From d19e912dd469e4bdad9f3020e1f6eb98f10f3470 Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 2 Nov 2016 15:43:18 -0700 Subject: Remove FX_BOOL from xfa. Review-Url: https://codereview.chromium.org/2467203003 --- xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp | 14 +++++++------- xfa/fxbarcode/qrcode/BC_QRCodeWriter.h | 4 ++-- xfa/fxbarcode/qrcode/BC_QRCoder.cpp | 2 +- xfa/fxbarcode/qrcode/BC_QRCoder.h | 2 +- xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp | 8 ++++---- xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp | 18 +++++++++--------- xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.h | 10 +++++----- xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp | 7 +++---- xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h | 4 ++-- 9 files changed, 34 insertions(+), 35 deletions(-) (limited to 'xfa/fxbarcode/qrcode') diff --git a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp index 01873f0f04..adb12f25b1 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp @@ -31,7 +31,7 @@ #include "xfa/fxbarcode/qrcode/BC_QRCoderVersion.h" CBC_QRCodeWriter::CBC_QRCodeWriter() { - m_bFixedSize = TRUE; + m_bFixedSize = true; m_iCorrectLevel = 1; m_iVersion = 0; } @@ -48,20 +48,20 @@ void CBC_QRCodeWriter::ReleaseAll() { CBC_QRCoderVersion::Destroy(); } -FX_BOOL CBC_QRCodeWriter::SetVersion(int32_t version) { +bool CBC_QRCodeWriter::SetVersion(int32_t version) { if (version < 0 || version > 40) { - return FALSE; + return false; } m_iVersion = version; - return TRUE; + return true; } -FX_BOOL CBC_QRCodeWriter::SetErrorCorrectionLevel(int32_t level) { +bool CBC_QRCodeWriter::SetErrorCorrectionLevel(int32_t level) { if (level < 0 || level > 3) { - return FALSE; + return false; } m_iCorrectLevel = level; - return TRUE; + return true; } uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents, diff --git a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.h b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.h index 6562107f10..5585fa55c1 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.h +++ b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.h @@ -31,10 +31,10 @@ class CBC_QRCodeWriter : public CBC_TwoDimWriter { int32_t& outWidth, int32_t& outHeight, int32_t& e); - FX_BOOL SetVersion(int32_t version); + bool SetVersion(int32_t version); // CBC_TwoDimWriter - FX_BOOL SetErrorCorrectionLevel(int32_t level) override; + bool SetErrorCorrectionLevel(int32_t level) override; static void ReleaseAll(); diff --git a/xfa/fxbarcode/qrcode/BC_QRCoder.cpp b/xfa/fxbarcode/qrcode/BC_QRCoder.cpp index 4c7956ed68..c47374935f 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoder.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoder.cpp @@ -90,7 +90,7 @@ int32_t CBC_QRCoder::At(int32_t x, int32_t y, int32_t& e) { return value; } -FX_BOOL CBC_QRCoder::IsValid() { +bool CBC_QRCoder::IsValid() { return m_mode && m_ecLevel && m_version != -1 && m_matrixWidth != -1 && m_maskPattern != -1 && m_numTotalBytes != -1 && m_numDataBytes != -1 && m_numECBytes != -1 && m_numRSBlocks != -1 && diff --git a/xfa/fxbarcode/qrcode/BC_QRCoder.h b/xfa/fxbarcode/qrcode/BC_QRCoder.h index bbb37355f2..5e949920a7 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoder.h +++ b/xfa/fxbarcode/qrcode/BC_QRCoder.h @@ -34,7 +34,7 @@ class CBC_QRCoder { CBC_CommonByteMatrix* GetMatrix() const; int32_t At(int32_t x, int32_t y, int32_t& e); - FX_BOOL IsValid(); + bool IsValid(); void SetMode(CBC_QRCoderMode* value); void SetECLevel(CBC_QRCoderErrorCorrectionLevel* ecLevel); diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp index 209a9656a6..ddfbff2e3c 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp @@ -635,13 +635,13 @@ CBC_QRCoderMode* CBC_QRCoderEncoder::ChooseMode(const CFX_ByteString& content, if (encoding.Compare("SHIFT_JIS") == 0) { return CBC_QRCoderMode::sKANJI; } - FX_BOOL hasNumeric = FALSE; - FX_BOOL hasAlphaNumeric = FALSE; + bool hasNumeric = false; + bool hasAlphaNumeric = false; for (int32_t i = 0; i < content.GetLength(); i++) { if (isdigit((uint8_t)content[i])) { - hasNumeric = TRUE; + hasNumeric = true; } else if (GetAlphaNumericCode((uint8_t)content[i]) != -1) { - hasAlphaNumeric = TRUE; + hasAlphaNumeric = true; } else { return CBC_QRCoderMode::sBYTE; } diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp index 4d845c4b07..8342b9b6db 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp @@ -30,8 +30,8 @@ CBC_QRCoderMaskUtil::CBC_QRCoderMaskUtil() {} CBC_QRCoderMaskUtil::~CBC_QRCoderMaskUtil() {} int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1( CBC_CommonByteMatrix* matrix) { - return ApplyMaskPenaltyRule1Internal(matrix, TRUE) + - ApplyMaskPenaltyRule1Internal(matrix, FALSE); + return ApplyMaskPenaltyRule1Internal(matrix, true) + + ApplyMaskPenaltyRule1Internal(matrix, false); } int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2( @@ -122,13 +122,13 @@ int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule4( double darkRatio = (double)numDarkCells / numTotalCells; return abs((int32_t)(darkRatio * 100 - 50) / 5) * 5 * 10; } -FX_BOOL CBC_QRCoderMaskUtil::GetDataMaskBit(int32_t maskPattern, - int32_t x, - int32_t y, - int32_t& e) { +bool CBC_QRCoderMaskUtil::GetDataMaskBit(int32_t maskPattern, + int32_t x, + int32_t y, + int32_t& e) { if (!CBC_QRCoder::IsValidMaskPattern(maskPattern)) { e = (BCExceptionInvalidateMaskPattern); - BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); + BC_EXCEPTION_CHECK_ReturnValue(e, false); } int32_t intermediate = 0, temp = 0; switch (maskPattern) { @@ -161,14 +161,14 @@ FX_BOOL CBC_QRCoderMaskUtil::GetDataMaskBit(int32_t maskPattern, break; default: { e = BCExceptionInvalidateMaskPattern; - BC_EXCEPTION_CHECK_ReturnValue(e, FALSE); + BC_EXCEPTION_CHECK_ReturnValue(e, false); } } return intermediate == 0; } int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1Internal( CBC_CommonByteMatrix* matrix, - FX_BOOL isHorizontal) { + bool isHorizontal) { int32_t penalty = 0; int32_t numSameBitCells = 0; int32_t prevBit = -1; diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.h b/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.h index 35032a3aaf..9fbe073e7e 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.h +++ b/xfa/fxbarcode/qrcode/BC_QRCoderMaskUtil.h @@ -11,17 +11,17 @@ class CBC_QRCoderMaskUtil { public: CBC_QRCoderMaskUtil(); virtual ~CBC_QRCoderMaskUtil(); - static FX_BOOL GetDataMaskBit(int32_t maskPattern, - int32_t x, - int32_t y, - int32_t& e); + static bool GetDataMaskBit(int32_t maskPattern, + int32_t x, + int32_t y, + int32_t& e); static int32_t ApplyMaskPenaltyRule1(CBC_CommonByteMatrix* matrix); static int32_t ApplyMaskPenaltyRule2(CBC_CommonByteMatrix* matrix); static int32_t ApplyMaskPenaltyRule3(CBC_CommonByteMatrix* matrix); static int32_t ApplyMaskPenaltyRule4(CBC_CommonByteMatrix* matrix); static int32_t ApplyMaskPenaltyRule1Internal(CBC_CommonByteMatrix* matrix, - FX_BOOL isHorizontal); + bool isHorizontal); }; #endif // XFA_FXBARCODE_QRCODE_BC_QRCODERMASKUTIL_H_ diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp index f5df04ee9c..ca44e01293 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp @@ -211,8 +211,7 @@ void CBC_QRCoderMatrixUtil::EmbedDataBits(CBC_QRCoderBitVector* dataBits, bit = 0; } if (maskPattern != -1) { - FX_BOOL bol = - CBC_QRCoderMaskUtil::GetDataMaskBit(maskPattern, xx, y, e); + bool bol = CBC_QRCoderMaskUtil::GetDataMaskBit(maskPattern, xx, y, e); BC_EXCEPTION_CHECK_ReturnVoid(e); if (bol) { bit ^= 0x01; @@ -285,10 +284,10 @@ void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(int32_t version, BC_EXCEPTION_CHECK_ReturnVoid(e); } } -FX_BOOL CBC_QRCoderMatrixUtil::IsEmpty(int32_t value) { +bool CBC_QRCoderMatrixUtil::IsEmpty(int32_t value) { return (uint8_t)value == 0xff; } -FX_BOOL CBC_QRCoderMatrixUtil::IsValidValue(int32_t value) { +bool CBC_QRCoderMatrixUtil::IsValidValue(int32_t value) { return ((uint8_t)value == 0xff || (uint8_t)value == 0x00 || (uint8_t)value == 0x01); } diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h b/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h index feb0bb491c..3ce4b7510b 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h +++ b/xfa/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h @@ -55,8 +55,8 @@ class CBC_QRCoderMatrixUtil { static void MakeVersionInfoBits(int32_t version, CBC_QRCoderBitVector* bits, int32_t& e); - static FX_BOOL IsEmpty(int32_t value); - static FX_BOOL IsValidValue(int32_t value); + static bool IsEmpty(int32_t value); + static bool IsValidValue(int32_t value); static void EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, int32_t& e); static void EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* matrix, int32_t& e); -- cgit v1.2.3