[evolution-patches] fix for bug #42854



http://bugzilla.ximian.com/show_bug.cgi?id=42854

the uids were not being sorted before passing them to imap-utils
function that split the uids into sets.

Attached patch fixes it.

Jeff

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
? 42854.patch
? ChangeLog.nonximian
? body
? body.c
? body.txt
? camel-mime-filter-windows.c
? camel-mime-filter-windows.h
? charset-map.c
? charset-map.diff
? cmsutil.c
? date.patch
? debug.patch
? ehlo.patch
? evolution-1.3-gpg.patch
? folder-info-build.patch
? foo
? html-filter-broken.msg
? imap
? invalid-content-id.patch
? iso
? iso.c
? pop3-uidl.patch
? smime
? win-charset.patch
? tests/mime-filter/test-tohtml
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.1811
diff -u -r1.1811 ChangeLog
--- ChangeLog	13 May 2003 18:10:10 -0000	1.1811
+++ ChangeLog	13 May 2003 22:19:00 -0000
@@ -1,3 +1,17 @@
+2003-05-13  Jeffrey Stedfast  <fejj ximian com>
+
+	* providers/imap/camel-imap-utils.c (imap_uid_array_to_set): Added
+	a note to the comment block for this function noting that uids
+	MUST be in sorted order.
+
+	* providers/imap/camel-imap-folder.c (imap_expunge_uids_online):
+	Sort the uids before splitting them into UID set chunks. The code
+	that splits the uid array into sets expects the uids to be in
+	sorted order. Fixes bug #42854.
+
+	* providers/imap/camel-imap-command.c (imap_command_start):
+	Re-enable camel_verbose_debug logging.
+
 2003-05-12  Jeffrey Stedfast  <fejj ximian com>
 
 	* providers/smtp/camel-smtp-transport.c (smtp_helo): If
Index: providers/imap/camel-imap-command.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/imap/camel-imap-command.c,v
retrieving revision 1.57
diff -u -r1.57 camel-imap-command.c
--- providers/imap/camel-imap-command.c	13 May 2003 16:03:19 -0000	1.57
+++ providers/imap/camel-imap-command.c	13 May 2003 22:19:00 -0000
@@ -44,7 +44,6 @@
 #include <camel/camel-utf8.h>
 #include <camel/camel-session.h>
 
-#define d(x)
 
 extern int camel_verbose_debug;
 
@@ -198,7 +197,6 @@
 	}
 	
 	/* Send the command */
-#if d(!)0
 	if (camel_verbose_debug) {
 		const char *mask;
 		
@@ -213,7 +211,6 @@
 		
 		fprintf (stderr, "sending : %c%.5d %s\r\n", store->tag_prefix, store->command, mask);
 	}
-#endif
 	
 	nwritten = camel_stream_printf (store->ostream, "%c%.5d %s\r\n",
 					store->tag_prefix, store->command++, cmd);
Index: providers/imap/camel-imap-folder.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/imap/camel-imap-folder.c,v
retrieving revision 1.300
diff -u -r1.300 camel-imap-folder.c
--- providers/imap/camel-imap-folder.c	13 May 2003 16:03:18 -0000	1.300
+++ providers/imap/camel-imap-folder.c	13 May 2003 22:19:01 -0000
@@ -847,6 +847,22 @@
 	camel_folder_change_info_free (changes);
 }
 
+static int
+uid_compar (const void *va, const void *vb)
+{
+	const char **sa = (const char **)va, **sb = (const char **)vb;
+	unsigned long a, b;
+
+	a = strtoul (*sa, NULL, 10);
+	b = strtoul (*sb, NULL, 10);
+	if (a < b)
+		return -1;
+	else if (a == b)
+		return 0;
+	else
+		return 1;
+}
+
 static void
 imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *ex)
 {
@@ -864,7 +880,9 @@
 			return;
 		}
 	}
-
+	
+	qsort (uids->pdata, uids->len, sizeof (void *), uid_compar);
+	
 	while (uid < uids->len) {
 		set = imap_uid_array_to_set (folder->summary, uids, uid, UID_SET_LIMIT, &uid);
 		response = camel_imap_command (store, folder, ex,
@@ -889,22 +907,6 @@
 	}
 	
 	CAMEL_SERVICE_UNLOCK (store, connect_lock);
-}
-
-static int
-uid_compar (const void *va, const void *vb)
-{
-	const char **sa = (const char **)va, **sb = (const char **)vb;
-	unsigned long a, b;
-
-	a = strtoul (*sa, NULL, 10);
-	b = strtoul (*sb, NULL, 10);
-	if (a < b)
-		return -1;
-	else if (a == b)
-		return 0;
-	else
-		return 1;
 }
 
 static void
Index: providers/imap/camel-imap-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/imap/camel-imap-utils.c,v
retrieving revision 1.63
diff -u -r1.63 camel-imap-utils.c
--- providers/imap/camel-imap-utils.c	24 Apr 2003 17:41:28 -0000	1.63
+++ providers/imap/camel-imap-utils.c	13 May 2003 22:19:01 -0000
@@ -1079,6 +1079,8 @@
  *
  * After calling, @lastuid will be set the index of the first uid
  * *not* included in the returned set string.
+ *
+ * Note: @uids MUST be in sorted order for this code to work properly.
  * 
  * Return value: the set, which the caller must free with g_free()
  **/


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