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 --- xfa/src/fxbarcode/pdf417/BC_PDF417.cpp | 66 ++++---- xfa/src/fxbarcode/pdf417/BC_PDF417.h | 28 ++-- .../fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp | 30 ++-- xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h | 24 +-- .../fxbarcode/pdf417/BC_PDF417BarcodeMetadata.cpp | 12 +- .../fxbarcode/pdf417/BC_PDF417BarcodeMetadata.h | 22 +-- xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp | 16 +- xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.h | 12 +- xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.cpp | 14 +- xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.h | 4 +- xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp | 26 +-- xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.h | 22 +-- xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.cpp | 20 +-- xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.h | 30 ++-- .../fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp | 44 +++--- .../fxbarcode/pdf417/BC_PDF417CodewordDecoder.h | 8 +- xfa/src/fxbarcode/pdf417/BC_PDF417Common.cpp | 40 ++--- xfa/src/fxbarcode/pdf417/BC_PDF417Common.h | 26 +-- .../pdf417/BC_PDF417DecodedBitStreamParser.cpp | 74 ++++----- .../pdf417/BC_PDF417DecodedBitStreamParser.h | 32 ++-- .../fxbarcode/pdf417/BC_PDF417DetectionResult.cpp | 70 ++++---- .../fxbarcode/pdf417/BC_PDF417DetectionResult.h | 28 ++-- .../pdf417/BC_PDF417DetectionResultColumn.cpp | 22 +-- .../pdf417/BC_PDF417DetectionResultColumn.h | 12 +- .../BC_PDF417DetectionResultRowIndicatorColumn.cpp | 58 +++---- .../BC_PDF417DetectionResultRowIndicatorColumn.h | 6 +- xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp | 114 ++++++------- xfa/src/fxbarcode/pdf417/BC_PDF417Detector.h | 38 ++--- .../fxbarcode/pdf417/BC_PDF417DetectorResult.cpp | 4 +- xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.cpp | 10 +- xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.h | 18 +-- .../pdf417/BC_PDF417ECErrorCorrection.cpp | 72 ++++----- .../fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h | 10 +- xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp | 26 +-- xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.h | 22 +-- .../fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp | 82 +++++----- xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.h | 22 +-- .../fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp | 24 +-- .../fxbarcode/pdf417/BC_PDF417ErrorCorrection.h | 8 +- .../fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp | 116 +++++++------- .../fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h | 40 ++--- xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp | 36 ++--- xfa/src/fxbarcode/pdf417/BC_PDF417Reader.h | 14 +- .../fxbarcode/pdf417/BC_PDF417ResultMetadata.cpp | 4 +- xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.h | 6 +- .../fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp | 176 ++++++++++----------- .../fxbarcode/pdf417/BC_PDF417ScanningDecoder.h | 52 +++--- xfa/src/fxbarcode/pdf417/BC_PDF417Writer.cpp | 40 ++--- xfa/src/fxbarcode/pdf417/BC_PDF417Writer.h | 10 +- 49 files changed, 845 insertions(+), 845 deletions(-) (limited to 'xfa/src/fxbarcode/pdf417') diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417.cpp index 96d3a3b655..366b172863 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417.cpp @@ -27,9 +27,9 @@ #include "BC_PDF417ErrorCorrection.h" #include "BC_PDF417HighLevelEncoder.h" #include "BC_PDF417.h" -FX_INT32 CBC_PDF417::START_PATTERN = 0x1fea8; -FX_INT32 CBC_PDF417::STOP_PATTERN = 0x3fa29; -FX_INT32 CBC_PDF417::CODEWORD_TABLE[][1000] = { +int32_t CBC_PDF417::START_PATTERN = 0x1fea8; +int32_t CBC_PDF417::STOP_PATTERN = 0x3fa29; +int32_t CBC_PDF417::CODEWORD_TABLE[][1000] = { { 0x1d5c0, 0x1eaf0, 0x1f57c, 0x1d4e0, 0x1ea78, 0x1f53e, 0x1a8c0, 0x1d470, 0x1a860, 0x15040, 0x1a830, 0x15020, @@ -535,28 +535,28 @@ CBC_BarcodeMatrix* CBC_PDF417::getBarcodeMatrix() { return m_barcodeMatrix; } -void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, FX_INT32 errorCorrectionLevel, FX_INT32 &e) +void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, int32_t errorCorrectionLevel, int32_t &e) { - FX_INT32 errorCorrectionCodeWords = CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(errorCorrectionLevel, e); + int32_t errorCorrectionCodeWords = CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(errorCorrectionLevel, e); BC_EXCEPTION_CHECK_ReturnVoid(e); CFX_WideString highLevel = CBC_PDF417HighLevelEncoder::encodeHighLevel(msg, m_compaction, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 sourceCodeWords = highLevel.GetLength(); + int32_t sourceCodeWords = highLevel.GetLength(); CFX_Int32Array* dimension = determineDimensions(sourceCodeWords, errorCorrectionCodeWords, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - FX_INT32 cols = dimension->GetAt(0); - FX_INT32 rows = dimension->GetAt(1); + int32_t cols = dimension->GetAt(0); + int32_t rows = dimension->GetAt(1); delete dimension; - FX_INT32 pad = getNumberOfPadCodewords(sourceCodeWords, errorCorrectionCodeWords, cols, rows); + int32_t pad = getNumberOfPadCodewords(sourceCodeWords, errorCorrectionCodeWords, cols, rows); if (sourceCodeWords + errorCorrectionCodeWords + 1 > 929) { e = BCExceptionEncodedMessageContainsTooManyCodeWords; return; } - FX_INT32 n = sourceCodeWords + pad + 1; + int32_t n = sourceCodeWords + pad + 1; CFX_WideString sb; sb += (FX_WCHAR) n; sb += highLevel; - for (FX_INT32 i = 0; i < pad; i++) { + for (int32_t i = 0; i < pad; i++) { sb += (FX_WCHAR) 900; } CFX_WideString dataCodewords(sb); @@ -566,7 +566,7 @@ void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, FX_INT32 errorCorrecti m_barcodeMatrix = FX_NEW CBC_BarcodeMatrix(rows, cols); encodeLowLevel(fullCodewords, cols, rows, errorCorrectionLevel, m_barcodeMatrix); } -void CBC_PDF417::setDimensions(FX_INT32 maxCols, FX_INT32 minCols, FX_INT32 maxRows, FX_INT32 minRows) +void CBC_PDF417::setDimensions(int32_t maxCols, int32_t minCols, int32_t maxRows, int32_t minRows) { m_maxCols = maxCols; m_minCols = minCols; @@ -581,25 +581,25 @@ void CBC_PDF417::setCompact(FX_BOOL compact) { m_compact = compact; } -FX_INT32 CBC_PDF417::calculateNumberOfRows(FX_INT32 m, FX_INT32 k, FX_INT32 c) +int32_t CBC_PDF417::calculateNumberOfRows(int32_t m, int32_t k, int32_t c) { - FX_INT32 r = ((m + 1 + k) / c) + 1; + int32_t r = ((m + 1 + k) / c) + 1; if (c * r >= (m + 1 + k + c)) { r--; } return r; } -FX_INT32 CBC_PDF417::getNumberOfPadCodewords(FX_INT32 m, FX_INT32 k, FX_INT32 c, FX_INT32 r) +int32_t CBC_PDF417::getNumberOfPadCodewords(int32_t m, int32_t k, int32_t c, int32_t r) { - FX_INT32 n = c * r - k; + int32_t n = c * r - k; return n > m + 1 ? n - m - 1 : 0; } -void CBC_PDF417::encodeChar(FX_INT32 pattern, FX_INT32 len, CBC_BarcodeRow* logic) +void CBC_PDF417::encodeChar(int32_t pattern, int32_t len, CBC_BarcodeRow* logic) { - FX_INT32 map = 1 << (len - 1); + int32_t map = 1 << (len - 1); FX_BOOL last = ((pattern & map) != 0); - FX_INT32 width = 0; - for (FX_INT32 i = 0; i < len; i++) { + int32_t width = 0; + for (int32_t i = 0; i < len; i++) { FX_BOOL black = ((pattern & map) != 0); if (last == black) { width++; @@ -612,16 +612,16 @@ void CBC_PDF417::encodeChar(FX_INT32 pattern, FX_INT32 len, CBC_BarcodeRow* logi } logic->addBar(last, width); } -void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords, FX_INT32 c, FX_INT32 r, FX_INT32 errorCorrectionLevel, CBC_BarcodeMatrix* logic) +void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords, int32_t c, int32_t r, int32_t errorCorrectionLevel, CBC_BarcodeMatrix* logic) { - FX_INT32 idx = 0; - for (FX_INT32 y = 0; y < r; y++) { - FX_INT32 cluster = y % 3; + int32_t idx = 0; + for (int32_t y = 0; y < r; y++) { + int32_t cluster = y % 3; logic->startRow(); - FX_INT32 a = START_PATTERN; + int32_t a = START_PATTERN; encodeChar(START_PATTERN, 17, logic->getCurrentRow()); - FX_INT32 left; - FX_INT32 right; + int32_t left; + int32_t right; if (cluster == 0) { left = (30 * (y / 3)) + ((r - 1) / 3); right = (30 * (y / 3)) + (c - 1); @@ -632,9 +632,9 @@ void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords, FX_INT32 c, FX_INT left = (30 * (y / 3)) + (c - 1); right = (30 * (y / 3)) + (errorCorrectionLevel * 3) + ((r - 1) % 3); } - FX_INT32 pattern = CODEWORD_TABLE[cluster][left]; + int32_t pattern = CODEWORD_TABLE[cluster][left]; encodeChar(pattern, 17, logic->getCurrentRow()); - for (FX_INT32 x = 0; x < c; x++) { + for (int32_t x = 0; x < c; x++) { pattern = CODEWORD_TABLE[cluster][fullCodewords.GetAt(idx)]; encodeChar(pattern, 17, logic->getCurrentRow()); idx++; @@ -648,12 +648,12 @@ void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords, FX_INT32 c, FX_INT } } } -CFX_Int32Array* CBC_PDF417::determineDimensions(FX_INT32 sourceCodeWords, FX_INT32 errorCorrectionCodeWords, FX_INT32 &e) +CFX_Int32Array* CBC_PDF417::determineDimensions(int32_t sourceCodeWords, int32_t errorCorrectionCodeWords, int32_t &e) { FX_FLOAT ratio = 0.0f; CFX_Int32Array* dimension = NULL; - for (FX_INT32 cols = m_minCols; cols <= m_maxCols; cols++) { - FX_INT32 rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols); + for (int32_t cols = m_minCols; cols <= m_maxCols; cols++) { + int32_t rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols); if (rows < m_minRows) { break; } @@ -673,7 +673,7 @@ CFX_Int32Array* CBC_PDF417::determineDimensions(FX_INT32 sourceCodeWords, FX_INT dimension->Add(rows); } if (dimension == NULL) { - FX_INT32 rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, m_minCols); + int32_t rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, m_minCols); if (rows < m_minRows) { dimension = FX_NEW CFX_Int32Array; dimension->Add(m_minCols); diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417.h b/xfa/src/fxbarcode/pdf417/BC_PDF417.h index 928afe80d2..21d902ef7a 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417.h @@ -16,29 +16,29 @@ public: CBC_PDF417(FX_BOOL compact); virtual ~CBC_PDF417(); CBC_BarcodeMatrix* getBarcodeMatrix(); - void generateBarcodeLogic(CFX_WideString msg, FX_INT32 errorCorrectionLevel, FX_INT32 &e); - void setDimensions(FX_INT32 maxCols, FX_INT32 minCols, FX_INT32 maxRows, FX_INT32 minRows); + void generateBarcodeLogic(CFX_WideString msg, int32_t errorCorrectionLevel, int32_t &e); + void setDimensions(int32_t maxCols, int32_t minCols, int32_t maxRows, int32_t minRows); void setCompaction(Compaction compaction); void setCompact(FX_BOOL compact); private: - static FX_INT32 START_PATTERN; - static FX_INT32 STOP_PATTERN; - static FX_INT32 CODEWORD_TABLE[][1000]; + static int32_t START_PATTERN; + static int32_t STOP_PATTERN; + static int32_t CODEWORD_TABLE[][1000]; static FX_FLOAT PREFERRED_RATIO; static FX_FLOAT DEFAULT_MODULE_WIDTH; static FX_FLOAT HEIGHT; CBC_BarcodeMatrix* m_barcodeMatrix; FX_BOOL m_compact; Compaction m_compaction; - FX_INT32 m_minCols; - FX_INT32 m_maxCols; - FX_INT32 m_maxRows; - FX_INT32 m_minRows; + int32_t m_minCols; + int32_t m_maxCols; + int32_t m_maxRows; + int32_t m_minRows; private: - static FX_INT32 calculateNumberOfRows(FX_INT32 m, FX_INT32 k, FX_INT32 c); - static FX_INT32 getNumberOfPadCodewords(FX_INT32 m, FX_INT32 k, FX_INT32 c, FX_INT32 r); - static void encodeChar(FX_INT32 pattern, FX_INT32 len, CBC_BarcodeRow* logic); - void encodeLowLevel(CFX_WideString fullCodewords, FX_INT32 c, FX_INT32 r, FX_INT32 errorCorrectionLevel, CBC_BarcodeMatrix* logic); - CFX_Int32Array* determineDimensions(FX_INT32 sourceCodeWords, FX_INT32 errorCorrectionCodeWords, FX_INT32 &e); + static int32_t calculateNumberOfRows(int32_t m, int32_t k, int32_t c); + static int32_t getNumberOfPadCodewords(int32_t m, int32_t k, int32_t c, int32_t r); + static void encodeChar(int32_t pattern, int32_t len, CBC_BarcodeRow* logic); + void encodeLowLevel(CFX_WideString fullCodewords, int32_t c, int32_t r, int32_t errorCorrectionLevel, CBC_BarcodeMatrix* logic); + CFX_Int32Array* determineDimensions(int32_t sourceCodeWords, int32_t errorCorrectionCodeWords, int32_t &e); }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp index e45562ba79..aa30e25d49 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp @@ -23,10 +23,10 @@ #include "../barcode.h" #include "BC_PDF417BarcodeRow.h" #include "BC_PDF417BarcodeMatrix.h" -CBC_BarcodeMatrix::CBC_BarcodeMatrix(FX_INT32 height, FX_INT32 width) +CBC_BarcodeMatrix::CBC_BarcodeMatrix(int32_t height, int32_t width) { m_matrix.SetSize(height + 2); - for (FX_INT32 i = 0, matrixLength = m_matrix.GetSize(); i < matrixLength; i++) { + for (int32_t i = 0, matrixLength = m_matrix.GetSize(); i < matrixLength; i++) { m_matrix[i] = FX_NEW CBC_BarcodeRow((width + 4) * 17 + 1); } m_width = width * 17; @@ -37,19 +37,19 @@ CBC_BarcodeMatrix::CBC_BarcodeMatrix(FX_INT32 height, FX_INT32 width) } CBC_BarcodeMatrix::~CBC_BarcodeMatrix() { - for (FX_INT32 i = 0; i < m_matrix.GetSize(); i++) { + for (int32_t i = 0; i < m_matrix.GetSize(); i++) { delete (CBC_BarcodeRow*)m_matrix.GetAt(i); } m_matrix.RemoveAll(); m_matrixOut.RemoveAll(); } -void CBC_BarcodeMatrix::set(FX_INT32 x, FX_INT32 y, FX_BYTE value) +void CBC_BarcodeMatrix::set(int32_t x, int32_t y, uint8_t value) { ((CBC_BarcodeRow*)m_matrix[y])->set(x, value); } -void CBC_BarcodeMatrix::setMatrix(FX_INT32 x, FX_INT32 y, FX_BOOL black) +void CBC_BarcodeMatrix::setMatrix(int32_t x, int32_t y, FX_BOOL black) { - set(x, y, (FX_BYTE) (black ? 1 : 0)); + set(x, y, (uint8_t) (black ? 1 : 0)); } void CBC_BarcodeMatrix::startRow() { @@ -59,11 +59,11 @@ CBC_BarcodeRow* CBC_BarcodeMatrix::getCurrentRow() { return (CBC_BarcodeRow*)m_matrix[m_currentRow]; } -FX_INT32 CBC_BarcodeMatrix::getWidth() +int32_t CBC_BarcodeMatrix::getWidth() { return m_outWidth; } -FX_INT32 CBC_BarcodeMatrix::getHeight() +int32_t CBC_BarcodeMatrix::getHeight() { return m_outHeight; } @@ -71,26 +71,26 @@ CFX_ByteArray& CBC_BarcodeMatrix::getMatrix() { return getScaledMatrix(1, 1); } -CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(FX_INT32 scale) +CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(int32_t scale) { return getScaledMatrix(scale, scale); } -CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(FX_INT32 xScale, FX_INT32 yScale) +CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(int32_t xScale, int32_t yScale) { - FX_INT32 yMax = m_height * yScale; + int32_t yMax = m_height * yScale; CFX_ByteArray bytearray; bytearray.Copy(((CBC_BarcodeRow*)m_matrix[0])->getScaledRow(xScale)); - FX_INT32 xMax = bytearray.GetSize(); + int32_t xMax = bytearray.GetSize(); m_matrixOut.SetSize(xMax * yMax); m_outWidth = xMax; m_outHeight = yMax; - FX_INT32 k = 0; - for (FX_INT32 i = 0; i < yMax; i++) { + int32_t k = 0; + for (int32_t i = 0; i < yMax; i++) { if (i != 0) { bytearray.Copy(((CBC_BarcodeRow*)m_matrix[i / yScale])->getScaledRow(xScale)); } k = i * xMax; - for (FX_INT32 l = 0; l < xMax; l++) { + for (int32_t l = 0; l < xMax; l++) { m_matrixOut[k + l] = bytearray.GetAt(l); } } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h index ce0681bfa8..f5f035dbca 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h @@ -11,24 +11,24 @@ class CBC_BarcodeMatrix { public: CBC_BarcodeMatrix(); - CBC_BarcodeMatrix(FX_INT32 height, FX_INT32 width); + CBC_BarcodeMatrix(int32_t height, int32_t width); virtual ~CBC_BarcodeMatrix(); - void set(FX_INT32 x, FX_INT32 y, FX_BYTE value); - void setMatrix(FX_INT32 x, FX_INT32 y, FX_BOOL black); + void set(int32_t x, int32_t y, uint8_t value); + void setMatrix(int32_t x, int32_t y, FX_BOOL black); void startRow(); CBC_BarcodeRow* getCurrentRow(); CFX_ByteArray& getMatrix(); - CFX_ByteArray& getScaledMatrix(FX_INT32 scale); - CFX_ByteArray& getScaledMatrix(FX_INT32 xScale, FX_INT32 yScale); - FX_INT32 getWidth(); - FX_INT32 getHeight(); + CFX_ByteArray& getScaledMatrix(int32_t scale); + CFX_ByteArray& getScaledMatrix(int32_t xScale, int32_t yScale); + int32_t getWidth(); + int32_t getHeight(); private: CFX_PtrArray m_matrix; CFX_ByteArray m_matrixOut; - FX_INT32 m_currentRow; - FX_INT32 m_height; - FX_INT32 m_width; - FX_INT32 m_outWidth; - FX_INT32 m_outHeight; + int32_t m_currentRow; + int32_t m_height; + int32_t m_width; + int32_t m_outWidth; + int32_t m_outHeight; }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.cpp index 456c0e6f2e..fc3f255ec0 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.cpp @@ -22,7 +22,7 @@ #include "../barcode.h" #include "BC_PDF417BarcodeMetadata.h" -CBC_BarcodeMetadata::CBC_BarcodeMetadata(FX_INT32 columnCount, FX_INT32 rowCountUpperPart, FX_INT32 rowCountLowerPart, FX_INT32 errorCorrectionLevel) +CBC_BarcodeMetadata::CBC_BarcodeMetadata(int32_t columnCount, int32_t rowCountUpperPart, int32_t rowCountLowerPart, int32_t errorCorrectionLevel) { m_columnCount = columnCount; m_rowCountUpperPart = rowCountUpperPart; @@ -33,23 +33,23 @@ CBC_BarcodeMetadata::CBC_BarcodeMetadata(FX_INT32 columnCount, FX_INT32 rowCount CBC_BarcodeMetadata::~CBC_BarcodeMetadata() { } -FX_INT32 CBC_BarcodeMetadata::getColumnCount() +int32_t CBC_BarcodeMetadata::getColumnCount() { return m_columnCount; } -FX_INT32 CBC_BarcodeMetadata::getErrorCorrectionLevel() +int32_t CBC_BarcodeMetadata::getErrorCorrectionLevel() { return m_errorCorrectionLevel; } -FX_INT32 CBC_BarcodeMetadata::getRowCount() +int32_t CBC_BarcodeMetadata::getRowCount() { return m_rowCount; } -FX_INT32 CBC_BarcodeMetadata::getRowCountUpperPart() +int32_t CBC_BarcodeMetadata::getRowCountUpperPart() { return m_rowCountUpperPart; } -FX_INT32 CBC_BarcodeMetadata::getRowCountLowerPart() +int32_t CBC_BarcodeMetadata::getRowCountLowerPart() { return m_rowCountLowerPart; } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.h b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.h index 6e2aa4d952..f25e37c1b4 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.h @@ -10,18 +10,18 @@ class CBC_BarcodeMetadata; class CBC_BarcodeMetadata { public: - CBC_BarcodeMetadata(FX_INT32 columnCount, FX_INT32 rowCountUpperPart, FX_INT32 rowCountLowerPart, FX_INT32 errorCorrectionLevel); + CBC_BarcodeMetadata(int32_t columnCount, int32_t rowCountUpperPart, int32_t rowCountLowerPart, int32_t errorCorrectionLevel); virtual ~CBC_BarcodeMetadata(); - FX_INT32 getColumnCount(); - FX_INT32 getErrorCorrectionLevel(); - FX_INT32 getRowCount(); - FX_INT32 getRowCountUpperPart(); - FX_INT32 getRowCountLowerPart(); + int32_t getColumnCount(); + int32_t getErrorCorrectionLevel(); + int32_t getRowCount(); + int32_t getRowCountUpperPart(); + int32_t getRowCountLowerPart(); private: - FX_INT32 m_columnCount; - FX_INT32 m_errorCorrectionLevel; - FX_INT32 m_rowCountUpperPart; - FX_INT32 m_rowCountLowerPart; - FX_INT32 m_rowCount; + int32_t m_columnCount; + int32_t m_errorCorrectionLevel; + int32_t m_rowCountUpperPart; + int32_t m_rowCountLowerPart; + int32_t m_rowCount; }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp index 02bc0f5574..8918d32600 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp @@ -22,7 +22,7 @@ #include "../barcode.h" #include "BC_PDF417BarcodeRow.h" -CBC_BarcodeRow::CBC_BarcodeRow(FX_INT32 width) +CBC_BarcodeRow::CBC_BarcodeRow(int32_t width) { m_row.SetSize(width); m_currentLocation = 0; @@ -32,17 +32,17 @@ CBC_BarcodeRow::~CBC_BarcodeRow() m_output.RemoveAll(); m_row.RemoveAll(); } -void CBC_BarcodeRow::set(FX_INT32 x, FX_BYTE value) +void CBC_BarcodeRow::set(int32_t x, uint8_t value) { m_row.SetAt(x, value); } -void CBC_BarcodeRow::set(FX_INT32 x, FX_BOOL black) +void CBC_BarcodeRow::set(int32_t x, FX_BOOL black) { - m_row.SetAt(x, (FX_BYTE) (black ? 1 : 0)); + m_row.SetAt(x, (uint8_t) (black ? 1 : 0)); } -void CBC_BarcodeRow::addBar(FX_BOOL black, FX_INT32 width) +void CBC_BarcodeRow::addBar(FX_BOOL black, int32_t width) { - for (FX_INT32 ii = 0; ii < width; ii++) { + for (int32_t ii = 0; ii < width; ii++) { set(m_currentLocation++, black); } } @@ -50,10 +50,10 @@ CFX_ByteArray& CBC_BarcodeRow::getRow() { return m_row; } -CFX_ByteArray& CBC_BarcodeRow::getScaledRow(FX_INT32 scale) +CFX_ByteArray& CBC_BarcodeRow::getScaledRow(int32_t scale) { m_output.SetSize(m_row.GetSize() * scale); - for (FX_INT32 i = 0; i < m_output.GetSize(); i++) { + for (int32_t i = 0; i < m_output.GetSize(); i++) { m_output[i] = (m_row[i / scale]); } return m_output; diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.h b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.h index c5520f6440..0fd1003477 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeRow.h @@ -9,16 +9,16 @@ class CBC_BarcodeRow { public: - CBC_BarcodeRow(FX_INT32 width); + CBC_BarcodeRow(int32_t width); virtual ~CBC_BarcodeRow(); - void set(FX_INT32 x, FX_BYTE value); - void set(FX_INT32 x, FX_BOOL black); - void addBar(FX_BOOL black, FX_INT32 width); + void set(int32_t x, uint8_t value); + void set(int32_t x, FX_BOOL black); + void addBar(FX_BOOL black, int32_t width); CFX_ByteArray& getRow(); - CFX_ByteArray& getScaledRow(FX_INT32 scale); + CFX_ByteArray& getScaledRow(int32_t scale); private: CFX_ByteArray m_row; CFX_ByteArray m_output; - FX_INT32 m_currentLocation; + int32_t m_currentLocation; }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.cpp index 446ef58a48..90fbea9897 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.cpp @@ -29,10 +29,10 @@ CBC_BarcodeValue::CBC_BarcodeValue() CBC_BarcodeValue::~CBC_BarcodeValue() { } -void CBC_BarcodeValue::setValue(FX_INT32 value) +void CBC_BarcodeValue::setValue(int32_t value) { - FX_INT32 confidence = 0; - for (FX_INT32 i = 0; i < m_keys.GetSize(); i++) { + int32_t confidence = 0; + for (int32_t i = 0; i < m_keys.GetSize(); i++) { if (m_keys.GetAt(i) == value) { confidence = m_values.GetAt(i); m_values.SetAt(i, confidence + 1); @@ -45,9 +45,9 @@ void CBC_BarcodeValue::setValue(FX_INT32 value) } CFX_Int32Array* CBC_BarcodeValue::getValue() { - FX_INT32 maxConfidence = -1; + int32_t maxConfidence = -1; CFX_Int32Array* result = FX_NEW CFX_Int32Array; - for (FX_INT32 i = 0; i < m_keys.GetSize(); i++) { + for (int32_t i = 0; i < m_keys.GetSize(); i++) { if (m_values.GetAt(i) > maxConfidence) { maxConfidence = m_values.GetAt(i); result->RemoveAll(); @@ -58,9 +58,9 @@ CFX_Int32Array* CBC_BarcodeValue::getValue() } return result; } -FX_INT32 CBC_BarcodeValue::getConfidence(FX_INT32 value) +int32_t CBC_BarcodeValue::getConfidence(int32_t value) { - for (FX_INT32 i = 0; i < m_keys.GetSize(); i++) + for (int32_t i = 0; i < m_keys.GetSize(); i++) if (m_keys.GetAt(i) == value) { return m_values.GetAt(i); } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.h b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.h index 6922d410f0..7729e04a14 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BarcodeValue.h @@ -11,9 +11,9 @@ class CBC_BarcodeValue public: CBC_BarcodeValue(); virtual ~CBC_BarcodeValue(); - void setValue(FX_INT32 value); + void setValue(int32_t value); CFX_Int32Array* getValue(); - FX_INT32 getConfidence(FX_INT32 value); + int32_t getConfidence(int32_t value); private: CFX_Int32Array m_keys; CFX_Int32Array m_values; diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp index 55f4cb4510..fec4abcafa 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.cpp @@ -24,7 +24,7 @@ #include "../BC_ResultPoint.h" #include "../common/BC_CommonBitMatrix.h" #include "BC_PDF417BoundingBox.h" -CBC_BoundingBox::CBC_BoundingBox(CBC_CommonBitMatrix* image, CBC_ResultPoint* topLeft, CBC_ResultPoint* bottomLeft, CBC_ResultPoint* topRight, CBC_ResultPoint* bottomRight, FX_INT32 &e) +CBC_BoundingBox::CBC_BoundingBox(CBC_CommonBitMatrix* image, CBC_ResultPoint* topLeft, CBC_ResultPoint* bottomLeft, CBC_ResultPoint* topRight, CBC_ResultPoint* bottomRight, int32_t &e) { if ((topLeft == NULL && topRight == NULL) || (bottomLeft == NULL && bottomRight == NULL) || @@ -53,7 +53,7 @@ CBC_BoundingBox::~CBC_BoundingBox() delete m_bottomRight; } } -CBC_BoundingBox* CBC_BoundingBox::merge(CBC_BoundingBox* leftBox, CBC_BoundingBox* rightBox, FX_INT32 &e) +CBC_BoundingBox* CBC_BoundingBox::merge(CBC_BoundingBox* leftBox, CBC_BoundingBox* rightBox, int32_t &e) { CBC_BoundingBox* boundingBox = NULL; if (leftBox == NULL) { @@ -68,7 +68,7 @@ CBC_BoundingBox* CBC_BoundingBox::merge(CBC_BoundingBox* leftBox, CBC_BoundingBo BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return boundingBox; } -CBC_BoundingBox* CBC_BoundingBox::addMissingRows(FX_INT32 missingStartRows, FX_INT32 missingEndRows, FX_BOOL isLeft, FX_INT32 &e) +CBC_BoundingBox* CBC_BoundingBox::addMissingRows(int32_t missingStartRows, int32_t missingEndRows, FX_BOOL isLeft, int32_t &e) { CBC_ResultPoint* newTopLeft = m_topLeft; CBC_ResultPoint* newBottomLeft = m_bottomLeft; @@ -78,7 +78,7 @@ CBC_BoundingBox* CBC_BoundingBox::addMissingRows(FX_INT32 missingStartRows, FX_I CBC_ResultPoint* newBottom = NULL; if (missingStartRows > 0) { CBC_ResultPoint* top = isLeft ? m_topLeft : m_topRight; - FX_INT32 newMinY = (FX_INT32) top->GetY() - missingStartRows; + int32_t newMinY = (int32_t) top->GetY() - missingStartRows; if (newMinY < 0) { newMinY = 0; } @@ -91,7 +91,7 @@ CBC_BoundingBox* CBC_BoundingBox::addMissingRows(FX_INT32 missingStartRows, FX_I } if (missingEndRows > 0) { CBC_ResultPoint* bottom = isLeft ? m_bottomLeft : m_bottomRight; - FX_INT32 newMaxY = (FX_INT32) bottom->GetY() + missingEndRows; + int32_t newMaxY = (int32_t) bottom->GetY() + missingEndRows; if (newMaxY >= m_image->GetHeight()) { newMaxY = m_image->GetHeight() - 1; } @@ -125,19 +125,19 @@ void CBC_BoundingBox::setBottomRight(CBC_ResultPoint bottomRight) m_bottomRight = FX_NEW CBC_ResultPoint(bottomRight.GetX(), bottomRight.GetY()); calculateMinMaxValues(); } -FX_INT32 CBC_BoundingBox::getMinX() +int32_t CBC_BoundingBox::getMinX() { return m_minX; } -FX_INT32 CBC_BoundingBox::getMaxX() +int32_t CBC_BoundingBox::getMaxX() { return m_maxX; } -FX_INT32 CBC_BoundingBox::getMinY() +int32_t CBC_BoundingBox::getMinY() { return m_minY; } -FX_INT32 CBC_BoundingBox::getMaxY() +int32_t CBC_BoundingBox::getMaxY() { return m_maxY; } @@ -187,8 +187,8 @@ void CBC_BoundingBox::calculateMinMaxValues() m_topRight = FX_NEW CBC_ResultPoint((FX_FLOAT)m_image->GetWidth() - 1, (FX_FLOAT)m_topLeft->GetY()); m_bottomRight = FX_NEW CBC_ResultPoint((FX_FLOAT)m_image->GetWidth() - 1, (FX_FLOAT)m_bottomLeft->GetY()); } - m_minX = (FX_INT32) (m_topLeft->GetX() < m_bottomLeft->GetX() ? m_topLeft->GetX() : m_bottomLeft->GetX()); - m_maxX = (FX_INT32) (m_topRight->GetX() > m_bottomRight->GetX() ? m_topRight->GetX() : m_bottomRight->GetX()); - m_minY = (FX_INT32) (m_topLeft->GetY() < m_topRight->GetY() ? m_topLeft->GetY() : m_topRight->GetY()); - m_maxY = (FX_INT32) (m_bottomLeft->GetY() > m_bottomRight->GetY() ? m_bottomLeft->GetY() : m_bottomRight->GetY()); + m_minX = (int32_t) (m_topLeft->GetX() < m_bottomLeft->GetX() ? m_topLeft->GetX() : m_bottomLeft->GetX()); + m_maxX = (int32_t) (m_topRight->GetX() > m_bottomRight->GetX() ? m_topRight->GetX() : m_bottomRight->GetX()); + m_minY = (int32_t) (m_topLeft->GetY() < m_topRight->GetY() ? m_topLeft->GetY() : m_topRight->GetY()); + m_maxY = (int32_t) (m_bottomLeft->GetY() > m_bottomRight->GetY() ? m_bottomLeft->GetY() : m_bottomRight->GetY()); } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.h b/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.h index 26bd1881c3..97d8406fd4 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417BoundingBox.h @@ -11,17 +11,17 @@ class CBC_ResultPoint; class CBC_BoundingBox { public: - CBC_BoundingBox(CBC_CommonBitMatrix* image, CBC_ResultPoint* topLeft, CBC_ResultPoint* bottomLeft, CBC_ResultPoint* topRight, CBC_ResultPoint* bottomRight, FX_INT32 &e); + CBC_BoundingBox(CBC_CommonBitMatrix* image, CBC_ResultPoint* topLeft, CBC_ResultPoint* bottomLeft, CBC_ResultPoint* topRight, CBC_ResultPoint* bottomRight, int32_t &e); CBC_BoundingBox(CBC_BoundingBox* boundingBox); virtual ~CBC_BoundingBox(); - static CBC_BoundingBox* merge(CBC_BoundingBox* leftBox, CBC_BoundingBox* rightBox, FX_INT32 &e); - CBC_BoundingBox* addMissingRows(FX_INT32 missingStartRows, FX_INT32 missingEndRows, FX_BOOL isLeft, FX_INT32 &e); + static CBC_BoundingBox* merge(CBC_BoundingBox* leftBox, CBC_BoundingBox* rightBox, int32_t &e); + CBC_BoundingBox* addMissingRows(int32_t missingStartRows, int32_t missingEndRows, FX_BOOL isLeft, int32_t &e); void setTopRight(CBC_ResultPoint topRight); void setBottomRight(CBC_ResultPoint bottomRight); - FX_INT32 getMinX(); - FX_INT32 getMaxX(); - FX_INT32 getMinY(); - FX_INT32 getMaxY(); + int32_t getMinX(); + int32_t getMaxX(); + int32_t getMinY(); + int32_t getMaxY(); CBC_ResultPoint* getTopLeft(); CBC_ResultPoint* getTopRight(); CBC_ResultPoint* getBottomLeft(); @@ -32,10 +32,10 @@ private: CBC_ResultPoint* m_bottomLeft; CBC_ResultPoint* m_topRight; CBC_ResultPoint* m_bottomRight; - FX_INT32 m_minX; - FX_INT32 m_maxX; - FX_INT32 m_minY; - FX_INT32 m_maxY; + int32_t m_minX; + int32_t m_maxX; + int32_t m_minY; + int32_t m_maxY; void init(CBC_CommonBitMatrix* image, CBC_ResultPoint* topLeft, CBC_ResultPoint* bottomLeft, CBC_ResultPoint* topRight, CBC_ResultPoint* bottomRight); void calculateMinMaxValues(); }; diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.cpp index 9ac65ab7bc..8449a7ed06 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.cpp @@ -22,8 +22,8 @@ #include "../barcode.h" #include "BC_PDF417Codeword.h" -FX_INT32 CBC_Codeword::BARCODE_ROW_UNKNOWN = -1; -CBC_Codeword::CBC_Codeword(FX_INT32 startX, FX_INT32 endX, FX_INT32 bucket, FX_INT32 cvalue) +int32_t CBC_Codeword::BARCODE_ROW_UNKNOWN = -1; +CBC_Codeword::CBC_Codeword(int32_t startX, int32_t endX, int32_t bucket, int32_t cvalue) { m_startX = startX; m_endX = endX; @@ -38,7 +38,7 @@ FX_BOOL CBC_Codeword::hasValidRowNumber() { return isValidRowNumber(m_rowNumber); } -FX_BOOL CBC_Codeword::isValidRowNumber(FX_INT32 rowNumber) +FX_BOOL CBC_Codeword::isValidRowNumber(int32_t rowNumber) { return m_rowNumber != BARCODE_ROW_UNKNOWN && m_bucket == (m_rowNumber % 3) * 3; } @@ -46,31 +46,31 @@ void CBC_Codeword::setRowNumberAsRowIndicatorColumn() { m_rowNumber = (m_value / 30) * 3 + m_bucket / 3; } -FX_INT32 CBC_Codeword::getWidth() +int32_t CBC_Codeword::getWidth() { return m_endX - m_startX; } -FX_INT32 CBC_Codeword::getStartX() +int32_t CBC_Codeword::getStartX() { return m_startX; } -FX_INT32 CBC_Codeword::getEndX() +int32_t CBC_Codeword::getEndX() { return m_endX; } -FX_INT32 CBC_Codeword::getBucket() +int32_t CBC_Codeword::getBucket() { return m_bucket; } -FX_INT32 CBC_Codeword::getValue() +int32_t CBC_Codeword::getValue() { return m_value; } -FX_INT32 CBC_Codeword::getRowNumber() +int32_t CBC_Codeword::getRowNumber() { return m_rowNumber; } -void CBC_Codeword::setRowNumber(FX_INT32 rowNumber) +void CBC_Codeword::setRowNumber(int32_t rowNumber) { m_rowNumber = rowNumber; } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.h b/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.h index ea0524cbf8..ef5e0aefc7 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Codeword.h @@ -9,25 +9,25 @@ class CBC_Codeword { public: - CBC_Codeword(FX_INT32 startX, FX_INT32 endX, FX_INT32 bucket, FX_INT32 value); + CBC_Codeword(int32_t startX, int32_t endX, int32_t bucket, int32_t value); virtual ~CBC_Codeword(); FX_BOOL hasValidRowNumber() ; - FX_BOOL isValidRowNumber(FX_INT32 rowNumber); + FX_BOOL isValidRowNumber(int32_t rowNumber); void setRowNumberAsRowIndicatorColumn(); - FX_INT32 getWidth(); - FX_INT32 getStartX(); - FX_INT32 getEndX(); - FX_INT32 getBucket(); - FX_INT32 getValue(); - FX_INT32 getRowNumber(); - void setRowNumber(FX_INT32 rowNumber); + int32_t getWidth(); + int32_t getStartX(); + int32_t getEndX(); + int32_t getBucket(); + int32_t getValue(); + int32_t getRowNumber(); + void setRowNumber(int32_t rowNumber); CFX_ByteString toString(); private: - static FX_INT32 BARCODE_ROW_UNKNOWN; - FX_INT32 m_startX; - FX_INT32 m_endX; - FX_INT32 m_bucket; - FX_INT32 m_value; - FX_INT32 m_rowNumber; + static int32_t BARCODE_ROW_UNKNOWN; + int32_t m_startX; + int32_t m_endX; + int32_t m_bucket; + int32_t m_value; + int32_t m_rowNumber; }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp index bf16bc25e0..822a47a4d4 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp @@ -34,10 +34,10 @@ CBC_PDF417CodewordDecoder::~CBC_PDF417CodewordDecoder() } void CBC_PDF417CodewordDecoder::Initialize() { - for (FX_INT32 i = 0; i < SYMBOL_TABLE_Length; i++) { - FX_INT32 currentSymbol = CBC_PDF417Common::SYMBOL_TABLE[i]; - FX_INT32 currentBit = currentSymbol & 0x1; - for (FX_INT32 j = 0; j < CBC_PDF417Common::BARS_IN_MODULE; j++) { + for (int32_t i = 0; i < SYMBOL_TABLE_Length; i++) { + int32_t currentSymbol = CBC_PDF417Common::SYMBOL_TABLE[i]; + int32_t currentBit = currentSymbol & 0x1; + for (int32_t j = 0; j < CBC_PDF417Common::BARS_IN_MODULE; j++) { FX_FLOAT size = 0.0f; while ((currentSymbol & 0x1) == currentBit) { size += 1.0f; @@ -51,10 +51,10 @@ void CBC_PDF417CodewordDecoder::Initialize() void CBC_PDF417CodewordDecoder::Finalize() { } -FX_INT32 CBC_PDF417CodewordDecoder::getDecodedValue(CFX_Int32Array& moduleBitCount) +int32_t CBC_PDF417CodewordDecoder::getDecodedValue(CFX_Int32Array& moduleBitCount) { CFX_Int32Array* array = sampleBitCounts(moduleBitCount); - FX_INT32 decodedValue = getDecodedCodewordValue(*array); + int32_t decodedValue = getDecodedCodewordValue(*array); delete array; if (decodedValue != -1) { return decodedValue; @@ -66,9 +66,9 @@ CFX_Int32Array* CBC_PDF417CodewordDecoder::sampleBitCounts(CFX_Int32Array& modul FX_FLOAT bitCountSum = (FX_FLOAT)CBC_PDF417Common::getBitCountSum(moduleBitCount); CFX_Int32Array* bitCount = FX_NEW CFX_Int32Array(); bitCount->SetSize(CBC_PDF417Common::BARS_IN_MODULE); - FX_INT32 bitCountIndex = 0; - FX_INT32 sumPreviousBits = 0; - for (FX_INT32 i = 0; i < CBC_PDF417Common::MODULES_IN_CODEWORD; i++) { + int32_t bitCountIndex = 0; + int32_t sumPreviousBits = 0; + for (int32_t i = 0; i < CBC_PDF417Common::MODULES_IN_CODEWORD; i++) { FX_FLOAT sampleIndex = bitCountSum / (2 * CBC_PDF417Common::MODULES_IN_CODEWORD) + (i * bitCountSum) / CBC_PDF417Common::MODULES_IN_CODEWORD; if (sumPreviousBits + moduleBitCount.GetAt(bitCountIndex) <= sampleIndex) { sumPreviousBits += moduleBitCount.GetAt(bitCountIndex); @@ -78,34 +78,34 @@ CFX_Int32Array* CBC_PDF417CodewordDecoder::sampleBitCounts(CFX_Int32Array& modul } return bitCount; } -FX_INT32 CBC_PDF417CodewordDecoder::getDecodedCodewordValue(CFX_Int32Array& moduleBitCount) +int32_t CBC_PDF417CodewordDecoder::getDecodedCodewordValue(CFX_Int32Array& moduleBitCount) { - FX_INT32 decodedValue = getBitValue(moduleBitCount); + int32_t decodedValue = getBitValue(moduleBitCount); return CBC_PDF417Common::getCodeword(decodedValue) == -1 ? -1 : decodedValue; } -FX_INT32 CBC_PDF417CodewordDecoder::getBitValue(CFX_Int32Array& moduleBitCount) +int32_t CBC_PDF417CodewordDecoder::getBitValue(CFX_Int32Array& moduleBitCount) { - FX_INT64 result = 0; - for (FX_INT32 i = 0; i < moduleBitCount.GetSize(); i++) { - for (FX_INT32 bit = 0; bit < moduleBitCount.GetAt(i); bit++) { + int64_t result = 0; + for (int32_t i = 0; i < moduleBitCount.GetSize(); i++) { + for (int32_t bit = 0; bit < moduleBitCount.GetAt(i); bit++) { result = (result << 1) | (i % 2 == 0 ? 1 : 0); } } - return (FX_INT32) result; + return (int32_t) result; } -FX_INT32 CBC_PDF417CodewordDecoder::getClosestDecodedValue(CFX_Int32Array& moduleBitCount) +int32_t CBC_PDF417CodewordDecoder::getClosestDecodedValue(CFX_Int32Array& moduleBitCount) { - FX_INT32 bitCountSum = CBC_PDF417Common::getBitCountSum(moduleBitCount); + int32_t bitCountSum = CBC_PDF417Common::getBitCountSum(moduleBitCount); CFX_FloatArray bitCountRatios; bitCountRatios.SetSize(CBC_PDF417Common::BARS_IN_MODULE); - for (FX_INT32 i = 0; i < bitCountRatios.GetSize(); i++) { + for (int32_t i = 0; i < bitCountRatios.GetSize(); i++) { bitCountRatios[i] = moduleBitCount.GetAt(i) / (FX_FLOAT) bitCountSum; } FX_FLOAT bestMatchError = (FX_FLOAT)Float_MAX_VALUE; - FX_INT32 bestMatch = -1; - for (FX_INT32 j = 0; j < SYMBOL_TABLE_Length; j++) { + int32_t bestMatch = -1; + for (int32_t j = 0; j < SYMBOL_TABLE_Length; j++) { FX_FLOAT error = 0.0f; - for (FX_INT32 k = 0; k < CBC_PDF417Common::BARS_IN_MODULE; k++) { + for (int32_t k = 0; k < CBC_PDF417Common::BARS_IN_MODULE; k++) { FX_FLOAT diff = RATIOS_TABLE[j][k] - bitCountRatios[k]; error += diff * diff; } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.h b/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.h index f76d16d015..424d31b2ce 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.h @@ -16,12 +16,12 @@ public: virtual ~CBC_PDF417CodewordDecoder(); static void Initialize(); static void Finalize(); - static FX_INT32 getDecodedValue(CFX_Int32Array& moduleBitCount); + static int32_t getDecodedValue(CFX_Int32Array& moduleBitCount); private: static FX_FLOAT RATIOS_TABLE[][8]; static CFX_Int32Array* sampleBitCounts(CFX_Int32Array& moduleBitCount); - static FX_INT32 getDecodedCodewordValue(CFX_Int32Array& moduleBitCount); - static FX_INT32 getBitValue(CFX_Int32Array& moduleBitCount); - static FX_INT32 getClosestDecodedValue(CFX_Int32Array& moduleBitCount); + static int32_t getDecodedCodewordValue(CFX_Int32Array& moduleBitCount); + static int32_t getBitValue(CFX_Int32Array& moduleBitCount); + static int32_t getClosestDecodedValue(CFX_Int32Array& moduleBitCount); }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Common.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Common.cpp index 1f192e63a7..758fed61fe 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Common.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Common.cpp @@ -22,16 +22,16 @@ #include "../barcode.h" #include "BC_PDF417Common.h" -FX_INT32 CBC_PDF417Common::NUMBER_OF_CODEWORDS = 929; -FX_INT32 CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE = NUMBER_OF_CODEWORDS - 1; -FX_INT32 CBC_PDF417Common::MIN_ROWS_IN_BARCODE = 3; -FX_INT32 CBC_PDF417Common::MAX_ROWS_IN_BARCODE = 90; -FX_INT32 CBC_PDF417Common::MAX_CODEWORDS_IN_ROW = 32; -FX_INT32 CBC_PDF417Common::MODULES_IN_CODEWORD = 17; -FX_INT32 CBC_PDF417Common::MODULES_IN_STOP_PATTERN = 18; -FX_INT32 CBC_PDF417Common::BARS_IN_MODULE = 8; +int32_t CBC_PDF417Common::NUMBER_OF_CODEWORDS = 929; +int32_t CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE = NUMBER_OF_CODEWORDS - 1; +int32_t CBC_PDF417Common::MIN_ROWS_IN_BARCODE = 3; +int32_t CBC_PDF417Common::MAX_ROWS_IN_BARCODE = 90; +int32_t CBC_PDF417Common::MAX_CODEWORDS_IN_ROW = 32; +int32_t CBC_PDF417Common::MODULES_IN_CODEWORD = 17; +int32_t CBC_PDF417Common::MODULES_IN_STOP_PATTERN = 18; +int32_t CBC_PDF417Common::BARS_IN_MODULE = 8; CFX_Int32Array* CBC_PDF417Common::EMPTY_INT_ARRAY = NULL; -FX_INT32 CBC_PDF417Common::SYMBOL_TABLE[] = { +int32_t CBC_PDF417Common::SYMBOL_TABLE[] = { 0x1025e, 0x1027a, 0x1029e, 0x102bc, 0x102f2, 0x102f4, 0x1032e, 0x1034e, 0x1035c, 0x10396, 0x103a6, 0x103ac, 0x10422, 0x10428, 0x10436, 0x10442, 0x10444, 0x10448, 0x10450, 0x1045e, 0x10466, 0x1046c, 0x1047a, 0x10482, 0x1049e, 0x104a0, 0x104bc, 0x104c6, 0x104d8, 0x104ee, 0x104f2, 0x104f4, 0x10504, 0x10508, 0x10510, 0x1051e, @@ -266,7 +266,7 @@ FX_INT32 CBC_PDF417Common::SYMBOL_TABLE[] = { 0x1fb3a, 0x1fb46, 0x1fb4c, 0x1fb58, 0x1fb6e, 0x1fb72, 0x1fb74, 0x1fb8a, 0x1fb92, 0x1fb94, 0x1fba2, 0x1fba4, 0x1fba8, 0x1fbb6, 0x1fbda }; -FX_INT32 CBC_PDF417Common::CODEWORD_TABLE[] = { +int32_t CBC_PDF417Common::CODEWORD_TABLE[] = { 2627, 1819, 2622, 2621, 1813, 1812, 2729, 2724, 2723, 2779, 2774, 2773, 902, 896, 908, 868, 865, 861, 859, 2511, 873, 871, 1780, 835, 2493, 825, 2491, 842, 837, 844, 1764, 1762, 811, 810, 809, 2483, 807, 2482, 806, 2480, 815, 814, 813, 812, 2484, 817, 816, 1745, 1744, 1742, 1746, 2655, 2637, 2635, 2626, 2625, 2623, 2628, 1820, 2752, @@ -414,30 +414,30 @@ CBC_PDF417Common::CBC_PDF417Common() CBC_PDF417Common::~CBC_PDF417Common() { } -FX_INT32 CBC_PDF417Common::getBitCountSum(CFX_Int32Array& moduleBitCount) +int32_t CBC_PDF417Common::getBitCountSum(CFX_Int32Array& moduleBitCount) { - FX_INT32 bitCountSum = 0; - for (FX_INT32 i = 0; i < moduleBitCount.GetSize(); i++) { - FX_INT32 count = moduleBitCount.GetAt(i); + int32_t bitCountSum = 0; + for (int32_t i = 0; i < moduleBitCount.GetSize(); i++) { + int32_t count = moduleBitCount.GetAt(i); bitCountSum += count; } return bitCountSum; } -FX_INT32 CBC_PDF417Common::getCodeword(FX_DWORD symbol) +int32_t CBC_PDF417Common::getCodeword(FX_DWORD symbol) { FX_DWORD sym = symbol & 0x3FFFF; - FX_INT32 i = findCodewordIndex(sym); + int32_t i = findCodewordIndex(sym); if (i == -1) { return -1; } return (CODEWORD_TABLE[i] - 1) % NUMBER_OF_CODEWORDS; } -FX_INT32 CBC_PDF417Common::findCodewordIndex(FX_DWORD symbol) +int32_t CBC_PDF417Common::findCodewordIndex(FX_DWORD symbol) { - FX_INT32 first = 0; - FX_INT32 upto = sizeof(SYMBOL_TABLE) / sizeof(SYMBOL_TABLE[0]); + int32_t first = 0; + int32_t upto = sizeof(SYMBOL_TABLE) / sizeof(SYMBOL_TABLE[0]); while (first < upto) { - FX_INT32 mid = ((FX_DWORD)(first + upto)) >> 1; + int32_t mid = ((FX_DWORD)(first + upto)) >> 1; if (symbol < (FX_DWORD)SYMBOL_TABLE[mid]) { upto = mid; } else if (symbol > (FX_DWORD)SYMBOL_TABLE[mid]) { diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Common.h b/xfa/src/fxbarcode/pdf417/BC_PDF417Common.h index 2d6258951e..a97d84b07a 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Common.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Common.h @@ -11,20 +11,20 @@ class CBC_PDF417Common public: CBC_PDF417Common(); virtual ~CBC_PDF417Common(); - static FX_INT32 getBitCountSum(CFX_Int32Array& moduleBitCount); - static FX_INT32 getCodeword(FX_DWORD symbol); - static FX_INT32 NUMBER_OF_CODEWORDS; - static FX_INT32 MAX_CODEWORDS_IN_BARCODE; - static FX_INT32 MIN_ROWS_IN_BARCODE; - static FX_INT32 MAX_ROWS_IN_BARCODE; - static FX_INT32 MAX_CODEWORDS_IN_ROW; - static FX_INT32 MODULES_IN_CODEWORD; - static FX_INT32 MODULES_IN_STOP_PATTERN; - static FX_INT32 BARS_IN_MODULE; - static FX_INT32 SYMBOL_TABLE[]; - static FX_INT32 CODEWORD_TABLE[]; + static int32_t getBitCountSum(CFX_Int32Array& moduleBitCount); + static int32_t getCodeword(FX_DWORD symbol); + static int32_t NUMBER_OF_CODEWORDS; + static int32_t MAX_CODEWORDS_IN_BARCODE; + static int32_t MIN_ROWS_IN_BARCODE; + static int32_t MAX_ROWS_IN_BARCODE; + static int32_t MAX_CODEWORDS_IN_ROW; + static int32_t MODULES_IN_CODEWORD; + static int32_t MODULES_IN_STOP_PATTERN; + static int32_t BARS_IN_MODULE; + static int32_t SYMBOL_TABLE[]; + static int32_t CODEWORD_TABLE[]; private: static CFX_Int32Array* EMPTY_INT_ARRAY; - static FX_INT32 findCodewordIndex(FX_DWORD symbol); + static int32_t findCodewordIndex(FX_DWORD symbol); }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp index ae26057c3e..281c78a8eb 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.cpp @@ -36,15 +36,15 @@ #define MACRO_PDF417_TERMINATOR 922 #define MODE_SHIFT_TO_BYTE_COMPACTION_MODE 913 -FX_INT32 CBC_DecodedBitStreamPaser::MAX_NUMERIC_CODEWORDS = 15; -FX_INT32 CBC_DecodedBitStreamPaser::NUMBER_OF_SEQUENCE_CODEWORDS = 2; -FX_INT32 CBC_DecodedBitStreamPaser::PL = 25; -FX_INT32 CBC_DecodedBitStreamPaser::LL = 27; -FX_INT32 CBC_DecodedBitStreamPaser::AS = 27; -FX_INT32 CBC_DecodedBitStreamPaser::ML = 28; -FX_INT32 CBC_DecodedBitStreamPaser::AL = 28; -FX_INT32 CBC_DecodedBitStreamPaser::PS = 29; -FX_INT32 CBC_DecodedBitStreamPaser::PAL = 29; +int32_t CBC_DecodedBitStreamPaser::MAX_NUMERIC_CODEWORDS = 15; +int32_t CBC_DecodedBitStreamPaser::NUMBER_OF_SEQUENCE_CODEWORDS = 2; +int32_t CBC_DecodedBitStreamPaser::PL = 25; +int32_t CBC_DecodedBitStreamPaser::LL = 27; +int32_t CBC_DecodedBitStreamPaser::AS = 27; +int32_t CBC_DecodedBitStreamPaser::ML = 28; +int32_t CBC_DecodedBitStreamPaser::AL = 28; +int32_t CBC_DecodedBitStreamPaser::PS = 29; +int32_t CBC_DecodedBitStreamPaser::PAL = 29; FX_CHAR CBC_DecodedBitStreamPaser::PUNCT_CHARS[29] = { ';', '<', '>', '@', '[', '\\', '}', '_', '`', '~', '!', '\r', '\t', ',', ':', '\n', '-', '.', '$', '/', '"', '|', '*', @@ -67,11 +67,11 @@ CBC_DecodedBitStreamPaser::CBC_DecodedBitStreamPaser() CBC_DecodedBitStreamPaser::~CBC_DecodedBitStreamPaser() { } -CBC_CommonDecoderResult* CBC_DecodedBitStreamPaser::decode(CFX_Int32Array &codewords, CFX_ByteString ecLevel, FX_INT32 &e) +CBC_CommonDecoderResult* CBC_DecodedBitStreamPaser::decode(CFX_Int32Array &codewords, CFX_ByteString ecLevel, int32_t &e) { CFX_ByteString result; - FX_INT32 codeIndex = 1; - FX_INT32 code = codewords.GetAt(codeIndex); + int32_t codeIndex = 1; + int32_t code = codewords.GetAt(codeIndex); codeIndex++; CBC_PDF417ResultMetadata* resultMetadata = FX_NEW CBC_PDF417ResultMetadata; while (codeIndex < codewords[0]) { @@ -128,7 +128,7 @@ CBC_CommonDecoderResult* CBC_DecodedBitStreamPaser::decode(CFX_Int32Array &codew tempCd->setOther(resultMetadata); return tempCd; } -FX_INT32 CBC_DecodedBitStreamPaser::decodeMacroBlock(CFX_Int32Array &codewords, FX_INT32 codeIndex, CBC_PDF417ResultMetadata* resultMetadata, FX_INT32 &e) +int32_t CBC_DecodedBitStreamPaser::decodeMacroBlock(CFX_Int32Array &codewords, int32_t codeIndex, CBC_PDF417ResultMetadata* resultMetadata, int32_t &e) { if (codeIndex + NUMBER_OF_SEQUENCE_CODEWORDS > codewords[0]) { e = BCExceptionFormatInstance; @@ -136,7 +136,7 @@ FX_INT32 CBC_DecodedBitStreamPaser::decodeMacroBlock(CFX_Int32Array &codewords, } CFX_Int32Array segmentIndexArray; segmentIndexArray.SetSize(NUMBER_OF_SEQUENCE_CODEWORDS); - for (FX_INT32 i = 0; i < NUMBER_OF_SEQUENCE_CODEWORDS; i++, codeIndex++) { + for (int32_t i = 0; i < NUMBER_OF_SEQUENCE_CODEWORDS; i++, codeIndex++) { segmentIndexArray.SetAt(i, codewords[codeIndex]); } CFX_ByteString str = decodeBase900toBase10(segmentIndexArray, NUMBER_OF_SEQUENCE_CODEWORDS, e); @@ -149,10 +149,10 @@ FX_INT32 CBC_DecodedBitStreamPaser::decodeMacroBlock(CFX_Int32Array &codewords, codeIndex++; CFX_Int32Array additionalOptionCodeWords; additionalOptionCodeWords.SetSize(codewords[0] - codeIndex); - FX_INT32 additionalOptionCodeWordsIndex = 0; + int32_t additionalOptionCodeWordsIndex = 0; FX_BOOL end = FALSE; while ((codeIndex < codewords[0]) && !end) { - FX_INT32 code = codewords[codeIndex++]; + int32_t code = codewords[codeIndex++]; if (code < TEXT_COMPACTION_MODE_LATCH) { additionalOptionCodeWords[additionalOptionCodeWordsIndex++] = code; } else { @@ -178,16 +178,16 @@ FX_INT32 CBC_DecodedBitStreamPaser::decodeMacroBlock(CFX_Int32Array &codewords, } return codeIndex; } -FX_INT32 CBC_DecodedBitStreamPaser::textCompaction(CFX_Int32Array &codewords, FX_INT32 codeIndex, CFX_ByteString &result) +int32_t CBC_DecodedBitStreamPaser::textCompaction(CFX_Int32Array &codewords, int32_t codeIndex, CFX_ByteString &result) { CFX_Int32Array textCompactionData; textCompactionData.SetSize((codewords[0] - codeIndex) << 1); CFX_Int32Array byteCompactionData; byteCompactionData.SetSize((codewords[0] - codeIndex) << 1); - FX_INT32 index = 0; + int32_t index = 0; FX_BOOL end = FALSE; while ((codeIndex < codewords[0]) && !end) { - FX_INT32 code = codewords[codeIndex++]; + int32_t code = codewords[codeIndex++]; if (code < TEXT_COMPACTION_MODE_LATCH) { textCompactionData[index] = code / 30; textCompactionData[index + 1] = code % 30; @@ -233,13 +233,13 @@ FX_INT32 CBC_DecodedBitStreamPaser::textCompaction(CFX_Int32Array &codewords, FX decodeTextCompaction(textCompactionData, byteCompactionData, index, result); return codeIndex; } -void CBC_DecodedBitStreamPaser::decodeTextCompaction(CFX_Int32Array &textCompactionData, CFX_Int32Array &byteCompactionData, FX_INT32 length, CFX_ByteString &result) +void CBC_DecodedBitStreamPaser::decodeTextCompaction(CFX_Int32Array &textCompactionData, CFX_Int32Array &byteCompactionData, int32_t length, CFX_ByteString &result) { Mode subMode = ALPHA; Mode priorToShiftMode = ALPHA; - FX_INT32 i = 0; + int32_t i = 0; while (i < length) { - FX_INT32 subModeCh = textCompactionData[i]; + int32_t subModeCh = textCompactionData[i]; FX_CHAR ch = 0; switch (subMode) { case ALPHA: @@ -351,16 +351,16 @@ void CBC_DecodedBitStreamPaser::decodeTextCompaction(CFX_Int32Array &textCompact i++; } } -FX_INT32 CBC_DecodedBitStreamPaser::byteCompaction(FX_INT32 mode, CFX_Int32Array &codewords, FX_INT32 codeIndex, CFX_ByteString &result) +int32_t CBC_DecodedBitStreamPaser::byteCompaction(int32_t mode, CFX_Int32Array &codewords, int32_t codeIndex, CFX_ByteString &result) { if (mode == BYTE_COMPACTION_MODE_LATCH) { - FX_INT32 count = 0; - FX_INT64 value = 0; + int32_t count = 0; + int64_t value = 0; FX_WORD* decodedData = FX_Alloc(FX_WORD, 6 * sizeof(FX_WORD)); CFX_Int32Array byteCompactedCodewords; byteCompactedCodewords.SetSize(6); FX_BOOL end = FALSE; - FX_INT32 nextCode = codewords[codeIndex++]; + int32_t nextCode = codewords[codeIndex++]; while ((codeIndex < codewords[0]) && !end) { byteCompactedCodewords[count++] = nextCode; value = 900 * value + nextCode; @@ -376,7 +376,7 @@ FX_INT32 CBC_DecodedBitStreamPaser::byteCompaction(FX_INT32 mode, CFX_Int32Array end = TRUE; } else { if ((count % 5 == 0) && (count > 0)) { - FX_INT32 j = 0; + int32_t j = 0; for (; j < 6; ++j) { decodedData[5 - j] = (FX_WORD) (value % 256); value >>= 8; @@ -392,15 +392,15 @@ FX_INT32 CBC_DecodedBitStreamPaser::byteCompaction(FX_INT32 mode, CFX_Int32Array if (codeIndex == codewords[0] && nextCode < TEXT_COMPACTION_MODE_LATCH) { byteCompactedCodewords[count++] = nextCode; } - for (FX_INT32 i = 0; i < count; i++) { + for (int32_t i = 0; i < count; i++) { result += (FX_CHAR)(FX_WORD) byteCompactedCodewords[i]; } } else if (mode == BYTE_COMPACTION_MODE_LATCH_6) { - FX_INT32 count = 0; - FX_INT64 value = 0; + int32_t count = 0; + int64_t value = 0; FX_BOOL end = FALSE; while (codeIndex < codewords[0] && !end) { - FX_INT32 code = codewords[codeIndex++]; + int32_t code = codewords[codeIndex++]; if (code < TEXT_COMPACTION_MODE_LATCH) { count++; value = 900 * value + code; @@ -418,7 +418,7 @@ FX_INT32 CBC_DecodedBitStreamPaser::byteCompaction(FX_INT32 mode, CFX_Int32Array } if ((count % 5 == 0) && (count > 0)) { FX_WORD* decodedData = FX_Alloc(FX_WORD, 6 * sizeof(FX_WORD)); - FX_INT32 j = 0; + int32_t j = 0; for (; j < 6; ++j) { decodedData[5 - j] = (FX_WORD) (value & 0xFF); value >>= 8; @@ -433,14 +433,14 @@ FX_INT32 CBC_DecodedBitStreamPaser::byteCompaction(FX_INT32 mode, CFX_Int32Array } return codeIndex; } -FX_INT32 CBC_DecodedBitStreamPaser::numericCompaction(CFX_Int32Array &codewords, FX_INT32 codeIndex, CFX_ByteString &result, FX_INT32 &e) +int32_t CBC_DecodedBitStreamPaser::numericCompaction(CFX_Int32Array &codewords, int32_t codeIndex, CFX_ByteString &result, int32_t &e) { - FX_INT32 count = 0; + int32_t count = 0; FX_BOOL end = FALSE; CFX_Int32Array numericCodewords; numericCodewords.SetSize(MAX_NUMERIC_CODEWORDS); while (codeIndex < codewords[0] && !end) { - FX_INT32 code = codewords[codeIndex++]; + int32_t code = codewords[codeIndex++]; if (codeIndex == codewords[0]) { end = TRUE; } @@ -469,11 +469,11 @@ FX_INT32 CBC_DecodedBitStreamPaser::numericCompaction(CFX_Int32Array &codewords, } return codeIndex; } -CFX_ByteString CBC_DecodedBitStreamPaser::decodeBase900toBase10(CFX_Int32Array &codewords, FX_INT32 count, FX_INT32 &e) +CFX_ByteString CBC_DecodedBitStreamPaser::decodeBase900toBase10(CFX_Int32Array &codewords, int32_t count, int32_t &e) { BigInteger result = 0; BigInteger nineHundred(900); - for (FX_INT32 i = 0; i < count; i++) { + for (int32_t i = 0; i < count; i++) { result = result * nineHundred + BigInteger(codewords[i]); } CFX_ByteString resultString(bigIntegerToString(result).c_str()); diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.h b/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.h index 4c97bc3f24..20831b4ad8 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.h @@ -15,7 +15,7 @@ public: virtual ~CBC_DecodedBitStreamPaser(); static void Initialize(); static void Finalize(); - static CBC_CommonDecoderResult* decode(CFX_Int32Array &codewords, CFX_ByteString ecLevel, FX_INT32 &e); + static CBC_CommonDecoderResult* decode(CFX_Int32Array &codewords, CFX_ByteString ecLevel, int32_t &e); private: enum Mode { @@ -26,22 +26,22 @@ private: ALPHA_SHIFT, PUNCT_SHIFT }; - static FX_INT32 MAX_NUMERIC_CODEWORDS; - static FX_INT32 PL; - static FX_INT32 LL; - static FX_INT32 AS; - static FX_INT32 ML; - static FX_INT32 AL; - static FX_INT32 PS; - static FX_INT32 PAL; + static int32_t MAX_NUMERIC_CODEWORDS; + static int32_t PL; + static int32_t LL; + static int32_t AS; + static int32_t ML; + static int32_t AL; + static int32_t PS; + static int32_t PAL; static FX_CHAR PUNCT_CHARS[29]; static FX_CHAR MIXED_CHARS[30]; - static FX_INT32 NUMBER_OF_SEQUENCE_CODEWORDS; - static FX_INT32 decodeMacroBlock(CFX_Int32Array &codewords, FX_INT32 codeIndex, CBC_PDF417ResultMetadata* resultMetadata, FX_INT32 &e); - static FX_INT32 textCompaction(CFX_Int32Array &codewords, FX_INT32 codeIndex, CFX_ByteString &result); - static void decodeTextCompaction(CFX_Int32Array &textCompactionData, CFX_Int32Array &byteCompactionData, FX_INT32 length, CFX_ByteString &result); - static FX_INT32 byteCompaction(FX_INT32 mode, CFX_Int32Array &codewords, FX_INT32 codeIndex, CFX_ByteString &result); - static FX_INT32 numericCompaction(CFX_Int32Array &codewords, FX_INT32 codeIndex, CFX_ByteString &result, FX_INT32 &e); - static CFX_ByteString decodeBase900toBase10(CFX_Int32Array &codewords, FX_INT32 count, FX_INT32 &e); + static int32_t NUMBER_OF_SEQUENCE_CODEWORDS; + static int32_t decodeMacroBlock(CFX_Int32Array &codewords, int32_t codeIndex, CBC_PDF417ResultMetadata* resultMetadata, int32_t &e); + static int32_t textCompaction(CFX_Int32Array &codewords, int32_t codeIndex, CFX_ByteString &result); + static void decodeTextCompaction(CFX_Int32Array &textCompactionData, CFX_Int32Array &byteCompactionData, int32_t length, CFX_ByteString &result); + static int32_t byteCompaction(int32_t mode, CFX_Int32Array &codewords, int32_t codeIndex, CFX_ByteString &result); + static int32_t numericCompaction(CFX_Int32Array &codewords, int32_t codeIndex, CFX_ByteString &result, int32_t &e); + static CFX_ByteString decodeBase900toBase10(CFX_Int32Array &codewords, int32_t count, int32_t &e); }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp index af316f7660..c4966942c6 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.cpp @@ -28,14 +28,14 @@ #include "BC_PDF417Common.h" #include "BC_PDF417DetectionResultRowIndicatorColumn.h" #include "BC_PDF417DetectionResult.h" -FX_INT32 CBC_DetectionResult::ADJUST_ROW_NUMBER_SKIP = 2; +int32_t CBC_DetectionResult::ADJUST_ROW_NUMBER_SKIP = 2; CBC_DetectionResult::CBC_DetectionResult(CBC_BarcodeMetadata* barcodeMetadata, CBC_BoundingBox* boundingBox) { m_barcodeMetadata = barcodeMetadata; m_barcodeColumnCount = barcodeMetadata->getColumnCount(); m_boundingBox = boundingBox; m_detectionResultColumns.SetSize(m_barcodeColumnCount + 2); - for (FX_INT32 i = 0; i < m_barcodeColumnCount + 2; i++) { + for (int32_t i = 0; i < m_barcodeColumnCount + 2; i++) { m_detectionResultColumns[i] = NULL; } } @@ -49,8 +49,8 @@ CFX_PtrArray& CBC_DetectionResult::getDetectionResultColumns() { adjustIndicatorColumnRowNumbers((CBC_DetectionResultColumn*)m_detectionResultColumns.GetAt(0)); adjustIndicatorColumnRowNumbers((CBC_DetectionResultColumn*)m_detectionResultColumns.GetAt(m_barcodeColumnCount + 1)); - FX_INT32 unadjustedCodewordCount = CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE; - FX_INT32 previousUnadjustedCount; + int32_t unadjustedCodewordCount = CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE; + int32_t previousUnadjustedCount; do { previousUnadjustedCount = unadjustedCodewordCount; unadjustedCodewordCount = adjustRowNumbers(); @@ -65,11 +65,11 @@ CBC_BoundingBox* CBC_DetectionResult::getBoundingBox() { return m_boundingBox; } -void CBC_DetectionResult::setDetectionResultColumn(FX_INT32 barcodeColumn, CBC_DetectionResultColumn* detectionResultColumn) +void CBC_DetectionResult::setDetectionResultColumn(int32_t barcodeColumn, CBC_DetectionResultColumn* detectionResultColumn) { m_detectionResultColumns[barcodeColumn] = detectionResultColumn; } -CBC_DetectionResultColumn* CBC_DetectionResult::getDetectionResultColumn(FX_INT32 barcodeColumn) +CBC_DetectionResultColumn* CBC_DetectionResult::getDetectionResultColumn(int32_t barcodeColumn) { return (CBC_DetectionResultColumn*)m_detectionResultColumns[barcodeColumn]; } @@ -80,9 +80,9 @@ CFX_ByteString CBC_DetectionResult::toString() rowIndicatorColumn = (CBC_DetectionResultColumn*)m_detectionResultColumns[m_barcodeColumnCount + 1]; } CFX_ByteString result; - for (FX_INT32 codewordsRow = 0; codewordsRow < rowIndicatorColumn->getCodewords()->GetSize(); codewordsRow++) { + for (int32_t codewordsRow = 0; codewordsRow < rowIndicatorColumn->getCodewords()->GetSize(); codewordsRow++) { result += (FX_CHAR) codewordsRow; - for (FX_INT32 barcodeColumn = 0; barcodeColumn < m_barcodeColumnCount + 2; barcodeColumn++) { + for (int32_t barcodeColumn = 0; barcodeColumn < m_barcodeColumnCount + 2; barcodeColumn++) { if (m_detectionResultColumns[barcodeColumn] == NULL) { result += " | "; continue; @@ -104,15 +104,15 @@ void CBC_DetectionResult::adjustIndicatorColumnRowNumbers(CBC_DetectionResultCol ((CBC_DetectionResultRowIndicatorColumn*)detectionResultColumn)->adjustCompleteIndicatorColumnRowNumbers(*m_barcodeMetadata); } } -FX_INT32 CBC_DetectionResult::adjustRowNumbers() +int32_t CBC_DetectionResult::adjustRowNumbers() { - FX_INT32 unadjustedCount = adjustRowNumbersByRow(); + int32_t unadjustedCount = adjustRowNumbersByRow(); if (unadjustedCount == 0) { return 0; } - for (FX_INT32 barcodeColumn = 1; barcodeColumn < m_barcodeColumnCount + 1; barcodeColumn++) { + for (int32_t barcodeColumn = 1; barcodeColumn < m_barcodeColumnCount + 1; barcodeColumn++) { CFX_PtrArray* codewords = ((CBC_DetectionResultColumn*)m_detectionResultColumns[barcodeColumn])->getCodewords(); - for (FX_INT32 codewordsRow = 0; codewordsRow < codewords->GetSize(); codewordsRow++) { + for (int32_t codewordsRow = 0; codewordsRow < codewords->GetSize(); codewordsRow++) { if (codewords->GetAt(codewordsRow) == NULL) { continue; } @@ -123,24 +123,24 @@ FX_INT32 CBC_DetectionResult::adjustRowNumbers() } return unadjustedCount; } -FX_INT32 CBC_DetectionResult::adjustRowNumbersByRow() +int32_t CBC_DetectionResult::adjustRowNumbersByRow() { adjustRowNumbersFromBothRI(); - FX_INT32 unadjustedCount = adjustRowNumbersFromLRI(); + int32_t unadjustedCount = adjustRowNumbersFromLRI(); return unadjustedCount + adjustRowNumbersFromRRI(); } -FX_INT32 CBC_DetectionResult::adjustRowNumbersFromBothRI() +int32_t CBC_DetectionResult::adjustRowNumbersFromBothRI() { if (m_detectionResultColumns[0] == NULL || m_detectionResultColumns[m_barcodeColumnCount + 1] == NULL) { return 0; } CFX_PtrArray* LRIcodewords = ((CBC_DetectionResultColumn*)m_detectionResultColumns[0])->getCodewords(); CFX_PtrArray* RRIcodewords = ((CBC_DetectionResultColumn*)m_detectionResultColumns[m_barcodeColumnCount + 1])->getCodewords(); - for (FX_INT32 codewordsRow = 0; codewordsRow < LRIcodewords->GetSize(); codewordsRow++) { + for (int32_t codewordsRow = 0; codewordsRow < LRIcodewords->GetSize(); codewordsRow++) { if (LRIcodewords->GetAt(codewordsRow) != NULL && RRIcodewords->GetAt(codewordsRow) != NULL && ((CBC_Codeword*)LRIcodewords->GetAt(codewordsRow))->getRowNumber() == ((CBC_Codeword*)RRIcodewords->GetAt(codewordsRow))->getRowNumber()) { - for (FX_INT32 barcodeColumn = 1; barcodeColumn <= m_barcodeColumnCount; barcodeColumn++) { + for (int32_t barcodeColumn = 1; barcodeColumn <= m_barcodeColumnCount; barcodeColumn++) { CBC_Codeword* codeword = (CBC_Codeword*)((CBC_DetectionResultColumn*)m_detectionResultColumns[barcodeColumn])->getCodewords()->GetAt(codewordsRow); if (codeword == NULL) { continue; @@ -154,20 +154,20 @@ FX_INT32 CBC_DetectionResult::adjustRowNumbersFromBothRI() } return 0; } -FX_INT32 CBC_DetectionResult::adjustRowNumbersFromRRI() +int32_t CBC_DetectionResult::adjustRowNumbersFromRRI() { if (m_detectionResultColumns[m_barcodeColumnCount + 1] == NULL) { return 0; } - FX_INT32 unadjustedCount = 0; + int32_t unadjustedCount = 0; CFX_PtrArray* codewords = ((CBC_DetectionResultColumn*) m_detectionResultColumns.GetAt(m_barcodeColumnCount + 1))->getCodewords(); - for (FX_INT32 codewordsRow = 0; codewordsRow < codewords->GetSize(); codewordsRow++) { + for (int32_t codewordsRow = 0; codewordsRow < codewords->GetSize(); codewordsRow++) { if (codewords->GetAt(codewordsRow) == NULL) { continue; } - FX_INT32 rowIndicatorRowNumber = ((CBC_Codeword*)codewords->GetAt(codewordsRow))->getRowNumber(); - FX_INT32 invalidRowCounts = 0; - for (FX_INT32 barcodeColumn = m_barcodeColumnCount + 1; barcodeColumn > 0 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; barcodeColumn--) { + int32_t rowIndicatorRowNumber = ((CBC_Codeword*)codewords->GetAt(codewordsRow))->getRowNumber(); + int32_t invalidRowCounts = 0; + for (int32_t barcodeColumn = m_barcodeColumnCount + 1; barcodeColumn > 0 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; barcodeColumn--) { CBC_Codeword* codeword = (CBC_Codeword*)((CBC_DetectionResultColumn*)m_detectionResultColumns.GetAt(barcodeColumn))->getCodewords()->GetAt(codewordsRow); if (codeword != NULL) { invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword); @@ -179,20 +179,20 @@ FX_INT32 CBC_DetectionResult::adjustRowNumbersFromRRI() } return unadjustedCount; } -FX_INT32 CBC_DetectionResult::adjustRowNumbersFromLRI() +int32_t CBC_DetectionResult::adjustRowNumbersFromLRI() { if (m_detectionResultColumns[0] == NULL) { return 0; } - FX_INT32 unadjustedCount = 0; + int32_t unadjustedCount = 0; CFX_PtrArray* codewords = ((CBC_DetectionResultColumn*)m_detectionResultColumns.GetAt(0))->getCodewords(); - for (FX_INT32 codewordsRow = 0; codewordsRow < codewords->GetSize(); codewordsRow++) { + for (int32_t codewordsRow = 0; codewordsRow < codewords->GetSize(); codewordsRow++) { if (codewords->GetAt(codewordsRow) == NULL) { continue; } - FX_INT32 rowIndicatorRowNumber = ((CBC_Codeword*)codewords->GetAt(codewordsRow))->getRowNumber(); - FX_INT32 invalidRowCounts = 0; - for (FX_INT32 barcodeColumn = 1; barcodeColumn < m_barcodeColumnCount + 1 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; barcodeColumn++) { + int32_t rowIndicatorRowNumber = ((CBC_Codeword*)codewords->GetAt(codewordsRow))->getRowNumber(); + int32_t invalidRowCounts = 0; + for (int32_t barcodeColumn = 1; barcodeColumn < m_barcodeColumnCount + 1 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; barcodeColumn++) { CBC_Codeword* codeword = (CBC_Codeword*)((CBC_DetectionResultColumn*)m_detectionResultColumns[barcodeColumn])->getCodewords()->GetAt(codewordsRow); if (codeword != NULL) { invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword); @@ -204,7 +204,7 @@ FX_INT32 CBC_DetectionResult::adjustRowNumbersFromLRI() } return unadjustedCount; } -FX_INT32 CBC_DetectionResult::adjustRowNumberIfValid(FX_INT32 rowIndicatorRowNumber, FX_INT32 invalidRowCounts, CBC_Codeword* codeword) +int32_t CBC_DetectionResult::adjustRowNumberIfValid(int32_t rowIndicatorRowNumber, int32_t invalidRowCounts, CBC_Codeword* codeword) { if (codeword == NULL) { return invalidRowCounts; @@ -219,7 +219,7 @@ FX_INT32 CBC_DetectionResult::adjustRowNumberIfValid(FX_INT32 rowIndicatorRowNum } return invalidRowCounts; } -void CBC_DetectionResult::adjustRowNumbers(FX_INT32 barcodeColumn, FX_INT32 codewordsRow, CFX_PtrArray* codewords) +void CBC_DetectionResult::adjustRowNumbers(int32_t barcodeColumn, int32_t codewordsRow, CFX_PtrArray* codewords) { CBC_Codeword* codeword = (CBC_Codeword*)codewords->GetAt(codewordsRow); CFX_PtrArray* previousColumnCodewords = ((CBC_DetectionResultColumn*)m_detectionResultColumns.GetAt(barcodeColumn - 1))->getCodewords(); @@ -251,7 +251,7 @@ void CBC_DetectionResult::adjustRowNumbers(FX_INT32 barcodeColumn, FX_INT32 code otherCodewords[12] = previousColumnCodewords->GetAt(codewordsRow + 2); otherCodewords[13] = nextColumnCodewords->GetAt(codewordsRow + 2); } - for (FX_INT32 i = 0; i < otherCodewords.GetSize(); i++) { + for (int32_t i = 0; i < otherCodewords.GetSize(); i++) { CBC_Codeword* otherCodeword = (CBC_Codeword*)otherCodewords.GetAt(i); if (adjustRowNumber(codeword, otherCodeword)) { return; @@ -269,15 +269,15 @@ FX_BOOL CBC_DetectionResult::adjustRowNumber(CBC_Codeword* codeword, CBC_Codewor } return FALSE; } -FX_INT32 CBC_DetectionResult::getBarcodeColumnCount() +int32_t CBC_DetectionResult::getBarcodeColumnCount() { return m_barcodeColumnCount; } -FX_INT32 CBC_DetectionResult::getBarcodeRowCount() +int32_t CBC_DetectionResult::getBarcodeRowCount() { return m_barcodeMetadata->getRowCount(); } -FX_INT32 CBC_DetectionResult::getBarcodeECLevel() +int32_t CBC_DetectionResult::getBarcodeECLevel() { return m_barcodeMetadata->getErrorCorrectionLevel(); } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.h b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.h index 55a5a8f134..34da90082c 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResult.h @@ -18,28 +18,28 @@ public: CFX_PtrArray& getDetectionResultColumns(); void setBoundingBox(CBC_BoundingBox* boundingBox); CBC_BoundingBox* getBoundingBox(); - void setDetectionResultColumn(FX_INT32 barcodeColumn, CBC_DetectionResultColumn* detectionResultColumn); - CBC_DetectionResultColumn* getDetectionResultColumn(FX_INT32 barcodeColumn); + void setDetectionResultColumn(int32_t barcodeColumn, CBC_DetectionResultColumn* detectionResultColumn); + CBC_DetectionResultColumn* getDetectionResultColumn(int32_t barcodeColumn); CFX_ByteString toString(); - FX_INT32 getBarcodeColumnCount(); - FX_INT32 getBarcodeRowCount(); - FX_INT32 getBarcodeECLevel(); + int32_t getBarcodeColumnCount(); + int32_t getBarcodeRowCount(); + int32_t getBarcodeECLevel(); private: - static FX_INT32 ADJUST_ROW_NUMBER_SKIP; + static int32_t ADJUST_ROW_NUMBER_SKIP; CBC_BarcodeMetadata* m_barcodeMetadata; CFX_PtrArray m_detectionResultColumns; CBC_BoundingBox* m_boundingBox; - FX_INT32 m_barcodeColumnCount; + int32_t m_barcodeColumnCount; private: void adjustIndicatorColumnRowNumbers(CBC_DetectionResultColumn* detectionResultColumn); - FX_INT32 adjustRowNumbers(); - FX_INT32 adjustRowNumbersByRow(); - FX_INT32 adjustRowNumbersFromBothRI(); - FX_INT32 adjustRowNumbersFromRRI(); - FX_INT32 adjustRowNumbersFromLRI(); - static FX_INT32 adjustRowNumberIfValid(FX_INT32 rowIndicatorRowNumber, FX_INT32 invalidRowCounts, CBC_Codeword* codeword); - void adjustRowNumbers(FX_INT32 barcodeColumn, FX_INT32 codewordsRow, CFX_PtrArray* codewords); + int32_t adjustRowNumbers(); + int32_t adjustRowNumbersByRow(); + int32_t adjustRowNumbersFromBothRI(); + int32_t adjustRowNumbersFromRRI(); + int32_t adjustRowNumbersFromLRI(); + static int32_t adjustRowNumberIfValid(int32_t rowIndicatorRowNumber, int32_t invalidRowCounts, CBC_Codeword* codeword); + void adjustRowNumbers(int32_t barcodeColumn, int32_t codewordsRow, CFX_PtrArray* codewords); static FX_BOOL adjustRowNumber(CBC_Codeword* codeword, CBC_Codeword* otherCodeword); diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp index 6d949b7640..f4da542130 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.cpp @@ -24,7 +24,7 @@ #include "BC_PDF417Codeword.h" #include "BC_PDF417BoundingBox.h" #include "BC_PDF417DetectionResultColumn.h" -FX_INT32 CBC_DetectionResultColumn::MAX_NEARBY_DISTANCE = 5; +int32_t CBC_DetectionResultColumn::MAX_NEARBY_DISTANCE = 5; CBC_DetectionResultColumn::CBC_DetectionResultColumn(CBC_BoundingBox* boundingBox) { m_boundingBox = boundingBox; @@ -33,20 +33,20 @@ CBC_DetectionResultColumn::CBC_DetectionResultColumn(CBC_BoundingBox* boundingBo } CBC_DetectionResultColumn::~CBC_DetectionResultColumn() { - for (FX_INT32 i = 0; i < m_codewords->GetSize(); i++) { + for (int32_t i = 0; i < m_codewords->GetSize(); i++) { delete (CBC_Codeword*)m_codewords->GetAt(i); } m_codewords->RemoveAll(); delete m_codewords; } -CBC_Codeword* CBC_DetectionResultColumn::getCodewordNearby(FX_INT32 imageRow) +CBC_Codeword* CBC_DetectionResultColumn::getCodewordNearby(int32_t imageRow) { CBC_Codeword* codeword = getCodeword(imageRow); if (codeword != NULL) { return codeword; } - for (FX_INT32 i = 1; i < MAX_NEARBY_DISTANCE; i++) { - FX_INT32 nearImageRow = imageRowToCodewordIndex(imageRow) - i; + for (int32_t i = 1; i < MAX_NEARBY_DISTANCE; i++) { + int32_t nearImageRow = imageRowToCodewordIndex(imageRow) - i; if (nearImageRow >= 0) { codeword = (CBC_Codeword*)m_codewords->GetAt(nearImageRow); if (codeword != NULL) { @@ -63,19 +63,19 @@ CBC_Codeword* CBC_DetectionResultColumn::getCodewordNearby(FX_INT32 imageRow) } return NULL; } -FX_INT32 CBC_DetectionResultColumn::imageRowToCodewordIndex(FX_INT32 imageRow) +int32_t CBC_DetectionResultColumn::imageRowToCodewordIndex(int32_t imageRow) { return imageRow - m_boundingBox->getMinY(); } -FX_INT32 CBC_DetectionResultColumn::codewordIndexToImageRow(FX_INT32 codewordIndex) +int32_t CBC_DetectionResultColumn::codewordIndexToImageRow(int32_t codewordIndex) { return m_boundingBox->getMinY() + codewordIndex; } -void CBC_DetectionResultColumn::setCodeword(FX_INT32 imageRow, CBC_Codeword* codeword) +void CBC_DetectionResultColumn::setCodeword(int32_t imageRow, CBC_Codeword* codeword) { m_codewords->SetAt(imageRowToCodewordIndex(imageRow), codeword); } -CBC_Codeword* CBC_DetectionResultColumn::getCodeword(FX_INT32 imageRow) +CBC_Codeword* CBC_DetectionResultColumn::getCodeword(int32_t imageRow) { return (CBC_Codeword*)m_codewords->GetAt(imageRowToCodewordIndex(imageRow)); } @@ -90,8 +90,8 @@ CFX_PtrArray* CBC_DetectionResultColumn::getCodewords() CFX_ByteString CBC_DetectionResultColumn::toString() { CFX_ByteString result; - FX_INT32 row = 0; - for (FX_INT32 i = 0; i < m_codewords->GetSize(); i++) { + int32_t row = 0; + for (int32_t i = 0; i < m_codewords->GetSize(); i++) { CBC_Codeword* codeword = (CBC_Codeword*)m_codewords->GetAt(i); if (codeword == NULL) { result += (FX_CHAR) row; diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.h b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.h index 202272d2e9..9940998282 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultColumn.h @@ -13,11 +13,11 @@ class CBC_DetectionResultColumn public: CBC_DetectionResultColumn(CBC_BoundingBox* boundingBox); virtual ~CBC_DetectionResultColumn(); - CBC_Codeword* getCodewordNearby(FX_INT32 imageRow); - FX_INT32 imageRowToCodewordIndex(FX_INT32 imageRow); - FX_INT32 codewordIndexToImageRow(FX_INT32 codewordIndex); - void setCodeword(FX_INT32 imageRow, CBC_Codeword* codeword); - CBC_Codeword* getCodeword(FX_INT32 imageRow); + CBC_Codeword* getCodewordNearby(int32_t imageRow); + int32_t imageRowToCodewordIndex(int32_t imageRow); + int32_t codewordIndexToImageRow(int32_t codewordIndex); + void setCodeword(int32_t imageRow, CBC_Codeword* codeword); + CBC_Codeword* getCodeword(int32_t imageRow); CBC_BoundingBox* getBoundingBox(); CFX_PtrArray* getCodewords(); CFX_ByteString toString(); @@ -25,6 +25,6 @@ public: CBC_BoundingBox* m_boundingBox; CFX_PtrArray* m_codewords; private: - static FX_INT32 MAX_NEARBY_DISTANCE; + static int32_t MAX_NEARBY_DISTANCE; }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp index 89e46a74cd..12622c3dff 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.cpp @@ -39,14 +39,14 @@ CBC_DetectionResultRowIndicatorColumn::~CBC_DetectionResultRowIndicatorColumn() } void CBC_DetectionResultRowIndicatorColumn::setRowNumbers() { - for (FX_INT32 i = 0; i < m_codewords->GetSize(); i++) { + for (int32_t i = 0; i < m_codewords->GetSize(); i++) { CBC_Codeword * codeword = (CBC_Codeword*)m_codewords->GetAt(i); if (codeword != NULL) { codeword->setRowNumberAsRowIndicatorColumn(); } } } -FX_INT32 CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata) +int32_t CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata) { CFX_PtrArray* codewords = getCodewords(); setRowNumbers(); @@ -54,18 +54,18 @@ FX_INT32 CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRow CBC_BoundingBox* boundingBox = getBoundingBox(); CBC_ResultPoint* top = m_isLeft ? boundingBox->getTopLeft() : boundingBox->getTopRight(); CBC_ResultPoint* bottom = m_isLeft ? boundingBox->getBottomLeft() : boundingBox->getBottomRight(); - FX_INT32 firstRow = imageRowToCodewordIndex((FX_INT32) top->GetY()); - FX_INT32 lastRow = imageRowToCodewordIndex((FX_INT32) bottom->GetY()); + int32_t firstRow = imageRowToCodewordIndex((int32_t) top->GetY()); + int32_t lastRow = imageRowToCodewordIndex((int32_t) bottom->GetY()); FX_FLOAT averageRowHeight = (lastRow - firstRow) / (FX_FLOAT) barcodeMetadata.getRowCount(); - FX_INT32 barcodeRow = -1; - FX_INT32 maxRowHeight = 1; - FX_INT32 currentRowHeight = 0; - for (FX_INT32 codewordsRow = firstRow; codewordsRow < lastRow; codewordsRow++) { + int32_t barcodeRow = -1; + int32_t maxRowHeight = 1; + int32_t currentRowHeight = 0; + for (int32_t codewordsRow = firstRow; codewordsRow < lastRow; codewordsRow++) { if (codewords->GetAt(codewordsRow) == NULL) { continue; } CBC_Codeword* codeword = (CBC_Codeword*)codewords->GetAt(codewordsRow); - FX_INT32 rowDifference = codeword->getRowNumber() - barcodeRow; + int32_t rowDifference = codeword->getRowNumber() - barcodeRow; if (rowDifference == 0) { currentRowHeight++; } else if (rowDifference == 1) { @@ -79,14 +79,14 @@ FX_INT32 CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRow } else if (rowDifference > codewordsRow) { codewords->SetAt(codewordsRow, NULL); } else { - FX_INT32 checkedRows; + int32_t checkedRows; if (maxRowHeight > 2) { checkedRows = (maxRowHeight - 2) * rowDifference; } else { checkedRows = rowDifference; } FX_BOOL closePreviousCodewordFound = checkedRows >= codewordsRow; - for (FX_INT32 i = 1; i <= checkedRows && !closePreviousCodewordFound; i++) { + for (int32_t i = 1; i <= checkedRows && !closePreviousCodewordFound; i++) { closePreviousCodewordFound = codewords->GetAt(codewordsRow - i) != NULL; } if (closePreviousCodewordFound) { @@ -97,9 +97,9 @@ FX_INT32 CBC_DetectionResultRowIndicatorColumn::adjustCompleteIndicatorColumnRow } } } - return (FX_INT32) (averageRowHeight + 0.5); + return (int32_t) (averageRowHeight + 0.5); } -CFX_Int32Array* CBC_DetectionResultRowIndicatorColumn::getRowHeights(FX_INT32 &e) +CFX_Int32Array* CBC_DetectionResultRowIndicatorColumn::getRowHeights(int32_t &e) { CBC_BarcodeMetadata* barcodeMetadata = getBarcodeMetadata(); if (barcodeMetadata == NULL) { @@ -109,7 +109,7 @@ CFX_Int32Array* CBC_DetectionResultRowIndicatorColumn::getRowHeights(FX_INT32 &e adjustIncompleteIndicatorColumnRowNumbers(*barcodeMetadata); CFX_Int32Array* result = FX_NEW CFX_Int32Array; result->SetSize(barcodeMetadata->getRowCount()); - for (FX_INT32 i = 0; i < getCodewords()->GetSize(); i++) { + for (int32_t i = 0; i < getCodewords()->GetSize(); i++) { CBC_Codeword* codeword = (CBC_Codeword*)getCodewords()->GetAt(i); if (codeword != NULL) { result->SetAt(codeword->getRowNumber(), result->GetAt(codeword->getRowNumber()) + 1); @@ -117,25 +117,25 @@ CFX_Int32Array* CBC_DetectionResultRowIndicatorColumn::getRowHeights(FX_INT32 &e } return result; } -FX_INT32 CBC_DetectionResultRowIndicatorColumn::adjustIncompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata) +int32_t CBC_DetectionResultRowIndicatorColumn::adjustIncompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata) { CBC_BoundingBox* boundingBox = getBoundingBox(); CBC_ResultPoint* top = m_isLeft ? boundingBox->getTopLeft() : boundingBox->getTopRight(); CBC_ResultPoint* bottom = m_isLeft ? boundingBox->getBottomLeft() : boundingBox->getBottomRight(); - FX_INT32 firstRow = imageRowToCodewordIndex((FX_INT32) top->GetY()); - FX_INT32 lastRow = imageRowToCodewordIndex((FX_INT32) bottom->GetY()); + int32_t firstRow = imageRowToCodewordIndex((int32_t) top->GetY()); + int32_t lastRow = imageRowToCodewordIndex((int32_t) bottom->GetY()); FX_FLOAT averageRowHeight = (lastRow - firstRow) / (FX_FLOAT) barcodeMetadata.getRowCount(); CFX_PtrArray* codewords = getCodewords(); - FX_INT32 barcodeRow = -1; - FX_INT32 maxRowHeight = 1; - FX_INT32 currentRowHeight = 0; - for (FX_INT32 codewordsRow = firstRow; codewordsRow < lastRow; codewordsRow++) { + int32_t barcodeRow = -1; + int32_t maxRowHeight = 1; + int32_t currentRowHeight = 0; + for (int32_t codewordsRow = firstRow; codewordsRow < lastRow; codewordsRow++) { if (codewords->GetAt(codewordsRow) == NULL) { continue; } CBC_Codeword* codeword = (CBC_Codeword*)codewords->GetAt(codewordsRow); codeword->setRowNumberAsRowIndicatorColumn(); - FX_INT32 rowDifference = codeword->getRowNumber() - barcodeRow; + int32_t rowDifference = codeword->getRowNumber() - barcodeRow; if (rowDifference == 0) { currentRowHeight++; } else if (rowDifference == 1) { @@ -149,7 +149,7 @@ FX_INT32 CBC_DetectionResultRowIndicatorColumn::adjustIncompleteIndicatorColumnR currentRowHeight = 1; } } - return (FX_INT32) (averageRowHeight + 0.5); + return (int32_t) (averageRowHeight + 0.5); } CBC_BarcodeMetadata* CBC_DetectionResultRowIndicatorColumn::getBarcodeMetadata() { @@ -158,14 +158,14 @@ CBC_BarcodeMetadata* CBC_DetectionResultRowIndicatorColumn::getBarcodeMetadata() CBC_BarcodeValue barcodeRowCountUpperPart; CBC_BarcodeValue barcodeRowCountLowerPart; CBC_BarcodeValue barcodeECLevel; - for (FX_INT32 i = 0; i < codewords->GetSize(); i++) { + for (int32_t i = 0; i < codewords->GetSize(); i++) { CBC_Codeword* codeword = (CBC_Codeword*)codewords->GetAt(i); if (codeword == NULL) { continue; } codeword->setRowNumberAsRowIndicatorColumn(); - FX_INT32 rowIndicatorValue = codeword->getValue() % 30; - FX_INT32 codewordRowNumber = codeword->getRowNumber(); + int32_t rowIndicatorValue = codeword->getValue() % 30; + int32_t codewordRowNumber = codeword->getRowNumber(); if (!m_isLeft) { codewordRowNumber += 2; } @@ -205,13 +205,13 @@ CFX_ByteString CBC_DetectionResultRowIndicatorColumn::toString() } void CBC_DetectionResultRowIndicatorColumn::removeIncorrectCodewords(CFX_PtrArray* codewords, CBC_BarcodeMetadata barcodeMetadata) { - for (FX_INT32 codewordRow = 0; codewordRow < codewords->GetSize(); codewordRow++) { + for (int32_t codewordRow = 0; codewordRow < codewords->GetSize(); codewordRow++) { CBC_Codeword* codeword = (CBC_Codeword*)codewords->GetAt(codewordRow); if (codeword == NULL) { continue; } - FX_INT32 rowIndicatorValue = codeword->getValue() % 30; - FX_INT32 codewordRowNumber = codeword->getRowNumber(); + int32_t rowIndicatorValue = codeword->getValue() % 30; + int32_t codewordRowNumber = codeword->getRowNumber(); if (codewordRowNumber > barcodeMetadata.getRowCount()) { codewords->SetAt(codewordRow, NULL); continue; diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.h b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.h index fbdd0f0ec4..f8092311c5 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectionResultRowIndicatorColumn.h @@ -15,9 +15,9 @@ public: CBC_DetectionResultRowIndicatorColumn(CBC_BoundingBox* boundingBox, FX_BOOL isLeft); virtual ~CBC_DetectionResultRowIndicatorColumn(); void setRowNumbers(); - FX_INT32 adjustCompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata); - CFX_Int32Array* getRowHeights(FX_INT32 &e); - FX_INT32 adjustIncompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata); + int32_t adjustCompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata); + CFX_Int32Array* getRowHeights(int32_t &e); + int32_t adjustIncompleteIndicatorColumnRowNumbers(CBC_BarcodeMetadata barcodeMetadata); CBC_BarcodeMetadata* getBarcodeMetadata(); FX_BOOL isLeft(); CFX_ByteString toString(); diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp index 8d1a86ec92..726e0ec94f 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.cpp @@ -28,26 +28,26 @@ #include "BC_PDF417DetectorResult.h" #include "BC_PDF417Detector.h" #define INTERGER_MAX 2147483647 -FX_INT32 CBC_Detector::INDEXES_START_PATTERN[] = {0, 4, 1, 5}; -FX_INT32 CBC_Detector::INDEXES_STOP_PATTERN[] = {6, 2, 7, 3}; -FX_INT32 CBC_Detector::INTEGER_MATH_SHIFT = 8; -FX_INT32 CBC_Detector::PATTERN_MATCH_RESULT_SCALE_FACTOR = 1 << INTEGER_MATH_SHIFT; -FX_INT32 CBC_Detector::MAX_AVG_VARIANCE = (FX_INT32) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f); -FX_INT32 CBC_Detector::MAX_INDIVIDUAL_VARIANCE = (FX_INT32) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.8f); -FX_INT32 CBC_Detector::START_PATTERN[] = {8, 1, 1, 1, 1, 1, 1, 3}; -FX_INT32 CBC_Detector::STOP_PATTERN[] = {7, 1, 1, 3, 1, 1, 1, 2, 1}; -FX_INT32 CBC_Detector::MAX_PIXEL_DRIFT = 3; -FX_INT32 CBC_Detector::MAX_PATTERN_DRIFT = 5; -FX_INT32 CBC_Detector::SKIPPED_ROW_COUNT_MAX = 25; -FX_INT32 CBC_Detector::ROW_STEP = 5; -FX_INT32 CBC_Detector::BARCODE_MIN_HEIGHT = 10; +int32_t CBC_Detector::INDEXES_START_PATTERN[] = {0, 4, 1, 5}; +int32_t CBC_Detector::INDEXES_STOP_PATTERN[] = {6, 2, 7, 3}; +int32_t CBC_Detector::INTEGER_MATH_SHIFT = 8; +int32_t CBC_Detector::PATTERN_MATCH_RESULT_SCALE_FACTOR = 1 << INTEGER_MATH_SHIFT; +int32_t CBC_Detector::MAX_AVG_VARIANCE = (int32_t) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f); +int32_t CBC_Detector::MAX_INDIVIDUAL_VARIANCE = (int32_t) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.8f); +int32_t CBC_Detector::START_PATTERN[] = {8, 1, 1, 1, 1, 1, 1, 3}; +int32_t CBC_Detector::STOP_PATTERN[] = {7, 1, 1, 3, 1, 1, 1, 2, 1}; +int32_t CBC_Detector::MAX_PIXEL_DRIFT = 3; +int32_t CBC_Detector::MAX_PATTERN_DRIFT = 5; +int32_t CBC_Detector::SKIPPED_ROW_COUNT_MAX = 25; +int32_t CBC_Detector::ROW_STEP = 5; +int32_t CBC_Detector::BARCODE_MIN_HEIGHT = 10; CBC_Detector::CBC_Detector() { } CBC_Detector::~CBC_Detector() { } -CBC_PDF417DetectorResult* CBC_Detector::detect(CBC_BinaryBitmap* image, FX_INT32 hints, FX_BOOL multiple, FX_INT32 &e) +CBC_PDF417DetectorResult* CBC_Detector::detect(CBC_BinaryBitmap* image, int32_t hints, FX_BOOL multiple, int32_t &e) { CBC_CommonBitMatrix* bitMatrix = image->GetBlackMatrix(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); @@ -65,12 +65,12 @@ CBC_PDF417DetectorResult* CBC_Detector::detect(CBC_BinaryBitmap* image, FX_INT32 } void CBC_Detector::rotate180(CBC_CommonBitMatrix* bitMatrix) { - FX_INT32 width = bitMatrix->GetWidth(); - FX_INT32 height = bitMatrix->GetHeight(); + int32_t width = bitMatrix->GetWidth(); + int32_t height = bitMatrix->GetHeight(); CBC_CommonBitArray* firstRowBitArray = FX_NEW CBC_CommonBitArray(width); CBC_CommonBitArray* secondRowBitArray = FX_NEW CBC_CommonBitArray(width); CBC_CommonBitArray* tmpBitArray = FX_NEW CBC_CommonBitArray(width); - for (FX_INT32 y = 0; y < (height + 1) >> 1; y++) { + for (int32_t y = 0; y < (height + 1) >> 1; y++) { CBC_CommonBitArray* temp = bitMatrix->GetRow(height - 1 - y, secondRowBitArray); CBC_CommonBitArray* tempfirstRow = firstRowBitArray; firstRowBitArray = bitMatrix->GetRow(y, tempfirstRow); @@ -91,8 +91,8 @@ CBC_CommonBitArray* CBC_Detector::mirror(CBC_CommonBitArray* input, CBC_CommonBi { CBC_CommonBitArray* array = FX_NEW CBC_CommonBitArray(result->GetSize()); array->Clear(); - FX_INT32 size = input->GetSize(); - for (FX_INT32 i = 0; i < size; i++) { + int32_t size = input->GetSize(); + for (int32_t i = 0; i < size; i++) { if (input->Get(i)) { array->Set(size - 1 - i); } @@ -102,8 +102,8 @@ CBC_CommonBitArray* CBC_Detector::mirror(CBC_CommonBitArray* input, CBC_CommonBi CFX_PtrArray* CBC_Detector::detect(FX_BOOL multiple, CBC_CommonBitMatrix* bitMatrix) { CFX_PtrArray* barcodeCoordinates = FX_NEW CFX_PtrArray; - FX_INT32 row = 0; - FX_INT32 column = 0; + int32_t row = 0; + int32_t column = 0; FX_BOOL foundBarcodeInRow = FALSE; while (row < bitMatrix->GetHeight()) { CFX_PtrArray* vertices = findVertices(bitMatrix, row, column); @@ -116,7 +116,7 @@ CFX_PtrArray* CBC_Detector::detect(FX_BOOL multiple, CBC_CommonBitMatrix* bitMat } foundBarcodeInRow = FALSE; column = 0; - for (FX_INT32 i = 0; i < barcodeCoordinates->GetSize(); i++) { + for (int32_t i = 0; i < barcodeCoordinates->GetSize(); i++) { CFX_PtrArray* barcodeCoordinate = (CFX_PtrArray*)barcodeCoordinates->GetAt(i); if (barcodeCoordinate->GetAt(1) != NULL) { row = row > ((CBC_ResultPoint*)barcodeCoordinate->GetAt(1))->GetY(); @@ -137,19 +137,19 @@ CFX_PtrArray* CBC_Detector::detect(FX_BOOL multiple, CBC_CommonBitMatrix* bitMat break; } if (vertices->GetAt(2) != NULL) { - column = (FX_INT32) ((CBC_ResultPoint*)vertices->GetAt(2))->GetX(); - row = (FX_INT32) ((CBC_ResultPoint*)vertices->GetAt(2))->GetY(); + column = (int32_t) ((CBC_ResultPoint*)vertices->GetAt(2))->GetX(); + row = (int32_t) ((CBC_ResultPoint*)vertices->GetAt(2))->GetY(); } else { - column = (FX_INT32) ((CBC_ResultPoint*)vertices->GetAt(4))->GetX(); - row = (FX_INT32) ((CBC_ResultPoint*)vertices->GetAt(4))->GetY(); + column = (int32_t) ((CBC_ResultPoint*)vertices->GetAt(4))->GetX(); + row = (int32_t) ((CBC_ResultPoint*)vertices->GetAt(4))->GetY(); } } return barcodeCoordinates; } -CFX_PtrArray* CBC_Detector::findVertices(CBC_CommonBitMatrix* matrix, FX_INT32 startRow, FX_INT32 startColumn) +CFX_PtrArray* CBC_Detector::findVertices(CBC_CommonBitMatrix* matrix, int32_t startRow, int32_t startColumn) { - FX_INT32 height = matrix->GetHeight(); - FX_INT32 width = matrix->GetWidth(); + int32_t height = matrix->GetHeight(); + int32_t width = matrix->GetWidth(); CFX_PtrArray* result = FX_NEW CFX_PtrArray; result->SetSize(8); CFX_PtrArray* startptr = findRowsWithPattern(matrix, height, width, startRow, startColumn, START_PATTERN, sizeof(START_PATTERN) / sizeof(START_PATTERN[0])); @@ -157,8 +157,8 @@ CFX_PtrArray* CBC_Detector::findVertices(CBC_CommonBitMatrix* matrix, FX_INT32 s startptr->RemoveAll(); delete startptr; if (result->GetAt(4) != NULL) { - startColumn = (FX_INT32) ((CBC_ResultPoint*)result->GetAt(4))->GetX(); - startRow = (FX_INT32) ((CBC_ResultPoint*)result->GetAt(4))->GetY(); + startColumn = (int32_t) ((CBC_ResultPoint*)result->GetAt(4))->GetX(); + startRow = (int32_t) ((CBC_ResultPoint*)result->GetAt(4))->GetY(); } CFX_PtrArray* stopptr = findRowsWithPattern(matrix, height, width, startRow, startColumn, STOP_PATTERN, sizeof(STOP_PATTERN) / sizeof(STOP_PATTERN[0])); copyToResult(result, stopptr, INDEXES_STOP_PATTERN, sizeof(INDEXES_STOP_PATTERN) / sizeof(INDEXES_STOP_PATTERN[0])); @@ -166,13 +166,13 @@ CFX_PtrArray* CBC_Detector::findVertices(CBC_CommonBitMatrix* matrix, FX_INT32 s delete stopptr; return result; } -void CBC_Detector::copyToResult(CFX_PtrArray *result, CFX_PtrArray* tmpResult, FX_INT32* destinationIndexes, FX_INT32 destinationLength) +void CBC_Detector::copyToResult(CFX_PtrArray *result, CFX_PtrArray* tmpResult, int32_t* destinationIndexes, int32_t destinationLength) { - for (FX_INT32 i = 0; i < destinationLength; i++) { + for (int32_t i = 0; i < destinationLength; i++) { result->SetAt(destinationIndexes[i], tmpResult->GetAt(i)); } } -CFX_PtrArray* CBC_Detector::findRowsWithPattern(CBC_CommonBitMatrix* matrix, FX_INT32 height, FX_INT32 width, FX_INT32 startRow, FX_INT32 startColumn, FX_INT32* pattern, FX_INT32 patternLength) +CFX_PtrArray* CBC_Detector::findRowsWithPattern(CBC_CommonBitMatrix* matrix, int32_t height, int32_t width, int32_t startRow, int32_t startColumn, int32_t* pattern, int32_t patternLength) { CFX_PtrArray* result = FX_NEW CFX_PtrArray; result->SetSize(4); @@ -199,12 +199,12 @@ CFX_PtrArray* CBC_Detector::findRowsWithPattern(CBC_CommonBitMatrix* matrix, FX_ break; } } - FX_INT32 stopRow = startRow + 1; + int32_t stopRow = startRow + 1; if (found) { - FX_INT32 skippedRowCount = 0; + int32_t skippedRowCount = 0; CFX_Int32Array previousRowLoc; - previousRowLoc.Add((FX_INT32)((CBC_ResultPoint*)result->GetAt(0))->GetX()); - previousRowLoc.Add((FX_INT32)((CBC_ResultPoint*)result->GetAt(1))->GetX()); + previousRowLoc.Add((int32_t)((CBC_ResultPoint*)result->GetAt(0))->GetX()); + previousRowLoc.Add((int32_t)((CBC_ResultPoint*)result->GetAt(1))->GetX()); for (; stopRow < height; stopRow++) { CFX_Int32Array* loc = findGuardPattern(matrix, previousRowLoc[0], stopRow, width, FALSE, pattern, patternLength, counters); if (loc != NULL && @@ -227,26 +227,26 @@ CFX_PtrArray* CBC_Detector::findRowsWithPattern(CBC_CommonBitMatrix* matrix, FX_ result->SetAt(3, FX_NEW CBC_ResultPoint((FX_FLOAT)previousRowLoc.GetAt(1), (FX_FLOAT)stopRow)); } if (stopRow - startRow < BARCODE_MIN_HEIGHT) { - for (FX_INT32 i = 0; i < result->GetSize(); i++) { + for (int32_t i = 0; i < result->GetSize(); i++) { result->SetAt(i, NULL); } } return result; } -CFX_Int32Array* CBC_Detector::findGuardPattern(CBC_CommonBitMatrix* matrix, FX_INT32 column, FX_INT32 row, FX_INT32 width, FX_BOOL whiteFirst, FX_INT32* pattern, FX_INT32 patternLength, CFX_Int32Array &counters) +CFX_Int32Array* CBC_Detector::findGuardPattern(CBC_CommonBitMatrix* matrix, int32_t column, int32_t row, int32_t width, FX_BOOL whiteFirst, int32_t* pattern, int32_t patternLength, CFX_Int32Array &counters) { - for (FX_INT32 i = 0; i < counters.GetSize(); i++) { + for (int32_t i = 0; i < counters.GetSize(); i++) { counters.SetAt(i, 0); } FX_BOOL isWhite = whiteFirst; - FX_INT32 patternStart = column; - FX_INT32 pixelDrift = 0; + int32_t patternStart = column; + int32_t pixelDrift = 0; CFX_Int32Array* intarray = FX_NEW CFX_Int32Array; while (matrix->Get(patternStart, row) && patternStart > 0 && pixelDrift++ < MAX_PIXEL_DRIFT) { patternStart--; } - FX_INT32 x = patternStart; - FX_INT32 counterPosition = 0; + int32_t x = patternStart; + int32_t counterPosition = 0; for (; x < width; x++) { FX_BOOL pixel = matrix->Get(x, row); if (pixel ^ isWhite) { @@ -259,7 +259,7 @@ CFX_Int32Array* CBC_Detector::findGuardPattern(CBC_CommonBitMatrix* matrix, FX_I return intarray; } patternStart += counters[0] + counters[1]; - for (FX_INT32 l = 2, k = 0; l < patternLength; l++, k++) { + for (int32_t l = 2, k = 0; l < patternLength; l++, k++) { counters.SetAt(k, counters.GetAt(l)); } counters.SetAt(patternLength - 2, 0); @@ -282,25 +282,25 @@ CFX_Int32Array* CBC_Detector::findGuardPattern(CBC_CommonBitMatrix* matrix, FX_I delete intarray; return NULL; } -FX_INT32 CBC_Detector::patternMatchVariance(CFX_Int32Array &counters, FX_INT32* pattern, FX_INT32 maxIndividualVariance) +int32_t CBC_Detector::patternMatchVariance(CFX_Int32Array &counters, int32_t* pattern, int32_t maxIndividualVariance) { - FX_INT32 numCounters = counters.GetSize(); - FX_INT32 total = 0; - FX_INT32 patternLength = 0; - for (FX_INT32 i = 0; i < numCounters; i++) { + int32_t numCounters = counters.GetSize(); + int32_t total = 0; + int32_t patternLength = 0; + for (int32_t i = 0; i < numCounters; i++) { total += counters[i]; patternLength += pattern[i]; } if (total < patternLength) { return INTERGER_MAX; } - FX_INT32 unitBarWidth = (total << INTEGER_MATH_SHIFT) / patternLength; + int32_t unitBarWidth = (total << INTEGER_MATH_SHIFT) / patternLength; maxIndividualVariance = (maxIndividualVariance * unitBarWidth) >> INTEGER_MATH_SHIFT; - FX_INT32 totalVariance = 0; - for (FX_INT32 x = 0; x < numCounters; x++) { - FX_INT32 counter = counters[x] << INTEGER_MATH_SHIFT; - FX_INT32 scaledPattern = pattern[x] * unitBarWidth; - FX_INT32 variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter; + int32_t totalVariance = 0; + for (int32_t x = 0; x < numCounters; x++) { + int32_t counter = counters[x] << INTEGER_MATH_SHIFT; + int32_t scaledPattern = pattern[x] * unitBarWidth; + int32_t variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter; if (variance > maxIndividualVariance) { return INTERGER_MAX; } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.h b/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.h index c160779122..93d5ff82a2 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Detector.h @@ -15,28 +15,28 @@ class CBC_Detector public: CBC_Detector(); virtual ~CBC_Detector(); - static CBC_PDF417DetectorResult* detect(CBC_BinaryBitmap* image, FX_INT32 hints, FX_BOOL multiple, FX_INT32 &e); + static CBC_PDF417DetectorResult* detect(CBC_BinaryBitmap* image, int32_t hints, FX_BOOL multiple, int32_t &e); static void rotate180(CBC_CommonBitMatrix* bitMatrix); static CBC_CommonBitArray* mirror(CBC_CommonBitArray* input, CBC_CommonBitArray* result); private: - static FX_INT32 INDEXES_START_PATTERN[]; - static FX_INT32 INDEXES_STOP_PATTERN[]; - static FX_INT32 INTEGER_MATH_SHIFT; - static FX_INT32 PATTERN_MATCH_RESULT_SCALE_FACTOR; - static FX_INT32 MAX_AVG_VARIANCE; - static FX_INT32 MAX_INDIVIDUAL_VARIANCE; - static FX_INT32 START_PATTERN[]; - static FX_INT32 STOP_PATTERN[]; - static FX_INT32 MAX_PIXEL_DRIFT; - static FX_INT32 MAX_PATTERN_DRIFT; - static FX_INT32 SKIPPED_ROW_COUNT_MAX; - static FX_INT32 ROW_STEP; - static FX_INT32 BARCODE_MIN_HEIGHT; + static int32_t INDEXES_START_PATTERN[]; + static int32_t INDEXES_STOP_PATTERN[]; + static int32_t INTEGER_MATH_SHIFT; + static int32_t PATTERN_MATCH_RESULT_SCALE_FACTOR; + static int32_t MAX_AVG_VARIANCE; + static int32_t MAX_INDIVIDUAL_VARIANCE; + static int32_t START_PATTERN[]; + static int32_t STOP_PATTERN[]; + static int32_t MAX_PIXEL_DRIFT; + static int32_t MAX_PATTERN_DRIFT; + static int32_t SKIPPED_ROW_COUNT_MAX; + static int32_t ROW_STEP; + static int32_t BARCODE_MIN_HEIGHT; static CFX_PtrArray* detect(FX_BOOL multiple, CBC_CommonBitMatrix* bitMatrix); - static CFX_PtrArray* findVertices(CBC_CommonBitMatrix* matrix, FX_INT32 startRow, FX_INT32 startColumn); - static void copyToResult(CFX_PtrArray* result, CFX_PtrArray* tmpResult, FX_INT32* destinationIndexes, FX_INT32 destinationLength); - static CFX_PtrArray* findRowsWithPattern(CBC_CommonBitMatrix* matrix, FX_INT32 height, FX_INT32 width, FX_INT32 startRow, FX_INT32 startColumn, FX_INT32* pattern, FX_INT32 patternLength); - static CFX_Int32Array* findGuardPattern(CBC_CommonBitMatrix* matrix, FX_INT32 column, FX_INT32 row, FX_INT32 width, FX_BOOL whiteFirst, FX_INT32* pattern, FX_INT32 patternLength, CFX_Int32Array &counters); - static FX_INT32 patternMatchVariance(CFX_Int32Array &counters, FX_INT32* pattern, FX_INT32 maxIndividualVariance); + static CFX_PtrArray* findVertices(CBC_CommonBitMatrix* matrix, int32_t startRow, int32_t startColumn); + static void copyToResult(CFX_PtrArray* result, CFX_PtrArray* tmpResult, int32_t* destinationIndexes, int32_t destinationLength); + static CFX_PtrArray* findRowsWithPattern(CBC_CommonBitMatrix* matrix, int32_t height, int32_t width, int32_t startRow, int32_t startColumn, int32_t* pattern, int32_t patternLength); + static CFX_Int32Array* findGuardPattern(CBC_CommonBitMatrix* matrix, int32_t column, int32_t row, int32_t width, FX_BOOL whiteFirst, int32_t* pattern, int32_t patternLength, CFX_Int32Array &counters); + static int32_t patternMatchVariance(CFX_Int32Array &counters, int32_t* pattern, int32_t maxIndividualVariance); }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectorResult.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectorResult.cpp index e082290011..7f65e04294 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417DetectorResult.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417DetectorResult.cpp @@ -31,9 +31,9 @@ CBC_PDF417DetectorResult::CBC_PDF417DetectorResult(CBC_CommonBitMatrix* bits, CF } CBC_PDF417DetectorResult::~CBC_PDF417DetectorResult() { - for (FX_INT32 i = 0; i < m_points->GetSize(); i++) { + for (int32_t i = 0; i < m_points->GetSize(); i++) { CFX_PtrArray* temp = (CFX_PtrArray*)m_points->GetAt(i); - for (FX_INT32 j = 0; j < temp->GetSize(); j++) { + for (int32_t j = 0; j < temp->GetSize(); j++) { delete (CBC_ResultPoint*)temp->GetAt(j); } temp->RemoveAll(); diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.cpp index 76d2e7bf88..189ed0831b 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.cpp @@ -23,7 +23,7 @@ #include "../barcode.h" #include "BC_PDF417Dimensions.h" -CBC_Dimensions::CBC_Dimensions(FX_INT32 minCols, FX_INT32 maxCols, FX_INT32 minRows, FX_INT32 maxRows) +CBC_Dimensions::CBC_Dimensions(int32_t minCols, int32_t maxCols, int32_t minRows, int32_t maxRows) { m_minCols = minCols; m_maxCols = maxCols; @@ -33,19 +33,19 @@ CBC_Dimensions::CBC_Dimensions(FX_INT32 minCols, FX_INT32 maxCols, FX_INT32 minR CBC_Dimensions::~CBC_Dimensions() { } -FX_INT32 CBC_Dimensions::getMinCols() +int32_t CBC_Dimensions::getMinCols() { return m_minCols; } -FX_INT32 CBC_Dimensions::getMaxCols() +int32_t CBC_Dimensions::getMaxCols() { return m_maxCols; } -FX_INT32 CBC_Dimensions::getMinRows() +int32_t CBC_Dimensions::getMinRows() { return m_minRows; } -FX_INT32 CBC_Dimensions::getMaxRows() +int32_t CBC_Dimensions::getMaxRows() { return m_maxRows; } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.h b/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.h index b8e9763081..b75b998fe7 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Dimensions.h @@ -9,16 +9,16 @@ class CBC_Dimensions { public: - CBC_Dimensions(FX_INT32 minCols, FX_INT32 maxCols, FX_INT32 minRows, FX_INT32 maxRows); + CBC_Dimensions(int32_t minCols, int32_t maxCols, int32_t minRows, int32_t maxRows); virtual ~CBC_Dimensions(); - FX_INT32 getMinCols(); - FX_INT32 getMaxCols(); - FX_INT32 getMinRows(); - FX_INT32 getMaxRows(); + int32_t getMinCols(); + int32_t getMaxCols(); + int32_t getMinRows(); + int32_t getMaxRows(); private: - FX_INT32 m_minCols; - FX_INT32 m_maxCols; - FX_INT32 m_minRows; - FX_INT32 m_maxRows; + int32_t m_minCols; + int32_t m_maxCols; + int32_t m_minRows; + int32_t m_maxRows; }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp index 23207ef959..d80a7f86ac 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp @@ -26,7 +26,7 @@ #include "BC_PDF417ECModulusGF.h" #include "BC_PDF417ECErrorCorrection.h" CBC_PDF417ECModulusGF* CBC_PDF417ECErrorCorrection::m_field = NULL; -void CBC_PDF417ECErrorCorrection::Initialize(FX_INT32 &e) +void CBC_PDF417ECErrorCorrection::Initialize(int32_t &e) { m_field = FX_NEW CBC_PDF417ECModulusGF(CBC_PDF417Common::NUMBER_OF_CODEWORDS, 3, e); } @@ -40,15 +40,15 @@ CBC_PDF417ECErrorCorrection::CBC_PDF417ECErrorCorrection() CBC_PDF417ECErrorCorrection::~CBC_PDF417ECErrorCorrection() { } -FX_INT32 CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array &received, FX_INT32 numECCodewords, CFX_Int32Array &erasures, FX_INT32 &e) +int32_t CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array &received, int32_t numECCodewords, CFX_Int32Array &erasures, int32_t &e) { CBC_PDF417ECModulusPoly poly(m_field, received, e); BC_EXCEPTION_CHECK_ReturnValue(e, -1); CFX_Int32Array S; S.SetSize(numECCodewords); FX_BOOL error = FALSE; - for (FX_INT32 l = numECCodewords; l > 0; l--) { - FX_INT32 eval = poly.evaluateAt(m_field->exp(l)); + for (int32_t l = numECCodewords; l > 0; l--) { + int32_t eval = poly.evaluateAt(m_field->exp(l)); S[numECCodewords - l] = eval; if (eval != 0) { error = TRUE; @@ -72,7 +72,7 @@ FX_INT32 CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array &received, FX_INT32 CBC_PDF417ECModulusPoly* omega = (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(1); CFX_Int32Array* errorLocations = findErrorLocations(sigma, e); if (e != BCExceptionNO) { - for (FX_INT32 i = 0; i < sigmaOmega->GetSize(); i++) { + for (int32_t i = 0; i < sigmaOmega->GetSize(); i++) { delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(i); } sigmaOmega->RemoveAll(); @@ -82,22 +82,22 @@ FX_INT32 CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array &received, FX_INT32 CFX_Int32Array* errorMagnitudes = findErrorMagnitudes(omega, sigma, *errorLocations, e); if (e != BCExceptionNO) { delete errorLocations; - for (FX_INT32 i = 0; i < sigmaOmega->GetSize(); i++) { + for (int32_t i = 0; i < sigmaOmega->GetSize(); i++) { delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(i); } sigmaOmega->RemoveAll(); delete sigmaOmega; return -1; } - for (FX_INT32 i = 0; i < errorLocations->GetSize(); i++) { - FX_INT32 log = m_field->log(errorLocations->GetAt(i), e);; + for (int32_t i = 0; i < errorLocations->GetSize(); i++) { + int32_t log = m_field->log(errorLocations->GetAt(i), e);; BC_EXCEPTION_CHECK_ReturnValue(e, -1); - FX_INT32 position = received.GetSize() - 1 - log; + int32_t position = received.GetSize() - 1 - log; if (position < 0) { e = BCExceptionChecksumException; delete errorLocations; delete errorMagnitudes; - for (FX_INT32 j = 0; j < sigmaOmega->GetSize(); j++) { + for (int32_t j = 0; j < sigmaOmega->GetSize(); j++) { delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(j); } sigmaOmega->RemoveAll(); @@ -106,17 +106,17 @@ FX_INT32 CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array &received, FX_INT32 } received[position] = m_field->subtract(received[position], errorMagnitudes->GetAt(i)); } - FX_INT32 result = errorLocations->GetSize(); + int32_t result = errorLocations->GetSize(); delete errorLocations; delete errorMagnitudes; - for (FX_INT32 k = 0; k < sigmaOmega->GetSize(); k++) { + for (int32_t k = 0; k < sigmaOmega->GetSize(); k++) { delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(k); } sigmaOmega->RemoveAll(); delete sigmaOmega; return result; } -CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECModulusPoly* a, CBC_PDF417ECModulusPoly* b, FX_INT32 R, FX_INT32 &e) +CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECModulusPoly* a, CBC_PDF417ECModulusPoly* b, int32_t R, int32_t &e) { if (a->getDegree() < b->getDegree()) { CBC_PDF417ECModulusPoly* temp = a; @@ -130,10 +130,10 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod CBC_PDF417ECModulusPoly* qtemp = NULL; CBC_PDF417ECModulusPoly* rtemp = NULL; CBC_PDF417ECModulusPoly* ttemp = NULL; - FX_INT32 i = 0; - FX_INT32 j = 0; - FX_INT32 m = 0; - FX_INT32 n = 0; + int32_t i = 0; + int32_t j = 0; + int32_t m = 0; + int32_t n = 0; while (r->getDegree() >= R / 2) { CBC_PDF417ECModulusPoly* rLastLast = rLast; CBC_PDF417ECModulusPoly* tLastLast = tLast; @@ -156,8 +156,8 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod } r = rLastLast; CBC_PDF417ECModulusPoly* q = m_field->getZero(); - FX_INT32 denominatorLeadingTerm = rLast->getCoefficient(rLast->getDegree()); - FX_INT32 dltInverse = m_field->inverse(denominatorLeadingTerm, e); + int32_t denominatorLeadingTerm = rLast->getCoefficient(rLast->getDegree()); + int32_t dltInverse = m_field->inverse(denominatorLeadingTerm, e); if (e != BCExceptionNO) { if (qtemp) { delete qtemp; @@ -171,8 +171,8 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod return NULL; } while (r->getDegree() >= rLast->getDegree() && !r->isZero()) { - FX_INT32 degreeDiff = r->getDegree() - rLast->getDegree(); - FX_INT32 scale = m_field->multiply(r->getCoefficient(r->getDegree()), dltInverse); + int32_t degreeDiff = r->getDegree() - rLast->getDegree(); + int32_t scale = m_field->multiply(r->getCoefficient(r->getDegree()), dltInverse); CBC_PDF417ECModulusPoly* buildmonomial = m_field->buildMonomial(degreeDiff, scale, e); if (e != BCExceptionNO) { if (qtemp) { @@ -273,8 +273,8 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod ttemp = t; j++; } - FX_INT32 aa = t->getCoefficient(1); - FX_INT32 sigmaTildeAtZero = t->getCoefficient(0); + int32_t aa = t->getCoefficient(1); + int32_t sigmaTildeAtZero = t->getCoefficient(0); if (sigmaTildeAtZero == 0) { e = BCExceptionChecksumException; if (rtemp) { @@ -285,7 +285,7 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod } return NULL; } - FX_INT32 inverse = m_field->inverse(sigmaTildeAtZero, e); + int32_t inverse = m_field->inverse(sigmaTildeAtZero, e); if (e != BCExceptionNO) { if (rtemp) { delete rtemp; @@ -315,13 +315,13 @@ CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod modulusPoly->Add(omega); return modulusPoly; } -CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorLocations(CBC_PDF417ECModulusPoly* errorLocator, FX_INT32 &e) +CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorLocations(CBC_PDF417ECModulusPoly* errorLocator, int32_t &e) { - FX_INT32 numErrors = errorLocator->getDegree(); + int32_t numErrors = errorLocator->getDegree(); CFX_Int32Array* result = FX_NEW CFX_Int32Array; result->SetSize(numErrors); - FX_INT32 ee = 0; - for (FX_INT32 i = 1; i < m_field->getSize() && ee < numErrors; i++) { + int32_t ee = 0; + for (int32_t i = 1; i < m_field->getSize() && ee < numErrors; i++) { if (errorLocator->evaluateAt(i) == 0) { result->SetAt(ee, m_field->inverse(i, e)); if (e != BCExceptionNO) { @@ -338,27 +338,27 @@ CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorLocations(CBC_PDF417ECModu } return result; } -CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorMagnitudes(CBC_PDF417ECModulusPoly* errorEvaluator, CBC_PDF417ECModulusPoly* errorLocator, CFX_Int32Array &errorLocations, FX_INT32 &e) +CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorMagnitudes(CBC_PDF417ECModulusPoly* errorEvaluator, CBC_PDF417ECModulusPoly* errorLocator, CFX_Int32Array &errorLocations, int32_t &e) { - FX_INT32 errorLocatorDegree = errorLocator->getDegree(); + int32_t errorLocatorDegree = errorLocator->getDegree(); CFX_Int32Array formalDerivativeCoefficients; formalDerivativeCoefficients.SetSize(errorLocatorDegree); - for (FX_INT32 l = 1; l <= errorLocatorDegree; l++) { + for (int32_t l = 1; l <= errorLocatorDegree; l++) { formalDerivativeCoefficients[errorLocatorDegree - l] = m_field->multiply(l, errorLocator->getCoefficient(l)); } CBC_PDF417ECModulusPoly formalDerivative(m_field, formalDerivativeCoefficients, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - FX_INT32 s = errorLocations.GetSize(); + int32_t s = errorLocations.GetSize(); CFX_Int32Array* result = FX_NEW CFX_Int32Array; result->SetSize(s); - for (FX_INT32 i = 0; i < s; i++) { - FX_INT32 xiInverse = m_field->inverse(errorLocations[i], e); + for (int32_t i = 0; i < s; i++) { + int32_t xiInverse = m_field->inverse(errorLocations[i], e); if (e != BCExceptionNO) { delete result; return NULL; } - FX_INT32 numerator = m_field->subtract(0, errorEvaluator->evaluateAt(xiInverse)); - FX_INT32 denominator = m_field->inverse(formalDerivative.evaluateAt(xiInverse), e); + int32_t numerator = m_field->subtract(0, errorEvaluator->evaluateAt(xiInverse)); + int32_t denominator = m_field->inverse(formalDerivative.evaluateAt(xiInverse), e); if (e != BCExceptionNO) { delete result; return NULL; diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h b/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h index 0fca2e6c39..c8a2058298 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.h @@ -13,13 +13,13 @@ class CBC_PDF417ECErrorCorrection public: CBC_PDF417ECErrorCorrection(); virtual ~CBC_PDF417ECErrorCorrection(); - static void Initialize(FX_INT32 &e); + static void Initialize(int32_t &e); static void Finalize(); - static FX_INT32 decode(CFX_Int32Array &received, FX_INT32 numECCodewords, CFX_Int32Array &erasures, FX_INT32 &e); + static int32_t decode(CFX_Int32Array &received, int32_t numECCodewords, CFX_Int32Array &erasures, int32_t &e); private: static CBC_PDF417ECModulusGF* m_field; - static CFX_PtrArray* runEuclideanAlgorithm(CBC_PDF417ECModulusPoly* a, CBC_PDF417ECModulusPoly* b, FX_INT32 R, FX_INT32 &e); - static CFX_Int32Array* findErrorLocations(CBC_PDF417ECModulusPoly* errorLocator, FX_INT32 &e); - static CFX_Int32Array* findErrorMagnitudes(CBC_PDF417ECModulusPoly* errorEvaluator, CBC_PDF417ECModulusPoly* errorLocator, CFX_Int32Array &errorLocations, FX_INT32 &e); + static CFX_PtrArray* runEuclideanAlgorithm(CBC_PDF417ECModulusPoly* a, CBC_PDF417ECModulusPoly* b, int32_t R, int32_t &e); + static CFX_Int32Array* findErrorLocations(CBC_PDF417ECModulusPoly* errorLocator, int32_t &e); + static CFX_Int32Array* findErrorMagnitudes(CBC_PDF417ECModulusPoly* errorEvaluator, CBC_PDF417ECModulusPoly* errorLocator, CFX_Int32Array &errorLocations, int32_t &e); }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp index 7619854bcb..1b41474bb3 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.cpp @@ -25,7 +25,7 @@ #include "BC_PDF417ECModulusPoly.h" #include "BC_PDF417ECModulusGF.h" CBC_PDF417ECModulusGF* CBC_PDF417ECModulusGF::PDF417_GF = NULL; -void CBC_PDF417ECModulusGF::Initialize(FX_INT32 &e) +void CBC_PDF417ECModulusGF::Initialize(int32_t &e) { PDF417_GF = FX_NEW CBC_PDF417ECModulusGF(CBC_PDF417Common::NUMBER_OF_CODEWORDS, 3, e); } @@ -33,17 +33,17 @@ void CBC_PDF417ECModulusGF::Finalize() { delete PDF417_GF; } -CBC_PDF417ECModulusGF::CBC_PDF417ECModulusGF(FX_INT32 modulus, FX_INT32 generator, FX_INT32 &e) +CBC_PDF417ECModulusGF::CBC_PDF417ECModulusGF(int32_t modulus, int32_t generator, int32_t &e) { m_modulus = modulus; m_expTable.SetSize(modulus); m_logTable.SetSize(modulus); - FX_INT32 x = 1; - for (FX_INT32 i = 0; i < modulus; i++) { + int32_t x = 1; + for (int32_t i = 0; i < modulus; i++) { m_expTable[i] = x; x = (x * generator) % modulus; } - for (FX_INT32 j = 0; j < modulus - 1; j++) { + for (int32_t j = 0; j < modulus - 1; j++) { m_logTable[m_expTable[j]] = j; } CFX_Int32Array zero; @@ -66,7 +66,7 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusGF::getOne() { return m_one; } -CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusGF::buildMonomial(FX_INT32 degree, FX_INT32 coefficient, FX_INT32 &e) +CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusGF::buildMonomial(int32_t degree, int32_t coefficient, int32_t &e) { if (degree < 0) { e = BCExceptionIllegalArgument; @@ -85,19 +85,19 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusGF::buildMonomial(FX_INT32 degree, F BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return modulusPoly; } -FX_INT32 CBC_PDF417ECModulusGF::add(FX_INT32 a, FX_INT32 b) +int32_t CBC_PDF417ECModulusGF::add(int32_t a, int32_t b) { return (a + b) % m_modulus; } -FX_INT32 CBC_PDF417ECModulusGF::subtract(FX_INT32 a, FX_INT32 b) +int32_t CBC_PDF417ECModulusGF::subtract(int32_t a, int32_t b) { return (m_modulus + a - b) % m_modulus; } -FX_INT32 CBC_PDF417ECModulusGF::exp(FX_INT32 a) +int32_t CBC_PDF417ECModulusGF::exp(int32_t a) { return m_expTable[a]; } -FX_INT32 CBC_PDF417ECModulusGF::log(FX_INT32 a, FX_INT32 &e) +int32_t CBC_PDF417ECModulusGF::log(int32_t a, int32_t &e) { if (a == 0) { e = BCExceptionIllegalArgument; @@ -105,7 +105,7 @@ FX_INT32 CBC_PDF417ECModulusGF::log(FX_INT32 a, FX_INT32 &e) } return m_logTable[a]; } -FX_INT32 CBC_PDF417ECModulusGF::inverse(FX_INT32 a, FX_INT32 &e) +int32_t CBC_PDF417ECModulusGF::inverse(int32_t a, int32_t &e) { if (a == 0) { e = BCExceptionIllegalArgument; @@ -113,14 +113,14 @@ FX_INT32 CBC_PDF417ECModulusGF::inverse(FX_INT32 a, FX_INT32 &e) } return m_expTable[m_modulus - m_logTable[a] - 1]; } -FX_INT32 CBC_PDF417ECModulusGF::multiply(FX_INT32 a, FX_INT32 b) +int32_t CBC_PDF417ECModulusGF::multiply(int32_t a, int32_t b) { if (a == 0 || b == 0) { return 0; } return m_expTable[(m_logTable[a] + m_logTable[b]) % (m_modulus - 1)]; } -FX_INT32 CBC_PDF417ECModulusGF::getSize() +int32_t CBC_PDF417ECModulusGF::getSize() { return m_modulus; } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.h b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.h index fbb79e3586..ee19117242 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusGF.h @@ -11,26 +11,26 @@ class CBC_PDF417Common; class CBC_PDF417ECModulusGF { public: - CBC_PDF417ECModulusGF(FX_INT32 modulus, FX_INT32 generator, FX_INT32 &e); + CBC_PDF417ECModulusGF(int32_t modulus, int32_t generator, int32_t &e); virtual ~CBC_PDF417ECModulusGF(); - static void Initialize(FX_INT32 &e); + static void Initialize(int32_t &e); static void Finalize(); CBC_PDF417ECModulusPoly* getZero(); CBC_PDF417ECModulusPoly* getOne(); - CBC_PDF417ECModulusPoly* buildMonomial(FX_INT32 degree, FX_INT32 coefficient, FX_INT32 &e); - FX_INT32 add(FX_INT32 a, FX_INT32 b); - FX_INT32 subtract(FX_INT32 a, FX_INT32 b); - FX_INT32 exp(FX_INT32 a); - FX_INT32 log(FX_INT32 a, FX_INT32 &e); - FX_INT32 inverse(FX_INT32 a, FX_INT32 &e); - FX_INT32 multiply(FX_INT32 a, FX_INT32 b); - FX_INT32 getSize(); + CBC_PDF417ECModulusPoly* buildMonomial(int32_t degree, int32_t coefficient, int32_t &e); + int32_t add(int32_t a, int32_t b); + int32_t subtract(int32_t a, int32_t b); + int32_t exp(int32_t a); + int32_t log(int32_t a, int32_t &e); + int32_t inverse(int32_t a, int32_t &e); + int32_t multiply(int32_t a, int32_t b); + int32_t getSize(); static CBC_PDF417ECModulusGF* PDF417_GF; private: CFX_Int32Array m_expTable; CFX_Int32Array m_logTable; CBC_PDF417ECModulusPoly* m_zero; CBC_PDF417ECModulusPoly* m_one; - FX_INT32 m_modulus; + int32_t m_modulus; }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp index 39d3fd8056..686b2badca 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.cpp @@ -24,15 +24,15 @@ #include "BC_PDF417Common.h" #include "BC_PDF417ECModulusGF.h" #include "BC_PDF417ECModulusPoly.h" -CBC_PDF417ECModulusPoly::CBC_PDF417ECModulusPoly(CBC_PDF417ECModulusGF* field, CFX_Int32Array &coefficients, FX_INT32 &e) +CBC_PDF417ECModulusPoly::CBC_PDF417ECModulusPoly(CBC_PDF417ECModulusGF* field, CFX_Int32Array &coefficients, int32_t &e) { if (coefficients.GetSize() == 0) { e = BCExceptionIllegalArgument; } m_field = field; - FX_INT32 coefficientsLength = coefficients.GetSize(); + int32_t coefficientsLength = coefficients.GetSize(); if (coefficientsLength > 1 && coefficients[0] == 0) { - FX_INT32 firstNonZero = 1; + int32_t firstNonZero = 1; while (firstNonZero < coefficientsLength && coefficients[firstNonZero] == 0) { firstNonZero++; } @@ -40,8 +40,8 @@ CBC_PDF417ECModulusPoly::CBC_PDF417ECModulusPoly(CBC_PDF417ECModulusGF* field, C m_coefficients = field->getZero()->m_coefficients; } else { m_coefficients.SetSize(coefficientsLength - firstNonZero); - FX_INT32 l = 0; - for (FX_INT32 i = firstNonZero; i < firstNonZero + m_coefficients.GetSize(); i++) { + int32_t l = 0; + for (int32_t i = firstNonZero; i < firstNonZero + m_coefficients.GetSize(); i++) { m_coefficients.SetAt(l, coefficients.GetAt(i)); l++; } @@ -61,7 +61,7 @@ CBC_PDF417ECModulusGF* CBC_PDF417ECModulusPoly::getField() { return m_field; } -FX_INT32 CBC_PDF417ECModulusPoly::getDegree() +int32_t CBC_PDF417ECModulusPoly::getDegree() { return m_coefficients.GetSize() - 1; } @@ -69,31 +69,31 @@ FX_BOOL CBC_PDF417ECModulusPoly::isZero() { return m_coefficients[0] == 0; } -FX_INT32 CBC_PDF417ECModulusPoly::getCoefficient(FX_INT32 degree) +int32_t CBC_PDF417ECModulusPoly::getCoefficient(int32_t degree) { return m_coefficients[m_coefficients.GetSize() - 1 - degree]; } -FX_INT32 CBC_PDF417ECModulusPoly::evaluateAt(FX_INT32 a) +int32_t CBC_PDF417ECModulusPoly::evaluateAt(int32_t a) { if (a == 0) { return getCoefficient(0); } - FX_INT32 size = m_coefficients.GetSize(); + int32_t size = m_coefficients.GetSize(); if (a == 1) { - FX_INT32 result = 0; - for (FX_INT32 l = 0; l < m_coefficients.GetSize(); l++) { - FX_INT32 coefficient = m_coefficients.GetAt(l); + int32_t result = 0; + for (int32_t l = 0; l < m_coefficients.GetSize(); l++) { + int32_t coefficient = m_coefficients.GetAt(l); result = m_field->add(result, coefficient); } return result; } - FX_INT32 result = m_coefficients[0]; - for (FX_INT32 i = 1; i < size; i++) { + int32_t result = m_coefficients[0]; + for (int32_t i = 1; i < size; i++) { result = m_field->add(m_field->multiply(a, result), m_coefficients[i]); } return result; } -CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::add(CBC_PDF417ECModulusPoly* other, FX_INT32 &e) +CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::add(CBC_PDF417ECModulusPoly* other, int32_t &e) { CBC_PDF417ECModulusPoly* modulusPoly = NULL; if (isZero()) { @@ -118,18 +118,18 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::add(CBC_PDF417ECModulusPoly* o } CFX_Int32Array sumDiff; sumDiff.SetSize(largerCoefficients.GetSize()); - FX_INT32 lengthDiff = largerCoefficients.GetSize() - smallerCoefficients.GetSize(); - for (FX_INT32 l = 0; l < lengthDiff; l++) { + int32_t lengthDiff = largerCoefficients.GetSize() - smallerCoefficients.GetSize(); + for (int32_t l = 0; l < lengthDiff; l++) { sumDiff.SetAt(l, largerCoefficients.GetAt(l)); } - for (FX_INT32 i = lengthDiff; i < largerCoefficients.GetSize(); i++) { + for (int32_t i = lengthDiff; i < largerCoefficients.GetSize(); i++) { sumDiff[i] = m_field->add(smallerCoefficients[i - lengthDiff], largerCoefficients[i]); } modulusPoly = FX_NEW CBC_PDF417ECModulusPoly(m_field, sumDiff, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return modulusPoly; } -CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::subtract(CBC_PDF417ECModulusPoly* other, FX_INT32 &e) +CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::subtract(CBC_PDF417ECModulusPoly* other, int32_t &e) { CBC_PDF417ECModulusPoly* modulusPoly = NULL; if (other->isZero()) { @@ -144,7 +144,7 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::subtract(CBC_PDF417ECModulusPo BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return modulusPoly; } -CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(CBC_PDF417ECModulusPoly* other, FX_INT32 &e) +CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(CBC_PDF417ECModulusPoly* other, int32_t &e) { CBC_PDF417ECModulusPoly* modulusPoly = NULL; if (isZero() || other->isZero()) { @@ -154,15 +154,15 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(CBC_PDF417ECModulusPo } CFX_Int32Array aCoefficients; aCoefficients.Copy(m_coefficients); - FX_INT32 aLength = aCoefficients.GetSize(); + int32_t aLength = aCoefficients.GetSize(); CFX_Int32Array bCoefficients; bCoefficients.Copy(other->m_coefficients); - FX_INT32 bLength = bCoefficients.GetSize(); + int32_t bLength = bCoefficients.GetSize(); CFX_Int32Array product; product.SetSize(aLength + bLength - 1); - for (FX_INT32 i = 0; i < aLength; i++) { - FX_INT32 aCoeff = aCoefficients[i]; - for (FX_INT32 j = 0; j < bLength; j++) { + for (int32_t i = 0; i < aLength; i++) { + int32_t aCoeff = aCoefficients[i]; + for (int32_t j = 0; j < bLength; j++) { product[i + j] = m_field->add(product[i + j], m_field->multiply(aCoeff, bCoefficients[j])); } } @@ -170,19 +170,19 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(CBC_PDF417ECModulusPo BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return modulusPoly; } -CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::negative(FX_INT32 &e) +CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::negative(int32_t &e) { - FX_INT32 size = m_coefficients.GetSize(); + int32_t size = m_coefficients.GetSize(); CFX_Int32Array negativeCoefficients; negativeCoefficients.SetSize(size); - for (FX_INT32 i = 0; i < size; i++) { + for (int32_t i = 0; i < size; i++) { negativeCoefficients[i] = m_field->subtract(0, m_coefficients[i]); } CBC_PDF417ECModulusPoly* modulusPoly = FX_NEW CBC_PDF417ECModulusPoly(m_field, negativeCoefficients, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return modulusPoly; } -CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(FX_INT32 scalar, FX_INT32 &e) +CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(int32_t scalar, int32_t &e) { CBC_PDF417ECModulusPoly* modulusPoly = NULL; if (scalar == 0) { @@ -195,17 +195,17 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(FX_INT32 scalar, FX_I BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return modulusPoly; } - FX_INT32 size = m_coefficients.GetSize(); + int32_t size = m_coefficients.GetSize(); CFX_Int32Array product; product.SetSize(size); - for (FX_INT32 i = 0; i < size; i++) { + for (int32_t i = 0; i < size; i++) { product[i] = m_field->multiply(m_coefficients[i], scalar); } modulusPoly = FX_NEW CBC_PDF417ECModulusPoly(m_field, product, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return modulusPoly; } -CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiplyByMonomial(FX_INT32 degree, FX_INT32 coefficient, FX_INT32 &e) +CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiplyByMonomial(int32_t degree, int32_t coefficient, int32_t &e) { if (degree < 0) { e = BCExceptionIllegalArgument; @@ -217,17 +217,17 @@ CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiplyByMonomial(FX_INT32 de BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return modulusPoly; } - FX_INT32 size = m_coefficients.GetSize(); + int32_t size = m_coefficients.GetSize(); CFX_Int32Array product; product.SetSize(size + degree); - for (FX_INT32 i = 0; i < size; i++) { + for (int32_t i = 0; i < size; i++) { product[i] = m_field->multiply(m_coefficients[i], coefficient); } modulusPoly = FX_NEW CBC_PDF417ECModulusPoly(m_field, product, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return modulusPoly; } -CFX_PtrArray* CBC_PDF417ECModulusPoly::divide(CBC_PDF417ECModulusPoly* other, FX_INT32 &e) +CFX_PtrArray* CBC_PDF417ECModulusPoly::divide(CBC_PDF417ECModulusPoly* other, int32_t &e) { if (other->isZero()) { e = BCExceptionDivideByZero; @@ -240,16 +240,16 @@ CFX_PtrArray* CBC_PDF417ECModulusPoly::divide(CBC_PDF417ECModulusPoly* other, FX delete quotient; return NULL; } - FX_INT32 denominatorLeadingTerm = other->getCoefficient(other->getDegree()); - FX_INT32 inverseDenominatorLeadingTerm = m_field->inverse(denominatorLeadingTerm, e); + int32_t denominatorLeadingTerm = other->getCoefficient(other->getDegree()); + int32_t inverseDenominatorLeadingTerm = m_field->inverse(denominatorLeadingTerm, e); if (e != BCExceptionNO) { delete quotient; delete remainder; return NULL; } while (remainder->getDegree() >= other->getDegree() && !remainder->isZero()) { - FX_INT32 degreeDifference = remainder->getDegree() - other->getDegree(); - FX_INT32 scale = m_field->multiply(remainder->getCoefficient(remainder->getDegree()), inverseDenominatorLeadingTerm); + int32_t degreeDifference = remainder->getDegree() - other->getDegree(); + int32_t scale = m_field->multiply(remainder->getCoefficient(remainder->getDegree()), inverseDenominatorLeadingTerm); CBC_PDF417ECModulusPoly* term = other->multiplyByMonomial(degreeDifference, scale, e); if (e != BCExceptionNO) { delete quotient; @@ -288,8 +288,8 @@ CFX_PtrArray* CBC_PDF417ECModulusPoly::divide(CBC_PDF417ECModulusPoly* other, FX CFX_ByteString CBC_PDF417ECModulusPoly::toString() { CFX_ByteString result; - for (FX_INT32 degree = getDegree(); degree >= 0; degree--) { - FX_INT32 coefficient = getCoefficient(degree); + for (int32_t degree = getDegree(); degree >= 0; degree--) { + int32_t coefficient = getCoefficient(degree); if (coefficient != 0) { if (coefficient < 0) { result += " - "; diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.h b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.h index 172cc76cc8..72c8d3eb35 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ECModulusPoly.h @@ -10,21 +10,21 @@ class CBC_PDF417ECModulusGF; class CBC_PDF417ECModulusPoly { public: - CBC_PDF417ECModulusPoly(CBC_PDF417ECModulusGF* field, CFX_Int32Array &coefficients, FX_INT32 &e); + CBC_PDF417ECModulusPoly(CBC_PDF417ECModulusGF* field, CFX_Int32Array &coefficients, int32_t &e); virtual ~CBC_PDF417ECModulusPoly(); CFX_Int32Array& getCoefficients(); CBC_PDF417ECModulusGF* getField(); - FX_INT32 getDegree(); + int32_t getDegree(); FX_BOOL isZero(); - FX_INT32 getCoefficient(FX_INT32 degree); - FX_INT32 evaluateAt(FX_INT32 a); - CBC_PDF417ECModulusPoly* add(CBC_PDF417ECModulusPoly* other, FX_INT32 &e); - CBC_PDF417ECModulusPoly* subtract(CBC_PDF417ECModulusPoly* other, FX_INT32 &e); - CBC_PDF417ECModulusPoly* multiply(CBC_PDF417ECModulusPoly* other, FX_INT32 &e); - CBC_PDF417ECModulusPoly* negative(FX_INT32 &e); - CBC_PDF417ECModulusPoly* multiply(FX_INT32 scalar, FX_INT32 &e); - CBC_PDF417ECModulusPoly* multiplyByMonomial(FX_INT32 degree, FX_INT32 coefficient, FX_INT32 &e); - CFX_PtrArray* divide(CBC_PDF417ECModulusPoly* other, FX_INT32 &e); + int32_t getCoefficient(int32_t degree); + int32_t evaluateAt(int32_t a); + CBC_PDF417ECModulusPoly* add(CBC_PDF417ECModulusPoly* other, int32_t &e); + CBC_PDF417ECModulusPoly* subtract(CBC_PDF417ECModulusPoly* other, int32_t &e); + CBC_PDF417ECModulusPoly* multiply(CBC_PDF417ECModulusPoly* other, int32_t &e); + CBC_PDF417ECModulusPoly* negative(int32_t &e); + CBC_PDF417ECModulusPoly* multiply(int32_t scalar, int32_t &e); + CBC_PDF417ECModulusPoly* multiplyByMonomial(int32_t degree, int32_t coefficient, int32_t &e); + CFX_PtrArray* divide(CBC_PDF417ECModulusPoly* other, int32_t &e); CFX_ByteString toString(); private: CBC_PDF417ECModulusGF* m_field; diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp index cd1ea88046..9dd6f67575 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp @@ -22,7 +22,7 @@ #include "../barcode.h" #include "BC_PDF417ErrorCorrection.h" -FX_INT32 CBC_PDF417ErrorCorrection::EC_COEFFICIENTS[][2500] = { +int32_t CBC_PDF417ErrorCorrection::EC_COEFFICIENTS[][2500] = { {27, 917}, {522, 568, 723, 809}, {237, 308, 436, 284, 646, 653, 428, 379}, @@ -132,7 +132,7 @@ CBC_PDF417ErrorCorrection::CBC_PDF417ErrorCorrection() CBC_PDF417ErrorCorrection::~CBC_PDF417ErrorCorrection() { } -FX_INT32 CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(FX_INT32 errorCorrectionLevel, FX_INT32 &e) +int32_t CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(int32_t errorCorrectionLevel, int32_t &e) { if (errorCorrectionLevel < 0 || errorCorrectionLevel > 8) { e = BCExceptionErrorCorrectionLevelMustBeBetween0And8; @@ -140,7 +140,7 @@ FX_INT32 CBC_PDF417ErrorCorrection::getErrorCorrectionCodewordCount(FX_INT32 err } return 1 << (errorCorrectionLevel + 1); } -FX_INT32 CBC_PDF417ErrorCorrection::getRecommendedMinimumErrorCorrectionLevel(FX_INT32 n, FX_INT32 &e) +int32_t CBC_PDF417ErrorCorrection::getRecommendedMinimumErrorCorrectionLevel(int32_t n, int32_t &e) { if (n <= 0) { e = BCExceptionIllegalArgumentnMustBeAbove0; @@ -161,18 +161,18 @@ FX_INT32 CBC_PDF417ErrorCorrection::getRecommendedMinimumErrorCorrectionLevel(FX e = BCExceptionNoRecommendationPossible; return -1; } -CFX_WideString CBC_PDF417ErrorCorrection::generateErrorCorrection(CFX_WideString dataCodewords, FX_INT32 errorCorrectionLevel, FX_INT32 &e) +CFX_WideString CBC_PDF417ErrorCorrection::generateErrorCorrection(CFX_WideString dataCodewords, int32_t errorCorrectionLevel, int32_t &e) { - FX_INT32 k = getErrorCorrectionCodewordCount(errorCorrectionLevel, e); + int32_t k = getErrorCorrectionCodewordCount(errorCorrectionLevel, e); BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR)' '); FX_WCHAR* ech = FX_Alloc(FX_WCHAR, k * sizeof(FX_WCHAR)); FXSYS_memset32(ech, 0, k * sizeof(FX_WCHAR)); - FX_INT32 sld = dataCodewords.GetLength(); - for (FX_INT32 i = 0; i < sld; i++) { - FX_INT32 t1 = (dataCodewords.GetAt(i) + ech[k - 1]) % 929; - FX_INT32 t2; - FX_INT32 t3; - for (FX_INT32 j = k - 1; j >= 1; j--) { + int32_t sld = dataCodewords.GetLength(); + for (int32_t i = 0; i < sld; i++) { + int32_t t1 = (dataCodewords.GetAt(i) + ech[k - 1]) % 929; + int32_t t2; + int32_t t3; + for (int32_t j = k - 1; j >= 1; j--) { t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][j]) % 929; t3 = 929 - t2; ech[j] = (FX_WCHAR) ((ech[j - 1] + t3) % 929); @@ -182,7 +182,7 @@ CFX_WideString CBC_PDF417ErrorCorrection::generateErrorCorrection(CFX_WideString ech[0] = (FX_WCHAR) (t3 % 929); } CFX_WideString sb; - for (FX_INT32 j = k - 1; j >= 0; j--) { + for (int32_t j = k - 1; j >= 0; j--) { if (ech[j] != 0) { ech[j] = (FX_WCHAR) (929 - ech[j]); } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h b/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h index 9af8b72f17..4e5dee0bb8 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ErrorCorrection.h @@ -11,10 +11,10 @@ class CBC_PDF417ErrorCorrection public: CBC_PDF417ErrorCorrection(); virtual ~CBC_PDF417ErrorCorrection(); - static FX_INT32 getErrorCorrectionCodewordCount(FX_INT32 errorCorrectionLevel, FX_INT32 &e); - static FX_INT32 getRecommendedMinimumErrorCorrectionLevel(FX_INT32 n, FX_INT32 &e); - static CFX_WideString generateErrorCorrection(CFX_WideString dataCodewords, FX_INT32 errorCorrectionLevel, FX_INT32 &e); + static int32_t getErrorCorrectionCodewordCount(int32_t errorCorrectionLevel, int32_t &e); + static int32_t getRecommendedMinimumErrorCorrectionLevel(int32_t n, int32_t &e); + static CFX_WideString generateErrorCorrection(CFX_WideString dataCodewords, int32_t errorCorrectionLevel, int32_t &e); private: - static FX_INT32 EC_COEFFICIENTS[][2500]; + static int32_t EC_COEFFICIENTS[][2500]; }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp index 54bd0b6c6a..85c01d60b0 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp @@ -28,23 +28,23 @@ #define SUBMODE_ALPHA 0 #define SUBMODE_LOWER 1 #define SUBMODE_MIXED 2 -FX_INT32 CBC_PDF417HighLevelEncoder::TEXT_COMPACTION = 0; -FX_INT32 CBC_PDF417HighLevelEncoder::BYTE_COMPACTION = 1; -FX_INT32 CBC_PDF417HighLevelEncoder::NUMERIC_COMPACTION = 2; -FX_INT32 CBC_PDF417HighLevelEncoder::SUBMODE_PUNCTUATION = 3; -FX_INT32 CBC_PDF417HighLevelEncoder::LATCH_TO_TEXT = 900; -FX_INT32 CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE_PADDED = 901; -FX_INT32 CBC_PDF417HighLevelEncoder::LATCH_TO_NUMERIC = 902; -FX_INT32 CBC_PDF417HighLevelEncoder::SHIFT_TO_BYTE = 913; -FX_INT32 CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE = 924; -FX_BYTE CBC_PDF417HighLevelEncoder::TEXT_MIXED_RAW[] = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 38, 13, 9, 44, 58, +int32_t CBC_PDF417HighLevelEncoder::TEXT_COMPACTION = 0; +int32_t CBC_PDF417HighLevelEncoder::BYTE_COMPACTION = 1; +int32_t CBC_PDF417HighLevelEncoder::NUMERIC_COMPACTION = 2; +int32_t CBC_PDF417HighLevelEncoder::SUBMODE_PUNCTUATION = 3; +int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_TEXT = 900; +int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE_PADDED = 901; +int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_NUMERIC = 902; +int32_t CBC_PDF417HighLevelEncoder::SHIFT_TO_BYTE = 913; +int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE = 924; +uint8_t CBC_PDF417HighLevelEncoder::TEXT_MIXED_RAW[] = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 38, 13, 9, 44, 58, 35, 45, 46, 36, 47, 43, 37, 42, 61, 94, 0, 32, 0, 0, 0 }; -FX_BYTE CBC_PDF417HighLevelEncoder::TEXT_PUNCTUATION_RAW[] = {59, 60, 62, 64, 91, 92, 93, 95, 96, 126, 33, 13, 9, 44, 58, +uint8_t CBC_PDF417HighLevelEncoder::TEXT_PUNCTUATION_RAW[] = {59, 60, 62, 64, 91, 92, 93, 95, 96, 126, 33, 13, 9, 44, 58, 10, 45, 46, 36, 47, 34, 124, 42, 40, 41, 63, 123, 125, 39, 0 }; -FX_INT32 CBC_PDF417HighLevelEncoder::MIXED[128] = {0}; -FX_INT32 CBC_PDF417HighLevelEncoder::PUNCTUATION[128] = {0}; +int32_t CBC_PDF417HighLevelEncoder::MIXED[128] = {0}; +int32_t CBC_PDF417HighLevelEncoder::PUNCTUATION[128] = {0}; void CBC_PDF417HighLevelEncoder::Initialize() { Inverse(); @@ -52,13 +52,13 @@ void CBC_PDF417HighLevelEncoder::Initialize() void CBC_PDF417HighLevelEncoder::Finalize() { } -CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMsg, Compaction compaction, FX_INT32 &e) +CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMsg, Compaction compaction, int32_t &e) { CFX_ByteString bytes; CBC_UtilCodingConvert::UnicodeToUTF8(wideMsg, bytes); CFX_WideString msg; - FX_INT32 len = bytes.GetLength(); - for (FX_INT32 i = 0; i < len; i++) { + int32_t len = bytes.GetLength(); + for (int32_t i = 0; i < len; i++) { FX_WCHAR ch = (FX_WCHAR)(bytes.GetAt(i) & 0xff); if (ch == '?' && bytes.GetAt(i) != '?') { e = BCExceptionCharactersOutsideISO88591Encoding; @@ -67,13 +67,13 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMs msg += ch; } CFX_ByteArray byteArr; - for (FX_INT32 k = 0; k < bytes.GetLength(); k++) { + for (int32_t k = 0; k < bytes.GetLength(); k++) { byteArr.Add(bytes.GetAt(k)); } CFX_WideString sb; len = msg.GetLength(); - FX_INT32 p = 0; - FX_INT32 textSubMode = SUBMODE_ALPHA; + int32_t p = 0; + int32_t textSubMode = SUBMODE_ALPHA; if (compaction == TEXT) { encodeText(msg, p, len, sb, textSubMode); } else if (compaction == BYTES) { @@ -82,9 +82,9 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMs sb += (FX_WCHAR) LATCH_TO_NUMERIC; encodeNumeric(msg, p, len, sb); } else { - FX_INT32 encodingMode = LATCH_TO_TEXT; + int32_t encodingMode = LATCH_TO_TEXT; while (p < len) { - FX_INT32 n = determineConsecutiveDigitCount(msg, p); + int32_t n = determineConsecutiveDigitCount(msg, p); if (n >= 13) { sb += (FX_WCHAR) LATCH_TO_NUMERIC; encodingMode = NUMERIC_COMPACTION; @@ -92,7 +92,7 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMs encodeNumeric(msg, p, n, sb); p += n; } else { - FX_INT32 t = determineConsecutiveTextCount(msg, p); + int32_t t = determineConsecutiveTextCount(msg, p); if (t >= 5 || n == len) { if (encodingMode != TEXT_COMPACTION) { sb += (FX_WCHAR) LATCH_TO_TEXT; @@ -102,7 +102,7 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMs textSubMode = encodeText(msg, p, t, sb, textSubMode); p += t; } else { - FX_INT32 b = determineConsecutiveBinaryCount(msg, &byteArr, p, e); + int32_t b = determineConsecutiveBinaryCount(msg, &byteArr, p, e); BC_EXCEPTION_CHECK_ReturnValue(e, (FX_WCHAR)' '); if (b == 0) { b = 1; @@ -123,13 +123,13 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(CFX_WideString wideMs } void CBC_PDF417HighLevelEncoder::Inverse() { - FX_BYTE i = 0; - FX_INT32 l = 0; + uint8_t i = 0; + int32_t l = 0; for (l = 0; l < sizeof(MIXED) / sizeof(MIXED[0]); l++) { MIXED[l] = -1; } for (i = 0; i < sizeof(TEXT_MIXED_RAW) / sizeof(TEXT_MIXED_RAW[0]); i++) { - FX_BYTE b = TEXT_MIXED_RAW[i]; + uint8_t b = TEXT_MIXED_RAW[i]; if (b > 0) { MIXED[b] = i; } @@ -138,17 +138,17 @@ void CBC_PDF417HighLevelEncoder::Inverse() PUNCTUATION[l] = -1; } for (i = 0; i < sizeof(TEXT_PUNCTUATION_RAW) / sizeof(TEXT_PUNCTUATION_RAW[0]); i++) { - FX_BYTE b = TEXT_PUNCTUATION_RAW[i]; + uint8_t b = TEXT_PUNCTUATION_RAW[i]; if (b > 0) { PUNCTUATION[b] = i; } } } -FX_INT32 CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, FX_INT32 startpos, FX_INT32 count, CFX_WideString &sb, FX_INT32 initialSubmode) +int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, int32_t startpos, int32_t count, CFX_WideString &sb, int32_t initialSubmode) { CFX_WideString tmp; - FX_INT32 submode = initialSubmode; - FX_INT32 idx = 0; + int32_t submode = initialSubmode; + int32_t idx = 0; while (TRUE) { FX_WCHAR ch = msg.GetAt(startpos + idx); switch (submode) { @@ -201,7 +201,7 @@ FX_INT32 CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, FX_INT32 sta case SUBMODE_MIXED: if (isMixed(ch)) { FX_WCHAR a = MIXED[ch]; - FX_INT32 b = (FX_INT32)a; + int32_t b = (int32_t)a; tmp += MIXED[ch]; } else { if (isAlphaUpper(ch)) { @@ -241,8 +241,8 @@ FX_INT32 CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, FX_INT32 sta } } FX_WCHAR h = 0; - FX_INT32 len = tmp.GetLength(); - for (FX_INT32 i = 0; i < len; i++) { + int32_t len = tmp.GetLength(); + for (int32_t i = 0; i < len; i++) { FX_BOOL odd = (i % 2) != 0; if (odd) { h = (FX_WCHAR) ((h * 30) + tmp.GetAt(i)); @@ -256,18 +256,18 @@ FX_INT32 CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, FX_INT32 sta } return submode; } -void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ByteArray* bytes, FX_INT32 startpos, FX_INT32 count, FX_INT32 startmode, CFX_WideString &sb) +void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ByteArray* bytes, int32_t startpos, int32_t count, int32_t startmode, CFX_WideString &sb) { if (count == 1 && startmode == TEXT_COMPACTION) { sb += (FX_WCHAR) SHIFT_TO_BYTE; } - FX_INT32 idx = startpos; - FX_INT32 i = 0; + int32_t idx = startpos; + int32_t i = 0; if (count >= 6) { sb += (FX_WCHAR) LATCH_TO_BYTE; FX_WCHAR chars[5]; while ((startpos + count - idx) >= 6) { - FX_INT64 t = 0; + int64_t t = 0; for (i = 0; i < 6; i++) { t <<= 8; t += bytes->GetAt(idx + i) & 0xff; @@ -286,25 +286,25 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ByteArray* bytes, FX_INT32 sta sb += (FX_WCHAR) LATCH_TO_BYTE_PADDED; } for (i = idx; i < startpos + count; i++) { - FX_INT32 ch = bytes->GetAt(i) & 0xff; + int32_t ch = bytes->GetAt(i) & 0xff; sb += (FX_WCHAR) ch; } } -void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg, FX_INT32 startpos, FX_INT32 count, CFX_WideString &sb) +void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg, int32_t startpos, int32_t count, CFX_WideString &sb) { - FX_INT32 idx = 0; + int32_t idx = 0; BigInteger num900 = 900; while (idx < count) { CFX_WideString tmp; - FX_INT32 len = 44 < count - idx ? 44 : count - idx; + int32_t len = 44 < count - idx ? 44 : count - idx; CFX_ByteString part = ((FX_WCHAR)'1' + msg.Mid(startpos + idx, len)).UTF8Encode(); BigInteger bigint = stringToBigInteger(part.c_str()); do { - FX_INT32 c = (bigint % num900).toInt(); + int32_t c = (bigint % num900).toInt(); tmp += (FX_WCHAR)(c); bigint = bigint / num900; } while (!bigint.isZero()); - for (FX_INT32 i = tmp.GetLength() - 1; i >= 0; i--) { + for (int32_t i = tmp.GetLength() - 1; i >= 0; i--) { sb += tmp.GetAt(i); } idx += len; @@ -334,11 +334,11 @@ FX_BOOL CBC_PDF417HighLevelEncoder::isText(FX_WCHAR ch) { return ch == '\t' || ch == '\n' || ch == '\r' || (ch >= 32 && ch <= 126); } -FX_INT32 CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg, FX_INT32 startpos) +int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideString msg, int32_t startpos) { - FX_INT32 count = 0; - FX_INT32 len = msg.GetLength(); - FX_INT32 idx = startpos; + int32_t count = 0; + int32_t len = msg.GetLength(); + int32_t idx = startpos; if (idx < len) { FX_WCHAR ch = msg.GetAt(idx); while (isDigit(ch) && idx < len) { @@ -351,13 +351,13 @@ FX_INT32 CBC_PDF417HighLevelEncoder::determineConsecutiveDigitCount(CFX_WideStri } return count; } -FX_INT32 CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(CFX_WideString msg, FX_INT32 startpos) +int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(CFX_WideString msg, int32_t startpos) { - FX_INT32 len = msg.GetLength(); - FX_INT32 idx = startpos; + int32_t len = msg.GetLength(); + int32_t idx = startpos; while (idx < len) { FX_WCHAR ch = msg.GetAt(idx); - FX_INT32 numericCount = 0; + int32_t numericCount = 0; while (numericCount < 13 && isDigit(ch) && idx < len) { numericCount++; idx++; @@ -379,16 +379,16 @@ FX_INT32 CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(CFX_WideStrin } return idx - startpos; } -FX_INT32 CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount(CFX_WideString msg, CFX_ByteArray* bytes, FX_INT32 startpos, FX_INT32 &e) +int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount(CFX_WideString msg, CFX_ByteArray* bytes, int32_t startpos, int32_t &e) { - FX_INT32 len = msg.GetLength(); - FX_INT32 idx = startpos; + int32_t len = msg.GetLength(); + int32_t idx = startpos; while (idx < len) { FX_WCHAR ch = msg.GetAt(idx); - FX_INT32 numericCount = 0; + int32_t numericCount = 0; while (numericCount < 13 && isDigit(ch)) { numericCount++; - FX_INT32 i = idx + numericCount; + int32_t i = idx + numericCount; if (i >= len) { break; } @@ -397,10 +397,10 @@ FX_INT32 CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount(CFX_WideStr if (numericCount >= 13) { return idx - startpos; } - FX_INT32 textCount = 0; + int32_t textCount = 0; while (textCount < 5 && isText(ch)) { textCount++; - FX_INT32 i = idx + textCount; + int32_t i = idx + textCount; if (i >= len) { break; } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h index 7c8801cb21..177507c4f5 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h @@ -12,36 +12,36 @@ class CBC_PDF417HighLevelEncoder { public: - static CFX_WideString encodeHighLevel(CFX_WideString msg, Compaction compaction, FX_INT32 &e); + static CFX_WideString encodeHighLevel(CFX_WideString msg, Compaction compaction, int32_t &e); static void Inverse(); static void Initialize(); static void Finalize(); private: - static FX_INT32 TEXT_COMPACTION; - static FX_INT32 BYTE_COMPACTION; - static FX_INT32 NUMERIC_COMPACTION; - static FX_INT32 SUBMODE_PUNCTUATION; - static FX_INT32 LATCH_TO_TEXT; - static FX_INT32 LATCH_TO_BYTE_PADDED; - static FX_INT32 LATCH_TO_NUMERIC; - static FX_INT32 SHIFT_TO_BYTE; - static FX_INT32 LATCH_TO_BYTE; - static FX_BYTE TEXT_MIXED_RAW[]; - static FX_BYTE TEXT_PUNCTUATION_RAW[]; - static FX_INT32 MIXED[128]; - static FX_INT32 PUNCTUATION[128]; - static FX_INT32 encodeText(CFX_WideString msg, FX_INT32 startpos, FX_INT32 count, CFX_WideString &sb, FX_INT32 initialSubmode); - static void encodeBinary(CFX_ByteArray* bytes, FX_INT32 startpos, FX_INT32 count, FX_INT32 startmode, CFX_WideString &sb); - static void encodeNumeric(CFX_WideString msg, FX_INT32 startpos, FX_INT32 count, CFX_WideString &sb); + static int32_t TEXT_COMPACTION; + static int32_t BYTE_COMPACTION; + static int32_t NUMERIC_COMPACTION; + static int32_t SUBMODE_PUNCTUATION; + static int32_t LATCH_TO_TEXT; + static int32_t LATCH_TO_BYTE_PADDED; + static int32_t LATCH_TO_NUMERIC; + static int32_t SHIFT_TO_BYTE; + static int32_t LATCH_TO_BYTE; + static uint8_t TEXT_MIXED_RAW[]; + static uint8_t TEXT_PUNCTUATION_RAW[]; + static int32_t MIXED[128]; + static int32_t PUNCTUATION[128]; + static int32_t encodeText(CFX_WideString msg, int32_t startpos, int32_t count, CFX_WideString &sb, int32_t initialSubmode); + static void encodeBinary(CFX_ByteArray* bytes, int32_t startpos, int32_t count, int32_t startmode, CFX_WideString &sb); + static void encodeNumeric(CFX_WideString msg, int32_t startpos, int32_t count, CFX_WideString &sb); static FX_BOOL isDigit(FX_WCHAR ch); static FX_BOOL isAlphaUpper(FX_WCHAR ch); static FX_BOOL isAlphaLower(FX_WCHAR ch); static FX_BOOL isMixed(FX_WCHAR ch); static FX_BOOL isPunctuation(FX_WCHAR ch); static FX_BOOL isText(FX_WCHAR ch); - static FX_INT32 determineConsecutiveDigitCount(CFX_WideString msg, FX_INT32 startpos); - static FX_INT32 determineConsecutiveTextCount(CFX_WideString msg, FX_INT32 startpos); - static FX_INT32 determineConsecutiveBinaryCount(CFX_WideString msg, CFX_ByteArray* bytes, FX_INT32 startpos, FX_INT32 &e); + static int32_t determineConsecutiveDigitCount(CFX_WideString msg, int32_t startpos); + static int32_t determineConsecutiveTextCount(CFX_WideString msg, int32_t startpos); + static int32_t determineConsecutiveBinaryCount(CFX_WideString msg, CFX_ByteArray* bytes, int32_t startpos, int32_t &e); friend class PDF417HighLevelEncoder_EncodeNumeric_Test; friend class PDF417HighLevelEncoder_EncodeBinary_Test; diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp index ed751cc4ba..a880317ee0 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp @@ -57,16 +57,16 @@ CBC_PDF417Reader::CBC_PDF417Reader() CBC_PDF417Reader::~CBC_PDF417Reader() { } -CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, FX_INT32 &e) +CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, int32_t &e) { return Decode(image, 0, e); } -CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, FX_BOOL multiple, FX_INT32 hints, FX_INT32 &e) +CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, FX_BOOL multiple, int32_t hints, int32_t &e) { CFX_ByteString results; CBC_PDF417DetectorResult* detectorResult = CBC_Detector::detect(image, hints, multiple, e); BC_EXCEPTION_CHECK_ReturnValue(e, ""); - for (FX_INT32 i = 0; i < detectorResult->getPoints()->GetSize(); i++) { + for (int32_t i = 0; i < detectorResult->getPoints()->GetSize(); i++) { CFX_PtrArray* points = (CFX_PtrArray*)detectorResult->getPoints()->GetAt(i); CBC_CommonDecoderResult* ResultTemp = CBC_PDF417ScanningDecoder::decode(detectorResult->getBits(), (CBC_ResultPoint*)points->GetAt(4), (CBC_ResultPoint*)points->GetAt(5), (CBC_ResultPoint*)points->GetAt(6), (CBC_ResultPoint*)points->GetAt(7), getMinCodewordWidth(*points), getMaxCodewordWidth(*points), e); @@ -81,39 +81,39 @@ CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, FX_BOOL multipl delete detectorResult; return results; } -CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e) +CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e) { CFX_ByteString bs = Decode(image, FALSE, 0, e); BC_EXCEPTION_CHECK_ReturnValue(e, ""); return bs; } -FX_INT32 CBC_PDF417Reader::getMaxWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2) +int32_t CBC_PDF417Reader::getMaxWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2) { if (p1 == NULL || p2 == NULL) { return 0; } - return (FX_INT32) FXSYS_fabs(p1->GetX() - p2->GetX()); + return (int32_t) FXSYS_fabs(p1->GetX() - p2->GetX()); } -FX_INT32 CBC_PDF417Reader::getMinWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2) +int32_t CBC_PDF417Reader::getMinWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2) { if (p1 == NULL || p2 == NULL) { return Integer_MAX_VALUE; } - return (FX_INT32) FXSYS_fabs(p1->GetX() - p2->GetX()); + return (int32_t) FXSYS_fabs(p1->GetX() - p2->GetX()); } -FX_INT32 CBC_PDF417Reader::getMaxCodewordWidth(CFX_PtrArray& p) +int32_t CBC_PDF417Reader::getMaxCodewordWidth(CFX_PtrArray& p) { - FX_INT32 a = getMaxWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN; - FX_INT32 b = getMaxWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN; - FX_INT32 c = getMaxWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) < a ? getMaxWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) : a; - FX_INT32 d = getMaxWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) < b ? getMaxWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) : b; + int32_t a = getMaxWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN; + int32_t b = getMaxWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN; + int32_t c = getMaxWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) < a ? getMaxWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) : a; + int32_t d = getMaxWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) < b ? getMaxWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) : b; return c < d ? c : d; } -FX_INT32 CBC_PDF417Reader::getMinCodewordWidth(CFX_PtrArray& p) +int32_t CBC_PDF417Reader::getMinCodewordWidth(CFX_PtrArray& p) { - FX_INT32 a = getMinWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN; - FX_INT32 b = getMinWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN; - FX_INT32 c = getMinWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) < a ? getMinWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) : a; - FX_INT32 d = getMinWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) < b ? getMinWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) : b; + int32_t a = getMinWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN; + int32_t b = getMinWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN; + int32_t c = getMinWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) < a ? getMinWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) : a; + int32_t d = getMinWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) < b ? getMinWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) : b; return c < d ? c : d; } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.h b/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.h index e6c0236cf7..031829d8e6 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.h @@ -14,13 +14,13 @@ class CBC_PDF417Reader : public CBC_Reader public: CBC_PDF417Reader(); virtual ~CBC_PDF417Reader(); - CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 &e); - CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_BOOL multiple, FX_INT32 hints, FX_INT32 &e); - CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e); + CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t &e); + CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_BOOL multiple, int32_t hints, int32_t &e); + CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e); private: - static FX_INT32 getMaxWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2); - static FX_INT32 getMinWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2); - static FX_INT32 getMaxCodewordWidth(CFX_PtrArray& p); - static FX_INT32 getMinCodewordWidth(CFX_PtrArray& p); + static int32_t getMaxWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2); + static int32_t getMinWidth(CBC_ResultPoint* p1, CBC_ResultPoint* p2); + static int32_t getMaxCodewordWidth(CFX_PtrArray& p); + static int32_t getMinCodewordWidth(CFX_PtrArray& p); }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.cpp index 393ee2e75d..d99cefdb58 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.cpp @@ -28,11 +28,11 @@ CBC_PDF417ResultMetadata::CBC_PDF417ResultMetadata() CBC_PDF417ResultMetadata::~CBC_PDF417ResultMetadata() { } -FX_INT32 CBC_PDF417ResultMetadata::getSegmentIndex() +int32_t CBC_PDF417ResultMetadata::getSegmentIndex() { return m_segmentIndex; } -void CBC_PDF417ResultMetadata::setSegmentIndex(FX_INT32 segmentIndex) +void CBC_PDF417ResultMetadata::setSegmentIndex(int32_t segmentIndex) { m_segmentIndex = segmentIndex; } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.h b/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.h index 7639c032ba..d635137e9d 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ResultMetadata.h @@ -11,8 +11,8 @@ class CBC_PDF417ResultMetadata public: CBC_PDF417ResultMetadata(); virtual ~CBC_PDF417ResultMetadata(); - FX_INT32 getSegmentIndex(); - void setSegmentIndex(FX_INT32 segmentIndex); + int32_t getSegmentIndex(); + void setSegmentIndex(int32_t segmentIndex); CFX_ByteString getFileId(); void setFileId(CFX_ByteString fileId); CFX_Int32Array& getOptionalData(); @@ -20,7 +20,7 @@ public: FX_BOOL isLastSegment(); void setLastSegment(FX_BOOL lastSegment); private: - FX_INT32 m_segmentIndex; + int32_t m_segmentIndex; CFX_ByteString m_fileId; CFX_Int32Array m_optionalData; FX_BOOL m_lastSegment; diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp index 2b127ceb07..de43e65144 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.cpp @@ -40,9 +40,9 @@ #include "BC_PDF417ECErrorCorrection.h" #include "BC_PDF417DecodedBitStreamParser.h" #include "BC_PDF417ScanningDecoder.h" -FX_INT32 CBC_PDF417ScanningDecoder::CODEWORD_SKEW_SIZE = 2; -FX_INT32 CBC_PDF417ScanningDecoder::MAX_ERRORS = 3; -FX_INT32 CBC_PDF417ScanningDecoder::MAX_EC_CODEWORDS = 512; +int32_t CBC_PDF417ScanningDecoder::CODEWORD_SKEW_SIZE = 2; +int32_t CBC_PDF417ScanningDecoder::MAX_ERRORS = 3; +int32_t CBC_PDF417ScanningDecoder::MAX_EC_CODEWORDS = 512; CBC_PDF417ECErrorCorrection* CBC_PDF417ScanningDecoder::errorCorrection = NULL; CBC_PDF417ScanningDecoder::CBC_PDF417ScanningDecoder() { @@ -59,14 +59,14 @@ void CBC_PDF417ScanningDecoder::Finalize() delete errorCorrection; } CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(CBC_CommonBitMatrix* image, CBC_ResultPoint* imageTopLeft, CBC_ResultPoint* imageBottomLeft, CBC_ResultPoint* imageTopRight, - CBC_ResultPoint* imageBottomRight, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth, FX_INT32 &e) + CBC_ResultPoint* imageBottomRight, int32_t minCodewordWidth, int32_t maxCodewordWidth, int32_t &e) { CBC_BoundingBox* boundingBox = FX_NEW CBC_BoundingBox(image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn = NULL; CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn = NULL; CBC_DetectionResult* detectionResult = NULL; - for (FX_INT32 i = 0; i < 2; i++) { + for (int32_t i = 0; i < 2; i++) { if (imageTopLeft != NULL) { leftRowIndicatorColumn = getRowIndicatorColumn(image, boundingBox, *imageTopLeft, TRUE, minCodewordWidth, maxCodewordWidth); } @@ -89,12 +89,12 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(CBC_CommonBitMatrix* break; } } - FX_INT32 maxBarcodeColumn = detectionResult->getBarcodeColumnCount() + 1; + int32_t maxBarcodeColumn = detectionResult->getBarcodeColumnCount() + 1; detectionResult->setDetectionResultColumn(0, leftRowIndicatorColumn); detectionResult->setDetectionResultColumn(maxBarcodeColumn, rightRowIndicatorColumn); FX_BOOL leftToRight = leftRowIndicatorColumn != NULL; - for (FX_INT32 barcodeColumnCount = 1; barcodeColumnCount <= maxBarcodeColumn; barcodeColumnCount++) { - FX_INT32 barcodeColumn = leftToRight ? barcodeColumnCount : maxBarcodeColumn - barcodeColumnCount; + for (int32_t barcodeColumnCount = 1; barcodeColumnCount <= maxBarcodeColumn; barcodeColumnCount++) { + int32_t barcodeColumn = leftToRight ? barcodeColumnCount : maxBarcodeColumn - barcodeColumnCount; if (detectionResult->getDetectionResultColumn(barcodeColumn) != NULL) { continue; } @@ -105,9 +105,9 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(CBC_CommonBitMatrix* detectionResultColumn = FX_NEW CBC_DetectionResultColumn(boundingBox); } detectionResult->setDetectionResultColumn(barcodeColumn, detectionResultColumn); - FX_INT32 startColumn = -1; - FX_INT32 previousStartColumn = startColumn; - for (FX_INT32 imageRow = boundingBox->getMinY(); imageRow <= boundingBox->getMaxY(); imageRow++) { + int32_t startColumn = -1; + int32_t previousStartColumn = startColumn; + for (int32_t imageRow = boundingBox->getMinY(); imageRow <= boundingBox->getMaxY(); imageRow++) { startColumn = getStartColumn(detectionResult, barcodeColumn, imageRow, leftToRight); if (startColumn < 0 || startColumn > boundingBox->getMaxX()) { if (previousStartColumn == -1) { @@ -134,9 +134,9 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decode(CBC_CommonBitMatrix* CFX_ByteString CBC_PDF417ScanningDecoder::toString(CFX_PtrArray* barcodeMatrix) { CFX_ByteString result; - for (FX_INT32 row = 0; row < barcodeMatrix->GetSize(); row++) { + for (int32_t row = 0; row < barcodeMatrix->GetSize(); row++) { result += row; - FX_INT32 l = 0; + int32_t l = 0; for (; l < ((CFX_PtrArray*)barcodeMatrix->GetAt(row))->GetSize(); l++) { CBC_BarcodeValue* barcodeValue = (CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(row))->GetAt(l); if (barcodeValue->getValue()->GetSize() == 0) { @@ -149,7 +149,7 @@ CFX_ByteString CBC_PDF417ScanningDecoder::toString(CFX_PtrArray* barcodeMatrix) } return result; } -CBC_DetectionResult* CBC_PDF417ScanningDecoder::merge(CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, FX_INT32 &e) +CBC_DetectionResult* CBC_PDF417ScanningDecoder::merge(CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, int32_t &e) { if (leftRowIndicatorColumn == NULL && rightRowIndicatorColumn == NULL) { e = BCExceptionIllegalArgument; @@ -178,45 +178,45 @@ CBC_DetectionResult* CBC_PDF417ScanningDecoder::merge(CBC_DetectionResultRowIndi CBC_DetectionResult* detectionresult = FX_NEW CBC_DetectionResult(barcodeMetadata, boundingBox); return detectionresult; } -CBC_BoundingBox* CBC_PDF417ScanningDecoder::adjustBoundingBox(CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn, FX_INT32 &e) +CBC_BoundingBox* CBC_PDF417ScanningDecoder::adjustBoundingBox(CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn, int32_t &e) { if (rowIndicatorColumn == NULL) { return NULL; } CFX_Int32Array* rowHeights = rowIndicatorColumn->getRowHeights(e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - FX_INT32 maxRowHeight = getMax(*rowHeights); - FX_INT32 missingStartRows = 0; - for (FX_INT32 i = 0; i < rowHeights->GetSize(); i++) { - FX_INT32 rowHeight = rowHeights->GetAt(i); + int32_t maxRowHeight = getMax(*rowHeights); + int32_t missingStartRows = 0; + for (int32_t i = 0; i < rowHeights->GetSize(); i++) { + int32_t rowHeight = rowHeights->GetAt(i); missingStartRows += maxRowHeight - rowHeight; if (rowHeight > 0) { break; } } CFX_PtrArray* codewords = rowIndicatorColumn->getCodewords(); - for (FX_INT32 row = 0; missingStartRows > 0 && codewords->GetAt(row) == NULL; row++) { + for (int32_t row = 0; missingStartRows > 0 && codewords->GetAt(row) == NULL; row++) { missingStartRows--; } - FX_INT32 missingEndRows = 0; - for (FX_INT32 row1 = rowHeights->GetSize() - 1; row1 >= 0; row1--) { + int32_t missingEndRows = 0; + for (int32_t row1 = rowHeights->GetSize() - 1; row1 >= 0; row1--) { missingEndRows += maxRowHeight - rowHeights->GetAt(row1); if (rowHeights->GetAt(row1) > 0) { break; } } - for (FX_INT32 row2 = codewords->GetSize() - 1; missingEndRows > 0 && codewords->GetAt(row2) == NULL; row2--) { + for (int32_t row2 = codewords->GetSize() - 1; missingEndRows > 0 && codewords->GetAt(row2) == NULL; row2--) { missingEndRows--; } CBC_BoundingBox* boundingBox = rowIndicatorColumn->getBoundingBox()->addMissingRows(missingStartRows, missingEndRows, rowIndicatorColumn->isLeft(), e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return boundingBox; } -FX_INT32 CBC_PDF417ScanningDecoder::getMax(CFX_Int32Array& values) +int32_t CBC_PDF417ScanningDecoder::getMax(CFX_Int32Array& values) { - FX_INT32 maxValue = -1; - for (FX_INT32 i = 0; i < values.GetSize(); i++) { - FX_INT32 value = values.GetAt(i); + int32_t maxValue = -1; + for (int32_t i = 0; i < values.GetSize(); i++) { + int32_t value = values.GetAt(i); maxValue = maxValue > value ? maxValue : value; } return maxValue; @@ -243,13 +243,13 @@ CBC_BarcodeMetadata* CBC_PDF417ScanningDecoder::getBarcodeMetadata(CBC_Detection return leftBarcodeMetadata; } CBC_DetectionResultRowIndicatorColumn* CBC_PDF417ScanningDecoder::getRowIndicatorColumn(CBC_CommonBitMatrix* image, CBC_BoundingBox* boundingBox, CBC_ResultPoint startPoint, - FX_BOOL leftToRight, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth) + FX_BOOL leftToRight, int32_t minCodewordWidth, int32_t maxCodewordWidth) { CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn = FX_NEW CBC_DetectionResultRowIndicatorColumn(boundingBox, leftToRight); - for (FX_INT32 i = 0; i < 2; i++) { - FX_INT32 increment = i == 0 ? 1 : -1; - FX_INT32 startColumn = (FX_INT32) startPoint.GetX(); - for (FX_INT32 imageRow = (FX_INT32) startPoint.GetY(); imageRow <= boundingBox->getMaxY() && imageRow >= boundingBox->getMinY(); imageRow += increment) { + for (int32_t i = 0; i < 2; i++) { + int32_t increment = i == 0 ? 1 : -1; + int32_t startColumn = (int32_t) startPoint.GetX(); + for (int32_t imageRow = (int32_t) startPoint.GetY(); imageRow <= boundingBox->getMaxY() && imageRow >= boundingBox->getMinY(); imageRow += increment) { CBC_Codeword* codeword = detectCodeword(image, 0, image->GetWidth(), leftToRight, startColumn, imageRow, minCodewordWidth, maxCodewordWidth); if (codeword != NULL) { rowIndicatorColumn->setCodeword(imageRow, codeword); @@ -263,10 +263,10 @@ CBC_DetectionResultRowIndicatorColumn* CBC_PDF417ScanningDecoder::getRowIndicato } return rowIndicatorColumn; } -void CBC_PDF417ScanningDecoder::adjustCodewordCount(CBC_DetectionResult* detectionResult, CFX_PtrArray* barcodeMatrix, FX_INT32 &e) +void CBC_PDF417ScanningDecoder::adjustCodewordCount(CBC_DetectionResult* detectionResult, CFX_PtrArray* barcodeMatrix, int32_t &e) { CFX_Int32Array* numberOfCodewords = ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(0))->GetAt(1))->getValue(); - FX_INT32 calculatedNumberOfCodewords = detectionResult->getBarcodeColumnCount() * detectionResult->getBarcodeRowCount() - getNumberOfECCodeWords(detectionResult->getBarcodeECLevel()); + int32_t calculatedNumberOfCodewords = detectionResult->getBarcodeColumnCount() * detectionResult->getBarcodeRowCount() - getNumberOfECCodeWords(detectionResult->getBarcodeECLevel()); if (numberOfCodewords->GetSize() == 0) { if (calculatedNumberOfCodewords < 1 || calculatedNumberOfCodewords > CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE) { e = BCExceptiontNotFoundInstance; @@ -279,14 +279,14 @@ void CBC_PDF417ScanningDecoder::adjustCodewordCount(CBC_DetectionResult* detecti } delete numberOfCodewords; } -CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult(CBC_DetectionResult* detectionResult, FX_INT32 &e) +CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult(CBC_DetectionResult* detectionResult, int32_t &e) { CFX_PtrArray* barcodeMatrix = createBarcodeMatrix(detectionResult); adjustCodewordCount(detectionResult, barcodeMatrix, e); if (e != BCExceptionNO) { - for (FX_INT32 i = 0; i < barcodeMatrix->GetSize(); i++) { + for (int32_t i = 0; i < barcodeMatrix->GetSize(); i++) { CFX_PtrArray* temp = (CFX_PtrArray*)barcodeMatrix->GetAt(i); - for (FX_INT32 j = 0; j < temp->GetSize(); j++) { + for (int32_t j = 0; j < temp->GetSize(); j++) { delete (CBC_BarcodeValue*)temp->GetAt(j); } temp->RemoveAll(); @@ -301,10 +301,10 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult(CBC_Dete codewords.SetSize(detectionResult->getBarcodeRowCount() * detectionResult->getBarcodeColumnCount()); CFX_PtrArray ambiguousIndexValuesList; CFX_Int32Array ambiguousIndexesList; - for (FX_INT32 row = 0; row < detectionResult->getBarcodeRowCount(); row++) { - for (FX_INT32 l = 0; l < detectionResult->getBarcodeColumnCount(); l++) { + for (int32_t row = 0; row < detectionResult->getBarcodeRowCount(); row++) { + for (int32_t l = 0; l < detectionResult->getBarcodeColumnCount(); l++) { CFX_Int32Array* values = ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(row))->GetAt(l + 1))->getValue(); - FX_INT32 codewordIndex = row * detectionResult->getBarcodeColumnCount() + l; + int32_t codewordIndex = row * detectionResult->getBarcodeColumnCount() + l; if (values->GetSize() == 0) { erasures.Add(codewordIndex); } else if (values->GetSize() == 1) { @@ -317,12 +317,12 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult(CBC_Dete } CFX_PtrArray ambiguousIndexValues; ambiguousIndexValues.SetSize(ambiguousIndexValuesList.GetSize()); - for (FX_INT32 i = 0; i < ambiguousIndexValues.GetSize(); i++) { + for (int32_t i = 0; i < ambiguousIndexValues.GetSize(); i++) { ambiguousIndexValues.SetAt(i, ambiguousIndexValuesList.GetAt(i)); } - for (FX_INT32 l = 0; l < barcodeMatrix->GetSize(); l++) { + for (int32_t l = 0; l < barcodeMatrix->GetSize(); l++) { CFX_PtrArray* temp = (CFX_PtrArray*)barcodeMatrix->GetAt(l); - for (FX_INT32 j = 0; j < temp->GetSize(); j++) { + for (int32_t j = 0; j < temp->GetSize(); j++) { delete (CBC_BarcodeValue*)temp->GetAt(j); } temp->RemoveAll(); @@ -334,14 +334,14 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult(CBC_Dete BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return decoderResult; } -CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResultFromAmbiguousValues(FX_INT32 ecLevel, CFX_Int32Array &codewords, CFX_Int32Array &erasureArray, CFX_Int32Array &ambiguousIndexes, - CFX_PtrArray& ambiguousIndexValues, FX_INT32 &e) +CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResultFromAmbiguousValues(int32_t ecLevel, CFX_Int32Array &codewords, CFX_Int32Array &erasureArray, CFX_Int32Array &ambiguousIndexes, + CFX_PtrArray& ambiguousIndexValues, int32_t &e) { CFX_Int32Array ambiguousIndexCount; ambiguousIndexCount.SetSize(ambiguousIndexes.GetSize()); - FX_INT32 tries = 100; + int32_t tries = 100; while (tries-- > 0) { - for (FX_INT32 l = 0; l < ambiguousIndexCount.GetSize(); l++) { + for (int32_t l = 0; l < ambiguousIndexCount.GetSize(); l++) { codewords[ambiguousIndexes[l]] = ((CFX_Int32Array*)ambiguousIndexValues.GetAt(l))->GetAt(ambiguousIndexCount[l]); } CBC_CommonDecoderResult* decoderResult = decodeCodewords(codewords, ecLevel, erasureArray, e); @@ -355,7 +355,7 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResultFromAmbig e = BCExceptionChecksumInstance; return NULL; } - for (FX_INT32 i = 0; i < ambiguousIndexCount.GetSize(); i++) { + for (int32_t i = 0; i < ambiguousIndexCount.GetSize(); i++) { if (ambiguousIndexCount[i] < ((CFX_Int32Array*)(ambiguousIndexValues.GetAt(i)))->GetSize() - 1) { ambiguousIndexCount[i]++; break; @@ -376,8 +376,8 @@ CFX_PtrArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix(CBC_DetectionResult CFX_PtrArray* barcodeMatrix = FX_NEW CFX_PtrArray; barcodeMatrix->SetSize(detectionResult->getBarcodeRowCount()); CFX_PtrArray* temp = NULL; - FX_INT32 colume = 0; - for (FX_INT32 row = 0; row < barcodeMatrix->GetSize(); row++) { + int32_t colume = 0; + for (int32_t row = 0; row < barcodeMatrix->GetSize(); row++) { temp = FX_NEW CFX_PtrArray; temp->SetSize(detectionResult->getBarcodeColumnCount() + 2); for (colume = 0; colume < detectionResult->getBarcodeColumnCount() + 2; colume++) { @@ -386,14 +386,14 @@ CFX_PtrArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix(CBC_DetectionResult barcodeMatrix->SetAt(row, temp); } colume = -1; - for (FX_INT32 i = 0; i < detectionResult->getDetectionResultColumns().GetSize(); i++) { + for (int32_t i = 0; i < detectionResult->getDetectionResultColumns().GetSize(); i++) { CBC_DetectionResultColumn* detectionResultColumn = (CBC_DetectionResultColumn*) detectionResult->getDetectionResultColumns().GetAt(i); colume++; if (detectionResultColumn == NULL) { continue; } CFX_PtrArray* temp = detectionResultColumn->getCodewords(); - for (FX_INT32 l = 0; l < temp->GetSize(); l++) { + for (int32_t l = 0; l < temp->GetSize(); l++) { CBC_Codeword* codeword = (CBC_Codeword*) temp->GetAt(l); if (codeword == NULL || codeword->getRowNumber() == -1) { continue; @@ -403,13 +403,13 @@ CFX_PtrArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix(CBC_DetectionResult } return barcodeMatrix; } -FX_BOOL CBC_PDF417ScanningDecoder::isValidBarcodeColumn(CBC_DetectionResult* detectionResult, FX_INT32 barcodeColumn) +FX_BOOL CBC_PDF417ScanningDecoder::isValidBarcodeColumn(CBC_DetectionResult* detectionResult, int32_t barcodeColumn) { return barcodeColumn >= 0 && barcodeColumn <= detectionResult->getBarcodeColumnCount() + 1; } -FX_INT32 CBC_PDF417ScanningDecoder::getStartColumn(CBC_DetectionResult* detectionResult, FX_INT32 barcodeColumn, FX_INT32 imageRow, FX_BOOL leftToRight) +int32_t CBC_PDF417ScanningDecoder::getStartColumn(CBC_DetectionResult* detectionResult, int32_t barcodeColumn, int32_t imageRow, FX_BOOL leftToRight) { - FX_INT32 offset = leftToRight ? 1 : -1; + int32_t offset = leftToRight ? 1 : -1; CBC_Codeword* codeword = NULL; if (isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) { codeword = detectionResult->getDetectionResultColumn(barcodeColumn - offset)->getCodeword(imageRow); @@ -427,10 +427,10 @@ FX_INT32 CBC_PDF417ScanningDecoder::getStartColumn(CBC_DetectionResult* detectio if (codeword != NULL) { return leftToRight ? codeword->getEndX() : codeword->getStartX(); } - FX_INT32 skippedColumns = 0; + int32_t skippedColumns = 0; while (isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) { barcodeColumn -= offset; - for (FX_INT32 i = 0; i < detectionResult->getDetectionResultColumn(barcodeColumn)->getCodewords()->GetSize(); i++) { + for (int32_t i = 0; i < detectionResult->getDetectionResultColumn(barcodeColumn)->getCodewords()->GetSize(); i++) { CBC_Codeword* previousRowCodeword = (CBC_Codeword*) detectionResult->getDetectionResultColumn(barcodeColumn)->getCodewords()->GetAt(i); if (previousRowCodeword != NULL) { return (leftToRight ? previousRowCodeword->getEndX() : previousRowCodeword->getStartX()) + @@ -441,42 +441,42 @@ FX_INT32 CBC_PDF417ScanningDecoder::getStartColumn(CBC_DetectionResult* detectio } return leftToRight ? detectionResult->getBoundingBox()->getMinX() : detectionResult->getBoundingBox()->getMaxX(); } -CBC_Codeword* CBC_PDF417ScanningDecoder::detectCodeword(CBC_CommonBitMatrix* image, FX_INT32 minColumn, FX_INT32 maxColumn, FX_BOOL leftToRight, FX_INT32 startColumn, - FX_INT32 imageRow, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth) +CBC_Codeword* CBC_PDF417ScanningDecoder::detectCodeword(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t startColumn, + int32_t imageRow, int32_t minCodewordWidth, int32_t maxCodewordWidth) { startColumn = adjustCodewordStartColumn(image, minColumn, maxColumn, leftToRight, startColumn, imageRow); CFX_Int32Array* moduleBitCount = getModuleBitCount(image, minColumn, maxColumn, leftToRight, startColumn, imageRow); if (moduleBitCount == NULL) { return NULL; } - FX_INT32 endColumn; - FX_INT32 codewordBitCount = CBC_PDF417Common::getBitCountSum(*moduleBitCount); + int32_t endColumn; + int32_t codewordBitCount = CBC_PDF417Common::getBitCountSum(*moduleBitCount); if (leftToRight) { endColumn = startColumn + codewordBitCount; } else { - for (FX_INT32 i = 0; i < moduleBitCount->GetSize() >> 1; i++) { - FX_INT32 tmpCount = moduleBitCount->GetAt(i); + for (int32_t i = 0; i < moduleBitCount->GetSize() >> 1; i++) { + int32_t tmpCount = moduleBitCount->GetAt(i); moduleBitCount->SetAt(i, moduleBitCount->GetAt(moduleBitCount->GetSize() - 1 - i)); moduleBitCount->SetAt(moduleBitCount->GetSize() - 1 - i, tmpCount); } endColumn = startColumn; startColumn = endColumn - codewordBitCount; } - FX_INT32 decodedValue = CBC_PDF417CodewordDecoder::getDecodedValue(*moduleBitCount); - FX_INT32 codeword = CBC_PDF417Common::getCodeword(decodedValue); + int32_t decodedValue = CBC_PDF417CodewordDecoder::getDecodedValue(*moduleBitCount); + int32_t codeword = CBC_PDF417Common::getCodeword(decodedValue); delete moduleBitCount; if (codeword == -1) { return NULL; } return FX_NEW CBC_Codeword(startColumn, endColumn, getCodewordBucketNumber(decodedValue), codeword); } -CFX_Int32Array* CBC_PDF417ScanningDecoder::getModuleBitCount(CBC_CommonBitMatrix* image, FX_INT32 minColumn, FX_INT32 maxColumn, FX_BOOL leftToRight, FX_INT32 startColumn, FX_INT32 imageRow) +CFX_Int32Array* CBC_PDF417ScanningDecoder::getModuleBitCount(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t startColumn, int32_t imageRow) { - FX_INT32 imageColumn = startColumn; + int32_t imageColumn = startColumn; CFX_Int32Array* moduleBitCount = FX_NEW CFX_Int32Array; moduleBitCount->SetSize(8); - FX_INT32 moduleNumber = 0; - FX_INT32 increment = leftToRight ? 1 : -1; + int32_t moduleNumber = 0; + int32_t increment = leftToRight ? 1 : -1; FX_BOOL previousPixelValue = leftToRight; while (((leftToRight && imageColumn < maxColumn) || (!leftToRight && imageColumn >= minColumn)) && moduleNumber < moduleBitCount->GetSize()) { if (image->Get(imageColumn, imageRow) == previousPixelValue) { @@ -493,15 +493,15 @@ CFX_Int32Array* CBC_PDF417ScanningDecoder::getModuleBitCount(CBC_CommonBitMatrix delete moduleBitCount; return NULL; } -FX_INT32 CBC_PDF417ScanningDecoder::getNumberOfECCodeWords(FX_INT32 barcodeECLevel) +int32_t CBC_PDF417ScanningDecoder::getNumberOfECCodeWords(int32_t barcodeECLevel) { return 2 << barcodeECLevel; } -FX_INT32 CBC_PDF417ScanningDecoder::adjustCodewordStartColumn(CBC_CommonBitMatrix* image, FX_INT32 minColumn, FX_INT32 maxColumn, FX_BOOL leftToRight, FX_INT32 codewordStartColumn, FX_INT32 imageRow) +int32_t CBC_PDF417ScanningDecoder::adjustCodewordStartColumn(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t codewordStartColumn, int32_t imageRow) { - FX_INT32 correctedStartColumn = codewordStartColumn; - FX_INT32 increment = leftToRight ? -1 : 1; - for (FX_INT32 i = 0; i < 2; i++) { + int32_t correctedStartColumn = codewordStartColumn; + int32_t increment = leftToRight ? -1 : 1; + for (int32_t i = 0; i < 2; i++) { FX_BOOL l = image->Get(correctedStartColumn, imageRow); while (((leftToRight && correctedStartColumn >= minColumn) || (!leftToRight && correctedStartColumn < maxColumn)) && leftToRight == image->Get(correctedStartColumn, imageRow)) { if (abs(codewordStartColumn - correctedStartColumn) > CODEWORD_SKEW_SIZE) { @@ -514,18 +514,18 @@ FX_INT32 CBC_PDF417ScanningDecoder::adjustCodewordStartColumn(CBC_CommonBitMatri } return correctedStartColumn; } -FX_BOOL CBC_PDF417ScanningDecoder::checkCodewordSkew(FX_INT32 codewordSize, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth) +FX_BOOL CBC_PDF417ScanningDecoder::checkCodewordSkew(int32_t codewordSize, int32_t minCodewordWidth, int32_t maxCodewordWidth) { return minCodewordWidth - CODEWORD_SKEW_SIZE <= codewordSize && codewordSize <= maxCodewordWidth + CODEWORD_SKEW_SIZE; } -CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decodeCodewords(CFX_Int32Array &codewords, FX_INT32 ecLevel, CFX_Int32Array &erasures, FX_INT32 &e) +CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decodeCodewords(CFX_Int32Array &codewords, int32_t ecLevel, CFX_Int32Array &erasures, int32_t &e) { if (codewords.GetSize() == 0) { e = BCExceptionFormatInstance; return NULL; } - FX_INT32 numECCodewords = 1 << (ecLevel + 1); - FX_INT32 correctedErrorsCount = correctErrors(codewords, erasures, numECCodewords, e); + int32_t numECCodewords = 1 << (ecLevel + 1); + int32_t correctedErrorsCount = correctErrors(codewords, erasures, numECCodewords, e); BC_EXCEPTION_CHECK_ReturnValue(e , NULL); verifyCodewordCount(codewords, numECCodewords, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); @@ -534,23 +534,23 @@ CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::decodeCodewords(CFX_Int32Arr BC_EXCEPTION_CHECK_ReturnValue(e, NULL); return decoderResult; } -FX_INT32 CBC_PDF417ScanningDecoder::correctErrors(CFX_Int32Array &codewords, CFX_Int32Array &erasures, FX_INT32 numECCodewords, FX_INT32 &e) +int32_t CBC_PDF417ScanningDecoder::correctErrors(CFX_Int32Array &codewords, CFX_Int32Array &erasures, int32_t numECCodewords, int32_t &e) { if ((erasures.GetSize() != 0 && erasures.GetSize() > (numECCodewords / 2 + MAX_ERRORS)) || numECCodewords < 0 || numECCodewords > MAX_EC_CODEWORDS) { e = BCExceptionChecksumInstance; return -1; } - FX_INT32 result = CBC_PDF417ECErrorCorrection::decode(codewords, numECCodewords, erasures, e); + int32_t result = CBC_PDF417ECErrorCorrection::decode(codewords, numECCodewords, erasures, e); BC_EXCEPTION_CHECK_ReturnValue(e, -1); return result; } -void CBC_PDF417ScanningDecoder::verifyCodewordCount(CFX_Int32Array &codewords, FX_INT32 numECCodewords, FX_INT32 &e) +void CBC_PDF417ScanningDecoder::verifyCodewordCount(CFX_Int32Array &codewords, int32_t numECCodewords, int32_t &e) { if (codewords.GetSize() < 4) { e = BCExceptionFormatInstance; return; } - FX_INT32 numberOfCodewords = codewords.GetAt(0); + int32_t numberOfCodewords = codewords.GetAt(0); if (numberOfCodewords > codewords.GetSize()) { e = BCExceptionFormatInstance; return; @@ -564,12 +564,12 @@ void CBC_PDF417ScanningDecoder::verifyCodewordCount(CFX_Int32Array &codewords, F } } } -CFX_Int32Array* CBC_PDF417ScanningDecoder::getBitCountForCodeword(FX_INT32 codeword) +CFX_Int32Array* CBC_PDF417ScanningDecoder::getBitCountForCodeword(int32_t codeword) { CFX_Int32Array* result = FX_NEW CFX_Int32Array; result->SetSize(8); - FX_INT32 previousValue = 0; - FX_INT32 i = result->GetSize() - 1; + int32_t previousValue = 0; + int32_t i = result->GetSize() - 1; while (TRUE) { if ((codeword & 0x1) != previousValue) { previousValue = codeword & 0x1; @@ -583,14 +583,14 @@ CFX_Int32Array* CBC_PDF417ScanningDecoder::getBitCountForCodeword(FX_INT32 codew } return result; } -FX_INT32 CBC_PDF417ScanningDecoder::getCodewordBucketNumber(FX_INT32 codeword) +int32_t CBC_PDF417ScanningDecoder::getCodewordBucketNumber(int32_t codeword) { CFX_Int32Array* array = getBitCountForCodeword(codeword); - FX_INT32 result = getCodewordBucketNumber(*array); + int32_t result = getCodewordBucketNumber(*array); delete array; return result; } -FX_INT32 CBC_PDF417ScanningDecoder::getCodewordBucketNumber(CFX_Int32Array& moduleBitCount) +int32_t CBC_PDF417ScanningDecoder::getCodewordBucketNumber(CFX_Int32Array& moduleBitCount) { return (moduleBitCount.GetAt(0) - moduleBitCount.GetAt(2) + moduleBitCount.GetAt(4) - moduleBitCount.GetAt(6) + 9) % 9; } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h b/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h index 8cb5d2856c..1022288811 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h @@ -25,37 +25,37 @@ public: static void Initialize(); static void Finalize(); static CBC_CommonDecoderResult* decode(CBC_CommonBitMatrix* image, CBC_ResultPoint* imageTopLeft, CBC_ResultPoint* imageBottomLeft, CBC_ResultPoint* imageTopRight, - CBC_ResultPoint* imageBottomRight, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth, FX_INT32 &e); + CBC_ResultPoint* imageBottomRight, int32_t minCodewordWidth, int32_t maxCodewordWidth, int32_t &e); static CFX_ByteString toString(CFX_PtrArray* barcodeMatrix); private: - static FX_INT32 CODEWORD_SKEW_SIZE; - static FX_INT32 MAX_ERRORS; - static FX_INT32 MAX_EC_CODEWORDS; + static int32_t CODEWORD_SKEW_SIZE; + static int32_t MAX_ERRORS; + static int32_t MAX_EC_CODEWORDS; static CBC_PDF417ECErrorCorrection* errorCorrection; - static CBC_DetectionResult* merge(CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, FX_INT32 &e); - static CBC_BoundingBox* adjustBoundingBox(CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn, FX_INT32 &e); - static FX_INT32 getMax(CFX_Int32Array& values); + static CBC_DetectionResult* merge(CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, int32_t &e); + static CBC_BoundingBox* adjustBoundingBox(CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn, int32_t &e); + static int32_t getMax(CFX_Int32Array& values); static CBC_BarcodeMetadata* getBarcodeMetadata(CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn); static CBC_DetectionResultRowIndicatorColumn* getRowIndicatorColumn(CBC_CommonBitMatrix* image, CBC_BoundingBox* boundingBox, CBC_ResultPoint startPoint, - FX_BOOL leftToRight, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth); - static void adjustCodewordCount(CBC_DetectionResult* detectionResult, CFX_PtrArray* barcodeMatrix, FX_INT32 &e); - static CBC_CommonDecoderResult* createDecoderResult(CBC_DetectionResult* detectionResult, FX_INT32 &e); - static CBC_CommonDecoderResult* createDecoderResultFromAmbiguousValues(FX_INT32 ecLevel, CFX_Int32Array &codewords, CFX_Int32Array &erasureArray, CFX_Int32Array &ambiguousIndexes, - CFX_PtrArray& ambiguousIndexValues, FX_INT32 &e); + FX_BOOL leftToRight, int32_t minCodewordWidth, int32_t maxCodewordWidth); + static void adjustCodewordCount(CBC_DetectionResult* detectionResult, CFX_PtrArray* barcodeMatrix, int32_t &e); + static CBC_CommonDecoderResult* createDecoderResult(CBC_DetectionResult* detectionResult, int32_t &e); + static CBC_CommonDecoderResult* createDecoderResultFromAmbiguousValues(int32_t ecLevel, CFX_Int32Array &codewords, CFX_Int32Array &erasureArray, CFX_Int32Array &ambiguousIndexes, + CFX_PtrArray& ambiguousIndexValues, int32_t &e); static CFX_PtrArray* createBarcodeMatrix(CBC_DetectionResult* detectionResult); - static FX_BOOL isValidBarcodeColumn(CBC_DetectionResult* detectionResult, FX_INT32 barcodeColumn); - static FX_INT32 getStartColumn(CBC_DetectionResult* detectionResult, FX_INT32 barcodeColumn, FX_INT32 imageRow, FX_BOOL leftToRight); - static CBC_Codeword* detectCodeword(CBC_CommonBitMatrix* image, FX_INT32 minColumn, FX_INT32 maxColumn, FX_BOOL leftToRight, FX_INT32 startColumn, - FX_INT32 imageRow, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth); - static CFX_Int32Array* getModuleBitCount(CBC_CommonBitMatrix* image, FX_INT32 minColumn, FX_INT32 maxColumn, FX_BOOL leftToRight, FX_INT32 startColumn, FX_INT32 imageRow); - static FX_INT32 getNumberOfECCodeWords(FX_INT32 barcodeECLevel); - static FX_INT32 adjustCodewordStartColumn(CBC_CommonBitMatrix* image, FX_INT32 minColumn, FX_INT32 maxColumn, FX_BOOL leftToRight, FX_INT32 codewordStartColumn, FX_INT32 imageRow); - static FX_BOOL checkCodewordSkew(FX_INT32 codewordSize, FX_INT32 minCodewordWidth, FX_INT32 maxCodewordWidth); - static CBC_CommonDecoderResult* decodeCodewords(CFX_Int32Array &codewords, FX_INT32 ecLevel, CFX_Int32Array &erasures, FX_INT32 &e); - static FX_INT32 correctErrors(CFX_Int32Array &codewords, CFX_Int32Array &erasures, FX_INT32 numECCodewords, FX_INT32 &e); - static void verifyCodewordCount(CFX_Int32Array &codewords, FX_INT32 numECCodewords, FX_INT32 &e); - static CFX_Int32Array* getBitCountForCodeword(FX_INT32 codeword); - static FX_INT32 getCodewordBucketNumber(FX_INT32 codeword); - static FX_INT32 getCodewordBucketNumber(CFX_Int32Array& moduleBitCount); + static FX_BOOL isValidBarcodeColumn(CBC_DetectionResult* detectionResult, int32_t barcodeColumn); + static int32_t getStartColumn(CBC_DetectionResult* detectionResult, int32_t barcodeColumn, int32_t imageRow, FX_BOOL leftToRight); + static CBC_Codeword* detectCodeword(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t startColumn, + int32_t imageRow, int32_t minCodewordWidth, int32_t maxCodewordWidth); + static CFX_Int32Array* getModuleBitCount(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t startColumn, int32_t imageRow); + static int32_t getNumberOfECCodeWords(int32_t barcodeECLevel); + static int32_t adjustCodewordStartColumn(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t codewordStartColumn, int32_t imageRow); + static FX_BOOL checkCodewordSkew(int32_t codewordSize, int32_t minCodewordWidth, int32_t maxCodewordWidth); + static CBC_CommonDecoderResult* decodeCodewords(CFX_Int32Array &codewords, int32_t ecLevel, CFX_Int32Array &erasures, int32_t &e); + static int32_t correctErrors(CFX_Int32Array &codewords, CFX_Int32Array &erasures, int32_t numECCodewords, int32_t &e); + static void verifyCodewordCount(CFX_Int32Array &codewords, int32_t numECCodewords, int32_t &e); + static CFX_Int32Array* getBitCountForCodeword(int32_t codeword); + static int32_t getCodewordBucketNumber(int32_t codeword); + static int32_t getCodewordBucketNumber(CFX_Int32Array& moduleBitCount); }; #endif diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.cpp index 86951c91e9..5154b2e231 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.cpp @@ -36,7 +36,7 @@ CBC_PDF417Writer::~CBC_PDF417Writer() { m_bTruncated = TRUE; } -FX_BOOL CBC_PDF417Writer:: SetErrorCorrectionLevel(FX_INT32 level) +FX_BOOL CBC_PDF417Writer:: SetErrorCorrectionLevel(int32_t level) { if (level < 0 || level > 8) { return FALSE; @@ -48,7 +48,7 @@ void CBC_PDF417Writer::SetTruncated(FX_BOOL truncated) { m_bTruncated = truncated; } -FX_BYTE* CBC_PDF417Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e) +uint8_t* CBC_PDF417Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e) { if ( format != BCFORMAT_PDF_417) { return NULL; @@ -56,15 +56,15 @@ FX_BYTE* CBC_PDF417Writer::Encode(const CFX_ByteString &contents, BCFORMAT forma CFX_WideString encodeContents = contents.UTF8Decode(); return Encode(encodeContents, outWidth, outHeight, e ); } -FX_BYTE* CBC_PDF417Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e) +uint8_t* CBC_PDF417Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e) { return NULL; } -FX_BYTE* CBC_PDF417Writer::Encode(const CFX_WideString &contents, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e) +uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString &contents, int32_t &outWidth, int32_t &outHeight, int32_t &e) { CBC_PDF417 encoder; - FX_INT32 col = (m_Width / m_ModuleWidth - 69) / 17; - FX_INT32 row = m_Height / (m_ModuleWidth * 20); + int32_t col = (m_Width / m_ModuleWidth - 69) / 17; + int32_t row = m_Height / (m_ModuleWidth * 20); if (row >= 3 && row <= 90 && col >= 1 && col <= 30) { encoder.setDimensions(col, col, row, row); } else if (col >= 1 && col <= 30) { @@ -74,26 +74,26 @@ FX_BYTE* CBC_PDF417Writer::Encode(const CFX_WideString &contents, FX_INT32 &outW } encoder.generateBarcodeLogic(contents, m_iCorrectLevel, e); BC_EXCEPTION_CHECK_ReturnValue(e, NULL); - FX_INT32 lineThickness = 2; - FX_INT32 aspectRatio = 4; + int32_t lineThickness = 2; + int32_t aspectRatio = 4; CBC_BarcodeMatrix* barcodeMatrix = encoder.getBarcodeMatrix(); CFX_ByteArray originalScale; originalScale.Copy(barcodeMatrix->getScaledMatrix(lineThickness, aspectRatio * lineThickness)); - FX_INT32 width = outWidth; - FX_INT32 height = outHeight; + int32_t width = outWidth; + int32_t height = outHeight; outWidth = barcodeMatrix->getWidth(); outHeight = barcodeMatrix->getHeight(); FX_BOOL rotated = FALSE; if ((height > width) ^ (outWidth < outHeight)) { rotateArray(originalScale, outHeight, outWidth); rotated = TRUE; - FX_INT32 temp = outHeight; + int32_t temp = outHeight; outHeight = outWidth; outWidth = temp; } - FX_INT32 scaleX = width / outWidth; - FX_INT32 scaleY = height / outHeight; - FX_INT32 scale; + int32_t scaleX = width / outWidth; + int32_t scaleY = height / outHeight; + int32_t scale; if (scaleX < scaleY) { scale = scaleX; } else { @@ -104,22 +104,22 @@ FX_BYTE* CBC_PDF417Writer::Encode(const CFX_WideString &contents, FX_INT32 &outW originalScale.Copy(barcodeMatrix->getScaledMatrix(scale * lineThickness, scale * aspectRatio * lineThickness)); if (rotated) { rotateArray(originalScale, outHeight, outWidth); - FX_INT32 temp = outHeight; + int32_t temp = outHeight; outHeight = outWidth; outWidth = temp; } } - FX_BYTE* result = (FX_BYTE*)FX_Alloc(FX_BYTE, outHeight * outWidth); + uint8_t* result = (uint8_t*)FX_Alloc(uint8_t, outHeight * outWidth); FXSYS_memcpy32(result, originalScale.GetData(), outHeight * outWidth); return result; } -void CBC_PDF417Writer::rotateArray(CFX_ByteArray& bitarray, FX_INT32 height, FX_INT32 width) +void CBC_PDF417Writer::rotateArray(CFX_ByteArray& bitarray, int32_t height, int32_t width) { CFX_ByteArray temp; temp.Copy(bitarray); - for (FX_INT32 ii = 0; ii < height; ii++) { - FX_INT32 inverseii = height - ii - 1; - for (FX_INT32 jj = 0; jj < width; jj++) { + for (int32_t ii = 0; ii < height; ii++) { + int32_t inverseii = height - ii - 1; + for (int32_t jj = 0; jj < width; jj++) { bitarray[jj * height + inverseii] = temp[ii * width + jj]; } } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.h b/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.h index 5d974f9377..e44959f4ff 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.h +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Writer.h @@ -13,14 +13,14 @@ class CBC_PDF417Writer : public CBC_TwoDimWriter public: CBC_PDF417Writer(); virtual ~CBC_PDF417Writer(); - FX_BYTE * Encode(const CFX_WideString &contents, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e); + uint8_t * Encode(const CFX_WideString &contents, int32_t &outWidth, int32_t &outHeight, int32_t &e); - FX_BYTE * Encode(const CFX_ByteString &contents, BCFORMAT format, 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_BOOL SetErrorCorrectionLevel(FX_INT32 level); + uint8_t * Encode(const CFX_ByteString &contents, BCFORMAT format, 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); + FX_BOOL SetErrorCorrectionLevel(int32_t level); void SetTruncated(FX_BOOL truncated); private: - void rotateArray(CFX_ByteArray& bitarray, FX_INT32 width, FX_INT32 height); + void rotateArray(CFX_ByteArray& bitarray, int32_t width, int32_t height); FX_BOOL m_bTruncated; }; #endif -- cgit v1.2.3