aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-04 06:19:43 +0000
committerChris Lattner <sabre@nondot.org>2010-02-04 06:19:43 +0000
commit463330684406c9d2fe2e9d7078c54b9d9f06dd52 (patch)
tree0b55c65879f5b06b239ae37f6a438a8e85e23da2
parentea4b6dfd8fc506d127e08770d21a81fe269177b2 (diff)
downloadexternal_llvm-463330684406c9d2fe2e9d7078c54b9d9f06dd52.zip
external_llvm-463330684406c9d2fe2e9d7078c54b9d9f06dd52.tar.gz
external_llvm-463330684406c9d2fe2e9d7078c54b9d9f06dd52.tar.bz2
From PR6228:
"Attached patch removes the extra NUL bytes from the output and changes test/Archive/MacOSX.toc from a binary to a text file (removes svn:mime-type=application/octet-stream and adds svn:eol-style=native). I can't figure out how to get SVN to include the new contents of the file in the patch so I'm attaching it separately." Patch by James Abbatiello! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95292 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Archive/ArchiveReader.cpp3
-rw-r--r--test/Archive/MacOSX.tocbin97 -> 72 bytes
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp
index a0c42b5..3ef15d2 100644
--- a/lib/Archive/ArchiveReader.cpp
+++ b/lib/Archive/ArchiveReader.cpp
@@ -120,7 +120,8 @@ Archive::parseMemberHeader(const char*& At, const char* End, std::string* error)
if (Hdr->name[1] == '1' && Hdr->name[2] == '/') {
if (isdigit(Hdr->name[3])) {
unsigned len = atoi(&Hdr->name[3]);
- pathname.assign(At, len);
+ const char *nulp = (const char *)memchr(At, '\0', len);
+ pathname.assign(At, nulp != 0 ? nulp - At : len);
At += len;
MemberSize -= len;
flags |= ArchiveMember::HasLongFilenameFlag;
diff --git a/test/Archive/MacOSX.toc b/test/Archive/MacOSX.toc
index 61cbd3b..f971df7 100644
--- a/test/Archive/MacOSX.toc
+++ b/test/Archive/MacOSX.toc
Binary files differ