summaryrefslogtreecommitdiff
path: root/riscos/filetype.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2006-08-25 22:46:38 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2006-08-25 22:46:38 +0000
commit358f20f4cd38821bed2ad6443fc77d8a7bc73332 (patch)
tree03d68e883ae12802157cdbde8a48839ff810edf7 /riscos/filetype.c
parent978637a134d19c3b05914d9b2005115347f805b4 (diff)
downloadnetsurf-358f20f4cd38821bed2ad6443fc77d8a7bc73332.tar.gz
netsurf-358f20f4cd38821bed2ad6443fc77d8a7bc73332.tar.bz2
Make fetch_mimetype consider our internal mapping table
svn path=/trunk/netsurf/; revision=2894
Diffstat (limited to 'riscos/filetype.c')
-rw-r--r--riscos/filetype.c11
1 files changed, 11 insertions, 0 deletions
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",