Skip to content

Commit

Permalink
archive-tar: keep const in checksum calculation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
René Scharfe authored and gitster committed May 18, 2012
1 parent c51a351 commit bf38245
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions archive-tar.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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) 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; unsigned int chksum = 0;
while (p < header->chksum) while (p < header->chksum)
chksum += *p++; chksum += *p++;
chksum += sizeof(header->chksum) * ' '; chksum += sizeof(header->chksum) * ' ';
p += 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++; chksum += *p++;
return chksum; return chksum;
} }
Expand Down

0 comments on commit bf38245

Please sign in to comment.