summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-25 21:15:14 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-25 21:15:14 +0000
commit67e3dd3c7b98a4e69d1fe2a7451bbb19ebb74eb1 (patch)
tree2e42cca55d7c3f9f4649ea035cf1822b95e95911
parent9ed6bd7150a9333cb28d149c98e3d316c3ededdf (diff)
downloadpdfium-67e3dd3c7b98a4e69d1fe2a7451bbb19ebb74eb1.tar.xz
Use a bool in FindBit() in the fax codec.
Change-Id: If75c0db94d341715e0bc6406f0fd89812f1ea73c Reviewed-on: https://pdfium-review.googlesource.com/31311 Commit-Queue: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--core/fxcodec/codec/fx_codec_fax.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp
index c800fda283..20280a3760 100644
--- a/core/fxcodec/codec/fx_codec_fax.cpp
+++ b/core/fxcodec/codec/fx_codec_fax.cpp
@@ -48,7 +48,7 @@ const uint8_t ZeroLeadPos[256] = {
// Limit of image dimension, an arbitrary large number.
const int kMaxImageDimension = 0x01FFFF;
-int FindBit(const uint8_t* data_buf, int max_pos, int start_pos, int bit) {
+int FindBit(const uint8_t* data_buf, int max_pos, int start_pos, bool bit) {
ASSERT(start_pos >= 0);
if (start_pos >= max_pos)
return max_pos;
@@ -87,8 +87,7 @@ void FaxG4FindB1B2(const std::vector<uint8_t>& ref_buf,
bool a0color,
int* b1,
int* b2) {
- uint8_t first_bit =
- (a0 < 0) ? 1 : ((ref_buf[a0 / 8] & (1 << (7 - a0 % 8))) != 0);
+ bool first_bit = a0 < 0 || (ref_buf[a0 / 8] & (1 << (7 - a0 % 8))) != 0;
*b1 = FindBit(ref_buf.data(), columns, a0 + 1, !first_bit);
if (*b1 >= columns) {
*b1 = *b2 = columns;