+ unsigned char *MemberData = Buffer + sizeof(ar_hdr);
+ unsigned MemberSize = SizeFromHeader;
+ // Get name of archive member.
+ char *startp = Hdr->name;
+ char *endp = (char *) memchr (startp, '/', sizeof(ar_hdr));
+ if (memcmp (Hdr->name, "#1/", 3) == 0) {
+ // 4.4BSD/MacOSX long filenames are abbreviated as "#1/L", where L is an
+ // ASCII-coded decimal number representing the length of the name buffer,
+ // which is prepended to the archive member's contents.
+ unsigned NameLength = atoi (&Hdr->name[3]);
+ startp = (char *) MemberData;
+ endp = startp + NameLength;
+ MemberData += NameLength;
+ MemberSize -= NameLength;
+ } else if (startp == endp && isdigit (Hdr->name[1])) {
+ // SVR4 long filenames are abbreviated as "/I", where I is
+ // an ASCII-coded decimal index into the LongFilenames vector.
+ unsigned NameIndex = atoi (&Hdr->name[1]);
+ assert (LongFilenames.size () > NameIndex
+ && "SVR4-style long filename for archive member not found");
+ startp = &LongFilenames[NameIndex];
+ endp = strchr (startp, '/');
+ } else if (startp == endp && Hdr->name[1] == '/') {
+ // This is for the SVR4 long filename table (there might be other
+ // names starting with // but I don't know about them). Make sure that
+ // getObjectType sees it.
+ endp = &Hdr->name[sizeof (Hdr->name)];
+ }
+ if (!endp) {
+ // 4.4BSD/MacOSX *short* filenames are not guaranteed to have a
+ // terminator. Start at the end of the field and backtrack over spaces.
+ endp = startp + sizeof(Hdr->name);
+ while (endp[-1] == ' ')
+ --endp;
+ }
+ std::string MemberName (startp, endp);
+ std::string FullMemberName = ArchiveName + "(" + MemberName + ")";
+
+ switch (getObjectType(Hdr, MemberName, MemberData, MemberSize)) {