summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Tytgat <joty@netsurf-browser.org>2004-05-03 21:00:14 +0000
committerJohn Tytgat <joty@netsurf-browser.org>2004-05-03 21:00:14 +0000
commit24c57d3215f7e906ee312f19c6b1a870e984e765 (patch)
tree69ce6e4e7bdb06a35d32a84f6e1327cdbf29f1c5
parentda96f9da00a1cfc9bccc5d17ac02fe19fe4c2338 (diff)
downloadnetsurf-24c57d3215f7e906ee312f19c6b1a870e984e765.tar.gz
netsurf-24c57d3215f7e906ee312f19c6b1a870e984e765.tar.bz2
[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
-rw-r--r--riscos/dialog.c9
1 files changed, 6 insertions, 3 deletions
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
*/