summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2017-01-07 08:32:07 +0000
committerRui Ueyama <ruiu@google.com>2017-01-07 08:32:07 +0000
commitd52f4b86f3e9babaa457bf15be73e92ad82eee31 (patch)
treeb1ea2b27868d8298bb5e2dcd82d49bcffca2ffb5
parent999f094aa3ccda4708fd7290f44cb9ae68666e54 (diff)
downloadbcm5719-llvm-d52f4b86f3e9babaa457bf15be73e92ad82eee31.tar.gz
bcm5719-llvm-d52f4b86f3e9babaa457bf15be73e92ad82eee31.zip
TarWriter: Use fitsInUstar function.
This change should have been commit as part of r291340. llvm-svn: 291341
-rw-r--r--llvm/lib/Support/TarWriter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/TarWriter.cpp b/llvm/lib/Support/TarWriter.cpp
index 5e45b36771f..57a4c8f4fc0 100644
--- a/llvm/lib/Support/TarWriter.cpp
+++ b/llvm/lib/Support/TarWriter.cpp
@@ -123,7 +123,7 @@ static std::pair<StringRef, StringRef> 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);
OpenPOWER on IntegriCloud