gnome_vfs_file_info_matches patch - 2



hi,

Here is a revised version of the patch. As before, extensively tested,
seems to work fine.

Mathieu
-- 
Mathieu Lacage <mathieu gnu org>
? patch
? stamp-h1
? doc/gnome-vfs-2.0-decl-list.txt
? doc/gnome-vfs-2.0-decl.txt
? doc/gnome-vfs-2.0-undocumented.txt
? doc/gnome-vfs-2.0-unused.txt
? doc/gnome-vfs-2.0.args
? doc/gnome-vfs-2.0.hierarchy
? doc/gnome-vfs-2.0.signals
? doc/xml
? doc/tmpl/gnome-vfs-2.0-unused.sgml
? doc/tmpl/gnome-vfs.sgml
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-vfs/ChangeLog,v
retrieving revision 1.1614
diff -u -r1.1614 ChangeLog
--- ChangeLog	17 Sep 2003 09:11:02 -0000	1.1614
+++ ChangeLog	17 Sep 2003 11:47:49 -0000
@@ -1,3 +1,12 @@
+<<<<<<< ChangeLog
+2003-09-11 Mathieu Lacage <mathieu gnome org>
+
+	* libgnomevfs/gnome-vfs-file-info.c: make gnome_vfs_file_info_matches
+	match against everything in the FileInfo structure. This effectively makes
+	this function behave like an _equals function but we cannot change the 
+	name of the function.
+
+=======
 2003-09-17  Alexander Larsson  <alexl redhat com>
 
 	* libgnomevfs/gnome-vfs-async-job-map.c (_gnome_vfs_async_job_map_get_job):
@@ -26,6 +35,7 @@
 	* HACKING:
 	Fix list name.
 
+>>>>>>> 1.1614
 2003-09-11  Fatih Demir <kabalak gtranslator org>
 
 	* configure.in: Added "ta" (Tamil) to the languages' list.
Index: libgnomevfs/gnome-vfs-file-info.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-file-info.c,v
retrieving revision 1.22
diff -u -r1.22 gnome-vfs-file-info.c
--- libgnomevfs/gnome-vfs-file-info.c	18 Dec 2002 16:40:00 -0000	1.22
+++ libgnomevfs/gnome-vfs-file-info.c	17 Sep 2003 11:47:49 -0000
@@ -217,7 +217,8 @@
  * @a: first GnomeVFSFileInfo struct to compare
  * @b: second GnomeVFSFileInfo struct to compare
  *
- * Compare the two file info structs, return TRUE if they match.
+ * Compare the two file info structs, return TRUE if they match exactly
+ * the same file data.
  *
  * Returns: TRUE if the two GnomeVFSFileInfos match, otherwise return FALSE.
  **/
@@ -230,12 +231,27 @@
 	g_return_val_if_fail (a->name != NULL, FALSE);
 	g_return_val_if_fail (b->name != NULL, FALSE);
 
+	/* This block of code assumes that the GnomeVfsFileInfo 
+	   was correctly allocated with g_new0 which means that each pair
+	   of fields are either invalid and equal to NULL or are valid 
+	   If both GnomeVfsFileInfos have only invalid fields, the 
+	   function returns TRUE. That is, it says the infos match which is,
+	   in a sense, true :)
+	*/
+
 	if (a->type != b->type
 	    || a->size != b->size
 	    || a->block_count != b->block_count
 	    || a->atime != b->atime
 	    || a->mtime != b->mtime
 	    || a->ctime != b->ctime
+	    || a->flags != b->flags
+	    || a->permissions != b->permissions
+	    || a->device != b->device
+	    || a->inode != b->inode
+	    || a->link_count != b->link_count
+	    || a->uid != b->uid
+	    || a->gid != b->gid
 	    || strcmp (a->name, b->name) != 0) {
 		return FALSE;
 	}
@@ -243,9 +259,19 @@
 	if (a->mime_type == NULL || b->mime_type == NULL) {
 		return a->mime_type == b->mime_type;
 	}
-
 	g_assert (a->mime_type != NULL && b->mime_type != NULL);
-	return g_ascii_strcasecmp (a->mime_type, b->mime_type) == 0;
+
+	if (a->symlink_name == NULL || b->symlink_name == NULL) {
+		return a->symlink_name == b->symlink_name;
+	}
+	g_assert (a->symlink_name != NULL && b->symlink_name != NULL);
+
+	if (g_ascii_strcasecmp (a->mime_type, b->mime_type) == 0
+	    && strcmp (a->symlink_name, b->symlink_name) == 0) {
+		return TRUE;
+	} else {
+		return FALSE;
+	}
 }
 
 /**
Index: libgnomevfs/gnome-vfs-file-info.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-file-info.h,v
retrieving revision 1.26
diff -u -r1.26 gnome-vfs-file-info.h
--- libgnomevfs/gnome-vfs-file-info.h	18 Dec 2002 16:40:00 -0000	1.26
+++ libgnomevfs/gnome-vfs-file-info.h	17 Sep 2003 11:47:49 -0000
@@ -234,7 +234,7 @@
            link points to.  */
 	char *symlink_name;
 
-	/* MIME type.  */
+	/* MIME type.  -- ascii string */
 	char *mime_type;
 
 	guint refcount;


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