aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicole Mazzuca <t-nimaz@microsoft.com>2019-07-10 17:39:04 -0700
committerNicole Mazzuca <t-nimaz@microsoft.com>2019-07-11 18:20:36 -0700
commitbb579072077153fabfa74acec852bce222265357 (patch)
tree835caef7d03a7ec3919763547f3d293cff895478
parent5b76f24f35976739991941d3b6289fb78fd93648 (diff)
downloadvcpkg-bb579072077153fabfa74acec852bce222265357.tar.gz
vcpkg-bb579072077153fabfa74acec852bce222265357.zip
make it compile on macos under g++6
-rw-r--r--toolsrc/include/vcpkg/base/strings.h6
-rw-r--r--toolsrc/include/vcpkg/base/work_queue.h4
-rw-r--r--toolsrc/src/vcpkg/base/files.cpp13
3 files changed, 11 insertions, 12 deletions
diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h
index 82145b826..9890bedbc 100644
--- a/toolsrc/include/vcpkg/base/strings.h
+++ b/toolsrc/include/vcpkg/base/strings.h
@@ -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;
diff --git a/toolsrc/include/vcpkg/base/work_queue.h b/toolsrc/include/vcpkg/base/work_queue.h
index 71e00a2ab..8a3d27538 100644
--- a/toolsrc/include/vcpkg/base/work_queue.h
+++ b/toolsrc/include/vcpkg/base/work_queue.h
@@ -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();
diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp
index f4c2106d4..8bc37819a 100644
--- a/toolsrc/src/vcpkg/base/files.cpp
+++ b/toolsrc/src/vcpkg/base/files.cpp
@@ -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};