mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 12:12:35 +03:00
refactor content handler initilisation to use named initialisors
svn path=/trunk/netsurf/; revision=12341
This commit is contained in:
parent
0929aa897b
commit
83f9e707eb
@ -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 const content_handler amiga_dt_picture_content_handler = {
|
||||
amiga_dt_picture_create,
|
||||
NULL,
|
||||
amiga_dt_picture_convert,
|
||||
NULL,
|
||||
amiga_dt_picture_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
amiga_dt_picture_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
amiga_dt_picture_clone,
|
||||
NULL,
|
||||
amiga_dt_picture_content_type,
|
||||
false
|
||||
.create = amiga_dt_picture_create,
|
||||
.data_complete = amiga_dt_picture_convert,
|
||||
.destroy = amiga_dt_picture_destroy,
|
||||
.redraw = amiga_dt_picture_redraw,
|
||||
.clone = amiga_dt_picture_clone,
|
||||
.type = amiga_dt_picture_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
nserror amiga_dt_picture_init_from_mime(void)
|
||||
|
22
amiga/icon.c
22
amiga/icon.c
@ -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 const content_handler amiga_icon_content_handler = {
|
||||
amiga_icon_create,
|
||||
NULL,
|
||||
amiga_icon_convert,
|
||||
NULL,
|
||||
amiga_icon_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
amiga_icon_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
amiga_icon_clone,
|
||||
NULL,
|
||||
amiga_icon_content_type,
|
||||
false
|
||||
.create = amiga_icon_create,
|
||||
.data_complete = amiga_icon_convert,
|
||||
.destroy = amiga_icon_destroy,
|
||||
.redraw = amiga_icon_redraw,
|
||||
.clone = amiga_icon_clone,
|
||||
.type = amiga_icon_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
static const char *amiga_icon_types[] = {
|
||||
|
@ -278,9 +278,9 @@ void content_convert(struct content *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;
|
||||
if (c->handler->convert(c) == false) {
|
||||
if (c->handler->data_complete(c) == false) {
|
||||
c->locked = false;
|
||||
c->status = CONTENT_STATUS_ERROR;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ struct content_handler {
|
||||
|
||||
bool (*process_data)(struct content *c,
|
||||
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 (*destroy)(struct content *c);
|
||||
void (*stop)(struct content *c);
|
||||
|
23
css/css.c
23
css/css.c
@ -79,21 +79,14 @@ static css_error nscss_register_import(struct content_css_data *c,
|
||||
const hlcache_handle *import);
|
||||
|
||||
static const content_handler css_content_handler = {
|
||||
nscss_create,
|
||||
nscss_process_data,
|
||||
nscss_convert,
|
||||
NULL,
|
||||
nscss_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nscss_clone,
|
||||
nscss_matches_quirks,
|
||||
nscss_content_type,
|
||||
false
|
||||
.create = nscss_create,
|
||||
.process_data = nscss_process_data,
|
||||
.data_complete = nscss_convert,
|
||||
.destroy = nscss_destroy,
|
||||
.clone = nscss_clone,
|
||||
.matches_quirks = nscss_matches_quirks,
|
||||
.type = nscss_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
static lwc_string *css_mime_type;
|
||||
|
22
image/bmp.c
22
image/bmp.c
@ -272,21 +272,13 @@ static content_type nsbmp_content_type(lwc_string *mime_type)
|
||||
|
||||
|
||||
static const content_handler nsbmp_content_handler = {
|
||||
nsbmp_create,
|
||||
NULL,
|
||||
nsbmp_convert,
|
||||
NULL,
|
||||
nsbmp_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nsbmp_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
nsbmp_clone,
|
||||
NULL,
|
||||
nsbmp_content_type,
|
||||
false
|
||||
.create = nsbmp_create,
|
||||
.data_complete = nsbmp_convert,
|
||||
.destroy = nsbmp_destroy,
|
||||
.redraw = nsbmp_redraw,
|
||||
.clone = nsbmp_clone,
|
||||
.type = nsbmp_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
nserror nsbmp_init(void)
|
||||
|
22
image/gif.c
22
image/gif.c
@ -418,21 +418,13 @@ static content_type nsgif_content_type(lwc_string *mime_type)
|
||||
|
||||
|
||||
static const content_handler nsgif_content_handler = {
|
||||
nsgif_create,
|
||||
NULL,
|
||||
nsgif_convert,
|
||||
NULL,
|
||||
nsgif_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nsgif_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
nsgif_clone,
|
||||
NULL,
|
||||
nsgif_content_type,
|
||||
false
|
||||
.create = nsgif_create,
|
||||
.data_complete = nsgif_convert,
|
||||
.destroy = nsgif_destroy,
|
||||
.redraw = nsgif_redraw,
|
||||
.clone = nsgif_clone,
|
||||
.type = nsgif_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
nserror nsgif_init(void)
|
||||
|
22
image/ico.c
22
image/ico.c
@ -230,21 +230,13 @@ static content_type nsico_content_type(lwc_string *mime_type)
|
||||
}
|
||||
|
||||
static const content_handler nsico_content_handler = {
|
||||
nsico_create,
|
||||
NULL,
|
||||
nsico_convert,
|
||||
NULL,
|
||||
nsico_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nsico_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
nsico_clone,
|
||||
NULL,
|
||||
nsico_content_type,
|
||||
false
|
||||
.create = nsico_create,
|
||||
.data_complete = nsico_convert,
|
||||
.destroy = nsico_destroy,
|
||||
.redraw = nsico_redraw,
|
||||
.clone = nsico_clone,
|
||||
.type = nsico_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
|
||||
|
22
image/jpeg.c
22
image/jpeg.c
@ -335,21 +335,13 @@ static content_type nsjpeg_content_type(lwc_string *mime_type)
|
||||
}
|
||||
|
||||
static const content_handler nsjpeg_content_handler = {
|
||||
nsjpeg_create,
|
||||
NULL,
|
||||
nsjpeg_convert,
|
||||
NULL,
|
||||
nsjpeg_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nsjpeg_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
nsjpeg_clone,
|
||||
NULL,
|
||||
nsjpeg_content_type,
|
||||
false
|
||||
.create = nsjpeg_create,
|
||||
.data_complete = nsjpeg_convert,
|
||||
.destroy = nsjpeg_destroy,
|
||||
.redraw = nsjpeg_redraw,
|
||||
.clone = nsjpeg_clone,
|
||||
.type = nsjpeg_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
nserror nsjpeg_init(void)
|
||||
|
23
image/mng.c
23
image/mng.c
@ -96,21 +96,14 @@ static void nsmng_free(mng_ptr p, mng_size_t n);
|
||||
#endif
|
||||
|
||||
static const content_handler nsmng_content_handler = {
|
||||
nsmng_create,
|
||||
nsmng_process_data,
|
||||
nsmng_convert,
|
||||
NULL,
|
||||
nsmng_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nsmng_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
nsmng_clone,
|
||||
NULL,
|
||||
nsmng_content_type,
|
||||
false
|
||||
.create = nsmng_create,
|
||||
.process_data = nsmng_process_data,
|
||||
.data_complete = nsmng_convert,
|
||||
.destroy = nsmng_destroy,
|
||||
.redraw = nsmng_redraw,
|
||||
.clone = nsmng_clone,
|
||||
.type = nsmng_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
static const char *jng_types[] = {
|
||||
|
@ -72,21 +72,13 @@ static content_type nssprite_content_type(lwc_string *mime_type);
|
||||
} while(0)
|
||||
|
||||
static const content_handler nssprite_content_handler = {
|
||||
nssprite_create,
|
||||
NULL,
|
||||
nssprite_convert,
|
||||
NULL,
|
||||
nssprite_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nssprite_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
nssprite_clone,
|
||||
NULL,
|
||||
nssprite_content_type,
|
||||
false
|
||||
.create = nssprite_create,
|
||||
.data_complete = nssprite_convert,
|
||||
.destroy = nssprite_destroy,
|
||||
.redraw = nssprite_redraw,
|
||||
.clone = nssprite_clone,
|
||||
.type = nssprite_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
static const char *nssprite_types[] = {
|
||||
|
23
image/png.c
23
image/png.c
@ -413,21 +413,14 @@ static content_type nspng_content_type(lwc_string *mime_type)
|
||||
}
|
||||
|
||||
static const content_handler nspng_content_handler = {
|
||||
nspng_create,
|
||||
nspng_process_data,
|
||||
nspng_convert,
|
||||
NULL,
|
||||
nspng_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nspng_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
nspng_clone,
|
||||
NULL,
|
||||
nspng_content_type,
|
||||
false
|
||||
.create = nspng_create,
|
||||
.process_data = nspng_process_data,
|
||||
.data_complete = nspng_convert,
|
||||
.destroy = nspng_destroy,
|
||||
.redraw = nspng_redraw,
|
||||
.clone = nspng_clone,
|
||||
.type = nspng_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
nserror nspng_init(void)
|
||||
|
23
image/rsvg.c
23
image/rsvg.c
@ -310,21 +310,14 @@ static content_type rsvg_content_type(lwc_string *mime_type)
|
||||
}
|
||||
|
||||
static const content_handler rsvg_content_handler = {
|
||||
rsvg_create,
|
||||
rsvg_process_data,
|
||||
rsvg_convert,
|
||||
NULL,
|
||||
rsvg_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
rsvg_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
rsvg_clone,
|
||||
NULL,
|
||||
rsvg_content_type,
|
||||
false
|
||||
.create = rsvg_create,
|
||||
.process_data = rsvg_process_data,
|
||||
.data_complete = rsvg_convert,
|
||||
.destroy = rsvg_destroy,
|
||||
.redraw = rsvg_redraw,
|
||||
.clone = rsvg_clone,
|
||||
.type = rsvg_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
nserror nsrsvg_init(void)
|
||||
|
23
image/svg.c
23
image/svg.c
@ -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 const content_handler svg_content_handler = {
|
||||
svg_create,
|
||||
NULL,
|
||||
svg_convert,
|
||||
svg_reformat,
|
||||
svg_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
svg_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
svg_clone,
|
||||
NULL,
|
||||
svg_content_type,
|
||||
false
|
||||
.create = svg_create,
|
||||
.data_complete = svg_convert,
|
||||
.reformat = svg_reformat,
|
||||
.destroy = svg_destroy,
|
||||
.redraw = svg_redraw,
|
||||
.clone = svg_clone,
|
||||
.type = svg_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
static const char *svg_types[] = {
|
||||
|
22
image/webp.c
22
image/webp.c
@ -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 const content_handler webp_content_handler = {
|
||||
webp_create,
|
||||
NULL,
|
||||
webp_convert,
|
||||
NULL,
|
||||
webp_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
webp_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
webp_clone,
|
||||
NULL,
|
||||
webp_content_type,
|
||||
false
|
||||
.create = webp_create,
|
||||
.data_complete = webp_convert,
|
||||
.destroy = webp_destroy,
|
||||
.redraw = webp_redraw,
|
||||
.clone = webp_clone,
|
||||
.type = webp_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
static const char *webp_types[] = {
|
||||
|
@ -102,21 +102,20 @@ static void html_dump_frameset(struct content_html_frames *frame,
|
||||
#endif
|
||||
|
||||
static const content_handler html_content_handler = {
|
||||
html_create,
|
||||
html_process_data,
|
||||
html_convert,
|
||||
html_reformat,
|
||||
html_destroy,
|
||||
html_stop,
|
||||
html_mouse_track,
|
||||
html_mouse_action,
|
||||
html_redraw,
|
||||
html_open,
|
||||
html_close,
|
||||
html_clone,
|
||||
NULL,
|
||||
html_content_type,
|
||||
true
|
||||
.create = html_create,
|
||||
.process_data = html_process_data,
|
||||
.data_complete = html_convert,
|
||||
.reformat = html_reformat,
|
||||
.destroy = html_destroy,
|
||||
.stop = html_stop,
|
||||
.mouse_track = html_mouse_track,
|
||||
.mouse_action = html_mouse_action,
|
||||
.redraw = html_redraw,
|
||||
.open = html_open,
|
||||
.close = html_close,
|
||||
.clone = html_clone,
|
||||
.type = html_content_type,
|
||||
.no_share = true,
|
||||
};
|
||||
|
||||
static const char empty_document[] =
|
||||
|
@ -121,21 +121,17 @@ static int textplain_coord_from_offset(const char *text, size_t offset,
|
||||
static float textplain_line_height(void);
|
||||
|
||||
static const content_handler textplain_content_handler = {
|
||||
textplain_create,
|
||||
textplain_process_data,
|
||||
textplain_convert,
|
||||
textplain_reformat,
|
||||
textplain_destroy,
|
||||
NULL,
|
||||
textplain_mouse_track,
|
||||
textplain_mouse_action,
|
||||
textplain_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
textplain_clone,
|
||||
NULL,
|
||||
textplain_content_type,
|
||||
true
|
||||
.create = textplain_create,
|
||||
.process_data = textplain_process_data,
|
||||
.data_complete = textplain_convert,
|
||||
.reformat = textplain_reformat,
|
||||
.destroy = textplain_destroy,
|
||||
.mouse_track = textplain_mouse_track,
|
||||
.mouse_action = textplain_mouse_action,
|
||||
.redraw = textplain_redraw,
|
||||
.clone = textplain_clone,
|
||||
.type = textplain_content_type,
|
||||
.no_share = true,
|
||||
};
|
||||
|
||||
static lwc_string *textplain_mime_type;
|
||||
|
@ -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 const content_handler artworks_content_handler = {
|
||||
artworks_create,
|
||||
NULL,
|
||||
artworks_convert,
|
||||
NULL,
|
||||
artworks_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
artworks_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
artworks_clone,
|
||||
NULL,
|
||||
artworks_content_type,
|
||||
false
|
||||
.create = artworks_create,
|
||||
.data_complete = artworks_convert,
|
||||
.destroy = artworks_destroy,
|
||||
.redraw = artworks_redraw,
|
||||
.clone = artworks_clone,
|
||||
.type = artworks_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
static const char *artworks_types[] = {
|
||||
|
@ -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 const content_handler draw_content_handler = {
|
||||
draw_create,
|
||||
NULL,
|
||||
draw_convert,
|
||||
NULL,
|
||||
draw_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
draw_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
draw_clone,
|
||||
NULL,
|
||||
draw_content_type,
|
||||
false
|
||||
.create = draw_create,
|
||||
.data_complete = draw_convert,
|
||||
.destroy = draw_destroy,
|
||||
.redraw = draw_redraw,
|
||||
.clone = draw_clone,
|
||||
.type = draw_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
static const char *draw_types[] = {
|
||||
|
@ -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 const content_handler sprite_content_handler = {
|
||||
sprite_create,
|
||||
NULL,
|
||||
sprite_convert,
|
||||
NULL,
|
||||
sprite_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
sprite_redraw,
|
||||
NULL,
|
||||
NULL,
|
||||
sprite_clone,
|
||||
NULL,
|
||||
sprite_content_type,
|
||||
false
|
||||
.create = sprite_create,
|
||||
.data_complete = sprite_convert,
|
||||
.destroy = sprite_destroy,
|
||||
.redraw = sprite_redraw,
|
||||
.clone = sprite_clone,
|
||||
.type = sprite_content_type,
|
||||
.no_share = false,
|
||||
};
|
||||
|
||||
static const char *sprite_types[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user