| 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 | 6 |
| 7 #include <stddef.h> // For offsetof(). | 7 #include <stddef.h> // For offsetof(). |
| 8 #include <cctype> | 8 #include <cctype> |
| 9 | 9 |
| 10 #include "core/include/fxcrt/fx_basic.h" | 10 #include "core/include/fxcrt/fx_basic.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 if (m_pData == NULL) { | 281 if (m_pData == NULL) { |
| 282 return (lpsz == NULL || lpsz[0] == 0) ? 0 : -1; | 282 return (lpsz == NULL || lpsz[0] == 0) ? 0 : -1; |
| 283 } | 283 } |
| 284 return FXSYS_wcscmp(m_pData->m_String, lpsz); | 284 return FXSYS_wcscmp(m_pData->m_String, lpsz); |
| 285 } | 285 } |
| 286 CFX_ByteString CFX_WideString::UTF8Encode() const { | 286 CFX_ByteString CFX_WideString::UTF8Encode() const { |
| 287 return FX_UTF8Encode(*this); | 287 return FX_UTF8Encode(*this); |
| 288 } | 288 } |
| 289 CFX_ByteString CFX_WideString::UTF16LE_Encode() const { | 289 CFX_ByteString CFX_WideString::UTF16LE_Encode() const { |
| 290 if (m_pData == NULL) { | 290 if (m_pData == NULL) { |
| 291 return CFX_ByteString("\0\0"); | 291 return CFX_ByteString("\0\0", 2); |
| 292 } | 292 } |
| 293 int len = m_pData->m_nDataLength; | 293 int len = m_pData->m_nDataLength; |
| 294 CFX_ByteString result; | 294 CFX_ByteString result; |
| 295 FX_CHAR* buffer = result.GetBuffer(len * 2 + 2); | 295 FX_CHAR* buffer = result.GetBuffer(len * 2 + 2); |
| 296 for (int i = 0; i < len; i++) { | 296 for (int i = 0; i < len; i++) { |
| 297 buffer[i * 2] = m_pData->m_String[i] & 0xff; | 297 buffer[i * 2] = m_pData->m_String[i] & 0xff; |
| 298 buffer[i * 2 + 1] = m_pData->m_String[i] >> 8; | 298 buffer[i * 2 + 1] = m_pData->m_String[i] >> 8; |
| 299 } | 299 } |
| 300 buffer[len * 2] = 0; | 300 buffer[len * 2] = 0; |
| 301 buffer[len * 2 + 1] = 0; | 301 buffer[len * 2 + 1] = 0; |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 return (CFX_CharMap*)&g_DefaultJISMapper; | 1059 return (CFX_CharMap*)&g_DefaultJISMapper; |
| 1060 case 936: | 1060 case 936: |
| 1061 return (CFX_CharMap*)&g_DefaultGBKMapper; | 1061 return (CFX_CharMap*)&g_DefaultGBKMapper; |
| 1062 case 949: | 1062 case 949: |
| 1063 return (CFX_CharMap*)&g_DefaultUHCMapper; | 1063 return (CFX_CharMap*)&g_DefaultUHCMapper; |
| 1064 case 950: | 1064 case 950: |
| 1065 return (CFX_CharMap*)&g_DefaultBig5Mapper; | 1065 return (CFX_CharMap*)&g_DefaultBig5Mapper; |
| 1066 } | 1066 } |
| 1067 return NULL; | 1067 return NULL; |
| 1068 } | 1068 } |
| OLD | NEW |