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

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

Issue 2461893002: Revert of Change FX_BOOL definition from int to bool. (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | 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_FXCRT_FX_SYSTEM_H_ 7 #ifndef CORE_FXCRT_FX_SYSTEM_H_
8 #define CORE_FXCRT_FX_SYSTEM_H_ 8 #define CORE_FXCRT_FX_SYSTEM_H_
9 9
10 #include <assert.h> 10 #include <assert.h>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include <sal.h> 58 #include <sal.h>
59 #endif 59 #endif
60 60
61 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 61 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
62 #include <Carbon/Carbon.h> 62 #include <Carbon/Carbon.h>
63 #include <libkern/OSAtomic.h> 63 #include <libkern/OSAtomic.h>
64 #endif 64 #endif
65 65
66 #ifdef __cplusplus 66 #ifdef __cplusplus
67 extern "C" { 67 extern "C" {
68 typedef bool FX_BOOL; // Deprecated.
69 #ifndef TRUE
70 #define TRUE true
71 #endif 68 #endif
72 #ifndef FALSE
73 #define FALSE false
74 #endif
75 #endif // __cplusplus
76
77 typedef void* FX_POSITION; // Keep until fxcrt containers gone 69 typedef void* FX_POSITION; // Keep until fxcrt containers gone
78 typedef float FX_FLOAT; // Keep, allow upgrade to doubles. 70 typedef float FX_FLOAT; // Keep, allow upgrade to doubles.
79 typedef double FX_DOUBLE; // Keep, allow downgrade to floats. 71 typedef double FX_DOUBLE; // Keep, allow downgrade to floats.
72 typedef int FX_BOOL; // Keep, sadly not always 0 or 1.
80 typedef char FX_CHAR; // Keep, questionable signedness. 73 typedef char FX_CHAR; // Keep, questionable signedness.
81 typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. 74 typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars.
82 75
83 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) 76 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001)
84 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) 77 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb)))
85 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) 78 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb)))
86 #define IsFloatEqual(fa, fb) IsFloatZero(fa - fb) 79 #define IsFloatEqual(fa, fb) IsFloatZero(fa - fb)
87 80
88 // PDFium string sizes are limited to 2^31-1, and the value is signed to 81 // PDFium string sizes are limited to 2^31-1, and the value is signed to
89 // allow -1 as a placeholder for "unknown". 82 // allow -1 as a placeholder for "unknown".
90 // TODO(palmer): it should be a |size_t|, or at least unsigned. 83 // TODO(palmer): it should be a |size_t|, or at least unsigned.
91 typedef int FX_STRSIZE; 84 typedef int FX_STRSIZE;
92 85
86 #ifndef TRUE
87 #define TRUE 1
88 #endif
89
90 #ifndef FALSE
91 #define FALSE 0
92 #endif
93
93 #ifdef __cplusplus 94 #ifdef __cplusplus
94 static_assert(TRUE == true, "true_needs_to_be_true"); 95 static_assert(TRUE == true, "true_needs_to_be_true");
95 static_assert(FALSE == false, "false_needs_to_be_false"); 96 static_assert(FALSE == false, "false_needs_to_be_false");
96 #endif 97 #endif
97 98
98 #ifndef ASSERT 99 #ifndef ASSERT
99 #ifndef NDEBUG 100 #ifndef NDEBUG
100 #define ASSERT assert 101 #define ASSERT assert
101 #else 102 #else
102 #define ASSERT(a) 103 #define ASSERT(a)
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 333
333 // Prevent a function from ever being inlined, typically because we'd 334 // Prevent a function from ever being inlined, typically because we'd
334 // like it to appear in stack traces. 335 // like it to appear in stack traces.
335 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 336 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
336 #define NEVER_INLINE __declspec(noinline) 337 #define NEVER_INLINE __declspec(noinline)
337 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 338 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
338 #define NEVER_INLINE __attribute__((__noinline__)) 339 #define NEVER_INLINE __attribute__((__noinline__))
339 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 340 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
340 341
341 #endif // CORE_FXCRT_FX_SYSTEM_H_ 342 #endif // CORE_FXCRT_FX_SYSTEM_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698