mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-01 16:54:30 +03:00
[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
This commit is contained in:
parent
da96f9da00
commit
24c57d3215
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user