Re: GLib file magics
- From: Pavel Císler <pavel eazel com>
- To: Darin Adler <darin eazel com>
- Cc: Maciej Stachowiak <mjs eazel com>, Tim Janik <timj gtk org>,Gtk+ Developers <gtk-devel-list gnome org>,Manish Singh <yosh gimp org>
- Subject: Re: GLib file magics
- Date: Fri, 28 Jul 2000 13:31:08 -0700
Darin Adler wrote:
> >> gnome-vfs-mime-magic.c:
> >> - closely tied to file io (even so for the mime specification)
> >
> > This is lame, and we are planning to add versions of the interfaces
> > that can work on in-memory buffers (and tell you how much a prefix you
> > need to do all the magic tests, or have some kind of callback setup).
>
> I'm not sure what you guys were looking at. My copy of gnome-vfs contains a
> header called gnome_vfs_sniff_buffer.h with interfaces for sniffing from a
> file, from memory, and a generic function-pointer-based streaming interface
> for more complex cases. It's true that this header doesn't provide an
> interface to the file-name-based checks, so there may be a little bit of API
> missing, but I believe Evolution already uses this to figure out the MIME
> type of incoming mismarked mail parts.
>
gnome-vfs-mime.h actually does have the file-name-based checks:
const char *gnome_vfs_mime_type_from_name (const gchar* filename);
const char *gnome_vfs_mime_type_from_name_or_default (const gchar *filename,
const gchar *defaultv);
Between the higher-level calls in gnome-vfs-mime.h and more customizable calls
in gnome-vfs-mime-magic.h and gnome_vfs_sniff_buffer.h most every mime-sniffing
need should be covered. If you need super exotic ones can be easily crafted
with the primitives in gnome_vfs_sniff_buffer.h as Darin and Dan points out.
Pavel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]