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 2008 ZXing authors | 8 * Copyright 2008 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 result.Add(CBC_OneDimReader::MIDDLE_PATTERN[4]); | 60 result.Add(CBC_OneDimReader::MIDDLE_PATTERN[4]); |
61 CFX_Int32Array* middleRange = | 61 CFX_Int32Array* middleRange = |
62 FindGuardPattern(row, rowOffset, TRUE, &result, e); | 62 FindGuardPattern(row, rowOffset, TRUE, &result, e); |
63 BC_EXCEPTION_CHECK_ReturnValue(e, 0); | 63 BC_EXCEPTION_CHECK_ReturnValue(e, 0); |
64 int32_t rowOffsetMid = rowOffset; | 64 int32_t rowOffsetMid = rowOffset; |
65 rowOffset = (*middleRange)[1]; | 65 rowOffset = (*middleRange)[1]; |
66 if ((rowOffset - rowOffsetMid) > RowOffsetLen) { | 66 if ((rowOffset - rowOffsetMid) > RowOffsetLen) { |
67 e = BCExceptionNotFound; | 67 e = BCExceptionNotFound; |
68 BC_EXCEPTION_CHECK_ReturnValue(e, 0); | 68 BC_EXCEPTION_CHECK_ReturnValue(e, 0); |
69 } | 69 } |
70 if (middleRange != NULL) { | 70 delete middleRange; |
71 delete middleRange; | |
72 middleRange = NULL; | |
73 } | |
74 for (int32_t y = 0; y < 4 && rowOffset < end; y++) { | 71 for (int32_t y = 0; y < 4 && rowOffset < end; y++) { |
75 int32_t bestMatch = | 72 int32_t bestMatch = |
76 DecodeDigit(row, &counters, rowOffset, | 73 DecodeDigit(row, &counters, rowOffset, |
77 &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e); | 74 &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e); |
78 BC_EXCEPTION_CHECK_ReturnValue(e, 0); | 75 BC_EXCEPTION_CHECK_ReturnValue(e, 0); |
79 resultResult += (FX_CHAR)('0' + bestMatch); | 76 resultResult += (FX_CHAR)('0' + bestMatch); |
80 for (int32_t i = 0; i < counters.GetSize(); i++) { | 77 for (int32_t i = 0; i < counters.GetSize(); i++) { |
81 rowOffset += counters[i]; | 78 rowOffset += counters[i]; |
82 } | 79 } |
83 } | 80 } |
84 return rowOffset; | 81 return rowOffset; |
85 } | 82 } |
OLD | NEW |