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 | |
parent | 6db6fbcdee9f1887ac02c647210bd5013358f12d (diff) | |
download | pdfium-chromium/2988.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')
33 files changed, 110 insertions, 97 deletions
diff --git a/xfa/fxbarcode/BC_UtilCodingConvert.cpp b/xfa/fxbarcode/BC_UtilCodingConvert.cpp index 73475751f6..c06cffc218 100644 --- a/xfa/fxbarcode/BC_UtilCodingConvert.cpp +++ b/xfa/fxbarcode/BC_UtilCodingConvert.cpp @@ -22,7 +22,7 @@ void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src, } void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src, - CFX_ByteArray& dst) { + CFX_ArrayTemplate<uint8_t>& dst) { CFX_WideString unicode = CFX_WideString::FromLocal(src.AsStringC()); CFX_ByteString utf8 = unicode.UTF8Encode(); for (int32_t i = 0; i < utf8.GetLength(); i++) { @@ -30,7 +30,7 @@ void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src, } } -void CBC_UtilCodingConvert::Utf8ToLocale(const CFX_ByteArray& src, +void CBC_UtilCodingConvert::Utf8ToLocale(const CFX_ArrayTemplate<uint8_t>& src, CFX_ByteString& dst) { CFX_ByteString utf8; for (int32_t i = 0; i < src.GetSize(); i++) { diff --git a/xfa/fxbarcode/BC_UtilCodingConvert.h b/xfa/fxbarcode/BC_UtilCodingConvert.h index 698cd857d7..859eeea1e9 100644 --- a/xfa/fxbarcode/BC_UtilCodingConvert.h +++ b/xfa/fxbarcode/BC_UtilCodingConvert.h @@ -17,8 +17,10 @@ class CBC_UtilCodingConvert { CFX_ByteString& result); static void LocaleToUtf8(const CFX_ByteString& source, CFX_ByteString& result); - static void LocaleToUtf8(const CFX_ByteString& source, CFX_ByteArray& result); - static void Utf8ToLocale(const CFX_ByteArray& source, CFX_ByteString& result); + static void LocaleToUtf8(const CFX_ByteString& source, + CFX_ArrayTemplate<uint8_t>& result); + static void Utf8ToLocale(const CFX_ArrayTemplate<uint8_t>& source, + CFX_ByteString& result); static void Utf8ToLocale(const uint8_t* source, int32_t count, CFX_ByteString& result); diff --git a/xfa/fxbarcode/BC_Utils.cpp b/xfa/fxbarcode/BC_Utils.cpp index 807b04861d..5d881c7be1 100644 --- a/xfa/fxbarcode/BC_Utils.cpp +++ b/xfa/fxbarcode/BC_Utils.cpp @@ -26,7 +26,8 @@ void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, FX_CHAR c) { dst += c; } } -void BC_FX_ByteString_Append(CFX_ByteString& dst, const CFX_ByteArray& ba) { +void BC_FX_ByteString_Append(CFX_ByteString& dst, + const CFX_ArrayTemplate<uint8_t>& ba) { for (int32_t i = 0; i < ba.GetSize(); i++) { dst += ba[i]; } diff --git a/xfa/fxbarcode/common/BC_CommonBitArray.cpp b/xfa/fxbarcode/common/BC_CommonBitArray.cpp index 722bbc501d..0371837fde 100644 --- a/xfa/fxbarcode/common/BC_CommonBitArray.cpp +++ b/xfa/fxbarcode/common/BC_CommonBitArray.cpp @@ -41,7 +41,7 @@ CBC_CommonBitArray::~CBC_CommonBitArray() { int32_t CBC_CommonBitArray::GetSize() { return m_size; } -CFX_Int32Array& CBC_CommonBitArray::GetBits() { +CFX_ArrayTemplate<int32_t>& CBC_CommonBitArray::GetBits() { return m_bits; } int32_t CBC_CommonBitArray::GetSizeInBytes() { diff --git a/xfa/fxbarcode/common/BC_CommonBitArray.h b/xfa/fxbarcode/common/BC_CommonBitArray.h index 80a56d1b53..6ad8ab321d 100644 --- a/xfa/fxbarcode/common/BC_CommonBitArray.h +++ b/xfa/fxbarcode/common/BC_CommonBitArray.h @@ -17,7 +17,7 @@ class CBC_CommonBitArray { virtual ~CBC_CommonBitArray(); int32_t GetSize(); - CFX_Int32Array& GetBits(); + CFX_ArrayTemplate<int32_t>& GetBits(); int32_t GetSizeInBytes(); bool Get(int32_t i); void Set(int32_t i); @@ -30,7 +30,7 @@ class CBC_CommonBitArray { private: int32_t m_size; - CFX_Int32Array m_bits; + CFX_ArrayTemplate<int32_t> m_bits; }; #endif // XFA_FXBARCODE_COMMON_BC_COMMONBITARRAY_H_ diff --git a/xfa/fxbarcode/common/BC_CommonByteArray.cpp b/xfa/fxbarcode/common/BC_CommonByteArray.cpp index 71fa85f0c4..050ecb0bf8 100644 --- a/xfa/fxbarcode/common/BC_CommonByteArray.cpp +++ b/xfa/fxbarcode/common/BC_CommonByteArray.cpp @@ -85,7 +85,7 @@ void CBC_CommonByteArray::Set(uint8_t* source, int32_t offset, int32_t count) { FXSYS_memcpy(m_bytes, source + offset, count); m_index = count; } -void CBC_CommonByteArray::Set(CFX_ByteArray* source, +void CBC_CommonByteArray::Set(CFX_ArrayTemplate<uint8_t>* source, int32_t offset, int32_t count) { FX_Free(m_bytes); diff --git a/xfa/fxbarcode/common/BC_CommonByteArray.h b/xfa/fxbarcode/common/BC_CommonByteArray.h index dd6ee581ef..009f625a86 100644 --- a/xfa/fxbarcode/common/BC_CommonByteArray.h +++ b/xfa/fxbarcode/common/BC_CommonByteArray.h @@ -25,7 +25,7 @@ class CBC_CommonByteArray { void AppendByte(int32_t value); void Reserve(int32_t capacity); void Set(uint8_t* source, int32_t offset, int32_t count); - void Set(CFX_ByteArray* source, int32_t offset, int32_t count); + void Set(CFX_ArrayTemplate<uint8_t>* source, int32_t offset, int32_t count); private: int32_t m_size; diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp index 352dc3dab1..eac1a1065a 100644 --- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp +++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp @@ -39,7 +39,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonEncoder::BuildGenerator(int32_t degree, CBC_ReedSolomonGF256Poly* lastGenerator = m_cachedGenerators[m_cachedGenerators.GetSize() - 1]; for (int32_t d = m_cachedGenerators.GetSize(); d <= degree; d++) { - CFX_Int32Array temp; + CFX_ArrayTemplate<int32_t> temp; temp.Add(1); temp.Add(m_field->Exp(d - 1)); CBC_ReedSolomonGF256Poly temp_poly; @@ -54,7 +54,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonEncoder::BuildGenerator(int32_t degree, } return m_cachedGenerators[degree]; } -void CBC_ReedSolomonEncoder::Encode(CFX_Int32Array* toEncode, +void CBC_ReedSolomonEncoder::Encode(CFX_ArrayTemplate<int32_t>* toEncode, int32_t ecBytes, int32_t& e) { if (ecBytes == 0) { @@ -68,7 +68,7 @@ void CBC_ReedSolomonEncoder::Encode(CFX_Int32Array* toEncode, } CBC_ReedSolomonGF256Poly* generator = BuildGenerator(ecBytes, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - CFX_Int32Array infoCoefficients; + CFX_ArrayTemplate<int32_t> infoCoefficients; infoCoefficients.SetSize(dataBytes); for (int32_t x = 0; x < dataBytes; x++) { infoCoefficients[x] = toEncode->operator[](x); @@ -83,7 +83,7 @@ void CBC_ReedSolomonEncoder::Encode(CFX_Int32Array* toEncode, infoTemp->Divide(generator, e)); BC_EXCEPTION_CHECK_ReturnVoid(e); CBC_ReedSolomonGF256Poly* remainder = (*temp)[1]; - CFX_Int32Array* coefficients = remainder->GetCoefficients(); + CFX_ArrayTemplate<int32_t>* coefficients = remainder->GetCoefficients(); int32_t numZeroCoefficients = ecBytes - coefficients->GetSize(); for (int32_t i = 0; i < numZeroCoefficients; i++) { (*toEncode)[dataBytes + i] = 0; diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h index b71cfb4c06..95828f1a0e 100644 --- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h +++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h @@ -17,7 +17,9 @@ class CBC_ReedSolomonEncoder { explicit CBC_ReedSolomonEncoder(CBC_ReedSolomonGF256* field); virtual ~CBC_ReedSolomonEncoder(); - void Encode(CFX_Int32Array* toEncode, int32_t ecBytes, int32_t& e); + void Encode(CFX_ArrayTemplate<int32_t>* toEncode, + int32_t ecBytes, + int32_t& e); virtual void Init(); private: diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp index 33b828cc1e..030048a632 100644 --- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp +++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp @@ -85,7 +85,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial( BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return temp; } - CFX_Int32Array coefficients; + CFX_ArrayTemplate<int32_t> coefficients; coefficients.SetSize(degree + 1); coefficients[0] = coefficient; CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly(); diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp index 60f1f1bbed..748646bcad 100644 --- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp +++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp @@ -38,7 +38,7 @@ CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly() { m_field = nullptr; } void CBC_ReedSolomonGF256Poly::Init(CBC_ReedSolomonGF256* field, - CFX_Int32Array* coefficients, + CFX_ArrayTemplate<int32_t>* coefficients, int32_t& e) { if (!coefficients || coefficients->GetSize() == 0) { e = BCExceptionCoefficientsSizeIsNull; @@ -64,7 +64,7 @@ void CBC_ReedSolomonGF256Poly::Init(CBC_ReedSolomonGF256* field, m_coefficients.Copy(*coefficients); } } -CFX_Int32Array* CBC_ReedSolomonGF256Poly::GetCoefficients() { +CFX_ArrayTemplate<int32_t>* CBC_ReedSolomonGF256Poly::GetCoefficients() { return &m_coefficients; } int32_t CBC_ReedSolomonGF256Poly::GetDegree() { @@ -109,17 +109,17 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract( if (other->IsZero()) return Clone(e); - CFX_Int32Array smallerCoefficients; + CFX_ArrayTemplate<int32_t> smallerCoefficients; smallerCoefficients.Copy(m_coefficients); - CFX_Int32Array largerCoefficients; + CFX_ArrayTemplate<int32_t> largerCoefficients; largerCoefficients.Copy(*(other->GetCoefficients())); if (smallerCoefficients.GetSize() > largerCoefficients.GetSize()) { - CFX_Int32Array temp; + CFX_ArrayTemplate<int32_t> temp; temp.Copy(smallerCoefficients); smallerCoefficients.Copy(largerCoefficients); largerCoefficients.Copy(temp); } - CFX_Int32Array sumDiff; + CFX_ArrayTemplate<int32_t> sumDiff; sumDiff.SetSize(largerCoefficients.GetSize()); int32_t lengthDiff = largerCoefficients.GetSize() - smallerCoefficients.GetSize(); @@ -141,13 +141,13 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply( if (IsZero() || other->IsZero()) return m_field->GetZero()->Clone(e); - CFX_Int32Array aCoefficients; + CFX_ArrayTemplate<int32_t> aCoefficients; aCoefficients.Copy(m_coefficients); int32_t aLength = m_coefficients.GetSize(); - CFX_Int32Array bCoefficients; + CFX_ArrayTemplate<int32_t> bCoefficients; bCoefficients.Copy(*(other->GetCoefficients())); int32_t bLength = other->GetCoefficients()->GetSize(); - CFX_Int32Array product; + CFX_ArrayTemplate<int32_t> product; product.SetSize(aLength + bLength - 1); for (int32_t i = 0; i < aLength; i++) { int32_t aCoeff = m_coefficients[i]; @@ -170,7 +170,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(int32_t scalar, return Clone(e); int32_t size = m_coefficients.GetSize(); - CFX_Int32Array product; + CFX_ArrayTemplate<int32_t> product; product.SetSize(size); for (int32_t i = 0; i < size; i++) { product[i] = m_field->Multiply(m_coefficients[i], scalar); @@ -192,7 +192,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial( return m_field->GetZero()->Clone(e); int32_t size = m_coefficients.GetSize(); - CFX_Int32Array product; + CFX_ArrayTemplate<int32_t> product; product.SetSize(size + degree); for (int32_t i = 0; i < size; i++) { product[i] = (m_field->Multiply(m_coefficients[i], coefficient)); diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h index 3eff31b622..ff93264e00 100644 --- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h +++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h @@ -17,11 +17,11 @@ class CBC_ReedSolomonGF256Poly final { CBC_ReedSolomonGF256Poly(); ~CBC_ReedSolomonGF256Poly(); void Init(CBC_ReedSolomonGF256* field, - CFX_Int32Array* coefficients, + CFX_ArrayTemplate<int32_t>* coefficients, int32_t& e); int32_t GetCoefficients(int32_t degree); - CFX_Int32Array* GetCoefficients(); + CFX_ArrayTemplate<int32_t>* GetCoefficients(); int32_t GetDegree(); bool IsZero(); int32_t EvaluateAt(int32_t a); @@ -41,7 +41,7 @@ class CBC_ReedSolomonGF256Poly final { private: CBC_ReedSolomonGF256* m_field; - CFX_Int32Array m_coefficients; + CFX_ArrayTemplate<int32_t> m_coefficients; }; #endif // XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_ 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); diff --git a/xfa/fxbarcode/pdf417/BC_PDF417.cpp b/xfa/fxbarcode/pdf417/BC_PDF417.cpp index 9b8d0c149c..16ed6fdf12 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417.cpp @@ -410,7 +410,7 @@ void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg, CBC_PDF417HighLevelEncoder::encodeHighLevel(msg, m_compaction, e); BC_EXCEPTION_CHECK_ReturnVoid(e); int32_t sourceCodeWords = highLevel.GetLength(); - CFX_Int32Array* dimension = + CFX_ArrayTemplate<int32_t>* dimension = determineDimensions(sourceCodeWords, errorCorrectionCodeWords, e); BC_EXCEPTION_CHECK_ReturnVoid(e); int32_t cols = dimension->GetAt(0); @@ -532,12 +532,12 @@ void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords, } } -CFX_Int32Array* CBC_PDF417::determineDimensions( +CFX_ArrayTemplate<int32_t>* CBC_PDF417::determineDimensions( int32_t sourceCodeWords, int32_t errorCorrectionCodeWords, int32_t& e) { FX_FLOAT ratio = 0.0f; - CFX_Int32Array* dimension = nullptr; + CFX_ArrayTemplate<int32_t>* dimension = nullptr; for (int32_t cols = m_minCols; cols <= m_maxCols; cols++) { int32_t rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols); @@ -555,7 +555,7 @@ CFX_Int32Array* CBC_PDF417::determineDimensions( } ratio = newRatio; delete dimension; - dimension = new CFX_Int32Array; + dimension = new CFX_ArrayTemplate<int32_t>; dimension->Add(cols); dimension->Add(rows); } @@ -563,11 +563,11 @@ CFX_Int32Array* CBC_PDF417::determineDimensions( int32_t rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, m_minCols); if (rows < m_minRows) { - dimension = new CFX_Int32Array; + dimension = new CFX_ArrayTemplate<int32_t>; dimension->Add(m_minCols); dimension->Add(m_minRows); } else if (rows >= 3 && rows <= 90) { - dimension = new CFX_Int32Array; + dimension = new CFX_ArrayTemplate<int32_t>; dimension->Add(m_minCols); dimension->Add(rows); } diff --git a/xfa/fxbarcode/pdf417/BC_PDF417.h b/xfa/fxbarcode/pdf417/BC_PDF417.h index 5f7c2d49b9..3ba5aa2f0c 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417.h +++ b/xfa/fxbarcode/pdf417/BC_PDF417.h @@ -51,9 +51,10 @@ class CBC_PDF417 { int32_t r, int32_t errorCorrectionLevel, CBC_BarcodeMatrix* logic); - CFX_Int32Array* determineDimensions(int32_t sourceCodeWords, - int32_t errorCorrectionCodeWords, - int32_t& e); + CFX_ArrayTemplate<int32_t>* determineDimensions( + int32_t sourceCodeWords, + int32_t errorCorrectionCodeWords, + int32_t& e); std::unique_ptr<CBC_BarcodeMatrix> m_barcodeMatrix; bool m_compact; diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp index f348d2c934..c1f4da1e3b 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp @@ -59,16 +59,16 @@ int32_t CBC_BarcodeMatrix::getWidth() { int32_t CBC_BarcodeMatrix::getHeight() { return m_outHeight; } -CFX_ByteArray& CBC_BarcodeMatrix::getMatrix() { +CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getMatrix() { return getScaledMatrix(1, 1); } -CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(int32_t scale) { +CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t scale) { return getScaledMatrix(scale, scale); } -CFX_ByteArray& CBC_BarcodeMatrix::getScaledMatrix(int32_t xScale, - int32_t yScale) { +CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t xScale, + int32_t yScale) { int32_t yMax = m_height * yScale; - CFX_ByteArray bytearray; + CFX_ArrayTemplate<uint8_t> bytearray; bytearray.Copy(m_matrix[0]->getScaledRow(xScale)); int32_t xMax = bytearray.GetSize(); m_matrixOut.SetSize(xMax * yMax); diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h index 0f6922233d..95ab547c90 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h +++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h @@ -21,15 +21,15 @@ class CBC_BarcodeMatrix { void setMatrix(int32_t x, int32_t y, bool black); void startRow(); CBC_BarcodeRow* getCurrentRow(); - CFX_ByteArray& getMatrix(); - CFX_ByteArray& getScaledMatrix(int32_t scale); - CFX_ByteArray& getScaledMatrix(int32_t xScale, int32_t yScale); + CFX_ArrayTemplate<uint8_t>& getMatrix(); + CFX_ArrayTemplate<uint8_t>& getScaledMatrix(int32_t scale); + CFX_ArrayTemplate<uint8_t>& getScaledMatrix(int32_t xScale, int32_t yScale); int32_t getWidth(); int32_t getHeight(); private: CFX_ArrayTemplate<CBC_BarcodeRow*> m_matrix; - CFX_ByteArray m_matrixOut; + CFX_ArrayTemplate<uint8_t> m_matrixOut; int32_t m_currentRow; int32_t m_height; int32_t m_width; diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp index b721ffc3ef..243af70d94 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp @@ -41,10 +41,10 @@ void CBC_BarcodeRow::addBar(bool black, int32_t width) { set(m_currentLocation++, black); } } -CFX_ByteArray& CBC_BarcodeRow::getRow() { +CFX_ArrayTemplate<uint8_t>& CBC_BarcodeRow::getRow() { return m_row; } -CFX_ByteArray& CBC_BarcodeRow::getScaledRow(int32_t scale) { +CFX_ArrayTemplate<uint8_t>& CBC_BarcodeRow::getScaledRow(int32_t scale) { m_output.SetSize(m_row.GetSize() * scale); for (int32_t i = 0; i < m_output.GetSize(); i++) { m_output[i] = (m_row[i / scale]); diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h index 90e76ac50a..7d9d19cb56 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h +++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h @@ -17,12 +17,12 @@ class CBC_BarcodeRow { void set(int32_t x, uint8_t value); void set(int32_t x, bool black); void addBar(bool black, int32_t width); - CFX_ByteArray& getRow(); - CFX_ByteArray& getScaledRow(int32_t scale); + CFX_ArrayTemplate<uint8_t>& getRow(); + CFX_ArrayTemplate<uint8_t>& getScaledRow(int32_t scale); private: - CFX_ByteArray m_row; - CFX_ByteArray m_output; + CFX_ArrayTemplate<uint8_t> m_row; + CFX_ArrayTemplate<uint8_t> m_output; int32_t m_currentLocation; }; diff --git a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp index fa0e9bc67d..183566f9e3 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp @@ -71,7 +71,7 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel( } msg += ch; } - CFX_ByteArray byteArr; + CFX_ArrayTemplate<uint8_t> byteArr; for (int32_t k = 0; k < bytes.GetLength(); k++) { byteArr.Add(bytes.GetAt(k)); } @@ -260,7 +260,7 @@ int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, } return submode; } -void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ByteArray* bytes, +void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes, int32_t startpos, int32_t count, int32_t startmode, @@ -387,7 +387,7 @@ int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount( } int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount( CFX_WideString msg, - CFX_ByteArray* bytes, + CFX_ArrayTemplate<uint8_t>* bytes, int32_t startpos, int32_t& e) { int32_t len = msg.GetLength(); diff --git a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h index 39abe0f1df..38382c891c 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h +++ b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h @@ -39,7 +39,7 @@ class CBC_PDF417HighLevelEncoder { int32_t count, CFX_WideString& sb, int32_t initialSubmode); - static void encodeBinary(CFX_ByteArray* bytes, + static void encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes, int32_t startpos, int32_t count, int32_t startmode, @@ -58,10 +58,11 @@ class CBC_PDF417HighLevelEncoder { 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); + static int32_t determineConsecutiveBinaryCount( + CFX_WideString msg, + CFX_ArrayTemplate<uint8_t>* bytes, + int32_t startpos, + int32_t& e); friend class PDF417HighLevelEncoder_EncodeNumeric_Test; friend class PDF417HighLevelEncoder_EncodeBinary_Test; diff --git a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp index a1b753e3ee..2cd60fef41 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp @@ -43,7 +43,7 @@ TEST(PDF417HighLevelEncoder, EncodeBinary) { CBC_PDF417HighLevelEncoder::Initialize(); for (size_t i = 0; i < FX_ArraySize(encode_binary_cases); ++i) { EncodeBinaryCase* ptr = &encode_binary_cases[i]; - CFX_ByteArray input_array; + CFX_ArrayTemplate<uint8_t> input_array; size_t input_length = strlen(ptr->input); input_array.SetSize(input_length); for (size_t j = 0; j < input_length; ++j) { diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp b/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp index 4c9b5cb15c..72d1a05dfd 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp +++ b/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp @@ -63,7 +63,7 @@ uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents, int32_t lineThickness = 2; int32_t aspectRatio = 4; CBC_BarcodeMatrix* barcodeMatrix = encoder.getBarcodeMatrix(); - CFX_ByteArray originalScale; + CFX_ArrayTemplate<uint8_t> originalScale; originalScale.Copy(barcodeMatrix->getScaledMatrix( lineThickness, aspectRatio * lineThickness)); int32_t width = outWidth; @@ -101,10 +101,10 @@ uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents, FXSYS_memcpy(result, originalScale.GetData(), outHeight * outWidth); return result; } -void CBC_PDF417Writer::rotateArray(CFX_ByteArray& bitarray, +void CBC_PDF417Writer::rotateArray(CFX_ArrayTemplate<uint8_t>& bitarray, int32_t height, int32_t width) { - CFX_ByteArray temp; + CFX_ArrayTemplate<uint8_t> temp; temp.Copy(bitarray); for (int32_t ii = 0; ii < height; ii++) { int32_t inverseii = height - ii - 1; diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Writer.h b/xfa/fxbarcode/pdf417/BC_PDF417Writer.h index 178d251bfe..420c441bc9 100644 --- a/xfa/fxbarcode/pdf417/BC_PDF417Writer.h +++ b/xfa/fxbarcode/pdf417/BC_PDF417Writer.h @@ -27,7 +27,9 @@ class CBC_PDF417Writer : public CBC_TwoDimWriter { void SetTruncated(bool truncated); private: - void rotateArray(CFX_ByteArray& bitarray, int32_t width, int32_t height); + void rotateArray(CFX_ArrayTemplate<uint8_t>& bitarray, + int32_t width, + int32_t height); bool m_bTruncated; }; diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp index 332f1de9c2..ab17d244fa 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp @@ -95,7 +95,7 @@ void CBC_QRCoderEncoder::AppendDataModeLenghInfo( e); BC_EXCEPTION_CHECK_ReturnVoid(e); } else if (tempMode == CBC_QRCoderMode::sBYTE) { - CFX_ByteArray bytes; + CFX_ArrayTemplate<uint8_t> bytes; CBC_UtilCodingConvert::LocaleToUtf8(splitResult.second, bytes); AppendModeInfo(tempMode, &headerAndDataBits, e); BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -722,7 +722,7 @@ void CBC_QRCoderEncoder::Append8BitBytes(const CFX_ByteString& content, } } -void CBC_QRCoderEncoder::Append8BitBytes(CFX_ByteArray& bytes, +void CBC_QRCoderEncoder::Append8BitBytes(CFX_ArrayTemplate<uint8_t>& bytes, CBC_QRCoderBitVector* bits, int32_t& e) { for (int32_t i = 0; i < bytes.GetSize(); i++) { @@ -734,7 +734,7 @@ void CBC_QRCoderEncoder::Append8BitBytes(CFX_ByteArray& bytes, void CBC_QRCoderEncoder::AppendKanjiBytes(const CFX_ByteString& content, CBC_QRCoderBitVector* bits, int32_t& e) { - CFX_ByteArray bytes; + CFX_ArrayTemplate<uint8_t> bytes; uint32_t value = 0; for (int32_t i = 0; i < bytes.GetSize(); i += 2) { value = (uint32_t)((uint8_t)(content[i] << 8) | (uint8_t)content[i + 1]); @@ -907,7 +907,7 @@ CBC_CommonByteArray* CBC_QRCoderEncoder::GenerateECBytes( int32_t numEcBytesInBlock, int32_t& e) { int32_t numDataBytes = dataBytes->Size(); - CFX_Int32Array toEncode; + CFX_ArrayTemplate<int32_t> toEncode; toEncode.SetSize(numDataBytes + numEcBytesInBlock); for (int32_t i = 0; i < numDataBytes; i++) { toEncode[i] = (dataBytes->At(i)); diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h index 649938a060..a1b078f24c 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h +++ b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h @@ -62,7 +62,7 @@ class CBC_QRCoderEncoder { CBC_QRCoderBitVector* bits, CFX_ByteString encoding, int32_t& e); - static void Append8BitBytes(CFX_ByteArray& bytes, + static void Append8BitBytes(CFX_ArrayTemplate<uint8_t>& bytes, CBC_QRCoderBitVector* bits, int32_t& e); static void AppendKanjiBytes(const CFX_ByteString& content, diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp index b0b445bede..b4effb91a5 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp +++ b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp @@ -354,7 +354,7 @@ CBC_QRCoderVersion::~CBC_QRCoderVersion() { int32_t CBC_QRCoderVersion::GetVersionNumber() { return m_versionNumber; } -CFX_Int32Array* CBC_QRCoderVersion::GetAlignmentPatternCenters() { +CFX_ArrayTemplate<int32_t>* CBC_QRCoderVersion::GetAlignmentPatternCenters() { return &m_alignmentPatternCenters; } int32_t CBC_QRCoderVersion::GetTotalCodeWords() { diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.h b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.h index 43b4b6062e..030dd512a0 100644 --- a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.h +++ b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.h @@ -23,7 +23,7 @@ class CBC_QRCoderVersion { int32_t GetTotalCodeWords(); int32_t GetDimensionForVersion(); CBC_CommonBitMatrix* BuildFunctionPattern(int32_t& e); - CFX_Int32Array* GetAlignmentPatternCenters(); + CFX_ArrayTemplate<int32_t>* GetAlignmentPatternCenters(); CBC_QRCoderECBlocks* GetECBlocksForLevel( CBC_QRCoderErrorCorrectionLevel* ecLevel); static CBC_QRCoderVersion* GetVersionForNumber(int32_t versionNumber, @@ -48,7 +48,7 @@ class CBC_QRCoderVersion { int32_t m_versionNumber; int32_t m_totalCodeWords; - CFX_Int32Array m_alignmentPatternCenters; + CFX_ArrayTemplate<int32_t> m_alignmentPatternCenters; CFX_ArrayTemplate<CBC_QRCoderECBlocks*> m_ecBlocksArray; }; diff --git a/xfa/fxbarcode/utils.h b/xfa/fxbarcode/utils.h index 7473d4196b..cb6eed7fe1 100644 --- a/xfa/fxbarcode/utils.h +++ b/xfa/fxbarcode/utils.h @@ -15,7 +15,8 @@ bool BC_FX_ByteString_Replace(CFX_ByteString& dst, int32_t count, FX_CHAR c); void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, FX_CHAR c); -void BC_FX_ByteString_Append(CFX_ByteString& dst, const CFX_ByteArray& ba); +void BC_FX_ByteString_Append(CFX_ByteString& dst, + const CFX_ArrayTemplate<uint8_t>& ba); #if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_) #include <limits> |