| 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 int32_t nextStart = (*start)[1]; | 60 int32_t nextStart = (*start)[1]; |
| 61 delete start; | 61 delete start; |
| 62 int32_t end = row->GetSize(); | 62 int32_t end = row->GetSize(); |
| 63 while (nextStart < end && !row->Get(nextStart)) { | 63 while (nextStart < end && !row->Get(nextStart)) { |
| 64 nextStart++; | 64 nextStart++; |
| 65 } | 65 } |
| 66 CFX_ByteString result; | 66 CFX_ByteString result; |
| 67 CFX_Int32Array counters; | 67 CFX_Int32Array counters; |
| 68 counters.SetSize(9); | 68 counters.SetSize(9); |
| 69 FX_CHAR decodedChar; | 69 FX_CHAR decodedChar; |
| 70 int32_t lastStart; | |
| 71 do { | 70 do { |
| 72 RecordPattern(row, nextStart, &counters, e); | 71 RecordPattern(row, nextStart, &counters, e); |
| 73 BC_EXCEPTION_CHECK_ReturnValue(e, ""); | 72 BC_EXCEPTION_CHECK_ReturnValue(e, ""); |
| 74 int32_t pattern = ToNarrowWidePattern(&counters); | 73 int32_t pattern = ToNarrowWidePattern(&counters); |
| 75 if (pattern < 0) { | 74 if (pattern < 0) { |
| 76 e = BCExceptionNotFound; | 75 e = BCExceptionNotFound; |
| 77 return ""; | 76 return ""; |
| 78 } | 77 } |
| 79 decodedChar = PatternToChar(pattern, e); | 78 decodedChar = PatternToChar(pattern, e); |
| 80 BC_EXCEPTION_CHECK_ReturnValue(e, ""); | 79 BC_EXCEPTION_CHECK_ReturnValue(e, ""); |
| 81 result += decodedChar; | 80 result += decodedChar; |
| 82 lastStart = nextStart; | |
| 83 for (int32_t i = 0; i < counters.GetSize(); i++) { | 81 for (int32_t i = 0; i < counters.GetSize(); i++) { |
| 84 nextStart += counters[i]; | 82 nextStart += counters[i]; |
| 85 } | 83 } |
| 86 while (nextStart < end && !row->Get(nextStart)) { | 84 while (nextStart < end && !row->Get(nextStart)) { |
| 87 nextStart++; | 85 nextStart++; |
| 88 } | 86 } |
| 89 } while (decodedChar != '*'); | 87 } while (decodedChar != '*'); |
| 90 result = result.Mid(0, result.GetLength() - 1); | 88 result = result.Mid(0, result.GetLength() - 1); |
| 91 int32_t lastPatternSize = 0; | 89 int32_t lastPatternSize = 0; |
| 92 for (int32_t j = 0; j < counters.GetSize(); j++) { | 90 for (int32_t j = 0; j < counters.GetSize(); j++) { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 break; | 281 break; |
| 284 } | 282 } |
| 285 decoded += decodedChar; | 283 decoded += decodedChar; |
| 286 i++; | 284 i++; |
| 287 } else { | 285 } else { |
| 288 decoded += c; | 286 decoded += c; |
| 289 } | 287 } |
| 290 } | 288 } |
| 291 return decoded; | 289 return decoded; |
| 292 } | 290 } |
| OLD | NEW |