Add missing consts to pointer casts.

This commit is contained in:
Lasse Collin 2009-11-22 12:05:33 +02:00
parent b9b5c54cd4
commit f1a28b96c9
2 changed files with 5 additions and 4 deletions

View File

@ -49,7 +49,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
// Calculate the CRC32 using the slice-by-eight algorithm. // Calculate the CRC32 using the slice-by-eight algorithm.
while (buf < limit) { while (buf < limit) {
crc ^= *(uint32_t *)(buf); crc ^= *(const uint32_t *)(buf);
buf += 4; buf += 4;
crc = lzma_crc32_table[7][A(crc)] crc = lzma_crc32_table[7][A(crc)]
@ -57,7 +57,7 @@ lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
^ lzma_crc32_table[5][C(crc)] ^ lzma_crc32_table[5][C(crc)]
^ lzma_crc32_table[4][D(crc)]; ^ lzma_crc32_table[4][D(crc)];
const uint32_t tmp = *(uint32_t *)(buf); const uint32_t tmp = *(const uint32_t *)(buf);
buf += 4; buf += 4;
// At least with some compilers, it is critical for // At least with some compilers, it is critical for

View File

@ -46,9 +46,10 @@ lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc)
while (buf < limit) { while (buf < limit) {
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
const uint32_t tmp = (crc >> 32) ^ *(uint32_t *)(buf); const uint32_t tmp = (crc >> 32)
^ *(const uint32_t *)(buf);
#else #else
const uint32_t tmp = crc ^ *(uint32_t *)(buf); const uint32_t tmp = crc ^ *(const uint32_t *)(buf);
#endif #endif
buf += 4; buf += 4;