diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2007-03-11 22:08:57 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2007-03-11 22:08:57 +0000 |
commit | 9cf51227979c84a9ed74c339290c3f65f0d58c4f (patch) | |
tree | a0c2a9fd6b328eca1dfbdf17989b5ef175427124 /render | |
parent | 58c217cbeeca8bac6c5edd3d156b1f5bbefed3d3 (diff) | |
download | netsurf-9cf51227979c84a9ed74c339290c3f65f0d58c4f.tar.gz netsurf-9cf51227979c84a9ed74c339290c3f65f0d58c4f.tar.bz2 |
Content handlers should not call warn_user - they should broadcast the
error using content_broadcast and leave it to the content owner(s) to
decide what to do about it.
Only use warn_user for top-level contents.
svn path=/trunk/netsurf/; revision=3204
Diffstat (limited to 'render')
-rw-r--r-- | render/html.c | 9 | ||||
-rw-r--r-- | render/textplain.c | 22 |
2 files changed, 22 insertions, 9 deletions
diff --git a/render/html.c b/render/html.c index 46d98b81d..db7c694cc 100644 --- a/render/html.c +++ b/render/html.c @@ -136,7 +136,6 @@ bool html_create(struct content *c, const char *params[]) no_memory: msg_data.error = messages_get("NoMemory"); content_broadcast(c, CONTENT_MSG_ERROR, msg_data); - warn_user("NoMemory", 0); return false; } @@ -1358,7 +1357,13 @@ void html_object_failed(struct box *box, struct content *content, * containers */ ic = box_create(0, 0, 0, 0, 0, content); if (!ic) { - warn_user("NoMemory", 0); + union content_msg_data msg_data; + + msg_data.error = + messages_get("NoMemory"); + content_broadcast(content, + CONTENT_MSG_ERROR, + msg_data); return; } ic->type = BOX_INLINE_CONTAINER; diff --git a/render/textplain.c b/render/textplain.c index 8984ff851..cb9bc644f 100644 --- a/render/textplain.c +++ b/render/textplain.c @@ -76,9 +76,14 @@ bool textplain_create(struct content *c, const char *params[]) iconv_cd = iconv_open("utf-8", "iso-8859-1"); } if (iconv_cd == (iconv_t)(-1)) { - msg_data.error = strerror(errno); + char buf[300]; + + snprintf(buf, sizeof buf, "IconvFailed %s", strerror(errno)); + buf[sizeof buf - 1] = 0; + + msg_data.error = buf; content_broadcast(c, CONTENT_MSG_ERROR, msg_data); - warn_user("IconvFailed", strerror(errno)); + return false; } @@ -97,7 +102,6 @@ bool textplain_create(struct content *c, const char *params[]) no_memory: msg_data.error = messages_get("NoMemory"); content_broadcast(c, CONTENT_MSG_ERROR, msg_data); - warn_user("NoMemory", 0); return false; } @@ -137,9 +141,15 @@ bool textplain_process_data(struct content *c, char *data, unsigned int size) c->data.textplain.utf8_data = utf8_data; c->data.textplain.utf8_data_allocated = allocated; } else if (count == (size_t)(-1) && errno != EINVAL) { - msg_data.error = strerror(errno); + char buf[300]; + + snprintf(buf, sizeof buf, "IconvFailed %s", + strerror(errno)); + buf[sizeof buf - 1] = 0; + + msg_data.error = buf; content_broadcast(c, CONTENT_MSG_ERROR, msg_data); - warn_user("IconvFailed", strerror(errno)); + return false; } @@ -152,7 +162,6 @@ bool textplain_process_data(struct content *c, char *data, unsigned int size) no_memory: msg_data.error = messages_get("NoMemory"); content_broadcast(c, CONTENT_MSG_ERROR, msg_data); - warn_user("NoMemory", 0); return false; } @@ -266,7 +275,6 @@ void textplain_reformat(struct content *c, int width, int height) no_memory: LOG(("out of memory (line_count %lu)", line_count)); - warn_user("NoMemory", 0); return; } |