From 5a839e938bad5b766a928fb545f0b0aba39e3829 Mon Sep 17 00:00:00 2001 From: Bruce Dawson Date: Wed, 30 Mar 2016 15:26:59 -0700 Subject: Fix C4434 warning about 32-bit shift assigned to 64-bits VS 2015 has a new or louder warning about 32-bit shifts that are then assigned to a 64-bit target. This type of code triggers it: int64_t size = 1 << shift_amount; Because the '1' being shifted is a 32-bit int the result of the shift will be a 32-bit result, so assigning it to a 64-bit variable is just misleading. In this case the code that triggers it is this: m_IAID.resize(1 << SBSYMCODELEN); The destination is a size_t so the warning only shows up on 64-bit builds and doesn't indicate a real bug. But, casting the '1' constant to size_t makes the behavior/intent more obvious and consistent and allows enabling C4334 in Chromium. BUG=593448 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1843253002 . --- core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp index 6be90941d6..140ca38f99 100644 --- a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp +++ b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp @@ -75,7 +75,7 @@ bool CJBig2_ArithIntDecoder::decode(CJBig2_ArithDecoder* pArithDecoder, CJBig2_ArithIaidDecoder::CJBig2_ArithIaidDecoder(unsigned char SBSYMCODELENA) : SBSYMCODELEN(SBSYMCODELENA) { - m_IAID.resize(1 << SBSYMCODELEN); + m_IAID.resize(static_cast(1) << SBSYMCODELEN); } CJBig2_ArithIaidDecoder::~CJBig2_ArithIaidDecoder() {} -- cgit v1.2.3