From c8017b2581b7ade6b05ba086eb7221465414173f Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 31 Jan 2017 13:02:10 -0800 Subject: Remove BC_EXCEPTION_CHECK macros These obfuscate control flow and save very few lines. Mechanical change (mostly), sed + clang-format and adding a few missing semicolons. Change-Id: If8ae06c23edea8c455c79eab589fee5142dc3409 Reviewed-on: https://pdfium-review.googlesource.com/2472 Reviewed-by: dsinclair Commit-Queue: dsinclair --- xfa/fxbarcode/pdf417/BC_PDF417.cpp | 12 ++++++++---- xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp | 3 ++- xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp | 3 ++- xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp | 3 ++- 4 files changed, 14 insertions(+), 7 deletions(-) (limited to 'xfa/fxbarcode/pdf417') diff --git a/xfa/fxbarcode/pdf417/BC_PDF417.cpp b/xfa/fxbarcode/pdf417/BC_PDF417.cpp index 16ed6fdf12..2f01564b11 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417.cpp @@ -405,14 +405,17 @@ void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, int32_t errorCorrectionCodeWords = CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount( errorCorrectionLevel, e); - BC_EXCEPTION_CHECK_ReturnVoid(e); + if (e != BCExceptionNO) + return; CFX_WideString highLevel = CBC_PDF417HighLevelEncoder::encodeHighLevel(msg, m_compaction, e); - BC_EXCEPTION_CHECK_ReturnVoid(e); + if (e != BCExceptionNO) + return; int32_t sourceCodeWords = highLevel.GetLength(); CFX_ArrayTemplate* dimension = determineDimensions(sourceCodeWords, errorCorrectionCodeWords, e); - BC_EXCEPTION_CHECK_ReturnVoid(e); + if (e != BCExceptionNO) + return; int32_t cols = dimension->GetAt(0); int32_t rows = dimension->GetAt(1); delete dimension; @@ -432,7 +435,8 @@ void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, CFX_WideString dataCodewords(sb); CFX_WideString ec = CBC_PDF417ErrorCorrection::generateErrorCorrection( dataCodewords, errorCorrectionLevel, e); - BC_EXCEPTION_CHECK_ReturnVoid(e); + if (e != BCExceptionNO) + return; CFX_WideString fullCodewords = dataCodewords + ec; m_barcodeMatrix = pdfium::MakeUnique(rows, cols); encodeLowLevel(fullCodewords, cols, rows, errorCorrectionLevel, diff --git a/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp b/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp index cbdfffac60..bdec403970 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp @@ -161,7 +161,8 @@ CFX_WideString CBC_PDF417ErrorCorrection::generateErrorCorrection( int32_t errorCorrectionLevel, int32_t& e) { int32_t k = getErrorCorrectionCodewordCount(errorCorrectionLevel, e); - BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR)' '); + if (e != BCExceptionNO) + return L" "; FX_WCHAR* ech = FX_Alloc(FX_WCHAR, k); FXSYS_memset(ech, 0, k * sizeof(FX_WCHAR)); int32_t sld = dataCodewords.GetLength(); diff --git a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp index 183566f9e3..08a40c51b3 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp @@ -108,7 +108,8 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel( p += t; } else { int32_t b = determineConsecutiveBinaryCount(msg, &byteArr, p, e); - BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR)' '); + if (e != BCExceptionNO) + return L" "; if (b == 0) { b = 1; } diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp b/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp index 72d1a05dfd..2c75a14a80 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp @@ -59,7 +59,8 @@ uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents, encoder.setDimensions(30, 1, row, row); } encoder.generateBarcodeLogic(contents, m_iCorrectLevel, e); - BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); + if (e != BCExceptionNO) + return nullptr; int32_t lineThickness = 2; int32_t aspectRatio = 4; CBC_BarcodeMatrix* barcodeMatrix = encoder.getBarcodeMatrix(); -- cgit v1.2.3