summaryrefslogtreecommitdiff
path: root/render/textplain.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2007-03-11 22:08:57 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2007-03-11 22:08:57 +0000
commit9cf51227979c84a9ed74c339290c3f65f0d58c4f (patch)
treea0c2a9fd6b328eca1dfbdf17989b5ef175427124 /render/textplain.c
parent58c217cbeeca8bac6c5edd3d156b1f5bbefed3d3 (diff)
downloadnetsurf-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/textplain.c')
-rw-r--r--render/textplain.c22
1 files changed, 15 insertions, 7 deletions
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;
}