diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-20T03·33+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-20T03·33+0100 |
commit | d331d3a0b5c497a46e2636f308234be66566c04c (patch) | |
tree | 92526b2f99456c09c5cc81233ed5a4311abe3d2b /third_party/nix/src/libstore/download.cc | |
parent | fed31b2c9b364fc1ed0b724c21b068cdedf46ee7 (diff) |
refactor(3p/nix): Apply clang-tidy's modernize-* fixes r/787
This applies the modernization fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html The 'modernize-use-trailing-return-type' fix was excluded due to my personal preference (more specifically, I think the 'auto' keyword is misleading in that position).
Diffstat (limited to 'third_party/nix/src/libstore/download.cc')
-rw-r--r-- | third_party/nix/src/libstore/download.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/third_party/nix/src/libstore/download.cc b/third_party/nix/src/libstore/download.cc index 4b90a3765724..eb7095ee146a 100644 --- a/third_party/nix/src/libstore/download.cc +++ b/third_party/nix/src/libstore/download.cc @@ -45,7 +45,7 @@ std::string resolveUri(const std::string& uri) { } struct CurlDownloader : public Downloader { - CURLM* curlm = 0; + CURLM* curlm = nullptr; std::random_device rd; std::mt19937 mt19937; @@ -57,7 +57,7 @@ struct CurlDownloader : public Downloader { bool done = false; // whether either the success or failure function has // been called Callback<DownloadResult> callback; - CURL* req = 0; + CURL* req = nullptr; bool active = false; // whether the handle has been added to the multi object std::string status; @@ -68,7 +68,7 @@ struct CurlDownloader : public Downloader { has been reached. */ std::chrono::steady_clock::time_point embargo; - struct curl_slist* requestHeaders = 0; + struct curl_slist* requestHeaders = nullptr; std::string encoding; @@ -523,7 +523,7 @@ struct CurlDownloader : public Downloader { workerThread = std::thread([&]() { workerThreadEntry(); }); } - ~CurlDownloader() { + ~CurlDownloader() override { stopWorkerThread(); workerThread.join(); @@ -909,7 +909,7 @@ CachedDownloadResult Downloader::downloadCached( if (ss.size() >= 3 && ss[0] == url) { time_t lastChecked; if (string2Int(ss[2], lastChecked) && - (uint64_t)lastChecked + request.ttl >= (uint64_t)time(0)) { + (uint64_t)lastChecked + request.ttl >= (uint64_t)time(nullptr)) { skip = true; result.effectiveUri = request.uri; result.etag = ss[1]; @@ -949,8 +949,8 @@ CachedDownloadResult Downloader::downloadCached( assert(!storePath.empty()); replaceSymlink(storePath, fileLink); - writeFile(dataFile, - url + "\n" + res.etag + "\n" + std::to_string(time(0)) + "\n"); + writeFile(dataFile, url + "\n" + res.etag + "\n" + + std::to_string(time(nullptr)) + "\n"); } catch (DownloadError& e) { if (storePath.empty()) { throw; |