From 6920c71f0aa0dbfc0da435f86ed13dfc7b145ffc Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Sat, 1 Sep 2012 07:21:45 -0700 Subject: [PATCH] fix MSVC warnings regarding implicit uint64 to uint32 conversions Change-Id: I284dae9222a3817bba3c5ba6be271b31b5bf660d --- src/utils/bit_reader.c | 4 ++-- src/utils/bit_reader.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/bit_reader.c b/src/utils/bit_reader.c index 1afb1db8..73eaafcb 100644 --- a/src/utils/bit_reader.c +++ b/src/utils/bit_reader.c @@ -169,7 +169,7 @@ void VP8LFillBitWindow(VP8LBitReader* const br) { } uint32_t VP8LReadOneBit(VP8LBitReader* const br) { - const uint32_t val = (br->val_ >> br->bit_pos_) & 1; + const uint32_t val = (uint32_t)((br->val_ >> br->bit_pos_) & 1); // Flag an error at end_of_stream. if (!br->eos_) { ++br->bit_pos_; @@ -198,7 +198,7 @@ uint32_t VP8LReadBits(VP8LBitReader* const br, int n_bits) { if ((br->bit_pos_ + n_bits) > 64) return val; } } - val = (br->val_ >> br->bit_pos_) & kBitMask[n_bits]; + val = (uint32_t)((br->val_ >> br->bit_pos_) & kBitMask[n_bits]); br->bit_pos_ += n_bits; if (br->bit_pos_ >= 40) { if (br->pos_ + 5 < br->len_) { diff --git a/src/utils/bit_reader.h b/src/utils/bit_reader.h index 36fc13e2..3cf7c30c 100644 --- a/src/utils/bit_reader.h +++ b/src/utils/bit_reader.h @@ -121,7 +121,7 @@ static WEBP_INLINE int VP8BitUpdate(VP8BitReader* const br, bit_t split) { static WEBP_INLINE void VP8Shift(VP8BitReader* const br) { // range_ is in [0..127] interval here. - const int idx = br->range_ >> (BITS); + const bit_t idx = br->range_ >> (BITS); const int shift = kVP8Log2Range[idx]; br->range_ = kVP8NewRange[idx]; br->value_ <<= shift; @@ -182,7 +182,7 @@ uint32_t VP8LReadOneBit(VP8LBitReader* const br); // 32 times after the last VP8LFillBitWindow. Any subsequent calls // (without VP8LFillBitWindow) will return invalid data. static WEBP_INLINE uint32_t VP8LReadOneBitUnsafe(VP8LBitReader* const br) { - const uint32_t val = (br->val_ >> br->bit_pos_) & 1; + const uint32_t val = (uint32_t)((br->val_ >> br->bit_pos_) & 1); ++br->bit_pos_; return val; }