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 _FX_SYSTEM_H_ | 7 #ifndef _FX_SYSTEM_H_ |
8 #define _FX_SYSTEM_H_ | 8 #define _FX_SYSTEM_H_ |
9 #define _FX_WIN32_DESKTOP_ 1 | 9 #define _FX_WIN32_DESKTOP_ 1 |
10 #define _FX_LINUX_DESKTOP_ 4 | 10 #define _FX_LINUX_DESKTOP_ 4 |
(...skipping 16 matching lines...) Expand all Loading... |
27 #elif defined(__APPLE__) | 27 #elif defined(__APPLE__) |
28 #define _FX_OS_ _FX_MACOSX_ | 28 #define _FX_OS_ _FX_MACOSX_ |
29 #define _FXM_PLATFORM_ _FXM_PLATFORM_APPLE_ | 29 #define _FXM_PLATFORM_ _FXM_PLATFORM_APPLE_ |
30 #endif | 30 #endif |
31 #endif | 31 #endif |
32 #if !defined(_FX_OS_) || _FX_OS_ == 0 | 32 #if !defined(_FX_OS_) || _FX_OS_ == 0 |
33 #error Sorry, can not figure out what OS you are targeting to. Please specify _F
X_OS_ macro. | 33 #error Sorry, can not figure out what OS you are targeting to. Please specify _F
X_OS_ macro. |
34 #endif | 34 #endif |
35 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 35 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
36 #define _CRT_SECURE_NO_WARNINGS | 36 #define _CRT_SECURE_NO_WARNINGS |
| 37 #include <sal.h> |
37 #include <windows.h> | 38 #include <windows.h> |
38 #endif | 39 #endif // _FXM_PLATFORM_WINDOWS_ |
39 #define _FX_W32_ 1 | 40 #define _FX_W32_ 1 |
40 #define _FX_W64_ 2 | 41 #define _FX_W64_ 2 |
41 #ifndef _FX_WORDSIZE_ | 42 #ifndef _FX_WORDSIZE_ |
42 #if defined(_WIN64) || defined(__arm64) || defined(__arm64__) || defined(_M_AMD6
4) || defined(_M_X64) || defined(_M_IA64) || defined(__powerpc64__) || defined(_
_x86_64__) || __WORDSIZE == 64 || defined(__LP64__) | 43 #if defined(_WIN64) || defined(__arm64) || defined(__arm64__) || defined(_M_AMD6
4) || defined(_M_X64) || defined(_M_IA64) || defined(__powerpc64__) || defined(_
_x86_64__) || __WORDSIZE == 64 || defined(__LP64__) |
43 #define _FX_WORDSIZE_ _FX_W64_ | 44 #define _FX_WORDSIZE_ _FX_W64_ |
44 #else | 45 #else |
45 #define _FX_WORDSIZE_ _FX_W32_ | 46 #define _FX_WORDSIZE_ _FX_W32_ |
46 #endif | 47 #endif |
47 #endif | 48 #endif |
48 #include <stddef.h> | 49 #include <stddef.h> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 #ifdef _DEBUG | 131 #ifdef _DEBUG |
131 #define ASSERT FXSYS_assert | 132 #define ASSERT FXSYS_assert |
132 #else | 133 #else |
133 | 134 |
134 #define ASSERT(a) | 135 #define ASSERT(a) |
135 #endif | 136 #endif |
136 #endif | 137 #endif |
137 #define FX_MAX(a, b) (((a) > (b)) ? (a) : (b)) | 138 #define FX_MAX(a, b) (((a) > (b)) ? (a) : (b)) |
138 #define FX_MIN(a, b) (((a) < (b)) ? (a) : (b)) | 139 #define FX_MIN(a, b) (((a) < (b)) ? (a) : (b)) |
139 #define FX_PI 3.1415926535897932384626433832795f | 140 #define FX_PI 3.1415926535897932384626433832795f |
140 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 141 |
141 #define FXSYS_snprintf» _snprintf | 142 // NOTE: prevent use of the return value from snprintf() since some platforms |
142 #define FXSYS_vsnprintf»_vsnprintf | 143 // have different return values (e.g. windows _vsnprintf()), and provide |
| 144 // versions that always NUL-terminate. |
| 145 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900 |
| 146 void FXSYS_snprintf(char *str, size_t size, _Printf_format_string_ const char* f
mt, ...); |
| 147 void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap); |
143 #else | 148 #else |
144 #define FXSYS_snprintf» snprintf | 149 #define FXSYS_snprintf» (void) snprintf |
145 #define FXSYS_vsnprintf»vsnprintf | 150 #define FXSYS_vsnprintf»(void) vsnprintf |
146 #endif | 151 #endif |
| 152 |
147 #define FXSYS_sprintf DO_NOT_USE_SPRINTF_DIE_DIE_DIE | 153 #define FXSYS_sprintf DO_NOT_USE_SPRINTF_DIE_DIE_DIE |
148 #define FXSYS_vsprintf DO_NOT_USE_VSPRINTF_DIE_DIE_DIE | 154 #define FXSYS_vsprintf DO_NOT_USE_VSPRINTF_DIE_DIE_DIE |
149 #define FXSYS_strchr strchr | 155 #define FXSYS_strchr strchr |
150 #define FXSYS_strlen strlen | 156 #define FXSYS_strlen strlen |
151 #define FXSYS_strncmp strncmp | 157 #define FXSYS_strncmp strncmp |
152 #define FXSYS_strcmp strcmp | 158 #define FXSYS_strcmp strcmp |
153 #define FXSYS_strcpy strcpy | 159 #define FXSYS_strcpy strcpy |
154 #define FXSYS_strncpy strncpy | 160 #define FXSYS_strncpy strncpy |
155 #define FXSYS_strstr strstr | 161 #define FXSYS_strstr strstr |
156 #define FXSYS_FILE FILE | 162 #define FXSYS_FILE FILE |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 321 |
316 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 322 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
317 | 323 |
318 #if !defined(PRIuS) | 324 #if !defined(PRIuS) |
319 #define PRIuS "Iu" | 325 #define PRIuS "Iu" |
320 #endif | 326 #endif |
321 | 327 |
322 #endif | 328 #endif |
323 | 329 |
324 #endif | 330 #endif |
OLD | NEW |