diff options
Diffstat (limited to 'third_party/nix/src/libutil/archive.cc')
-rw-r--r-- | third_party/nix/src/libutil/archive.cc | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/third_party/nix/src/libutil/archive.cc b/third_party/nix/src/libutil/archive.cc index 32bad07f22da..f78727c5fb46 100644 --- a/third_party/nix/src/libutil/archive.cc +++ b/third_party/nix/src/libutil/archive.cc @@ -38,7 +38,7 @@ static GlobalConfig::Register r1(&archiveSettings); const std::string narVersionMagic1 = "nix-archive-1"; -static string caseHackSuffix = "~nix~case~hack~"; +static std::string caseHackSuffix = "~nix~case~hack~"; PathFilter defaultPathFilter = [](const Path& /*unused*/) { return true; }; @@ -89,12 +89,12 @@ static void dump(const Path& path, Sink& sink, PathFilter& filter) { /* If we're on a case-insensitive system like macOS, undo the case hack applied by restorePath(). */ - std::map<string, string> unhacked; + std::map<std::string, std::string> unhacked; for (auto& i : readDirectory(path)) { if (archiveSettings.useCaseHack) { - string name(i.name); + std::string name(i.name); size_t pos = i.name.find(caseHackSuffix); - if (pos != string::npos) { + if (pos != std::string::npos) { DLOG(INFO) << "removing case hack suffix from " << path << "/" << i.name; @@ -145,7 +145,7 @@ void dumpString(const std::string& s, Sink& sink) { << "contents" << s << ")"; } -static SerialisationError badArchive(const string& s) { +static SerialisationError badArchive(const std::string& s) { return SerialisationError("bad archive: " + s); } @@ -182,13 +182,13 @@ static void parseContents(ParseSink& sink, Source& source, const Path& path) { } struct CaseInsensitiveCompare { - bool operator()(const string& a, const string& b) const { + bool operator()(const std::string& a, const std::string& b) const { return strcasecmp(a.c_str(), b.c_str()) < 0; } }; static void parse(ParseSink& sink, Source& source, const Path& path) { - string s; + std::string s; s = readString(source); if (s != "(") { @@ -212,7 +212,7 @@ static void parse(ParseSink& sink, Source& source, const Path& path) { if (type != tpUnknown) { throw badArchive("multiple type fields"); } - string t = readString(source); + std::string t = readString(source); if (t == "regular") { type = tpRegular; @@ -247,8 +247,8 @@ static void parse(ParseSink& sink, Source& source, const Path& path) { } else if (s == "entry" && type == tpDirectory) { - string name; - string prevName; + std::string name; + std::string prevName; s = readString(source); if (s != "(") { @@ -266,8 +266,8 @@ static void parse(ParseSink& sink, Source& source, const Path& path) { if (s == "name") { name = readString(source); if (name.empty() || name == "." || name == ".." || - name.find('/') != string::npos || - name.find((char)0) != string::npos) { + name.find('/') != std::string::npos || + name.find((char)0) != std::string::npos) { throw Error(format("NAR contains invalid file name '%1%'") % name); } if (name <= prevName) { @@ -297,7 +297,7 @@ static void parse(ParseSink& sink, Source& source, const Path& path) { } else if (s == "target" && type == tpSymlink) { - string target = readString(source); + std::string target = readString(source); sink.createSymlink(path, target); } @@ -308,7 +308,7 @@ static void parse(ParseSink& sink, Source& source, const Path& path) { } void parseDump(ParseSink& sink, Source& source) { - string version; + std::string version; try { version = readString(source, narVersionMagic1.size()); } catch (SerialisationError& e) { @@ -369,7 +369,7 @@ struct RestoreSink : ParseSink { writeFull(fd.get(), data, len); } - void createSymlink(const Path& path, const string& target) override { + void createSymlink(const Path& path, const std::string& target) override { Path p = dstPath + path; nix::createSymlink(target, p); } |