Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Side by Side Diff: xfa/src/fxbarcode/pdf417/BC_PDF417Common.cpp

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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");
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 FX_INT32 CBC_PDF417Common::NUMBER_OF_CODEWORDS = 929; 25 int32_t CBC_PDF417Common::NUMBER_OF_CODEWORDS = 929;
26 FX_INT32 CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE = NUMBER_OF_CODEWORDS - 1; 26 int32_t CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE = NUMBER_OF_CODEWORDS - 1;
27 FX_INT32 CBC_PDF417Common::MIN_ROWS_IN_BARCODE = 3; 27 int32_t CBC_PDF417Common::MIN_ROWS_IN_BARCODE = 3;
28 FX_INT32 CBC_PDF417Common::MAX_ROWS_IN_BARCODE = 90; 28 int32_t CBC_PDF417Common::MAX_ROWS_IN_BARCODE = 90;
29 FX_INT32 CBC_PDF417Common::MAX_CODEWORDS_IN_ROW = 32; 29 int32_t CBC_PDF417Common::MAX_CODEWORDS_IN_ROW = 32;
30 FX_INT32 CBC_PDF417Common::MODULES_IN_CODEWORD = 17; 30 int32_t CBC_PDF417Common::MODULES_IN_CODEWORD = 17;
31 FX_INT32 CBC_PDF417Common::MODULES_IN_STOP_PATTERN = 18; 31 int32_t CBC_PDF417Common::MODULES_IN_STOP_PATTERN = 18;
32 FX_INT32 CBC_PDF417Common::BARS_IN_MODULE = 8; 32 int32_t CBC_PDF417Common::BARS_IN_MODULE = 8;
33 CFX_Int32Array* CBC_PDF417Common::EMPTY_INT_ARRAY = NULL; 33 CFX_Int32Array* CBC_PDF417Common::EMPTY_INT_ARRAY = NULL;
34 FX_INT32 CBC_PDF417Common::SYMBOL_TABLE[] = { 34 int32_t CBC_PDF417Common::SYMBOL_TABLE[] = {
35 0x1025e, 0x1027a, 0x1029e, 0x102bc, 0x102f2, 0x102f4, 0x1032e, 0x1034e, 0x10 35c, 0x10396, 0x103a6, 0x103ac, 35 0x1025e, 0x1027a, 0x1029e, 0x102bc, 0x102f2, 0x102f4, 0x1032e, 0x1034e, 0x10 35c, 0x10396, 0x103a6, 0x103ac,
36 0x10422, 0x10428, 0x10436, 0x10442, 0x10444, 0x10448, 0x10450, 0x1045e, 0x10 466, 0x1046c, 0x1047a, 0x10482, 36 0x10422, 0x10428, 0x10436, 0x10442, 0x10444, 0x10448, 0x10450, 0x1045e, 0x10 466, 0x1046c, 0x1047a, 0x10482,
37 0x1049e, 0x104a0, 0x104bc, 0x104c6, 0x104d8, 0x104ee, 0x104f2, 0x104f4, 0x10 504, 0x10508, 0x10510, 0x1051e, 37 0x1049e, 0x104a0, 0x104bc, 0x104c6, 0x104d8, 0x104ee, 0x104f2, 0x104f4, 0x10 504, 0x10508, 0x10510, 0x1051e,
38 0x10520, 0x1053c, 0x10540, 0x10578, 0x10586, 0x1058c, 0x10598, 0x105b0, 0x10 5be, 0x105ce, 0x105dc, 0x105e2, 38 0x10520, 0x1053c, 0x10540, 0x10578, 0x10586, 0x1058c, 0x10598, 0x105b0, 0x10 5be, 0x105ce, 0x105dc, 0x105e2,
39 0x105e4, 0x105e8, 0x105f6, 0x1062e, 0x1064e, 0x1065c, 0x1068e, 0x1069c, 0x10 6b8, 0x106de, 0x106fa, 0x10716, 39 0x105e4, 0x105e8, 0x105f6, 0x1062e, 0x1064e, 0x1065c, 0x1068e, 0x1069c, 0x10 6b8, 0x106de, 0x106fa, 0x10716,
40 0x10726, 0x1072c, 0x10746, 0x1074c, 0x10758, 0x1076e, 0x10792, 0x10794, 0x10 7a2, 0x107a4, 0x107a8, 0x107b6, 40 0x10726, 0x1072c, 0x10746, 0x1074c, 0x10758, 0x1076e, 0x10792, 0x10794, 0x10 7a2, 0x107a4, 0x107a8, 0x107b6,
41 0x10822, 0x10828, 0x10842, 0x10848, 0x10850, 0x1085e, 0x10866, 0x1086c, 0x10 87a, 0x10882, 0x10884, 0x10890, 41 0x10822, 0x10828, 0x10842, 0x10848, 0x10850, 0x1085e, 0x10866, 0x1086c, 0x10 87a, 0x10882, 0x10884, 0x10890,
42 0x1089e, 0x108a0, 0x108bc, 0x108c6, 0x108cc, 0x108d8, 0x108ee, 0x108f2, 0x10 8f4, 0x10902, 0x10908, 0x1091e, 42 0x1089e, 0x108a0, 0x108bc, 0x108c6, 0x108cc, 0x108d8, 0x108ee, 0x108f2, 0x10 8f4, 0x10902, 0x10908, 0x1091e,
43 0x10920, 0x1093c, 0x10940, 0x10978, 0x10986, 0x10998, 0x109b0, 0x109be, 0x10 9ce, 0x109dc, 0x109e2, 0x109e4, 43 0x10920, 0x1093c, 0x10940, 0x10978, 0x10986, 0x10998, 0x109b0, 0x109be, 0x10 9ce, 0x109dc, 0x109e2, 0x109e4,
44 0x109e8, 0x109f6, 0x10a08, 0x10a10, 0x10a1e, 0x10a20, 0x10a3c, 0x10a40, 0x10 a78, 0x10af0, 0x10b06, 0x10b0c, 44 0x109e8, 0x109f6, 0x10a08, 0x10a10, 0x10a1e, 0x10a20, 0x10a3c, 0x10a40, 0x10 a78, 0x10af0, 0x10b06, 0x10b0c,
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 0x1f614, 0x1f622, 0x1f624, 0x1f628, 0x1f636, 0x1f642, 0x1f644, 0x1f648, 0x1f 650, 0x1f65e, 0x1f666, 0x1f67a, 259 0x1f614, 0x1f622, 0x1f624, 0x1f628, 0x1f636, 0x1f642, 0x1f644, 0x1f648, 0x1f 650, 0x1f65e, 0x1f666, 0x1f67a,
260 0x1f682, 0x1f684, 0x1f688, 0x1f690, 0x1f69e, 0x1f6a0, 0x1f6bc, 0x1f6cc, 0x1f 6f2, 0x1f6f4, 0x1f71a, 0x1f72e, 260 0x1f682, 0x1f684, 0x1f688, 0x1f690, 0x1f69e, 0x1f6a0, 0x1f6bc, 0x1f6cc, 0x1f 6f2, 0x1f6f4, 0x1f71a, 0x1f72e,
261 0x1f732, 0x1f734, 0x1f74e, 0x1f75c, 0x1f762, 0x1f764, 0x1f768, 0x1f776, 0x1f 796, 0x1f7a6, 0x1f7ac, 0x1f7ba, 261 0x1f732, 0x1f734, 0x1f74e, 0x1f75c, 0x1f762, 0x1f764, 0x1f768, 0x1f776, 0x1f 796, 0x1f7a6, 0x1f7ac, 0x1f7ba,
262 0x1f7d2, 0x1f7d4, 0x1f89a, 0x1f8ae, 0x1f8b2, 0x1f8b4, 0x1f8d6, 0x1f8ea, 0x1f 91a, 0x1f92e, 0x1f932, 0x1f934, 262 0x1f7d2, 0x1f7d4, 0x1f89a, 0x1f8ae, 0x1f8b2, 0x1f8b4, 0x1f8d6, 0x1f8ea, 0x1f 91a, 0x1f92e, 0x1f932, 0x1f934,
263 0x1f94e, 0x1f95c, 0x1f962, 0x1f964, 0x1f968, 0x1f976, 0x1f996, 0x1f9a6, 0x1f 9ac, 0x1f9ba, 0x1f9ca, 0x1f9d2, 263 0x1f94e, 0x1f95c, 0x1f962, 0x1f964, 0x1f968, 0x1f976, 0x1f996, 0x1f9a6, 0x1f 9ac, 0x1f9ba, 0x1f9ca, 0x1f9d2,
264 0x1f9d4, 0x1fa1a, 0x1fa2e, 0x1fa32, 0x1fa34, 0x1fa4e, 0x1fa5c, 0x1fa62, 0x1f a64, 0x1fa68, 0x1fa76, 0x1fa8e, 264 0x1f9d4, 0x1fa1a, 0x1fa2e, 0x1fa32, 0x1fa34, 0x1fa4e, 0x1fa5c, 0x1fa62, 0x1f a64, 0x1fa68, 0x1fa76, 0x1fa8e,
265 0x1fa9c, 0x1fab8, 0x1fac2, 0x1fac4, 0x1fac8, 0x1fad0, 0x1fade, 0x1fae6, 0x1f aec, 0x1fb16, 0x1fb26, 0x1fb2c, 265 0x1fa9c, 0x1fab8, 0x1fac2, 0x1fac4, 0x1fac8, 0x1fad0, 0x1fade, 0x1fae6, 0x1f aec, 0x1fb16, 0x1fb26, 0x1fb2c,
266 0x1fb3a, 0x1fb46, 0x1fb4c, 0x1fb58, 0x1fb6e, 0x1fb72, 0x1fb74, 0x1fb8a, 0x1f b92, 0x1fb94, 0x1fba2, 0x1fba4, 266 0x1fb3a, 0x1fb46, 0x1fb4c, 0x1fb58, 0x1fb6e, 0x1fb72, 0x1fb74, 0x1fb8a, 0x1f b92, 0x1fb94, 0x1fba2, 0x1fba4,
267 0x1fba8, 0x1fbb6, 0x1fbda 267 0x1fba8, 0x1fbb6, 0x1fbda
268 }; 268 };
269 FX_INT32 CBC_PDF417Common::CODEWORD_TABLE[] = { 269 int32_t CBC_PDF417Common::CODEWORD_TABLE[] = {
270 2627, 1819, 2622, 2621, 1813, 1812, 2729, 2724, 2723, 2779, 2774, 2773, 902, 896, 908, 868, 865, 861, 859, 2511, 270 2627, 1819, 2622, 2621, 1813, 1812, 2729, 2724, 2723, 2779, 2774, 2773, 902, 896, 908, 868, 865, 861, 859, 2511,
271 873, 871, 1780, 835, 2493, 825, 2491, 842, 837, 844, 1764, 1762, 811, 810, 8 09, 2483, 807, 2482, 806, 2480, 815, 271 873, 871, 1780, 835, 2493, 825, 2491, 842, 837, 844, 1764, 1762, 811, 810, 8 09, 2483, 807, 2482, 806, 2480, 815,
272 814, 813, 812, 2484, 817, 816, 1745, 1744, 1742, 1746, 2655, 2637, 2635, 262 6, 2625, 2623, 2628, 1820, 2752, 272 814, 813, 812, 2484, 817, 816, 1745, 1744, 1742, 1746, 2655, 2637, 2635, 262 6, 2625, 2623, 2628, 1820, 2752,
273 2739, 2737, 2728, 2727, 2725, 2730, 2785, 2783, 2778, 2777, 2775, 2780, 787, 781, 747, 739, 736, 2413, 754, 752, 273 2739, 2737, 2728, 2727, 2725, 2730, 2785, 2783, 2778, 2777, 2775, 2780, 787, 781, 747, 739, 736, 2413, 754, 752,
274 1719, 692, 689, 681, 2371, 678, 2369, 700, 697, 694, 703, 1688, 1686, 642, 6 38, 2343, 631, 2341, 627, 2338, 651, 274 1719, 692, 689, 681, 2371, 678, 2369, 700, 697, 694, 703, 1688, 1686, 642, 6 38, 2343, 631, 2341, 627, 2338, 651,
275 646, 643, 2345, 654, 652, 1652, 1650, 1647, 1654, 601, 599, 2322, 596, 2321, 594, 2319, 2317, 611, 610, 608, 606, 275 646, 643, 2345, 654, 652, 1652, 1650, 1647, 1654, 601, 599, 2322, 596, 2321, 594, 2319, 2317, 611, 610, 608, 606,
276 2324, 603, 2323, 615, 614, 612, 1617, 1616, 1614, 1612, 616, 1619, 1618, 257 5, 2538, 2536, 905, 901, 898, 909, 276 2324, 603, 2323, 615, 614, 612, 1617, 1616, 1614, 1612, 616, 1619, 1618, 257 5, 2538, 2536, 905, 901, 898, 909,
277 2509, 2507, 2504, 870, 867, 864, 860, 2512, 875, 872, 1781, 2490, 2489, 2487 , 2485, 1748, 836, 834, 832, 830, 277 2509, 2507, 2504, 870, 867, 864, 860, 2512, 875, 872, 1781, 2490, 2489, 2487 , 2485, 1748, 836, 834, 832, 830,
278 2494, 827, 2492, 843, 841, 839, 845, 1765, 1763, 2701, 2676, 2674, 2653, 264 8, 2656, 2634, 2633, 2631, 2629, 278 2494, 827, 2492, 843, 841, 839, 845, 1765, 1763, 2701, 2676, 2674, 2653, 264 8, 2656, 2634, 2633, 2631, 2629,
279 1821, 2638, 2636, 2770, 2763, 2761, 2750, 2745, 2753, 2736, 2735, 2733, 2731 , 1848, 2740, 2738, 2786, 2784, 591, 279 1821, 2638, 2636, 2770, 2763, 2761, 2750, 2745, 2753, 2736, 2735, 2733, 2731 , 1848, 2740, 2738, 2786, 2784, 591,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 2058, 2054, 1145, 1142, 2005, 2002, 1999, 2009, 1488, 1429, 1426, 2200, 1698 , 1659, 1656, 1975, 1053, 1957, 1954, 407 2058, 2054, 1145, 1142, 2005, 2002, 1999, 2009, 1488, 1429, 1426, 2200, 1698 , 1659, 1656, 1975, 1053, 1957, 1954,
408 1001, 998, 1924, 1921, 1918, 1928, 937, 934, 931, 1879, 1876, 1873, 1870, 94 5, 1885, 1882, 1323, 1273, 1270, 408 1001, 998, 1924, 1921, 1918, 1928, 937, 934, 931, 1879, 1876, 1873, 1870, 94 5, 1885, 1882, 1323, 1273, 1270,
409 2105, 1202, 1199, 1196, 1211, 2061, 2057, 1576, 1543, 1540, 1484, 1481, 1478 , 1491, 1700 409 2105, 1202, 1199, 1196, 1211, 2061, 2057, 1576, 1543, 1540, 1484, 1481, 1478 , 1491, 1700
410 }; 410 };
411 CBC_PDF417Common::CBC_PDF417Common() 411 CBC_PDF417Common::CBC_PDF417Common()
412 { 412 {
413 } 413 }
414 CBC_PDF417Common::~CBC_PDF417Common() 414 CBC_PDF417Common::~CBC_PDF417Common()
415 { 415 {
416 } 416 }
417 FX_INT32 CBC_PDF417Common::getBitCountSum(CFX_Int32Array& moduleBitCount) 417 int32_t CBC_PDF417Common::getBitCountSum(CFX_Int32Array& moduleBitCount)
418 { 418 {
419 FX_INT32 bitCountSum = 0; 419 int32_t bitCountSum = 0;
420 for (FX_INT32 i = 0; i < moduleBitCount.GetSize(); i++) { 420 for (int32_t i = 0; i < moduleBitCount.GetSize(); i++) {
421 FX_INT32 count = moduleBitCount.GetAt(i); 421 int32_t count = moduleBitCount.GetAt(i);
422 bitCountSum += count; 422 bitCountSum += count;
423 } 423 }
424 return bitCountSum; 424 return bitCountSum;
425 } 425 }
426 FX_INT32 CBC_PDF417Common::getCodeword(FX_DWORD symbol) 426 int32_t CBC_PDF417Common::getCodeword(FX_DWORD symbol)
427 { 427 {
428 FX_DWORD sym = symbol & 0x3FFFF; 428 FX_DWORD sym = symbol & 0x3FFFF;
429 FX_INT32 i = findCodewordIndex(sym); 429 int32_t i = findCodewordIndex(sym);
430 if (i == -1) { 430 if (i == -1) {
431 return -1; 431 return -1;
432 } 432 }
433 return (CODEWORD_TABLE[i] - 1) % NUMBER_OF_CODEWORDS; 433 return (CODEWORD_TABLE[i] - 1) % NUMBER_OF_CODEWORDS;
434 } 434 }
435 FX_INT32 CBC_PDF417Common::findCodewordIndex(FX_DWORD symbol) 435 int32_t CBC_PDF417Common::findCodewordIndex(FX_DWORD symbol)
436 { 436 {
437 FX_INT32 first = 0; 437 int32_t first = 0;
438 FX_INT32 upto = sizeof(SYMBOL_TABLE) / sizeof(SYMBOL_TABLE[0]); 438 int32_t upto = sizeof(SYMBOL_TABLE) / sizeof(SYMBOL_TABLE[0]);
439 while (first < upto) { 439 while (first < upto) {
440 FX_INT32 mid = ((FX_DWORD)(first + upto)) >> 1; 440 int32_t mid = ((FX_DWORD)(first + upto)) >> 1;
441 if (symbol < (FX_DWORD)SYMBOL_TABLE[mid]) { 441 if (symbol < (FX_DWORD)SYMBOL_TABLE[mid]) {
442 upto = mid; 442 upto = mid;
443 } else if (symbol > (FX_DWORD)SYMBOL_TABLE[mid]) { 443 } else if (symbol > (FX_DWORD)SYMBOL_TABLE[mid]) {
444 first = mid + 1; 444 first = mid + 1;
445 } else { 445 } else {
446 return mid; 446 return mid;
447 } 447 }
448 } 448 }
449 return -1; 449 return -1;
450 } 450 }
OLDNEW
« no previous file with comments | « xfa/src/fxbarcode/pdf417/BC_PDF417Common.h ('k') | xfa/src/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698