diff options
author | Lei Zhang <thestig@chromium.org> | 2017-03-30 23:34:45 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-31 16:11:01 +0000 |
commit | c0cf369e0bd58ce5ae910d0b8636f6f23eca1490 (patch) | |
tree | 0d35c949daeee7f475042d7cc3dc5977673b9162 /fxbarcode/qrcode/BC_QRCoderEncoder.cpp | |
parent | d6fa97ba82bc6a19a836119eab904b79961854b2 (diff) | |
download | pdfium-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>
Diffstat (limited to 'fxbarcode/qrcode/BC_QRCoderEncoder.cpp')
-rw-r--r-- | fxbarcode/qrcode/BC_QRCoderEncoder.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
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; } |