Chromium Code Reviews| 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 2013 ZXing authors | 8 * Copyright 2013 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"); |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 CFX_Int32Array ambiguousIndexCount; | 416 CFX_Int32Array ambiguousIndexCount; |
| 417 ambiguousIndexCount.SetSize(ambiguousIndexes.GetSize()); | 417 ambiguousIndexCount.SetSize(ambiguousIndexes.GetSize()); |
| 418 int32_t tries = 100; | 418 int32_t tries = 100; |
| 419 while (tries-- > 0) { | 419 while (tries-- > 0) { |
| 420 for (int32_t l = 0; l < ambiguousIndexCount.GetSize(); l++) { | 420 for (int32_t l = 0; l < ambiguousIndexCount.GetSize(); l++) { |
| 421 codewords[ambiguousIndexes[l]] = | 421 codewords[ambiguousIndexes[l]] = |
| 422 ambiguousIndexValues.GetAt(l)->GetAt(ambiguousIndexCount[l]); | 422 ambiguousIndexValues.GetAt(l)->GetAt(ambiguousIndexCount[l]); |
| 423 } | 423 } |
| 424 CBC_CommonDecoderResult* decoderResult = | 424 CBC_CommonDecoderResult* decoderResult = |
| 425 decodeCodewords(codewords, ecLevel, erasureArray, e); | 425 decodeCodewords(codewords, ecLevel, erasureArray, e); |
| 426 if (e != BCExceptionNO) { | 426 if (e == BCExceptionNO) |
| 427 e = BCExceptionNO; | |
| 428 continue; | |
| 429 } else { | |
| 430 return decoderResult; | 427 return decoderResult; |
| 431 } | 428 |
| 429 e = BCExceptionNO; | |
|
Tom Sepez
2016/05/23 16:57:54
agreed, most likely this was the intent.
| |
| 432 if (ambiguousIndexCount.GetSize() == 0) { | 430 if (ambiguousIndexCount.GetSize() == 0) { |
| 433 e = BCExceptionChecksumInstance; | 431 e = BCExceptionChecksumInstance; |
| 434 return NULL; | 432 return nullptr; |
| 435 } | 433 } |
| 436 for (int32_t i = 0; i < ambiguousIndexCount.GetSize(); i++) { | 434 for (int32_t i = 0; i < ambiguousIndexCount.GetSize(); i++) { |
| 437 if (ambiguousIndexCount[i] < | 435 if (ambiguousIndexCount[i] < |
| 438 ambiguousIndexValues.GetAt(i)->GetSize() - 1) { | 436 ambiguousIndexValues.GetAt(i)->GetSize() - 1) { |
| 439 ambiguousIndexCount[i]++; | 437 ambiguousIndexCount[i]++; |
| 440 break; | 438 break; |
| 441 } else { | 439 } else { |
| 442 ambiguousIndexCount[i] = 0; | 440 ambiguousIndexCount[i] = 0; |
| 443 if (i == ambiguousIndexCount.GetSize() - 1) { | 441 if (i == ambiguousIndexCount.GetSize() - 1) { |
| 444 e = BCExceptionChecksumInstance; | 442 e = BCExceptionChecksumInstance; |
| 445 return NULL; | 443 return nullptr; |
| 446 } | 444 } |
| 447 } | 445 } |
| 448 } | 446 } |
| 449 } | 447 } |
| 450 e = BCExceptionChecksumInstance; | 448 e = BCExceptionChecksumInstance; |
| 451 return NULL; | 449 return NULL; |
| 452 } | 450 } |
| 453 CBC_BarcodeValueArrayArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix( | 451 CBC_BarcodeValueArrayArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix( |
| 454 CBC_DetectionResult* detectionResult) { | 452 CBC_DetectionResult* detectionResult) { |
| 455 CBC_BarcodeValueArrayArray* barcodeMatrix = new CBC_BarcodeValueArrayArray; | 453 CBC_BarcodeValueArrayArray* barcodeMatrix = new CBC_BarcodeValueArrayArray; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 730 int32_t result = getCodewordBucketNumber(*array); | 728 int32_t result = getCodewordBucketNumber(*array); |
| 731 delete array; | 729 delete array; |
| 732 return result; | 730 return result; |
| 733 } | 731 } |
| 734 int32_t CBC_PDF417ScanningDecoder::getCodewordBucketNumber( | 732 int32_t CBC_PDF417ScanningDecoder::getCodewordBucketNumber( |
| 735 CFX_Int32Array& moduleBitCount) { | 733 CFX_Int32Array& moduleBitCount) { |
| 736 return (moduleBitCount.GetAt(0) - moduleBitCount.GetAt(2) + | 734 return (moduleBitCount.GetAt(0) - moduleBitCount.GetAt(2) + |
| 737 moduleBitCount.GetAt(4) - moduleBitCount.GetAt(6) + 9) % | 735 moduleBitCount.GetAt(4) - moduleBitCount.GetAt(6) + 9) % |
| 738 9; | 736 9; |
| 739 } | 737 } |
| OLD | NEW |