diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-20T21·27+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-20T21·27+0100 |
commit | 689ef502f5b0655c9923ed77da2ae3504630f473 (patch) | |
tree | 3e331c153646f136875f047cc3b9f0aad8c86341 /third_party/nix/src/libstore/nar-info-disk-cache.cc | |
parent | d331d3a0b5c497a46e2636f308234be66566c04c (diff) |
refactor(3p/nix): Apply clang-tidy's readability-* fixes r/788
This applies the readability fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html
Diffstat (limited to 'third_party/nix/src/libstore/nar-info-disk-cache.cc')
-rw-r--r-- | third_party/nix/src/libstore/nar-info-disk-cache.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/third_party/nix/src/libstore/nar-info-disk-cache.cc b/third_party/nix/src/libstore/nar-info-disk-cache.cc index 7ef178ab4388..19ef2c9d7461 100644 --- a/third_party/nix/src/libstore/nar-info-disk-cache.cc +++ b/third_party/nix/src/libstore/nar-info-disk-cache.cc @@ -142,7 +142,7 @@ class NarInfoDiskCacheImpl : public NarInfoDiskCache { }); } - Cache& getCache(State& state, const std::string& uri) { + static Cache& getCache(State& state, const std::string& uri) { auto i = state.caches.find(uri); if (i == state.caches.end()) { abort(); @@ -158,7 +158,8 @@ class NarInfoDiskCacheImpl : public NarInfoDiskCache { // FIXME: race state->insertCache - .use()(uri)(time(nullptr))(storeDir)(wantMassQuery)(priority) + .use()(uri)(time(nullptr))(storeDir)( + static_cast<int64_t>(wantMassQuery))(priority) .exec(); assert(sqlite3_changes(state->db) == 1); state->caches[uri] = Cache{(int)sqlite3_last_insert_rowid(state->db), @@ -209,7 +210,7 @@ class NarInfoDiskCacheImpl : public NarInfoDiskCache { return {oUnknown, nullptr}; } - if (!queryNAR.getInt(0)) { + if (queryNAR.getInt(0) == 0) { return {oInvalid, nullptr}; } @@ -262,10 +263,10 @@ class NarInfoDiskCacheImpl : public NarInfoDiskCache { narInfo && narInfo->fileHash)( narInfo ? narInfo->fileSize : 0, narInfo != nullptr && - narInfo->fileSize)(info->narHash.to_string())( + (narInfo->fileSize != 0u))(info->narHash.to_string())( info->narSize)(concatStringsSep(" ", info->shortRefs()))( - info->deriver != "" ? baseNameOf(info->deriver) : "", - info->deriver != "")(concatStringsSep(" ", info->sigs))( + !info->deriver.empty() ? baseNameOf(info->deriver) : "", + !info->deriver.empty())(concatStringsSep(" ", info->sigs))( info->ca)(time(nullptr)) .exec(); |