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 2010 ZXing authors | 8 * Copyright 2010 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 int32_t position = 0; | 204 int32_t position = 0; |
205 patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_START_C]); | 205 patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_START_C]); |
206 checkSum += CODE_START_C * checkWeight; | 206 checkSum += CODE_START_C * checkWeight; |
207 while (position < contents.GetLength()) { | 207 while (position < contents.GetLength()) { |
208 int32_t patternIndex = 0; | 208 int32_t patternIndex = 0; |
209 FX_CHAR ch = contents.GetAt(position); | 209 FX_CHAR ch = contents.GetAt(position); |
210 if (ch < '0' || ch > '9') { | 210 if (ch < '0' || ch > '9') { |
211 patternIndex = (int32_t)ch; | 211 patternIndex = (int32_t)ch; |
212 position++; | 212 position++; |
213 } else { | 213 } else { |
214 patternIndex = FXSYS_atoi(contents.Mid(position, 2)); | 214 patternIndex = FXSYS_atoi(contents.Mid(position, 2).c_str()); |
215 if (contents.GetAt(position + 1) < '0' || | 215 if (contents.GetAt(position + 1) < '0' || |
216 contents.GetAt(position + 1) > '9') { | 216 contents.GetAt(position + 1) > '9') { |
217 position += 1; | 217 position += 1; |
218 } else { | 218 } else { |
219 position += 2; | 219 position += 2; |
220 } | 220 } |
221 } | 221 } |
222 patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]); | 222 patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]); |
223 checkSum += patternIndex * checkWeight; | 223 checkSum += patternIndex * checkWeight; |
224 if (position != 0) { | 224 if (position != 0) { |
225 checkWeight++; | 225 checkWeight++; |
226 } | 226 } |
227 } | 227 } |
228 return checkSum; | 228 return checkSum; |
229 } | 229 } |
OLD | NEW |