From d70beb28db6f978ae9fc674640f3101e20c05bb8 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 26 Aug 2017 15:50:03 +0100 Subject: Content API: Make content_broadcast take pointer to content_msg_data. --- content/handlers/css/css.c | 8 ++++---- content/handlers/image/bmp.c | 6 +++--- content/handlers/image/gif.c | 8 ++++---- content/handlers/image/ico.c | 6 +++--- content/handlers/image/jpeg.c | 2 +- content/handlers/image/nssprite.c | 4 ++-- content/handlers/image/png.c | 8 ++++---- content/handlers/image/rsvg.c | 12 ++++++------ content/handlers/image/svg.c | 2 +- 9 files changed, 28 insertions(+), 28 deletions(-) (limited to 'content/handlers') diff --git a/content/handlers/css/css.c b/content/handlers/css/css.c index 997eb5115..a665fbdc4 100644 --- a/content/handlers/css/css.c +++ b/content/handlers/css/css.c @@ -172,7 +172,7 @@ nscss_create(const content_handler *handler, nscss_content_done, result); if (error != NSERROR_OK) { msg_data.error = messages_get("NoMemory"); - content_broadcast(&result->base, CONTENT_MSG_ERROR, msg_data); + content_broadcast(&result->base, CONTENT_MSG_ERROR, &msg_data); if (charset_value != NULL) lwc_string_unref(charset_value); free(result); @@ -256,7 +256,7 @@ bool nscss_process_data(struct content *c, const char *data, unsigned int size) error = nscss_process_css_data(&css->data, data, size); if (error != CSS_OK && error != CSS_NEEDDATA) { msg_data.error = "?"; - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); } return (error == CSS_OK || error == CSS_NEEDDATA); @@ -292,7 +292,7 @@ bool nscss_convert(struct content *c) error = nscss_convert_css_data(&css->data); if (error != CSS_OK) { msg_data.error = "?"; - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } @@ -485,7 +485,7 @@ void nscss_content_done(struct content_css_data *css, void *pw) error = css_stylesheet_size(css->sheet, &size); if (error != CSS_OK) { msg_data.error = "?"; - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); content_set_error(c); return; } diff --git a/content/handlers/image/bmp.c b/content/handlers/image/bmp.c index 271787449..47c1d0845 100644 --- a/content/handlers/image/bmp.c +++ b/content/handlers/image/bmp.c @@ -80,7 +80,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(&bmp->base, CONTENT_MSG_ERROR, &msg_data); return NSERROR_NOMEM; } @@ -139,12 +139,12 @@ static bool nsbmp_convert(struct content *c) break; case BMP_INSUFFICIENT_MEMORY: msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); 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(c, CONTENT_MSG_ERROR, &msg_data); return false; } diff --git a/content/handlers/image/gif.c b/content/handlers/image/gif.c index c4f039490..9184f31ce 100644 --- a/content/handlers/image/gif.c +++ b/content/handlers/image/gif.c @@ -86,7 +86,7 @@ static nserror nsgif_create_gif_data(nsgif_content *c) c->gif = calloc(sizeof(gif_animation), 1); if (c->gif == NULL) { msg_data.error = messages_get("NoMemory"); - content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data); + content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data); return NSERROR_NOMEM; } gif_create(c->gif, &gif_bitmap_callbacks); @@ -231,7 +231,7 @@ static void nsgif_animate(void *p) data.redraw.object_width = gif->base.width; data.redraw.object_height = gif->base.height; - content_broadcast(&gif->base, CONTENT_MSG_REDRAW, data); + content_broadcast(&gif->base, CONTENT_MSG_REDRAW, &data); } static bool nsgif_convert(struct content *c) @@ -261,7 +261,7 @@ static bool nsgif_convert(struct content *c) msg_data.error = messages_get("NoMemory"); break; } - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } } while (res != GIF_OK && res != GIF_INSUFFICIENT_FRAME_DATA); @@ -270,7 +270,7 @@ static bool nsgif_convert(struct content *c) if ((gif->gif->frame_count_partial == 0) || (gif->gif->width == 0) || (gif->gif->height == 0)) { msg_data.error = messages_get("BadGIF"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } diff --git a/content/handlers/image/ico.c b/content/handlers/image/ico.c index b14ea7fe1..180b20d7e 100644 --- a/content/handlers/image/ico.c +++ b/content/handlers/image/ico.c @@ -77,7 +77,7 @@ static nserror nsico_create_ico_data(nsico_content *c) c->ico = calloc(sizeof(ico_collection), 1); if (c->ico == NULL) { msg_data.error = messages_get("NoMemory"); - content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data); + content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data); return NSERROR_NOMEM; } ico_collection_create(c->ico, &bmp_bitmap_callbacks); @@ -138,12 +138,12 @@ static bool nsico_convert(struct content *c) break; case BMP_INSUFFICIENT_MEMORY: msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; case BMP_INSUFFICIENT_DATA: case BMP_DATA_ERROR: msg_data.error = messages_get("BadICO"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } diff --git a/content/handlers/image/jpeg.c b/content/handlers/image/jpeg.c index 5ae9e70cd..c5aca1c9b 100644 --- a/content/handlers/image/jpeg.c +++ b/content/handlers/image/jpeg.c @@ -301,7 +301,7 @@ static bool nsjpeg_convert(struct content *c) jpeg_destroy_decompress(&cinfo); msg_data.error = nsjpeg_error_buffer; - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } diff --git a/content/handlers/image/nssprite.c b/content/handlers/image/nssprite.c index 247574aa4..ab48978e9 100644 --- a/content/handlers/image/nssprite.c +++ b/content/handlers/image/nssprite.c @@ -119,13 +119,13 @@ static bool nssprite_convert(struct content *c) nssprite->bitmap = guit->bitmap->create(sprite->width, sprite->height, BITMAP_NEW); if (!nssprite->bitmap) { msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } uint32_t* imagebuf = (uint32_t *)guit->bitmap->get_buffer(nssprite->bitmap); if (!imagebuf) { msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } unsigned char *spritebuf = (unsigned char *)sprite->image; diff --git a/content/handlers/image/png.c b/content/handlers/image/png.c index 0baf411bf..136fd8f73 100644 --- a/content/handlers/image/png.c +++ b/content/handlers/image/png.c @@ -247,7 +247,7 @@ static nserror nspng_create_png_data(nspng_content *png_c) png_c->png = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); if (png_c->png == NULL) { msg_data.error = messages_get("NoMemory"); - content_broadcast(&png_c->base, CONTENT_MSG_ERROR, msg_data); + content_broadcast(&png_c->base, CONTENT_MSG_ERROR, &msg_data); return NSERROR_NOMEM; } @@ -258,7 +258,7 @@ static nserror nspng_create_png_data(nspng_content *png_c) png_destroy_read_struct(&png_c->png, &png_c->info, 0); msg_data.error = messages_get("NoMemory"); - content_broadcast(&png_c->base, CONTENT_MSG_ERROR, msg_data); + content_broadcast(&png_c->base, CONTENT_MSG_ERROR, &msg_data); return NSERROR_NOMEM; } @@ -269,7 +269,7 @@ static nserror nspng_create_png_data(nspng_content *png_c) png_c->info = NULL; msg_data.error = messages_get("PNGError"); - content_broadcast(&png_c->base, CONTENT_MSG_ERROR, msg_data); + content_broadcast(&png_c->base, CONTENT_MSG_ERROR, &msg_data); return NSERROR_NOMEM; } @@ -363,7 +363,7 @@ static bool nspng_process_data(struct content *c, const char *data, png_c->info = NULL; msg_data.error = messages_get("PNGError"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); ret = false; diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c index 0665f217f..24819df57 100644 --- a/content/handlers/image/rsvg.c +++ b/content/handlers/image/rsvg.c @@ -72,7 +72,7 @@ static nserror rsvg_create_svg_data(rsvg_content *c) if ((c->rsvgh = rsvg_handle_new()) == NULL) { LOG("rsvg_handle_new() returned NULL."); msg_data.error = messages_get("NoMemory"); - content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data); + content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data); return NSERROR_NOMEM; } @@ -122,7 +122,7 @@ static bool rsvg_process_data(struct content *c, const char *data, &err) == FALSE) { LOG("rsvg_handle_write returned an error: %s", err->message); msg_data.error = err->message; - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } @@ -168,7 +168,7 @@ static bool rsvg_convert(struct content *c) if (rsvg_handle_close(d->rsvgh, &err) == FALSE) { LOG("rsvg_handle_close returned an error: %s", err->message); msg_data.error = err->message; - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } @@ -186,7 +186,7 @@ static bool rsvg_convert(struct content *c) BITMAP_NEW)) == NULL) { LOG("Failed to create bitmap for rsvg render."); msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } @@ -197,14 +197,14 @@ static bool rsvg_convert(struct content *c) guit->bitmap->get_rowstride(d->bitmap))) == NULL) { LOG("Failed to create Cairo image surface for rsvg render."); msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } if ((d->ct = cairo_create(d->cs)) == NULL) { LOG("Failed to create Cairo drawing context for rsvg render."); msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } diff --git a/content/handlers/image/svg.c b/content/handlers/image/svg.c index b34c6b7bb..f31ee1f8d 100644 --- a/content/handlers/image/svg.c +++ b/content/handlers/image/svg.c @@ -62,7 +62,7 @@ static nserror svg_create_svg_data(svg_content *c) no_memory: msg_data.error = messages_get("NoMemory"); - content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data); + content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data); return NSERROR_NOMEM; } -- cgit v1.2.3