From a02ef25970cb97ab4c29b3859799062431ae668b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 21 Dec 2019 21:50:11 +0100 Subject: Enable and fix warnings --- src/storage.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/storage.cpp') diff --git a/src/storage.cpp b/src/storage.cpp index b5e71b7..e611da0 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -258,7 +258,7 @@ Digest::Digest(const string & str) if (str.size() != 2 * size) throw runtime_error("invalid ref digest"); - for (int i = 0; i < size; i++) + for (size_t i = 0; i < size; i++) std::from_chars(str.data() + 2 * i, str.data() + 2 * i + 2, value[i], 16); @@ -267,7 +267,7 @@ Digest::Digest(const string & str) Digest::operator string() const { string res(size * 2, '0'); - for (int i = 0; i < size; i++) + for (size_t i = 0; i < size; i++) std::to_chars(res.data() + 2 * i + (value[i] < 0x10), res.data() + 2 * i + 2, value[i], 16); @@ -283,6 +283,7 @@ optional Ref::create(Storage st, const Digest & digest) auto p = new Priv { .storage = st, .digest = digest, + .object = {}, }; p->object = std::async(std::launch::deferred, [p] { @@ -502,7 +503,7 @@ optional Object::decode(Storage st, const vector & data) if (space == newline) return nullopt; - size_t size = std::stoi(string(space + 1, newline)); + ssize_t size = std::stoi(string(space + 1, newline)); if (data.end() - newline - 1 != size) return nullopt; -- cgit v1.2.3