diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-05-29 15:49:39 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-05-29 15:49:39 +0400 |
commit | 9e05f6571f824bd4a99bb4fe5af5ec15688a9649 (patch) | |
tree | 258cb4a162bdcad89b4cdbf5d5f86ad352ebd999 /source/blender/blenlib | |
parent | e99801dc706b7ff4cea0656e408c20835638dd6b (diff) |
Make sure bool will always have the same size in C and C++
There were an issues with data structures defined in headers
and being used by both C and C++ on systems with stdbool
unavailable.
This happened because bool in this case will be defined as
unsigned int, which is 4 bytes. But C++'s bool is only 1
byte and this lead to alignment issues.
Now bool is always 1 byte, also made sure there's no situation
like bool foo = BitField & BitFlag, which could give overflow
issues. Use (BitField & BitFlag) != 0 instead.
Fixes #35553: Compositor broken (Backdrop & Preview)
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_sys_types.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/source/blender/blenlib/BLI_sys_types.h b/source/blender/blenlib/BLI_sys_types.h index 9c72433a415..7a7da5c097b 100644 --- a/source/blender/blenlib/BLI_sys_types.h +++ b/source/blender/blenlib/BLI_sys_types.h @@ -119,11 +119,8 @@ typedef uint64_t u_int64_t; # ifdef __cplusplus typedef bool _BLI_Bool; # else -/* using char here may cause nasty tricky bugs, e.g. - * bool is_bit_flag = RNA_property_flag(prop) & PROP_ENUM_FLAG; - * as PROP_ENUM_FLAG is farther than 8th bit, do_translate would be always false! - */ -# define _BLI_Bool unsigned int +/* Make sure bool is alays defined with the same size for both C and C++ */ +# define _BLI_Bool unsigned char # endif # else # define _BLI_Bool _Bool |