diff options
| author | Billy O'Neal <bion@microsoft.com> | 2020-10-28 14:26:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-28 14:26:41 -0700 |
| commit | 1b1c17de8206231831b2bc8a06cff80506184be1 (patch) | |
| tree | b14e701224a7b12015ec3fef4782332251cd34de /toolsrc/src | |
| parent | 0ff714bd520f5315081db50acce43644832451ba (diff) | |
| download | vcpkg-1b1c17de8206231831b2bc8a06cff80506184be1.tar.gz vcpkg-1b1c17de8206231831b2bc8a06cff80506184be1.zip | |
[vcpkg baseline] [vs-yasm] Build yasm instead of downloading it to work around memory corruption bugs in yasm itself. (#14003)
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg/base/files.cpp | 13 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.create.cpp | 12 |
2 files changed, 13 insertions, 12 deletions
diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index d00b9b7a6..ee3a339e0 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -23,16 +23,6 @@ #include <algorithm> #include <string> -namespace -{ - struct IsSlash - { - bool operator()(const wchar_t c) const noexcept { return c == L'/' || c == L'\\'; } - }; - - constexpr IsSlash is_slash; -} // unnamed namespace - #if defined(_WIN32) namespace { @@ -1277,6 +1267,7 @@ namespace vcpkg::Files #ifdef _WIN32 fs::path win32_fix_path_case(const fs::path& source) { + using fs::is_slash; const std::wstring& native = source.native(); if (native.empty()) { @@ -1381,7 +1372,7 @@ namespace vcpkg::Files std::string result; const auto base_size = base.size(); const auto file_size = file.size(); - if (base_size != 0 && !is_slash(base.data()[base_size - 1])) + if (base_size != 0 && !fs::is_slash(base.data()[base_size - 1])) { result.reserve(base_size + file_size + 1); result.append(base.data(), base_size); diff --git a/toolsrc/src/vcpkg/commands.create.cpp b/toolsrc/src/vcpkg/commands.create.cpp index b14b47a8f..c3268bd5e 100644 --- a/toolsrc/src/vcpkg/commands.create.cpp +++ b/toolsrc/src/vcpkg/commands.create.cpp @@ -8,6 +8,16 @@ #include <vcpkg/vcpkgcmdarguments.h> #include <vcpkg/vcpkgpaths.h> +namespace +{ + std::string remove_trailing_slashes(std::string argument) + { + using fs::is_slash; + argument.erase(std::find_if_not(argument.rbegin(), argument.rend(), is_slash).base(), argument.end()); + return argument; + } +} + namespace vcpkg::Commands::Create { const CommandStructure COMMAND_STRUCTURE = { @@ -22,7 +32,7 @@ namespace vcpkg::Commands::Create { (void)args.parse_arguments(COMMAND_STRUCTURE); const std::string port_name = args.command_arguments.at(0); - const std::string url = args.command_arguments.at(1); + const std::string url = remove_trailing_slashes(args.command_arguments.at(1)); std::vector<System::CMakeVariable> cmake_args{{"CMD", "CREATE"}, {"PORT", port_name}, {"URL", url}}; |
