From 38bcb14d7765a1231527f65f9a1c3d9e8045697e Mon Sep 17 00:00:00 2001 From: Chris Young Date: Tue, 10 May 2011 19:32:21 +0000 Subject: Migrate to new MIMEtyper svn path=/trunk/netsurf/; revision=12375 --- amiga/filetype.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 4 deletions(-) (limited to 'amiga/filetype.c') diff --git a/amiga/filetype.c b/amiga/filetype.c index 28c780f5f..4a5d9aa62 100644 --- a/amiga/filetype.c +++ b/amiga/filetype.c @@ -318,7 +318,7 @@ void ami_mime_entry_free(struct ami_mime_entry *mimeentry) /** * Return next matching MIME entry * - * \param search lwc_string to search for + * \param search lwc_string to search for (or NULL for all) * \param type of value being searched for (AMI_MIME_#?) * \param start_node node to continue search (updated on exit) * \return entry or NULL if no match @@ -412,7 +412,6 @@ struct Node *ami_mime_from_datatype(struct DataType *dt, lwc_string *dt_name; lwc_error lerror; - if(IsMinListEmpty(ami_mime_list)) return NULL; if(dt == NULL) return NULL; dth = dt->dtn_Header; @@ -451,8 +450,6 @@ struct Node *ami_mime_to_filetype(lwc_string *mimetype, struct Node *node; struct ami_mime_entry *mimeentry; - if(IsMinListEmpty(ami_mime_list)) return NULL; - node = start_node; mimeentry = ami_mime_entry_locate(mimetype, AMI_MIME_MIMETYPE, &node); @@ -467,6 +464,62 @@ struct Node *ami_mime_to_filetype(lwc_string *mimetype, } } +/** + * Return all MIME types containing a plugincmd + * + * \param mimetype ptr to lwc_string MIME type + * \param start_node node to feed back in to continue search + * \return node or NULL if no match + */ + +struct Node *ami_mime_has_cmd(lwc_string **mimetype, struct Node *start_node) +{ + struct Node *node; + struct ami_mime_entry *mimeentry; + + node = start_node; + mimeentry = ami_mime_entry_locate(NULL, AMI_MIME_PLUGINCMD, &node); + + if(mimeentry != NULL) + { + *mimetype = mimeentry->mimetype; + return (struct Node *)node; + } + else + { + return NULL; + } +} + +/** + * Return the plugincmd matching a MIME type + * + * \param mimetype lwc_string MIME type + * \param plugincmd ptr to lwc_string to hold plugincmd + * \param start_node node to feed back in to continue search + * \return node or NULL if no match + */ + +struct Node *ami_mime_to_plugincmd(lwc_string *mimetype, + lwc_string **plugincmd, struct Node *start_node) +{ + struct Node *node; + struct ami_mime_entry *mimeentry; + + node = start_node; + mimeentry = ami_mime_entry_locate(mimetype, AMI_MIME_MIMETYPE, &node); + + if(mimeentry != NULL) + { + *plugincmd = mimeentry->plugincmd; + return (struct Node *)node; + } + else + { + return NULL; + } +} + /** * Compare the MIME type of an hlcache_handle to a DefIcons type */ -- cgit v1.2.3