From f34a485dc6fb38e1c2dd23704891fb81f53a06cb Mon Sep 17 00:00:00 2001 From: John Tytgat Date: Thu, 26 Aug 2004 22:58:19 +0000 Subject: [project @ 2004-08-26 22:58:19 by joty] warn_user() : made warn_buffer static local. die() : a too long error message is now correctly NUL terminated; got rid of static variable. svn path=/import/netsurf/; revision=1251 --- riscos/gui.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'riscos') diff --git a/riscos/gui.c b/riscos/gui.c index 43c06ede6..732adb472 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -1454,8 +1454,6 @@ void gui_launch_url(const char *url) } -static char warn_buffer[300]; - /** * Display a warning for a serious problem (eg memory exhaustion). * @@ -1465,6 +1463,8 @@ static char warn_buffer[300]; void warn_user(const char *warning, const char *detail) { + static char warn_buffer[300]; + LOG(("%s %s", warning, detail)); snprintf(warn_buffer, sizeof warn_buffer, "%s %s", messages_get(warning), @@ -1479,9 +1479,6 @@ void warn_user(const char *warning, const char *detail) } -static os_error warn_error = { 1, "" }; - - /** * Display an error and exit. * @@ -1490,7 +1487,12 @@ static os_error warn_error = { 1, "" }; void die(const char *error) { - strncpy(warn_error.errmess, messages_get(error), 252); + os_error warn_error; + + warn_error.errnum = 1; /* \todo: reasonable ? */ + strncpy(warn_error.errmess, messages_get(error), + sizeof(warn_error.errmess)-1); + warn_error.errmess[sizeof(warn_error.errmess)-1] = '\0'; xwimp_report_error_by_category(&warn_error, wimp_ERROR_BOX_OK_ICON | wimp_ERROR_BOX_GIVEN_CATEGORY | -- cgit v1.2.3