From 337bd98f6c6b8ec900afaae613337fdbc5ba778a Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 27 Aug 2017 13:23:23 +0100 Subject: BMP content handler: Convert to using content_broadcast_errorcode(). --- content/handlers/image/bmp.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'content/handlers/image') 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; } -- cgit v1.2.3