Skip to content

Commit 8c9b376

Browse files
authored
Fix NK_MEMCPY() size type conversions with nk_size (#913)
1 parent d293cc2 commit 8c9b376

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

nuklear.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17607,7 +17607,7 @@ nk__lit(unsigned char *data, unsigned int length)
1760717607
NK_ASSERT (nk__dout + length <= nk__barrier);
1760817608
if (nk__dout + length > nk__barrier) { nk__dout += length; return; }
1760917609
if (data < nk__barrier2) { nk__dout = nk__barrier+1; return; }
17610-
NK_MEMCPY(nk__dout, data, length);
17610+
NK_MEMCPY(nk__dout, data, (nk_size)length);
1761117611
nk__dout += length;
1761217612
}
1761317613
NK_INTERN unsigned char*
@@ -29173,7 +29173,7 @@ nk_property(struct nk_context *ctx, const char *name, struct nk_property_variant
2917329173
win->property.prev_state = prev_state;
2917429174
win->property.prev_name = win->property.name;
2917529175
win->property.prev_length = win->property.length;
29176-
NK_MEMCPY(win->property.prev_buffer, win->property.buffer, win->property.length);
29176+
NK_MEMCPY(win->property.prev_buffer, win->property.buffer, (nk_size)win->property.length);
2917729177
}
2917829178
/* current property is now hot */
2917929179
win->property.active = 1;
@@ -30729,11 +30729,11 @@ nk_tooltip_begin_offset(struct nk_context *ctx, float width, enum nk_tooltip_pos
3072930729
return 0;
3073030730

3073130731
w = nk_iceilf(width);
30732-
h = NK_MAX(win->layout->row.min_height, ctx->style.font->height+2*ctx->style.window.padding.y);
30732+
h = (int)NK_MAX(win->layout->row.min_height, ctx->style.font->height+2*ctx->style.window.padding.y);
3073330733

3073430734
/* Default origin is top left, plus user offset */
30735-
x = nk_ifloorf(in->mouse.pos.x + 1) - (int)win->layout->clip.x + offset.x;
30736-
y = nk_ifloorf(in->mouse.pos.y + 1) - (int)win->layout->clip.y + offset.y;
30735+
x = nk_ifloorf(in->mouse.pos.x + 1) - (int)win->layout->clip.x + (int)offset.x;
30736+
y = nk_ifloorf(in->mouse.pos.y + 1) - (int)win->layout->clip.y + (int)offset.y;
3073730737

3073830738
/* Adjust origin based on enum */
3073930739
switch (position) {

src/nuklear_font.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ nk__lit(unsigned char *data, unsigned int length)
735735
NK_ASSERT (nk__dout + length <= nk__barrier);
736736
if (nk__dout + length > nk__barrier) { nk__dout += length; return; }
737737
if (data < nk__barrier2) { nk__dout = nk__barrier+1; return; }
738-
NK_MEMCPY(nk__dout, data, length);
738+
NK_MEMCPY(nk__dout, data, (nk_size)length);
739739
nk__dout += length;
740740
}
741741
NK_INTERN unsigned char*

src/nuklear_property.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ nk_property(struct nk_context *ctx, const char *name, struct nk_property_variant
416416
win->property.prev_state = prev_state;
417417
win->property.prev_name = win->property.name;
418418
win->property.prev_length = win->property.length;
419-
NK_MEMCPY(win->property.prev_buffer, win->property.buffer, win->property.length);
419+
NK_MEMCPY(win->property.prev_buffer, win->property.buffer, (nk_size)win->property.length);
420420
}
421421
/* current property is now hot */
422422
win->property.active = 1;

src/nuklear_tooltip.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ nk_tooltip_begin_offset(struct nk_context *ctx, float width, enum nk_tooltip_pos
3535
return 0;
3636

3737
w = nk_iceilf(width);
38-
h = NK_MAX(win->layout->row.min_height, ctx->style.font->height+2*ctx->style.window.padding.y);
38+
h = (int)NK_MAX(win->layout->row.min_height, ctx->style.font->height+2*ctx->style.window.padding.y);
3939

4040
/* Default origin is top left, plus user offset */
41-
x = nk_ifloorf(in->mouse.pos.x + 1) - (int)win->layout->clip.x + offset.x;
42-
y = nk_ifloorf(in->mouse.pos.y + 1) - (int)win->layout->clip.y + offset.y;
41+
x = nk_ifloorf(in->mouse.pos.x + 1) - (int)win->layout->clip.x + (int)offset.x;
42+
y = nk_ifloorf(in->mouse.pos.y + 1) - (int)win->layout->clip.y + (int)offset.y;
4343

4444
/* Adjust origin based on enum */
4545
switch (position) {

0 commit comments

Comments
 (0)