mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
TarWriter: Use fitsInUstar function.
This change should have been commit as part of r291340. llvm-svn: 291341
This commit is contained in:
parent
4b6763fe74
commit
a5652428f7
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user