提交 bf38245b 编写于 作者: R René Scharfe 提交者: Junio C Hamano

archive-tar: keep const in checksum calculation

For correctness, don't needlessly drop the const qualifier when casting.
Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 c51a351a
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册