[llvm] r291341 - TarWriter: Use fitsInUstar function.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 7 00:32:07 PST 2017
Author: ruiu
Date: Sat Jan 7 02:32:07 2017
New Revision: 291341
URL: http://llvm.org/viewvc/llvm-project?rev=291341&view=rev
Log:
TarWriter: Use fitsInUstar function.
This change should have been commit as part of r291340.
Modified:
llvm/trunk/lib/Support/TarWriter.cpp
Modified: llvm/trunk/lib/Support/TarWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TarWriter.cpp?rev=291341&r1=291340&r2=291341&view=diff
==============================================================================
--- llvm/trunk/lib/Support/TarWriter.cpp (original)
+++ llvm/trunk/lib/Support/TarWriter.cpp Sat Jan 7 02:32:07 2017
@@ -123,7 +123,7 @@ static std::pair<StringRef, StringRef> s
// 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 B
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);
More information about the llvm-commits
mailing list