On Sat, 14 May 2011 20:49:10 +0200, François Revol wrote:

> [const?] char *fetch_mime_by_ext(const char *filename);

Personally I hate detecting filetypes by filename/extension - it's
prone to errors/hacking.  Look at all the problems on Windows,
renaming a file makes it think the filetype has changed, you can trick
things like Outlook so easily just by renaming files.

I also realise that sometimes the filename is the only way to
determine a filetype.  I think an "integrated" approach would be
better, one function which passes the filename and the data.  I see no
reason why the data (or at least the first few bytes) couldn't be
available before you need to work out what type it is.

Chris

Reply via email to