mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17909 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ced8222405
commit
dd95e8d71e
@ -97,7 +97,8 @@ Archive::parseMemberHeader(const char*& At, const char* End) {
|
|||||||
if (isdigit(Hdr->name[3])) {
|
if (isdigit(Hdr->name[3])) {
|
||||||
unsigned len = atoi(&Hdr->name[3]);
|
unsigned len = atoi(&Hdr->name[3]);
|
||||||
pathname.assign(At,len);
|
pathname.assign(At,len);
|
||||||
At += len + 1; // terminated by \n
|
At += len;
|
||||||
|
MemberSize -= len;
|
||||||
flags |= ArchiveMember::HasLongFilenameFlag;
|
flags |= ArchiveMember::HasLongFilenameFlag;
|
||||||
} else
|
} else
|
||||||
throw std::string("invalid long filename");
|
throw std::string("invalid long filename");
|
||||||
@ -155,7 +156,7 @@ Archive::parseMemberHeader(const char*& At, const char* End) {
|
|||||||
default:
|
default:
|
||||||
char* slash = (char*) memchr(Hdr->name,'/',16);
|
char* slash = (char*) memchr(Hdr->name,'/',16);
|
||||||
if (slash == 0)
|
if (slash == 0)
|
||||||
throw std::string("missing name terminator");
|
slash = Hdr->name + 16;
|
||||||
pathname.assign(Hdr->name,slash-Hdr->name);
|
pathname.assign(Hdr->name,slash-Hdr->name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,8 @@ Archive::parseMemberHeader(const char*& At, const char* End) {
|
|||||||
if (isdigit(Hdr->name[3])) {
|
if (isdigit(Hdr->name[3])) {
|
||||||
unsigned len = atoi(&Hdr->name[3]);
|
unsigned len = atoi(&Hdr->name[3]);
|
||||||
pathname.assign(At,len);
|
pathname.assign(At,len);
|
||||||
At += len + 1; // terminated by \n
|
At += len;
|
||||||
|
MemberSize -= len;
|
||||||
flags |= ArchiveMember::HasLongFilenameFlag;
|
flags |= ArchiveMember::HasLongFilenameFlag;
|
||||||
} else
|
} else
|
||||||
throw std::string("invalid long filename");
|
throw std::string("invalid long filename");
|
||||||
@ -155,7 +156,7 @@ Archive::parseMemberHeader(const char*& At, const char* End) {
|
|||||||
default:
|
default:
|
||||||
char* slash = (char*) memchr(Hdr->name,'/',16);
|
char* slash = (char*) memchr(Hdr->name,'/',16);
|
||||||
if (slash == 0)
|
if (slash == 0)
|
||||||
throw std::string("missing name terminator");
|
slash = Hdr->name + 16;
|
||||||
pathname.assign(Hdr->name,slash-Hdr->name);
|
pathname.assign(Hdr->name,slash-Hdr->name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user