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 #ifndef CORE_INCLUDE_FXCRT_FX_SYSTEM_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_SYSTEM_H_ |
8 #define CORE_INCLUDE_FXCRT_FX_SYSTEM_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_SYSTEM_H_ |
9 | 9 |
10 #include <assert.h> | 10 #include <assert.h> |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 #define FXSYS_wfopen(f, m) _wfopen((const wchar_t*)(f), (const wchar_t*)(m)) | 150 #define FXSYS_wfopen(f, m) _wfopen((const wchar_t*)(f), (const wchar_t*)(m)) |
151 #else | 151 #else |
152 #define FXSYS_wfopen _wfopen | 152 #define FXSYS_wfopen _wfopen |
153 #endif | 153 #endif |
154 #else | 154 #else |
155 FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode); | 155 FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode); |
156 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 156 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
157 | 157 |
158 #ifdef __cplusplus | 158 #ifdef __cplusplus |
159 } // extern "C" | 159 } // extern "C" |
| 160 |
160 #include "third_party/base/numerics/safe_conversions.h" | 161 #include "third_party/base/numerics/safe_conversions.h" |
| 162 |
161 #define FXSYS_strlen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(strlen(ptr)) | 163 #define FXSYS_strlen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(strlen(ptr)) |
162 #define FXSYS_wcslen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(wcslen(ptr)) | 164 #define FXSYS_wcslen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(wcslen(ptr)) |
| 165 |
163 extern "C" { | 166 extern "C" { |
164 #else | 167 #else |
165 #define FXSYS_strlen(ptr) ((FX_STRSIZE)strlen(ptr)) | 168 #define FXSYS_strlen(ptr) ((FX_STRSIZE)strlen(ptr)) |
166 #define FXSYS_wcslen(ptr) ((FX_STRSIZE)wcslen(ptr)) | 169 #define FXSYS_wcslen(ptr) ((FX_STRSIZE)wcslen(ptr)) |
167 #endif | 170 #endif |
168 | 171 |
169 #define FXSYS_wcscmp wcscmp | 172 #define FXSYS_wcscmp wcscmp |
170 #define FXSYS_wcschr wcschr | 173 #define FXSYS_wcschr wcschr |
171 #define FXSYS_wcsstr wcsstr | 174 #define FXSYS_wcsstr wcsstr |
172 #define FXSYS_wcsncmp wcsncmp | 175 #define FXSYS_wcsncmp wcsncmp |
(...skipping 26 matching lines...) Expand all Loading... |
199 #define FXSYS_wcsicmp _wcsicmp | 202 #define FXSYS_wcsicmp _wcsicmp |
200 #define FXSYS_WideCharToMultiByte WideCharToMultiByte | 203 #define FXSYS_WideCharToMultiByte WideCharToMultiByte |
201 #define FXSYS_MultiByteToWideChar MultiByteToWideChar | 204 #define FXSYS_MultiByteToWideChar MultiByteToWideChar |
202 #define FXSYS_wcslwr _wcslwr | 205 #define FXSYS_wcslwr _wcslwr |
203 #define FXSYS_wcsupr _wcsupr | 206 #define FXSYS_wcsupr _wcsupr |
204 #endif | 207 #endif |
205 #define FXSYS_GetFullPathName GetFullPathName | 208 #define FXSYS_GetFullPathName GetFullPathName |
206 #define FXSYS_GetModuleFileName GetModuleFileName | 209 #define FXSYS_GetModuleFileName GetModuleFileName |
207 #else | 210 #else |
208 int FXSYS_GetACP(void); | 211 int FXSYS_GetACP(void); |
209 char* FXSYS_itoa(int value, char* string, int radix); | 212 char* FXSYS_itoa(int value, char* str, int radix); |
210 int FXSYS_WideCharToMultiByte(FX_DWORD codepage, | 213 int FXSYS_WideCharToMultiByte(FX_DWORD codepage, |
211 FX_DWORD dwFlags, | 214 FX_DWORD dwFlags, |
212 const wchar_t* wstr, | 215 const wchar_t* wstr, |
213 int wlen, | 216 int wlen, |
214 char* buf, | 217 char* buf, |
215 int buflen, | 218 int buflen, |
216 const char* default_str, | 219 const char* default_str, |
217 int* pUseDefault); | 220 int* pUseDefault); |
218 int FXSYS_MultiByteToWideChar(FX_DWORD codepage, | 221 int FXSYS_MultiByteToWideChar(FX_DWORD codepage, |
219 FX_DWORD dwFlags, | 222 FX_DWORD dwFlags, |
220 const char* bstr, | 223 const char* bstr, |
221 int blen, | 224 int blen, |
222 wchar_t* buf, | 225 wchar_t* buf, |
223 int buflen); | 226 int buflen); |
224 FX_DWORD FXSYS_GetFullPathName(const char* filename, | 227 FX_DWORD FXSYS_GetFullPathName(const char* filename, |
225 FX_DWORD buflen, | 228 FX_DWORD buflen, |
226 char* buf, | 229 char* buf, |
227 char** filepart); | 230 char** filepart); |
228 FX_DWORD FXSYS_GetModuleFileName(void* hModule, char* buf, FX_DWORD bufsize); | 231 FX_DWORD FXSYS_GetModuleFileName(void* hModule, char* buf, FX_DWORD bufsize); |
229 char* FXSYS_strlwr(char* str); | 232 char* FXSYS_strlwr(char* str); |
230 char* FXSYS_strupr(char* str); | 233 char* FXSYS_strupr(char* str); |
231 int FXSYS_stricmp(const char*, const char*); | 234 int FXSYS_stricmp(const char*, const char*); |
232 int FXSYS_wcsicmp(const wchar_t* string1, const wchar_t* string2); | 235 int FXSYS_wcsicmp(const wchar_t* str1, const wchar_t* str2); |
233 wchar_t* FXSYS_wcslwr(wchar_t* str); | 236 wchar_t* FXSYS_wcslwr(wchar_t* str); |
234 wchar_t* FXSYS_wcsupr(wchar_t* str); | 237 wchar_t* FXSYS_wcsupr(wchar_t* str); |
235 #endif // _FXM_PLATFORM == _FXM_PLATFORM_WINDOWS_ | 238 #endif // _FXM_PLATFORM == _FXM_PLATFORM_WINDOWS_ |
236 | 239 |
237 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 240 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
238 #define FXSYS_pow(a, b) (FX_FLOAT) powf(a, b) | 241 #define FXSYS_pow(a, b) (FX_FLOAT) powf(a, b) |
239 #else | 242 #else |
240 #define FXSYS_pow(a, b) (FX_FLOAT) pow(a, b) | 243 #define FXSYS_pow(a, b) (FX_FLOAT) pow(a, b) |
241 #endif | 244 #endif |
242 #define FXSYS_sqrt(a) (FX_FLOAT) sqrt(a) | 245 #define FXSYS_sqrt(a) (FX_FLOAT) sqrt(a) |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 310 |
308 // Prevent a function from ever being inlined, typically because we'd | 311 // Prevent a function from ever being inlined, typically because we'd |
309 // like it to appear in stack traces. | 312 // like it to appear in stack traces. |
310 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 313 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
311 #define NEVER_INLINE __declspec(noinline) | 314 #define NEVER_INLINE __declspec(noinline) |
312 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 315 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
313 #define NEVER_INLINE __attribute__((__noinline__)) | 316 #define NEVER_INLINE __attribute__((__noinline__)) |
314 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 317 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
315 | 318 |
316 #endif // CORE_INCLUDE_FXCRT_FX_SYSTEM_H_ | 319 #endif // CORE_INCLUDE_FXCRT_FX_SYSTEM_H_ |
OLD | NEW |