| 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 <cctype> | 7 #include <cctype> |
| 8 #include <cwctype> | 8 #include <cwctype> |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 #ifdef __cplusplus | 90 #ifdef __cplusplus |
| 91 } | 91 } |
| 92 #endif | 92 #endif |
| 93 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 93 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| 94 #ifdef __cplusplus | 94 #ifdef __cplusplus |
| 95 extern "C" { | 95 extern "C" { |
| 96 #endif | 96 #endif |
| 97 int FXSYS_GetACP() { | 97 int FXSYS_GetACP() { |
| 98 return 0; | 98 return 0; |
| 99 } | 99 } |
| 100 FX_DWORD FXSYS_GetFullPathName(const FX_CHAR* filename, | 100 uint32_t FXSYS_GetFullPathName(const FX_CHAR* filename, |
| 101 FX_DWORD buflen, | 101 uint32_t buflen, |
| 102 FX_CHAR* buf, | 102 FX_CHAR* buf, |
| 103 FX_CHAR** filepart) { | 103 FX_CHAR** filepart) { |
| 104 int srclen = FXSYS_strlen(filename); | 104 int srclen = FXSYS_strlen(filename); |
| 105 if (!buf || (int)buflen < srclen + 1) { | 105 if (!buf || (int)buflen < srclen + 1) { |
| 106 return srclen + 1; | 106 return srclen + 1; |
| 107 } | 107 } |
| 108 FXSYS_strcpy(buf, filename); | 108 FXSYS_strcpy(buf, filename); |
| 109 return srclen; | 109 return srclen; |
| 110 } | 110 } |
| 111 FX_DWORD FXSYS_GetModuleFileName(void* hModule, char* buf, FX_DWORD bufsize) { | 111 uint32_t FXSYS_GetModuleFileName(void* hModule, char* buf, uint32_t bufsize) { |
| 112 return (FX_DWORD)-1; | 112 return (uint32_t)-1; |
| 113 } | 113 } |
| 114 #ifdef __cplusplus | 114 #ifdef __cplusplus |
| 115 } | 115 } |
| 116 #endif | 116 #endif |
| 117 #endif | 117 #endif |
| 118 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 118 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| 119 #ifdef __cplusplus | 119 #ifdef __cplusplus |
| 120 extern "C" { | 120 extern "C" { |
| 121 #endif | 121 #endif |
| 122 FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode) { | 122 FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 return FXSYS_IntToStr<int32_t, uint32_t, FX_CHAR*>(value, str, radix); | 195 return FXSYS_IntToStr<int32_t, uint32_t, FX_CHAR*>(value, str, radix); |
| 196 } | 196 } |
| 197 #ifdef __cplusplus | 197 #ifdef __cplusplus |
| 198 } | 198 } |
| 199 #endif | 199 #endif |
| 200 #endif | 200 #endif |
| 201 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 201 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| 202 #ifdef __cplusplus | 202 #ifdef __cplusplus |
| 203 extern "C" { | 203 extern "C" { |
| 204 #endif | 204 #endif |
| 205 int FXSYS_WideCharToMultiByte(FX_DWORD codepage, | 205 int FXSYS_WideCharToMultiByte(uint32_t codepage, |
| 206 FX_DWORD dwFlags, | 206 uint32_t dwFlags, |
| 207 const FX_WCHAR* wstr, | 207 const FX_WCHAR* wstr, |
| 208 int wlen, | 208 int wlen, |
| 209 FX_CHAR* buf, | 209 FX_CHAR* buf, |
| 210 int buflen, | 210 int buflen, |
| 211 const FX_CHAR* default_str, | 211 const FX_CHAR* default_str, |
| 212 int* pUseDefault) { | 212 int* pUseDefault) { |
| 213 int len = 0; | 213 int len = 0; |
| 214 for (int i = 0; i < wlen; i++) { | 214 for (int i = 0; i < wlen; i++) { |
| 215 if (wstr[i] < 0x100) { | 215 if (wstr[i] < 0x100) { |
| 216 if (buf && len < buflen) { | 216 if (buf && len < buflen) { |
| 217 buf[len] = (FX_CHAR)wstr[i]; | 217 buf[len] = (FX_CHAR)wstr[i]; |
| 218 } | 218 } |
| 219 len++; | 219 len++; |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 return len; | 222 return len; |
| 223 } | 223 } |
| 224 int FXSYS_MultiByteToWideChar(FX_DWORD codepage, | 224 int FXSYS_MultiByteToWideChar(uint32_t codepage, |
| 225 FX_DWORD dwFlags, | 225 uint32_t dwFlags, |
| 226 const FX_CHAR* bstr, | 226 const FX_CHAR* bstr, |
| 227 int blen, | 227 int blen, |
| 228 FX_WCHAR* buf, | 228 FX_WCHAR* buf, |
| 229 int buflen) { | 229 int buflen) { |
| 230 int wlen = 0; | 230 int wlen = 0; |
| 231 for (int i = 0; i < blen; i++) { | 231 for (int i = 0; i < blen; i++) { |
| 232 if (buf && wlen < buflen) { | 232 if (buf && wlen < buflen) { |
| 233 buf[wlen] = bstr[i]; | 233 buf[wlen] = bstr[i]; |
| 234 } | 234 } |
| 235 wlen++; | 235 wlen++; |
| 236 } | 236 } |
| 237 return wlen; | 237 return wlen; |
| 238 } | 238 } |
| 239 #ifdef __cplusplus | 239 #ifdef __cplusplus |
| 240 } | 240 } |
| 241 #endif | 241 #endif |
| 242 #endif | 242 #endif |
| OLD | NEW |