From 358f20f4cd38821bed2ad6443fc77d8a7bc73332 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 25 Aug 2006 22:46:38 +0000 Subject: Make fetch_mimetype consider our internal mapping table svn path=/trunk/netsurf/; revision=2894 --- riscos/filetype.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'riscos') diff --git a/riscos/filetype.c b/riscos/filetype.c index 4c19c0d41..3144d3d5a 100644 --- a/riscos/filetype.c +++ b/riscos/filetype.c @@ -152,6 +152,7 @@ char *fetch_mimetype(const char *ro_path) int objtype; char *mime = calloc(BUF_SIZE, sizeof(char)); char *slash; + struct type_entry *t; if (!mime) { LOG(("Insufficient memory for calloc")); @@ -193,6 +194,16 @@ char *fetch_mimetype(const char *ro_path) filetype = load; } + /* search for MIME type in our internal table */ + t = bsearch(&filetype, type_map, TYPE_MAP_COUNT, + sizeof(type_map[0]), cmp_type); + if (t) { + /* found, so return it */ + strncpy(mime, t->mime_type, BUF_SIZE); + return mime; + } + + /* not in internal table, so ask MimeMap */ e = xmimemaptranslate_filetype_to_mime_type(filetype, mime); if (e) { LOG(("xmimemaptranslate_filetype_to_mime_type: 0x%x: %s", -- cgit v1.2.3