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)
This commit is contained in:
2013-05-29 11:49:39 +00:00
parent e99801dc70
commit 9e05f6571f
9 changed files with 13 additions and 16 deletions

View File

@@ -3411,7 +3411,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
if (wt) {
//rcti disablerect = *rect; /* rect gets clipped smaller for text */
int roundboxalign, state;
bool disabled = FALSE;
bool disabled = false;
roundboxalign = widget_roundbox_set(but, rect);
@@ -3420,7 +3420,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE))
if (but->dt != UI_EMBOSSP)
disabled = TRUE;
disabled = true;
if (disabled)
ui_widget_color_disabled(wt);