Re: gnome_vfs_mime_remove_extension() bug.



On Wed, 16 Apr 2003, 725eb0c8ef771c09ee wrote:

> Hi everyone,
> I'm now using GnomeVfs API, in specific, it's:
> GnomeVFSResult
> gnome_vfs_mime_remove_extension (const char *mime_type, const char *extension)
> in gnome-vfs-mime-handlers.c.
> 
> This function works fine if there are more than one file extensions from the 
> specificed MIME type in the MIME database. But if there is only one file 
> extension, this function fails to remove it.
> 
> The problem could be easily recreated, could anybody help to check and fix it ?

Does this fix the problem?

Index: libgnomevfs/gnome-vfs-mime-handlers.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-mime-handlers.c,v
retrieving revision 1.97
diff -u -p -r1.97 gnome-vfs-mime-handlers.c
--- libgnomevfs/gnome-vfs-mime-handlers.c	16 May 2002 15:06:02 -0000	1.97
+++ libgnomevfs/gnome-vfs-mime-handlers.c	16 Apr 2003 07:35:26 -0000
@@ -1583,6 +1583,8 @@ gnome_vfs_mime_remove_extension (const c
 	if (extensions != NULL) {
 		/* Add extensions to hash table and flush into the file */
 		gnome_vfs_mime_set_registered_type_key (mime_type, "ext", extensions);
+	} else {
+		gnome_vfs_mime_set_registered_type_key (mime_type, "ext", "");
 	}
 	
 	gnome_vfs_mime_extensions_list_free (list);
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an uncontrollable one-eyed messiah on the edge. She's a high-kicking 
paranoid college professor with the power to bend men's minds. They fight 
crime! 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]