Skip to content

Commit 175ff81

Browse files
authored
Fix nk_roundf() int type casting (#742)
1 parent 22b712b commit 175ff81

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

nuklear.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6627,7 +6627,7 @@ nk_log10(double n)
66276627
NK_LIB float
66286628
nk_roundf(float x)
66296629
{
6630-
return (x >= 0.0) ? nk_ifloorf(x + 0.5) : nk_iceilf(x - 0.5);
6630+
return (x >= 0.0f) ? (float)nk_ifloorf(x + 0.5f) : (float)nk_iceilf(x - 0.5f);
66316631
}
66326632
NK_API struct nk_rect
66336633
nk_get_null_rect(void)
@@ -30698,6 +30698,7 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args)
3069830698
/// - [y]: Minor version with non-breaking API and library changes
3069930699
/// - [z]: Patch version with no direct changes to the API
3070030700
///
30701+
/// - 2024/11/20 (4.12.2) - Fix int/float type conversion warnings in `nk_roundf`
3070130702
/// - 2024/03/07 (4.12.1) - Fix bitwise operations warnings in C++20
3070230703
/// - 2023/11/26 (4.12.0) - Added an alignment option to checkboxes and radio buttons.
3070330704
/// - 2023/10/11 (4.11.0) - Added nk_widget_disable_begin() and nk_widget_disable_end()

src/CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
/// - [y]: Minor version with non-breaking API and library changes
88
/// - [z]: Patch version with no direct changes to the API
99
///
10+
/// - 2024/11/20 (4.12.2) - Fix int/float type conversion warnings in `nk_roundf`
1011
/// - 2024/03/07 (4.12.1) - Fix bitwise operations warnings in C++20
1112
/// - 2023/11/26 (4.12.0) - Added an alignment option to checkboxes and radio buttons.
1213
/// - 2023/10/11 (4.11.0) - Added nk_widget_disable_begin() and nk_widget_disable_end()

src/nuklear_math.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ nk_log10(double n)
200200
NK_LIB float
201201
nk_roundf(float x)
202202
{
203-
return (x >= 0.0) ? nk_ifloorf(x + 0.5) : nk_iceilf(x - 0.5);
203+
return (x >= 0.0f) ? (float)nk_ifloorf(x + 0.5f) : (float)nk_iceilf(x - 0.5f);
204204
}
205205
NK_API struct nk_rect
206206
nk_get_null_rect(void)

0 commit comments

Comments
 (0)