diff options
author | Richard Wilson <rjw@netsurf-browser.org> | 2005-12-31 04:35:34 +0000 |
---|---|---|
committer | Richard Wilson <rjw@netsurf-browser.org> | 2005-12-31 04:35:34 +0000 |
commit | 28f51bfcf58fc111564524052b20dd02b3a507f1 (patch) | |
tree | 28393302345518952806d2d37f10dbd11f0d64cb | |
parent | ad82fceb2e9b54095a405138a7dc41f7ad95630c (diff) | |
download | netsurf-28f51bfcf58fc111564524052b20dd02b3a507f1.tar.gz netsurf-28f51bfcf58fc111564524052b20dd02b3a507f1.tar.bz2 |
[project @ 2005-12-31 04:35:34 by rjw]
Allow filetype to be read from the content type
svn path=/import/netsurf/; revision=1912
-rw-r--r-- | riscos/filetype.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/riscos/filetype.c b/riscos/filetype.c index 41227bed9..08228d6a5 100644 --- a/riscos/filetype.c +++ b/riscos/filetype.c @@ -211,7 +211,26 @@ int ro_content_filetype(struct content *content) int file_type; os_error *error; - switch (content->type) { + file_type = ro_content_filetype_from_type(content->type); + if (file_type != 0) + return file_type; + + error = xmimemaptranslate_mime_type_to_filetype(content->mime_type, + &file_type); + if (error) + return 0xffd; + return file_type; +} + + +/** + * Determine the RISC OS filetype from a content type. + * + * \param type The content type to examine. + * \return The RISC OS filetype corresponding to the content, or 0 for unknown + */ +int ro_content_filetype_from_type(content_type type) { + switch (type) { case CONTENT_HTML: return 0xfaf; case CONTENT_TEXTPLAIN: return 0xfff; case CONTENT_CSS: return 0xf79; @@ -239,10 +258,5 @@ int ro_content_filetype(struct content *content) #endif default: break; } - - error = xmimemaptranslate_mime_type_to_filetype(content->mime_type, - &file_type); - if (error) - return 0xffd; - return file_type; + return 0; } |