mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 20:16:54 +03:00
ICO content handler: Convert to using content_broadcast_errorcode().
This commit is contained in:
parent
d83f6ea3c1
commit
d1a493f569
@ -66,7 +66,6 @@ static void *nsico_bitmap_create(int width, int height, unsigned int bmp_state)
|
||||
|
||||
static nserror nsico_create_ico_data(nsico_content *c)
|
||||
{
|
||||
union content_msg_data msg_data;
|
||||
bmp_bitmap_callback_vt bmp_bitmap_callbacks = {
|
||||
.bitmap_create = nsico_bitmap_create,
|
||||
.bitmap_destroy = guit->bitmap->destroy,
|
||||
@ -76,8 +75,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_errorcode(&c->base, NSERROR_NOMEM);
|
||||
return NSERROR_NOMEM;
|
||||
}
|
||||
ico_collection_create(c->ico, &bmp_bitmap_callbacks);
|
||||
@ -122,7 +120,6 @@ static bool nsico_convert(struct content *c)
|
||||
nsico_content *ico = (nsico_content *) c;
|
||||
struct bmp_image *bmp;
|
||||
bmp_result res;
|
||||
union content_msg_data msg_data;
|
||||
const char *data;
|
||||
unsigned long size;
|
||||
char *title;
|
||||
@ -137,13 +134,11 @@ static bool nsico_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("BadICO");
|
||||
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
|
||||
content_broadcast_errorcode(c, NSERROR_ICO_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,8 @@ typedef enum {
|
||||
|
||||
NSERROR_GIF_ERROR, /**< A GIF error occurred */
|
||||
|
||||
NSERROR_ICO_ERROR, /**< A ICO error occurred */
|
||||
|
||||
NSERROR_BAD_ENCODING, /**< The character set is unknown */
|
||||
|
||||
NSERROR_NEED_DATA, /**< More data needed */
|
||||
|
Loading…
Reference in New Issue
Block a user