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 2009 ZXing authors | 8 * Copyright 2009 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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 CBC_PDF417Common::CBC_PDF417Common() {} | 613 CBC_PDF417Common::CBC_PDF417Common() {} |
614 CBC_PDF417Common::~CBC_PDF417Common() {} | 614 CBC_PDF417Common::~CBC_PDF417Common() {} |
615 int32_t CBC_PDF417Common::getBitCountSum(CFX_Int32Array& moduleBitCount) { | 615 int32_t CBC_PDF417Common::getBitCountSum(CFX_Int32Array& moduleBitCount) { |
616 int32_t bitCountSum = 0; | 616 int32_t bitCountSum = 0; |
617 for (int32_t i = 0; i < moduleBitCount.GetSize(); i++) { | 617 for (int32_t i = 0; i < moduleBitCount.GetSize(); i++) { |
618 int32_t count = moduleBitCount.GetAt(i); | 618 int32_t count = moduleBitCount.GetAt(i); |
619 bitCountSum += count; | 619 bitCountSum += count; |
620 } | 620 } |
621 return bitCountSum; | 621 return bitCountSum; |
622 } | 622 } |
623 int32_t CBC_PDF417Common::getCodeword(FX_DWORD symbol) { | 623 int32_t CBC_PDF417Common::getCodeword(uint32_t symbol) { |
624 FX_DWORD sym = symbol & 0x3FFFF; | 624 uint32_t sym = symbol & 0x3FFFF; |
625 int32_t i = findCodewordIndex(sym); | 625 int32_t i = findCodewordIndex(sym); |
626 if (i == -1) { | 626 if (i == -1) { |
627 return -1; | 627 return -1; |
628 } | 628 } |
629 return (CODEWORD_TABLE[i] - 1) % NUMBER_OF_CODEWORDS; | 629 return (CODEWORD_TABLE[i] - 1) % NUMBER_OF_CODEWORDS; |
630 } | 630 } |
631 int32_t CBC_PDF417Common::findCodewordIndex(FX_DWORD symbol) { | 631 int32_t CBC_PDF417Common::findCodewordIndex(uint32_t symbol) { |
632 int32_t first = 0; | 632 int32_t first = 0; |
633 int32_t upto = sizeof(SYMBOL_TABLE) / sizeof(SYMBOL_TABLE[0]); | 633 int32_t upto = sizeof(SYMBOL_TABLE) / sizeof(SYMBOL_TABLE[0]); |
634 while (first < upto) { | 634 while (first < upto) { |
635 int32_t mid = ((FX_DWORD)(first + upto)) >> 1; | 635 int32_t mid = ((uint32_t)(first + upto)) >> 1; |
636 if (symbol < (FX_DWORD)SYMBOL_TABLE[mid]) { | 636 if (symbol < (uint32_t)SYMBOL_TABLE[mid]) { |
637 upto = mid; | 637 upto = mid; |
638 } else if (symbol > (FX_DWORD)SYMBOL_TABLE[mid]) { | 638 } else if (symbol > (uint32_t)SYMBOL_TABLE[mid]) { |
639 first = mid + 1; | 639 first = mid + 1; |
640 } else { | 640 } else { |
641 return mid; | 641 return mid; |
642 } | 642 } |
643 } | 643 } |
644 return -1; | 644 return -1; |
645 } | 645 } |
OLD | NEW |