summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-03-30 23:34:45 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-03-31 16:11:01 +0000
commitc0cf369e0bd58ce5ae910d0b8636f6f23eca1490 (patch)
tree0d35c949daeee7f475042d7cc3dc5977673b9162
parentd6fa97ba82bc6a19a836119eab904b79961854b2 (diff)
downloadpdfium-c0cf369e0bd58ce5ae910d0b8636f6f23eca1490.tar.xz
Fix QR code generation.
Roll DEPS for testing corpus to 2c5a026 to verify. This regressed in commit c8017b2. BUG=pdfium:692 Change-Id: Ic09ed53db8b3cc81abb2bdea863b8cf32f614197 Reviewed-on: https://pdfium-review.googlesource.com/3510 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r--DEPS2
-rw-r--r--fxbarcode/qrcode/BC_QRCoderEncoder.cpp18
2 files changed, 11 insertions, 9 deletions
diff --git a/DEPS b/DEPS
index ef2a08994f..ceb53c709b 100644
--- a/DEPS
+++ b/DEPS
@@ -15,7 +15,7 @@ vars = {
'gtest_revision': '8245545b6dc9c4703e6496d1efd19e975ad2b038',
'icu_revision': '73e24736676b4b438270fda44e5b2c83b49fdd80',
'instrumented_lib_revision': '45f5814b1543e41ea0be54c771e3840ea52cca4a',
- 'pdfium_tests_revision': '146d4c6b67f95ce178d2bd350ea48327486581e0',
+ 'pdfium_tests_revision': '2c5a02609900c6cc67341f67ab49d3073a7081c3',
'skia_revision': '90e3cd78991ef337dbd0023efb30ece864694308',
'tools_memory_revision': '427f10475e1a8d72424c29d00bf689122b738e5d',
'trace_event_revision': '06294c8a4a6f744ef284cd63cfe54dbf61eea290',
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index 29dc69996b..ae9a8ebd14 100644
--- a/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -487,8 +487,9 @@ catchException:
qrCode->GetVersion(),
qrCode->GetMaskPattern(), matrix.get(), e);
if (e != BCExceptionNO)
- return qrCode->SetMatrix(std::move(matrix));
+ return;
+ qrCode->SetMatrix(std::move(matrix));
if (!qrCode->IsValid())
e = BCExceptionInvalidQRCode;
}
@@ -523,7 +524,8 @@ void CBC_QRCoderEncoder::Encode(const CFX_WideString& content,
return;
headerAndDataBits.AppendBitVector(&dataBits, e);
if (e != BCExceptionNO)
- return TerminateBits(qrCode->GetNumDataBytes(), &headerAndDataBits, e);
+ return;
+ TerminateBits(qrCode->GetNumDataBytes(), &headerAndDataBits, e);
if (e != BCExceptionNO)
return;
CBC_QRCoderBitVector finalBits;
@@ -547,8 +549,9 @@ void CBC_QRCoderEncoder::Encode(const CFX_WideString& content,
qrCode->GetVersion(),
qrCode->GetMaskPattern(), matrix.get(), e);
if (e != BCExceptionNO)
- return qrCode->SetMatrix(std::move(matrix));
+ return;
+ qrCode->SetMatrix(std::move(matrix));
if (!qrCode->IsValid())
e = BCExceptionInvalidQRCode;
}
@@ -629,9 +632,9 @@ int32_t CBC_QRCoderEncoder::CalculateMaskPenalty(CBC_CommonByteMatrix* matrix) {
CBC_QRCoderMode* CBC_QRCoderEncoder::ChooseMode(const CFX_ByteString& content,
CFX_ByteString encoding) {
- if (encoding.Compare("SHIFT_JIS") == 0) {
+ if (encoding.Compare("SHIFT_JIS") == 0)
return CBC_QRCoderMode::sKANJI;
- }
+
bool hasNumeric = false;
bool hasAlphaNumeric = false;
for (int32_t i = 0; i < content.GetLength(); i++) {
@@ -643,11 +646,10 @@ CBC_QRCoderMode* CBC_QRCoderEncoder::ChooseMode(const CFX_ByteString& content,
return CBC_QRCoderMode::sBYTE;
}
}
- if (hasAlphaNumeric) {
+ if (hasAlphaNumeric)
return CBC_QRCoderMode::sALPHANUMERIC;
- } else if (hasNumeric) {
+ if (hasNumeric)
return CBC_QRCoderMode::sNUMERIC;
- }
return CBC_QRCoderMode::sBYTE;
}