Skip to content

Commit 0b49ee5

Browse files
authored
Fix warnings about sign conversion (#323)
1 parent 7ef8fd6 commit 0b49ee5

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

nuklear.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19024,7 +19024,7 @@ nk_pool_init_fixed(struct nk_pool *pool, void *memory, nk_size size)
1902419024
NK_ASSERT(size >= sizeof(struct nk_page));
1902519025
if (size < sizeof(struct nk_page)) return;
1902619026
/* first nk_page_element is embedded in nk_page, additional elements follow in adjacent space */
19027-
pool->capacity = 1 + (unsigned)(size - sizeof(struct nk_page)) / sizeof(struct nk_page_element);
19027+
pool->capacity = (unsigned)(1 + (size - sizeof(struct nk_page)) / sizeof(struct nk_page_element));
1902819028
pool->pages = (struct nk_page*)memory;
1902919029
pool->type = NK_BUFFER_FIXED;
1903019030
pool->size = size;
@@ -19330,8 +19330,8 @@ nk_panel_begin(struct nk_context *ctx, const char *title, enum nk_panel_type pan
1933019330

1933119331
/* window movement */
1933219332
if ((win->flags & NK_WINDOW_MOVABLE) && !(win->flags & NK_WINDOW_ROM)) {
19333-
int left_mouse_down;
19334-
int left_mouse_clicked;
19333+
nk_bool left_mouse_down;
19334+
unsigned int left_mouse_clicked;
1933519335
int left_mouse_click_in_cursor;
1933619336

1933719337
/* calculate draggable window space */
@@ -19346,7 +19346,7 @@ nk_panel_begin(struct nk_context *ctx, const char *title, enum nk_panel_type pan
1934619346

1934719347
/* window movement by dragging */
1934819348
left_mouse_down = in->mouse.buttons[NK_BUTTON_LEFT].down;
19349-
left_mouse_clicked = (int)in->mouse.buttons[NK_BUTTON_LEFT].clicked;
19349+
left_mouse_clicked = in->mouse.buttons[NK_BUTTON_LEFT].clicked;
1935019350
left_mouse_click_in_cursor = nk_input_has_mouse_click_down_in_rect(in,
1935119351
NK_BUTTON_LEFT, header, nk_true);
1935219352
if (left_mouse_down && left_mouse_click_in_cursor && !left_mouse_clicked) {
@@ -21865,7 +21865,7 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx,
2186521865
panel_space = nk_layout_row_calculate_usable_space(&ctx->style, layout->type,
2186621866
layout->bounds.w, layout->row.columns);
2186721867

21868-
#define NK_FRAC(x) (x - (int)x) /* will be used to remove fookin gaps */
21868+
#define NK_FRAC(x) (x - (float)(int)x) /* will be used to remove fookin gaps */
2186921869
/* calculate the width of one item inside the current layout space */
2187021870
switch (layout->row.type) {
2187121871
case NK_LAYOUT_DYNAMIC_FIXED: {
@@ -25074,7 +25074,7 @@ nk_scrollbar_behavior(nk_flags *state, struct nk_input *in,
2507425074
{
2507525075
nk_flags ws = 0;
2507625076
int left_mouse_down;
25077-
int left_mouse_clicked;
25077+
unsigned int left_mouse_clicked;
2507825078
int left_mouse_click_in_cursor;
2507925079
float scroll_delta;
2508025080

@@ -29508,4 +29508,3 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args)
2950829508
/// in libraries and brought me to create some of my own. Finally Apoorva Joshi
2950929509
/// for his single header file packer.
2951029510
*/
29511-

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nuklear",
3-
"version": "4.07.3",
3+
"version": "4.07.4",
44
"repo": "Immediate-Mode-UI/Nuklear",
55
"description": "A small ANSI C gui toolkit",
66
"keywords": ["gl", "ui", "toolkit"],

src/CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/// - [yy]: Minor version with non-breaking API and library changes
99
/// - [zz]: Bug fix version with no direct changes to API
1010
///
11+
/// - 2021/08/15 (4.07.4) - Fix conversion and sign conversion warnings
1112
/// - 2021/08/08 (4.07.3) - Fix crash when baking merged fonts
1213
/// - 2021/08/08 (4.07.2) - Fix Multiline Edit wrong offset
1314
/// - 2021/03/17 (4.07.1) - Fix warning about unused parameter

src/nuklear_layout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx,
601601
panel_space = nk_layout_row_calculate_usable_space(&ctx->style, layout->type,
602602
layout->bounds.w, layout->row.columns);
603603

604-
#define NK_FRAC(x) (x - (int)x) /* will be used to remove fookin gaps */
604+
#define NK_FRAC(x) (x - (float)(int)x) /* will be used to remove fookin gaps */
605605
/* calculate the width of one item inside the current layout space */
606606
switch (layout->row.type) {
607607
case NK_LAYOUT_DYNAMIC_FIXED: {

src/nuklear_panel.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ nk_panel_begin(struct nk_context *ctx, const char *title, enum nk_panel_type pan
122122

123123
/* window movement */
124124
if ((win->flags & NK_WINDOW_MOVABLE) && !(win->flags & NK_WINDOW_ROM)) {
125-
int left_mouse_down;
126-
int left_mouse_clicked;
125+
nk_bool left_mouse_down;
126+
unsigned int left_mouse_clicked;
127127
int left_mouse_click_in_cursor;
128128

129129
/* calculate draggable window space */
@@ -138,7 +138,7 @@ nk_panel_begin(struct nk_context *ctx, const char *title, enum nk_panel_type pan
138138

139139
/* window movement by dragging */
140140
left_mouse_down = in->mouse.buttons[NK_BUTTON_LEFT].down;
141-
left_mouse_clicked = (int)in->mouse.buttons[NK_BUTTON_LEFT].clicked;
141+
left_mouse_clicked = in->mouse.buttons[NK_BUTTON_LEFT].clicked;
142142
left_mouse_click_in_cursor = nk_input_has_mouse_click_down_in_rect(in,
143143
NK_BUTTON_LEFT, header, nk_true);
144144
if (left_mouse_down && left_mouse_click_in_cursor && !left_mouse_clicked) {

src/nuklear_pool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ nk_pool_init_fixed(struct nk_pool *pool, void *memory, nk_size size)
3737
NK_ASSERT(size >= sizeof(struct nk_page));
3838
if (size < sizeof(struct nk_page)) return;
3939
/* first nk_page_element is embedded in nk_page, additional elements follow in adjacent space */
40-
pool->capacity = 1 + (unsigned)(size - sizeof(struct nk_page)) / sizeof(struct nk_page_element);
40+
pool->capacity = (unsigned)(1 + (size - sizeof(struct nk_page)) / sizeof(struct nk_page_element));
4141
pool->pages = (struct nk_page*)memory;
4242
pool->type = NK_BUFFER_FIXED;
4343
pool->size = size;

src/nuklear_scrollbar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ nk_scrollbar_behavior(nk_flags *state, struct nk_input *in,
1515
{
1616
nk_flags ws = 0;
1717
int left_mouse_down;
18-
int left_mouse_clicked;
18+
unsigned int left_mouse_clicked;
1919
int left_mouse_click_in_cursor;
2020
float scroll_delta;
2121

0 commit comments

Comments
 (0)