From 24c57d3215f7e906ee312f19c6b1a870e984e765 Mon Sep 17 00:00:00 2001 From: John Tytgat Date: Mon, 3 May 2004 21:00:14 +0000 Subject: [project @ 2004-05-03 21:00:14 by joty] ro_gui_set_icon_string() : - anti-flicker test didn't work when string is longer than icon text buffer length - make sure we have a NUL char terminated string when new icon text is longer than icon buffer. svn path=/import/netsurf/; revision=820 --- riscos/dialog.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'riscos') diff --git a/riscos/dialog.c b/riscos/dialog.c index 9a93da379..4c03656e8 100644 --- a/riscos/dialog.c +++ b/riscos/dialog.c @@ -733,14 +733,17 @@ void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text) { /* Check that the existing text is not the same as the updated text to stop flicker */ - if (!strncmp(ic.icon.data.indirected_text.text, text, - (unsigned int)ic.icon.data.indirected_text.size)) return; + if (!strcmp(ic.icon.data.indirected_text.text, text)) + return; /* Copy the text across */ old_len = strlen(ic.icon.data.indirected_text.text); - strncpy(ic.icon.data.indirected_text.text, text, + if (ic.icon.data.indirected_text.size > 0) { + strncpy(ic.icon.data.indirected_text.text, text, (unsigned int)ic.icon.data.indirected_text.size); + ic.icon.data.indirected_text.text[ic.icon.data.indirected_text.size - 1] = '\0'; + } /* Handle the caret being in the icon */ -- cgit v1.2.3