1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-13 04:57:02 +02:00

archive-tar: keep const in checksum calculation

For correctness, don't needlessly drop the const qualifier when casting.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe 2012-05-18 07:18:11 +02:00 committed by Junio C Hamano
parent c51a351a6b
commit bf38245be8

View File

@ -101,13 +101,13 @@ static void strbuf_append_ext_header(struct strbuf *sb, const char *keyword,
static unsigned int ustar_header_chksum(const struct ustar_header *header)
{
char *p = (char *)header;
const char *p = (const char *)header;
unsigned int chksum = 0;
while (p < header->chksum)
chksum += *p++;
chksum += sizeof(header->chksum) * ' ';
p += sizeof(header->chksum);
while (p < (char *)header + sizeof(struct ustar_header))
while (p < (const char *)header + sizeof(struct ustar_header))
chksum += *p++;
return chksum;
}