[vcpkg baseline] [vs-yasm] Build yasm instead of downloading it to work around memory corruption bugs in yasm itself.
MODIFY
include/vcpkg/base/files.h
include/vcpkg/base/files.h
namespace fs
{
+ struct IsSlash
+ {
+ bool operator()(const wchar_t c) const noexcept { return c == L'/' || c == L'\\'; }
+ };
+
+ constexpr IsSlash is_slash;
+
#if VCPKG_USE_STD_FILESYSTEM
namespace stdfs = std::filesystem;
#else

MODIFY
src/vcpkg/base/files.cpp
src/vcpkg/base/files.cpp
#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);

MODIFY
src/vcpkg/commands.create.cpp
src/vcpkg/commands.create.cpp
#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}};

[vcpkg baseline] [vs-yasm] Build yasm instead of downloading it to work around memory corruption bugs in yasm itself. (#14003)