| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 return TRUE; | 100 return TRUE; |
| 101 } | 101 } |
| 102 uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents, | 102 uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents, |
| 103 BCFORMAT format, | 103 BCFORMAT format, |
| 104 int32_t& outWidth, | 104 int32_t& outWidth, |
| 105 int32_t& outHeight, | 105 int32_t& outHeight, |
| 106 int32_t hints, | 106 int32_t hints, |
| 107 int32_t& e) { | 107 int32_t& e) { |
| 108 if (format != BCFORMAT_CODE_128) { | 108 if (format != BCFORMAT_CODE_128) { |
| 109 e = BCExceptionOnlyEncodeCODE_128; | 109 e = BCExceptionOnlyEncodeCODE_128; |
| 110 return NULL; | 110 return nullptr; |
| 111 } | 111 } |
| 112 uint8_t* ret = | 112 uint8_t* ret = |
| 113 CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e); | 113 CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e); |
| 114 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 114 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); |
| 115 return ret; | 115 return ret; |
| 116 } | 116 } |
| 117 uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents, | 117 uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents, |
| 118 BCFORMAT format, | 118 BCFORMAT format, |
| 119 int32_t& outWidth, | 119 int32_t& outWidth, |
| 120 int32_t& outHeight, | 120 int32_t& outHeight, |
| 121 int32_t& e) { | 121 int32_t& e) { |
| 122 uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); | 122 uint8_t* ret = Encode(contents, format, outWidth, outHeight, 0, e); |
| 123 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 123 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); |
| 124 return ret; | 124 return ret; |
| 125 } | 125 } |
| 126 FX_BOOL CBC_OnedCode128Writer::IsDigits(const CFX_ByteString& contents, | 126 FX_BOOL CBC_OnedCode128Writer::IsDigits(const CFX_ByteString& contents, |
| 127 int32_t start, | 127 int32_t start, |
| 128 int32_t length) { | 128 int32_t length) { |
| 129 int32_t end = start + length; | 129 int32_t end = start + length; |
| 130 for (int32_t i = start; i < end; i++) { | 130 for (int32_t i = start; i < end; i++) { |
| 131 if (contents[i] < '0' || contents[i] > '9') { | 131 if (contents[i] < '0' || contents[i] > '9') { |
| 132 return FALSE; | 132 return FALSE; |
| 133 } | 133 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 patterns->Add(CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]); | 224 patterns->Add(CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]); |
| 225 checkSum += patternIndex * checkWeight; | 225 checkSum += patternIndex * checkWeight; |
| 226 if (position != 0) { | 226 if (position != 0) { |
| 227 checkWeight++; | 227 checkWeight++; |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 return checkSum; | 230 return checkSum; |
| 231 } | 231 } |
| OLD | NEW |