summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2017-08-27 13:23:23 +0100
committerMichael Drake <michael.drake@codethink.co.uk>2017-08-27 13:28:21 +0100
commit337bd98f6c6b8ec900afaae613337fdbc5ba778a (patch)
tree0e7f0af485a0fac44081aafee5c8c516049e7aa0
parentd4cdcf30675a642764b5dc32e313aa92e4849496 (diff)
downloadnetsurf-337bd98f6c6b8ec900afaae613337fdbc5ba778a.tar.gz
netsurf-337bd98f6c6b8ec900afaae613337fdbc5ba778a.tar.bz2
BMP content handler: Convert to using content_broadcast_errorcode().
-rw-r--r--content/handlers/image/bmp.c13
-rw-r--r--utils/errors.h2
2 files changed, 6 insertions, 9 deletions
diff --git a/content/handlers/image/bmp.c b/content/handlers/image/bmp.c
index 47c1d0845..48a37fb24 100644
--- a/content/handlers/image/bmp.c
+++ b/content/handlers/image/bmp.c
@@ -68,8 +68,7 @@ static void *nsbmp_bitmap_create(int width, int height, unsigned int bmp_state)
}
static nserror nsbmp_create_bmp_data(nsbmp_content *bmp)
-{
- union content_msg_data msg_data;
+{
bmp_bitmap_callback_vt bmp_bitmap_callbacks = {
.bitmap_create = nsbmp_bitmap_create,
.bitmap_destroy = guit->bitmap->destroy,
@@ -79,8 +78,7 @@ static nserror nsbmp_create_bmp_data(nsbmp_content *bmp)
bmp->bmp = calloc(sizeof(struct bmp_image), 1);
if (bmp->bmp == NULL) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&bmp->base, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(&bmp->base, NSERROR_NOMEM);
return NSERROR_NOMEM;
}
@@ -123,7 +121,6 @@ static bool nsbmp_convert(struct content *c)
{
nsbmp_content *bmp = (nsbmp_content *) c;
bmp_result res;
- union content_msg_data msg_data;
uint32_t swidth;
const char *data;
unsigned long size;
@@ -138,13 +135,11 @@ static bool nsbmp_convert(struct content *c)
case BMP_OK:
break;
case BMP_INSUFFICIENT_MEMORY:
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
case BMP_INSUFFICIENT_DATA:
case BMP_DATA_ERROR:
- msg_data.error = messages_get("BadBMP");
- content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
+ content_broadcast_errorcode(c, NSERROR_BMP_ERROR);
return false;
}
diff --git a/utils/errors.h b/utils/errors.h
index b9e157c66..803a55f44 100644
--- a/utils/errors.h
+++ b/utils/errors.h
@@ -47,6 +47,8 @@ typedef enum {
NSERROR_MNG_ERROR, /**< An MNG error occurred */
+ NSERROR_BMP_ERROR, /**< A BMP error occurred */
+
NSERROR_BAD_ENCODING, /**< The character set is unknown */
NSERROR_NEED_DATA, /**< More data needed */