about summary refs log tree commit diff
path: root/third_party/nix/src/libutil/archive.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-20T03·33+0100
committerVincent Ambo <tazjin@google.com>2020-05-20T03·33+0100
commitd331d3a0b5c497a46e2636f308234be66566c04c (patch)
tree92526b2f99456c09c5cc81233ed5a4311abe3d2b /third_party/nix/src/libutil/archive.cc
parentfed31b2c9b364fc1ed0b724c21b068cdedf46ee7 (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/libutil/archive.cc')
-rw-r--r--third_party/nix/src/libutil/archive.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/third_party/nix/src/libutil/archive.cc b/third_party/nix/src/libutil/archive.cc
index 855a3c465838..a316336ec73f 100644
--- a/third_party/nix/src/libutil/archive.cc
+++ b/third_party/nix/src/libutil/archive.cc
@@ -199,7 +199,7 @@ static void parse(ParseSink& sink, Source& source, const Path& path) {
 
   std::map<Path, int, CaseInsensitiveCompare> names;
 
-  while (1) {
+  while (true) {
     checkInterrupt();
 
     s = readString(source);
@@ -254,7 +254,7 @@ static void parse(ParseSink& sink, Source& source, const Path& path) {
         throw badArchive("expected open tag");
       }
 
-      while (1) {
+      while (true) {
         checkInterrupt();
 
         s = readString(source);
@@ -323,14 +323,14 @@ struct RestoreSink : ParseSink {
   Path dstPath;
   AutoCloseFD fd;
 
-  void createDirectory(const Path& path) {
+  void createDirectory(const Path& path) override {
     Path p = dstPath + path;
     if (mkdir(p.c_str(), 0777) == -1) {
       throw SysError(format("creating directory '%1%'") % p);
     }
   };
 
-  void createRegularFile(const Path& path) {
+  void createRegularFile(const Path& path) override {
     Path p = dstPath + path;
     fd = open(p.c_str(), O_CREAT | O_EXCL | O_WRONLY | O_CLOEXEC, 0666);
     if (!fd) {
@@ -338,7 +338,7 @@ struct RestoreSink : ParseSink {
     }
   }
 
-  void isExecutable() {
+  void isExecutable() override {
     struct stat st;
     if (fstat(fd.get(), &st) == -1) {
       throw SysError("fstat");
@@ -348,7 +348,7 @@ struct RestoreSink : ParseSink {
     }
   }
 
-  void preallocateContents(unsigned long long len) {
+  void preallocateContents(unsigned long long len) override {
 #if HAVE_POSIX_FALLOCATE
     if (len) {
       errno = posix_fallocate(fd.get(), 0, len);
@@ -363,11 +363,11 @@ struct RestoreSink : ParseSink {
 #endif
   }
 
-  void receiveContents(unsigned char* data, unsigned int len) {
+  void receiveContents(unsigned char* data, unsigned int len) override {
     writeFull(fd.get(), data, len);
   }
 
-  void createSymlink(const Path& path, const string& target) {
+  void createSymlink(const Path& path, const string& target) override {
     Path p = dstPath + path;
     nix::createSymlink(target, p);
   }