| 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 2006-2007 Jeremias Maerki. | 8 * Copyright 2006-2007 Jeremias Maerki. |
| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 if (count > 4) { | 83 if (count > 4) { |
| 84 e = BCExceptionIllegalStateCountMustNotExceed4; | 84 e = BCExceptionIllegalStateCountMustNotExceed4; |
| 85 return; | 85 return; |
| 86 } | 86 } |
| 87 int32_t restChars = count - 1; | 87 int32_t restChars = count - 1; |
| 88 CFX_WideString encoded = encodeToCodewords(buffer, 0, e); | 88 CFX_WideString encoded = encodeToCodewords(buffer, 0, e); |
| 89 if (e != BCExceptionNO) { | 89 if (e != BCExceptionNO) { |
| 90 return; | 90 return; |
| 91 } | 91 } |
| 92 FX_BOOL endOfSymbolReached = !context.hasMoreCharacters(); | 92 bool endOfSymbolReached = !context.hasMoreCharacters(); |
| 93 FX_BOOL restInAscii = endOfSymbolReached && restChars <= 2; | 93 bool restInAscii = endOfSymbolReached && restChars <= 2; |
| 94 if (restChars <= 2) { | 94 if (restChars <= 2) { |
| 95 context.updateSymbolInfo(context.getCodewordCount() + restChars, e); | 95 context.updateSymbolInfo(context.getCodewordCount() + restChars, e); |
| 96 if (e != BCExceptionNO) { | 96 if (e != BCExceptionNO) { |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 int32_t available = | 99 int32_t available = |
| 100 context.m_symbolInfo->m_dataCapacity - context.getCodewordCount(); | 100 context.m_symbolInfo->m_dataCapacity - context.getCodewordCount(); |
| 101 if (available >= 3) { | 101 if (available >= 3) { |
| 102 restInAscii = FALSE; | 102 restInAscii = false; |
| 103 context.updateSymbolInfo(context.getCodewordCount() + encoded.GetLength(), | 103 context.updateSymbolInfo(context.getCodewordCount() + encoded.GetLength(), |
| 104 e); | 104 e); |
| 105 if (e != BCExceptionNO) { | 105 if (e != BCExceptionNO) { |
| 106 return; | 106 return; |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 if (restInAscii) { | 110 if (restInAscii) { |
| 111 context.resetSymbolInfo(); | 111 context.resetSymbolInfo(); |
| 112 context.m_pos -= restChars; | 112 context.m_pos -= restChars; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 CFX_WideString res; | 145 CFX_WideString res; |
| 146 res += cw1; | 146 res += cw1; |
| 147 if (len >= 2) { | 147 if (len >= 2) { |
| 148 res += cw2; | 148 res += cw2; |
| 149 } | 149 } |
| 150 if (len >= 3) { | 150 if (len >= 3) { |
| 151 res += cw3; | 151 res += cw3; |
| 152 } | 152 } |
| 153 return res; | 153 return res; |
| 154 } | 154 } |
| OLD | NEW |