Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: core/include/fxcrt/fx_system.h

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/include/fxcrt/fx_string.h ('k') | core/include/fxcrt/fx_ucd.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 62 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
63 #include <libkern/OSAtomic.h> 63 #include <libkern/OSAtomic.h>
64 #include <Carbon/Carbon.h> 64 #include <Carbon/Carbon.h>
65 #endif 65 #endif
66 66
67 #ifdef __cplusplus 67 #ifdef __cplusplus
68 extern "C" { 68 extern "C" {
69 #endif 69 #endif
70 typedef void* FX_LPVOID; // Deprecate, use with void*. 70 typedef void* FX_LPVOID; // Deprecate, use with void*.
71 typedef void const* FX_LPCVOID; // Deprecate, use with const void*. 71 typedef const void* FX_LPCVOID; // Deprecate, use with const void*.
72 typedef void* FX_POSITION; // Keep until fxcrt containers gone 72 typedef void* FX_POSITION; // Keep until fxcrt containers gone
73 typedef signed char FX_INT8; // Deprecate, use int8_t. 73 typedef uint8_t* FX_LPBYTE; // Deprecate, use uint8_t*.
74 typedef unsigned char FX_UINT8; // Deprecate, use uint8_t. 74 typedef const uint8_t* FX_LPCBYTE; // Deprecate, use const uint8_t*.
75 typedef unsigned char FX_BYTE; // Deprecate, use uint8_t.
76 typedef unsigned char* FX_LPBYTE; // Deprecate, use uint8_t*.
77 typedef unsigned char const* FX_LPCBYTE; // Deprecate, use const uint8_t*.
78 typedef short FX_INT16; // Deprecate, use int16_t.
79 typedef unsigned short FX_UINT16; // Deprecate, use uint16_t.
80 typedef short FX_SHORT; // Deprecate, use int16_t.
81 typedef unsigned short FX_WORD; // Keep - "an efficient small type" 75 typedef unsigned short FX_WORD; // Keep - "an efficient small type"
82 typedef unsigned short* FX_LPWORD; // Deprecate, use FX_WORD*. 76 typedef FX_WORD* FX_LPWORD; // Deprecate, use FX_WORD*.
83 typedef unsigned short const* FX_LPCWORD; // Deprecate, use const FX_WORD*. 77 typedef const FX_WORD* FX_LPCWORD; // Deprecate, use const FX_WORD*.
84 typedef int FX_INT32; // Deprecate, use int32_t.
85 typedef unsigned int FX_UINT32; // Deprecate, use uint32_t.
86 typedef unsigned int FX_DWORD; // Keep - "an efficient type" 78 typedef unsigned int FX_DWORD; // Keep - "an efficient type"
87 typedef unsigned int* FX_LPDWORD; // Deprecate, use FX_DWORD*. 79 typedef FX_DWORD* FX_LPDWORD; // Deprecate, use FX_DWORD*.
88 typedef int64_t FX_INT64; // Deprecate, use int64_t.
89 typedef uint64_t FX_UINT64; // Deprecate, use uint64_t.
90 typedef intptr_t FX_INTPTR; // Deprecate, use intptr_t.
91 typedef uintptr_t FX_UINTPTR; // Deprecate, use uintptr_t.
92 typedef float FX_FLOAT; // Keep, allow upgrade to doubles. 80 typedef float FX_FLOAT; // Keep, allow upgrade to doubles.
93 typedef int FX_BOOL; // Sadly not always 0 or 1. 81 typedef int FX_BOOL; // Sadly not always 0 or 1.
94 typedef char FX_CHAR; // Keep, questionable signedness. 82 typedef char FX_CHAR; // Keep, questionable signedness.
95 typedef char* FX_LPSTR; // Deprecate, use FX_CHAR*. 83 typedef FX_CHAR* FX_LPSTR; // Deprecate, use FX_CHAR*.
96 typedef char const* FX_LPCSTR; // Deprecate, use const FX_CHAR*. 84 typedef const FX_CHAR* FX_LPCSTR; // Deprecate, use const FX_CHAR*.
97 typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. 85 typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars.
98 typedef wchar_t* FX_LPWSTR; // Deprecate, use FX_WCHAR*. 86 typedef FX_WCHAR* FX_LPWSTR; // Deprecate, use FX_WCHAR*.
99 typedef wchar_t const* FX_LPCWSTR; // Deprecate, use const FX_WCHAR*. 87 typedef const FX_WCHAR* FX_LPCWSTR; // Deprecate, use const FX_WCHAR*.
100 88
101 // PDFium string sizes are limited to 2^31-1, and the value is signed to 89 // PDFium string sizes are limited to 2^31-1, and the value is signed to
102 // allow -1 as a placeholder for "unknown". 90 // allow -1 as a placeholder for "unknown".
103 // TODO(palmer): it should be a |size_t|, or at least unsigned. 91 // TODO(palmer): it should be a |size_t|, or at least unsigned.
104 typedef int FX_STRSIZE; 92 typedef int FX_STRSIZE;
105 93
106 #if defined(DEBUG) && !defined(_DEBUG) 94 #if defined(DEBUG) && !defined(_DEBUG)
107 #define _DEBUG 95 #define _DEBUG
108 #endif 96 #endif
109 97
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 #define FXSYS_ceil(a) (FX_FLOAT)ceil(a) 241 #define FXSYS_ceil(a) (FX_FLOAT)ceil(a)
254 #define FXSYS_floor(a) (FX_FLOAT)floor(a) 242 #define FXSYS_floor(a) (FX_FLOAT)floor(a)
255 #define FXSYS_cos(a) (FX_FLOAT)cos(a) 243 #define FXSYS_cos(a) (FX_FLOAT)cos(a)
256 #define FXSYS_acos(a) (FX_FLOAT)acos(a) 244 #define FXSYS_acos(a) (FX_FLOAT)acos(a)
257 #define FXSYS_sin(a) (FX_FLOAT)sin(a) 245 #define FXSYS_sin(a) (FX_FLOAT)sin(a)
258 #define FXSYS_log(a) (FX_FLOAT)log(a) 246 #define FXSYS_log(a) (FX_FLOAT)log(a)
259 #define FXSYS_log10(a) (FX_FLOAT)log10(a) 247 #define FXSYS_log10(a) (FX_FLOAT)log10(a)
260 #define FXSYS_fmod(a, b) (FX_FLOAT)fmod(a, b) 248 #define FXSYS_fmod(a, b) (FX_FLOAT)fmod(a, b)
261 #define FXSYS_abs abs 249 #define FXSYS_abs abs
262 #define FXDWORD_FROM_LSBFIRST(i) (i) 250 #define FXDWORD_FROM_LSBFIRST(i) (i)
263 #define FXDWORD_FROM_MSBFIRST(i)» (((FX_BYTE)(i) << 24) | ((FX_BYTE)((i) > > 8) << 16) | ((FX_BYTE)((i) >> 16) << 8) | (FX_BYTE)((i) >> 24)) 251 #define FXDWORD_FROM_MSBFIRST(i)» (((uint8_t)(i) << 24) | ((uint8_t)((i) > > 8) << 16) | ((uint8_t)((i) >> 16) << 8) | (uint8_t)((i) >> 24))
264 #define FXDWORD_GET_LSBFIRST(p) ((((FX_LPBYTE)(p))[3] << 24) | (((FX_LPB YTE)(p))[2] << 16) | (((FX_LPBYTE)(p))[1] << 8) | (((FX_LPBYTE)(p))[0])) 252 #define FXDWORD_GET_LSBFIRST(p) ((((FX_LPBYTE)(p))[3] << 24) | (((FX_LPB YTE)(p))[2] << 16) | (((FX_LPBYTE)(p))[1] << 8) | (((FX_LPBYTE)(p))[0]))
265 #define FXDWORD_GET_MSBFIRST(p) ((((FX_LPBYTE)(p))[0] << 24) | (((FX_LPBYTE)(p)) [1] << 16) | (((FX_LPBYTE)(p))[2] << 8) | (((FX_LPBYTE)(p))[3])) 253 #define FXDWORD_GET_MSBFIRST(p) ((((FX_LPBYTE)(p))[0] << 24) | (((FX_LPBYTE)(p)) [1] << 16) | (((FX_LPBYTE)(p))[2] << 8) | (((FX_LPBYTE)(p))[3]))
266 #define FXSYS_HIBYTE(word)» ((FX_BYTE)((word) >> 8)) 254 #define FXSYS_HIBYTE(word)» ((uint8_t)((word) >> 8))
267 #define FXSYS_LOBYTE(word)» ((FX_BYTE)(word)) 255 #define FXSYS_LOBYTE(word)» ((uint8_t)(word))
268 #define FXSYS_HIWORD(dword) ((FX_WORD)((dword) >> 16)) 256 #define FXSYS_HIWORD(dword) ((FX_WORD)((dword) >> 16))
269 #define FXSYS_LOWORD(dword) ((FX_WORD)(dword)) 257 #define FXSYS_LOWORD(dword) ((FX_WORD)(dword))
270 FX_INT32» FXSYS_atoi(FX_LPCSTR str); 258 int32_t»FXSYS_atoi(FX_LPCSTR str);
271 FX_INT32» FXSYS_wtoi(FX_LPCWSTR str); 259 int32_t»FXSYS_wtoi(FX_LPCWSTR str);
272 FX_INT64» FXSYS_atoi64(FX_LPCSTR str); 260 int64_t»FXSYS_atoi64(FX_LPCSTR str);
273 FX_INT64» FXSYS_wtoi64(FX_LPCWSTR str); 261 int64_t»FXSYS_wtoi64(FX_LPCWSTR str);
274 FX_LPCSTR» FXSYS_i64toa(FX_INT64 value, FX_LPSTR str, int radix); 262 FX_LPCSTR» FXSYS_i64toa(int64_t value, FX_LPSTR str, int radix);
275 FX_LPCWSTR» FXSYS_i64tow(FX_INT64 value, FX_LPWSTR str, int radix); 263 FX_LPCWSTR» FXSYS_i64tow(int64_t value, FX_LPWSTR str, int radix);
276 int FXSYS_round(FX_FLOAT f); 264 int FXSYS_round(FX_FLOAT f);
277 #define FXSYS_Mul(a, b) ((a) * (b)) 265 #define FXSYS_Mul(a, b) ((a) * (b))
278 #define FXSYS_Div(a, b) ((a) / (b)) 266 #define FXSYS_Div(a, b) ((a) / (b))
279 #define FXSYS_MulDiv(a, b, c) ((a) * (b) / (c)) 267 #define FXSYS_MulDiv(a, b, c) ((a) * (b) / (c))
280 #define FXSYS_sqrt2(a, b) (FX_FLOAT)FXSYS_sqrt((a)*(a) + (b)*(b)) 268 #define FXSYS_sqrt2(a, b) (FX_FLOAT)FXSYS_sqrt((a)*(a) + (b)*(b))
281 #ifdef __cplusplus 269 #ifdef __cplusplus
282 }; 270 };
283 #endif 271 #endif
284 272
285 // To print a size_t value in a portable way: 273 // To print a size_t value in a portable way:
(...skipping 28 matching lines...) Expand all
314 302
315 // Prevent a function from ever being inlined, typically because we'd 303 // Prevent a function from ever being inlined, typically because we'd
316 // like it to appear in stack traces. 304 // like it to appear in stack traces.
317 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 305 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
318 #define NEVER_INLINE __declspec(noinline) 306 #define NEVER_INLINE __declspec(noinline)
319 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 307 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
320 #define NEVER_INLINE __attribute__((__noinline__)) 308 #define NEVER_INLINE __attribute__((__noinline__))
321 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 309 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
322 310
323 #endif // CORE_INCLUDE_FXCRT_FX_SYSTEM_H_ 311 #endif // CORE_INCLUDE_FXCRT_FX_SYSTEM_H_
OLDNEW
« no previous file with comments | « core/include/fxcrt/fx_string.h ('k') | core/include/fxcrt/fx_ucd.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698