refactor content handler initilisation to use named initialisors

svn path=/trunk/netsurf/; revision=12341
This commit is contained in:
Vincent Sanders 2011-05-09 15:32:34 +00:00
parent 0929aa897b
commit 83f9e707eb
20 changed files with 145 additions and 273 deletions

View File

@ -61,21 +61,13 @@ static nserror amiga_dt_picture_clone(const struct content *old, struct content
static content_type amiga_dt_picture_content_type(lwc_string *mime_type); static content_type amiga_dt_picture_content_type(lwc_string *mime_type);
static const content_handler amiga_dt_picture_content_handler = { static const content_handler amiga_dt_picture_content_handler = {
amiga_dt_picture_create, .create = amiga_dt_picture_create,
NULL, .data_complete = amiga_dt_picture_convert,
amiga_dt_picture_convert, .destroy = amiga_dt_picture_destroy,
NULL, .redraw = amiga_dt_picture_redraw,
amiga_dt_picture_destroy, .clone = amiga_dt_picture_clone,
NULL, .type = amiga_dt_picture_content_type,
NULL, .no_share = false,
NULL,
amiga_dt_picture_redraw,
NULL,
NULL,
amiga_dt_picture_clone,
NULL,
amiga_dt_picture_content_type,
false
}; };
nserror amiga_dt_picture_init_from_mime(void) nserror amiga_dt_picture_init_from_mime(void)

View File

@ -72,21 +72,13 @@ static nserror amiga_icon_clone(const struct content *old,
static content_type amiga_icon_content_type(lwc_string *mime_type); static content_type amiga_icon_content_type(lwc_string *mime_type);
static const content_handler amiga_icon_content_handler = { static const content_handler amiga_icon_content_handler = {
amiga_icon_create, .create = amiga_icon_create,
NULL, .data_complete = amiga_icon_convert,
amiga_icon_convert, .destroy = amiga_icon_destroy,
NULL, .redraw = amiga_icon_redraw,
amiga_icon_destroy, .clone = amiga_icon_clone,
NULL, .type = amiga_icon_content_type,
NULL, .no_share = false,
NULL,
amiga_icon_redraw,
NULL,
NULL,
amiga_icon_clone,
NULL,
amiga_icon_content_type,
false
}; };
static const char *amiga_icon_types[] = { static const char *amiga_icon_types[] = {

View File

@ -278,9 +278,9 @@ void content_convert(struct content *c)
LOG(("content %s (%p)", llcache_handle_get_url(c->llcache), c)); LOG(("content %s (%p)", llcache_handle_get_url(c->llcache), c));
if (c->handler->convert != NULL) { if (c->handler->data_complete != NULL) {
c->locked = true; c->locked = true;
if (c->handler->convert(c) == false) { if (c->handler->data_complete(c) == false) {
c->locked = false; c->locked = false;
c->status = CONTENT_STATUS_ERROR; c->status = CONTENT_STATUS_ERROR;
} }

View File

@ -46,7 +46,7 @@ struct content_handler {
bool (*process_data)(struct content *c, bool (*process_data)(struct content *c,
const char *data, unsigned int size); const char *data, unsigned int size);
bool (*convert)(struct content *c); bool (*data_complete)(struct content *c);
void (*reformat)(struct content *c, int width, int height); void (*reformat)(struct content *c, int width, int height);
void (*destroy)(struct content *c); void (*destroy)(struct content *c);
void (*stop)(struct content *c); void (*stop)(struct content *c);

View File

@ -79,21 +79,14 @@ static css_error nscss_register_import(struct content_css_data *c,
const hlcache_handle *import); const hlcache_handle *import);
static const content_handler css_content_handler = { static const content_handler css_content_handler = {
nscss_create, .create = nscss_create,
nscss_process_data, .process_data = nscss_process_data,
nscss_convert, .data_complete = nscss_convert,
NULL, .destroy = nscss_destroy,
nscss_destroy, .clone = nscss_clone,
NULL, .matches_quirks = nscss_matches_quirks,
NULL, .type = nscss_content_type,
NULL, .no_share = false,
NULL,
NULL,
NULL,
nscss_clone,
nscss_matches_quirks,
nscss_content_type,
false
}; };
static lwc_string *css_mime_type; static lwc_string *css_mime_type;

View File

@ -272,21 +272,13 @@ static content_type nsbmp_content_type(lwc_string *mime_type)
static const content_handler nsbmp_content_handler = { static const content_handler nsbmp_content_handler = {
nsbmp_create, .create = nsbmp_create,
NULL, .data_complete = nsbmp_convert,
nsbmp_convert, .destroy = nsbmp_destroy,
NULL, .redraw = nsbmp_redraw,
nsbmp_destroy, .clone = nsbmp_clone,
NULL, .type = nsbmp_content_type,
NULL, .no_share = false,
NULL,
nsbmp_redraw,
NULL,
NULL,
nsbmp_clone,
NULL,
nsbmp_content_type,
false
}; };
nserror nsbmp_init(void) nserror nsbmp_init(void)

View File

@ -418,21 +418,13 @@ static content_type nsgif_content_type(lwc_string *mime_type)
static const content_handler nsgif_content_handler = { static const content_handler nsgif_content_handler = {
nsgif_create, .create = nsgif_create,
NULL, .data_complete = nsgif_convert,
nsgif_convert, .destroy = nsgif_destroy,
NULL, .redraw = nsgif_redraw,
nsgif_destroy, .clone = nsgif_clone,
NULL, .type = nsgif_content_type,
NULL, .no_share = false,
NULL,
nsgif_redraw,
NULL,
NULL,
nsgif_clone,
NULL,
nsgif_content_type,
false
}; };
nserror nsgif_init(void) nserror nsgif_init(void)

View File

@ -230,21 +230,13 @@ static content_type nsico_content_type(lwc_string *mime_type)
} }
static const content_handler nsico_content_handler = { static const content_handler nsico_content_handler = {
nsico_create, .create = nsico_create,
NULL, .data_complete = nsico_convert,
nsico_convert, .destroy = nsico_destroy,
NULL, .redraw = nsico_redraw,
nsico_destroy, .clone = nsico_clone,
NULL, .type = nsico_content_type,
NULL, .no_share = false,
NULL,
nsico_redraw,
NULL,
NULL,
nsico_clone,
NULL,
nsico_content_type,
false
}; };

View File

@ -335,21 +335,13 @@ static content_type nsjpeg_content_type(lwc_string *mime_type)
} }
static const content_handler nsjpeg_content_handler = { static const content_handler nsjpeg_content_handler = {
nsjpeg_create, .create = nsjpeg_create,
NULL, .data_complete = nsjpeg_convert,
nsjpeg_convert, .destroy = nsjpeg_destroy,
NULL, .redraw = nsjpeg_redraw,
nsjpeg_destroy, .clone = nsjpeg_clone,
NULL, .type = nsjpeg_content_type,
NULL, .no_share = false,
NULL,
nsjpeg_redraw,
NULL,
NULL,
nsjpeg_clone,
NULL,
nsjpeg_content_type,
false
}; };
nserror nsjpeg_init(void) nserror nsjpeg_init(void)

View File

@ -96,21 +96,14 @@ static void nsmng_free(mng_ptr p, mng_size_t n);
#endif #endif
static const content_handler nsmng_content_handler = { static const content_handler nsmng_content_handler = {
nsmng_create, .create = nsmng_create,
nsmng_process_data, .process_data = nsmng_process_data,
nsmng_convert, .data_complete = nsmng_convert,
NULL, .destroy = nsmng_destroy,
nsmng_destroy, .redraw = nsmng_redraw,
NULL, .clone = nsmng_clone,
NULL, .type = nsmng_content_type,
NULL, .no_share = false,
nsmng_redraw,
NULL,
NULL,
nsmng_clone,
NULL,
nsmng_content_type,
false
}; };
static const char *jng_types[] = { static const char *jng_types[] = {

View File

@ -72,21 +72,13 @@ static content_type nssprite_content_type(lwc_string *mime_type);
} while(0) } while(0)
static const content_handler nssprite_content_handler = { static const content_handler nssprite_content_handler = {
nssprite_create, .create = nssprite_create,
NULL, .data_complete = nssprite_convert,
nssprite_convert, .destroy = nssprite_destroy,
NULL, .redraw = nssprite_redraw,
nssprite_destroy, .clone = nssprite_clone,
NULL, .type = nssprite_content_type,
NULL, .no_share = false,
NULL,
nssprite_redraw,
NULL,
NULL,
nssprite_clone,
NULL,
nssprite_content_type,
false
}; };
static const char *nssprite_types[] = { static const char *nssprite_types[] = {

View File

@ -413,21 +413,14 @@ static content_type nspng_content_type(lwc_string *mime_type)
} }
static const content_handler nspng_content_handler = { static const content_handler nspng_content_handler = {
nspng_create, .create = nspng_create,
nspng_process_data, .process_data = nspng_process_data,
nspng_convert, .data_complete = nspng_convert,
NULL, .destroy = nspng_destroy,
nspng_destroy, .redraw = nspng_redraw,
NULL, .clone = nspng_clone,
NULL, .type = nspng_content_type,
NULL, .no_share = false,
nspng_redraw,
NULL,
NULL,
nspng_clone,
NULL,
nspng_content_type,
false
}; };
nserror nspng_init(void) nserror nspng_init(void)

View File

@ -310,21 +310,14 @@ static content_type rsvg_content_type(lwc_string *mime_type)
} }
static const content_handler rsvg_content_handler = { static const content_handler rsvg_content_handler = {
rsvg_create, .create = rsvg_create,
rsvg_process_data, .process_data = rsvg_process_data,
rsvg_convert, .data_complete = rsvg_convert,
NULL, .destroy = rsvg_destroy,
rsvg_destroy, .redraw = rsvg_redraw,
NULL, .clone = rsvg_clone,
NULL, .type = rsvg_content_type,
NULL, .no_share = false,
rsvg_redraw,
NULL,
NULL,
rsvg_clone,
NULL,
rsvg_content_type,
false
}; };
nserror nsrsvg_init(void) nserror nsrsvg_init(void)

View File

@ -59,21 +59,14 @@ static nserror svg_clone(const struct content *old, struct content **newc);
static content_type svg_content_type(lwc_string *mime_type); static content_type svg_content_type(lwc_string *mime_type);
static const content_handler svg_content_handler = { static const content_handler svg_content_handler = {
svg_create, .create = svg_create,
NULL, .data_complete = svg_convert,
svg_convert, .reformat = svg_reformat,
svg_reformat, .destroy = svg_destroy,
svg_destroy, .redraw = svg_redraw,
NULL, .clone = svg_clone,
NULL, .type = svg_content_type,
NULL, .no_share = false,
svg_redraw,
NULL,
NULL,
svg_clone,
NULL,
svg_content_type,
false
}; };
static const char *svg_types[] = { static const char *svg_types[] = {

View File

@ -55,21 +55,13 @@ static nserror webp_clone(const struct content *old, struct content **newc);
static content_type webp_content_type(lwc_string *mime_type); static content_type webp_content_type(lwc_string *mime_type);
static const content_handler webp_content_handler = { static const content_handler webp_content_handler = {
webp_create, .create = webp_create,
NULL, .data_complete = webp_convert,
webp_convert, .destroy = webp_destroy,
NULL, .redraw = webp_redraw,
webp_destroy, .clone = webp_clone,
NULL, .type = webp_content_type,
NULL, .no_share = false,
NULL,
webp_redraw,
NULL,
NULL,
webp_clone,
NULL,
webp_content_type,
false
}; };
static const char *webp_types[] = { static const char *webp_types[] = {

View File

@ -102,21 +102,20 @@ static void html_dump_frameset(struct content_html_frames *frame,
#endif #endif
static const content_handler html_content_handler = { static const content_handler html_content_handler = {
html_create, .create = html_create,
html_process_data, .process_data = html_process_data,
html_convert, .data_complete = html_convert,
html_reformat, .reformat = html_reformat,
html_destroy, .destroy = html_destroy,
html_stop, .stop = html_stop,
html_mouse_track, .mouse_track = html_mouse_track,
html_mouse_action, .mouse_action = html_mouse_action,
html_redraw, .redraw = html_redraw,
html_open, .open = html_open,
html_close, .close = html_close,
html_clone, .clone = html_clone,
NULL, .type = html_content_type,
html_content_type, .no_share = true,
true
}; };
static const char empty_document[] = static const char empty_document[] =

View File

@ -121,21 +121,17 @@ static int textplain_coord_from_offset(const char *text, size_t offset,
static float textplain_line_height(void); static float textplain_line_height(void);
static const content_handler textplain_content_handler = { static const content_handler textplain_content_handler = {
textplain_create, .create = textplain_create,
textplain_process_data, .process_data = textplain_process_data,
textplain_convert, .data_complete = textplain_convert,
textplain_reformat, .reformat = textplain_reformat,
textplain_destroy, .destroy = textplain_destroy,
NULL, .mouse_track = textplain_mouse_track,
textplain_mouse_track, .mouse_action = textplain_mouse_action,
textplain_mouse_action, .redraw = textplain_redraw,
textplain_redraw, .clone = textplain_clone,
NULL, .type = textplain_content_type,
NULL, .no_share = true,
textplain_clone,
NULL,
textplain_content_type,
true
}; };
static lwc_string *textplain_mime_type; static lwc_string *textplain_mime_type;

View File

@ -118,21 +118,13 @@ static nserror artworks_clone(const struct content *old, struct content **newc);
static content_type artworks_content_type(lwc_string *mime_type); static content_type artworks_content_type(lwc_string *mime_type);
static const content_handler artworks_content_handler = { static const content_handler artworks_content_handler = {
artworks_create, .create = artworks_create,
NULL, .data_complete = artworks_convert,
artworks_convert, .destroy = artworks_destroy,
NULL, .redraw = artworks_redraw,
artworks_destroy, .clone = artworks_clone,
NULL, .type = artworks_content_type,
NULL, .no_share = false,
NULL,
artworks_redraw,
NULL,
NULL,
artworks_clone,
NULL,
artworks_content_type,
false
}; };
static const char *artworks_types[] = { static const char *artworks_types[] = {

View File

@ -58,21 +58,13 @@ static nserror draw_clone(const struct content *old, struct content **newc);
static content_type draw_content_type(lwc_string *mime_type); static content_type draw_content_type(lwc_string *mime_type);
static const content_handler draw_content_handler = { static const content_handler draw_content_handler = {
draw_create, .create = draw_create,
NULL, .data_complete = draw_convert,
draw_convert, .destroy = draw_destroy,
NULL, .redraw = draw_redraw,
draw_destroy, .clone = draw_clone,
NULL, .type = draw_content_type,
NULL, .no_share = false,
NULL,
draw_redraw,
NULL,
NULL,
draw_clone,
NULL,
draw_content_type,
false
}; };
static const char *draw_types[] = { static const char *draw_types[] = {

View File

@ -60,21 +60,13 @@ static nserror sprite_clone(const struct content *old, struct content **newc);
static content_type sprite_content_type(lwc_string *mime_type); static content_type sprite_content_type(lwc_string *mime_type);
static const content_handler sprite_content_handler = { static const content_handler sprite_content_handler = {
sprite_create, .create = sprite_create,
NULL, .data_complete = sprite_convert,
sprite_convert, .destroy = sprite_destroy,
NULL, .redraw = sprite_redraw,
sprite_destroy, .clone = sprite_clone,
NULL, .type = sprite_content_type,
NULL, .no_share = false,
NULL,
sprite_redraw,
NULL,
NULL,
sprite_clone,
NULL,
sprite_content_type,
false
}; };
static const char *sprite_types[] = { static const char *sprite_types[] = {