Mark checkSignature const, and in turn stop casting away const from

ArchiveMemberHeader. Found by gcc48 -Wcast-qual.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163255 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Roman Divacky 2012-09-05 22:09:23 +00:00
parent 141e99745a
commit 651e800def
2 changed files with 3 additions and 3 deletions

View File

@ -66,7 +66,7 @@ namespace llvm {
fmag[1] = '\n';
}
bool checkSignature() {
bool checkSignature() const {
return 0 == memcmp(fmag, ARFILE_MEMBER_MAGIC,2);
}
};

View File

@ -79,7 +79,7 @@ Archive::parseMemberHeader(const char*& At, const char* End, std::string* error)
}
// Cast archive member header
ArchiveMemberHeader* Hdr = (ArchiveMemberHeader*)At;
const ArchiveMemberHeader* Hdr = (const ArchiveMemberHeader*)At;
At += sizeof(ArchiveMemberHeader);
int flags = 0;
@ -196,7 +196,7 @@ Archive::parseMemberHeader(const char*& At, const char* End, std::string* error)
/* FALL THROUGH */
default:
char* slash = (char*) memchr(Hdr->name, '/', 16);
const char* slash = (const char*) memchr(Hdr->name, '/', 16);
if (slash == 0)
slash = Hdr->name + 16;
pathname.assign(Hdr->name, slash - Hdr->name);