| 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 27 matching lines...) Expand all Loading... |
| 38 return m_codeFormat; | 38 return m_codeFormat; |
| 39 } | 39 } |
| 40 FX_BOOL CBC_OnedCode128Writer::CheckContentValidity( | 40 FX_BOOL CBC_OnedCode128Writer::CheckContentValidity( |
| 41 const CFX_WideStringC& contents) { | 41 const CFX_WideStringC& contents) { |
| 42 FX_BOOL ret = TRUE; | 42 FX_BOOL ret = TRUE; |
| 43 int32_t position = 0; | 43 int32_t position = 0; |
| 44 int32_t patternIndex = -1; | 44 int32_t patternIndex = -1; |
| 45 if (m_codeFormat == BC_CODE128_B || m_codeFormat == BC_CODE128_C) { | 45 if (m_codeFormat == BC_CODE128_B || m_codeFormat == BC_CODE128_C) { |
| 46 while (position < contents.GetLength()) { | 46 while (position < contents.GetLength()) { |
| 47 patternIndex = (int32_t)contents.GetAt(position); | 47 patternIndex = (int32_t)contents.GetAt(position); |
| 48 if (patternIndex >= 32 && patternIndex <= 126 && patternIndex != 34) { | 48 if (patternIndex < 32 || patternIndex > 126 || patternIndex == 34) { |
| 49 position++; | |
| 50 continue; | |
| 51 } else { | |
| 52 ret = FALSE; | 49 ret = FALSE; |
| 53 break; | 50 break; |
| 54 } | 51 } |
| 55 position++; | 52 position++; |
| 56 } | 53 } |
| 57 } else { | 54 } else { |
| 58 ret = FALSE; | 55 ret = FALSE; |
| 59 } | 56 } |
| 60 return ret; | 57 return ret; |
| 61 } | 58 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } | 222 } |
| 226 } | 223 } |
| 227 patterns->Add(CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]); | 224 patterns->Add(CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]); |
| 228 checkSum += patternIndex * checkWeight; | 225 checkSum += patternIndex * checkWeight; |
| 229 if (position != 0) { | 226 if (position != 0) { |
| 230 checkWeight++; | 227 checkWeight++; |
| 231 } | 228 } |
| 232 } | 229 } |
| 233 return checkSum; | 230 return checkSum; |
| 234 } | 231 } |
| OLD | NEW |