summaryrefslogtreecommitdiff
path: root/src/storage.cpp
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2019-12-21 21:50:11 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2019-12-21 21:50:11 +0100
commita02ef25970cb97ab4c29b3859799062431ae668b (patch)
tree1c9b32ff49ada7e89fe5bd966b0eb194f042e60e /src/storage.cpp
parentf94443c63dfd63300e5bd29889935fd1f451175e (diff)
Enable and fix warnings
Diffstat (limited to 'src/storage.cpp')
-rw-r--r--src/storage.cpp7
1 files changed, 4 insertions, 3 deletions
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> 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> Object::decode(Storage st, const vector<uint8_t> & 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;