summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/fx_codec_flate.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-03-15 13:26:37 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-03-15 21:10:29 +0000
commita12159b17085796e2b72d2b49e850092e0b4e8b7 (patch)
treedf7a5d149c9bbfe5c2d2ec16631c3dcb6ae9a901 /core/fxcodec/codec/fx_codec_flate.cpp
parent59d9416553b293f6df923c2f3ef33def2d51d7b7 (diff)
downloadpdfium-a12159b17085796e2b72d2b49e850092e0b4e8b7.tar.xz
Refactor some CPDF_ColorSpace code.
Change-Id: I1e30d68dae3bf70cf3c426f6126d593b7f1c3ba4 Reviewed-on: https://pdfium-review.googlesource.com/2991 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/fx_codec_flate.cpp')
-rw-r--r--core/fxcodec/codec/fx_codec_flate.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp
index 2ba505d059..f908908062 100644
--- a/core/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/fxcodec/codec/fx_codec_flate.cpp
@@ -161,7 +161,7 @@ int CLZWDecoder::Decode(uint8_t* dest_buf,
m_pOutput = dest_buf;
m_Early = bEarlyChange ? 1 : 0;
m_nCodes = 0;
- uint32_t old_code = (uint32_t)-1;
+ uint32_t old_code = 0xFFFFFFFF;
uint8_t last_char = 0;
while (1) {
if (m_InPos + m_CodeLen > src_size * 8) {
@@ -193,20 +193,19 @@ int CLZWDecoder::Decode(uint8_t* dest_buf,
}
m_OutPos++;
last_char = (uint8_t)code;
- if (old_code != (uint32_t)-1) {
+ if (old_code != 0xFFFFFFFF)
AddCode(old_code, last_char);
- }
old_code = code;
} else if (code == 256) {
m_CodeLen = 9;
m_nCodes = 0;
- old_code = (uint32_t)-1;
+ old_code = 0xFFFFFFFF;
} else if (code == 257) {
break;
} else {
- if (old_code == (uint32_t)-1) {
+ if (old_code == 0xFFFFFFFF)
return 2;
- }
+
m_StackLen = 0;
if (code >= m_nCodes + 258) {
if (m_StackLen < sizeof(m_DecodeStack)) {
@@ -824,7 +823,7 @@ uint32_t CCodec_FlateModule::FlateOrLZWDecode(bool bLZW,
if (bLZW) {
{
std::unique_ptr<CLZWDecoder> decoder(new CLZWDecoder);
- dest_size = (uint32_t)-1;
+ dest_size = 0xFFFFFFFF;
offset = src_size;
int err =
decoder->Decode(nullptr, dest_size, src_buf, offset, bEarlyChange);