summaryrefslogtreecommitdiff
path: root/render/favicon.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2010-04-04 17:17:24 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2010-04-04 17:17:24 +0000
commit69f02e926f746b31500f46572d606fdc482ff0cb (patch)
tree438e52c0db585579cb75afcb0e3d59c9a777b4cb /render/favicon.c
parent487d4c3ae384fafded41ee0b4203bd82f5268b57 (diff)
downloadnetsurf-69f02e926f746b31500f46572d606fdc482ff0cb.tar.gz
netsurf-69f02e926f746b31500f46572d606fdc482ff0cb.tar.bz2
Make the high-level cache drop contents of unacceptable type on the floor.
svn path=/trunk/netsurf/; revision=10238
Diffstat (limited to 'render/favicon.c')
-rw-r--r--render/favicon.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/render/favicon.c b/render/favicon.c
index 06ff0b94f..d1eaaacdd 100644
--- a/render/favicon.c
+++ b/render/favicon.c
@@ -148,6 +148,18 @@ char *favicon_get_icon_ref(struct content *c, xmlNode *html)
bool favicon_get_icon(struct content *c, xmlNode *html)
{
+ 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
+ };
char *url;
nserror error;
@@ -157,7 +169,7 @@ bool favicon_get_icon(struct content *c, xmlNode *html)
error = hlcache_handle_retrieve(url, LLCACHE_RETRIEVE_NO_ERROR_PAGES,
content__get_url(c), NULL, favicon_callback, c, NULL,
- &c->data.html.favicon);
+ permitted_types, &c->data.html.favicon);
free(url);
@@ -171,29 +183,12 @@ bool favicon_get_icon(struct content *c, xmlNode *html)
nserror favicon_callback(hlcache_handle *icon,
const hlcache_event *event, void *pw)
{
- 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 = pw;
- const content_type *type;
switch (event->type) {
case CONTENT_MSG_LOADING:
/* check that the favicon is really a correct image type */
- for (type = permitted_types; *type != CONTENT_UNKNOWN; type++)
- if (content_get_type(icon) == *type)
- break;
-
- if (*type == CONTENT_UNKNOWN) {
+ if (content_get_type(icon) == CONTENT_UNKNOWN) {
union content_msg_data msg_data;
LOG(("%s is not a favicon", content_get_url(icon)));