diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2003-06-02 21:09:50 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2003-06-02 21:09:50 +0000 |
commit | 51e93478079f490b13023d406782dd883bd817e2 (patch) | |
tree | 7497e42bc41c6c28b93c0c82da89239f750c9cc3 | |
parent | 3ca51179c9d06d4d69027db8c2f1f3af856aef0a (diff) | |
download | netsurf-51e93478079f490b13023d406782dd883bd817e2.tar.gz netsurf-51e93478079f490b13023d406782dd883bd817e2.tar.bz2 |
[project @ 2003-06-02 21:09:50 by jmb]
Use Mimemap module to get mime types from file extensions
svn path=/import/netsurf/; revision=151
-rw-r--r-- | riscos/plugin.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/riscos/plugin.c b/riscos/plugin.c index e6b3aabb8..1d395ade2 100644 --- a/riscos/plugin.c +++ b/riscos/plugin.c @@ -1,5 +1,5 @@ /** - * $Id: plugin.c,v 1.1 2003/05/31 18:47:00 jmb Exp $ + * $Id: plugin.c,v 1.2 2003/06/02 21:09:50 jmb Exp $ */ #include <assert.h> @@ -14,6 +14,8 @@ #include "netsurf/utils/log.h" #include "netsurf/utils/utils.h" +#include "oslib/mimemap.h" + char* create_mime_from_ext(char* data); void plugin_fetch(struct content* content, char* url, struct box* box, @@ -64,24 +66,17 @@ void plugin_fetch(struct content* content, char* url, struct box* box, char* create_mime_from_ext(char* data){ char* ret; + os_error *e; ret = strrchr(data, '.'); - LOG(("ret = %s", ++ret)); - - if ((stricmp(ret,"jpg")) == 0 || (stricmp(ret,"jpeg")) == 0) { - strcpy(ret,"image/jpeg"); - LOG(("jpeg image")); + LOG(("Extension = %s", ret)); - } else if ((stricmp(ret,"png")) == 0) { - strcpy(ret,"image/png"); - LOG(("png image")); + /* Let's make the mime map module do the work for us */ + e = xmimemaptranslate_extension_to_mime_type((const char*)ret, + ret); + LOG(("Mime Type = %s", ret)); - } /*else if ((stricmp(ret, "gif")) == 0) { - ret = "image/gif"; - }*/ else { - - ret = NULL; - } + if(e != NULL) ret = NULL; return ret; } |