From: Joel Rosdahl Date: Sat, 5 Sep 2020 14:58:42 +0000 (+0200) Subject: Tweak some integer types X-Git-Tag: v4.0~126 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e56d12cf57c4a8371b3ebcb6c57e2846cf3b4119;p=thirdparty%2Fccache.git Tweak some integer types --- diff --git a/src/Util.cpp b/src/Util.cpp index e646aa81c..3e239bdac 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -552,7 +552,7 @@ format_parsable_size_with_suffix(uint64_t size) } else if (size >= 1000 * 1000) { return fmt::format("{:.1f}M", size / ((double)(1000 * 1000))); } else { - return fmt::format("{}", (unsigned)size); + return fmt::format("{}", size); } } @@ -743,7 +743,7 @@ get_path_in_cache(string_view cache_dir, path.reserve(path.size() + levels * 2 + 1 + name.length() - levels + suffix.length()); - unsigned level = 0; + uint32_t level = 0; for (; level < levels; ++level) { path.push_back('/'); path.push_back(name.at(level)); diff --git a/src/manifest.cpp b/src/manifest.cpp index e0d401b9f..57d621188 100644 --- a/src/manifest.cpp +++ b/src/manifest.cpp @@ -586,11 +586,11 @@ manifest_dump(const std::string& path, FILE* stream) } fmt::print(stream, "File paths ({}):\n", mf->files.size()); - for (unsigned i = 0; i < mf->files.size(); ++i) { + for (size_t i = 0; i < mf->files.size(); ++i) { fmt::print(stream, " {}: {}\n", i, mf->files[i]); } fmt::print(stream, "File infos ({}):\n", mf->file_infos.size()); - for (unsigned i = 0; i < mf->file_infos.size(); ++i) { + for (size_t i = 0; i < mf->file_infos.size(); ++i) { fmt::print(stream, " {}:\n", i); fmt::print(stream, " Path index: {}\n", mf->file_infos[i].index); fmt::print(stream, " Hash: {}\n", mf->file_infos[i].digest.to_string()); @@ -599,7 +599,7 @@ manifest_dump(const std::string& path, FILE* stream) fmt::print(stream, " Ctime: {}\n", mf->file_infos[i].ctime); } fmt::print(stream, "Results ({}):\n", mf->results.size()); - for (unsigned i = 0; i < mf->results.size(); ++i) { + for (size_t i = 0; i < mf->results.size(); ++i) { fmt::print(stream, " {}:\n", i); fmt::print(stream, " File info indexes:"); for (uint32_t file_info_index : mf->results[i].file_info_indexes) {