summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorJohn-Mark Bell <jmb@netsurf-browser.org>2013-01-13 17:54:11 +0000
committerJohn-Mark Bell <jmb@netsurf-browser.org>2013-01-13 17:54:11 +0000
commit6e09ff691bbba9aa5bd68e0f1d9f66a709149599 (patch)
tree6ff1307f6beba547ee4b4e6b61c5ad129b374d15 /riscos
parent8e66adaade55a6ca82a6e8a97e52312adafe38ce (diff)
downloadnetsurf-6e09ff691bbba9aa5bd68e0f1d9f66a709149599.tar.gz
netsurf-6e09ff691bbba9aa5bd68e0f1d9f66a709149599.tar.bz2
Consult internal mimemap before consulting MimeMap module.
Diffstat (limited to 'riscos')
-rw-r--r--riscos/filetype.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/riscos/filetype.c b/riscos/filetype.c
index ec15b3655..529f867ab 100644
--- a/riscos/filetype.c
+++ b/riscos/filetype.c
@@ -305,9 +305,21 @@ int ro_content_native_type(hlcache_handle *c)
*/
int ro_content_filetype_from_mime_type(lwc_string *mime_type)
{
- int file_type;
+ int file_type, index;
os_error *error;
+ /* Search internal type map */
+ for (index = TYPE_MAP_COUNT; index > 0; index--) {
+ const struct type_entry *e = &type_map[index - 1];
+
+ if (strlen(e->mime_type) == lwc_string_length(mime_type) &&
+ strncasecmp(e->mime_type,
+ lwc_string_data(mime_type),
+ lwc_string_length(mime_type)) == 0)
+ return e->file_type;
+ }
+
+ /* Ask MimeMap module */
error = xmimemaptranslate_mime_type_to_filetype(
lwc_string_data(mime_type), (bits *) &file_type);
if (error)