diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2018-05-02T11·56+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2018-05-02T11·56+0200 |
commit | 53ec5ac69f59ac435b18297a594933e83e236766 (patch) | |
tree | f50797b3f3338de1d471a9b6f3b3e377813f09c9 /src/libutil | |
parent | 548ad391d96d8922d0f8c35b5dd72bf4fb7e3ed1 (diff) |
Fix some random -Wconversion warnings
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/hash.cc | 2 | ||||
-rw-r--r-- | src/libutil/serialise.hh | 4 | ||||
-rw-r--r-- | src/libutil/xml-writer.cc | 4 | ||||
-rw-r--r-- | src/libutil/xml-writer.hh | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/libutil/hash.cc b/src/libutil/hash.cc index a01d651e1ef5..9d82f13a5e38 100644 --- a/src/libutil/hash.cc +++ b/src/libutil/hash.cc @@ -82,7 +82,7 @@ static string printHash32(const Hash & hash) string s; s.reserve(len); - for (int n = len - 1; n >= 0; n--) { + for (int n = (int) len - 1; n >= 0; n--) { unsigned int b = n * 5; unsigned int i = b / 8; unsigned int j = b % 8; diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh index d0b4552e3399..6e703c52a1e3 100644 --- a/src/libutil/serialise.hh +++ b/src/libutil/serialise.hh @@ -227,7 +227,7 @@ inline Sink & operator << (Sink & sink, uint64_t n) buf[4] = (n >> 32) & 0xff; buf[5] = (n >> 40) & 0xff; buf[6] = (n >> 48) & 0xff; - buf[7] = (n >> 56) & 0xff; + buf[7] = (unsigned char) (n >> 56) & 0xff; sink(buf, sizeof(buf)); return sink; } @@ -259,7 +259,7 @@ T readNum(Source & source) if (n > std::numeric_limits<T>::max()) throw SerialisationError("serialised integer %d is too large for type '%s'", n, typeid(T).name()); - return n; + return (T) n; } diff --git a/src/libutil/xml-writer.cc b/src/libutil/xml-writer.cc index 98bd058d18be..e5cc2e9fc719 100644 --- a/src/libutil/xml-writer.cc +++ b/src/libutil/xml-writer.cc @@ -28,7 +28,7 @@ void XMLWriter::close() } -void XMLWriter::indent_(unsigned int depth) +void XMLWriter::indent_(size_t depth) { if (!indent) return; output << string(depth * 2, ' '); @@ -75,7 +75,7 @@ void XMLWriter::writeAttrs(const XMLAttrs & attrs) { for (auto & i : attrs) { output << " " << i.first << "=\""; - for (unsigned int j = 0; j < i.second.size(); ++j) { + for (size_t j = 0; j < i.second.size(); ++j) { char c = i.second[j]; if (c == '"') output << """; else if (c == '<') output << "<"; diff --git a/src/libutil/xml-writer.hh b/src/libutil/xml-writer.hh index 3cefe3712c08..b98b445265a2 100644 --- a/src/libutil/xml-writer.hh +++ b/src/libutil/xml-writer.hh @@ -44,7 +44,7 @@ public: private: void writeAttrs(const XMLAttrs & attrs); - void indent_(unsigned int depth); + void indent_(size_t depth); }; |