summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-12-03 17:03:03 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-12-10 16:05:14 +0100
commit855d80702e038035ab121307e9fe570ed9762167 (patch)
tree38e2e36bfc4856cfcaadc0c362edf0d059dca410 /src/gui
parent71ae8f1907592a25d8fa6b10e02020f19c16b215 (diff)
downloadweechat-855d80702e038035ab121307e9fe570ed9762167.zip
core: replace call to memcpy by utf8_strncpy
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/curses/gui-curses-chat.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index e8e0a9105..0ffacd982 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -373,7 +373,7 @@ gui_chat_display_word_raw (struct t_gui_window *window, struct t_gui_line *line,
int apply_style_inactive,
int nick_offline)
{
- char *next_char, *output, utf_char[16], *ptr_char;
+ char *output, utf_char[16], *ptr_char;
int x, chars_displayed, display_char, size_on_screen;
if (!simulate)
@@ -395,14 +395,10 @@ gui_chat_display_word_raw (struct t_gui_window *window, struct t_gui_line *line,
if (!string)
return chars_displayed;
- next_char = (char *)utf8_next_char (string);
- if (next_char)
+ utf8_strncpy (utf_char, string, 1);
+ if (utf_char[0])
{
ptr_char = utf_char;
-
- memcpy (utf_char, string, next_char - string);
- utf_char[next_char - string] = '\0';
-
if (!gui_chat_utf_char_valid (utf_char))
snprintf (utf_char, sizeof (utf_char), " ");
else if (utf_char[0] == '\t')
@@ -440,7 +436,7 @@ gui_chat_display_word_raw (struct t_gui_window *window, struct t_gui_line *line,
x += size_on_screen;
}
- string = next_char;
+ string = utf8_next_char (string);
}
return chars_displayed;