[llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveReader.cpp

Reid Spencer reid at x10sys.com
Wed Nov 17 08:13:22 PST 2004



Changes in directory llvm/lib/Bytecode/Archive:

ArchiveReader.cpp updated: 1.25 -> 1.26
---
Log message:

Despite documentation to the contrary, Mac OSX and BSD 4.4 archive formats
*do* include the length of the long file in the length of the member and
they are *not* null terminated. 


---
Diffs of the changes:  (+3 -2)

Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp
diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.25 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.26
--- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.25	Tue Nov 16 00:47:19 2004
+++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp	Wed Nov 17 10:13:11 2004
@@ -97,7 +97,8 @@
         if (isdigit(Hdr->name[3])) {
           unsigned len = atoi(&Hdr->name[3]);
           pathname.assign(At,len);
-          At += len + 1; // terminated by \n
+          At += len;
+          MemberSize -= len;
           flags |= ArchiveMember::HasLongFilenameFlag;
         } else
           throw std::string("invalid long filename");
@@ -155,7 +156,7 @@
     default:
       char* slash = (char*) memchr(Hdr->name,'/',16);
       if (slash == 0)
-        throw std::string("missing name terminator");
+        slash = Hdr->name + 16;
       pathname.assign(Hdr->name,slash-Hdr->name);
       break;
   }






More information about the llvm-commits mailing list