From: Rui Ueyama Date: Sat, 7 Jan 2017 08:32:07 +0000 (+0000) Subject: TarWriter: Use fitsInUstar function. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=edd4534a45df348c4ae87cfa8d08e719ae0c7085;p=llvm TarWriter: Use fitsInUstar function. This change should have been commit as part of r291340. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291341 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/TarWriter.cpp b/lib/Support/TarWriter.cpp index 5e45b36771f..57a4c8f4fc0 100644 --- a/lib/Support/TarWriter.cpp +++ b/lib/Support/TarWriter.cpp @@ -123,7 +123,7 @@ static std::pair splitPath(StringRef Path) { // Returns true if a given path can be stored to a Ustar header // without the PAX extension. -static bool fitInUstar(StringRef Path) { +static bool fitsInUstar(StringRef Path) { StringRef Prefix; StringRef Name; std::tie(Prefix, Name) = splitPath(Path); @@ -172,7 +172,7 @@ TarWriter::TarWriter(int FD, StringRef BaseDir) void TarWriter::append(StringRef Path, StringRef Data) { // Write Path and Data. std::string S = BaseDir + "/" + canonicalize(Path) + "\0"; - if (S.size() <= sizeof(UstarHeader::Name)) { + if (fitsInUstar(S)) { writeUstarHeader(OS, S, Data.size()); } else { writePaxHeader(OS, S);