@@ -9,7 +9,7 @@ int check_hash(std::string_view str, std::string_view expect_md5) { | |||
browns::md5 hash; | |||
hash.feed(neo::buffer(str)); | |||
hash.pad(); | |||
auto dig = hash.digest(); | |||
auto dig = hash.digest(); | |||
auto dig_str = browns::format_digest(dig); | |||
if (dig_str != expect_md5) { | |||
std::cerr << "Hash of '" << str << "' did not match. Expected '" << expect_md5 | |||
@@ -27,7 +27,9 @@ int main() { | |||
n_fails += check_hash("The quick brown fox jumps over the lazy dog", | |||
"9e107d9d372bb6826bd81d3542a419d6"); | |||
n_fails += check_hash("", "d41d8cd98f00b204e9800998ecf8427e"); | |||
n_fails += check_hash("WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW", "967ce152b23edc20ebd23b7eba57277c"); | |||
n_fails += check_hash( | |||
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW", | |||
"967ce152b23edc20ebd23b7eba57277c"); | |||
n_fails += check_hash("WWWWWWWWWWWWWWWWWWWWWWWWWWWWW", "9aff577d3248b8889b22f24ee9665c17"); | |||
return n_fails; | |||
} |
@@ -23,10 +23,12 @@ package_manifest package_manifest::load_from_file(const fs::path& fpath) { | |||
lm::reject_unknown()); | |||
if (ret.name.empty()) { | |||
throw std::runtime_error(fmt::format("'Name' field in [{}] may not be an empty string", fpath.string())); | |||
throw std::runtime_error( | |||
fmt::format("'Name' field in [{}] may not be an empty string", fpath.string())); | |||
} | |||
if (version_str.empty()) { | |||
throw std::runtime_error(fmt::format("'Version' field in [{}] may not be an empty string", fpath.string())); | |||
throw std::runtime_error( | |||
fmt::format("'Version' field in [{}] may not be an empty string", fpath.string())); | |||
} | |||
ret.version = semver::version::parse(version_str); |
@@ -13,7 +13,7 @@ temporary_dir temporary_dir::create() { | |||
auto base = fs::temp_directory_path(); | |||
::UUID uuid; | |||
auto status = ::UuidCreate(&uuid); | |||
auto status = ::UuidCreate(&uuid); | |||
assert(status == RPC_S_OK || status == RPC_S_UUID_LOCAL_ONLY | |||
|| status == RPC_S_UUID_NO_ADDRESS); | |||
@@ -22,7 +22,7 @@ temporary_dir temporary_dir::create() { | |||
std::string uuid_std_str(reinterpret_cast<const char*>(uuid_str)); | |||
::RpcStringFree(&uuid_str); | |||
auto new_dir = base / ("dds-" + uuid_std_str); | |||
auto new_dir = base / ("dds-" + uuid_std_str); | |||
std::error_code ec; | |||
fs::create_directory(new_dir); | |||
return std::make_shared<impl>(std::move(new_dir)); |
@@ -236,7 +236,7 @@ public: | |||
}; | |||
template <typename... Items> | |||
auto read(std::string_view context[[maybe_unused]], const pair_list& pairs, Items... is) { | |||
auto read(std::string_view context [[maybe_unused]], const pair_list& pairs, Items... is) { | |||
std::vector<pair> bad_pairs; | |||
for (auto [key, value] : pairs.items()) { | |||
auto did_read = (is.read_one(context, key, value) || ...); |
@@ -102,7 +102,7 @@ constexpr const_buffer buffer(std::basic_string_view<Char, Traits> sv, std::size | |||
} | |||
template <typename Char, typename Traits> | |||
constexpr const_buffer buffer(std::basic_string_view<Char, Traits> sv) { | |||
constexpr const_buffer buffer(std::basic_string_view<Char, Traits> sv) { | |||
return buffer(sv, sv.size()); | |||
} | |||
@@ -3,8 +3,8 @@ | |||
#include <stdexcept> | |||
#include <string> | |||
#include <string_view> | |||
#include <vector> | |||
#include <tuple> | |||
#include <vector> | |||
namespace semver { | |||