[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-sync.c, 1.77.2.16, 1.77.2.17

tss at dovecot.org tss at dovecot.org
Fri May 11 16:14:10 EEST 2007


Update of /var/lib/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv2222

Modified Files:
      Tag: branch_1_0
	maildir-sync.c 
Log Message:
Keyword characters weren't sorted in the maildir filename.



Index: maildir-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-sync.c,v
retrieving revision 1.77.2.16
retrieving revision 1.77.2.17
diff -u -d -r1.77.2.16 -r1.77.2.17
--- maildir-sync.c	9 May 2007 07:10:18 -0000	1.77.2.16
+++ maildir-sync.c	11 May 2007 13:14:08 -0000	1.77.2.17
@@ -182,6 +182,7 @@
 
 #include <stdio.h>
 #include <stddef.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <sys/stat.h>
@@ -298,13 +299,20 @@
 	return 1;
 }
 
+static int char_cmp(const void *p1, const void *p2)
+{
+	const unsigned char *c1 = p1, *c2 = p2;
+
+	return *c1 - *c2;
+}
+
 static void
 maildir_filename_append_keywords(struct maildir_keywords_sync_ctx *ctx,
 				 array_t *keywords, string_t *str)
 {
 	ARRAY_SET_TYPE(keywords, unsigned int);
 	const unsigned int *indexes;
-	unsigned int i, count;
+	unsigned int i, count, start = str_len(str);
 	char chr;
 
 	indexes = array_get(keywords, &count);
@@ -313,6 +321,8 @@
 		if (chr != '\0')
 			str_append_c(str, chr);
 	}
+
+	qsort(str_c_modifyable(str) + start, str_len(str) - start, 1, char_cmp);
 }
 
 const char *maildir_filename_set_flags(struct maildir_keywords_sync_ctx *ctx,



More information about the dovecot-cvs mailing list