From 392307bb1fdf4186f26300631fe3710d895cf7ce Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 18 Apr 2016 23:04:16 +0100 Subject: [PATCH] reduce content header interdependancy --- content/content.c | 3 ++- content/content.h | 20 +++---------------- content/content_debug.h | 38 +++++++++++++++++++++++++++++++++++++ content/content_factory.c | 2 ++ content/content_protected.h | 14 +++++++++----- desktop/browser.c | 1 + desktop/gui_factory.c | 1 + desktop/searchweb.c | 3 +++ gtk/bitmap.c | 1 + image/jpeg.c | 2 +- image/nssprite.c | 2 +- image/png.c | 2 +- image/svg.c | 2 +- javascript/content.c | 2 +- 14 files changed, 65 insertions(+), 28 deletions(-) create mode 100644 content/content_debug.h diff --git a/content/content.c b/content/content.c index d20695613..b0d86b94c 100644 --- a/content/content.c +++ b/content/content.c @@ -32,6 +32,7 @@ #include "image/bitmap.h" #include "content/content_protected.h" +#include "content/content_debug.h" #include "content/hlcache.h" #define URL_FMT_SPC "%.140s" @@ -62,7 +63,7 @@ static void content_convert(struct content *c); */ nserror content__init(struct content *c, const content_handler *handler, - lwc_string *imime_type, const http_parameter *params, + lwc_string *imime_type, const struct http_parameter *params, llcache_handle *llcache, const char *fallback_charset, bool quirks) { diff --git a/content/content.h b/content/content.h index 6c05df9c5..cdd7283cc 100644 --- a/content/content.h +++ b/content/content.h @@ -26,19 +26,14 @@ #ifndef _NETSURF_CONTENT_CONTENT_H_ #define _NETSURF_CONTENT_CONTENT_H_ -#include -#include - #include -#include "utils/config.h" #include "utils/errors.h" -#include "utils/http.h" #include "content/content_factory.h" #include "content/content_type.h" -#include "desktop/search.h" -#include "desktop/mouse.h" -#include "desktop/plot_style.h" +#include "desktop/search.h" /* search flags enum */ +#include "desktop/mouse.h" /* mouse state enums */ +#include "desktop/plot_style.h" /* color typedef */ struct browser_window; struct browser_window_features; @@ -317,15 +312,6 @@ void content_search(struct hlcache_handle *h, void *context, search_flags_t flags, const char *string); void content_search_clear(struct hlcache_handle *h); -/** - * Dump debug information to file. - * - * \param h content handle to debug. - * \param f File to write output to. - * \param op Debug operation type. - */ -nserror content_debug_dump(struct hlcache_handle *h, FILE *f, enum content_debug op); - /** * Control debug con a content. * diff --git a/content/content_debug.h b/content/content_debug.h new file mode 100644 index 000000000..b08f730b8 --- /dev/null +++ b/content/content_debug.h @@ -0,0 +1,38 @@ +/* + * Copyright 2016 Vincent Sanders + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file + * Interface to content handling debug. + */ + +#ifndef _NETSURF_CONTENT_CONTENT_DEBUG_H_ +#define _NETSURF_CONTENT_CONTENT_DEBUG_H_ + +#include + +/** + * Dump debug information to file. + * + * \param h content handle to debug. + * \param f File to write output to. + * \param op Debug operation type. + */ +nserror content_debug_dump(struct hlcache_handle *h, FILE *f, enum content_debug op); + +#endif diff --git a/content/content_factory.c b/content/content_factory.c index 8da73337c..224220796 100644 --- a/content/content_factory.c +++ b/content/content_factory.c @@ -24,6 +24,8 @@ #include #include +#include "utils/http.h" + #include "content/content.h" #include "content/content_factory.h" #include "content/content_protected.h" diff --git a/content/content_protected.h b/content/content_protected.h index e5ff1cae2..e901e40df 100644 --- a/content/content_protected.h +++ b/content/content_protected.h @@ -28,6 +28,8 @@ #include #include +#include + #include "utils/config.h" #include "content/content.h" #include "content/content_factory.h" @@ -38,15 +40,17 @@ struct bitmap; struct content; struct rect; struct redraw_context; +struct http_parameter; struct content_handler { void (*fini)(void); nserror (*create)(const content_handler *handler, - lwc_string *imime_type, const http_parameter *params, - llcache_handle *llcache, - const char *fallback_charset, bool quirks, - struct content **c); + lwc_string *imime_type, + const struct http_parameter *params, + llcache_handle *llcache, + const char *fallback_charset, bool quirks, + struct content **c); bool (*process_data)(struct content *c, const char *data, unsigned int size); @@ -157,7 +161,7 @@ extern const char * const content_type_name[]; extern const char * const content_status_name[]; nserror content__init(struct content *c, const content_handler *handler, - lwc_string *imime_type, const http_parameter *params, + lwc_string *imime_type, const struct http_parameter *params, struct llcache_handle *llcache, const char *fallback_charset, bool quirks); nserror content__clone(const struct content *c, struct content *nc); diff --git a/desktop/browser.c b/desktop/browser.c index 48f69eaae..14fdb565d 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -47,6 +47,7 @@ #include "utils/utf8.h" #include "utils/nsoption.h" #include "content/content.h" +#include "content/content_debug.h" #include "content/fetch.h" #include "content/hlcache.h" #include "content/urldb.h" diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c index 3150d756c..0b168f405 100644 --- a/desktop/gui_factory.c +++ b/desktop/gui_factory.c @@ -20,6 +20,7 @@ #include #include +#include "utils/config.h" #include "utils/errors.h" #include "utils/file.h" #include "image/bitmap.h" diff --git a/desktop/searchweb.c b/desktop/searchweb.c index 4033f8ef0..83a19c31e 100644 --- a/desktop/searchweb.c +++ b/desktop/searchweb.c @@ -21,6 +21,9 @@ * \brief core web search facilities implementation. */ +#include + +#include "utils/utils.h" #include "utils/log.h" #include "utils/url.h" #include "utils/nsoption.h" diff --git a/gtk/bitmap.c b/gtk/bitmap.c index fa86ff178..3c5b1742c 100644 --- a/gtk/bitmap.c +++ b/gtk/bitmap.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/image/jpeg.c b/image/jpeg.c index 8e6ac8528..a9030be1e 100644 --- a/image/jpeg.c +++ b/image/jpeg.c @@ -61,7 +61,7 @@ static unsigned char nsjpeg_eoi[] = { 0xff, JPEG_EOI }; * Content create entry point. */ static nserror nsjpeg_create(const content_handler *handler, - lwc_string *imime_type, const http_parameter *params, + lwc_string *imime_type, const struct http_parameter *params, llcache_handle *llcache, const char *fallback_charset, bool quirks, struct content **c) { diff --git a/image/nssprite.c b/image/nssprite.c index c0c6ff1b9..e61566391 100644 --- a/image/nssprite.c +++ b/image/nssprite.c @@ -60,7 +60,7 @@ typedef struct nssprite_content { static nserror nssprite_create(const content_handler *handler, - lwc_string *imime_type, const http_parameter *params, + lwc_string *imime_type, const struct http_parameter *params, llcache_handle *llcache, const char *fallback_charset, bool quirks, struct content **c) { diff --git a/image/png.c b/image/png.c index 934252b7a..dfeac89e0 100644 --- a/image/png.c +++ b/image/png.c @@ -279,7 +279,7 @@ static nserror nspng_create_png_data(nspng_content *png_c) } static nserror nspng_create(const content_handler *handler, - lwc_string *imime_type, const http_parameter *params, + lwc_string *imime_type, const struct http_parameter *params, llcache_handle *llcache, const char *fallback_charset, bool quirks, struct content **c) { diff --git a/image/svg.c b/image/svg.c index 0bffbe836..63cdb3bf8 100644 --- a/image/svg.c +++ b/image/svg.c @@ -70,7 +70,7 @@ no_memory: */ static nserror svg_create(const content_handler *handler, - lwc_string *imime_type, const http_parameter *params, + lwc_string *imime_type, const struct http_parameter *params, llcache_handle *llcache, const char *fallback_charset, bool quirks, struct content **c) { diff --git a/javascript/content.c b/javascript/content.c index ef1bedc8e..ef5614094 100644 --- a/javascript/content.c +++ b/javascript/content.c @@ -38,7 +38,7 @@ typedef struct javascript_content { } javascript_content; static nserror javascript_create(const content_handler *handler, - lwc_string *imime_type, const http_parameter *params, + lwc_string *imime_type, const struct http_parameter *params, llcache_handle *llcache, const char *fallback_charset, bool quirks, struct content **c) {