From bfa9a824a20f37c2dd7111012b46c929cf2ed8a0 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 9 Jun 2015 13:24:12 -0700 Subject: Merge to XFA: Use stdint.h types throughout PDFium. Near-automatic merge, plus re-running scripts to update additional usage. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1172793002 --- .../qrcode/BC_QRAlignmentPatternFinder.cpp | 50 ++-- .../fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h | 18 +- xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp | 60 ++--- xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.h | 12 +- xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp | 8 +- xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h | 8 +- xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp | 12 +- xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.h | 12 +- xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp | 36 +-- xfa/src/fxbarcode/qrcode/BC_QRCoder.h | 48 ++-- xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp | 46 ++-- xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.h | 24 +- xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp | 38 +-- xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h | 6 +- xfa/src/fxbarcode/qrcode/BC_QRCoderECB.cpp | 6 +- xfa/src/fxbarcode/qrcode/BC_QRCoderECB.h | 10 +- xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp | 16 +- xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h | 12 +- xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp | 254 ++++++++++----------- xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h | 60 ++--- .../qrcode/BC_QRCoderErrorCorrectionLevel.cpp | 8 +- .../qrcode/BC_QRCoderErrorCorrectionLevel.h | 12 +- .../qrcode/BC_QRCoderFormatInformation.cpp | 30 +-- .../fxbarcode/qrcode/BC_QRCoderFormatInformation.h | 18 +- xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp | 78 +++---- xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.h | 12 +- xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp | 158 ++++++------- xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h | 58 ++--- xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp | 30 +-- xfa/src/fxbarcode/qrcode/BC_QRCoderMode.h | 12 +- xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.cpp | 52 ++--- xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h | 22 +- xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp | 40 ++-- xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h | 8 +- xfa/src/fxbarcode/qrcode/BC_QRDataMask.cpp | 30 +-- xfa/src/fxbarcode/qrcode/BC_QRDataMask.h | 8 +- .../qrcode/BC_QRDecodedBitStreamParser.cpp | 68 +++--- .../fxbarcode/qrcode/BC_QRDecodedBitStreamParser.h | 16 +- xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp | 96 ++++---- xfa/src/fxbarcode/qrcode/BC_QRDetector.h | 16 +- xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp | 2 +- xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.cpp | 2 +- xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.h | 4 +- .../fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp | 94 ++++---- .../fxbarcode/qrcode/BC_QRFinderPatternFinder.h | 22 +- xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp | 28 +-- xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h | 6 +- 47 files changed, 833 insertions(+), 833 deletions(-) (limited to 'xfa/src/fxbarcode/qrcode') diff --git a/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp index 669a0fbf7e..fa75cd8995 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.cpp @@ -26,10 +26,10 @@ #include "BC_QRAlignmentPattern.h" #include "BC_QRAlignmentPatternFinder.h" CBC_QRAlignmentPatternFinder::CBC_QRAlignmentPatternFinder(CBC_CommonBitMatrix *image, - FX_INT32 startX, - FX_INT32 startY, - FX_INT32 width, - FX_INT32 height, + int32_t startX, + int32_t startY, + int32_t width, + int32_t height, FX_FLOAT moduleSize): m_image(image), m_startX(startX), m_startY(startY), @@ -42,29 +42,29 @@ CBC_QRAlignmentPatternFinder::CBC_QRAlignmentPatternFinder(CBC_CommonBitMatrix * } CBC_QRAlignmentPatternFinder::~CBC_QRAlignmentPatternFinder() { - for (FX_INT32 i = 0; i < m_possibleCenters.GetSize(); i++) { + for (int32_t i = 0; i < m_possibleCenters.GetSize(); i++) { delete (CBC_QRAlignmentPattern*)m_possibleCenters[i]; } m_possibleCenters.RemoveAll(); } -CBC_QRAlignmentPattern *CBC_QRAlignmentPatternFinder::Find(FX_INT32 &e) +CBC_QRAlignmentPattern *CBC_QRAlignmentPatternFinder::Find(int32_t &e) { - FX_INT32 startX = m_startX; - FX_INT32 height = m_height; - FX_INT32 maxJ = startX + m_width; - FX_INT32 middleI = m_startY + (height >> 1); + int32_t startX = m_startX; + int32_t height = m_height; + int32_t maxJ = startX + m_width; + int32_t middleI = m_startY + (height >> 1); CFX_Int32Array stateCount; stateCount.SetSize(3); - for (FX_INT32 iGen = 0; iGen < height; iGen++) { - FX_INT32 i = middleI + ((iGen & 0x01) == 0 ? ((iGen + 1) >> 1) : -((iGen + 1) >> 1)); + for (int32_t iGen = 0; iGen < height; iGen++) { + int32_t i = middleI + ((iGen & 0x01) == 0 ? ((iGen + 1) >> 1) : -((iGen + 1) >> 1)); stateCount[0] = 0; stateCount[1] = 0; stateCount[2] = 0; - FX_INT32 j = startX; + int32_t j = startX; while (j < maxJ && !m_image->Get(j, i)) { j++; } - FX_INT32 currentState = 0; + int32_t currentState = 0; while (j < maxJ) { if (m_image->Get(j, i)) { if (currentState == 1) { @@ -107,7 +107,7 @@ CBC_QRAlignmentPattern *CBC_QRAlignmentPatternFinder::Find(FX_INT32 &e) BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return NULL; } -FX_FLOAT CBC_QRAlignmentPatternFinder::CenterFromEnd(const CFX_Int32Array &stateCount, FX_INT32 end) +FX_FLOAT CBC_QRAlignmentPatternFinder::CenterFromEnd(const CFX_Int32Array &stateCount, int32_t end) { return (FX_FLOAT) (end - stateCount[2]) - stateCount[1] / 2.0f; } @@ -115,23 +115,23 @@ FX_BOOL CBC_QRAlignmentPatternFinder::FoundPatternCross(const CFX_Int32Array &st { FX_FLOAT moduleSize = m_moduleSize; FX_FLOAT maxVariance = moduleSize / 2.0f; - for (FX_INT32 i = 0; i < 3; i++) { + for (int32_t i = 0; i < 3; i++) { if (fabs(moduleSize - stateCount[i]) >= maxVariance) { return false; } } return TRUE; } -FX_FLOAT CBC_QRAlignmentPatternFinder::CrossCheckVertical(FX_INT32 startI, FX_INT32 centerJ, FX_INT32 maxCount, FX_INT32 originalStateCountTotal) +FX_FLOAT CBC_QRAlignmentPatternFinder::CrossCheckVertical(int32_t startI, int32_t centerJ, int32_t maxCount, int32_t originalStateCountTotal) { CBC_CommonBitMatrix *image = m_image; - FX_INT32 maxI = m_image->GetHeight(); + int32_t maxI = m_image->GetHeight(); CFX_Int32Array stateCount; stateCount.Copy(m_crossCheckStateCount); stateCount[0] = 0; stateCount[1] = 0; stateCount[2] = 0; - FX_INT32 i = startI; + int32_t i = startI; while (i >= 0 && m_image->Get(centerJ, i) && stateCount[1] <= maxCount) { stateCount[1]++; i--; @@ -161,21 +161,21 @@ FX_FLOAT CBC_QRAlignmentPatternFinder::CrossCheckVertical(FX_INT32 startI, FX_IN if (stateCount[2] > maxCount) { return FXSYS_nan(); } - FX_INT32 stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2]; + int32_t stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2]; if (5 * abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal) { return FXSYS_nan(); } return FoundPatternCross(stateCount) ? CenterFromEnd(stateCount, i) : FXSYS_nan(); } -CBC_QRAlignmentPattern *CBC_QRAlignmentPatternFinder::HandlePossibleCenter(const CFX_Int32Array &stateCount, FX_INT32 i, FX_INT32 j) +CBC_QRAlignmentPattern *CBC_QRAlignmentPatternFinder::HandlePossibleCenter(const CFX_Int32Array &stateCount, int32_t i, int32_t j) { - FX_INT32 stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2]; + int32_t stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2]; FX_FLOAT centerJ = CenterFromEnd(stateCount, j); - FX_FLOAT centerI = CrossCheckVertical(i, (FX_INT32) centerJ, 2 * stateCount[1], stateCountTotal); + FX_FLOAT centerI = CrossCheckVertical(i, (int32_t) centerJ, 2 * stateCount[1], stateCountTotal); if (!FXSYS_isnan(centerI)) { FX_FLOAT estimatedModuleSize = (FX_FLOAT) (stateCount[0] + stateCount[1] + stateCount[2]) / 3.0f; - FX_INT32 max = m_possibleCenters.GetSize(); - for (FX_INT32 index = 0; index < max; index++) { + int32_t max = m_possibleCenters.GetSize(); + for (int32_t index = 0; index < max; index++) { CBC_QRAlignmentPattern *center = (CBC_QRAlignmentPattern *)(m_possibleCenters[index]); if (center->AboutEquals(estimatedModuleSize, centerI, centerJ)) { return FX_NEW CBC_QRAlignmentPattern(centerJ, centerI, estimatedModuleSize); diff --git a/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h b/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h index c1d224a8eb..b16517ede2 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRAlignmentPatternFinder.h @@ -13,19 +13,19 @@ class CBC_QRAlignmentPatternFinder private: CBC_CommonBitMatrix *m_image; CFX_PtrArray m_possibleCenters; - FX_INT32 m_startX; - FX_INT32 m_startY; - FX_INT32 m_width; - FX_INT32 m_height; + int32_t m_startX; + int32_t m_startY; + int32_t m_width; + int32_t m_height; FX_FLOAT m_moduleSize; CFX_Int32Array m_crossCheckStateCount; public: - CBC_QRAlignmentPatternFinder(CBC_CommonBitMatrix *image, FX_INT32 startX, FX_INT32 startY, FX_INT32 width, FX_INT32 height, FX_FLOAT moduleSize); + CBC_QRAlignmentPatternFinder(CBC_CommonBitMatrix *image, int32_t startX, int32_t startY, int32_t width, int32_t height, FX_FLOAT moduleSize); virtual ~CBC_QRAlignmentPatternFinder(); FX_BOOL FoundPatternCross(const CFX_Int32Array &stateCount); - FX_FLOAT CrossCheckVertical(FX_INT32 startI, FX_INT32 startJ, FX_INT32 maxCount, FX_INT32 originalStateCountTotal); - CBC_QRAlignmentPattern* Find(FX_INT32 &e); - CBC_QRAlignmentPattern *HandlePossibleCenter(const CFX_Int32Array &stateCount, FX_INT32 i, FX_INT32 j); - static FX_FLOAT CenterFromEnd(const CFX_Int32Array &stateCount, FX_INT32 end); + FX_FLOAT CrossCheckVertical(int32_t startI, int32_t startJ, int32_t maxCount, int32_t originalStateCountTotal); + CBC_QRAlignmentPattern* Find(int32_t &e); + CBC_QRAlignmentPattern *HandlePossibleCenter(const CFX_Int32Array &stateCount, int32_t i, int32_t j); + static FX_FLOAT CenterFromEnd(const CFX_Int32Array &stateCount, int32_t end); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp b/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp index 7c85c58367..ba5662bb4e 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.cpp @@ -29,7 +29,7 @@ CBC_QRBitMatrixParser::CBC_QRBitMatrixParser() { } -void CBC_QRBitMatrixParser::Init(CBC_CommonBitMatrix *bitMatrix, FX_INT32 &e) +void CBC_QRBitMatrixParser::Init(CBC_CommonBitMatrix *bitMatrix, int32_t &e) { m_dimension = bitMatrix->GetDimension(e); BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -50,34 +50,34 @@ CBC_QRBitMatrixParser::~CBC_QRBitMatrixParser() } m_version = NULL; } -CBC_QRCoderFormatInformation* CBC_QRBitMatrixParser::ReadFormatInformation(FX_INT32 &e) +CBC_QRCoderFormatInformation* CBC_QRBitMatrixParser::ReadFormatInformation(int32_t &e) { if(m_parsedFormatInfo != NULL) { return m_parsedFormatInfo; } - FX_INT32 formatInfoBits = 0; - FX_INT32 j; + int32_t formatInfoBits = 0; + int32_t j; for( j = 0; j < 6; j++) { formatInfoBits = CopyBit(8, j, formatInfoBits); } formatInfoBits = CopyBit(8, 7, formatInfoBits); formatInfoBits = CopyBit(8, 8, formatInfoBits); formatInfoBits = CopyBit(7, 8, formatInfoBits); - for(FX_INT32 i = 5; i >= 0; i--) { + for(int32_t i = 5; i >= 0; i--) { formatInfoBits = CopyBit(i, 8, formatInfoBits); } m_parsedFormatInfo = CBC_QRCoderFormatInformation::DecodeFormatInformation(formatInfoBits); if(m_parsedFormatInfo != NULL) { return m_parsedFormatInfo; } - FX_INT32 dimension = m_bitMatrix->GetDimension(e); + int32_t dimension = m_bitMatrix->GetDimension(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); formatInfoBits = 0; - FX_INT32 iMin = dimension - 8; + int32_t iMin = dimension - 8; for(j = dimension - 1; j >= iMin; j--) { formatInfoBits = CopyBit(j, 8, formatInfoBits); } - for(FX_INT32 k = dimension - 7; k < dimension; k++) { + for(int32_t k = dimension - 7; k < dimension; k++) { formatInfoBits = CopyBit(8, k , formatInfoBits); } m_parsedFormatInfo = CBC_QRCoderFormatInformation::DecodeFormatInformation(formatInfoBits); @@ -88,23 +88,23 @@ CBC_QRCoderFormatInformation* CBC_QRBitMatrixParser::ReadFormatInformation(FX_IN BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return NULL; } -CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(FX_INT32 &e) +CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(int32_t &e) { if(m_version != NULL) { return m_version; } - FX_INT32 dimension = m_bitMatrix->GetDimension(e); + int32_t dimension = m_bitMatrix->GetDimension(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - FX_INT32 provisionVersion = (dimension - 17) >> 2; + int32_t provisionVersion = (dimension - 17) >> 2; if(provisionVersion <= 6) { CBC_QRCoderVersion* qrv = CBC_QRCoderVersion::GetVersionForNumber(provisionVersion, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return qrv; } - FX_INT32 versionBits = 0; - for (FX_INT32 i = 5; i >= 0; i--) { - FX_INT32 jMin = dimension - 11; - for (FX_INT32 j = dimension - 9; j >= jMin; j--) { + int32_t versionBits = 0; + for (int32_t i = 5; i >= 0; i--) { + int32_t jMin = dimension - 11; + for (int32_t j = dimension - 9; j >= jMin; j--) { versionBits = CopyBit(i, j, versionBits); } } @@ -114,9 +114,9 @@ CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(FX_INT32 &e) return m_version; } versionBits = 0; - for (FX_INT32 j = 5; j >= 0; j--) { - FX_INT32 iMin = dimension - 11; - for (FX_INT32 i = dimension - 9; i >= iMin; i--) { + for (int32_t j = 5; j >= 0; j--) { + int32_t iMin = dimension - 11; + for (int32_t i = dimension - 9; i >= iMin; i--) { versionBits = CopyBit(i, j, versionBits); } } @@ -129,19 +129,19 @@ CBC_QRCoderVersion* CBC_QRBitMatrixParser::ReadVersion(FX_INT32 &e) BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return NULL; } -FX_INT32 CBC_QRBitMatrixParser::CopyBit(FX_INT32 i, FX_INT32 j, FX_INT32 versionBits) +int32_t CBC_QRBitMatrixParser::CopyBit(int32_t i, int32_t j, int32_t versionBits) { return m_bitMatrix->Get(j, i) ? (versionBits << 1) | 0x1 : versionBits << 1; } -CFX_ByteArray* CBC_QRBitMatrixParser::ReadCodewords(FX_INT32 &e) +CFX_ByteArray* CBC_QRBitMatrixParser::ReadCodewords(int32_t &e) { CBC_QRCoderFormatInformation *formatInfo = ReadFormatInformation(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL) CBC_QRCoderVersion *version = ReadVersion(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - CBC_QRDataMask *dataMask = CBC_QRDataMask::ForReference((FX_INT32)(formatInfo->GetDataMask()), e); + CBC_QRDataMask *dataMask = CBC_QRDataMask::ForReference((int32_t)(formatInfo->GetDataMask()), e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - FX_INT32 dimension = m_bitMatrix->GetDimension(e); + int32_t dimension = m_bitMatrix->GetDimension(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); dataMask->UnmaskBitMatirx(m_bitMatrix, dimension); CBC_CommonBitMatrix* cbm = version->BuildFunctionPattern(e); @@ -151,16 +151,16 @@ CFX_ByteArray* CBC_QRBitMatrixParser::ReadCodewords(FX_INT32 &e) CFX_ByteArray * temp = FX_NEW CFX_ByteArray; temp->SetSize(version->GetTotalCodeWords()); CBC_AutoPtr result(temp); - FX_INT32 resultOffset = 0; - FX_INT32 currentByte = 0; - FX_INT32 bitsRead = 0; - for(FX_INT32 j = dimension - 1; j > 0; j -= 2) { + int32_t resultOffset = 0; + int32_t currentByte = 0; + int32_t bitsRead = 0; + for(int32_t j = dimension - 1; j > 0; j -= 2) { if(j == 6) { j--; } - for(FX_INT32 count = 0; count < dimension; count++) { - FX_INT32 i = readingUp ? dimension - 1 - count : count; - for(FX_INT32 col = 0; col < 2; col++) { + for(int32_t count = 0; count < dimension; count++) { + int32_t i = readingUp ? dimension - 1 - count : count; + for(int32_t col = 0; col < 2; col++) { if(!functionPattern->Get(j - col, i)) { bitsRead++; currentByte <<= 1; @@ -168,7 +168,7 @@ CFX_ByteArray* CBC_QRBitMatrixParser::ReadCodewords(FX_INT32 &e) currentByte |= 1; } if(bitsRead == 8) { - (*result)[resultOffset++] = (FX_BYTE) currentByte; + (*result)[resultOffset++] = (uint8_t) currentByte; bitsRead = 0; currentByte = 0; } diff --git a/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.h b/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.h index 0189ba7c81..6f378fff95 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRBitMatrixParser.h @@ -17,14 +17,14 @@ private: CBC_CommonBitMatrix *m_tempBitMatrix; CBC_QRCoderVersion *m_version; CBC_QRCoderFormatInformation *m_parsedFormatInfo; - FX_INT32 m_dimension; + int32_t m_dimension; public: CBC_QRBitMatrixParser(); virtual ~CBC_QRBitMatrixParser(); - CBC_QRCoderFormatInformation *ReadFormatInformation(FX_INT32 &e); - CBC_QRCoderVersion *ReadVersion(FX_INT32 &e); - FX_INT32 CopyBit(FX_INT32 i, FX_INT32 j, FX_INT32 versionBits); - CFX_ByteArray *ReadCodewords(FX_INT32 &e); - virtual void Init(CBC_CommonBitMatrix *bitMatrix, FX_INT32 &e); + CBC_QRCoderFormatInformation *ReadFormatInformation(int32_t &e); + CBC_QRCoderVersion *ReadVersion(int32_t &e); + int32_t CopyBit(int32_t i, int32_t j, int32_t versionBits); + CFX_ByteArray *ReadCodewords(int32_t &e); + virtual void Init(CBC_CommonBitMatrix *bitMatrix, int32_t &e); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp index f12c4e0ad3..ab28f3434d 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.cpp @@ -55,7 +55,7 @@ CBC_QRCodeReader::~CBC_QRCodeReader() } m_decoder = NULL; } -CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e) +CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e) { CBC_CommonBitMatrix *matrix = image->GetMatrix(e); BC_EXCEPTION_CHECK_ReturnValue(e, ""); @@ -68,7 +68,7 @@ CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap *image, FX_INT32 hints, CBC_AutoPtr decodeResult(qdr2); return (decodeResult->GetText()); } -CFX_ByteString CBC_QRCodeReader::Decode(const CFX_WideString &filename, FX_INT32 hints, FX_INT32 byteModeDecode, FX_INT32 &e) +CFX_ByteString CBC_QRCodeReader::Decode(const CFX_WideString &filename, int32_t hints, int32_t byteModeDecode, int32_t &e) { CBC_BufferedImageLuminanceSource source(filename); source.Init(e); @@ -79,7 +79,7 @@ CFX_ByteString CBC_QRCodeReader::Decode(const CFX_WideString &filename, FX_INT32 BC_EXCEPTION_CHECK_ReturnValue(e, ""); return bs; } -CFX_ByteString CBC_QRCodeReader::Decode(CFX_DIBitmap *pBitmap, FX_INT32 hints, FX_INT32 byteModeDecode, FX_INT32 &e) +CFX_ByteString CBC_QRCodeReader::Decode(CFX_DIBitmap *pBitmap, int32_t hints, int32_t byteModeDecode, int32_t &e) { CBC_BufferedImageLuminanceSource source(pBitmap); CBC_GlobalHistogramBinarizer binarizer(&source); @@ -88,7 +88,7 @@ CFX_ByteString CBC_QRCodeReader::Decode(CFX_DIBitmap *pBitmap, FX_INT32 hints, F BC_EXCEPTION_CHECK_ReturnValue(e, ""); return bs; } -CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap *image, FX_INT32 &e) +CFX_ByteString CBC_QRCodeReader::Decode(CBC_BinaryBitmap *image, int32_t &e) { CFX_ByteString bs = Decode(image, 0, e); BC_EXCEPTION_CHECK_ReturnValue(e, ""); diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h index 71a1ad3dd6..73b83d390e 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCodeReader.h @@ -25,11 +25,11 @@ private: public: CBC_QRCodeReader(); virtual ~CBC_QRCodeReader(); - CFX_ByteString Decode(CFX_DIBitmap *pBitmap, FX_INT32 hints, FX_INT32 byteModeDecode, FX_INT32 &e); - CFX_ByteString Decode(const CFX_WideString &filename, FX_INT32 hints, FX_INT32 byteModeDecode, FX_INT32 &e); + CFX_ByteString Decode(CFX_DIBitmap *pBitmap, int32_t hints, int32_t byteModeDecode, int32_t &e); + CFX_ByteString Decode(const CFX_WideString &filename, int32_t hints, int32_t byteModeDecode, int32_t &e); static void ReleaseAll(); - CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e); - CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 &e); + CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e); + CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t &e); virtual void Init(); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp index ccc0220d6c..37d0277bec 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.cpp @@ -42,7 +42,7 @@ void CBC_QRCodeWriter::ReleaseAll() { CBC_QRCodeReader::ReleaseAll(); } -FX_BOOL CBC_QRCodeWriter::SetVersion(FX_INT32 version) +FX_BOOL CBC_QRCodeWriter::SetVersion(int32_t version) { if (version < 0 || version > 40) { return FALSE; @@ -50,7 +50,7 @@ FX_BOOL CBC_QRCodeWriter::SetVersion(FX_INT32 version) m_iVersion = version; return TRUE; } -FX_BOOL CBC_QRCodeWriter::SetErrorCorrectionLevel(FX_INT32 level) +FX_BOOL CBC_QRCodeWriter::SetErrorCorrectionLevel(int32_t level) { if (level < 0 || level > 3) { return FALSE; @@ -58,7 +58,7 @@ FX_BOOL CBC_QRCodeWriter::SetErrorCorrectionLevel(FX_INT32 level) m_iCorrectLevel = level; return TRUE; } -FX_BYTE* CBC_QRCodeWriter::Encode(const CFX_WideString& contents, FX_INT32 ecLevel, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e) +uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents, int32_t ecLevel, int32_t &outWidth, int32_t &outHeight, int32_t &e) { CBC_QRCoderErrorCorrectionLevel *ec = NULL; switch(ecLevel) { @@ -89,15 +89,15 @@ FX_BYTE* CBC_QRCodeWriter::Encode(const CFX_WideString& contents, FX_INT32 ecLev BC_EXCEPTION_CHECK_ReturnValue(e, NULL); outWidth = qr.GetMatrixWidth(); outHeight = qr.GetMatrixWidth(); - FX_BYTE* result = FX_Alloc(FX_BYTE, outWidth * outWidth); + uint8_t* result = FX_Alloc(uint8_t, outWidth * outWidth); FXSYS_memcpy32(result, qr.GetMatrix()->GetArray(), outWidth * outHeight); return result; } -FX_BYTE *CBC_QRCodeWriter::Encode(const CFX_ByteString& contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e) +uint8_t *CBC_QRCodeWriter::Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e) { return NULL; } -FX_BYTE* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e) +uint8_t* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e) { return NULL; } diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.h b/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.h index bf0ca71996..7cfd978c47 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCodeWriter.h @@ -15,14 +15,14 @@ class CBC_QRCodeWriter : public CBC_TwoDimWriter public: CBC_QRCodeWriter(); virtual ~CBC_QRCodeWriter(); - FX_BYTE* Encode(const CFX_WideString& contents, FX_INT32 ecLevel, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e); - FX_BYTE* Encode(const CFX_ByteString& contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e); - FX_BYTE* Encode(const CFX_ByteString& contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e); - FX_BOOL SetVersion(FX_INT32 version); - FX_BOOL SetErrorCorrectionLevel(FX_INT32 level); + uint8_t* Encode(const CFX_WideString& contents, int32_t ecLevel, int32_t &outWidth, int32_t &outHeight, int32_t &e); + uint8_t* Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e); + uint8_t* Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e); + FX_BOOL SetVersion(int32_t version); + FX_BOOL SetErrorCorrectionLevel(int32_t level); static void ReleaseAll(); private: - FX_INT32 m_iVersion; + int32_t m_iVersion; }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp index f650f83b48..1f642016e2 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoder.cpp @@ -62,31 +62,31 @@ CBC_QRCoderErrorCorrectionLevel* CBC_QRCoder::GetECLevel() { return m_ecLevel; } -FX_INT32 CBC_QRCoder::GetVersion() +int32_t CBC_QRCoder::GetVersion() { return m_version; } -FX_INT32 CBC_QRCoder::GetMatrixWidth() +int32_t CBC_QRCoder::GetMatrixWidth() { return m_matrixWidth; } -FX_INT32 CBC_QRCoder::GetMaskPattern() +int32_t CBC_QRCoder::GetMaskPattern() { return m_maskPattern; } -FX_INT32 CBC_QRCoder::GetNumTotalBytes() +int32_t CBC_QRCoder::GetNumTotalBytes() { return m_numTotalBytes; } -FX_INT32 CBC_QRCoder::GetNumDataBytes() +int32_t CBC_QRCoder::GetNumDataBytes() { return m_numDataBytes; } -FX_INT32 CBC_QRCoder::GetNumECBytes() +int32_t CBC_QRCoder::GetNumECBytes() { return m_numECBytes; } -FX_INT32 CBC_QRCoder::GetNumRSBlocks() +int32_t CBC_QRCoder::GetNumRSBlocks() { return m_numRSBlocks; } @@ -94,9 +94,9 @@ CBC_CommonByteMatrix* CBC_QRCoder::GetMatrix() { return m_matrix; } -FX_INT32 CBC_QRCoder::At(FX_INT32 x, FX_INT32 y, FX_INT32 &e) +int32_t CBC_QRCoder::At(int32_t x, int32_t y, int32_t &e) { - FX_INT32 value = m_matrix->Get(x, y); + int32_t value = m_matrix->Get(x, y); if(!(value == 0 || value == 1)) { e = BCExceptionValueMustBeEither0or1; BC_EXCEPTION_CHECK_ReturnValue(e, 0); @@ -129,35 +129,35 @@ void CBC_QRCoder::SetECLevel(CBC_QRCoderErrorCorrectionLevel* ecLevel) { m_ecLevel = ecLevel; } -void CBC_QRCoder::SetVersion(FX_INT32 version) +void CBC_QRCoder::SetVersion(int32_t version) { m_version = version; } -void CBC_QRCoder::SetMatrixWidth(FX_INT32 width) +void CBC_QRCoder::SetMatrixWidth(int32_t width) { m_matrixWidth = width; } -void CBC_QRCoder::SetMaskPattern(FX_INT32 pattern) +void CBC_QRCoder::SetMaskPattern(int32_t pattern) { m_maskPattern = pattern; } -void CBC_QRCoder::SetNumDataBytes(FX_INT32 bytes) +void CBC_QRCoder::SetNumDataBytes(int32_t bytes) { m_numDataBytes = bytes; } -void CBC_QRCoder::SetNumTotalBytes(FX_INT32 value) +void CBC_QRCoder::SetNumTotalBytes(int32_t value) { m_numTotalBytes = value; } -void CBC_QRCoder::SetNumRSBlocks(FX_INT32 block) +void CBC_QRCoder::SetNumRSBlocks(int32_t block) { m_numRSBlocks = block; } -void CBC_QRCoder::SetNumECBytes(FX_INT32 value) +void CBC_QRCoder::SetNumECBytes(int32_t value) { m_numECBytes = value; } -FX_BOOL CBC_QRCoder::IsValidMaskPattern(FX_INT32 maskPattern) +FX_BOOL CBC_QRCoder::IsValidMaskPattern(int32_t maskPattern) { return maskPattern >= 0 && maskPattern < NUM_MASK_PATTERNS; } @@ -165,4 +165,4 @@ void CBC_QRCoder::SetMatrix(CBC_CommonByteMatrix* value) { m_matrix = value; } -const FX_INT32 CBC_QRCoder::NUM_MASK_PATTERNS = 8; +const int32_t CBC_QRCoder::NUM_MASK_PATTERNS = 8; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoder.h b/xfa/src/fxbarcode/qrcode/BC_QRCoder.h index 3c24dc2bc9..72db2fe487 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoder.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoder.h @@ -15,41 +15,41 @@ class CBC_QRCoder private: CBC_QRCoderMode* m_mode; CBC_QRCoderErrorCorrectionLevel* m_ecLevel; - FX_INT32 m_version; - FX_INT32 m_matrixWidth; - FX_INT32 m_maskPattern; - FX_INT32 m_numTotalBytes; - FX_INT32 m_numDataBytes; - FX_INT32 m_numECBytes; - FX_INT32 m_numRSBlocks; + int32_t m_version; + int32_t m_matrixWidth; + int32_t m_maskPattern; + int32_t m_numTotalBytes; + int32_t m_numDataBytes; + int32_t m_numECBytes; + int32_t m_numRSBlocks; CBC_CommonByteMatrix* m_matrix; public: - const static FX_INT32 NUM_MASK_PATTERNS; + const static int32_t NUM_MASK_PATTERNS; CBC_QRCoder(); virtual ~CBC_QRCoder(); CBC_QRCoderMode* GetMode(); CBC_QRCoderErrorCorrectionLevel* GetECLevel(); - FX_INT32 GetVersion(); - FX_INT32 GetMatrixWidth(); - FX_INT32 GetMaskPattern(); - FX_INT32 GetNumTotalBytes(); - FX_INT32 GetNumDataBytes(); - FX_INT32 GetNumECBytes(); - FX_INT32 GetNumRSBlocks(); + int32_t GetVersion(); + int32_t GetMatrixWidth(); + int32_t GetMaskPattern(); + int32_t GetNumTotalBytes(); + int32_t GetNumDataBytes(); + int32_t GetNumECBytes(); + int32_t GetNumRSBlocks(); CBC_CommonByteMatrix* GetMatrix(); - FX_INT32 At(FX_INT32 x, FX_INT32 y, FX_INT32 &e); + int32_t At(int32_t x, int32_t y, int32_t &e); FX_BOOL IsValid(); void SetMode(CBC_QRCoderMode* value); void SetECLevel(CBC_QRCoderErrorCorrectionLevel* ecLevel); - void SetVersion(FX_INT32 version); - void SetMatrixWidth(FX_INT32 width); - void SetMaskPattern(FX_INT32 pattern); - void SetNumDataBytes(FX_INT32 bytes); - void SetNumTotalBytes(FX_INT32 value); - void SetNumECBytes(FX_INT32 value); - void SetNumRSBlocks(FX_INT32 block); + void SetVersion(int32_t version); + void SetMatrixWidth(int32_t width); + void SetMaskPattern(int32_t pattern); + void SetNumDataBytes(int32_t bytes); + void SetNumTotalBytes(int32_t value); + void SetNumECBytes(int32_t value); + void SetNumRSBlocks(int32_t block); void SetMatrix(CBC_CommonByteMatrix* value); - static FX_BOOL IsValidMaskPattern(FX_INT32 maskPattern); + static FX_BOOL IsValidMaskPattern(int32_t maskPattern); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp index b7a0a1c3a7..53a5e487a4 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.cpp @@ -29,7 +29,7 @@ CBC_QRCoderBitVector::CBC_QRCoderBitVector() } void CBC_QRCoderBitVector::Init() { - m_array = FX_Alloc(FX_BYTE, m_size); + m_array = FX_Alloc(uint8_t, m_size); } CBC_QRCoderBitVector::~CBC_QRCoderBitVector() { @@ -47,32 +47,32 @@ void CBC_QRCoderBitVector::Clear() } m_sizeInBits = 0; m_size = 32; - m_array = FX_Alloc(FX_BYTE, m_size); + m_array = FX_Alloc(uint8_t, m_size); } -FX_INT32 CBC_QRCoderBitVector::At(FX_INT32 index, FX_INT32 &e) +int32_t CBC_QRCoderBitVector::At(int32_t index, int32_t &e) { if(index < 0 || index >= m_sizeInBits) { e = BCExceptionBadIndexException; BC_EXCEPTION_CHECK_ReturnValue(e, 0); } - FX_INT32 value = m_array[index >> 3] & 0xff; + int32_t value = m_array[index >> 3] & 0xff; return (value >> (7 - (index & 0x7))) & 1; } -FX_INT32 CBC_QRCoderBitVector::sizeInBytes() +int32_t CBC_QRCoderBitVector::sizeInBytes() { return (m_sizeInBits + 7) >> 3; } -FX_INT32 CBC_QRCoderBitVector::Size() +int32_t CBC_QRCoderBitVector::Size() { return m_sizeInBits; } -void CBC_QRCoderBitVector::AppendBit(FX_INT32 bit, FX_INT32 &e) +void CBC_QRCoderBitVector::AppendBit(int32_t bit, int32_t &e) { if(!(bit == 0 || bit == 1)) { e = BCExceptionBadValueException; BC_EXCEPTION_CHECK_ReturnVoid(e); } - FX_INT32 numBitsInLastByte = m_sizeInBits & 0x7; + int32_t numBitsInLastByte = m_sizeInBits & 0x7; if(numBitsInLastByte == 0) { AppendByte(0); m_sizeInBits -= 8; @@ -80,55 +80,55 @@ void CBC_QRCoderBitVector::AppendBit(FX_INT32 bit, FX_INT32 &e) m_array[m_sizeInBits >> 3] |= (bit << (7 - numBitsInLastByte)); ++m_sizeInBits; } -void CBC_QRCoderBitVector::AppendBits(FX_INT32 value, FX_INT32 numBits, FX_INT32 &e) +void CBC_QRCoderBitVector::AppendBits(int32_t value, int32_t numBits, int32_t &e) { if (numBits < 0 || numBits > 32) { e = BCExceptionBadNumBitsException; BC_EXCEPTION_CHECK_ReturnVoid(e); } - FX_INT32 numBitsLeft = numBits; + int32_t numBitsLeft = numBits; while (numBitsLeft > 0) { if ((m_sizeInBits & 0x7) == 0 && numBitsLeft >= 8) { - FX_INT32 newByte = (value >> (numBitsLeft - 8)) & 0xff; + int32_t newByte = (value >> (numBitsLeft - 8)) & 0xff; AppendByte(newByte); numBitsLeft -= 8; } else { - FX_INT32 bit = (value >> (numBitsLeft - 1)) & 1; + int32_t bit = (value >> (numBitsLeft - 1)) & 1; AppendBit(bit, e); BC_EXCEPTION_CHECK_ReturnVoid(e); --numBitsLeft; } } } -void CBC_QRCoderBitVector::AppendBitVector(CBC_QRCoderBitVector *bits, FX_INT32 &e) +void CBC_QRCoderBitVector::AppendBitVector(CBC_QRCoderBitVector *bits, int32_t &e) { - FX_INT32 size = bits->Size(); - for(FX_INT32 i = 0; i < size; i++) { - FX_INT32 num = bits->At(i, e); + int32_t size = bits->Size(); + for(int32_t i = 0; i < size; i++) { + int32_t num = bits->At(i, e); BC_EXCEPTION_CHECK_ReturnVoid(e); AppendBit(num, e); BC_EXCEPTION_CHECK_ReturnVoid(e) } } -void CBC_QRCoderBitVector::XOR(CBC_QRCoderBitVector *other, FX_INT32 &e) +void CBC_QRCoderBitVector::XOR(CBC_QRCoderBitVector *other, int32_t &e) { if(m_sizeInBits != other->Size()) { e = BCExceptioncanNotOperatexorOperator; BC_EXCEPTION_CHECK_ReturnVoid(e); } - FX_INT32 sizeInBytes = (m_sizeInBits + 7) >> 3; - for(FX_INT32 i = 0; i < sizeInBytes; ++i) { + int32_t sizeInBytes = (m_sizeInBits + 7) >> 3; + for(int32_t i = 0; i < sizeInBytes; ++i) { m_array[i] ^= (other->GetArray())[i]; } } -FX_BYTE* CBC_QRCoderBitVector::GetArray() +uint8_t* CBC_QRCoderBitVector::GetArray() { return m_array; } -void CBC_QRCoderBitVector::AppendByte(FX_INT32 value) +void CBC_QRCoderBitVector::AppendByte(int32_t value) { if((m_sizeInBits >> 3) == m_size) { - FX_BYTE* newArray = FX_Alloc(FX_BYTE, m_size << 1); + uint8_t* newArray = FX_Alloc(uint8_t, m_size << 1); FXSYS_memcpy32(newArray, m_array, m_size); if(m_array != NULL) { FX_Free(m_array); @@ -136,6 +136,6 @@ void CBC_QRCoderBitVector::AppendByte(FX_INT32 value) m_array = newArray; m_size = m_size << 1; } - m_array[m_sizeInBits >> 3] = (FX_BYTE) value; + m_array[m_sizeInBits >> 3] = (uint8_t) value; m_sizeInBits += 8; } diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.h index ae73fe8c88..49549ba0d2 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.h @@ -9,22 +9,22 @@ class CBC_QRCoderBitVector { private: - FX_INT32 m_sizeInBits; - FX_BYTE *m_array; - FX_INT32 m_size; + int32_t m_sizeInBits; + uint8_t *m_array; + int32_t m_size; - void AppendByte(FX_INT32 value); + void AppendByte(int32_t value); public: CBC_QRCoderBitVector(); virtual ~CBC_QRCoderBitVector(); - FX_INT32 At(FX_INT32 index, FX_INT32 &e); - FX_INT32 Size(); - FX_INT32 sizeInBytes(); - void AppendBit(FX_INT32 bit, FX_INT32 &e); - void AppendBits(FX_INT32 value, FX_INT32 numBits, FX_INT32 &e); - void AppendBitVector(CBC_QRCoderBitVector *bits, FX_INT32 &e); - void XOR(CBC_QRCoderBitVector *other, FX_INT32 &e); - FX_BYTE* GetArray(); + int32_t At(int32_t index, int32_t &e); + int32_t Size(); + int32_t sizeInBytes(); + void AppendBit(int32_t bit, int32_t &e); + void AppendBits(int32_t value, int32_t numBits, int32_t &e); + void AppendBitVector(CBC_QRCoderBitVector *bits, int32_t &e); + void XOR(CBC_QRCoderBitVector *other, int32_t &e); + uint8_t* GetArray(); void Clear(); virtual void Init(); }; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp index 6f16db6ad8..e866873d24 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.cpp @@ -47,12 +47,12 @@ CBC_QRCoderDecoder::~CBC_QRCoderDecoder() } m_rsDecoder = NULL; } -CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(FX_BOOL* image, FX_INT32 width, FX_INT32 height, FX_INT32 &e) +CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(FX_BOOL* image, int32_t width, int32_t height, int32_t &e) { CBC_CommonBitMatrix bits; bits.Init(width); - for(FX_INT32 i = 0; i < width; i++) { - for(FX_INT32 j = 0; j < height; j++) { + for(int32_t i = 0; i < width; i++) { + for(int32_t j = 0; j < height; j++) { if(image[i * width + j]) { bits.Set(j, i); } @@ -62,7 +62,7 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(FX_BOOL* image, FX_INT32 wid BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return cdr; } -CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, FX_INT32 byteModeDecode, FX_INT32 &e) +CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, int32_t byteModeDecode, int32_t &e) { CBC_QRBitMatrixParser parser; parser.Init(bits, e); @@ -77,19 +77,19 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, F CBC_AutoPtr codewords(ba); CFX_PtrArray *dataBlocks = CBC_QRDataBlock::GetDataBlocks(codewords.get(), version, ecLevel, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - FX_INT32 totalBytes = 0; - for (FX_INT32 i = 0; i < dataBlocks->GetSize(); i++) { + int32_t totalBytes = 0; + for (int32_t i = 0; i < dataBlocks->GetSize(); i++) { totalBytes += ((CBC_QRDataBlock*) ((*dataBlocks)[i]))->GetNumDataCodewords(); } CFX_ByteArray resultBytes; - FX_INT32 resultOffset = 0; - for (FX_INT32 j = 0; j < dataBlocks->GetSize(); j++) { + int32_t resultOffset = 0; + for (int32_t j = 0; j < dataBlocks->GetSize(); j++) { CBC_QRDataBlock *dataBlock = (CBC_QRDataBlock *)((*dataBlocks)[j]); CFX_ByteArray* codewordBytes = dataBlock->GetCodewords(); - FX_INT32 numDataCodewords = dataBlock->GetNumDataCodewords(); + int32_t numDataCodewords = dataBlock->GetNumDataCodewords(); CorrectErrors(codewordBytes, numDataCodewords, e); if (e != BCExceptionNO) { - for(FX_INT32 k = 0; k < dataBlocks->GetSize(); k++) { + for(int32_t k = 0; k < dataBlocks->GetSize(); k++) { delete (CBC_QRDataBlock*)(*dataBlocks)[k]; } dataBlocks->RemoveAll(); @@ -97,11 +97,11 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, F dataBlocks = NULL; return NULL; } - for(FX_INT32 i = 0; i < numDataCodewords; i++) { + for(int32_t i = 0; i < numDataCodewords; i++) { resultBytes.Add((*codewordBytes)[i]); } } - for(FX_INT32 k = 0; k < dataBlocks->GetSize(); k++) { + for(int32_t k = 0; k < dataBlocks->GetSize(); k++) { delete (CBC_QRDataBlock*)(*dataBlocks)[k] ; } dataBlocks->RemoveAll(); @@ -111,18 +111,18 @@ CBC_CommonDecoderResult* CBC_QRCoderDecoder::Decode(CBC_CommonBitMatrix* bits, F BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return cdr; } -void CBC_QRCoderDecoder::CorrectErrors(CFX_ByteArray* codewordBytes, FX_INT32 numDataCodewords, FX_INT32 &e) +void CBC_QRCoderDecoder::CorrectErrors(CFX_ByteArray* codewordBytes, int32_t numDataCodewords, int32_t &e) { - FX_INT32 numCodewords = codewordBytes->GetSize(); + int32_t numCodewords = codewordBytes->GetSize(); CFX_Int32Array codewordsInts; codewordsInts.SetSize(numCodewords); - for(FX_INT32 i = 0; i < numCodewords; i++) { - codewordsInts[i] = (FX_INT32)((*codewordBytes)[i] & 0xff); + for(int32_t i = 0; i < numCodewords; i++) { + codewordsInts[i] = (int32_t)((*codewordBytes)[i] & 0xff); } - FX_INT32 numECCodewords = codewordBytes->GetSize() - numDataCodewords; + int32_t numECCodewords = codewordBytes->GetSize() - numDataCodewords; m_rsDecoder->Decode(&codewordsInts, numECCodewords, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - for(FX_INT32 k = 0; k < numDataCodewords; k++) { - (*codewordBytes)[k] = (FX_BYTE) codewordsInts[k]; + for(int32_t k = 0; k < numDataCodewords; k++) { + (*codewordBytes)[k] = (uint8_t) codewordsInts[k]; } } diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h index 00238544c3..7747c7ba5b 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderDecoder.h @@ -20,9 +20,9 @@ public: CBC_QRCoderDecoder(); virtual ~CBC_QRCoderDecoder(); - CBC_CommonDecoderResult* Decode(FX_BOOL* image, FX_INT32 width, FX_INT32 height, FX_INT32 &e); - CBC_CommonDecoderResult* Decode(CBC_CommonBitMatrix* bits, FX_INT32 byteModeDecode, FX_INT32 &e); - void CorrectErrors(CFX_ByteArray* codewordBytes, FX_INT32 numDataCodewords, FX_INT32 &e); + CBC_CommonDecoderResult* Decode(FX_BOOL* image, int32_t width, int32_t height, int32_t &e); + CBC_CommonDecoderResult* Decode(CBC_CommonBitMatrix* bits, int32_t byteModeDecode, int32_t &e); + void CorrectErrors(CFX_ByteArray* codewordBytes, int32_t numDataCodewords, int32_t &e); virtual void Init(); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.cpp index a475cecb37..7dfef9356d 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.cpp @@ -22,7 +22,7 @@ #include "../barcode.h" #include "BC_QRCoderECB.h" -CBC_QRCoderECB::CBC_QRCoderECB(FX_INT32 count, FX_INT32 dataCodeWords) +CBC_QRCoderECB::CBC_QRCoderECB(int32_t count, int32_t dataCodeWords) { m_dataCodeWords = dataCodeWords; m_count = count; @@ -30,11 +30,11 @@ CBC_QRCoderECB::CBC_QRCoderECB(FX_INT32 count, FX_INT32 dataCodeWords) CBC_QRCoderECB::~CBC_QRCoderECB() { } -FX_INT32 CBC_QRCoderECB::GetCount() +int32_t CBC_QRCoderECB::GetCount() { return m_count; } -FX_INT32 CBC_QRCoderECB::GetDataCodeWords() +int32_t CBC_QRCoderECB::GetDataCodeWords() { return m_dataCodeWords; } diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.h index e8c2d36999..5a9c25bd53 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderECB.h @@ -9,12 +9,12 @@ class CBC_QRCoderECB { private: - FX_INT32 m_count; - FX_INT32 m_dataCodeWords; + int32_t m_count; + int32_t m_dataCodeWords; public: - CBC_QRCoderECB(FX_INT32 count, FX_INT32 dataCodeWords); + CBC_QRCoderECB(int32_t count, int32_t dataCodeWords); virtual ~CBC_QRCoderECB(); - FX_INT32 GetCount(); - FX_INT32 GetDataCodeWords(); + int32_t GetCount(); + int32_t GetDataCodeWords(); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp index 22485fe733..3c40cfd34b 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp @@ -23,12 +23,12 @@ #include "../barcode.h" #include "BC_QRCoderECB.h" #include "BC_QRCoderECBlocks.h" -CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(FX_INT32 ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks) +CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks) { m_ecCodeWordsPerBlock = ecCodeWordsPerBlock; m_ecBlocks.Add(ecBlocks); } -CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(FX_INT32 ecCodeWordsPerBlock, +CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks1, CBC_QRCoderECB* ecBlocks2) { @@ -38,24 +38,24 @@ CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(FX_INT32 ecCodeWordsPerBlock, } CBC_QRCoderECBlocks::~CBC_QRCoderECBlocks() { - for (FX_INT32 i = 0 ; i < m_ecBlocks.GetSize(); i++) { + for (int32_t i = 0 ; i < m_ecBlocks.GetSize(); i++) { delete ( (CBC_QRCoderECB*)(m_ecBlocks[i]) ) ; } m_ecBlocks.RemoveAll(); } -FX_INT32 CBC_QRCoderECBlocks::GetECCodeWordsPerBlock() +int32_t CBC_QRCoderECBlocks::GetECCodeWordsPerBlock() { return m_ecCodeWordsPerBlock; } -FX_INT32 CBC_QRCoderECBlocks::GetNumBlocks() +int32_t CBC_QRCoderECBlocks::GetNumBlocks() { - FX_INT32 total = 0; - for(FX_INT32 i = 0; i < m_ecBlocks.GetSize(); i++) { + int32_t total = 0; + for(int32_t i = 0; i < m_ecBlocks.GetSize(); i++) { total += ( (CBC_QRCoderECB*)(m_ecBlocks[i]) )->GetCount(); } return total; } -FX_INT32 CBC_QRCoderECBlocks::GetTotalECCodeWords() +int32_t CBC_QRCoderECBlocks::GetTotalECCodeWords() { return m_ecCodeWordsPerBlock * GetNumBlocks(); } diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h index 7f229742ab..8a962e1627 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h @@ -10,15 +10,15 @@ class CBC_QRCoderECB; class CBC_QRCoderECBlocks { private: - FX_INT32 m_ecCodeWordsPerBlock; + int32_t m_ecCodeWordsPerBlock; CFX_PtrArray m_ecBlocks; public: - CBC_QRCoderECBlocks(FX_INT32 ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks); - CBC_QRCoderECBlocks(FX_INT32 ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks1, CBC_QRCoderECB* ecBlocks2); + CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks); + CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock, CBC_QRCoderECB* ecBlocks1, CBC_QRCoderECB* ecBlocks2); virtual ~CBC_QRCoderECBlocks(); - FX_INT32 GetECCodeWordsPerBlock(); - FX_INT32 GetNumBlocks(); - FX_INT32 GetTotalECCodeWords(); + int32_t GetECCodeWordsPerBlock(); + int32_t GetNumBlocks(); + int32_t GetTotalECCodeWords(); CFX_PtrArray* GetECBlocks(); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp index 3f6a644f0f..2ec490f109 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp @@ -36,7 +36,7 @@ #include "BC_QRCoderMaskUtil.h" #include "BC_QRCoderMatrixUtil.h" #include "BC_QRCoderBitVector.h" -const FX_INT32 CBC_QRCoderEncoder::m_alphaNumbericTable[] = { +const int32_t CBC_QRCoderEncoder::m_alphaNumbericTable[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, @@ -71,7 +71,7 @@ public: ~Make_Pair() {} }; void CBC_QRCoderEncoder::Encode(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, - CBC_QRCoder *qrCode, FX_INT32 &e, FX_INT32 versionSpecify) + CBC_QRCoder *qrCode, int32_t &e, int32_t versionSpecify) { if(versionSpecify == 0) { EncodeWithAutoVersion(content, ecLevel, qrCode, e); @@ -88,9 +88,9 @@ void CBC_QRCoderEncoder::AppendECI(CBC_QRCoderBitVector* bits) { } void CBC_QRCoderEncoder::AppendDataModeLenghInfo(CFX_PtrArray &splitResult, CBC_QRCoderBitVector &headerAndDataBits, - CBC_QRCoderMode *tempMode, CBC_QRCoder *qrCode, CFX_ByteString &encoding, FX_INT32 &e) + CBC_QRCoderMode *tempMode, CBC_QRCoder *qrCode, CFX_ByteString &encoding, int32_t &e) { - for(FX_INT32 i = 0; i < splitResult.GetSize(); i++) { + for(int32_t i = 0; i < splitResult.GetSize(); i++) { tempMode = ((Make_Pair*)splitResult[i])->m_mode; if(tempMode == CBC_QRCoderMode::sGBK) { AppendModeInfo(tempMode, &headerAndDataBits, e); @@ -130,9 +130,9 @@ void CBC_QRCoderEncoder::AppendDataModeLenghInfo(CFX_PtrArray &splitResult, CBC_ } void CBC_QRCoderEncoder::SplitString(const CFX_ByteString &content, CFX_PtrArray &result) { - FX_INT32 index = 0, flag = 0; - while((((FX_BYTE)content[index] >= 0xA1 && (FX_BYTE)content[index] <= 0xAA) || - ((FX_BYTE)content[index] >= 0xB0 && (FX_BYTE)content[index] <= 0xFA)) && (index < content.GetLength())) { + int32_t index = 0, flag = 0; + while((((uint8_t)content[index] >= 0xA1 && (uint8_t)content[index] <= 0xAA) || + ((uint8_t)content[index] >= 0xB0 && (uint8_t)content[index] <= 0xFA)) && (index < content.GetLength())) { index += 2; } if(index != flag) { @@ -142,14 +142,14 @@ void CBC_QRCoderEncoder::SplitString(const CFX_ByteString &content, CFX_PtrArray if(index >= content.GetLength()) { return; } - while(GetAlphaNumericCode((FX_BYTE)content[index]) == -1 - && !(((FX_BYTE)content[index] >= 0xA1 && (FX_BYTE)content[index] <= 0xAA) || - ((FX_BYTE)content[index] >= 0xB0 && (FX_BYTE)content[index] <= 0xFA)) + while(GetAlphaNumericCode((uint8_t)content[index]) == -1 + && !(((uint8_t)content[index] >= 0xA1 && (uint8_t)content[index] <= 0xAA) || + ((uint8_t)content[index] >= 0xB0 && (uint8_t)content[index] <= 0xFA)) && (index < content.GetLength())) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - if(IsDBCSLeadByte((FX_BYTE)content[index])) + if(IsDBCSLeadByte((uint8_t)content[index])) #else - if((FX_BYTE)content[index] > 127) + if((uint8_t)content[index] > 127) #endif { index += 2; @@ -164,7 +164,7 @@ void CBC_QRCoderEncoder::SplitString(const CFX_ByteString &content, CFX_PtrArray if(index >= content.GetLength()) { return; } - while(FXSYS_Isdigit((FX_BYTE)content[index]) && (index < content.GetLength())) { + while(FXSYS_Isdigit((uint8_t)content[index]) && (index < content.GetLength())) { index++; } if(index != flag) { @@ -174,7 +174,7 @@ void CBC_QRCoderEncoder::SplitString(const CFX_ByteString &content, CFX_PtrArray if(index >= content.GetLength()) { return; } - while(GetAlphaNumericCode((FX_BYTE)content[index]) != -1 && (index < content.GetLength())) { + while(GetAlphaNumericCode((uint8_t)content[index]) != -1 && (index < content.GetLength())) { index++; } if(index != flag) { @@ -186,7 +186,7 @@ void CBC_QRCoderEncoder::SplitString(const CFX_ByteString &content, CFX_PtrArray } SplitString(content.Mid(index, content.GetLength() - index), result); } -FX_INT32 CBC_QRCoderEncoder::GetSpanByVersion(CBC_QRCoderMode *modeFirst, CBC_QRCoderMode *modeSecond, FX_INT32 versionNum, FX_INT32 &e) +int32_t CBC_QRCoderEncoder::GetSpanByVersion(CBC_QRCoderMode *modeFirst, CBC_QRCoderMode *modeSecond, int32_t versionNum, int32_t &e) { if(versionNum == 0) { return 0; @@ -230,17 +230,17 @@ FX_INT32 CBC_QRCoderEncoder::GetSpanByVersion(CBC_QRCoderMode *modeFirst, CBC_QR } return -1; } -void CBC_QRCoderEncoder::MergeString(CFX_PtrArray &result, FX_INT32 versionNum, FX_INT32 &e) +void CBC_QRCoderEncoder::MergeString(CFX_PtrArray &result, int32_t versionNum, int32_t &e) { Make_Pair *first = NULL; Make_Pair *second = NULL; size_t mergeNum = 0; - FX_INT32 i; + int32_t i; for(i = 0; ((i < result.GetSize()) && (i + 1 < result.GetSize())); i++) { first = (Make_Pair*)result[i]; second = (Make_Pair*)result[i + 1]; if(first->m_mode == CBC_QRCoderMode::sALPHANUMERIC) { - FX_INT32 tmp = GetSpanByVersion(CBC_QRCoderMode::sALPHANUMERIC, CBC_QRCoderMode::sBYTE, versionNum, e); + int32_t tmp = GetSpanByVersion(CBC_QRCoderMode::sALPHANUMERIC, CBC_QRCoderMode::sBYTE, versionNum, e); BC_EXCEPTION_CHECK_ReturnVoid(e); if((second->m_mode == CBC_QRCoderMode::sBYTE) && (first->m_string.GetLength() < tmp)) { @@ -260,7 +260,7 @@ void CBC_QRCoderEncoder::MergeString(CFX_PtrArray &result, FX_INT32 versionNum, mergeNum++; } } else if(first->m_mode == CBC_QRCoderMode::sNUMERIC) { - FX_INT32 tmp = GetSpanByVersion(CBC_QRCoderMode::sNUMERIC, CBC_QRCoderMode::sBYTE, versionNum, e); + int32_t tmp = GetSpanByVersion(CBC_QRCoderMode::sNUMERIC, CBC_QRCoderMode::sBYTE, versionNum, e); BC_EXCEPTION_CHECK_ReturnVoid(e); if((second->m_mode == CBC_QRCoderMode::sBYTE) && (first->m_string.GetLength() < tmp)) { @@ -290,18 +290,18 @@ void CBC_QRCoderEncoder::MergeString(CFX_PtrArray &result, FX_INT32 versionNum, MergeString(result, versionNum, e); BC_EXCEPTION_CHECK_ReturnVoid(e); } -void CBC_QRCoderEncoder::InitQRCode(FX_INT32 numInputBytes, FX_INT32 versionNumber, - CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, FX_INT32 &e) +void CBC_QRCoderEncoder::InitQRCode(int32_t numInputBytes, int32_t versionNumber, + CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, int32_t &e) { qrCode->SetECLevel(ecLevel); qrCode->SetMode(mode); CBC_QRCoderVersion* version = CBC_QRCoderVersion::GetVersionForNumber(versionNumber, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 numBytes = version->GetTotalCodeWords(); + int32_t numBytes = version->GetTotalCodeWords(); CBC_QRCoderECBlocks* ecBlocks = version->GetECBlocksForLevel(ecLevel); - FX_INT32 numEcBytes = ecBlocks->GetTotalECCodeWords(); - FX_INT32 numRSBlocks = ecBlocks->GetNumBlocks(); - FX_INT32 numDataBytes = numBytes - numEcBytes; + int32_t numEcBytes = ecBlocks->GetTotalECCodeWords(); + int32_t numRSBlocks = ecBlocks->GetNumBlocks(); + int32_t numDataBytes = numBytes - numEcBytes; if(numDataBytes >= numInputBytes + 3) { qrCode->SetVersion(versionNumber); qrCode->SetNumTotalBytes(numBytes); @@ -315,7 +315,7 @@ void CBC_QRCoderEncoder::InitQRCode(FX_INT32 numInputBytes, FX_INT32 versionNumb BC_EXCEPTION_CHECK_ReturnVoid(e); } void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, - CBC_QRCoder *qrCode, FX_INT32 versionSpecify, FX_INT32 &e) + CBC_QRCoder *qrCode, int32_t versionSpecify, int32_t &e) { CFX_ByteString encoding = "utf8"; CBC_QRCoderMode *mode = CBC_QRCoderMode::sBYTE; @@ -326,22 +326,22 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(const CFX_ByteString &content, MergeString(splitResult, versionSpecify, e); BC_EXCEPTION_CHECK_ReturnVoid(e) CBC_QRCoderMode *tempMode = NULL; - for(FX_INT32 i = 0; i < splitResult.GetSize(); i++) { + for(int32_t i = 0; i < splitResult.GetSize(); i++) { AppendBytes(((Make_Pair*)splitResult[i])->m_string, ((Make_Pair*)splitResult[i])->m_mode, &dataBits, encoding, e); if(e != BCExceptionNO) { - for(FX_INT32 y = 0; y < splitResult.GetSize(); y++) { + for(int32_t y = 0; y < splitResult.GetSize(); y++) { delete (Make_Pair*)splitResult[y]; } splitResult.RemoveAll(); return; } } - FX_INT32 numInputBytes = dataBits.sizeInBytes(); + int32_t numInputBytes = dataBits.sizeInBytes(); CBC_QRCoderBitVector headerAndDataBits; headerAndDataBits.Init(); InitQRCode(numInputBytes, versionSpecify, ecLevel, mode, qrCode, e); if(e != BCExceptionNO) { - for(FX_INT32 k = 0; k < splitResult.GetSize(); k++) { + for(int32_t k = 0; k < splitResult.GetSize(); k++) { delete (Make_Pair*)splitResult[k]; } splitResult.RemoveAll(); @@ -349,7 +349,7 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(const CFX_ByteString &content, } AppendDataModeLenghInfo(splitResult, headerAndDataBits, tempMode, qrCode, encoding, e); if(e != BCExceptionNO) { - for(FX_INT32 k = 0; k < splitResult.GetSize(); k++) { + for(int32_t k = 0; k < splitResult.GetSize(); k++) { delete (Make_Pair*)splitResult[k]; } splitResult.RemoveAll(); @@ -358,13 +358,13 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(const CFX_ByteString &content, numInputBytes = headerAndDataBits.sizeInBytes(); TerminateBits(qrCode->GetNumDataBytes(), &headerAndDataBits, e); if(e != BCExceptionNO) { - for(FX_INT32 k = 0; k < splitResult.GetSize(); k++) { + for(int32_t k = 0; k < splitResult.GetSize(); k++) { delete (Make_Pair*)splitResult[k]; } splitResult.RemoveAll(); return ; } - for(FX_INT32 j = 0; j < splitResult.GetSize(); j++) { + for(int32_t j = 0; j < splitResult.GetSize(); j++) { delete (Make_Pair*)splitResult[j]; } splitResult.RemoveAll(); @@ -376,7 +376,7 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(const CFX_ByteString &content, CBC_CommonByteMatrix* pDecoder = FX_NEW CBC_CommonByteMatrix(qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()); pDecoder->Init(); CBC_AutoPtr matrix(pDecoder); - FX_INT32 maskPattern = ChooseMaskPattern(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e); + int32_t maskPattern = ChooseMaskPattern(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e); BC_EXCEPTION_CHECK_ReturnVoid(e); qrCode->SetMaskPattern(maskPattern); CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), qrCode->GetMaskPattern(), matrix.get(), e); @@ -387,7 +387,7 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(const CFX_ByteString &content, BC_EXCEPTION_CHECK_ReturnVoid(e); } } -void CBC_QRCoderEncoder::EncodeWithAutoVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, FX_INT32 &e) +void CBC_QRCoderEncoder::EncodeWithAutoVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, int32_t &e) { CFX_ByteString encoding = "utf8"; CBC_QRCoderMode *mode = CBC_QRCoderMode::sBYTE; @@ -398,23 +398,23 @@ void CBC_QRCoderEncoder::EncodeWithAutoVersion(const CFX_ByteString &content, CB MergeString(splitResult, 8, e); BC_EXCEPTION_CHECK_ReturnVoid(e); CBC_QRCoderMode *tempMode = NULL; - for(FX_INT32 i = 0; i < splitResult.GetSize(); i++) { + for(int32_t i = 0; i < splitResult.GetSize(); i++) { AppendBytes(((Make_Pair*)splitResult[i])->m_string, ((Make_Pair*)splitResult[i])->m_mode, &dataBits, encoding, e); if(e != BCExceptionNO) { - for(FX_INT32 l = 0; l < splitResult.GetSize(); l++) { + for(int32_t l = 0; l < splitResult.GetSize(); l++) { delete (Make_Pair*)splitResult[l]; } splitResult.RemoveAll(); return; } } - FX_INT32 numInputBytes = dataBits.sizeInBytes(); + int32_t numInputBytes = dataBits.sizeInBytes(); InitQRCode(numInputBytes, ecLevel, mode, qrCode, e); BC_EXCEPTION_CHECK_ReturnVoid(e) CBC_QRCoderBitVector headerAndDataBits; headerAndDataBits.Init(); tempMode = NULL; - FX_INT32 versionNum = qrCode->GetVersion(); + int32_t versionNum = qrCode->GetVersion(); sign: AppendDataModeLenghInfo(splitResult, headerAndDataBits, tempMode, qrCode, encoding, e); if (e != BCExceptionNO) { @@ -427,7 +427,7 @@ sign: } catchException: if (e != BCExceptionNO) { - FX_INT32 e1 = BCExceptionNO; + int32_t e1 = BCExceptionNO; InitQRCode(numInputBytes, ecLevel, mode, qrCode, e1); if (e1 != BCExceptionNO) { e = e1; @@ -439,14 +439,14 @@ catchException: e = BCExceptionNO; goto sign; } else { - for (FX_INT32 j = 0; j < splitResult.GetSize(); j++) { + for (int32_t j = 0; j < splitResult.GetSize(); j++) { delete (Make_Pair*)splitResult[j]; } splitResult.RemoveAll(); return; } } - for (FX_INT32 k = 0; k < splitResult.GetSize(); k++) { + for (int32_t k = 0; k < splitResult.GetSize(); k++) { delete (Make_Pair*)splitResult[k]; } splitResult.RemoveAll(); @@ -458,7 +458,7 @@ catchException: CBC_CommonByteMatrix* pDecoder = FX_NEW CBC_CommonByteMatrix(qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()); pDecoder->Init(); CBC_AutoPtr matrix(pDecoder); - FX_INT32 maskPattern = ChooseMaskPattern(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e); + int32_t maskPattern = ChooseMaskPattern(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e); BC_EXCEPTION_CHECK_ReturnVoid(e); qrCode->SetMaskPattern(maskPattern); CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), qrCode->GetMaskPattern(), matrix.get(), e); @@ -469,7 +469,7 @@ catchException: BC_EXCEPTION_CHECK_ReturnVoid(e); } } -void CBC_QRCoderEncoder::Encode(const CFX_WideString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, FX_INT32 &e) +void CBC_QRCoderEncoder::Encode(const CFX_WideString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, int32_t &e) { CFX_ByteString encoding = "utf8"; CFX_ByteString utf8Data; @@ -479,14 +479,14 @@ void CBC_QRCoderEncoder::Encode(const CFX_WideString &content, CBC_QRCoderErrorC dataBits.Init(); AppendBytes(utf8Data, mode, &dataBits, encoding, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 numInputBytes = dataBits.sizeInBytes(); + int32_t numInputBytes = dataBits.sizeInBytes(); InitQRCode(numInputBytes, ecLevel, mode, qrCode, e); BC_EXCEPTION_CHECK_ReturnVoid(e); CBC_QRCoderBitVector headerAndDataBits; headerAndDataBits.Init(); AppendModeInfo(mode, &headerAndDataBits, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 numLetters = mode == CBC_QRCoderMode::sBYTE ? dataBits.sizeInBytes() : content.GetLength(); + int32_t numLetters = mode == CBC_QRCoderMode::sBYTE ? dataBits.sizeInBytes() : content.GetLength(); AppendLengthInfo(numLetters, qrCode->GetVersion(), mode, &headerAndDataBits, e); BC_EXCEPTION_CHECK_ReturnVoid(e); headerAndDataBits.AppendBitVector(&dataBits, e); @@ -501,7 +501,7 @@ void CBC_QRCoderEncoder::Encode(const CFX_WideString &content, CBC_QRCoderErrorC CBC_CommonByteMatrix* pDecoder = FX_NEW CBC_CommonByteMatrix(qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()); pDecoder->Init(); CBC_AutoPtr matrix(pDecoder); - FX_INT32 maskPattern = ChooseMaskPattern(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e); + int32_t maskPattern = ChooseMaskPattern(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e); BC_EXCEPTION_CHECK_ReturnVoid(e); qrCode->SetMaskPattern(maskPattern); CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), qrCode->GetMaskPattern(), matrix.get(), e); @@ -512,21 +512,21 @@ void CBC_QRCoderEncoder::Encode(const CFX_WideString &content, CBC_QRCoderErrorC BC_EXCEPTION_CHECK_ReturnVoid(e); } } -void CBC_QRCoderEncoder::TerminateBits(FX_INT32 numDataBytes, CBC_QRCoderBitVector* bits, FX_INT32 &e) +void CBC_QRCoderEncoder::TerminateBits(int32_t numDataBytes, CBC_QRCoderBitVector* bits, int32_t &e) { - FX_INT32 capacity = numDataBytes << 3; + int32_t capacity = numDataBytes << 3; if(bits->Size() > capacity) { e = BCExceptionDataTooMany; BC_EXCEPTION_CHECK_ReturnVoid(e); } - for (FX_INT32 i = 0; i < 4 && bits->Size() < capacity; ++i) { + for (int32_t i = 0; i < 4 && bits->Size() < capacity; ++i) { bits->AppendBit(0, e); BC_EXCEPTION_CHECK_ReturnVoid(e); } - FX_INT32 numBitsInLastByte = bits->Size() % 8; + int32_t numBitsInLastByte = bits->Size() % 8; if (numBitsInLastByte > 0) { - FX_INT32 numPaddingBits = 8 - numBitsInLastByte; - for (FX_INT32 j = 0; j < numPaddingBits; ++j) { + int32_t numPaddingBits = 8 - numBitsInLastByte; + for (int32_t j = 0; j < numPaddingBits; ++j) { bits->AppendBit(0, e); BC_EXCEPTION_CHECK_ReturnVoid(e) } @@ -535,8 +535,8 @@ void CBC_QRCoderEncoder::TerminateBits(FX_INT32 numDataBytes, CBC_QRCoderBitVect e = BCExceptionDigitLengthMustBe8; BC_EXCEPTION_CHECK_ReturnVoid(e); } - FX_INT32 numPaddingBytes = numDataBytes - bits->sizeInBytes(); - for (FX_INT32 k = 0; k < numPaddingBytes; ++k) { + int32_t numPaddingBytes = numDataBytes - bits->sizeInBytes(); + for (int32_t k = 0; k < numPaddingBytes; ++k) { if (k % 2 == 0) { bits->AppendBits(0xec, 8, e); BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -550,14 +550,14 @@ void CBC_QRCoderEncoder::TerminateBits(FX_INT32 numDataBytes, CBC_QRCoderBitVect BC_EXCEPTION_CHECK_ReturnVoid(e); } } -FX_INT32 CBC_QRCoderEncoder::ChooseMaskPattern(CBC_QRCoderBitVector* bits, CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e) +int32_t CBC_QRCoderEncoder::ChooseMaskPattern(CBC_QRCoderBitVector* bits, CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e) { - FX_INT32 minPenalty = 65535; - FX_INT32 bestMaskPattern = -1; - for(FX_INT32 maskPattern = 0; maskPattern < CBC_QRCoder::NUM_MASK_PATTERNS; maskPattern++) { + int32_t minPenalty = 65535; + int32_t bestMaskPattern = -1; + for(int32_t maskPattern = 0; maskPattern < CBC_QRCoder::NUM_MASK_PATTERNS; maskPattern++) { CBC_QRCoderMatrixUtil::BuildMatrix(bits, ecLevel, version, maskPattern, matrix, e); BC_EXCEPTION_CHECK_ReturnValue(e, 0); - FX_INT32 penalty = CalculateMaskPenalty(matrix); + int32_t penalty = CalculateMaskPenalty(matrix); if(penalty < minPenalty) { minPenalty = penalty; bestMaskPattern = maskPattern; @@ -565,9 +565,9 @@ FX_INT32 CBC_QRCoderEncoder::ChooseMaskPattern(CBC_QRCoderBitVector* bits, CBC_Q } return bestMaskPattern; } -FX_INT32 CBC_QRCoderEncoder::CalculateMaskPenalty(CBC_CommonByteMatrix* matrix) +int32_t CBC_QRCoderEncoder::CalculateMaskPenalty(CBC_CommonByteMatrix* matrix) { - FX_INT32 penalty = 0; + int32_t penalty = 0; penalty += CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1(matrix); penalty += CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2(matrix); penalty += CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule3(matrix); @@ -581,10 +581,10 @@ CBC_QRCoderMode *CBC_QRCoderEncoder::ChooseMode(const CFX_ByteString &content, C } FX_BOOL hasNumeric = FALSE; FX_BOOL hasAlphaNumeric = FALSE; - for(FX_INT32 i = 0; i < content.GetLength(); i++) { - if(isdigit((FX_BYTE)content[i])) { + for(int32_t i = 0; i < content.GetLength(); i++) { + if(isdigit((uint8_t)content[i])) { hasNumeric = TRUE; - } else if(GetAlphaNumericCode((FX_BYTE)content[i]) != -1) { + } else if(GetAlphaNumericCode((uint8_t)content[i]) != -1) { hasAlphaNumeric = TRUE; } else { return CBC_QRCoderMode::sBYTE; @@ -597,14 +597,14 @@ CBC_QRCoderMode *CBC_QRCoderEncoder::ChooseMode(const CFX_ByteString &content, C } return CBC_QRCoderMode::sBYTE; } -FX_INT32 CBC_QRCoderEncoder::GetAlphaNumericCode(FX_INT32 code) +int32_t CBC_QRCoderEncoder::GetAlphaNumericCode(int32_t code) { if(code < 96 && code >= 0) { return m_alphaNumbericTable[code]; } return -1; } -void CBC_QRCoderEncoder::AppendBytes(const CFX_ByteString &content, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, FX_INT32 &e) +void CBC_QRCoderEncoder::AppendBytes(const CFX_ByteString &content, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, int32_t &e) { if(mode == CBC_QRCoderMode::sNUMERIC) { AppendNumericBytes(content, bits, e); @@ -626,20 +626,20 @@ void CBC_QRCoderEncoder::AppendBytes(const CFX_ByteString &content, CBC_QRCoderM BC_EXCEPTION_CHECK_ReturnVoid(e); } } -void CBC_QRCoderEncoder::AppendNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e) +void CBC_QRCoderEncoder::AppendNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e) { - FX_INT32 length = content.GetLength(); - FX_INT32 i = 0; + int32_t length = content.GetLength(); + int32_t i = 0; while(i < length) { - FX_INT32 num1 = content[i] - '0'; + int32_t num1 = content[i] - '0'; if(i + 2 < length) { - FX_INT32 num2 = content[i + 1] - '0'; - FX_INT32 num3 = content[i + 2] - '0'; + int32_t num2 = content[i + 1] - '0'; + int32_t num3 = content[i + 2] - '0'; bits->AppendBits(num1 * 100 + num2 * 10 + num3, 10, e); BC_EXCEPTION_CHECK_ReturnVoid(e) i += 3; } else if(i + 1 < length) { - FX_INT32 num2 = content[i + 1] - '0'; + int32_t num2 = content[i + 1] - '0'; bits->AppendBits(num1 * 10 + num2, 7, e); BC_EXCEPTION_CHECK_ReturnVoid(e) i += 2; @@ -650,18 +650,18 @@ void CBC_QRCoderEncoder::AppendNumericBytes(const CFX_ByteString &content, CBC_Q } } } -void CBC_QRCoderEncoder::AppendAlphaNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e) +void CBC_QRCoderEncoder::AppendAlphaNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e) { - FX_INT32 length = content.GetLength(); - FX_INT32 i = 0; + int32_t length = content.GetLength(); + int32_t i = 0; while(i < length) { - FX_INT32 code1 = GetAlphaNumericCode(content[i]); + int32_t code1 = GetAlphaNumericCode(content[i]); if(code1 == -1) { e = BCExceptionInvalidateCharacter; BC_EXCEPTION_CHECK_ReturnVoid(e); } if(i + 1 < length) { - FX_INT32 code2 = GetAlphaNumericCode(content[i + 1]); + int32_t code2 = GetAlphaNumericCode(content[i + 1]); if(code2 == -1) { e = BCExceptionInvalidateCharacter; BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -676,12 +676,12 @@ void CBC_QRCoderEncoder::AppendAlphaNumericBytes(const CFX_ByteString &content, } } } -void CBC_QRCoderEncoder::AppendGBKBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e) +void CBC_QRCoderEncoder::AppendGBKBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e) { - FX_INT32 length = content.GetLength(); + int32_t length = content.GetLength(); FX_DWORD value = 0; - for(FX_INT32 i = 0; i < length; i += 2) { - value = (FX_DWORD)((FX_BYTE)content[i] << 8 | (FX_BYTE)content[i + 1]); + for(int32_t i = 0; i < length; i += 2) { + value = (FX_DWORD)((uint8_t)content[i] << 8 | (uint8_t)content[i + 1]); if(value <= 0xAAFE && value >= 0xA1A1) { value -= 0xA1A1; } else if(value <= 0xFAFE && value >= 0xB0A1) { @@ -695,26 +695,26 @@ void CBC_QRCoderEncoder::AppendGBKBytes(const CFX_ByteString &content, CBC_QRCod BC_EXCEPTION_CHECK_ReturnVoid(e); } } -void CBC_QRCoderEncoder::Append8BitBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, FX_INT32 &e) +void CBC_QRCoderEncoder::Append8BitBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, int32_t &e) { - for(FX_INT32 i = 0; i < content.GetLength(); i++) { + for(int32_t i = 0; i < content.GetLength(); i++) { bits->AppendBits(content[i], 8, e); BC_EXCEPTION_CHECK_ReturnVoid(e); } } -void CBC_QRCoderEncoder::Append8BitBytes(CFX_ByteArray &bytes, CBC_QRCoderBitVector *bits, FX_INT32 &e) +void CBC_QRCoderEncoder::Append8BitBytes(CFX_ByteArray &bytes, CBC_QRCoderBitVector *bits, int32_t &e) { - for(FX_INT32 i = 0; i < bytes.GetSize(); i++) { + for(int32_t i = 0; i < bytes.GetSize(); i++) { bits->AppendBits(bytes[i], 8, e); BC_EXCEPTION_CHECK_ReturnVoid(e); } } -void CBC_QRCoderEncoder::AppendKanjiBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e) +void CBC_QRCoderEncoder::AppendKanjiBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e) { CFX_ByteArray bytes; FX_DWORD value = 0, h = 0; - for(FX_INT32 i = 0; i < bytes.GetSize(); i += 2) { - value = (FX_DWORD)((FX_BYTE)(content[i] << 8) | (FX_BYTE)content[i + 1]); + for(int32_t i = 0; i < bytes.GetSize(); i += 2) { + value = (FX_DWORD)((uint8_t)(content[i] << 8) | (uint8_t)content[i + 1]); if(value <= 0x9ffc && value >= 0x8140) { value -= 0x8140; } else if(value <= 0xebbf && value >= 0xe040) { @@ -728,19 +728,19 @@ void CBC_QRCoderEncoder::AppendKanjiBytes(const CFX_ByteString &content, CBC_QRC BC_EXCEPTION_CHECK_ReturnVoid(e); } } -void CBC_QRCoderEncoder::InitQRCode(FX_INT32 numInputBytes, CBC_QRCoderErrorCorrectionLevel* ecLevel, - CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, FX_INT32 &e) +void CBC_QRCoderEncoder::InitQRCode(int32_t numInputBytes, CBC_QRCoderErrorCorrectionLevel* ecLevel, + CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, int32_t &e) { qrCode->SetECLevel(ecLevel); qrCode->SetMode(mode); - for(FX_INT32 versionNum = 1; versionNum <= 40; versionNum++) { + for(int32_t versionNum = 1; versionNum <= 40; versionNum++) { CBC_QRCoderVersion* version = CBC_QRCoderVersion::GetVersionForNumber(versionNum, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 numBytes = version->GetTotalCodeWords(); + int32_t numBytes = version->GetTotalCodeWords(); CBC_QRCoderECBlocks* ecBlocks = version->GetECBlocksForLevel(ecLevel); - FX_INT32 numEcBytes = ecBlocks->GetTotalECCodeWords(); - FX_INT32 numRSBlocks = ecBlocks->GetNumBlocks(); - FX_INT32 numDataBytes = numBytes - numEcBytes; + int32_t numEcBytes = ecBlocks->GetTotalECCodeWords(); + int32_t numRSBlocks = ecBlocks->GetNumBlocks(); + int32_t numDataBytes = numBytes - numEcBytes; if(numDataBytes >= numInputBytes + 3) { qrCode->SetVersion(versionNum); qrCode->SetNumTotalBytes(numBytes); @@ -754,7 +754,7 @@ void CBC_QRCoderEncoder::InitQRCode(FX_INT32 numInputBytes, CBC_QRCoderErrorCorr e = BCExceptionCannotFindBlockInfo; BC_EXCEPTION_CHECK_ReturnVoid(e); } -void CBC_QRCoderEncoder::AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, FX_INT32 &e) +void CBC_QRCoderEncoder::AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, int32_t &e) { bits->AppendBits(mode->GetBits(), 4, e); if(mode == CBC_QRCoderMode::sGBK) { @@ -762,11 +762,11 @@ void CBC_QRCoderEncoder::AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVec BC_EXCEPTION_CHECK_ReturnVoid(e); } } -void CBC_QRCoderEncoder::AppendLengthInfo(FX_INT32 numLetters, FX_INT32 version, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, FX_INT32 &e) +void CBC_QRCoderEncoder::AppendLengthInfo(int32_t numLetters, int32_t version, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, int32_t &e) { CBC_QRCoderVersion* qcv = CBC_QRCoderVersion::GetVersionForNumber(version, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 numBits = mode->GetCharacterCountBits(qcv, e); + int32_t numBits = mode->GetCharacterCountBits(qcv, e); BC_EXCEPTION_CHECK_ReturnVoid(e); if(numBits > ((1 << numBits) - 1)) { return; @@ -778,20 +778,20 @@ void CBC_QRCoderEncoder::AppendLengthInfo(FX_INT32 numLetters, FX_INT32 version, bits->AppendBits(numLetters, numBits, e); BC_EXCEPTION_CHECK_ReturnVoid(e); } -void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits, FX_INT32 numTotalBytes, FX_INT32 numDataBytes, FX_INT32 numRSBlocks, CBC_QRCoderBitVector* result, FX_INT32 &e) +void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits, int32_t numTotalBytes, int32_t numDataBytes, int32_t numRSBlocks, CBC_QRCoderBitVector* result, int32_t &e) { if(bits->sizeInBytes() != numDataBytes) { e = BCExceptionBitsBytesNotMatch; BC_EXCEPTION_CHECK_ReturnVoid(e); } - FX_INT32 dataBytesOffset = 0; - FX_INT32 maxNumDataBytes = 0; - FX_INT32 maxNumEcBytes = 0; + int32_t dataBytesOffset = 0; + int32_t maxNumDataBytes = 0; + int32_t maxNumEcBytes = 0; CFX_PtrArray blocks; - FX_INT32 i; + int32_t i; for(i = 0; i < numRSBlocks; i++) { - FX_INT32 numDataBytesInBlock; - FX_INT32 numEcBytesInBlosk; + int32_t numDataBytesInBlock; + int32_t numEcBytesInBlosk; GetNumDataBytesAndNumECBytesForBlockID(numTotalBytes, numDataBytes, numRSBlocks, i, numDataBytesInBlock, numEcBytesInBlosk); CBC_CommonByteArray* dataBytes = FX_NEW CBC_CommonByteArray; @@ -807,8 +807,8 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits, FX_IN e = BCExceptionBytesNotMatchOffset; BC_EXCEPTION_CHECK_ReturnVoid(e); } - for(FX_INT32 x = 0; x < maxNumDataBytes; x++) { - for(FX_INT32 j = 0; j < blocks.GetSize(); j++) { + for(int32_t x = 0; x < maxNumDataBytes; x++) { + for(int32_t j = 0; j < blocks.GetSize(); j++) { CBC_CommonByteArray* dataBytes = ((CBC_QRCoderBlockPair*)blocks[j])->GetDataBytes(); if(x < dataBytes->Size()) { result->AppendBits(dataBytes->At(x), 8, e); @@ -816,8 +816,8 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits, FX_IN } } } - for(FX_INT32 y = 0; y < maxNumEcBytes; y++) { - for(FX_INT32 l = 0; l < blocks.GetSize(); l++) { + for(int32_t y = 0; y < maxNumEcBytes; y++) { + for(int32_t l = 0; l < blocks.GetSize(); l++) { CBC_CommonByteArray* ecBytes = ((CBC_QRCoderBlockPair*)blocks[l])->GetErrorCorrectionBytes(); if(y < ecBytes->Size()) { result->AppendBits(ecBytes->At(y), 8, e); @@ -825,7 +825,7 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits, FX_IN } } } - for(FX_INT32 k = 0; k < blocks.GetSize(); k++) { + for(int32_t k = 0; k < blocks.GetSize(); k++) { delete (CBC_QRCoderBlockPair*)blocks[k]; } if(numTotalBytes != result->sizeInBytes()) { @@ -833,21 +833,21 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits, FX_IN BC_EXCEPTION_CHECK_ReturnVoid(e); } } -void CBC_QRCoderEncoder::GetNumDataBytesAndNumECBytesForBlockID(FX_INT32 numTotalBytes, FX_INT32 numDataBytes, - FX_INT32 numRSBlocks, FX_INT32 blockID, - FX_INT32 &numDataBytesInBlock, FX_INT32& numECBytesInBlock) +void CBC_QRCoderEncoder::GetNumDataBytesAndNumECBytesForBlockID(int32_t numTotalBytes, int32_t numDataBytes, + int32_t numRSBlocks, int32_t blockID, + int32_t &numDataBytesInBlock, int32_t& numECBytesInBlock) { if(blockID >= numRSBlocks) { return; } - FX_INT32 numRsBlocksInGroup2 = numTotalBytes % numRSBlocks; - FX_INT32 numRsBlocksInGroup1 = numRSBlocks - numRsBlocksInGroup2; - FX_INT32 numTotalBytesInGroup1 = numTotalBytes / numRSBlocks; - FX_INT32 numTotalBytesInGroup2 = numTotalBytesInGroup1 + 1; - FX_INT32 numDataBytesInGroup1 = numDataBytes / numRSBlocks; - FX_INT32 numDataBytesInGroup2 = numDataBytesInGroup1 + 1; - FX_INT32 numEcBytesInGroup1 = numTotalBytesInGroup1 - numDataBytesInGroup1; - FX_INT32 numEcBytesInGroup2 = numTotalBytesInGroup2 - numDataBytesInGroup2; + int32_t numRsBlocksInGroup2 = numTotalBytes % numRSBlocks; + int32_t numRsBlocksInGroup1 = numRSBlocks - numRsBlocksInGroup2; + int32_t numTotalBytesInGroup1 = numTotalBytes / numRSBlocks; + int32_t numTotalBytesInGroup2 = numTotalBytesInGroup1 + 1; + int32_t numDataBytesInGroup1 = numDataBytes / numRSBlocks; + int32_t numDataBytesInGroup2 = numDataBytesInGroup1 + 1; + int32_t numEcBytesInGroup1 = numTotalBytesInGroup1 - numDataBytesInGroup1; + int32_t numEcBytesInGroup2 = numTotalBytesInGroup2 - numDataBytesInGroup2; if (blockID < numRsBlocksInGroup1) { numDataBytesInBlock = numDataBytesInGroup1; numECBytesInBlock = numEcBytesInGroup1; @@ -856,12 +856,12 @@ void CBC_QRCoderEncoder::GetNumDataBytesAndNumECBytesForBlockID(FX_INT32 numTota numECBytesInBlock = numEcBytesInGroup2; } } -CBC_CommonByteArray* CBC_QRCoderEncoder::GenerateECBytes(CBC_CommonByteArray* dataBytes, FX_INT32 numEcBytesInBlock, FX_INT32 &e) +CBC_CommonByteArray* CBC_QRCoderEncoder::GenerateECBytes(CBC_CommonByteArray* dataBytes, int32_t numEcBytesInBlock, int32_t &e) { - FX_INT32 numDataBytes = dataBytes->Size(); + int32_t numDataBytes = dataBytes->Size(); CFX_Int32Array toEncode; toEncode.SetSize(numDataBytes + numEcBytesInBlock); - for(FX_INT32 i = 0; i < numDataBytes; i++) { + for(int32_t i = 0; i < numDataBytes; i++) { toEncode[i] = (dataBytes->At(i)); } CBC_ReedSolomonEncoder encode(CBC_ReedSolomonGF256::QRCodeFild); @@ -869,7 +869,7 @@ CBC_CommonByteArray* CBC_QRCoderEncoder::GenerateECBytes(CBC_CommonByteArray* da encode.Encode(&toEncode, numEcBytesInBlock, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_CommonByteArray* ecBytes = FX_NEW CBC_CommonByteArray(numEcBytesInBlock); - for(FX_INT32 j = 0; j < numEcBytesInBlock; j++) { + for(int32_t j = 0; j < numEcBytesInBlock; j++) { ecBytes->Set(j, toEncode[numDataBytes + j]); } return ecBytes; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h index f08d608fb8..303dbcb767 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h @@ -17,44 +17,44 @@ class CBC_QRCoderEncoder; class CBC_QRCoderEncoder { private: - const static FX_INT32 m_alphaNumbericTable[96]; + const static int32_t m_alphaNumbericTable[96]; public: CBC_QRCoderEncoder(); virtual ~CBC_QRCoderEncoder(); - static void Encode(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, FX_INT32 &e, FX_INT32 versionSpecify = 0); - static void Encode(const CFX_WideString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, FX_INT32 &e); + static void Encode(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, int32_t &e, int32_t versionSpecify = 0); + static void Encode(const CFX_WideString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, int32_t &e); static void EncodeWithSpecifyVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, - CBC_QRCoder *qrCode, FX_INT32 versionSpecify, FX_INT32 &e); - static void EncodeWithAutoVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, FX_INT32 &e); + CBC_QRCoder *qrCode, int32_t versionSpecify, int32_t &e); + static void EncodeWithAutoVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, int32_t &e); static CBC_QRCoderMode* ChooseMode(const CFX_ByteString & content, CFX_ByteString encoding); - static FX_INT32 GetAlphaNumericCode(FX_INT32 code); + static int32_t GetAlphaNumericCode(int32_t code); static void AppendECI(CBC_QRCoderBitVector* bits); - static void AppendBytes(const CFX_ByteString &content, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, FX_INT32 &e); - static void AppendNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e); - static void AppendAlphaNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e); - static void Append8BitBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, FX_INT32 &e); - static void Append8BitBytes(CFX_ByteArray &bytes, CBC_QRCoderBitVector *bits, FX_INT32 &e); - static void AppendKanjiBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e); - static void AppendGBKBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e); - static void InitQRCode(FX_INT32 numInputBytes, FX_INT32 versionNumber, - CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, FX_INT32 &e); - static void InitQRCode(FX_INT32 numInputBytes, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, FX_INT32 &e); - static void AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, FX_INT32 &e); - static void AppendLengthInfo(FX_INT32 numLetters, FX_INT32 version, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, FX_INT32 &e); + static void AppendBytes(const CFX_ByteString &content, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, int32_t &e); + static void AppendNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e); + static void AppendAlphaNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e); + static void Append8BitBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, int32_t &e); + static void Append8BitBytes(CFX_ByteArray &bytes, CBC_QRCoderBitVector *bits, int32_t &e); + static void AppendKanjiBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e); + static void AppendGBKBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e); + static void InitQRCode(int32_t numInputBytes, int32_t versionNumber, + CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, int32_t &e); + static void InitQRCode(int32_t numInputBytes, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, int32_t &e); + static void AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, int32_t &e); + static void AppendLengthInfo(int32_t numLetters, int32_t version, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, int32_t &e); - static void InterleaveWithECBytes(CBC_QRCoderBitVector* bits, FX_INT32 numTotalBytes, FX_INT32 numDataBytes, FX_INT32 numRSBlocks, CBC_QRCoderBitVector* result, FX_INT32 &e); - static void GetNumDataBytesAndNumECBytesForBlockID(FX_INT32 numTotalBytes, FX_INT32 numDataBytes, - FX_INT32 numRSBlocks, FX_INT32 blockID, - FX_INT32 &numDataBytesInBlock, FX_INT32& numECBytesInBlocks); - static CBC_CommonByteArray* GenerateECBytes(CBC_CommonByteArray* dataBytes, FX_INT32 numEcBytesInBlock, FX_INT32 &e); - static FX_INT32 ChooseMaskPattern(CBC_QRCoderBitVector* bits, CBC_QRCoderErrorCorrectionLevel* ecLevel, - FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e); - static FX_INT32 CalculateMaskPenalty(CBC_CommonByteMatrix* matrix); - static void TerminateBits(FX_INT32 numDataBytes, CBC_QRCoderBitVector* bits, FX_INT32 &e); - static FX_INT32 GetSpanByVersion(CBC_QRCoderMode *modeFirst, CBC_QRCoderMode *modeSecond, FX_INT32 versionNum, FX_INT32 &e); - static void MergeString(CFX_PtrArray &result, FX_INT32 versionNum, FX_INT32 &e); + static void InterleaveWithECBytes(CBC_QRCoderBitVector* bits, int32_t numTotalBytes, int32_t numDataBytes, int32_t numRSBlocks, CBC_QRCoderBitVector* result, int32_t &e); + static void GetNumDataBytesAndNumECBytesForBlockID(int32_t numTotalBytes, int32_t numDataBytes, + int32_t numRSBlocks, int32_t blockID, + int32_t &numDataBytesInBlock, int32_t& numECBytesInBlocks); + static CBC_CommonByteArray* GenerateECBytes(CBC_CommonByteArray* dataBytes, int32_t numEcBytesInBlock, int32_t &e); + static int32_t ChooseMaskPattern(CBC_QRCoderBitVector* bits, CBC_QRCoderErrorCorrectionLevel* ecLevel, + int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e); + static int32_t CalculateMaskPenalty(CBC_CommonByteMatrix* matrix); + static void TerminateBits(int32_t numDataBytes, CBC_QRCoderBitVector* bits, int32_t &e); + static int32_t GetSpanByVersion(CBC_QRCoderMode *modeFirst, CBC_QRCoderMode *modeSecond, int32_t versionNum, int32_t &e); + static void MergeString(CFX_PtrArray &result, int32_t versionNum, int32_t &e); static void SplitString(const CFX_ByteString &content, CFX_PtrArray &result); - static void AppendDataModeLenghInfo(CFX_PtrArray &splitResult, CBC_QRCoderBitVector &headerAndDataBits, CBC_QRCoderMode *tempMode, CBC_QRCoder *qrCode, CFX_ByteString &encoding, FX_INT32 &e); + static void AppendDataModeLenghInfo(CFX_PtrArray &splitResult, CBC_QRCoderBitVector &headerAndDataBits, CBC_QRCoderMode *tempMode, CBC_QRCoder *qrCode, CFX_ByteString &encoding, int32_t &e); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp index f8aae491da..cccaf86da0 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.cpp @@ -26,7 +26,7 @@ CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::L = NULL; CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::M = NULL; CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::Q = NULL; CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::H = NULL; -CBC_QRCoderErrorCorrectionLevel::CBC_QRCoderErrorCorrectionLevel(FX_INT32 ordinal, FX_INT32 bits, FX_CHAR* name) +CBC_QRCoderErrorCorrectionLevel::CBC_QRCoderErrorCorrectionLevel(int32_t ordinal, int32_t bits, FX_CHAR* name) { m_name += name; m_ordinal = ordinal; @@ -49,11 +49,11 @@ void CBC_QRCoderErrorCorrectionLevel::Finalize() delete Q; delete H; } -FX_INT32 CBC_QRCoderErrorCorrectionLevel::Ordinal() +int32_t CBC_QRCoderErrorCorrectionLevel::Ordinal() { return m_ordinal; } -FX_INT32 CBC_QRCoderErrorCorrectionLevel::GetBits() +int32_t CBC_QRCoderErrorCorrectionLevel::GetBits() { return m_bits; } @@ -61,7 +61,7 @@ CFX_ByteString CBC_QRCoderErrorCorrectionLevel::GetName() { return m_name; } -CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::ForBits(FX_INT32 bits) +CBC_QRCoderErrorCorrectionLevel* CBC_QRCoderErrorCorrectionLevel::ForBits(int32_t bits) { switch(bits) { case 0x00: diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h index 907c20d1cc..e38abbcae9 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h @@ -9,10 +9,10 @@ class CBC_QRCoderErrorCorrectionLevel { private: - FX_INT32 m_ordinal; - FX_INT32 m_bits; + int32_t m_ordinal; + int32_t m_bits; CFX_ByteString m_name; - CBC_QRCoderErrorCorrectionLevel(FX_INT32 ordinal, FX_INT32 bits, FX_CHAR* name); + CBC_QRCoderErrorCorrectionLevel(int32_t ordinal, int32_t bits, FX_CHAR* name); CBC_QRCoderErrorCorrectionLevel(); public: static CBC_QRCoderErrorCorrectionLevel* L; @@ -22,10 +22,10 @@ public: virtual ~CBC_QRCoderErrorCorrectionLevel(); static void Initialize(); static void Finalize(); - FX_INT32 Ordinal(); - FX_INT32 GetBits(); + int32_t Ordinal(); + int32_t GetBits(); CFX_ByteString GetName(); static void Destroy(); - static CBC_QRCoderErrorCorrectionLevel* ForBits(FX_INT32 bits); + static CBC_QRCoderErrorCorrectionLevel* ForBits(int32_t bits); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp index 5a205480ae..9c72140241 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.cpp @@ -23,8 +23,8 @@ #include "../barcode.h" #include "BC_QRCoderErrorCorrectionLevel.h" #include "BC_QRCoderFormatInformation.h" -const FX_INT32 CBC_QRCoderFormatInformation::FORMAT_INFO_MASK_QR = 0X5412; -const FX_INT32 CBC_QRCoderFormatInformation::FORMAT_INFO_DECODE_LOOKUP[32][2] = { +const int32_t CBC_QRCoderFormatInformation::FORMAT_INFO_MASK_QR = 0X5412; +const int32_t CBC_QRCoderFormatInformation::FORMAT_INFO_DECODE_LOOKUP[32][2] = { {0x5412, 0x00}, {0x5125, 0x01}, {0x5E7C, 0x02}, @@ -58,17 +58,17 @@ const FX_INT32 CBC_QRCoderFormatInformation::FORMAT_INFO_DECODE_LOOKUP[32][2] = {0x2EDA, 0x1E}, {0x2BED, 0x1F}, }; -const FX_INT32 CBC_QRCoderFormatInformation::BITS_SET_IN_HALF_BYTE[] = +const int32_t CBC_QRCoderFormatInformation::BITS_SET_IN_HALF_BYTE[] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4}; -CBC_QRCoderFormatInformation::CBC_QRCoderFormatInformation(FX_INT32 formatInfo) +CBC_QRCoderFormatInformation::CBC_QRCoderFormatInformation(int32_t formatInfo) { m_errorCorrectLevl = CBC_QRCoderErrorCorrectionLevel::ForBits((formatInfo >> 3) & 0x03); - m_dataMask = (FX_BYTE) (formatInfo & 0x07); + m_dataMask = (uint8_t) (formatInfo & 0x07); } CBC_QRCoderFormatInformation::~CBC_QRCoderFormatInformation() { } -FX_INT32 CBC_QRCoderFormatInformation::NumBitsDiffering(FX_INT32 a, FX_INT32 b) +int32_t CBC_QRCoderFormatInformation::NumBitsDiffering(int32_t a, int32_t b) { a ^= b; return BITS_SET_IN_HALF_BYTE[a & 0x0F] + @@ -80,7 +80,7 @@ FX_INT32 CBC_QRCoderFormatInformation::NumBitsDiffering(FX_INT32 a, FX_INT32 b) BITS_SET_IN_HALF_BYTE[(a >> 24) & 0x0F] + BITS_SET_IN_HALF_BYTE[(a >> 28) & 0x0F]; } -FX_BYTE CBC_QRCoderFormatInformation::GetDataMask() +uint8_t CBC_QRCoderFormatInformation::GetDataMask() { return m_dataMask; } @@ -88,7 +88,7 @@ CBC_QRCoderErrorCorrectionLevel *CBC_QRCoderFormatInformation::GetErrorCorrectio { return m_errorCorrectLevl; } -CBC_QRCoderFormatInformation* CBC_QRCoderFormatInformation::DecodeFormatInformation(FX_INT32 maskedFormatInfo) +CBC_QRCoderFormatInformation* CBC_QRCoderFormatInformation::DecodeFormatInformation(int32_t maskedFormatInfo) { CBC_QRCoderFormatInformation* formatInfo = DoDecodeFormatInformation(maskedFormatInfo); if(formatInfo != NULL) { @@ -96,17 +96,17 @@ CBC_QRCoderFormatInformation* CBC_QRCoderFormatInformation::DecodeFormatInformat } return DoDecodeFormatInformation(maskedFormatInfo ^ FORMAT_INFO_MASK_QR); } -CBC_QRCoderFormatInformation* CBC_QRCoderFormatInformation::DoDecodeFormatInformation(FX_INT32 maskedFormatInfo) +CBC_QRCoderFormatInformation* CBC_QRCoderFormatInformation::DoDecodeFormatInformation(int32_t maskedFormatInfo) { - FX_INT32 bestDifference = (FX_INT32)FXSYS_nan(); - FX_INT32 bestFormatInfo = 0; - for(FX_INT32 i = 0; i < 32; i++) { - FX_INT32 const* decodeInfo = &FORMAT_INFO_DECODE_LOOKUP[i][0]; - FX_INT32 targetInfo = decodeInfo[0]; + int32_t bestDifference = (int32_t)FXSYS_nan(); + int32_t bestFormatInfo = 0; + for(int32_t i = 0; i < 32; i++) { + int32_t const* decodeInfo = &FORMAT_INFO_DECODE_LOOKUP[i][0]; + int32_t targetInfo = decodeInfo[0]; if(targetInfo == maskedFormatInfo) { return FX_NEW CBC_QRCoderFormatInformation(decodeInfo[1]); } - FX_INT32 bitsDifference = NumBitsDiffering(maskedFormatInfo, targetInfo); + int32_t bitsDifference = NumBitsDiffering(maskedFormatInfo, targetInfo); if(bitsDifference < bestDifference) { bestFormatInfo = decodeInfo[1]; bestDifference = bitsDifference; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.h index 49265e5033..5a0f15064c 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderFormatInformation.h @@ -10,19 +10,19 @@ class CBC_QRCoderErrorCorrectionLevel; class CBC_QRCoderFormatInformation { private: - const static FX_INT32 FORMAT_INFO_MASK_QR; - const static FX_INT32 FORMAT_INFO_DECODE_LOOKUP[32][2]; - const static FX_INT32 BITS_SET_IN_HALF_BYTE[16]; + const static int32_t FORMAT_INFO_MASK_QR; + const static int32_t FORMAT_INFO_DECODE_LOOKUP[32][2]; + const static int32_t BITS_SET_IN_HALF_BYTE[16]; CBC_QRCoderErrorCorrectionLevel* m_errorCorrectLevl; - FX_BYTE m_dataMask; + uint8_t m_dataMask; public: - CBC_QRCoderFormatInformation(FX_INT32 formatInfo); + CBC_QRCoderFormatInformation(int32_t formatInfo); virtual ~CBC_QRCoderFormatInformation(); - FX_BYTE GetDataMask(); + uint8_t GetDataMask(); CBC_QRCoderErrorCorrectionLevel* GetErrorCorrectionLevel(); - static FX_INT32 NumBitsDiffering(FX_INT32 a, FX_INT32 b); - static CBC_QRCoderFormatInformation* DecodeFormatInformation(FX_INT32 maskedFormatInfo); - static CBC_QRCoderFormatInformation* DoDecodeFormatInformation(FX_INT32 maskedFormatInfo); + static int32_t NumBitsDiffering(int32_t a, int32_t b); + static CBC_QRCoderFormatInformation* DecodeFormatInformation(int32_t maskedFormatInfo); + static CBC_QRCoderFormatInformation* DoDecodeFormatInformation(int32_t maskedFormatInfo); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp index bc01eff442..f0e777c6eb 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.cpp @@ -31,20 +31,20 @@ CBC_QRCoderMaskUtil::CBC_QRCoderMaskUtil() CBC_QRCoderMaskUtil::~CBC_QRCoderMaskUtil() { } -FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1(CBC_CommonByteMatrix* matrix) +int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1(CBC_CommonByteMatrix* matrix) { return ApplyMaskPenaltyRule1Internal(matrix, TRUE) + ApplyMaskPenaltyRule1Internal(matrix, FALSE); } -FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2(CBC_CommonByteMatrix* matrix) +int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2(CBC_CommonByteMatrix* matrix) { - FX_INT32 penalty = 0; - FX_BYTE* array = matrix->GetArray(); - FX_INT32 width = matrix->GetWidth(); - FX_INT32 height = matrix->GetHeight(); - for(FX_INT32 y = 0; y < height - 1; y++) { - for(FX_INT32 x = 0; x < width - 1; x++) { - FX_INT32 value = array[y * width + x]; + int32_t penalty = 0; + uint8_t* array = matrix->GetArray(); + int32_t width = matrix->GetWidth(); + int32_t height = matrix->GetHeight(); + for(int32_t y = 0; y < height - 1; y++) { + for(int32_t x = 0; x < width - 1; x++) { + int32_t value = array[y * width + x]; if(value == array[y * width + x + 1] && value == array[(y + 1) * width + x] && value == array[(y + 1) * width + x + 1]) { @@ -54,14 +54,14 @@ FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule2(CBC_CommonByteMatrix* matrix } return 3 * penalty; } -FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule3(CBC_CommonByteMatrix* matrix) +int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule3(CBC_CommonByteMatrix* matrix) { - FX_INT32 penalty = 0; - FX_BYTE* array = matrix->GetArray(); - FX_INT32 width = matrix->GetWidth(); - FX_INT32 height = matrix->GetHeight(); - for (FX_INT32 y = 0; y < height; ++y) { - for (FX_INT32 x = 0; x < width; ++x) { + int32_t penalty = 0; + uint8_t* array = matrix->GetArray(); + int32_t width = matrix->GetWidth(); + int32_t height = matrix->GetHeight(); + for (int32_t y = 0; y < height; ++y) { + for (int32_t x = 0; x < width; ++x) { if (x == 0 && ((y >= 0 && y <= 6) || (y >= height - 7 && y <= height - 1))) { continue; } @@ -118,30 +118,30 @@ FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule3(CBC_CommonByteMatrix* matrix } return penalty; } -FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule4(CBC_CommonByteMatrix* matrix) +int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule4(CBC_CommonByteMatrix* matrix) { - FX_INT32 numDarkCells = 0; - FX_BYTE* array = matrix->GetArray(); - FX_INT32 width = matrix->GetWidth(); - FX_INT32 height = matrix->GetHeight(); - for (FX_INT32 y = 0; y < height; ++y) { - for (FX_INT32 x = 0; x < width; ++x) { + int32_t numDarkCells = 0; + uint8_t* array = matrix->GetArray(); + int32_t width = matrix->GetWidth(); + int32_t height = matrix->GetHeight(); + for (int32_t y = 0; y < height; ++y) { + for (int32_t x = 0; x < width; ++x) { if (array[y * width + x] == 1) { numDarkCells += 1; } } } - FX_INT32 numTotalCells = matrix->GetHeight() * matrix->GetWidth(); + int32_t numTotalCells = matrix->GetHeight() * matrix->GetWidth(); double darkRatio = (double) numDarkCells / numTotalCells; - return abs( (FX_INT32) (darkRatio * 100 - 50) / 5 ) * 5 * 10; + return abs( (int32_t) (darkRatio * 100 - 50) / 5 ) * 5 * 10; } -FX_BOOL CBC_QRCoderMaskUtil::GetDataMaskBit(FX_INT32 maskPattern, FX_INT32 x, FX_INT32 y, FX_INT32 &e) +FX_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); } - FX_INT32 intermediate = 0, temp = 0; + int32_t intermediate = 0, temp = 0; switch(maskPattern) { case 0: intermediate = (y + x) & 0x1; @@ -177,19 +177,19 @@ FX_BOOL CBC_QRCoderMaskUtil::GetDataMaskBit(FX_INT32 maskPattern, FX_INT32 x, FX } return intermediate == 0; } -FX_INT32 CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1Internal(CBC_CommonByteMatrix* matrix, FX_BOOL isHorizontal) +int32_t CBC_QRCoderMaskUtil::ApplyMaskPenaltyRule1Internal(CBC_CommonByteMatrix* matrix, FX_BOOL isHorizontal) { - FX_INT32 penalty = 0; - FX_INT32 numSameBitCells = 0; - FX_INT32 prevBit = -1; - FX_INT32 width = matrix->GetWidth(); - FX_INT32 height = matrix->GetHeight(); - FX_INT32 iLimit = isHorizontal ? height : width; - FX_INT32 jLimit = isHorizontal ? width : height; - FX_BYTE* array = matrix->GetArray(); - for (FX_INT32 i = 0; i < iLimit; ++i) { - for (FX_INT32 j = 0; j < jLimit; ++j) { - FX_INT32 bit = isHorizontal ? array[i * width + j] : array[j * width + i]; + int32_t penalty = 0; + int32_t numSameBitCells = 0; + int32_t prevBit = -1; + int32_t width = matrix->GetWidth(); + int32_t height = matrix->GetHeight(); + int32_t iLimit = isHorizontal ? height : width; + int32_t jLimit = isHorizontal ? width : height; + uint8_t* array = matrix->GetArray(); + for (int32_t i = 0; i < iLimit; ++i) { + for (int32_t j = 0; j < jLimit; ++j) { + int32_t bit = isHorizontal ? array[i * width + j] : array[j * width + i]; if (bit == prevBit) { numSameBitCells += 1; if (numSameBitCells == 5) { diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.h index 13bb11691a..10ff964e97 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.h @@ -12,12 +12,12 @@ class CBC_QRCoderMaskUtil public: CBC_QRCoderMaskUtil(); virtual ~CBC_QRCoderMaskUtil(); - static FX_BOOL GetDataMaskBit(FX_INT32 maskPattern, FX_INT32 x, FX_INT32 y, FX_INT32 &e); + static FX_BOOL GetDataMaskBit(int32_t maskPattern, int32_t x, int32_t y, int32_t &e); - static FX_INT32 ApplyMaskPenaltyRule1(CBC_CommonByteMatrix* matrix); - static FX_INT32 ApplyMaskPenaltyRule2(CBC_CommonByteMatrix* matrix); - static FX_INT32 ApplyMaskPenaltyRule3(CBC_CommonByteMatrix* matrix); - static FX_INT32 ApplyMaskPenaltyRule4(CBC_CommonByteMatrix* matrix); - static FX_INT32 ApplyMaskPenaltyRule1Internal(CBC_CommonByteMatrix* matrix, FX_BOOL isHorizontal); + 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); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp index 4c2db5e34e..7caa6b5bab 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.cpp @@ -27,7 +27,7 @@ #include "BC_QRCoderMaskUtil.h" #include "BC_QRCoderMatrixUtil.h" #include "BC_QRCoderBitVector.h" -const FX_INT32 CBC_QRCoderMatrixUtil::POSITION_DETECTION_PATTERN[7][7] = { +const int32_t CBC_QRCoderMatrixUtil::POSITION_DETECTION_PATTERN[7][7] = { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, @@ -36,20 +36,20 @@ const FX_INT32 CBC_QRCoderMatrixUtil::POSITION_DETECTION_PATTERN[7][7] = { 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 }; -const FX_INT32 CBC_QRCoderMatrixUtil::HORIZONTAL_SEPARATION_PATTERN[1][8] = { +const int32_t CBC_QRCoderMatrixUtil::HORIZONTAL_SEPARATION_PATTERN[1][8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -const FX_INT32 CBC_QRCoderMatrixUtil::VERTICAL_SEPARATION_PATTERN[7][1] = { +const int32_t CBC_QRCoderMatrixUtil::VERTICAL_SEPARATION_PATTERN[7][1] = { 0, 0, 0, 0, 0, 0, 0 }; -const FX_INT32 CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN[5][5] = { +const int32_t CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN[5][5] = { 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 }; -const FX_INT32 CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[40][7] = { +const int32_t CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[40][7] = { { -1, -1, -1, -1, -1, -1, -1}, { 6, 18, -1, -1, -1, -1, -1}, { 6, 22, -1, -1, -1, -1, -1}, @@ -91,7 +91,7 @@ const FX_INT32 CBC_QRCoderMatrixUtil::POSITION_ADJUSTMENT_PATTERN_COORDINATE_TAB { 6, 26, 54, 82, 110, 138, 166}, { 6, 30, 58, 86, 114, 142, 170}, }; -const FX_INT32 CBC_QRCoderMatrixUtil::TYPE_INFO_COORDINATES[15][2] = { +const int32_t CBC_QRCoderMatrixUtil::TYPE_INFO_COORDINATES[15][2] = { {8, 0}, {8, 1}, {8, 2}, @@ -108,21 +108,21 @@ const FX_INT32 CBC_QRCoderMatrixUtil::TYPE_INFO_COORDINATES[15][2] = { {1, 8}, {0, 8}, }; -const FX_INT32 CBC_QRCoderMatrixUtil::VERSION_INFO_POLY = 0x1f25; -const FX_INT32 CBC_QRCoderMatrixUtil::TYPE_INFO_POLY = 0x0537; -const FX_INT32 CBC_QRCoderMatrixUtil::TYPE_INFO_MASK_PATTERN = 0x5412; -void CBC_QRCoderMatrixUtil::ClearMatrix(CBC_CommonByteMatrix* matrix, FX_INT32 &e) +const int32_t CBC_QRCoderMatrixUtil::VERSION_INFO_POLY = 0x1f25; +const int32_t CBC_QRCoderMatrixUtil::TYPE_INFO_POLY = 0x0537; +const int32_t CBC_QRCoderMatrixUtil::TYPE_INFO_MASK_PATTERN = 0x5412; +void CBC_QRCoderMatrixUtil::ClearMatrix(CBC_CommonByteMatrix* matrix, int32_t &e) { if(matrix == NULL) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } - matrix->clear((FX_BYTE) - 1); + matrix->clear((uint8_t) - 1); } void CBC_QRCoderMatrixUtil::BuildMatrix(CBC_QRCoderBitVector* dataBits, CBC_QRCoderErrorCorrectionLevel* ecLevel, - FX_INT32 version, FX_INT32 maskPattern, - CBC_CommonByteMatrix* matrix, FX_INT32 &e) + int32_t version, int32_t maskPattern, + CBC_CommonByteMatrix* matrix, int32_t &e) { if(matrix == NULL) { e = BCExceptionNullPointer; @@ -139,7 +139,7 @@ void CBC_QRCoderMatrixUtil::BuildMatrix(CBC_QRCoderBitVector* dataBits, EmbedDataBits(dataBits, maskPattern, matrix, e); BC_EXCEPTION_CHECK_ReturnVoid(e); } -void CBC_QRCoderMatrixUtil::EmbedBasicPatterns(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e) +void CBC_QRCoderMatrixUtil::EmbedBasicPatterns(int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e) { if(matrix == NULL) { e = BCExceptionNullPointer; @@ -155,7 +155,7 @@ void CBC_QRCoderMatrixUtil::EmbedBasicPatterns(FX_INT32 version, CBC_CommonByteM BC_EXCEPTION_CHECK_ReturnVoid(e); } void CBC_QRCoderMatrixUtil::EmbedTypeInfo(CBC_QRCoderErrorCorrectionLevel* ecLevel, - FX_INT32 maskPattern, CBC_CommonByteMatrix *matrix, FX_INT32 &e) + int32_t maskPattern, CBC_CommonByteMatrix *matrix, int32_t &e) { if(matrix == NULL) { e = BCExceptionNullPointer; @@ -165,24 +165,24 @@ void CBC_QRCoderMatrixUtil::EmbedTypeInfo(CBC_QRCoderErrorCorrectionLevel* ecLev typeInfoBits.Init(); MakeTypeInfoBits(ecLevel, maskPattern, &typeInfoBits, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - for(FX_INT32 i = 0; i < typeInfoBits.Size(); i++) { - FX_INT32 bit = typeInfoBits.At(typeInfoBits.Size() - 1 - i, e); + for(int32_t i = 0; i < typeInfoBits.Size(); i++) { + int32_t bit = typeInfoBits.At(typeInfoBits.Size() - 1 - i, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 x1 = TYPE_INFO_COORDINATES[i][0]; - FX_INT32 y1 = TYPE_INFO_COORDINATES[i][1]; + int32_t x1 = TYPE_INFO_COORDINATES[i][0]; + int32_t y1 = TYPE_INFO_COORDINATES[i][1]; matrix->Set(x1, y1, bit); if(i < 8) { - FX_INT32 x2 = matrix->GetWidth() - i - 1; - FX_INT32 y2 = 8; + int32_t x2 = matrix->GetWidth() - i - 1; + int32_t y2 = 8; matrix->Set(x2, y2, bit); } else { - FX_INT32 x2 = 8; - FX_INT32 y2 = matrix->GetHeight() - 7 + (i - 8); + int32_t x2 = 8; + int32_t y2 = matrix->GetHeight() - 7 + (i - 8); matrix->Set(x2, y2, bit); } } } -void CBC_QRCoderMatrixUtil::MaybeEmbedVersionInfo(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e) +void CBC_QRCoderMatrixUtil::MaybeEmbedVersionInfo(int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e) { if(matrix == NULL) { e = BCExceptionNullPointer; @@ -195,10 +195,10 @@ void CBC_QRCoderMatrixUtil::MaybeEmbedVersionInfo(FX_INT32 version, CBC_CommonBy versionInfoBits.Init(); MakeVersionInfoBits(version, &versionInfoBits, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 bitIndex = 6 * 3 - 1; - for(FX_INT32 i = 0; i < 6; i++) { - for(FX_INT32 j = 0; j < 3; j++) { - FX_INT32 bit = versionInfoBits.At(bitIndex, e); + int32_t bitIndex = 6 * 3 - 1; + for(int32_t i = 0; i < 6; i++) { + for(int32_t j = 0; j < 3; j++) { + int32_t bit = versionInfoBits.At(bitIndex, e); BC_EXCEPTION_CHECK_ReturnVoid(e); bitIndex--; matrix->Set(i, matrix->GetHeight() - 11 + j, bit); @@ -207,16 +207,16 @@ void CBC_QRCoderMatrixUtil::MaybeEmbedVersionInfo(FX_INT32 version, CBC_CommonBy } } void CBC_QRCoderMatrixUtil::EmbedDataBits(CBC_QRCoderBitVector* dataBits, - FX_INT32 maskPattern, CBC_CommonByteMatrix* matrix, FX_INT32 &e) + int32_t maskPattern, CBC_CommonByteMatrix* matrix, int32_t &e) { if(matrix == NULL || dataBits == NULL) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } - FX_INT32 bitIndex = 0; - FX_INT32 direction = -1; - FX_INT32 x = matrix->GetWidth() - 1; - FX_INT32 y = matrix->GetHeight() - 1; + int32_t bitIndex = 0; + int32_t direction = -1; + int32_t x = matrix->GetWidth() - 1; + int32_t y = matrix->GetHeight() - 1; while(x > 0) { if (x == 6) { x -= 1; @@ -226,12 +226,12 @@ void CBC_QRCoderMatrixUtil::EmbedDataBits(CBC_QRCoderBitVector* dataBits, y += direction; continue; } - for(FX_INT32 i = 0; i < 2; i++) { - FX_INT32 xx = x - i; + for(int32_t i = 0; i < 2; i++) { + int32_t xx = x - i; if(!IsEmpty(matrix->Get(xx, y))) { continue; } - FX_INT32 bit; + int32_t bit; if(bitIndex < dataBits->Size()) { bit = dataBits->At(bitIndex, e); BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -258,9 +258,9 @@ void CBC_QRCoderMatrixUtil::EmbedDataBits(CBC_QRCoderBitVector* dataBits, return; } } -FX_INT32 CBC_QRCoderMatrixUtil::CalculateBCHCode(FX_INT32 value, FX_INT32 poly) +int32_t CBC_QRCoderMatrixUtil::CalculateBCHCode(int32_t value, int32_t poly) { - FX_INT32 msbSetInPoly = FindMSBSet(poly); + int32_t msbSetInPoly = FindMSBSet(poly); value <<= msbSetInPoly - 1; while(FindMSBSet(value) >= msbSetInPoly) { value ^= poly << (FindMSBSet(value) - msbSetInPoly); @@ -268,7 +268,7 @@ FX_INT32 CBC_QRCoderMatrixUtil::CalculateBCHCode(FX_INT32 value, FX_INT32 poly) return value; } void CBC_QRCoderMatrixUtil::MakeTypeInfoBits(CBC_QRCoderErrorCorrectionLevel* ecLevel, - FX_INT32 maskPattern, CBC_QRCoderBitVector* bits, FX_INT32 &e) + int32_t maskPattern, CBC_QRCoderBitVector* bits, int32_t &e) { if(bits == NULL) { e = BCExceptionNullPointer; @@ -278,10 +278,10 @@ void CBC_QRCoderMatrixUtil::MakeTypeInfoBits(CBC_QRCoderErrorCorrectionLevel* ec e = BCExceptionBadMask; BC_EXCEPTION_CHECK_ReturnVoid(e); } - FX_INT32 typeInfo = (ecLevel->GetBits() << 3) | maskPattern; + int32_t typeInfo = (ecLevel->GetBits() << 3) | maskPattern; BC_EXCEPTION_CHECK_ReturnVoid(e); bits->AppendBits(typeInfo, 5, e); - FX_INT32 bchCode = CalculateBCHCode(typeInfo, TYPE_INFO_POLY); + int32_t bchCode = CalculateBCHCode(typeInfo, TYPE_INFO_POLY); BC_EXCEPTION_CHECK_ReturnVoid(e); bits->AppendBits(bchCode, 10, e); CBC_QRCoderBitVector maskBits; @@ -295,7 +295,7 @@ void CBC_QRCoderMatrixUtil::MakeTypeInfoBits(CBC_QRCoderErrorCorrectionLevel* ec BC_EXCEPTION_CHECK_ReturnVoid(e); } } -void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(FX_INT32 version, CBC_QRCoderBitVector* bits, FX_INT32 &e) +void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(int32_t version, CBC_QRCoderBitVector* bits, int32_t &e) { if(bits == NULL) { e = BCExceptionNullPointer; @@ -303,7 +303,7 @@ void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(FX_INT32 version, CBC_QRCoderBit } bits->AppendBits(version, 6, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 bchCode = CalculateBCHCode(version, VERSION_INFO_POLY); + int32_t bchCode = CalculateBCHCode(version, VERSION_INFO_POLY); bits->AppendBits(bchCode, 12, e); BC_EXCEPTION_CHECK_ReturnVoid(e); if(bits->Size() != 18) { @@ -311,22 +311,22 @@ void CBC_QRCoderMatrixUtil::MakeVersionInfoBits(FX_INT32 version, CBC_QRCoderBit BC_EXCEPTION_CHECK_ReturnVoid(e); } } -FX_BOOL CBC_QRCoderMatrixUtil::IsEmpty(FX_INT32 value) +FX_BOOL CBC_QRCoderMatrixUtil::IsEmpty(int32_t value) { - return (FX_BYTE)value == 0xff; + return (uint8_t)value == 0xff; } -FX_BOOL CBC_QRCoderMatrixUtil::IsValidValue(FX_INT32 value) +FX_BOOL CBC_QRCoderMatrixUtil::IsValidValue(int32_t value) { - return ((FX_BYTE)value == 0xff || (FX_BYTE)value == 0x00 || (FX_BYTE)value == 0x01); + return ((uint8_t)value == 0xff || (uint8_t)value == 0x00 || (uint8_t)value == 0x01); } -void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, FX_INT32 &e) +void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, int32_t &e) { if(matrix == NULL) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } - for(FX_INT32 i = 8; i < matrix->GetWidth() - 8; i++) { - FX_INT32 bit = (i + 1) % 2; + for(int32_t i = 8; i < matrix->GetWidth() - 8; i++) { + int32_t bit = (i + 1) % 2; if(!IsValidValue(matrix->Get(i, 6))) { e = BCExceptionInvalidateImageData; BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -343,7 +343,7 @@ void CBC_QRCoderMatrixUtil::EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, FX } } } -void CBC_QRCoderMatrixUtil::EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* matrix, FX_INT32 &e) +void CBC_QRCoderMatrixUtil::EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* matrix, int32_t &e) { if(matrix == NULL) { e = BCExceptionNullPointer; @@ -355,14 +355,14 @@ void CBC_QRCoderMatrixUtil::EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* } matrix->Set(8, matrix->GetHeight() - 8, 1); } -void CBC_QRCoderMatrixUtil::EmbedHorizontalSeparationPattern(FX_INT32 xStart, FX_INT32 yStart, - CBC_CommonByteMatrix* matrix, FX_INT32 &e) +void CBC_QRCoderMatrixUtil::EmbedHorizontalSeparationPattern(int32_t xStart, int32_t yStart, + CBC_CommonByteMatrix* matrix, int32_t &e) { if(matrix == NULL) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } - for(FX_INT32 x = 0; x < 8; x++) { + for(int32_t x = 0; x < 8; x++) { if(!IsEmpty(matrix->Get(xStart + x, yStart))) { e = BCExceptionInvalidateData; BC_EXCEPTION_CHECK_ReturnVoid(e) @@ -370,14 +370,14 @@ void CBC_QRCoderMatrixUtil::EmbedHorizontalSeparationPattern(FX_INT32 xStart, FX matrix->Set(xStart + x, yStart, HORIZONTAL_SEPARATION_PATTERN[0][x]); } } -void CBC_QRCoderMatrixUtil::EmbedVerticalSeparationPattern(FX_INT32 xStart, FX_INT32 yStart, - CBC_CommonByteMatrix* matrix, FX_INT32 &e) +void CBC_QRCoderMatrixUtil::EmbedVerticalSeparationPattern(int32_t xStart, int32_t yStart, + CBC_CommonByteMatrix* matrix, int32_t &e) { if(matrix == NULL) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } - for(FX_INT32 y = 0; y < 7; y++) { + for(int32_t y = 0; y < 7; y++) { if(!IsEmpty(matrix->Get(xStart, yStart + y))) { e = BCExceptionInvalidateData; BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -385,15 +385,15 @@ void CBC_QRCoderMatrixUtil::EmbedVerticalSeparationPattern(FX_INT32 xStart, FX_I matrix->Set(xStart, yStart + y, VERTICAL_SEPARATION_PATTERN[y][0]); } } -void CBC_QRCoderMatrixUtil::EmbedPositionAdjustmentPattern(FX_INT32 xStart, FX_INT32 yStart, - CBC_CommonByteMatrix* matrix, FX_INT32 &e) +void CBC_QRCoderMatrixUtil::EmbedPositionAdjustmentPattern(int32_t xStart, int32_t yStart, + CBC_CommonByteMatrix* matrix, int32_t &e) { if(matrix == NULL) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } - for(FX_INT32 y = 0; y < 5; y++) { - for(FX_INT32 x = 0; x < 5; x++) { + for(int32_t y = 0; y < 5; y++) { + for(int32_t x = 0; x < 5; x++) { if(!IsEmpty(matrix->Get(xStart + x, y + yStart))) { e = BCExceptionInvalidateData; BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -402,15 +402,15 @@ void CBC_QRCoderMatrixUtil::EmbedPositionAdjustmentPattern(FX_INT32 xStart, FX_I } } } -void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPattern (FX_INT32 xStart, FX_INT32 yStart, - CBC_CommonByteMatrix* matrix, FX_INT32 &e) +void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPattern (int32_t xStart, int32_t yStart, + CBC_CommonByteMatrix* matrix, int32_t &e) { if(matrix == NULL) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } - for(FX_INT32 y = 0; y < 7; y++) { - for(FX_INT32 x = 0; x < 7; x++) { + for(int32_t y = 0; y < 7; y++) { + for(int32_t x = 0; x < 7; x++) { if(!IsEmpty(matrix->Get(xStart + x, yStart + y))) { e = BCExceptionInvalidateData; BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -419,27 +419,27 @@ void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPattern (FX_INT32 xStart, FX_I } } } -void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPatternsAndSeparators(CBC_CommonByteMatrix* matrix, FX_INT32 &e) +void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPatternsAndSeparators(CBC_CommonByteMatrix* matrix, int32_t &e) { if(matrix == NULL) { e = BCExceptionNullPointer; BC_EXCEPTION_CHECK_ReturnVoid(e); } - FX_INT32 pdpWidth = 7; + int32_t pdpWidth = 7; EmbedPositionDetectionPattern(0, 0, matrix, e); BC_EXCEPTION_CHECK_ReturnVoid(e); EmbedPositionDetectionPattern(matrix->GetWidth() - pdpWidth, 0, matrix, e); BC_EXCEPTION_CHECK_ReturnVoid(e); EmbedPositionDetectionPattern(0, matrix->GetWidth() - pdpWidth, matrix, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 hspWidth = 8; + int32_t hspWidth = 8; EmbedHorizontalSeparationPattern(0, hspWidth - 1, matrix, e); BC_EXCEPTION_CHECK_ReturnVoid(e); EmbedHorizontalSeparationPattern(matrix->GetWidth() - hspWidth, hspWidth - 1, matrix, e); BC_EXCEPTION_CHECK_ReturnVoid(e); EmbedHorizontalSeparationPattern(0, matrix->GetWidth() - hspWidth, matrix, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 vspSize = 7; + int32_t vspSize = 7; EmbedVerticalSeparationPattern(vspSize, 0, matrix, e); BC_EXCEPTION_CHECK_ReturnVoid(e); EmbedVerticalSeparationPattern(matrix->GetHeight() - vspSize - 1, 0, matrix, e); @@ -447,7 +447,7 @@ void CBC_QRCoderMatrixUtil::EmbedPositionDetectionPatternsAndSeparators(CBC_Comm EmbedVerticalSeparationPattern(vspSize, matrix->GetHeight() - vspSize, matrix, e); BC_EXCEPTION_CHECK_ReturnVoid(e); } -void CBC_QRCoderMatrixUtil::MaybeEmbedPositionAdjustmentPatterns(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e) +void CBC_QRCoderMatrixUtil::MaybeEmbedPositionAdjustmentPatterns(int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e) { if(matrix == NULL) { e = BCExceptionNullPointer; @@ -456,13 +456,13 @@ void CBC_QRCoderMatrixUtil::MaybeEmbedPositionAdjustmentPatterns(FX_INT32 versio if(version < 2) { return; } - FX_INT32 index = version - 1; - FX_INT32 const* coordinates = &(POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index][0]); - FX_INT32 numCoordinate = 7; - for(FX_INT32 i = 0; i < numCoordinate; i++) { - for(FX_INT32 j = 0; j < numCoordinate; j++) { - FX_INT32 y = coordinates[i]; - FX_INT32 x = coordinates[j]; + int32_t index = version - 1; + int32_t const* coordinates = &(POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index][0]); + int32_t numCoordinate = 7; + for(int32_t i = 0; i < numCoordinate; i++) { + for(int32_t j = 0; j < numCoordinate; j++) { + int32_t y = coordinates[i]; + int32_t x = coordinates[j]; if(x == -1 || y == -1) { continue; } @@ -473,9 +473,9 @@ void CBC_QRCoderMatrixUtil::MaybeEmbedPositionAdjustmentPatterns(FX_INT32 versio } } } -FX_INT32 CBC_QRCoderMatrixUtil::FindMSBSet(FX_INT32 value) +int32_t CBC_QRCoderMatrixUtil::FindMSBSet(int32_t value) { - FX_INT32 numDigits = 0; + int32_t numDigits = 0; while(value != 0) { value >>= 1; ++numDigits; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h index ce1e65d4c2..5da32441fc 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h @@ -12,38 +12,38 @@ class CBC_QRCoderBitVector; class CBC_QRCoderMatrixUtil { private: - const static FX_INT32 POSITION_DETECTION_PATTERN[7][7]; - const static FX_INT32 VERTICAL_SEPARATION_PATTERN[7][1]; - const static FX_INT32 HORIZONTAL_SEPARATION_PATTERN[1][8]; - const static FX_INT32 POSITION_ADJUSTMENT_PATTERN[5][5]; - const static FX_INT32 POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[40][7]; - const static FX_INT32 TYPE_INFO_COORDINATES[15][2]; - const static FX_INT32 VERSION_INFO_POLY; - const static FX_INT32 TYPE_INFO_POLY; - const static FX_INT32 TYPE_INFO_MASK_PATTERN; + const static int32_t POSITION_DETECTION_PATTERN[7][7]; + const static int32_t VERTICAL_SEPARATION_PATTERN[7][1]; + const static int32_t HORIZONTAL_SEPARATION_PATTERN[1][8]; + const static int32_t POSITION_ADJUSTMENT_PATTERN[5][5]; + const static int32_t POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[40][7]; + const static int32_t TYPE_INFO_COORDINATES[15][2]; + const static int32_t VERSION_INFO_POLY; + const static int32_t TYPE_INFO_POLY; + const static int32_t TYPE_INFO_MASK_PATTERN; public: CBC_QRCoderMatrixUtil(); virtual ~CBC_QRCoderMatrixUtil(); - static void ClearMatrix(CBC_CommonByteMatrix* matrix, FX_INT32 &e); + static void ClearMatrix(CBC_CommonByteMatrix* matrix, int32_t &e); static void BuildMatrix(CBC_QRCoderBitVector* dataBits, CBC_QRCoderErrorCorrectionLevel* ecLevel, - FX_INT32 version, FX_INT32 maskPattern, CBC_CommonByteMatrix* matrix, FX_INT32 &e); - static void EmbedBasicPatterns(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e); - static void EmbedTypeInfo(CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 maskPattern, CBC_CommonByteMatrix *matrix, FX_INT32 &e); - static void EmbedDataBits(CBC_QRCoderBitVector* dataBits, FX_INT32 maskPattern, CBC_CommonByteMatrix* matrix, FX_INT32 &e); - static void MaybeEmbedVersionInfo(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e); - static FX_INT32 FindMSBSet(FX_INT32 value); - static FX_INT32 CalculateBCHCode(FX_INT32 code, FX_INT32 poly); - static void MakeTypeInfoBits(CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 maskPattern, CBC_QRCoderBitVector* bits, FX_INT32 &e); - static void MakeVersionInfoBits(FX_INT32 version, CBC_QRCoderBitVector* bits, FX_INT32 &e); - static FX_BOOL IsEmpty(FX_INT32 value); - static FX_BOOL IsValidValue(FX_INT32 value); - static void EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, FX_INT32 &e); - static void EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* matrix, FX_INT32 &e); - static void EmbedHorizontalSeparationPattern(FX_INT32 xStart, FX_INT32 yStart, CBC_CommonByteMatrix* matrix, FX_INT32 &e); - static void EmbedVerticalSeparationPattern(FX_INT32 xStart, FX_INT32 yStart, CBC_CommonByteMatrix* matrix, FX_INT32 &e); - static void EmbedPositionAdjustmentPattern(FX_INT32 xStart, FX_INT32 yStart, CBC_CommonByteMatrix* matrix, FX_INT32 &e); - static void EmbedPositionDetectionPattern(FX_INT32 xStart, FX_INT32 yStart, CBC_CommonByteMatrix* matrix, FX_INT32 &e); - static void EmbedPositionDetectionPatternsAndSeparators(CBC_CommonByteMatrix* matrix, FX_INT32 &e); - static void MaybeEmbedPositionAdjustmentPatterns(FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e); + int32_t version, int32_t maskPattern, CBC_CommonByteMatrix* matrix, int32_t &e); + static void EmbedBasicPatterns(int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e); + static void EmbedTypeInfo(CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t maskPattern, CBC_CommonByteMatrix *matrix, int32_t &e); + static void EmbedDataBits(CBC_QRCoderBitVector* dataBits, int32_t maskPattern, CBC_CommonByteMatrix* matrix, int32_t &e); + static void MaybeEmbedVersionInfo(int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e); + static int32_t FindMSBSet(int32_t value); + static int32_t CalculateBCHCode(int32_t code, int32_t poly); + static void MakeTypeInfoBits(CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t maskPattern, CBC_QRCoderBitVector* bits, int32_t &e); + 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 void EmbedTimingPatterns(CBC_CommonByteMatrix* matrix, int32_t &e); + static void EmbedDarkDotAtLeftBottomCorner(CBC_CommonByteMatrix* matrix, int32_t &e); + static void EmbedHorizontalSeparationPattern(int32_t xStart, int32_t yStart, CBC_CommonByteMatrix* matrix, int32_t &e); + static void EmbedVerticalSeparationPattern(int32_t xStart, int32_t yStart, CBC_CommonByteMatrix* matrix, int32_t &e); + static void EmbedPositionAdjustmentPattern(int32_t xStart, int32_t yStart, CBC_CommonByteMatrix* matrix, int32_t &e); + static void EmbedPositionDetectionPattern(int32_t xStart, int32_t yStart, CBC_CommonByteMatrix* matrix, int32_t &e); + static void EmbedPositionDetectionPatternsAndSeparators(CBC_CommonByteMatrix* matrix, int32_t &e); + static void MaybeEmbedPositionAdjustmentPatterns(int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp index 00c7e47cb7..5bc2fe0623 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.cpp @@ -33,9 +33,9 @@ CBC_QRCoderMode* CBC_QRCoderMode::sTERMINATOR = NULL; CBC_QRCoderMode* CBC_QRCoderMode::sFNC1_FIRST_POSITION = NULL; CBC_QRCoderMode* CBC_QRCoderMode::sFNC1_SECOND_POSITION = NULL; CBC_QRCoderMode* CBC_QRCoderMode::sSTRUCTURED_APPEND = NULL; -CBC_QRCoderMode::CBC_QRCoderMode(FX_INT32 *characterCountBitsForVersions, - FX_INT32 x1, FX_INT32 x2, FX_INT32 x3, - FX_INT32 bits, CFX_ByteString name) +CBC_QRCoderMode::CBC_QRCoderMode(int32_t *characterCountBitsForVersions, + int32_t x1, int32_t x2, int32_t x3, + int32_t bits, CFX_ByteString name) { m_characterCountBitsForVersions = characterCountBitsForVersions; if (m_characterCountBitsForVersions != NULL) { @@ -54,16 +54,16 @@ CBC_QRCoderMode::~CBC_QRCoderMode() } void CBC_QRCoderMode::Initialize() { - sBYTE = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 8, 16, 16, 0x4, "BYTE"); - sALPHANUMERIC = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 9, 11, 13, 0x2, "ALPHANUMERIC"); + sBYTE = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 8, 16, 16, 0x4, "BYTE"); + sALPHANUMERIC = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 9, 11, 13, 0x2, "ALPHANUMERIC"); sECI = FX_NEW CBC_QRCoderMode(NULL, 0, 0, 0, 0x7, "ECI"); - sKANJI = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 8, 10, 12, 0x8, "KANJI"); - sNUMERIC = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 10, 12, 14, 0x1, "NUMERIC"); - sGBK = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 8, 10, 12, 0x0D, "GBK"); - sTERMINATOR = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 0, 0, 0, 0x00, "TERMINATOR"); + sKANJI = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 8, 10, 12, 0x8, "KANJI"); + sNUMERIC = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 10, 12, 14, 0x1, "NUMERIC"); + sGBK = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 8, 10, 12, 0x0D, "GBK"); + sTERMINATOR = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 0, 0, 0, 0x00, "TERMINATOR"); sFNC1_FIRST_POSITION = FX_NEW CBC_QRCoderMode(NULL, 0, 0, 0, 0x05, "FNC1_FIRST_POSITION"); sFNC1_SECOND_POSITION = FX_NEW CBC_QRCoderMode(NULL, 0, 0, 0, 0x09, "FNC1_SECOND_POSITION"); - sSTRUCTURED_APPEND = FX_NEW CBC_QRCoderMode(FX_Alloc(FX_INT32, 3), 0, 0, 0, 0x03, "STRUCTURED_APPEND"); + sSTRUCTURED_APPEND = FX_NEW CBC_QRCoderMode(FX_Alloc(int32_t, 3), 0, 0, 0, 0x03, "STRUCTURED_APPEND"); } void CBC_QRCoderMode::Finalize() { @@ -78,7 +78,7 @@ void CBC_QRCoderMode::Finalize() delete sFNC1_SECOND_POSITION; delete sSTRUCTURED_APPEND; } -CBC_QRCoderMode* CBC_QRCoderMode::ForBits(FX_INT32 bits, FX_INT32 &e) +CBC_QRCoderMode* CBC_QRCoderMode::ForBits(int32_t bits, int32_t &e) { switch (bits) { case 0x0: @@ -108,7 +108,7 @@ CBC_QRCoderMode* CBC_QRCoderMode::ForBits(FX_INT32 bits, FX_INT32 &e) } return NULL; } -FX_INT32 CBC_QRCoderMode::GetBits() +int32_t CBC_QRCoderMode::GetBits() { return m_bits; } @@ -116,14 +116,14 @@ CFX_ByteString CBC_QRCoderMode::GetName() { return m_name; } -FX_INT32 CBC_QRCoderMode::GetCharacterCountBits(CBC_QRCoderVersion* version, FX_INT32 &e) +int32_t CBC_QRCoderMode::GetCharacterCountBits(CBC_QRCoderVersion* version, int32_t &e) { if(m_characterCountBitsForVersions == NULL) { e = BCExceptionCharacterNotThisMode; BC_EXCEPTION_CHECK_ReturnValue(e, 0); } - FX_INT32 number = version->GetVersionNumber(); - FX_INT32 offset; + int32_t number = version->GetVersionNumber(); + int32_t offset; if(number <= 9) { offset = 0; } else if(number <= 26) { diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.h index fbd90871cf..472d3b1198 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderMode.h @@ -10,10 +10,10 @@ class CBC_QRCoderVersion; class CBC_QRCoderMode { private: - FX_INT32* m_characterCountBitsForVersions; - FX_INT32 m_bits; + int32_t* m_characterCountBitsForVersions; + int32_t m_bits; CFX_ByteString m_name; - CBC_QRCoderMode(FX_INT32 *characterCountBitsForVersions, FX_INT32 x1, FX_INT32 x2, FX_INT32 x3, FX_INT32 bits, CFX_ByteString name); + CBC_QRCoderMode(int32_t *characterCountBitsForVersions, int32_t x1, int32_t x2, int32_t x3, int32_t bits, CFX_ByteString name); CBC_QRCoderMode(); public: static CBC_QRCoderMode* sBYTE; @@ -30,9 +30,9 @@ public: static void Initialize(); static void Finalize(); - static CBC_QRCoderMode* ForBits(FX_INT32 bits, FX_INT32 &e); - FX_INT32 GetCharacterCountBits(CBC_QRCoderVersion* version, FX_INT32 &e); - FX_INT32 GetBits(); + static CBC_QRCoderMode* ForBits(int32_t bits, int32_t &e); + int32_t GetCharacterCountBits(CBC_QRCoderVersion* version, int32_t &e); + int32_t GetBits(); CFX_ByteString GetName(); static void Destroy(); }; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.cpp index 9ff54f2a13..e0acf46fb9 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.cpp @@ -29,7 +29,7 @@ #include "BC_QRCoderBitVector.h" #include "BC_QRCoderECBlocks.h" #include "BC_QRCoderVersion.h" -const FX_INT32 CBC_QRCoderVersion::VERSION_DECODE_INFO[] = { +const int32_t CBC_QRCoderVersion::VERSION_DECODE_INFO[] = { 0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847, 0x0E60D, 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683, @@ -45,13 +45,13 @@ void CBC_QRCoderVersion::Initialize() } void CBC_QRCoderVersion::Finalize() { - for(FX_INT32 i = 0 ; i < VERSION->GetSize(); i++) { + for(int32_t i = 0 ; i < VERSION->GetSize(); i++) { CBC_QRCoderVersion* v = (CBC_QRCoderVersion*)(VERSION->GetAt(i)); delete v; } delete VERSION; } -CBC_QRCoderVersion::CBC_QRCoderVersion(FX_INT32 versionNumber, +CBC_QRCoderVersion::CBC_QRCoderVersion(int32_t versionNumber, CBC_QRCoderECBlocks* ecBlocks1, CBC_QRCoderECBlocks* ecBlocks2, CBC_QRCoderECBlocks* ecBlocks3, @@ -62,10 +62,10 @@ CBC_QRCoderVersion::CBC_QRCoderVersion(FX_INT32 versionNumber, m_ecBlocks.Add(ecBlocks2); m_ecBlocks.Add(ecBlocks3); m_ecBlocks.Add(ecBlocks4); - FX_INT32 total = 0; - FX_INT32 ecCodeWords = ecBlocks1->GetECCodeWordsPerBlock(); + int32_t total = 0; + int32_t ecCodeWords = ecBlocks1->GetECCodeWordsPerBlock(); CFX_PtrArray* ecbArray = ecBlocks1->GetECBlocks(); - for(FX_INT32 i = 0; i < ecbArray->GetSize(); i++) { + for(int32_t i = 0; i < ecbArray->GetSize(); i++) { CBC_QRCoderECB* ecBlock = (CBC_QRCoderECB*)((*ecbArray)[i]); total += ecBlock->GetCount() * (ecBlock->GetDataCodeWords() + ecCodeWords); } @@ -334,15 +334,15 @@ CBC_QRCoderVersion::CBC_QRCoderVersion(FX_INT32 versionNumber, CBC_QRCoderVersion::~CBC_QRCoderVersion() { if(m_ecBlocks.GetSize() != 0) { - FX_INT32 itBeg = 0; - FX_INT32 itEnd = m_ecBlocks.GetSize(); + int32_t itBeg = 0; + int32_t itEnd = m_ecBlocks.GetSize(); while(itBeg != itEnd) { delete ( (CBC_QRCoderECBlocks*)(m_ecBlocks[itBeg]) ); itBeg++; } } } -FX_INT32 CBC_QRCoderVersion::GetVersionNumber() +int32_t CBC_QRCoderVersion::GetVersionNumber() { return m_versionNumber; } @@ -350,11 +350,11 @@ CFX_Int32Array* CBC_QRCoderVersion::GetAlignmentPatternCenters() { return &m_alignmentPatternCenters; } -FX_INT32 CBC_QRCoderVersion::GetTotalCodeWords() +int32_t CBC_QRCoderVersion::GetTotalCodeWords() { return m_totalCodeWords; } -FX_INT32 CBC_QRCoderVersion::GetDimensionForVersion() +int32_t CBC_QRCoderVersion::GetDimensionForVersion() { return 17 + 4 * m_versionNumber; } @@ -362,7 +362,7 @@ CBC_QRCoderECBlocks* CBC_QRCoderVersion::GetECBlocksForLevel(CBC_QRCoderErrorCor { return (CBC_QRCoderECBlocks*)m_ecBlocks[ecLevel->Ordinal()]; } -CBC_QRCoderVersion* CBC_QRCoderVersion::GetProvisionalVersionForDimension(FX_INT32 dimension, FX_INT32 &e) +CBC_QRCoderVersion* CBC_QRCoderVersion::GetProvisionalVersionForDimension(int32_t dimension, int32_t &e) { if((dimension % 4) != 1) { e = BCExceptionRead; @@ -372,18 +372,18 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetProvisionalVersionForDimension(FX_INT BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return qcv; } -CBC_QRCoderVersion* CBC_QRCoderVersion::DecodeVersionInformation(FX_INT32 versionBits, FX_INT32 &e) +CBC_QRCoderVersion* CBC_QRCoderVersion::DecodeVersionInformation(int32_t versionBits, int32_t &e) { - FX_INT32 bestDifference = FXSYS_IntMax; - FX_INT32 bestVersion = 0; - for (FX_INT32 i = 0; i < 34; i++) { - FX_INT32 targetVersion = VERSION_DECODE_INFO[i]; + int32_t bestDifference = FXSYS_IntMax; + int32_t bestVersion = 0; + for (int32_t i = 0; i < 34; i++) { + int32_t targetVersion = VERSION_DECODE_INFO[i]; if(targetVersion == versionBits) { CBC_QRCoderVersion* qcv = GetVersionForNumber(i + 7, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return qcv; } - FX_INT32 bitsDifference = CBC_QRCoderFormatInformation::NumBitsDiffering(versionBits, targetVersion); + int32_t bitsDifference = CBC_QRCoderFormatInformation::NumBitsDiffering(versionBits, targetVersion); if(bitsDifference < bestDifference) { bestVersion = i + 7; bestDifference = bitsDifference; @@ -396,9 +396,9 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::DecodeVersionInformation(FX_INT32 versio } return NULL; } -CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(FX_INT32 &e) +CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(int32_t &e) { - FX_INT32 dimension = GetDimensionForVersion(); + int32_t dimension = GetDimensionForVersion(); CBC_CommonBitMatrix* bitMatrix = FX_NEW CBC_CommonBitMatrix(); bitMatrix->Init(dimension); bitMatrix->SetRegion(0, 0 , 9, 9, e); @@ -407,10 +407,10 @@ CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(FX_INT32 &e) BC_EXCEPTION_CHECK_ReturnValue(e, NULL); bitMatrix->SetRegion(0, dimension - 8, 9, 8, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - FX_INT32 max = m_alignmentPatternCenters.GetSize(); - for (FX_INT32 x = 0; x < max; x++) { - FX_INT32 i = m_alignmentPatternCenters[x] - 2; - for (FX_INT32 y = 0; y < max; y++) { + int32_t max = m_alignmentPatternCenters.GetSize(); + for (int32_t x = 0; x < max; x++) { + int32_t i = m_alignmentPatternCenters[x] - 2; + for (int32_t y = 0; y < max; y++) { if ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0)) { continue; } @@ -430,7 +430,7 @@ CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(FX_INT32 &e) } return bitMatrix; } -CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(FX_INT32 versionNumber, FX_INT32 &e) +CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(int32_t versionNumber, int32_t &e) { if(VERSION->GetSize() == 0) { VERSION->Add(FX_NEW CBC_QRCoderVersion(1, @@ -770,7 +770,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(FX_INT32 versionNumb } void CBC_QRCoderVersion::Destroy() { - FX_INT32 i; + int32_t i; for(i = 0; i < VERSION->GetSize(); i++) { delete ( (CBC_QRCoderVersion*)(*VERSION)[i] ); } diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h b/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h index 17d392121d..46a80c8d09 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderVersion.h @@ -12,30 +12,30 @@ class CBC_QRCoderErrorCorrectionLevel; class CBC_QRCoderVersion { private: - const static FX_INT32 VERSION_DECODE_INFO[34]; + const static int32_t VERSION_DECODE_INFO[34]; static CFX_PtrArray *VERSION; - FX_INT32 m_versionNumber; - FX_INT32 m_totalCodeWords; + int32_t m_versionNumber; + int32_t m_totalCodeWords; CFX_Int32Array m_alignmentPatternCenters; CFX_PtrArray m_ecBlocks; CBC_QRCoderVersion(); - CBC_QRCoderVersion(FX_INT32 versionNumber, CBC_QRCoderECBlocks* ecBlocks1, CBC_QRCoderECBlocks* ecBlocks2, + CBC_QRCoderVersion(int32_t versionNumber, CBC_QRCoderECBlocks* ecBlocks1, CBC_QRCoderECBlocks* ecBlocks2, CBC_QRCoderECBlocks* ecBlocks3, CBC_QRCoderECBlocks* ecBlocks4); public: virtual ~CBC_QRCoderVersion(); static void Initialize(); static void Finalize(); - FX_INT32 GetVersionNumber(); - FX_INT32 GetTotalCodeWords(); - FX_INT32 GetDimensionForVersion(); - CBC_CommonBitMatrix *BuildFunctionPattern(FX_INT32 &e); + int32_t GetVersionNumber(); + int32_t GetTotalCodeWords(); + int32_t GetDimensionForVersion(); + CBC_CommonBitMatrix *BuildFunctionPattern(int32_t &e); CFX_Int32Array* GetAlignmentPatternCenters(); CBC_QRCoderECBlocks* GetECBlocksForLevel(CBC_QRCoderErrorCorrectionLevel *ecLevel); - static CBC_QRCoderVersion* GetVersionForNumber(FX_INT32 versionNumber, FX_INT32 &e); - static CBC_QRCoderVersion* GetProvisionalVersionForDimension(FX_INT32 dimension, FX_INT32 &e); - static CBC_QRCoderVersion* DecodeVersionInformation(FX_INT32 versionBits, FX_INT32 &e); + static CBC_QRCoderVersion* GetVersionForNumber(int32_t versionNumber, int32_t &e); + static CBC_QRCoderVersion* GetProvisionalVersionForDimension(int32_t dimension, int32_t &e); + static CBC_QRCoderVersion* DecodeVersionInformation(int32_t versionBits, int32_t &e); static void Destroy(); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp index 87c14deac9..2877d2f82b 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.cpp @@ -25,7 +25,7 @@ #include "BC_QRCoderECB.h" #include "BC_QRDataBlock.h" #include "BC_QRCoderVersion.h" -CBC_QRDataBlock::CBC_QRDataBlock(FX_INT32 numDataCodewords, CFX_ByteArray *codewords) +CBC_QRDataBlock::CBC_QRDataBlock(int32_t numDataCodewords, CFX_ByteArray *codewords) : m_numDataCodewords(numDataCodewords) , m_codewords(codewords) { @@ -37,7 +37,7 @@ CBC_QRDataBlock::~CBC_QRDataBlock() m_codewords = NULL; } } -FX_INT32 CBC_QRDataBlock::GetNumDataCodewords() +int32_t CBC_QRDataBlock::GetNumDataCodewords() { return m_numDataCodewords; } @@ -45,47 +45,47 @@ CFX_ByteArray *CBC_QRDataBlock::GetCodewords() { return m_codewords; } -CFX_PtrArray *CBC_QRDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords, CBC_QRCoderVersion *version, CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 &e) +CFX_PtrArray *CBC_QRDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords, CBC_QRCoderVersion *version, CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t &e) { if(rawCodewords->GetSize() != version->GetTotalCodeWords()) { e = BCExceptionIllegalArgument; BC_EXCEPTION_CHECK_ReturnValue(e, NULL); } CBC_QRCoderECBlocks *ecBlocks = version->GetECBlocksForLevel(ecLevel); - FX_INT32 totalBlocks = 0; + int32_t totalBlocks = 0; CFX_PtrArray* ecBlockArray = ecBlocks->GetECBlocks(); - FX_INT32 i = 0; + int32_t i = 0; for(i = 0; i < ecBlockArray->GetSize(); i++) { totalBlocks += ((CBC_QRCoderECB*)(*ecBlockArray)[i])->GetCount(); } CFX_PtrArray *datablock = FX_NEW CFX_PtrArray(); datablock->SetSize(totalBlocks); CBC_AutoPtr result(datablock); - FX_INT32 numResultBlocks = 0; - for(FX_INT32 j = 0; j < ecBlockArray->GetSize(); j++) { + int32_t numResultBlocks = 0; + for(int32_t j = 0; j < ecBlockArray->GetSize(); j++) { CBC_QRCoderECB *ecBlock = (CBC_QRCoderECB*)(*ecBlockArray)[j]; - for(FX_INT32 k = 0; k < ecBlock->GetCount(); k++) { - FX_INT32 numDataCodewords = ecBlock->GetDataCodeWords(); - FX_INT32 numBlockCodewords = ecBlocks->GetECCodeWordsPerBlock() + numDataCodewords; + for(int32_t k = 0; k < ecBlock->GetCount(); k++) { + int32_t numDataCodewords = ecBlock->GetDataCodeWords(); + int32_t numBlockCodewords = ecBlocks->GetECCodeWordsPerBlock() + numDataCodewords; CFX_ByteArray *bytearray = FX_NEW CFX_ByteArray(); bytearray->SetSize(numBlockCodewords); (*result)[numResultBlocks++] = FX_NEW CBC_QRDataBlock(numDataCodewords, bytearray); } } - FX_INT32 shorterBlocksTotalCodewords = ((CBC_QRDataBlock*)(*result)[0])->m_codewords->GetSize(); - FX_INT32 longerBlocksStartAt = result->GetSize() - 1; + int32_t shorterBlocksTotalCodewords = ((CBC_QRDataBlock*)(*result)[0])->m_codewords->GetSize(); + int32_t longerBlocksStartAt = result->GetSize() - 1; while(longerBlocksStartAt >= 0) { - FX_INT32 numCodewords = ((CBC_QRDataBlock*)(*result)[longerBlocksStartAt])->m_codewords->GetSize(); + int32_t numCodewords = ((CBC_QRDataBlock*)(*result)[longerBlocksStartAt])->m_codewords->GetSize(); if(numCodewords == shorterBlocksTotalCodewords) { break; } longerBlocksStartAt--; } longerBlocksStartAt++; - FX_INT32 shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks->GetECCodeWordsPerBlock(); - FX_INT32 rawCodewordsOffset = 0; - FX_INT32 x = 0; - for(FX_INT32 k = 0; k < shorterBlocksNumDataCodewords; k++) { + int32_t shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks->GetECCodeWordsPerBlock(); + int32_t rawCodewordsOffset = 0; + int32_t x = 0; + for(int32_t k = 0; k < shorterBlocksNumDataCodewords; k++) { for(x = 0; x < numResultBlocks; x++) { (*(((CBC_QRDataBlock*)(*result)[x])->m_codewords))[k] = (*rawCodewords)[rawCodewordsOffset++]; } @@ -93,10 +93,10 @@ CFX_PtrArray *CBC_QRDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords, CBC_QR for(x = longerBlocksStartAt; x < numResultBlocks; x++) { (*(((CBC_QRDataBlock*)(*result)[x])->m_codewords))[shorterBlocksNumDataCodewords] = (*rawCodewords)[rawCodewordsOffset++]; } - FX_INT32 max = ((CBC_QRDataBlock*)(*result)[0])->m_codewords->GetSize(); + int32_t max = ((CBC_QRDataBlock*)(*result)[0])->m_codewords->GetSize(); for(i = shorterBlocksNumDataCodewords; i < max; i++) { - for(FX_INT32 y = 0; y < numResultBlocks; y++) { - FX_INT32 iOffset = y < longerBlocksStartAt ? i : i + 1; + for(int32_t y = 0; y < numResultBlocks; y++) { + int32_t iOffset = y < longerBlocksStartAt ? i : i + 1; (*(((CBC_QRDataBlock*)(*result)[y])->m_codewords))[iOffset] = (*rawCodewords)[rawCodewordsOffset++]; } } diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h index d5697ff724..4502398e92 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRDataBlock.h @@ -13,14 +13,14 @@ class CBC_QRCoderErrorCorrectionLevel; class CBC_QRDataBlock { private: - FX_INT32 m_numDataCodewords; + int32_t m_numDataCodewords; CFX_ByteArray *m_codewords; - CBC_QRDataBlock(FX_INT32 numDataCodewords, CFX_ByteArray *codewords); + CBC_QRDataBlock(int32_t numDataCodewords, CFX_ByteArray *codewords); public: virtual ~CBC_QRDataBlock(); - FX_INT32 GetNumDataCodewords(); + int32_t GetNumDataCodewords(); CFX_ByteArray* GetCodewords(); static CFX_PtrArray *GetDataBlocks(CFX_ByteArray* rawCodewords, - CBC_QRCoderVersion *version, CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 &e); + CBC_QRCoderVersion *version, CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t &e); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDataMask.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDataMask.cpp index fd81b20f1b..bfea8e2d4d 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDataMask.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRDataMask.cpp @@ -23,7 +23,7 @@ #include "../barcode.h" #include "../common/BC_CommonBitMatrix.h" #include "BC_QRDataMask.h" -static FX_INT32 N_DATA_MASKS = 0; +static int32_t N_DATA_MASKS = 0; CFX_PtrArray* CBC_QRDataMask::DATA_MASKS = NULL; void CBC_QRDataMask::Initialize() { @@ -37,7 +37,7 @@ void CBC_QRDataMask::Finalize() } void CBC_QRDataMask::Destroy() { - FX_INT32 i; + int32_t i; for(i = 0; i < N_DATA_MASKS; i++) { CBC_QRDataMask* p = (CBC_QRDataMask*)(*DATA_MASKS)[i]; if (p) { @@ -45,17 +45,17 @@ void CBC_QRDataMask::Destroy() } } } -void CBC_QRDataMask::UnmaskBitMatirx(CBC_CommonBitMatrix *bits, FX_INT32 dimension) +void CBC_QRDataMask::UnmaskBitMatirx(CBC_CommonBitMatrix *bits, int32_t dimension) { - for(FX_INT32 i = 0; i < dimension; i++) { - for(FX_INT32 j = 0; j < dimension; j++) { + for(int32_t i = 0; i < dimension; i++) { + for(int32_t j = 0; j < dimension; j++) { if(IsMasked(i, j)) { bits->Flip(j, i); } } } } -CBC_QRDataMask* CBC_QRDataMask::ForReference(FX_INT32 reference, FX_INT32 &e) +CBC_QRDataMask* CBC_QRDataMask::ForReference(int32_t reference, int32_t &e) { if(reference < 0 || reference > 7) { e = BCExceptionReferenceMustBeBetween0And7; @@ -66,7 +66,7 @@ CBC_QRDataMask* CBC_QRDataMask::ForReference(FX_INT32 reference, FX_INT32 &e) class DataMask000 : public CBC_QRDataMask { public: - FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y) + FX_BOOL IsMasked(int32_t x, int32_t y) { return ((x + y) % 2) == 0; } @@ -74,7 +74,7 @@ public: class DataMask001 : public CBC_QRDataMask { public: - FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y) + FX_BOOL IsMasked(int32_t x, int32_t y) { return (x % 2) == 0; } @@ -82,7 +82,7 @@ public: class DataMask010 : public CBC_QRDataMask { public: - FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y) + FX_BOOL IsMasked(int32_t x, int32_t y) { return y % 3 == 0; } @@ -90,7 +90,7 @@ public: class DataMask011 : public CBC_QRDataMask { public: - FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y) + FX_BOOL IsMasked(int32_t x, int32_t y) { return (x + y) % 3 == 0; } @@ -98,7 +98,7 @@ public: class DataMask100 : public CBC_QRDataMask { public: - FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y) + FX_BOOL IsMasked(int32_t x, int32_t y) { return (((x >> 1) + (y / 3)) % 2) == 0; } @@ -106,7 +106,7 @@ public: class DataMask101 : public CBC_QRDataMask { public: - FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y) + FX_BOOL IsMasked(int32_t x, int32_t y) { size_t temp = x * y; return (temp % 2) + (temp % 3) == 0; @@ -115,7 +115,7 @@ public: class DataMask110 : public CBC_QRDataMask { public: - FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y) + FX_BOOL IsMasked(int32_t x, int32_t y) { size_t temp = x * y; return (((temp % 2) + (temp % 3)) % 2) == 0; @@ -124,12 +124,12 @@ public: class DataMask111 : public CBC_QRDataMask { public: - FX_BOOL IsMasked(FX_INT32 x, FX_INT32 y) + FX_BOOL IsMasked(int32_t x, int32_t y) { return ((((x + y) % 2) + ((x * y) % 3)) % 2) == 0; } }; -FX_INT32 CBC_QRDataMask::BuildDataMasks() +int32_t CBC_QRDataMask::BuildDataMasks() { DATA_MASKS->Add(FX_NEW DataMask000); DATA_MASKS->Add(FX_NEW DataMask001); diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDataMask.h b/xfa/src/fxbarcode/qrcode/BC_QRDataMask.h index 221218f34a..79ae4901b6 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDataMask.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRDataMask.h @@ -15,10 +15,10 @@ public: virtual ~CBC_QRDataMask(); static void Initialize(); static void Finalize(); - virtual FX_BOOL IsMasked(FX_INT32 i, FX_INT32 j) = 0; - void UnmaskBitMatirx(CBC_CommonBitMatrix *bits, FX_INT32 dimension); - static CBC_QRDataMask* ForReference(FX_INT32 reference, FX_INT32 &e); - static FX_INT32 BuildDataMasks(); + virtual FX_BOOL IsMasked(int32_t i, int32_t j) = 0; + void UnmaskBitMatirx(CBC_CommonBitMatrix *bits, int32_t dimension); + static CBC_QRDataMask* ForReference(int32_t reference, int32_t &e); + static int32_t BuildDataMasks(); static void Destroy(); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp index 0fe4d1b2b6..b521222f00 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.cpp @@ -42,7 +42,7 @@ CBC_QRDecodedBitStreamParser::~CBC_QRDecodedBitStreamParser() { } CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode(CFX_ByteArray *bytes, CBC_QRCoderVersion *version, - CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 byteModeDecode, FX_INT32 &e) + CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t byteModeDecode, int32_t &e) { CBC_CommonBitSource bits(bytes); CFX_ByteString result; @@ -54,7 +54,7 @@ CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode(CFX_ByteArray *byt if(bits.Available() < 4) { mode = CBC_QRCoderMode::sTERMINATOR; } else { - FX_INT32 iTemp1 = bits.ReadBits(4, e); + int32_t iTemp1 = bits.ReadBits(4, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); mode = CBC_QRCoderMode::ForBits(iTemp1, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); @@ -70,7 +70,7 @@ CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode(CFX_ByteArray *byt bits.ReadBits(16, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); } else if(mode == CBC_QRCoderMode::sECI) { - FX_INT32 value = ParseECIValue(&bits, e); + int32_t value = ParseECIValue(&bits, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); currentCharacterSetECI = CBC_CommonCharacterSetECI::GetCharacterSetECIByValue(value); } else { @@ -78,9 +78,9 @@ CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode(CFX_ByteArray *byt bits.ReadBits(4, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); } - FX_INT32 numBits = mode->GetCharacterCountBits(version, e); + int32_t numBits = mode->GetCharacterCountBits(version, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - FX_INT32 count = bits.ReadBits(numBits, e); + int32_t count = bits.ReadBits(numBits, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); if(mode == CBC_QRCoderMode::sNUMERIC) { DecodeNumericSegment(&bits, result, count, e); @@ -109,46 +109,46 @@ CBC_CommonDecoderResult* CBC_QRDecodedBitStreamParser::Decode(CFX_ByteArray *byt BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return tempCd; } -void CBC_QRDecodedBitStreamParser::DecodeGBKSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e) +void CBC_QRDecodedBitStreamParser::DecodeGBKSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, int32_t &e) { CFX_ByteString buffer; - FX_INT32 offset = 0; + int32_t offset = 0; while (count > 0) { - FX_INT32 twoBytes = bits->ReadBits(13, e); + int32_t twoBytes = bits->ReadBits(13, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 assembledTwoBytes = ((twoBytes / 0x060) << 8) | (twoBytes % 0x060); + int32_t assembledTwoBytes = ((twoBytes / 0x060) << 8) | (twoBytes % 0x060); if (assembledTwoBytes <= 0x0095d) { assembledTwoBytes += 0x0a1a1; } else { assembledTwoBytes += 0x0a6a1; } - buffer += (FX_BYTE) (assembledTwoBytes >> 8); - buffer += (FX_BYTE) assembledTwoBytes; + buffer += (uint8_t) (assembledTwoBytes >> 8); + buffer += (uint8_t) assembledTwoBytes; count--; } CBC_UtilCodingConvert::LocaleToUtf8(buffer, result); } -void CBC_QRDecodedBitStreamParser::DecodeKanjiSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e) +void CBC_QRDecodedBitStreamParser::DecodeKanjiSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, int32_t &e) { CFX_ByteString buffer; while (count > 0) { - FX_INT32 twoBytes = bits->ReadBits(13, e); + int32_t twoBytes = bits->ReadBits(13, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 assembledTwoBytes = ((twoBytes / 0x0c0) << 8) | (twoBytes % 0x0c0); + int32_t assembledTwoBytes = ((twoBytes / 0x0c0) << 8) | (twoBytes % 0x0c0); if (assembledTwoBytes <= 0x01f00) { assembledTwoBytes += 0x08140; } else { assembledTwoBytes += 0x0c140; } - buffer += (FX_BYTE) (assembledTwoBytes >> 8); - buffer += (FX_BYTE) assembledTwoBytes; + buffer += (uint8_t) (assembledTwoBytes >> 8); + buffer += (uint8_t) assembledTwoBytes; count--; } CBC_UtilCodingConvert::LocaleToUtf8(buffer, result); } -void CBC_QRDecodedBitStreamParser::DecodeByteSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, +void CBC_QRDecodedBitStreamParser::DecodeByteSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, CBC_CommonCharacterSetECI *currentCharacterSetECI, - CFX_Int32Array *byteSegments, FX_INT32 byteModeDecode, FX_INT32 &e) + CFX_Int32Array *byteSegments, int32_t byteModeDecode, int32_t &e) { if(count < 0) { e = BCExceptionNotFound; @@ -158,10 +158,10 @@ void CBC_QRDecodedBitStreamParser::DecodeByteSegment(CBC_CommonBitSource* bits, e = BCExceptionRead; BC_EXCEPTION_CHECK_ReturnVoid(e); } - FX_BYTE *readBytes = FX_Alloc(FX_BYTE, count); + uint8_t *readBytes = FX_Alloc(uint8_t, count); FXSYS_memset32(readBytes, 0x00, count); - for(FX_INT32 i = 0; i < count; i++) { - readBytes[i] = (FX_BYTE) bits->ReadBits(8, e); + for(int32_t i = 0; i < count; i++) { + readBytes[i] = (uint8_t) bits->ReadBits(8, e); BC_EXCEPTION_CHECK_ReturnVoid(e); } CFX_ByteString bs(readBytes, count); @@ -169,23 +169,23 @@ void CBC_QRDecodedBitStreamParser::DecodeByteSegment(CBC_CommonBitSource* bits, FX_Free(readBytes); } void CBC_QRDecodedBitStreamParser::DecodeAlphanumericSegment(CBC_CommonBitSource* bits, - CFX_ByteString &result, FX_INT32 count, FX_BOOL fac1InEffect, FX_INT32 &e) + CFX_ByteString &result, int32_t count, FX_BOOL fac1InEffect, int32_t &e) { - FX_INT32 start = result.GetLength(); + int32_t start = result.GetLength(); while(count > 1) { - FX_INT32 nextTwoCharsBits = bits->ReadBits(11, e); + int32_t nextTwoCharsBits = bits->ReadBits(11, e); BC_EXCEPTION_CHECK_ReturnVoid(e); BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[nextTwoCharsBits / 45]); BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[nextTwoCharsBits % 45]); count -= 2; } if(count == 1) { - FX_INT32 itemp = bits->ReadBits(6, e); + int32_t itemp = bits->ReadBits(6, e); BC_EXCEPTION_CHECK_ReturnVoid(e); BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[itemp]); } if(fac1InEffect) { - for(FX_INT32 i = start; i < result.GetLength(); i++) { + for(int32_t i = start; i < result.GetLength(); i++) { if(result[i] == '%') { if((i < result.GetLength() - 1) && result[i + 1] == '%') { result.Delete(i + 1, 1); @@ -196,10 +196,10 @@ void CBC_QRDecodedBitStreamParser::DecodeAlphanumericSegment(CBC_CommonBitSource } } } -void CBC_QRDecodedBitStreamParser::DecodeNumericSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e) +void CBC_QRDecodedBitStreamParser::DecodeNumericSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, int32_t &e) { while(count >= 3) { - FX_INT32 threeDigitsBits = bits->ReadBits(10, e); + int32_t threeDigitsBits = bits->ReadBits(10, e); BC_EXCEPTION_CHECK_ReturnVoid(e); if(threeDigitsBits >= 1000) { e = BCExceptionRead; @@ -211,7 +211,7 @@ void CBC_QRDecodedBitStreamParser::DecodeNumericSegment(CBC_CommonBitSource* bit count -= 3; } if(count == 2) { - FX_INT32 twoDigitBits = bits->ReadBits(7, e); + int32_t twoDigitBits = bits->ReadBits(7, e); BC_EXCEPTION_CHECK_ReturnVoid(e); if(twoDigitBits >= 100) { e = BCExceptionRead; @@ -220,7 +220,7 @@ void CBC_QRDecodedBitStreamParser::DecodeNumericSegment(CBC_CommonBitSource* bit BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[twoDigitBits / 10]); BC_FX_ByteString_Append(result, 1, ALPHANUMERIC_CHARS[twoDigitBits % 10]); } else if(count == 1) { - FX_INT32 digitBits = bits->ReadBits(4, e); + int32_t digitBits = bits->ReadBits(4, e); BC_EXCEPTION_CHECK_ReturnVoid(e); if(digitBits >= 10) { e = BCExceptionRead; @@ -233,18 +233,18 @@ const CFX_ByteString CBC_QRDecodedBitStreamParser::GuessEncoding(CFX_ByteArray * { return *UTF_8; } -FX_INT32 CBC_QRDecodedBitStreamParser::ParseECIValue(CBC_CommonBitSource* bits, FX_INT32 &e) +int32_t CBC_QRDecodedBitStreamParser::ParseECIValue(CBC_CommonBitSource* bits, int32_t &e) { - FX_INT32 firstByte = bits->ReadBits(8, e); + int32_t firstByte = bits->ReadBits(8, e); BC_EXCEPTION_CHECK_ReturnValue(e, 0); if((firstByte & 0x80) == 0) { return firstByte & 0x7f; } else if((firstByte & 0xc0) == 0x80) { - FX_INT32 secondByte = bits->ReadBits(8, e); + int32_t secondByte = bits->ReadBits(8, e); BC_EXCEPTION_CHECK_ReturnValue(e, 0); return ((firstByte & 0x3f) << 8) | secondByte; } else if((firstByte & 0xe0) == 0xc0) { - FX_INT32 secondThirdByte = bits->ReadBits(16, e); + int32_t secondThirdByte = bits->ReadBits(16, e); BC_EXCEPTION_CHECK_ReturnValue(e, 0); return ((firstByte & 0x1f) << 16) | secondThirdByte; } diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.h b/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.h index f4ac06b984..d607e72da8 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRDecodedBitStreamParser.h @@ -20,15 +20,15 @@ private: public: virtual ~CBC_QRDecodedBitStreamParser(); static CBC_CommonDecoderResult* Decode(CFX_ByteArray *bytes, CBC_QRCoderVersion *version, - CBC_QRCoderErrorCorrectionLevel* ecLevel, FX_INT32 byteModeDecode, FX_INT32 &e); + CBC_QRCoderErrorCorrectionLevel* ecLevel, int32_t byteModeDecode, int32_t &e); static const CFX_ByteString GuessEncoding(CFX_ByteArray* bytes); - static FX_INT32 ParseECIValue(CBC_CommonBitSource* bits, FX_INT32 &e); - static void DecodeGBKSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e); - static void DecodeKanjiSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e); - static void DecodeNumericSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_INT32 &e); - static void DecodeAlphanumericSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, FX_BOOL fac1InEffect, FX_INT32 &e); - static void DecodeByteSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, FX_INT32 count, CBC_CommonCharacterSetECI *currentCharacterSetECI, - CFX_Int32Array *byteSegments, FX_INT32 byteModeDecode, FX_INT32 &e); + static int32_t ParseECIValue(CBC_CommonBitSource* bits, int32_t &e); + static void DecodeGBKSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, int32_t &e); + static void DecodeKanjiSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, int32_t &e); + static void DecodeNumericSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, int32_t &e); + static void DecodeAlphanumericSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, FX_BOOL fac1InEffect, int32_t &e); + static void DecodeByteSegment(CBC_CommonBitSource* bits, CFX_ByteString &result, int32_t count, CBC_CommonCharacterSetECI *currentCharacterSetECI, + CFX_Int32Array *byteSegments, int32_t byteModeDecode, int32_t &e); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp index 01d90832b9..0b75da7bec 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRDetector.cpp @@ -37,7 +37,7 @@ CBC_QRDetector::CBC_QRDetector(CBC_CommonBitMatrix *image): m_image(image) CBC_QRDetector::~CBC_QRDetector() { } -CBC_QRDetectorResult *CBC_QRDetector::Detect(FX_INT32 hints, FX_INT32 &e) +CBC_QRDetectorResult *CBC_QRDetector::Detect(int32_t hints, int32_t &e) { CBC_QRFinderPatternFinder finder(m_image); CBC_QRFinderPatternInfo* qpi = finder.Find(hints, e); @@ -47,7 +47,7 @@ CBC_QRDetectorResult *CBC_QRDetector::Detect(FX_INT32 hints, FX_INT32 &e) BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return qdr; } -CBC_QRDetectorResult* CBC_QRDetector::ProcessFinderPatternInfo(CBC_QRFinderPatternInfo *info, FX_INT32 &e) +CBC_QRDetectorResult* CBC_QRDetector::ProcessFinderPatternInfo(CBC_QRFinderPatternInfo *info, int32_t &e) { CBC_AutoPtr topLeft(info->GetTopLeft()); CBC_AutoPtr topRight(info->GetTopRight()); @@ -57,21 +57,21 @@ CBC_QRDetectorResult* CBC_QRDetector::ProcessFinderPatternInfo(CBC_QRFinderPatte e = BCExceptionRead; BC_EXCEPTION_CHECK_ReturnValue(e, NULL); } - FX_INT32 dimension = ComputeDimension(topLeft.get(), topRight.get(), bottomLeft.get(), moduleSize, e); + int32_t dimension = ComputeDimension(topLeft.get(), topRight.get(), bottomLeft.get(), moduleSize, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_QRCoderVersion *provisionalVersion = CBC_QRCoderVersion::GetProvisionalVersionForDimension(dimension, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - FX_INT32 modulesBetweenFPCenters = provisionalVersion->GetDimensionForVersion() - 7; + int32_t modulesBetweenFPCenters = provisionalVersion->GetDimensionForVersion() - 7; CBC_QRAlignmentPattern * alignmentPattern = NULL; if(provisionalVersion->GetAlignmentPatternCenters()->GetSize() > 0) { FX_FLOAT bottomRightX = topRight->GetX() - topLeft->GetX() + bottomLeft->GetX(); FX_FLOAT bottomRightY = topRight->GetY() - topLeft->GetY() + bottomLeft->GetY(); FX_FLOAT correctionToTopLeft = 1.0f - 3.0f / (FX_FLOAT) modulesBetweenFPCenters; FX_FLOAT xtemp = (topLeft->GetX() + correctionToTopLeft * (bottomRightX - topLeft->GetX())); - FX_INT32 estAlignmentX = (FX_INT32)xtemp ; + int32_t estAlignmentX = (int32_t)xtemp ; FX_FLOAT ytemp = (topLeft->GetY() + correctionToTopLeft * (bottomRightY - topLeft->GetY())); - FX_INT32 estAlignmentY = (FX_INT32)ytemp; - for(FX_INT32 i = 4; i <= 16; i <<= 1) { + int32_t estAlignmentY = (int32_t)ytemp; + for(int32_t i = 4; i <= 16; i <<= 1) { CBC_QRAlignmentPattern *temp = FindAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, (FX_FLOAT) i, e); alignmentPattern = temp; break; @@ -94,7 +94,7 @@ CBC_QRDetectorResult* CBC_QRDetector::ProcessFinderPatternInfo(CBC_QRFinderPatte } CBC_CommonBitMatrix *CBC_QRDetector::SampleGrid(CBC_CommonBitMatrix *image, CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, CBC_ResultPoint *bottomLeft, CBC_ResultPoint* alignmentPattern, - FX_INT32 dimension, FX_INT32 &e) + int32_t dimension, int32_t &e) { FX_FLOAT dimMinusThree = (FX_FLOAT) dimension - 3.5f; FX_FLOAT bottomRightX; @@ -132,12 +132,12 @@ CBC_CommonBitMatrix *CBC_QRDetector::SampleGrid(CBC_CommonBitMatrix *image, CBC_ BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return cbm; } -FX_INT32 CBC_QRDetector::ComputeDimension(CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, - CBC_ResultPoint *bottomLeft, FX_FLOAT moduleSize, FX_INT32 &e) +int32_t CBC_QRDetector::ComputeDimension(CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, + CBC_ResultPoint *bottomLeft, FX_FLOAT moduleSize, int32_t &e) { - FX_INT32 tltrCentersDimension = Round(CBC_QRFinderPatternFinder::Distance(topLeft, topRight) / moduleSize); - FX_INT32 tlblCentersDimension = Round(CBC_QRFinderPatternFinder::Distance(topLeft, bottomLeft) / moduleSize); - FX_INT32 dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7; + int32_t tltrCentersDimension = Round(CBC_QRFinderPatternFinder::Distance(topLeft, topRight) / moduleSize); + int32_t tlblCentersDimension = Round(CBC_QRFinderPatternFinder::Distance(topLeft, bottomLeft) / moduleSize); + int32_t dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7; switch(dimension & 0x03) { case 0: dimension++; @@ -158,14 +158,14 @@ FX_FLOAT CBC_QRDetector::CalculateModuleSize(CBC_ResultPoint *topLeft, CBC_Resul } FX_FLOAT CBC_QRDetector::CalculateModuleSizeOneWay(CBC_ResultPoint *pattern, CBC_ResultPoint *otherPattern) { - FX_FLOAT moduleSizeEst1 = SizeOfBlackWhiteBlackRunBothWays((FX_INT32) pattern->GetX(), - (FX_INT32) pattern->GetY(), - (FX_INT32) otherPattern->GetX(), - (FX_INT32) otherPattern->GetY()); - FX_FLOAT moduleSizeEst2 = SizeOfBlackWhiteBlackRunBothWays((FX_INT32) otherPattern->GetX(), - (FX_INT32) otherPattern->GetY(), - (FX_INT32) pattern->GetX(), - (FX_INT32) pattern->GetY()); + FX_FLOAT moduleSizeEst1 = SizeOfBlackWhiteBlackRunBothWays((int32_t) pattern->GetX(), + (int32_t) pattern->GetY(), + (int32_t) otherPattern->GetX(), + (int32_t) otherPattern->GetY()); + FX_FLOAT moduleSizeEst2 = SizeOfBlackWhiteBlackRunBothWays((int32_t) otherPattern->GetX(), + (int32_t) otherPattern->GetY(), + (int32_t) pattern->GetX(), + (int32_t) pattern->GetY()); if (FXSYS_isnan(moduleSizeEst1)) { return moduleSizeEst2; } @@ -174,20 +174,20 @@ FX_FLOAT CBC_QRDetector::CalculateModuleSizeOneWay(CBC_ResultPoint *pattern, CBC } return (moduleSizeEst1 + moduleSizeEst2) / 14.0f; } -FX_INT32 CBC_QRDetector::Round(FX_FLOAT d) +int32_t CBC_QRDetector::Round(FX_FLOAT d) { - return (FX_INT32)(d + 0.5f); + return (int32_t)(d + 0.5f); } -FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRunBothWays(FX_INT32 fromX, FX_INT32 fromY, FX_INT32 toX, FX_INT32 toY) +FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRunBothWays(int32_t fromX, int32_t fromY, int32_t toX, int32_t toY) { FX_FLOAT result = SizeOfBlackWhiteBlackRun(fromX, fromY, toX, toY); - FX_INT32 otherToX = fromX - (toX - fromX); + int32_t otherToX = fromX - (toX - fromX); if (otherToX < 0) { otherToX = -1; } else if (otherToX >= m_image->GetWidth()) { otherToX = m_image->GetWidth(); } - FX_INT32 otherToY = fromY - (toY - fromY); + int32_t otherToY = fromY - (toY - fromY); if (otherToY < 0) { otherToY = -1; } else if (otherToY >= m_image->GetHeight()) { @@ -196,26 +196,26 @@ FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRunBothWays(FX_INT32 fromX, FX_INT result += SizeOfBlackWhiteBlackRun(fromX, fromY, otherToX, otherToY); return result - 1.0f; } -FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRun(FX_INT32 fromX, FX_INT32 fromY, FX_INT32 toX, FX_INT32 toY) +FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRun(int32_t fromX, int32_t fromY, int32_t toX, int32_t toY) { FX_BOOL steep = FXSYS_abs(toY - fromY) > FXSYS_abs(toX - fromX); if (steep) { - FX_INT32 temp = fromX; + int32_t temp = fromX; fromX = fromY; fromY = temp; temp = toX; toX = toY; toY = temp; } - FX_INT32 dx = FXSYS_abs(toX - fromX); - FX_INT32 dy = FXSYS_abs(toY - fromY); - FX_INT32 error = -dx >> 1; - FX_INT32 ystep = fromY < toY ? 1 : -1; - FX_INT32 xstep = fromX < toX ? 1 : -1; - FX_INT32 state = 0; - for (FX_INT32 x = fromX, y = fromY; x != toX; x += xstep) { - FX_INT32 realX = steep ? y : x; - FX_INT32 realY = steep ? x : y; + int32_t dx = FXSYS_abs(toX - fromX); + int32_t dy = FXSYS_abs(toY - fromY); + int32_t error = -dx >> 1; + int32_t ystep = fromY < toY ? 1 : -1; + int32_t xstep = fromX < toX ? 1 : -1; + int32_t state = 0; + for (int32_t x = fromX, y = fromY; x != toX; x += xstep) { + int32_t realX = steep ? y : x; + int32_t realY = steep ? x : y; if (state == 1) { if (m_image->Get(realX, realY)) { state++; @@ -226,8 +226,8 @@ FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRun(FX_INT32 fromX, FX_INT32 fromY } } if (state == 3) { - FX_INT32 diffX = x - fromX; - FX_INT32 diffY = y - fromY; + int32_t diffX = x - fromX; + int32_t diffY = y - fromY; return (FX_FLOAT) sqrt((double) (diffX * diffX + diffY * diffY)); } error += dy; @@ -236,22 +236,22 @@ FX_FLOAT CBC_QRDetector::SizeOfBlackWhiteBlackRun(FX_INT32 fromX, FX_INT32 fromY error -= dx; } } - FX_INT32 diffX = toX - fromX; - FX_INT32 diffY = toY - fromY; + int32_t diffX = toX - fromX; + int32_t diffY = toY - fromY; return (FX_FLOAT) sqrt((double) (diffX * diffX + diffY * diffY)); } -CBC_QRAlignmentPattern *CBC_QRDetector::FindAlignmentInRegion(FX_FLOAT overallEstModuleSize, FX_INT32 estAlignmentX, - FX_INT32 estAlignmentY, FX_FLOAT allowanceFactor, FX_INT32 &e) +CBC_QRAlignmentPattern *CBC_QRDetector::FindAlignmentInRegion(FX_FLOAT overallEstModuleSize, int32_t estAlignmentX, + int32_t estAlignmentY, FX_FLOAT allowanceFactor, int32_t &e) { - FX_INT32 allowance = (FX_INT32) (allowanceFactor * overallEstModuleSize); - FX_INT32 alignmentAreaLeftX = FX_MAX(0, estAlignmentX - allowance); - FX_INT32 alignmentAreaRightX = FX_MIN(m_image->GetWidth() - 1, estAlignmentX + allowance); + int32_t allowance = (int32_t) (allowanceFactor * overallEstModuleSize); + int32_t alignmentAreaLeftX = FX_MAX(0, estAlignmentX - allowance); + int32_t alignmentAreaRightX = FX_MIN(m_image->GetWidth() - 1, estAlignmentX + allowance); if (alignmentAreaRightX - alignmentAreaLeftX < overallEstModuleSize * 3) { e = BCExceptionRead; BC_EXCEPTION_CHECK_ReturnValue(e, NULL); } - FX_INT32 alignmentAreaTopY = FX_MAX(0, estAlignmentY - allowance); - FX_INT32 alignmentAreaBottomY = FX_MIN(m_image->GetHeight() - 1, estAlignmentY + allowance); + int32_t alignmentAreaTopY = FX_MAX(0, estAlignmentY - allowance); + int32_t alignmentAreaBottomY = FX_MIN(m_image->GetHeight() - 1, estAlignmentY + allowance); CBC_QRAlignmentPatternFinder alignmentFinder(m_image, alignmentAreaLeftX, alignmentAreaTopY, diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDetector.h b/xfa/src/fxbarcode/qrcode/BC_QRDetector.h index 60c301cb7b..298ccf4d4c 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDetector.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRDetector.h @@ -26,16 +26,16 @@ public: virtual ~CBC_QRDetector(); CBC_CommonBitMatrix* GetImage(); - CBC_QRDetectorResult* Detect(FX_INT32 hints, FX_INT32 &e); - CBC_QRDetectorResult* ProcessFinderPatternInfo(CBC_QRFinderPatternInfo *info, FX_INT32 &e); + CBC_QRDetectorResult* Detect(int32_t hints, int32_t &e); + CBC_QRDetectorResult* ProcessFinderPatternInfo(CBC_QRFinderPatternInfo *info, int32_t &e); FX_FLOAT CalculateModuleSize(CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, CBC_ResultPoint *bottomLeft); FX_FLOAT CalculateModuleSizeOneWay(CBC_ResultPoint *pattern, CBC_ResultPoint *otherPattern); - FX_FLOAT SizeOfBlackWhiteBlackRunBothWays(FX_INT32 fromX, FX_INT32 fromY, FX_INT32 toX, FX_INT32 toY); - FX_FLOAT SizeOfBlackWhiteBlackRun(FX_INT32 fromX, FX_INT32 fromY, FX_INT32 toX, FX_INT32 toY); - CBC_QRAlignmentPattern* FindAlignmentInRegion(FX_FLOAT overallEstModuleSize, FX_INT32 estAlignmentX, FX_INT32 estAlignmentY, FX_FLOAT allowanceFactor, FX_INT32 &e); - static FX_INT32 Round(FX_FLOAT d); - static FX_INT32 ComputeDimension(CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, CBC_ResultPoint *bottomLeft, FX_FLOAT moduleSize, FX_INT32 &e); + FX_FLOAT SizeOfBlackWhiteBlackRunBothWays(int32_t fromX, int32_t fromY, int32_t toX, int32_t toY); + FX_FLOAT SizeOfBlackWhiteBlackRun(int32_t fromX, int32_t fromY, int32_t toX, int32_t toY); + CBC_QRAlignmentPattern* FindAlignmentInRegion(FX_FLOAT overallEstModuleSize, int32_t estAlignmentX, int32_t estAlignmentY, FX_FLOAT allowanceFactor, int32_t &e); + static int32_t Round(FX_FLOAT d); + static int32_t ComputeDimension(CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, CBC_ResultPoint *bottomLeft, FX_FLOAT moduleSize, int32_t &e); static CBC_CommonBitMatrix* SampleGrid(CBC_CommonBitMatrix *image, CBC_ResultPoint *topLeft, CBC_ResultPoint *topRight, - CBC_ResultPoint *bottomLeft, CBC_ResultPoint* alignmentPattern, FX_INT32 dimension, FX_INT32 &e); + CBC_ResultPoint *bottomLeft, CBC_ResultPoint* alignmentPattern, int32_t dimension, int32_t &e); }; #endif diff --git a/xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp b/xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp index 369dc3a527..3734fab24d 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRDetectorResult.cpp @@ -30,7 +30,7 @@ CBC_QRDetectorResult::CBC_QRDetectorResult(CBC_CommonBitMatrix *bits, CFX_PtrArr } CBC_QRDetectorResult::~CBC_QRDetectorResult() { - for(FX_INT32 i = 0; i < m_points->GetSize(); i++) { + for(int32_t i = 0; i < m_points->GetSize(); i++) { delete (CBC_ResultPoint*) (*m_points)[i]; } m_points->RemoveAll(); diff --git a/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.cpp b/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.cpp index 8d1385e99a..dc08fc1e77 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.cpp @@ -45,7 +45,7 @@ FX_FLOAT CBC_QRFinderPattern::GetEstimatedModuleSize() { return m_estimatedModuleSize; } -FX_INT32 CBC_QRFinderPattern::GetCount() +int32_t CBC_QRFinderPattern::GetCount() { return m_count; } diff --git a/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.h b/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.h index af88a727d9..919b0c1534 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRFinderPattern.h @@ -12,12 +12,12 @@ class CBC_QRFinderPattern : public CBC_ResultPoint { private: FX_FLOAT m_estimatedModuleSize; - FX_INT32 m_count; + int32_t m_count; public: CBC_QRFinderPattern(FX_FLOAT x, FX_FLOAT posY, FX_FLOAT estimatedModuleSize); virtual ~CBC_QRFinderPattern(); - FX_INT32 GetCount(); + int32_t GetCount(); FX_FLOAT GetX(); FX_FLOAT GetY(); FX_FLOAT GetEstimatedModuleSize(); diff --git a/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp index da2d1231f8..975776db3f 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.cpp @@ -26,10 +26,10 @@ #include "BC_QRFinderPatternFinder.h" #include "BC_FinderPatternInfo.h" #include "BC_QRFinderPattern.h" -const FX_INT32 CBC_QRFinderPatternFinder::CENTER_QUORUM = 2; -const FX_INT32 CBC_QRFinderPatternFinder::MIN_SKIP = 3; -const FX_INT32 CBC_QRFinderPatternFinder::MAX_MODULES = 57; -const FX_INT32 CBC_QRFinderPatternFinder::INTEGER_MATH_SHIFT = 8; +const int32_t CBC_QRFinderPatternFinder::CENTER_QUORUM = 2; +const int32_t CBC_QRFinderPatternFinder::MIN_SKIP = 3; +const int32_t CBC_QRFinderPatternFinder::MAX_MODULES = 57; +const int32_t CBC_QRFinderPatternFinder::INTEGER_MATH_SHIFT = 8; CBC_QRFinderPatternFinder::CBC_QRFinderPatternFinder(CBC_CommonBitMatrix* image) { m_image = image; @@ -38,7 +38,7 @@ CBC_QRFinderPatternFinder::CBC_QRFinderPatternFinder(CBC_CommonBitMatrix* image) } CBC_QRFinderPatternFinder::~CBC_QRFinderPatternFinder() { - for(FX_INT32 i = 0; i < m_possibleCenters.GetSize(); i++) { + for(int32_t i = 0; i < m_possibleCenters.GetSize(); i++) { delete (CBC_QRFinderPattern*)m_possibleCenters[i]; } m_possibleCenters.RemoveAll(); @@ -51,7 +51,7 @@ public: ClosestToAverageComparator(FX_FLOAT averageModuleSize) : m_averageModuleSize(averageModuleSize) { } - FX_INT32 operator()(FinderPattern *a, FinderPattern *b) + int32_t operator()(FinderPattern *a, FinderPattern *b) { FX_FLOAT dA = (FX_FLOAT)fabs(a->GetEstimatedModuleSize() - m_averageModuleSize); FX_FLOAT dB = (FX_FLOAT)fabs(b->GetEstimatedModuleSize() - m_averageModuleSize); @@ -61,7 +61,7 @@ public: class CenterComparator { public: - FX_INT32 operator()(FinderPattern *a, FinderPattern *b) + int32_t operator()(FinderPattern *a, FinderPattern *b) { return b->GetCount() - a->GetCount(); } @@ -83,25 +83,25 @@ CFX_PtrArray *CBC_QRFinderPatternFinder::GetPossibleCenters() { return &m_possibleCenters; } -CBC_QRFinderPatternInfo* CBC_QRFinderPatternFinder::Find(FX_INT32 hint, FX_INT32 &e) +CBC_QRFinderPatternInfo* CBC_QRFinderPatternFinder::Find(int32_t hint, int32_t &e) { - FX_INT32 maxI = m_image->GetHeight(); - FX_INT32 maxJ = m_image->GetWidth(); - FX_INT32 iSkip = (3 * maxI) / (4 * MAX_MODULES); + int32_t maxI = m_image->GetHeight(); + int32_t maxJ = m_image->GetWidth(); + int32_t iSkip = (3 * maxI) / (4 * MAX_MODULES); if(iSkip < MIN_SKIP || 0) { iSkip = MIN_SKIP; } FX_BOOL done = FALSE; CFX_Int32Array stateCount; stateCount.SetSize(5); - for(FX_INT32 i = iSkip - 1; i < maxI && !done; i += iSkip) { + for(int32_t i = iSkip - 1; i < maxI && !done; i += iSkip) { stateCount[0] = 0; stateCount[1] = 0; stateCount[2] = 0; stateCount[3] = 0; stateCount[4] = 0; - FX_INT32 currentState = 0; - for(FX_INT32 j = 0; j < maxJ; j++) { + int32_t currentState = 0; + for(int32_t j = 0; j < maxJ; j++) { if(m_image->Get(j, i)) { if((currentState & 1) == 1) { currentState++; @@ -117,7 +117,7 @@ CBC_QRFinderPatternInfo* CBC_QRFinderPatternFinder::Find(FX_INT32 hint, FX_INT32 if(m_hasSkipped) { done = HaveMultiplyConfirmedCenters(); } else { - FX_INT32 rowSkip = FindRowSkip(); + int32_t rowSkip = FindRowSkip(); if(rowSkip > stateCount[2]) { i += rowSkip - stateCount[2] - iSkip; j = maxJ - 1; @@ -202,15 +202,15 @@ FX_FLOAT CBC_QRFinderPatternFinder::Distance(CBC_ResultPoint* point1, CBC_Result FX_FLOAT dy = point1->GetY() - point2->GetY(); return (FX_FLOAT)FXSYS_sqrt(dx * dx + dy * dy); } -FX_FLOAT CBC_QRFinderPatternFinder::CenterFromEnd(const CFX_Int32Array &stateCount, FX_INT32 end) +FX_FLOAT CBC_QRFinderPatternFinder::CenterFromEnd(const CFX_Int32Array &stateCount, int32_t end) { return (FX_FLOAT)(end - stateCount[4] - stateCount[3]) - stateCount[2] / 2.0f; } FX_BOOL CBC_QRFinderPatternFinder::FoundPatternCross(const CFX_Int32Array &stateCount) { - FX_INT32 totalModuleSize = 0; - for (FX_INT32 i = 0; i < 5; i++) { - FX_INT32 count = stateCount[i]; + int32_t totalModuleSize = 0; + for (int32_t i = 0; i < 5; i++) { + int32_t count = stateCount[i]; if (count == 0) { return FALSE; } @@ -219,21 +219,21 @@ FX_BOOL CBC_QRFinderPatternFinder::FoundPatternCross(const CFX_Int32Array &state if (totalModuleSize < 7) { return FALSE; } - FX_INT32 moduleSize = (totalModuleSize << INTEGER_MATH_SHIFT) / 7; - FX_INT32 maxVariance = moduleSize / 2; + int32_t moduleSize = (totalModuleSize << INTEGER_MATH_SHIFT) / 7; + int32_t maxVariance = moduleSize / 2; return FXSYS_abs(moduleSize - (stateCount[0] << INTEGER_MATH_SHIFT)) < maxVariance && FXSYS_abs(moduleSize - (stateCount[1] << INTEGER_MATH_SHIFT)) < maxVariance && FXSYS_abs(3 * moduleSize - (stateCount[2] << INTEGER_MATH_SHIFT)) < 3 * maxVariance && FXSYS_abs(moduleSize - (stateCount[3] << INTEGER_MATH_SHIFT)) < maxVariance && FXSYS_abs(moduleSize - (stateCount[4] << INTEGER_MATH_SHIFT)) < maxVariance; } -FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckVertical(FX_INT32 startI, FX_INT32 centerJ, FX_INT32 maxCount, - FX_INT32 originalStateCountTotal) +FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckVertical(int32_t startI, int32_t centerJ, int32_t maxCount, + int32_t originalStateCountTotal) { CBC_CommonBitMatrix *image = m_image; - FX_INT32 maxI = image->GetHeight(); + int32_t maxI = image->GetHeight(); CFX_Int32Array &stateCount = GetCrossCheckStateCount(); - FX_INT32 i = startI; + int32_t i = startI; while(i >= 0 && image->Get(centerJ, i)) { stateCount[2]++; i--; @@ -277,18 +277,18 @@ FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckVertical(FX_INT32 startI, FX_INT32 if (stateCount[4] >= maxCount) { return FXSYS_nan(); } - FX_INT32 stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4]; + int32_t stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4]; if (5 * FXSYS_abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal) { return FXSYS_nan(); } return FoundPatternCross(stateCount) ? CenterFromEnd(stateCount, i) : FXSYS_nan(); } -FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckHorizontal(FX_INT32 startJ, FX_INT32 centerI, FX_INT32 maxCount, FX_INT32 originalStateCountTotal) +FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckHorizontal(int32_t startJ, int32_t centerI, int32_t maxCount, int32_t originalStateCountTotal) { CBC_CommonBitMatrix *image = m_image; - FX_INT32 maxJ = image->GetWidth(); + int32_t maxJ = image->GetWidth(); CFX_Int32Array &stateCount = GetCrossCheckStateCount(); - FX_INT32 j = startJ; + int32_t j = startJ; while (j >= 0 && image->Get(j, centerI)) { stateCount[2]++; j--; @@ -332,7 +332,7 @@ FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckHorizontal(FX_INT32 startJ, FX_INT if (stateCount[4] >= maxCount) { return FXSYS_nan(); } - FX_INT32 stateCountTotal = stateCount[0] + stateCount[1] + + int32_t stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4]; if (5 * FXSYS_abs(stateCountTotal - originalStateCountTotal) >= originalStateCountTotal) { @@ -340,18 +340,18 @@ FX_FLOAT CBC_QRFinderPatternFinder::CrossCheckHorizontal(FX_INT32 startJ, FX_INT } return FoundPatternCross(stateCount) ? CenterFromEnd(stateCount, j) : FXSYS_nan(); } -FX_BOOL CBC_QRFinderPatternFinder::HandlePossibleCenter(const CFX_Int32Array &stateCount, FX_INT32 i, FX_INT32 j) +FX_BOOL CBC_QRFinderPatternFinder::HandlePossibleCenter(const CFX_Int32Array &stateCount, int32_t i, int32_t j) { - FX_INT32 stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4]; + int32_t stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4]; FX_FLOAT centerJ = CenterFromEnd(stateCount, j); - FX_FLOAT centerI = CrossCheckVertical(i, (FX_INT32) centerJ, stateCount[2], stateCountTotal); + FX_FLOAT centerI = CrossCheckVertical(i, (int32_t) centerJ, stateCount[2], stateCountTotal); if(!FXSYS_isnan(centerI)) { - centerJ = CrossCheckHorizontal((FX_INT32) centerJ, (FX_INT32) centerI, stateCount[2], stateCountTotal); + centerJ = CrossCheckHorizontal((int32_t) centerJ, (int32_t) centerI, stateCount[2], stateCountTotal); if(!FXSYS_isnan(centerJ)) { FX_FLOAT estimatedModuleSize = (FX_FLOAT) stateCountTotal / 7.0f; FX_BOOL found = FALSE; - FX_INT32 max = m_possibleCenters.GetSize(); - for(FX_INT32 index = 0; index < max; index++) { + int32_t max = m_possibleCenters.GetSize(); + for(int32_t index = 0; index < max; index++) { CBC_QRFinderPattern *center = (CBC_QRFinderPattern*)(m_possibleCenters[index]); if(center->AboutEquals(estimatedModuleSize, centerI, centerJ)) { center->IncrementCount(); @@ -367,21 +367,21 @@ FX_BOOL CBC_QRFinderPatternFinder::HandlePossibleCenter(const CFX_Int32Array &st } return FALSE; } -FX_INT32 CBC_QRFinderPatternFinder::FindRowSkip() +int32_t CBC_QRFinderPatternFinder::FindRowSkip() { - FX_INT32 max = m_possibleCenters.GetSize(); + int32_t max = m_possibleCenters.GetSize(); if (max <= 1) { return 0; } FinderPattern *firstConfirmedCenter = NULL; - for (FX_INT32 i = 0; i < max; i++) { + for (int32_t i = 0; i < max; i++) { CBC_QRFinderPattern *center = (CBC_QRFinderPattern*)m_possibleCenters[i]; if (center->GetCount() >= CENTER_QUORUM) { if (firstConfirmedCenter == NULL) { firstConfirmedCenter = center; } else { m_hasSkipped = TRUE; - return (FX_INT32) ((fabs(firstConfirmedCenter->GetX() - center->GetX()) - + return (int32_t) ((fabs(firstConfirmedCenter->GetX() - center->GetX()) - fabs(firstConfirmedCenter->GetY() - center->GetY())) / 2); } } @@ -390,10 +390,10 @@ FX_INT32 CBC_QRFinderPatternFinder::FindRowSkip() } FX_BOOL CBC_QRFinderPatternFinder::HaveMultiplyConfirmedCenters() { - FX_INT32 confirmedCount = 0; + int32_t confirmedCount = 0; FX_FLOAT totalModuleSize = 0.0f; - FX_INT32 max = m_possibleCenters.GetSize(); - FX_INT32 i; + int32_t max = m_possibleCenters.GetSize(); + int32_t i; for (i = 0; i < max; i++) { CBC_QRFinderPattern *pattern = (CBC_QRFinderPattern*)m_possibleCenters[i]; if (pattern->GetCount() >= CENTER_QUORUM) { @@ -416,9 +416,9 @@ inline FX_BOOL centerComparator(FX_LPVOID a, FX_LPVOID b) { return ((CBC_QRFinderPattern*)b)->GetCount() < ((CBC_QRFinderPattern*)a)->GetCount(); } -CFX_PtrArray *CBC_QRFinderPatternFinder::SelectBestpatterns(FX_INT32 &e) +CFX_PtrArray *CBC_QRFinderPatternFinder::SelectBestpatterns(int32_t &e) { - FX_INT32 startSize = m_possibleCenters.GetSize(); + int32_t startSize = m_possibleCenters.GetSize(); if(m_possibleCenters.GetSize() < 3) { e = BCExceptionRead; BC_EXCEPTION_CHECK_ReturnValue(e, NULL); @@ -426,11 +426,11 @@ CFX_PtrArray *CBC_QRFinderPatternFinder::SelectBestpatterns(FX_INT32 &e) FX_FLOAT average = 0.0f; if(startSize > 3) { FX_FLOAT totalModuleSize = 0.0f; - for(FX_INT32 i = 0; i < startSize; i++) { + for(int32_t i = 0; i < startSize; i++) { totalModuleSize += ((CBC_QRFinderPattern*)m_possibleCenters[i])->GetEstimatedModuleSize(); } average = totalModuleSize / (FX_FLOAT)startSize; - for(FX_INT32 j = 0; j < m_possibleCenters.GetSize() && m_possibleCenters.GetSize() > 3; j++) { + for(int32_t j = 0; j < m_possibleCenters.GetSize() && m_possibleCenters.GetSize() > 3; j++) { CBC_QRFinderPattern *pattern = (CBC_QRFinderPattern*)m_possibleCenters[j]; if(fabs(pattern->GetEstimatedModuleSize() - average) > 0.2f * average) { delete pattern; diff --git a/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h b/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h index d0fde46542..f24d22bed2 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRFinderPatternFinder.h @@ -14,10 +14,10 @@ class CBC_QRFinderPatternInfo; class CBC_QRFinderPatternFinder { private: - const static FX_INT32 CENTER_QUORUM; - const static FX_INT32 MIN_SKIP; - const static FX_INT32 MAX_MODULES; - const static FX_INT32 INTEGER_MATH_SHIFT; + const static int32_t CENTER_QUORUM; + const static int32_t MIN_SKIP; + const static int32_t MAX_MODULES; + const static int32_t INTEGER_MATH_SHIFT; FX_BOOL m_hasSkipped; CBC_CommonBitMatrix* m_image; CFX_Int32Array m_crossCheckStateCount; @@ -25,19 +25,19 @@ private: public: CBC_QRFinderPatternFinder(CBC_CommonBitMatrix *image); virtual ~CBC_QRFinderPatternFinder(); - FX_INT32 FindRowSkip(); + int32_t FindRowSkip(); CBC_CommonBitMatrix* GetImage(); - CBC_QRFinderPatternInfo* Find(FX_INT32 hint, FX_INT32 &e); + CBC_QRFinderPatternInfo* Find(int32_t hint, int32_t &e); CFX_Int32Array &GetCrossCheckStateCount(); CFX_PtrArray *GetPossibleCenters(); - CFX_PtrArray *SelectBestpatterns(FX_INT32 &e); + CFX_PtrArray *SelectBestpatterns(int32_t &e); - FX_BOOL HandlePossibleCenter(const CFX_Int32Array &stateCount, FX_INT32 i, FX_INT32 j); + FX_BOOL HandlePossibleCenter(const CFX_Int32Array &stateCount, int32_t i, int32_t j); FX_BOOL HaveMultiplyConfirmedCenters(); - FX_FLOAT CenterFromEnd(const CFX_Int32Array &stateCount, FX_INT32 end); - FX_FLOAT CrossCheckVertical(FX_INT32 startI, FX_INT32 centerJ, FX_INT32 maxCount, FX_INT32 originalStateCountTotal); - FX_FLOAT CrossCheckHorizontal(FX_INT32 startJ, FX_INT32 CenterI, FX_INT32 maxCOunt, FX_INT32 originalStateCountTotal); + FX_FLOAT CenterFromEnd(const CFX_Int32Array &stateCount, int32_t end); + FX_FLOAT CrossCheckVertical(int32_t startI, int32_t centerJ, int32_t maxCount, int32_t originalStateCountTotal); + FX_FLOAT CrossCheckHorizontal(int32_t startJ, int32_t CenterI, int32_t maxCOunt, int32_t originalStateCountTotal); static void OrderBestPatterns(CFX_PtrArray *patterns); static FX_BOOL FoundPatternCross(const CFX_Int32Array &stateCount); static FX_FLOAT Distance(CBC_ResultPoint* point1, CBC_ResultPoint* point2); diff --git a/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp b/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp index 8783078690..a5e478e1da 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.cpp @@ -35,15 +35,15 @@ CBC_QRGridSampler &CBC_QRGridSampler::GetInstance() { return m_gridSampler; } -void CBC_QRGridSampler::CheckAndNudgePoints(CBC_CommonBitMatrix *image, CFX_FloatArray *points, FX_INT32 &e) +void CBC_QRGridSampler::CheckAndNudgePoints(CBC_CommonBitMatrix *image, CFX_FloatArray *points, int32_t &e) { - FX_INT32 width = image->GetWidth(); - FX_INT32 height = image->GetHeight(); + int32_t width = image->GetWidth(); + int32_t height = image->GetHeight(); FX_BOOL nudged = TRUE; - FX_INT32 offset; + int32_t offset; for (offset = 0; offset < points->GetSize() && nudged; offset += 2) { - FX_INT32 x = (FX_INT32) (*points)[offset]; - FX_INT32 y = (FX_INT32) (*points)[offset + 1]; + int32_t x = (int32_t) (*points)[offset]; + int32_t y = (int32_t) (*points)[offset + 1]; if (x < -1 || x > width || y < -1 || y > height) { e = BCExceptionRead; BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -66,8 +66,8 @@ void CBC_QRGridSampler::CheckAndNudgePoints(CBC_CommonBitMatrix *image, CFX_Floa } nudged = TRUE; for (offset = (*points).GetSize() - 2; offset >= 0 && nudged; offset -= 2) { - FX_INT32 x = (FX_INT32) (*points)[offset]; - FX_INT32 y = (FX_INT32) (*points)[offset + 1]; + int32_t x = (int32_t) (*points)[offset]; + int32_t y = (int32_t) (*points)[offset + 1]; if (x < -1 || x > width || y < -1 || y > height) { e = BCExceptionRead; BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -89,7 +89,7 @@ void CBC_QRGridSampler::CheckAndNudgePoints(CBC_CommonBitMatrix *image, CFX_Floa } } } -CBC_CommonBitMatrix *CBC_QRGridSampler::SampleGrid(CBC_CommonBitMatrix *image, FX_INT32 dimensionX, FX_INT32 dimensionY, +CBC_CommonBitMatrix *CBC_QRGridSampler::SampleGrid(CBC_CommonBitMatrix *image, int32_t dimensionX, int32_t dimensionY, FX_FLOAT p1ToX, FX_FLOAT p1ToY, FX_FLOAT p2ToX, FX_FLOAT p2ToY, FX_FLOAT p3ToX, FX_FLOAT p3ToY, @@ -97,7 +97,7 @@ CBC_CommonBitMatrix *CBC_QRGridSampler::SampleGrid(CBC_CommonBitMatrix *image, F FX_FLOAT p1FromX, FX_FLOAT p1FromY, FX_FLOAT p2FromX, FX_FLOAT p2FromY, FX_FLOAT p3FromX, FX_FLOAT p3FromY, - FX_FLOAT p4FromX, FX_FLOAT p4FromY, FX_INT32 &e) + FX_FLOAT p4FromX, FX_FLOAT p4FromY, int32_t &e) { CBC_AutoPtr transform(CBC_CommonPerspectiveTransform::QuadrilateralToQuadrilateral( p1ToX, p1ToY, p2ToX, p2ToY, p3ToX, p3ToY, p4ToX, p4ToY, @@ -107,10 +107,10 @@ CBC_CommonBitMatrix *CBC_QRGridSampler::SampleGrid(CBC_CommonBitMatrix *image, F CBC_AutoPtr bits(tempBitM); CFX_FloatArray points; points.SetSize(dimensionX << 1); - for (FX_INT32 y = 0; y < dimensionY; y++) { - FX_INT32 max = points.GetSize(); + for (int32_t y = 0; y < dimensionY; y++) { + int32_t max = points.GetSize(); FX_FLOAT iValue = (FX_FLOAT) (y + 0.5f); - FX_INT32 x; + int32_t x; for (x = 0; x < max; x += 2) { points[x] = (FX_FLOAT) ((x >> 1) + 0.5f); points[x + 1] = iValue; @@ -119,7 +119,7 @@ CBC_CommonBitMatrix *CBC_QRGridSampler::SampleGrid(CBC_CommonBitMatrix *image, F CheckAndNudgePoints(image, &points, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); for (x = 0; x < max; x += 2) { - if (image->Get((FX_INT32) points[x], (FX_INT32) points[x + 1])) { + if (image->Get((int32_t) points[x], (int32_t) points[x + 1])) { bits->Set(x >> 1, y); } } diff --git a/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h b/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h index 0b8c7d3ab7..c7abf75f8d 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h +++ b/xfa/src/fxbarcode/qrcode/BC_QRGridSampler.h @@ -17,7 +17,7 @@ private: public: CBC_QRGridSampler(); virtual ~CBC_QRGridSampler(); - virtual CBC_CommonBitMatrix* SampleGrid(CBC_CommonBitMatrix *image, FX_INT32 dimensionX, FX_INT32 dimensionY, + virtual CBC_CommonBitMatrix* SampleGrid(CBC_CommonBitMatrix *image, int32_t dimensionX, int32_t dimensionY, FX_FLOAT p1ToX, FX_FLOAT p1ToY, FX_FLOAT p2ToX, FX_FLOAT p2ToY, FX_FLOAT p3ToX, FX_FLOAT p3ToY, @@ -25,9 +25,9 @@ public: FX_FLOAT p1FromX, FX_FLOAT p1FromY, FX_FLOAT p2FromX, FX_FLOAT p2FromY, FX_FLOAT p3FromX, FX_FLOAT p3FromY, - FX_FLOAT p4FromX, FX_FLOAT p4FromY, FX_INT32 &e); + FX_FLOAT p4FromX, FX_FLOAT p4FromY, int32_t &e); static CBC_QRGridSampler &GetInstance(); - static void CheckAndNudgePoints(CBC_CommonBitMatrix *image, CFX_FloatArray *points, FX_INT32 &e); + static void CheckAndNudgePoints(CBC_CommonBitMatrix *image, CFX_FloatArray *points, int32_t &e); }; #endif -- cgit v1.2.3