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/common | |
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/common')
9 files changed, 27 insertions, 25 deletions
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_ |