From 5b0ad574b68b21ceef4ea167163c0a10d1d13d71 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 21 Jan 2010 23:48:34 +0000 Subject: Fix compilation when BMP/PNG/GIF support is disabled. svn path=/trunk/netsurf/; revision=9858 --- render/favicon.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'render') diff --git a/render/favicon.c b/render/favicon.c index bc64f0a9e..4b9d381a6 100644 --- a/render/favicon.c +++ b/render/favicon.c @@ -166,14 +166,31 @@ bool favicon_get_icon(struct content *c, xmlNode *html) void favicon_callback(content_msg msg, struct content *icon, intptr_t p1, intptr_t p2, union content_msg_data data) { + static const content_type permitted_types[] = { +#ifdef WITH_BMP + CONTENT_ICO, +#endif +#if defined(WITH_MNG) || defined(WITH_PNG) + CONTENT_PNG, +#endif +#ifdef WITH_GIF + CONTENT_GIF, +#endif + CONTENT_UNKNOWN + }; struct content *c = (struct content *) p1; unsigned int i = p2; + const content_type *type; + + switch (msg) { case CONTENT_MSG_LOADING: /* check that the favicon is really a correct image type */ - if (!((icon->type == CONTENT_ICO) || - (icon->type == CONTENT_PNG) || - (icon->type == CONTENT_GIF))) { + for (type = permitted_types; *type != CONTENT_UNKNOWN; type++) + if (icon->type == *type) + break; + + if (*type != CONTENT_UNKNOWN) { c->data.html.favicon = 0; LOG(("%s is not a favicon", icon->url)); content_add_error(c, "NotFavIco", 0); -- cgit v1.2.3