From dc642bc3fa1895e01aa970cdd45f1610e4ad6de9 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 21 Mar 2004 22:31:30 +0000 Subject: [project @ 2004-03-21 22:31:30 by jmb] Fix mimetype reading for files used by image filingsystems. svn path=/import/netsurf/; revision=647 --- riscos/filetype.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'riscos') diff --git a/riscos/filetype.c b/riscos/filetype.c index 4a4a9c92d..c5bd20a1b 100644 --- a/riscos/filetype.c +++ b/riscos/filetype.c @@ -79,12 +79,22 @@ const char *fetch_filetype(const char *unix_path) char *fetch_mimetype(const char *ro_path) { os_error *e; - bits filetype; + bits filetype = 0, load; + int objtype; char *mime = xcalloc(256, sizeof(char)); - e = xosfile_read_stamped_no_path(ro_path, 0, 0, 0, 0, 0, &filetype); + e = xosfile_read_no_path(ro_path, &objtype, &load, 0, 0, 0); if (e) return 0; + if (objtype == 0x2) return 0; /* directories are pointless */ + + if ((load >> 20) & 0xFFF) { + filetype = (load>>8) & 0x000FFF; + } + else { + return 0; /* no idea */ + } + e = xmimemaptranslate_filetype_to_mime_type(filetype, mime); if (e) return 0; -- cgit v1.2.3