diff options
author | John Tytgat <joty@netsurf-browser.org> | 2004-05-03 21:00:14 +0000 |
---|---|---|
committer | John Tytgat <joty@netsurf-browser.org> | 2004-05-03 21:00:14 +0000 |
commit | 24c57d3215f7e906ee312f19c6b1a870e984e765 (patch) | |
tree | 69ce6e4e7bdb06a35d32a84f6e1327cdbf29f1c5 /riscos | |
parent | da96f9da00a1cfc9bccc5d17ac02fe19fe4c2338 (diff) | |
download | netsurf-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
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/dialog.c | 9 |
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 */ |