From da5198ccdcae3b49cab99cfd0b1195de4369d505 Mon Sep 17 00:00:00 2001 From: loli Date: Mon, 24 Oct 2022 10:40:48 +0200 Subject: [PATCH] Fix nk_str_{append,insert}_str_utf8 always returning 0 --- nuklear.h | 9 ++++----- src/CHANGELOG | 1 + src/nuklear_string.c | 6 ++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/nuklear.h b/nuklear.h index 5e645db..d115913 100644 --- a/nuklear.h +++ b/nuklear.h @@ -8439,7 +8439,6 @@ nk_str_append_text_utf8(struct nk_str *str, const char *text, int len) NK_API int nk_str_append_str_utf8(struct nk_str *str, const char *text) { - int runes = 0; int byte_len = 0; int num_runes = 0; int glyph_len = 0; @@ -8453,7 +8452,7 @@ nk_str_append_str_utf8(struct nk_str *str, const char *text) num_runes++; } nk_str_append_text_char(str, text, byte_len); - return runes; + return num_runes; } NK_API int nk_str_append_text_runes(struct nk_str *str, const nk_rune *text, int len) @@ -8568,7 +8567,6 @@ nk_str_insert_text_utf8(struct nk_str *str, int pos, const char *text, int len) NK_API int nk_str_insert_str_utf8(struct nk_str *str, int pos, const char *text) { - int runes = 0; int byte_len = 0; int num_runes = 0; int glyph_len = 0; @@ -8582,7 +8580,7 @@ nk_str_insert_str_utf8(struct nk_str *str, int pos, const char *text) num_runes++; } nk_str_insert_at_rune(str, pos, text, byte_len); - return runes; + return num_runes; } NK_API int nk_str_insert_text_runes(struct nk_str *str, int pos, const nk_rune *runes, int len) @@ -29656,7 +29654,8 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args) /// - [y]: Minor version with non-breaking API and library changes /// - [z]: Patch version with no direct changes to the API /// -/// - 2022/08/28 (4.10.3) - Renamed the `null` texture variable to `tex_null` +/// - 2022/10/24 (4.10.4) - Fix nk_str_{append,insert}_str_utf8 always returning 0 +/// - 2022/09/03 (4.10.3) - Renamed the `null` texture variable to `tex_null` /// - 2022/08/01 (4.10.2) - Fix Apple Silicon with incorrect NK_SITE_TYPE and NK_POINTER_TYPE /// - 2022/08/01 (4.10.1) - Fix cursor jumping back to beginning of text when typing more than /// nk_edit_xxx limit diff --git a/src/CHANGELOG b/src/CHANGELOG index da6fd2d..62db3f1 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -7,6 +7,7 @@ /// - [y]: Minor version with non-breaking API and library changes /// - [z]: Patch version with no direct changes to the API /// +/// - 2022/10/24 (4.10.4) - Fix nk_str_{append,insert}_str_utf8 always returning 0 /// - 2022/09/03 (4.10.3) - Renamed the `null` texture variable to `tex_null` /// - 2022/08/01 (4.10.2) - Fix Apple Silicon with incorrect NK_SITE_TYPE and NK_POINTER_TYPE /// - 2022/08/01 (4.10.1) - Fix cursor jumping back to beginning of text when typing more than diff --git a/src/nuklear_string.c b/src/nuklear_string.c index 6ba249f..01a8de5 100644 --- a/src/nuklear_string.c +++ b/src/nuklear_string.c @@ -64,7 +64,6 @@ nk_str_append_text_utf8(struct nk_str *str, const char *text, int len) NK_API int nk_str_append_str_utf8(struct nk_str *str, const char *text) { - int runes = 0; int byte_len = 0; int num_runes = 0; int glyph_len = 0; @@ -78,7 +77,7 @@ nk_str_append_str_utf8(struct nk_str *str, const char *text) num_runes++; } nk_str_append_text_char(str, text, byte_len); - return runes; + return num_runes; } NK_API int nk_str_append_text_runes(struct nk_str *str, const nk_rune *text, int len) @@ -193,7 +192,6 @@ nk_str_insert_text_utf8(struct nk_str *str, int pos, const char *text, int len) NK_API int nk_str_insert_str_utf8(struct nk_str *str, int pos, const char *text) { - int runes = 0; int byte_len = 0; int num_runes = 0; int glyph_len = 0; @@ -207,7 +205,7 @@ nk_str_insert_str_utf8(struct nk_str *str, int pos, const char *text) num_runes++; } nk_str_insert_at_rune(str, pos, text, byte_len); - return runes; + return num_runes; } NK_API int nk_str_insert_text_runes(struct nk_str *str, int pos, const nk_rune *runes, int len)