diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2015-02-03 21:45:53 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2015-02-03 21:45:53 +0200 |
commit | b9a5b6b7a29029680af733082b6a46e0fc01623a (patch) | |
tree | 775fa4115d88b938d39127410d620008057441ce /src | |
parent | liblzma: Set LZMA_MEMCMPLEN_EXTRA depending on the compare method. (diff) | |
download | xz-b9a5b6b7a29029680af733082b6a46e0fc01623a.tar.xz |
Add a few casts to tuklib_integer.h to silence possible warnings.
I heard that Visual Studio 2013 gave warnings without the casts.
Thanks to Gabi Davar.
Diffstat (limited to '')
-rw-r--r-- | src/common/tuklib_integer.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/common/tuklib_integer.h b/src/common/tuklib_integer.h index e6daa772..a7fda679 100644 --- a/src/common/tuklib_integer.h +++ b/src/common/tuklib_integer.h @@ -321,8 +321,8 @@ unaligned_read32le(const uint8_t *buf) static inline void unaligned_write16be(uint8_t *buf, uint16_t num) { - buf[0] = num >> 8; - buf[1] = num; + buf[0] = (uint8_t)(num >> 8); + buf[1] = (uint8_t)num; return; } @@ -330,8 +330,8 @@ unaligned_write16be(uint8_t *buf, uint16_t num) static inline void unaligned_write16le(uint8_t *buf, uint16_t num) { - buf[0] = num; - buf[1] = num >> 8; + buf[0] = (uint8_t)num; + buf[1] = (uint8_t)(num >> 8); return; } @@ -339,10 +339,10 @@ unaligned_write16le(uint8_t *buf, uint16_t num) static inline void unaligned_write32be(uint8_t *buf, uint32_t num) { - buf[0] = num >> 24; - buf[1] = num >> 16; - buf[2] = num >> 8; - buf[3] = num; + buf[0] = (uint8_t)(num >> 24); + buf[1] = (uint8_t)(num >> 16); + buf[2] = (uint8_t)(num >> 8); + buf[3] = (uint8_t)num; return; } @@ -350,10 +350,10 @@ unaligned_write32be(uint8_t *buf, uint32_t num) static inline void unaligned_write32le(uint8_t *buf, uint32_t num) { - buf[0] = num; - buf[1] = num >> 8; - buf[2] = num >> 16; - buf[3] = num >> 24; + buf[0] = (uint8_t)num; + buf[1] = (uint8_t)(num >> 8); + buf[2] = (uint8_t)(num >> 16); + buf[3] = (uint8_t)(num >> 24); return; } |