summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/common/reedsolomon
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxbarcode/common/reedsolomon')
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp8
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h4
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp2
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp22
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h6
5 files changed, 22 insertions, 20 deletions
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_