From 45b78bc199cac5e5f32be205191242e364c82be3 Mon Sep 17 00:00:00 2001 From: Richard Wilson Date: Wed, 25 Jan 2006 12:49:51 +0000 Subject: [project @ 2006-01-25 12:49:51 by rjw] Possible workaround for OS template loading bug. svn path=/import/netsurf/; revision=2041 --- riscos/dialog.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/riscos/dialog.c b/riscos/dialog.c index 7946a1146..0f6dcb043 100644 --- a/riscos/dialog.c +++ b/riscos/dialog.c @@ -246,6 +246,14 @@ wimp_window * ro_gui_dialog_load_template(const char *template_name) /* wimp_load_template won't accept a const char * */ strncpy(name, template_name, sizeof name); + /* there is an OS bug such that wimp_load_template with a 12 character + * name will sometimes fail. to work around it we truncate such names to a + * 10 character wildcarded name, eg 'con_language' -> 'con_langua*' */ + if (strlen(template_name) > 11) { + name[10] = '*'; + name[11] = '\0'; + } + /* find required buffer sizes */ error = xwimp_load_template(wimp_GET_SIZE, 0, 0, wimp_NO_FONTS, name, 0, &window_size, &data_size, &context); @@ -269,6 +277,12 @@ wimp_window * ro_gui_dialog_load_template(const char *template_name) die("NoMemory"); } + /* the OS has updated our name, so we reset it back if required*/ + if (strlen(template_name) > 11) { + name[10] = '*'; + name[11] = '\0'; + } + /* load template */ error = xwimp_load_template(window, data, data + data_size, wimp_NO_FONTS, name, 0, 0, 0, 0); -- cgit v1.2.3