Skip to content

Commit 1f37b78

Browse files
authored
Merge pull request #883 from sleeptightAnsiC/fix__style_configurator_unsafe_cast
fix(style_configurator): fix unsafe int to nk_bool pointer casts
2 parents 25f33c8 + f416ca9 commit 1f37b78

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

demo/common/style_configurator.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ style_slider(struct nk_context* ctx, struct nk_style_slider* out_style)
275275
{
276276
struct nk_style_slider slider = *out_style;
277277
struct nk_style_button* dups[1];
278+
nk_bool show_buttons_b;
278279

279280
nk_layout_row_dynamic(ctx, 30, 2);
280281

@@ -299,7 +300,9 @@ style_slider(struct nk_context* ctx, struct nk_style_slider* out_style)
299300
nk_property_float(ctx, "#Rounding:", -100.0f, &slider.rounding, 100.0f, 1,0.5f);
300301

301302
nk_layout_row_dynamic(ctx, 30, 1);
302-
nk_checkbox_label(ctx, "Show Buttons", &slider.show_buttons);
303+
show_buttons_b = (nk_bool)slider.show_buttons;
304+
nk_checkbox_label(ctx, "Show Buttons", &show_buttons_b);
305+
slider.show_buttons = (int)show_buttons_b;
303306

304307
if (slider.show_buttons) {
305308
nk_layout_row_dynamic(ctx, 30, 2);
@@ -355,6 +358,7 @@ style_scrollbars(struct nk_context* ctx, struct nk_style_scrollbar* out_style, s
355358
{
356359
struct nk_style_scrollbar scroll = *out_style;
357360
struct nk_style_button* dups[3];
361+
nk_bool show_buttons_b;
358362

359363
nk_layout_row_dynamic(ctx, 30, 2);
360364

@@ -380,7 +384,9 @@ style_scrollbars(struct nk_context* ctx, struct nk_style_scrollbar* out_style, s
380384

381385
/* TODO what is wrong with scrollbar buttons? Also look into controlling the total width (and height) of scrollbars */
382386
nk_layout_row_dynamic(ctx, 30, 1);
383-
nk_checkbox_label(ctx, "Show Buttons", &scroll.show_buttons);
387+
show_buttons_b = (nk_bool)scroll.show_buttons;
388+
nk_checkbox_label(ctx, "Show Buttons", &show_buttons_b);
389+
scroll.show_buttons = (int)show_buttons_b;
384390

385391
if (scroll.show_buttons) {
386392
nk_layout_row_dynamic(ctx, 30, 2);

0 commit comments

Comments
 (0)