Index: xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp |
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417ECErrorCorrection.cpp |
index 23207ef95971f94421e49c10b4355872ad5b9fc5..d80a7f86acc93b04c46b2c29e7a7d30c90d6b6e8 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; |