make it compile on macos under g++6

This commit is contained in:
Nicole Mazzuca 2019-07-10 17:39:04 -07:00
parent 5b76f24f35
commit bb57907207
3 changed files with 11 additions and 12 deletions

View File

@ -191,7 +191,8 @@ namespace vcpkg::Strings
template <class Integral>
std::string b64url_encode(Integral x) {
static_assert(std::is_integral<Integral>::value, "b64url_encode must take an integer type");
auto value = static_cast<std::make_unsigned_t<Integral>>(x);
using Unsigned = std::make_unsigned_t<Integral>;
auto value = static_cast<Unsigned>(x);
// 64 values, plus the implicit \0
constexpr static char map[0x41] =
@ -202,8 +203,8 @@ namespace vcpkg::Strings
/*3*/ "wxyz0123456789-_"
;
constexpr static std::make_unsigned_t<Integral> mask = 0x3F;
constexpr static int shift = 5;
constexpr static auto mask = (static_cast<Unsigned>(1) << shift) - 1;
std::string result;
// reserve ceiling(number of bits / 3)
@ -212,6 +213,7 @@ namespace vcpkg::Strings
while (value != 0) {
char mapped_value = map[value & mask];
result.push_back(mapped_value);
value >>= shift;
}
return result;

View File

@ -103,7 +103,7 @@ namespace vcpkg {
m_actions.reserve(m_actions.size() + (last - first));
std::move(first, last, std::back_insert_iterator(rng));
std::move(first, last, std::back_inserter(rng));
}
m_cv.notify_all();
@ -122,7 +122,7 @@ namespace vcpkg {
m_actions.reserve(m_actions.size() + (last - first));
std::copy(first, last, std::back_insert_iterator(rng));
std::copy(first, last, std::back_inserter(rng));
}
m_cv.notify_all();

View File

@ -129,7 +129,7 @@ namespace vcpkg::Files
file_stream.read(&output[0], length);
file_stream.close();
return std::move(output);
return output;
}
virtual Expected<std::vector<std::string>> read_lines(const fs::path& file_path) const override
{
@ -147,7 +147,7 @@ namespace vcpkg::Files
}
file_stream.close();
return std::move(output);
return output;
}
virtual fs::path find_file_recursively_up(const fs::path& starting_dir,
const std::string& filename) const override
@ -372,9 +372,6 @@ namespace vcpkg::Files
void operator()(const fs::path& current_path, tld& info, const queue& queue) const {
std::error_code ec;
const auto type = fs::symlink_status(current_path, ec).type();
if (check_ec(ec, info, queue)) return;
const auto tmp_name = Strings::b64url_encode(info.index++);
const auto tmp_path = info.tmp_directory / tmp_name;
@ -387,16 +384,16 @@ namespace vcpkg::Files
const auto path_type = fs::symlink_status(path, ec).type();
std::atomic<std::uintmax_t> files_deleted = 0;
std::atomic<std::uintmax_t> files_deleted{0};
if (path_type == fs::file_type::directory) {
std::uint64_t index = 0;
std::mutex ec_mutex;
auto queue = remove::queue([&] {
remove::queue queue{[&] {
index += static_cast<std::uint64_t>(1) << 32;
return remove::tld{path, index, files_deleted, ec_mutex, ec};
});
}};
index += static_cast<std::uint64_t>(1) << 32;
auto main_tld = remove::tld{path, index, files_deleted, ec_mutex, ec};