diff options
author | Bruce Dawson <brucedawson@chromium.org> | 2016-03-30 15:26:59 -0700 |
---|---|---|
committer | Bruce Dawson <brucedawson@chromium.org> | 2016-03-30 15:26:59 -0700 |
commit | 5a839e938bad5b766a928fb545f0b0aba39e3829 (patch) | |
tree | 280c8b8a340af1425d513ca22351b704ba8c0776 /core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp | |
parent | ac88953dfa7c1a68c69989d61d7bc03c0595064b (diff) | |
download | pdfium-5a839e938bad5b766a928fb545f0b0aba39e3829.tar.xz |
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 .
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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<size_t>(1) << SBSYMCODELEN); } CJBig2_ArithIaidDecoder::~CJBig2_ArithIaidDecoder() {} |