[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-sync.c, 1.103, 1.104

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


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

Modified Files:
	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.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- maildir-sync.c	9 May 2007 07:10:21 -0000	1.103
+++ maildir-sync.c	11 May 2007 13:14:10 -0000	1.104
@@ -183,6 +183,7 @@
 
 #include <stdio.h>
 #include <stddef.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <dirent.h>
 #include <sys/stat.h>
@@ -296,13 +297,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_TYPE(keyword_indexes) *keywords,
 				 string_t *str)
 {
 	const unsigned int *indexes;
-	unsigned int i, count;
+	unsigned int i, count, start = str_len(str);
 	char chr;
 
 	indexes = array_get(keywords, &count);
@@ -311,6 +319,8 @@
 		if (chr != '\0')
 			str_append_c(str, chr);
 	}
+
+	qsort(str_c_modifiable(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