OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 // Original code is licensed as follows: | 6 // Original code is licensed as follows: |
7 /* | 7 /* |
8 * Copyright 2012 ZXing authors | 8 * Copyright 2012 ZXing authors |
9 * | 9 * |
10 * Licensed under the Apache License, Version 2.0 (the "License"); | 10 * Licensed under the Apache License, Version 2.0 (the "License"); |
11 * you may not use this file except in compliance with the License. | 11 * you may not use this file except in compliance with the License. |
12 * You may obtain a copy of the License at | 12 * You may obtain a copy of the License at |
13 * | 13 * |
14 * http://www.apache.org/licenses/LICENSE-2.0 | 14 * http://www.apache.org/licenses/LICENSE-2.0 |
15 * | 15 * |
16 * Unless required by applicable law or agreed to in writing, software | 16 * Unless required by applicable law or agreed to in writing, software |
17 * distributed under the License is distributed on an "AS IS" BASIS, | 17 * distributed under the License is distributed on an "AS IS" BASIS, |
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
19 * See the License for the specific language governing permissions and | 19 * See the License for the specific language governing permissions and |
20 * limitations under the License. | 20 * limitations under the License. |
21 */ | 21 */ |
22 | 22 |
23 #include "../barcode.h" | 23 #include "../barcode.h" |
24 #include "BC_PDF417Common.h" | 24 #include "BC_PDF417Common.h" |
25 #include "BC_PDF417ECModulusPoly.h" | 25 #include "BC_PDF417ECModulusPoly.h" |
26 #include "BC_PDF417ECModulusGF.h" | 26 #include "BC_PDF417ECModulusGF.h" |
27 #include "BC_PDF417ECErrorCorrection.h" | 27 #include "BC_PDF417ECErrorCorrection.h" |
28 CBC_PDF417ECModulusGF* CBC_PDF417ECErrorCorrection::m_field = NULL; | 28 CBC_PDF417ECModulusGF* CBC_PDF417ECErrorCorrection::m_field = NULL; |
29 void CBC_PDF417ECErrorCorrection::Initialize(FX_INT32 &e) | 29 void CBC_PDF417ECErrorCorrection::Initialize(int32_t &e) |
30 { | 30 { |
31 m_field = FX_NEW CBC_PDF417ECModulusGF(CBC_PDF417Common::NUMBER_OF_CODEWORDS
, 3, e); | 31 m_field = FX_NEW CBC_PDF417ECModulusGF(CBC_PDF417Common::NUMBER_OF_CODEWORDS
, 3, e); |
32 } | 32 } |
33 void CBC_PDF417ECErrorCorrection::Finalize() | 33 void CBC_PDF417ECErrorCorrection::Finalize() |
34 { | 34 { |
35 delete m_field; | 35 delete m_field; |
36 } | 36 } |
37 CBC_PDF417ECErrorCorrection::CBC_PDF417ECErrorCorrection() | 37 CBC_PDF417ECErrorCorrection::CBC_PDF417ECErrorCorrection() |
38 { | 38 { |
39 } | 39 } |
40 CBC_PDF417ECErrorCorrection::~CBC_PDF417ECErrorCorrection() | 40 CBC_PDF417ECErrorCorrection::~CBC_PDF417ECErrorCorrection() |
41 { | 41 { |
42 } | 42 } |
43 FX_INT32 CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array &received, FX_INT32
numECCodewords, CFX_Int32Array &erasures, FX_INT32 &e) | 43 int32_t CBC_PDF417ECErrorCorrection::decode(CFX_Int32Array &received, int32_t nu
mECCodewords, CFX_Int32Array &erasures, int32_t &e) |
44 { | 44 { |
45 CBC_PDF417ECModulusPoly poly(m_field, received, e); | 45 CBC_PDF417ECModulusPoly poly(m_field, received, e); |
46 BC_EXCEPTION_CHECK_ReturnValue(e, -1); | 46 BC_EXCEPTION_CHECK_ReturnValue(e, -1); |
47 CFX_Int32Array S; | 47 CFX_Int32Array S; |
48 S.SetSize(numECCodewords); | 48 S.SetSize(numECCodewords); |
49 FX_BOOL error = FALSE; | 49 FX_BOOL error = FALSE; |
50 for (FX_INT32 l = numECCodewords; l > 0; l--) { | 50 for (int32_t l = numECCodewords; l > 0; l--) { |
51 FX_INT32 eval = poly.evaluateAt(m_field->exp(l)); | 51 int32_t eval = poly.evaluateAt(m_field->exp(l)); |
52 S[numECCodewords - l] = eval; | 52 S[numECCodewords - l] = eval; |
53 if (eval != 0) { | 53 if (eval != 0) { |
54 error = TRUE; | 54 error = TRUE; |
55 } | 55 } |
56 } | 56 } |
57 if (!error) { | 57 if (!error) { |
58 return 0; | 58 return 0; |
59 } | 59 } |
60 CBC_PDF417ECModulusPoly* syndrome = FX_NEW CBC_PDF417ECModulusPoly(m_field,
S, e); | 60 CBC_PDF417ECModulusPoly* syndrome = FX_NEW CBC_PDF417ECModulusPoly(m_field,
S, e); |
61 BC_EXCEPTION_CHECK_ReturnValue(e, -1); | 61 BC_EXCEPTION_CHECK_ReturnValue(e, -1); |
62 CBC_PDF417ECModulusPoly* buildmonomial = m_field->buildMonomial(numECCodewor
ds, 1, e); | 62 CBC_PDF417ECModulusPoly* buildmonomial = m_field->buildMonomial(numECCodewor
ds, 1, e); |
63 if (e != BCExceptionNO) { | 63 if (e != BCExceptionNO) { |
64 delete syndrome; | 64 delete syndrome; |
65 return -1; | 65 return -1; |
66 } | 66 } |
67 CFX_PtrArray* sigmaOmega = runEuclideanAlgorithm(buildmonomial, syndrome, nu
mECCodewords, e); | 67 CFX_PtrArray* sigmaOmega = runEuclideanAlgorithm(buildmonomial, syndrome, nu
mECCodewords, e); |
68 delete buildmonomial; | 68 delete buildmonomial; |
69 delete syndrome; | 69 delete syndrome; |
70 BC_EXCEPTION_CHECK_ReturnValue(e, -1); | 70 BC_EXCEPTION_CHECK_ReturnValue(e, -1); |
71 CBC_PDF417ECModulusPoly* sigma = (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt
(0); | 71 CBC_PDF417ECModulusPoly* sigma = (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt
(0); |
72 CBC_PDF417ECModulusPoly* omega = (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt
(1); | 72 CBC_PDF417ECModulusPoly* omega = (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt
(1); |
73 CFX_Int32Array* errorLocations = findErrorLocations(sigma, e); | 73 CFX_Int32Array* errorLocations = findErrorLocations(sigma, e); |
74 if (e != BCExceptionNO) { | 74 if (e != BCExceptionNO) { |
75 for (FX_INT32 i = 0; i < sigmaOmega->GetSize(); i++) { | 75 for (int32_t i = 0; i < sigmaOmega->GetSize(); i++) { |
76 delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(i); | 76 delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(i); |
77 } | 77 } |
78 sigmaOmega->RemoveAll(); | 78 sigmaOmega->RemoveAll(); |
79 delete sigmaOmega; | 79 delete sigmaOmega; |
80 return -1; | 80 return -1; |
81 } | 81 } |
82 CFX_Int32Array* errorMagnitudes = findErrorMagnitudes(omega, sigma, *errorLo
cations, e); | 82 CFX_Int32Array* errorMagnitudes = findErrorMagnitudes(omega, sigma, *errorLo
cations, e); |
83 if (e != BCExceptionNO) { | 83 if (e != BCExceptionNO) { |
84 delete errorLocations; | 84 delete errorLocations; |
85 for (FX_INT32 i = 0; i < sigmaOmega->GetSize(); i++) { | 85 for (int32_t i = 0; i < sigmaOmega->GetSize(); i++) { |
86 delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(i); | 86 delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(i); |
87 } | 87 } |
88 sigmaOmega->RemoveAll(); | 88 sigmaOmega->RemoveAll(); |
89 delete sigmaOmega; | 89 delete sigmaOmega; |
90 return -1; | 90 return -1; |
91 } | 91 } |
92 for (FX_INT32 i = 0; i < errorLocations->GetSize(); i++) { | 92 for (int32_t i = 0; i < errorLocations->GetSize(); i++) { |
93 FX_INT32 log = m_field->log(errorLocations->GetAt(i), e);; | 93 int32_t log = m_field->log(errorLocations->GetAt(i), e);; |
94 BC_EXCEPTION_CHECK_ReturnValue(e, -1); | 94 BC_EXCEPTION_CHECK_ReturnValue(e, -1); |
95 FX_INT32 position = received.GetSize() - 1 - log; | 95 int32_t position = received.GetSize() - 1 - log; |
96 if (position < 0) { | 96 if (position < 0) { |
97 e = BCExceptionChecksumException; | 97 e = BCExceptionChecksumException; |
98 delete errorLocations; | 98 delete errorLocations; |
99 delete errorMagnitudes; | 99 delete errorMagnitudes; |
100 for (FX_INT32 j = 0; j < sigmaOmega->GetSize(); j++) { | 100 for (int32_t j = 0; j < sigmaOmega->GetSize(); j++) { |
101 delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(j); | 101 delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(j); |
102 } | 102 } |
103 sigmaOmega->RemoveAll(); | 103 sigmaOmega->RemoveAll(); |
104 delete sigmaOmega; | 104 delete sigmaOmega; |
105 return -1; | 105 return -1; |
106 } | 106 } |
107 received[position] = m_field->subtract(received[position], errorMagnitud
es->GetAt(i)); | 107 received[position] = m_field->subtract(received[position], errorMagnitud
es->GetAt(i)); |
108 } | 108 } |
109 FX_INT32 result = errorLocations->GetSize(); | 109 int32_t result = errorLocations->GetSize(); |
110 delete errorLocations; | 110 delete errorLocations; |
111 delete errorMagnitudes; | 111 delete errorMagnitudes; |
112 for (FX_INT32 k = 0; k < sigmaOmega->GetSize(); k++) { | 112 for (int32_t k = 0; k < sigmaOmega->GetSize(); k++) { |
113 delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(k); | 113 delete (CBC_PDF417ECModulusPoly*)sigmaOmega->GetAt(k); |
114 } | 114 } |
115 sigmaOmega->RemoveAll(); | 115 sigmaOmega->RemoveAll(); |
116 delete sigmaOmega; | 116 delete sigmaOmega; |
117 return result; | 117 return result; |
118 } | 118 } |
119 CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod
ulusPoly* a, CBC_PDF417ECModulusPoly* b, FX_INT32 R, FX_INT32 &e) | 119 CFX_PtrArray* CBC_PDF417ECErrorCorrection::runEuclideanAlgorithm(CBC_PDF417ECMod
ulusPoly* a, CBC_PDF417ECModulusPoly* b, int32_t R, int32_t &e) |
120 { | 120 { |
121 if (a->getDegree() < b->getDegree()) { | 121 if (a->getDegree() < b->getDegree()) { |
122 CBC_PDF417ECModulusPoly* temp = a; | 122 CBC_PDF417ECModulusPoly* temp = a; |
123 a = b; | 123 a = b; |
124 b = temp; | 124 b = temp; |
125 } | 125 } |
126 CBC_PDF417ECModulusPoly* rLast = a; | 126 CBC_PDF417ECModulusPoly* rLast = a; |
127 CBC_PDF417ECModulusPoly* r = b; | 127 CBC_PDF417ECModulusPoly* r = b; |
128 CBC_PDF417ECModulusPoly* tLast = m_field->getZero(); | 128 CBC_PDF417ECModulusPoly* tLast = m_field->getZero(); |
129 CBC_PDF417ECModulusPoly* t = m_field->getOne(); | 129 CBC_PDF417ECModulusPoly* t = m_field->getOne(); |
130 CBC_PDF417ECModulusPoly* qtemp = NULL; | 130 CBC_PDF417ECModulusPoly* qtemp = NULL; |
131 CBC_PDF417ECModulusPoly* rtemp = NULL; | 131 CBC_PDF417ECModulusPoly* rtemp = NULL; |
132 CBC_PDF417ECModulusPoly* ttemp = NULL; | 132 CBC_PDF417ECModulusPoly* ttemp = NULL; |
133 FX_INT32 i = 0; | 133 int32_t i = 0; |
134 FX_INT32 j = 0; | 134 int32_t j = 0; |
135 FX_INT32 m = 0; | 135 int32_t m = 0; |
136 FX_INT32 n = 0; | 136 int32_t n = 0; |
137 while (r->getDegree() >= R / 2) { | 137 while (r->getDegree() >= R / 2) { |
138 CBC_PDF417ECModulusPoly* rLastLast = rLast; | 138 CBC_PDF417ECModulusPoly* rLastLast = rLast; |
139 CBC_PDF417ECModulusPoly* tLastLast = tLast; | 139 CBC_PDF417ECModulusPoly* tLastLast = tLast; |
140 rLast = r; | 140 rLast = r; |
141 tLast = t; | 141 tLast = t; |
142 m = i; | 142 m = i; |
143 n = j; | 143 n = j; |
144 if (rLast->isZero()) { | 144 if (rLast->isZero()) { |
145 e = BCExceptionChecksumException; | 145 e = BCExceptionChecksumException; |
146 if (qtemp) { | 146 if (qtemp) { |
147 delete qtemp; | 147 delete qtemp; |
148 } | 148 } |
149 if (rtemp) { | 149 if (rtemp) { |
150 delete rtemp; | 150 delete rtemp; |
151 } | 151 } |
152 if (ttemp) { | 152 if (ttemp) { |
153 delete ttemp; | 153 delete ttemp; |
154 } | 154 } |
155 return NULL; | 155 return NULL; |
156 } | 156 } |
157 r = rLastLast; | 157 r = rLastLast; |
158 CBC_PDF417ECModulusPoly* q = m_field->getZero(); | 158 CBC_PDF417ECModulusPoly* q = m_field->getZero(); |
159 FX_INT32 denominatorLeadingTerm = rLast->getCoefficient(rLast->getDegree
()); | 159 int32_t denominatorLeadingTerm = rLast->getCoefficient(rLast->getDegree(
)); |
160 FX_INT32 dltInverse = m_field->inverse(denominatorLeadingTerm, e); | 160 int32_t dltInverse = m_field->inverse(denominatorLeadingTerm, e); |
161 if (e != BCExceptionNO) { | 161 if (e != BCExceptionNO) { |
162 if (qtemp) { | 162 if (qtemp) { |
163 delete qtemp; | 163 delete qtemp; |
164 } | 164 } |
165 if (rtemp) { | 165 if (rtemp) { |
166 delete rtemp; | 166 delete rtemp; |
167 } | 167 } |
168 if (ttemp) { | 168 if (ttemp) { |
169 delete ttemp; | 169 delete ttemp; |
170 } | 170 } |
171 return NULL; | 171 return NULL; |
172 } | 172 } |
173 while (r->getDegree() >= rLast->getDegree() && !r->isZero()) { | 173 while (r->getDegree() >= rLast->getDegree() && !r->isZero()) { |
174 FX_INT32 degreeDiff = r->getDegree() - rLast->getDegree(); | 174 int32_t degreeDiff = r->getDegree() - rLast->getDegree(); |
175 FX_INT32 scale = m_field->multiply(r->getCoefficient(r->getDegree())
, dltInverse); | 175 int32_t scale = m_field->multiply(r->getCoefficient(r->getDegree()),
dltInverse); |
176 CBC_PDF417ECModulusPoly* buildmonomial = m_field->buildMonomial(degr
eeDiff, scale, e); | 176 CBC_PDF417ECModulusPoly* buildmonomial = m_field->buildMonomial(degr
eeDiff, scale, e); |
177 if (e != BCExceptionNO) { | 177 if (e != BCExceptionNO) { |
178 if (qtemp) { | 178 if (qtemp) { |
179 delete qtemp; | 179 delete qtemp; |
180 } | 180 } |
181 if (rtemp) { | 181 if (rtemp) { |
182 delete rtemp; | 182 delete rtemp; |
183 } | 183 } |
184 if (ttemp) { | 184 if (ttemp) { |
185 delete ttemp; | 185 delete ttemp; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 delete ttemp; | 266 delete ttemp; |
267 if (e != BCExceptionNO) { | 267 if (e != BCExceptionNO) { |
268 if (rtemp) { | 268 if (rtemp) { |
269 delete rtemp; | 269 delete rtemp; |
270 } | 270 } |
271 return NULL; | 271 return NULL; |
272 } | 272 } |
273 ttemp = t; | 273 ttemp = t; |
274 j++; | 274 j++; |
275 } | 275 } |
276 FX_INT32 aa = t->getCoefficient(1); | 276 int32_t aa = t->getCoefficient(1); |
277 FX_INT32 sigmaTildeAtZero = t->getCoefficient(0); | 277 int32_t sigmaTildeAtZero = t->getCoefficient(0); |
278 if (sigmaTildeAtZero == 0) { | 278 if (sigmaTildeAtZero == 0) { |
279 e = BCExceptionChecksumException; | 279 e = BCExceptionChecksumException; |
280 if (rtemp) { | 280 if (rtemp) { |
281 delete rtemp; | 281 delete rtemp; |
282 } | 282 } |
283 if (ttemp) { | 283 if (ttemp) { |
284 delete ttemp; | 284 delete ttemp; |
285 } | 285 } |
286 return NULL; | 286 return NULL; |
287 } | 287 } |
288 FX_INT32 inverse = m_field->inverse(sigmaTildeAtZero, e); | 288 int32_t inverse = m_field->inverse(sigmaTildeAtZero, e); |
289 if (e != BCExceptionNO) { | 289 if (e != BCExceptionNO) { |
290 if (rtemp) { | 290 if (rtemp) { |
291 delete rtemp; | 291 delete rtemp; |
292 } | 292 } |
293 if (ttemp) { | 293 if (ttemp) { |
294 delete ttemp; | 294 delete ttemp; |
295 } | 295 } |
296 return NULL; | 296 return NULL; |
297 } | 297 } |
298 CBC_PDF417ECModulusPoly* sigma = t->multiply(inverse, e); | 298 CBC_PDF417ECModulusPoly* sigma = t->multiply(inverse, e); |
299 if (ttemp) { | 299 if (ttemp) { |
300 delete ttemp; | 300 delete ttemp; |
301 } | 301 } |
302 if (e != BCExceptionNO) { | 302 if (e != BCExceptionNO) { |
303 if (rtemp) { | 303 if (rtemp) { |
304 delete rtemp; | 304 delete rtemp; |
305 } | 305 } |
306 return NULL; | 306 return NULL; |
307 } | 307 } |
308 CBC_PDF417ECModulusPoly* omega = r->multiply(inverse, e); | 308 CBC_PDF417ECModulusPoly* omega = r->multiply(inverse, e); |
309 if (rtemp) { | 309 if (rtemp) { |
310 delete rtemp; | 310 delete rtemp; |
311 } | 311 } |
312 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 312 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
313 CFX_PtrArray* modulusPoly = FX_NEW CFX_PtrArray; | 313 CFX_PtrArray* modulusPoly = FX_NEW CFX_PtrArray; |
314 modulusPoly->Add(sigma); | 314 modulusPoly->Add(sigma); |
315 modulusPoly->Add(omega); | 315 modulusPoly->Add(omega); |
316 return modulusPoly; | 316 return modulusPoly; |
317 } | 317 } |
318 CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorLocations(CBC_PDF417ECModu
lusPoly* errorLocator, FX_INT32 &e) | 318 CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorLocations(CBC_PDF417ECModu
lusPoly* errorLocator, int32_t &e) |
319 { | 319 { |
320 FX_INT32 numErrors = errorLocator->getDegree(); | 320 int32_t numErrors = errorLocator->getDegree(); |
321 CFX_Int32Array* result = FX_NEW CFX_Int32Array; | 321 CFX_Int32Array* result = FX_NEW CFX_Int32Array; |
322 result->SetSize(numErrors); | 322 result->SetSize(numErrors); |
323 FX_INT32 ee = 0; | 323 int32_t ee = 0; |
324 for (FX_INT32 i = 1; i < m_field->getSize() && ee < numErrors; i++) { | 324 for (int32_t i = 1; i < m_field->getSize() && ee < numErrors; i++) { |
325 if (errorLocator->evaluateAt(i) == 0) { | 325 if (errorLocator->evaluateAt(i) == 0) { |
326 result->SetAt(ee, m_field->inverse(i, e)); | 326 result->SetAt(ee, m_field->inverse(i, e)); |
327 if (e != BCExceptionNO) { | 327 if (e != BCExceptionNO) { |
328 delete result; | 328 delete result; |
329 return NULL; | 329 return NULL; |
330 } | 330 } |
331 ee++; | 331 ee++; |
332 } | 332 } |
333 } | 333 } |
334 if (ee != numErrors) { | 334 if (ee != numErrors) { |
335 e = BCExceptionChecksumException; | 335 e = BCExceptionChecksumException; |
336 delete result; | 336 delete result; |
337 return NULL; | 337 return NULL; |
338 } | 338 } |
339 return result; | 339 return result; |
340 } | 340 } |
341 CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorMagnitudes(CBC_PDF417ECMod
ulusPoly* errorEvaluator, CBC_PDF417ECModulusPoly* errorLocator, CFX_Int32Array
&errorLocations, FX_INT32 &e) | 341 CFX_Int32Array* CBC_PDF417ECErrorCorrection::findErrorMagnitudes(CBC_PDF417ECMod
ulusPoly* errorEvaluator, CBC_PDF417ECModulusPoly* errorLocator, CFX_Int32Array
&errorLocations, int32_t &e) |
342 { | 342 { |
343 FX_INT32 errorLocatorDegree = errorLocator->getDegree(); | 343 int32_t errorLocatorDegree = errorLocator->getDegree(); |
344 CFX_Int32Array formalDerivativeCoefficients; | 344 CFX_Int32Array formalDerivativeCoefficients; |
345 formalDerivativeCoefficients.SetSize(errorLocatorDegree); | 345 formalDerivativeCoefficients.SetSize(errorLocatorDegree); |
346 for (FX_INT32 l = 1; l <= errorLocatorDegree; l++) { | 346 for (int32_t l = 1; l <= errorLocatorDegree; l++) { |
347 formalDerivativeCoefficients[errorLocatorDegree - l] = m_field->multiply
(l, errorLocator->getCoefficient(l)); | 347 formalDerivativeCoefficients[errorLocatorDegree - l] = m_field->multiply
(l, errorLocator->getCoefficient(l)); |
348 } | 348 } |
349 CBC_PDF417ECModulusPoly formalDerivative(m_field, formalDerivativeCoefficien
ts, e); | 349 CBC_PDF417ECModulusPoly formalDerivative(m_field, formalDerivativeCoefficien
ts, e); |
350 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 350 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
351 FX_INT32 s = errorLocations.GetSize(); | 351 int32_t s = errorLocations.GetSize(); |
352 CFX_Int32Array* result = FX_NEW CFX_Int32Array; | 352 CFX_Int32Array* result = FX_NEW CFX_Int32Array; |
353 result->SetSize(s); | 353 result->SetSize(s); |
354 for (FX_INT32 i = 0; i < s; i++) { | 354 for (int32_t i = 0; i < s; i++) { |
355 FX_INT32 xiInverse = m_field->inverse(errorLocations[i], e); | 355 int32_t xiInverse = m_field->inverse(errorLocations[i], e); |
356 if (e != BCExceptionNO) { | 356 if (e != BCExceptionNO) { |
357 delete result; | 357 delete result; |
358 return NULL; | 358 return NULL; |
359 } | 359 } |
360 FX_INT32 numerator = m_field->subtract(0, errorEvaluator->evaluateAt(xiI
nverse)); | 360 int32_t numerator = m_field->subtract(0, errorEvaluator->evaluateAt(xiIn
verse)); |
361 FX_INT32 denominator = m_field->inverse(formalDerivative.evaluateAt(xiIn
verse), e); | 361 int32_t denominator = m_field->inverse(formalDerivative.evaluateAt(xiInv
erse), e); |
362 if (e != BCExceptionNO) { | 362 if (e != BCExceptionNO) { |
363 delete result; | 363 delete result; |
364 return NULL; | 364 return NULL; |
365 } | 365 } |
366 result->SetAt(i, m_field->multiply(numerator, denominator)); | 366 result->SetAt(i, m_field->multiply(numerator, denominator)); |
367 } | 367 } |
368 return result; | 368 return result; |
369 } | 369 } |
OLD | NEW |