diff options
author | tsepez <tsepez@chromium.org> | 2017-01-20 12:59:50 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2017-01-20 12:59:50 -0800 |
commit | 82aa396188ec26f22fe730f4e35b5a54ebffb5dc (patch) | |
tree | 3950a96204c68fed27d1812cdd9d30de1a6226c0 /xfa/fxbarcode/datamatrix | |
parent | 6db6fbcdee9f1887ac02c647210bd5013358f12d (diff) | |
download | pdfium-82aa396188ec26f22fe730f4e35b5a54ebffb5dc.tar.xz |
Replace CFX_ByteArray with CFX_ArrayTemplate<uint8_t>chromium/2990chromium/2989chromium/2988
Also replace CFX_Int32Array typedef with CFX_ArrayTemplate<int32_t>.
Removing the typedefs makes subsequent conversion to std::vector<>
easier on a case-by-case basis.
Review-Url: https://codereview.chromium.org/2649563003
Diffstat (limited to 'xfa/fxbarcode/datamatrix')
-rw-r--r-- | xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp | 2 | ||||
-rw-r--r-- | xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h | 4 | ||||
-rw-r--r-- | xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp | 6 | ||||
-rw-r--r-- | xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp | 23 | ||||
-rw-r--r-- | xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h | 10 |
5 files changed, 24 insertions, 21 deletions
diff --git a/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp b/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp index bc0aa72b42..e7eef07b47 100644 --- a/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp +++ b/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp @@ -43,7 +43,7 @@ int32_t CBC_DefaultPlacement::getNumrows() { int32_t CBC_DefaultPlacement::getNumcols() { return m_numcols; } -CFX_ByteArray& CBC_DefaultPlacement::getBits() { +CFX_ArrayTemplate<uint8_t>& CBC_DefaultPlacement::getBits() { return m_bits; } bool CBC_DefaultPlacement::getBit(int32_t col, int32_t row) { diff --git a/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h b/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h index 64d02886f7..36a7ab2615 100644 --- a/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h +++ b/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h @@ -18,7 +18,7 @@ class CBC_DefaultPlacement { int32_t getNumrows(); int32_t getNumcols(); - CFX_ByteArray& getBits(); + CFX_ArrayTemplate<uint8_t>& getBits(); bool getBit(int32_t col, int32_t row); void setBit(int32_t col, int32_t row, bool bit); bool hasBit(int32_t col, int32_t row); @@ -28,7 +28,7 @@ class CBC_DefaultPlacement { CFX_WideString m_codewords; int32_t m_numrows; int32_t m_numcols; - CFX_ByteArray m_bits; + CFX_ArrayTemplate<uint8_t> m_bits; void module(int32_t row, int32_t col, int32_t pos, int32_t bit); void utah(int32_t row, int32_t col, int32_t pos); void corner1(int32_t pos); diff --git a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp index f52f0ff0c4..7782830940 100644 --- a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp +++ b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp @@ -132,11 +132,11 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords, BC_EXCEPTION_CHECK_ReturnValue(e, CFX_WideString()); sb += ecc; } else { - CFX_Int32Array dataSizes; + CFX_ArrayTemplate<int32_t> dataSizes; dataSizes.SetSize(blockCount); - CFX_Int32Array errorSizes; + CFX_ArrayTemplate<int32_t> errorSizes; errorSizes.SetSize(blockCount); - CFX_Int32Array startPos; + CFX_ArrayTemplate<int32_t> startPos; startPos.SetSize(blockCount); for (int32_t i = 0; i < blockCount; i++) { dataSizes[i] = symbolInfo->getDataLengthForInterleavedBlock(i + 1); diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp index fcd668af6d..4b4b246038 100644 --- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp +++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp @@ -58,7 +58,8 @@ const wchar_t CBC_HighLevelEncoder::MACRO_TRAILER = 0x0004; CBC_HighLevelEncoder::CBC_HighLevelEncoder() {} CBC_HighLevelEncoder::~CBC_HighLevelEncoder() {} -CFX_ByteArray& CBC_HighLevelEncoder::getBytesForMessage(CFX_WideString msg) { +CFX_ArrayTemplate<uint8_t>& CBC_HighLevelEncoder::getBytesForMessage( + CFX_WideString msg) { CFX_ByteString bytestr; CBC_UtilCodingConvert::UnicodeToUTF8(msg, bytestr); for (int32_t i = 0; i < bytestr.GetLength(); i++) { @@ -159,9 +160,9 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, while (true) { if ((startpos + charsProcessed) == msg.GetLength()) { int32_t min = std::numeric_limits<int32_t>::max(); - CFX_ByteArray mins; + CFX_ArrayTemplate<uint8_t> mins; mins.SetSize(6); - CFX_Int32Array intCharCounts; + CFX_ArrayTemplate<int32_t> intCharCounts; intCharCounts.SetSize(6); min = findMinimums(charCounts, intCharCounts, min, mins); int32_t minCount = getMinimumCount(mins); @@ -229,9 +230,9 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg, charCounts[BASE256_ENCODATION]++; } if (charsProcessed >= 4) { - CFX_Int32Array intCharCounts; + CFX_ArrayTemplate<int32_t> intCharCounts; intCharCounts.SetSize(6); - CFX_ByteArray mins; + CFX_ArrayTemplate<uint8_t> mins; mins.SetSize(6); findMinimums(charCounts, intCharCounts, std::numeric_limits<int32_t>::max(), mins); @@ -317,10 +318,11 @@ FX_WCHAR CBC_HighLevelEncoder::randomize253State(FX_WCHAR ch, return tempVariable <= 254 ? (FX_WCHAR)tempVariable : (FX_WCHAR)(tempVariable - 254); } -int32_t CBC_HighLevelEncoder::findMinimums(std::vector<FX_FLOAT>& charCounts, - CFX_Int32Array& intCharCounts, - int32_t min, - CFX_ByteArray& mins) { +int32_t CBC_HighLevelEncoder::findMinimums( + std::vector<FX_FLOAT>& charCounts, + CFX_ArrayTemplate<int32_t>& intCharCounts, + int32_t min, + CFX_ArrayTemplate<uint8_t>& mins) { for (int32_t l = 0; l < mins.GetSize(); l++) { mins[l] = (uint8_t)0; } @@ -339,7 +341,8 @@ int32_t CBC_HighLevelEncoder::findMinimums(std::vector<FX_FLOAT>& charCounts, } return min; } -int32_t CBC_HighLevelEncoder::getMinimumCount(CFX_ByteArray& mins) { +int32_t CBC_HighLevelEncoder::getMinimumCount( + CFX_ArrayTemplate<uint8_t>& mins) { int32_t minCount = 0; for (int32_t i = 0; i < 6; i++) { minCount += mins[i]; diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h index 3b88f888fd..5d72f1074e 100644 --- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h +++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h @@ -23,7 +23,7 @@ class CBC_HighLevelEncoder : public CBC_SymbolShapeHint { CBC_HighLevelEncoder(); ~CBC_HighLevelEncoder() override; - CFX_ByteArray& getBytesForMessage(CFX_WideString msg); + CFX_ArrayTemplate<uint8_t>& getBytesForMessage(CFX_WideString msg); static CFX_WideString encodeHighLevel(CFX_WideString msg, CFX_WideString ecLevel, int32_t& e); @@ -59,15 +59,15 @@ class CBC_HighLevelEncoder : public CBC_SymbolShapeHint { static const wchar_t* MACRO_05_HEADER; static const wchar_t* MACRO_06_HEADER; static const wchar_t MACRO_TRAILER; - CFX_ByteArray m_bytearray; + CFX_ArrayTemplate<uint8_t> m_bytearray; private: static FX_WCHAR randomize253State(FX_WCHAR ch, int32_t codewordPosition); static int32_t findMinimums(std::vector<FX_FLOAT>& charCounts, - CFX_Int32Array& intCharCounts, + CFX_ArrayTemplate<int32_t>& intCharCounts, int32_t min, - CFX_ByteArray& mins); - static int32_t getMinimumCount(CFX_ByteArray& mins); + CFX_ArrayTemplate<uint8_t>& mins); + static int32_t getMinimumCount(CFX_ArrayTemplate<uint8_t>& mins); static bool isNativeC40(FX_WCHAR ch); static bool isNativeText(FX_WCHAR ch); static bool isNativeX12(FX_WCHAR ch); |