summaryrefslogtreecommitdiff
path: root/image
diff options
context:
space:
mode:
Diffstat (limited to 'image')
-rw-r--r--image/bmp.c11
-rw-r--r--image/bmp.h12
-rw-r--r--image/gif.c5
-rw-r--r--image/gif.h13
-rw-r--r--image/ico.c5
-rw-r--r--image/ico.h15
-rw-r--r--image/image.c61
-rw-r--r--image/image.h1
-rw-r--r--image/jpeg.c5
-rw-r--r--image/jpeg.h14
-rw-r--r--image/mng.c5
-rw-r--r--image/mng.h17
-rw-r--r--image/nssprite.c5
-rw-r--r--image/nssprite.h12
-rw-r--r--image/png.c6
-rw-r--r--image/png.h15
-rw-r--r--image/rsvg.c8
-rw-r--r--image/rsvg.h14
-rw-r--r--image/svg.c5
-rw-r--r--image/svg.h15
-rw-r--r--image/webp.c4
-rw-r--r--image/webp.h14
22 files changed, 69 insertions, 193 deletions
diff --git a/image/bmp.c b/image/bmp.c
index fb62da89f..1a4152649 100644
--- a/image/bmp.c
+++ b/image/bmp.c
@@ -21,25 +21,24 @@
* Content for image/bmp (implementation)
*/
-#include "utils/config.h"
-#ifdef WITH_BMP
-
#include <assert.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <libnsbmp.h>
+
#include "utils/config.h"
#include "content/content_protected.h"
#include "content/hlcache.h"
#include "desktop/plotters.h"
-#include "image/bitmap.h"
-#include "image/bmp.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/talloc.h"
#include "utils/utils.h"
+#include "image/bitmap.h"
+#include "image/bmp.h"
+
typedef struct nsbmp_content {
struct content base;
@@ -275,5 +274,3 @@ static const char *nsbmp_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nsbmp, nsbmp_types, nsbmp_content_handler);
-
-#endif
diff --git a/image/bmp.h b/image/bmp.h
index 885b94344..bdd8ffa5f 100644
--- a/image/bmp.h
+++ b/image/bmp.h
@@ -24,11 +24,8 @@
#ifndef _NETSURF_IMAGE_BMP_H_
#define _NETSURF_IMAGE_BMP_H_
-#include "utils/config.h"
-#ifdef WITH_BMP
-
-#include <stdbool.h>
#include <libnsbmp.h>
+
#include "image/bitmap.h"
extern bmp_bitmap_callback_vt bmp_bitmap_callbacks; /** Only to be used by ICO code. */
@@ -36,11 +33,4 @@ extern bmp_bitmap_callback_vt bmp_bitmap_callbacks; /** Only to be used by ICO c
nserror nsbmp_init(void);
void nsbmp_fini(void);
-#else
-
-#define nsbmp_init() NSERROR_OK
-#define nsbmp_fini() ((void) 0)
-
-#endif /* WITH_BMP */
-
#endif
diff --git a/image/gif.c b/image/gif.c
index 214a7bcff..74d09f13d 100644
--- a/image/gif.c
+++ b/image/gif.c
@@ -28,9 +28,6 @@
* [rjw] - Sun 4th April 2004
*/
-#include "utils/config.h"
-#ifdef WITH_GIF
-
#include <assert.h>
#include <string.h>
#include <stdbool.h>
@@ -425,5 +422,3 @@ static const char *nsgif_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nsgif, nsgif_types, nsgif_content_handler);
-
-#endif
diff --git a/image/gif.h b/image/gif.h
index 4ed06d09e..ebf821a51 100644
--- a/image/gif.h
+++ b/image/gif.h
@@ -24,20 +24,7 @@
#ifndef _NETSURF_IMAGE_GIF_H_
#define _NETSURF_IMAGE_GIF_H_
-#include "utils/config.h"
-#ifdef WITH_GIF
-
-#include <stdbool.h>
-#include <libnsgif.h>
-
nserror nsgif_init(void);
void nsgif_fini(void);
-#else
-
-#define nsgif_init() NSERROR_OK
-#define nsgif_fini() ((void) 0)
-
-#endif /* WITH_GIF */
-
#endif
diff --git a/image/ico.c b/image/ico.c
index 9f9aeb0f1..35c59e2b4 100644
--- a/image/ico.c
+++ b/image/ico.c
@@ -20,9 +20,6 @@
* Content for image/ico (implementation)
*/
-#include "utils/config.h"
-#ifdef WITH_BMP
-
#include <assert.h>
#include <string.h>
#include <stdbool.h>
@@ -237,5 +234,3 @@ static const char *nsico_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nsico, nsico_types, nsico_content_handler);
-
-#endif
diff --git a/image/ico.h b/image/ico.h
index 5df3bca95..3b592d7b2 100644
--- a/image/ico.h
+++ b/image/ico.h
@@ -23,22 +23,7 @@
#ifndef _NETSURF_IMAGE_ICO_H_
#define _NETSURF_IMAGE_ICO_H_
-#include "utils/config.h"
-#ifdef WITH_BMP
-
-#include <stdbool.h>
-#include <libnsbmp.h>
-
-#include "utils/errors.h"
-
nserror nsico_init(void);
void nsico_fini(void);
-#else
-
-#define nsico_init() NSERROR_OK
-#define nsico_fini() ((void) 0)
-
-#endif /* WITH_BMP */
-
#endif
diff --git a/image/image.c b/image/image.c
index 8ef96eeba..779826a17 100644
--- a/image/image.c
+++ b/image/image.c
@@ -16,8 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "image/image.h"
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include "utils/errors.h"
+#include "image/image.h"
#include "image/bmp.h"
#include "image/gif.h"
#include "image/ico.h"
@@ -29,6 +34,8 @@
#include "image/svg.h"
#include "image/webp.h"
+#include "utils/config.h"
+
/**
* Initialise image content handlers
*
@@ -38,49 +45,70 @@ nserror image_init(void)
{
nserror error;
+#ifdef WITH_BMP
error = nsbmp_init();
if (error != NSERROR_OK)
return error;
+#endif
+#ifdef WITH_GIF
error = nsgif_init();
if (error != NSERROR_OK)
return error;
+#endif
+#ifdef WITH_BMP
error = nsico_init();
if (error != NSERROR_OK)
return error;
+#endif
+#ifdef WITH_JPEG
error = nsjpeg_init();
if (error != NSERROR_OK)
return error;
+#endif
+#ifdef WITH_MNG
error = nsmng_init();
if (error != NSERROR_OK)
return error;
- /* Prefer libpng over libmng for pngs by registering later */
error = nsjpng_init();
if (error != NSERROR_OK)
return error;
+#endif
+
+#ifdef WITH_PNG
+ /* Prefer libpng over libmng for pngs by registering later */
error = nspng_init();
if (error != NSERROR_OK)
return error;
+#endif
+#ifdef WITH_NSSPRITE
error = nssprite_init();
if (error != NSERROR_OK)
return error;
+#endif
/* Prefer rsvg over libsvgtiny for svgs */
+#ifdef WITH_NS_SVG
error = svg_init();
if (error != NSERROR_OK)
return error;
+#endif
+#ifdef WITH_RSVG
error = nsrsvg_init();
if (error != NSERROR_OK)
return error;
+#endif
+#ifdef WITH_WEBP
error = webp_init();
if (error != NSERROR_OK)
return error;
+#endif /* WITH_WEBP */
return NSERROR_OK;
}
@@ -90,16 +118,45 @@ nserror image_init(void)
*/
void image_fini(void)
{
+#ifdef WITH_BMP
nsbmp_fini();
+#endif
+
+#ifdef WITH_GIF
nsgif_fini();
+#endif
+
+#ifdef WITH_BMP
nsico_fini();
+#endif
+
+#ifdef WITH_JPEG
nsjpeg_fini();
+#endif
+
+#ifdef WITH_MNG
nsmng_fini();
nsjpng_fini();
+#endif
+
+#ifdef WITH_NSSPRITE
nssprite_fini();
+#endif
+
+#ifdef WITH_PNG
nspng_fini();
+#endif
+
+#ifdef WITH_RSVG
nsrsvg_fini();
+#endif
+
+#ifdef WITH_NS_SVG
svg_fini();
+#endif
+
+#ifdef WITH_WEBP
webp_fini();
+#endif
}
diff --git a/image/image.h b/image/image.h
index 6c2163121..44ea148a8 100644
--- a/image/image.h
+++ b/image/image.h
@@ -28,5 +28,4 @@
nserror image_init(void);
void image_fini(void);
-
#endif
diff --git a/image/jpeg.c b/image/jpeg.c
index 622e2c5db..f2fb314af 100644
--- a/image/jpeg.c
+++ b/image/jpeg.c
@@ -23,9 +23,6 @@
* This implementation uses the IJG JPEG library.
*/
-#include "utils/config.h"
-#ifdef WITH_JPEG
-
#include <assert.h>
#include <setjmp.h>
#include <string.h>
@@ -357,5 +354,3 @@ static const char *nsjpeg_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nsjpeg, nsjpeg_types, nsjpeg_content_handler);
-
-#endif /* WITH_JPEG */
diff --git a/image/jpeg.h b/image/jpeg.h
index 57b82bdc1..163f8f286 100644
--- a/image/jpeg.h
+++ b/image/jpeg.h
@@ -23,21 +23,7 @@
#ifndef _NETSURF_IMAGE_JPEG_H_
#define _NETSURF_IMAGE_JPEG_H_
-#include "utils/config.h"
-#ifdef WITH_JPEG
-
-#include <stdbool.h>
-
-#include "utils/errors.h"
-
nserror nsjpeg_init(void);
void nsjpeg_fini(void);
-#else
-
-#define nsjpeg_init() NSERROR_OK
-#define nsjpeg_fini() ((void) 0)
-
-#endif /* WITH_JPEG */
-
#endif
diff --git a/image/mng.c b/image/mng.c
index 44b62f203..eb4344bf8 100644
--- a/image/mng.c
+++ b/image/mng.c
@@ -20,9 +20,6 @@
* Content for image/mng, image/png, and image/jng (implementation).
*/
-#include "utils/config.h"
-#ifdef WITH_MNG
-
#include <assert.h>
#include <stdbool.h>
#include <string.h>
@@ -811,5 +808,3 @@ static const char *nsjpng_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nsjpng, nsjpng_types, nsjpng_content_handler);
-
-#endif
diff --git a/image/mng.h b/image/mng.h
index 458150644..69c88f362 100644
--- a/image/mng.h
+++ b/image/mng.h
@@ -23,23 +23,10 @@
#ifndef _NETSURF_IMAGE_MNG_H_
#define _NETSURF_IMAGE_MNG_H_
-#include "utils/config.h"
-#ifdef WITH_MNG
-
-#include <stdbool.h>
-
nserror nsmng_init(void);
-void nsmng_fini(void);
nserror nsjpng_init(void);
-void nsjpng_fini(void);
-#else
-
-#define nsmng_init() NSERROR_OK
-#define nsmng_fini() ((void) 0)
-#define nsjpng_init() NSERROR_OK
-#define nsjpng_fini() ((void) 0)
-
-#endif /* WITH_MNG */
+void nsmng_fini(void);
+void nsjpng_fini(void);
#endif
diff --git a/image/nssprite.c b/image/nssprite.c
index b8dd649a6..e64ef7d39 100644
--- a/image/nssprite.c
+++ b/image/nssprite.c
@@ -21,9 +21,6 @@
*
*/
-#include "utils/config.h"
-#ifdef WITH_NSSPRITE
-
#include <assert.h>
#include <string.h>
#include <stdlib.h>
@@ -240,5 +237,3 @@ static const char *nssprite_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nssprite, nssprite_types, nssprite_content_handler);
-
-#endif
diff --git a/image/nssprite.h b/image/nssprite.h
index 1f25896b3..daa31480b 100644
--- a/image/nssprite.h
+++ b/image/nssprite.h
@@ -23,19 +23,7 @@
#ifndef _NETSURF_NS_SPRITE_H_
#define _NETSURF_NS_SPRITE_H_
-#include "utils/config.h"
-#ifdef WITH_NSSPRITE
-
-#include <stdbool.h>
-
nserror nssprite_init(void);
void nssprite_fini(void);
-#else
-
-#define nssprite_init() NSERROR_OK
-#define nssprite_fini() ((void) 0)
-
-#endif /* WITH_NSSPRITE */
-
#endif
diff --git a/image/png.c b/image/png.c
index f88b8fcfc..4f1d18720 100644
--- a/image/png.c
+++ b/image/png.c
@@ -25,8 +25,6 @@
#include <png.h>
-#include "utils/config.h"
-
#include "desktop/plotters.h"
#include "content/content_protected.h"
@@ -39,8 +37,6 @@
#include "utils/talloc.h"
#include "utils/utils.h"
-#ifdef WITH_PNG
-
/* accommodate for old versions of libpng (beware security holes!) */
#ifndef png_jmpbuf
@@ -438,5 +434,3 @@ static const char *nspng_types[] = {
};
CONTENT_FACTORY_REGISTER_TYPES(nspng, nspng_types, nspng_content_handler);
-
-#endif
diff --git a/image/png.h b/image/png.h
index 1119b6a43..c14521ae8 100644
--- a/image/png.h
+++ b/image/png.h
@@ -20,22 +20,7 @@
#ifndef _NETSURF_RISCOS_PNG_H_
#define _NETSURF_RISCOS_PNG_H_
-#include "utils/config.h"
-
-#ifdef WITH_PNG
-
-#include <stdbool.h>
-
-#include "utils/errors.h"
-
nserror nspng_init(void);
void nspng_fini(void);
-#else
-
-#define nspng_init() NSERROR_OK
-#define nspng_fini() ((void) 0)
-
-#endif
-
#endif
diff --git a/image/rsvg.c b/image/rsvg.c
index 678cd862d..c322773c8 100644
--- a/image/rsvg.c
+++ b/image/rsvg.c
@@ -27,9 +27,6 @@
* function to render it for redraw requests.
*/
-#include "utils/config.h"
-#ifdef WITH_RSVG
-
#include <stdbool.h>
#include <assert.h>
#include <string.h>
@@ -38,7 +35,6 @@
#include <librsvg/rsvg.h>
#include <librsvg/rsvg-cairo.h>
-#include "image/rsvg.h"
#include "content/content_protected.h"
#include "desktop/plotters.h"
#include "image/bitmap.h"
@@ -47,6 +43,8 @@
#include "utils/messages.h"
#include "utils/talloc.h"
+#include "image/rsvg.h"
+
typedef struct rsvg_content {
struct content base;
@@ -315,5 +313,3 @@ static const char *rsvg_types[] = {
CONTENT_FACTORY_REGISTER_TYPES(nsrsvg, rsvg_types, rsvg_content_handler);
-
-#endif /* WITH_RSVG */
diff --git a/image/rsvg.h b/image/rsvg.h
index 4d4e65fea..21e46d1b9 100644
--- a/image/rsvg.h
+++ b/image/rsvg.h
@@ -23,21 +23,7 @@
#ifndef _NETSURF_IMAGE_RSVG_H_
#define _NETSURF_IMAGE_RSVG_H_
-#include "utils/config.h"
-#ifdef WITH_RSVG
-
-#include <stdbool.h>
-
-#include "utils/errors.h"
-
nserror nsrsvg_init(void);
void nsrsvg_fini(void);
-#else
-
-#define nsrsvg_init() NSERROR_OK
-#define nsrsvg_fini() ((void) 0)
-
-#endif /* WITH_RSVG */
-
#endif
diff --git a/image/svg.c b/image/svg.c
index 3bcb2709a..43f456bd6 100644
--- a/image/svg.c
+++ b/image/svg.c
@@ -20,9 +20,6 @@
* Content for image/svg (implementation).
*/
-#include "utils/config.h"
-#ifdef WITH_NS_SVG
-
#include <assert.h>
#include <string.h>
@@ -346,4 +343,4 @@ static const char *svg_types[] = {
CONTENT_FACTORY_REGISTER_TYPES(svg, svg_types, svg_content_handler);
-#endif /* WITH_NS_SVG */
+
diff --git a/image/svg.h b/image/svg.h
index 0e8ad8559..149a3c85f 100644
--- a/image/svg.h
+++ b/image/svg.h
@@ -23,22 +23,7 @@
#ifndef _NETSURF_IMAGE_SVG_H_
#define _NETSURF_IMAGE_SVG_H_
-#include "utils/config.h"
-
-#ifdef WITH_NS_SVG
-
-#include <stdbool.h>
-
-#include "utils/errors.h"
-
nserror svg_init(void);
void svg_fini(void);
-#else
-
-#define svg_init() NSERROR_OK
-#define svg_fini() ((void) 0)
-
-#endif
-
#endif
diff --git a/image/webp.c b/image/webp.c
index 90c7121ac..25a026271 100644
--- a/image/webp.c
+++ b/image/webp.c
@@ -21,9 +21,6 @@
*
*/
-#include "utils/config.h"
-#ifdef WITH_WEBP
-
#include <assert.h>
#include <string.h>
#include <stdlib.h>
@@ -211,4 +208,3 @@ static const char *webp_types[] = {
CONTENT_FACTORY_REGISTER_TYPES(webp, webp_types, webp_content_handler);
-#endif
diff --git a/image/webp.h b/image/webp.h
index 3d976d13e..cfc869fb2 100644
--- a/image/webp.h
+++ b/image/webp.h
@@ -23,21 +23,7 @@
#ifndef _NETSURF_WEBP_H_
#define _NETSURF_WEBP_H_
-#include "utils/config.h"
-#ifdef WITH_WEBP
-
-#include <stdbool.h>
-
-#include "utils/errors.h"
-
nserror webp_init(void);
void webp_fini(void);
-#else
-
-#define webp_init() NSERROR_OK
-#define webp_fini() ((void) 0)
-
-#endif /* WITH_WEBP */
-
#endif