[dovecot-cvs] dovecot/src/lib-storage/index index-mail-headers.c, 1.59.2.4, 1.59.2.5 index-mail.c, 1.93.2.5, 1.93.2.6 index-mail.h, 1.37.2.1, 1.37.2.2

tss at dovecot.org tss at dovecot.org
Fri Oct 13 16:32:37 UTC 2006


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

Modified Files:
      Tag: branch_1_0
	index-mail-headers.c index-mail.c index-mail.h 
Log Message:
Don't use time_t anymore in cache file. uint32_t is large enough and makes
cache files compatible between 32bit and 64bit systems.



Index: index-mail-headers.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-mail-headers.c,v
retrieving revision 1.59.2.4
retrieving revision 1.59.2.5
diff -u -d -r1.59.2.4 -r1.59.2.5
--- index-mail-headers.c	23 Aug 2006 10:39:41 -0000	1.59.2.4
+++ index-mail-headers.c	13 Oct 2006 15:32:35 -0000	1.59.2.5
@@ -271,7 +271,7 @@
 
 	if (hdr == NULL) {
 		/* end of headers */
-		if (data->sent_date.time != (time_t)-1) {
+		if (data->sent_date.time != (uint32_t)-1) {
 			index_mail_cache_add(mail, MAIL_CACHE_SENT_DATE,
 					     &data->sent_date,
 					     sizeof(data->sent_date));

Index: index-mail.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-mail.c,v
retrieving revision 1.93.2.5
retrieving revision 1.93.2.6
diff -u -d -r1.93.2.5 -r1.93.2.6
--- index-mail.c	9 Oct 2006 17:24:48 -0000	1.93.2.5
+++ index-mail.c	13 Oct 2006 15:32:35 -0000	1.93.2.6
@@ -20,7 +20,7 @@
 	{ "date.sent", 0, MAIL_CACHE_FIELD_FIXED_SIZE,
 	  sizeof(struct mail_sent_date), 0 },
 	{ "date.received", 0, MAIL_CACHE_FIELD_FIXED_SIZE,
-	  sizeof(time_t), 0 },
+	  sizeof(uint32_t), 0 },
 	{ "size.virtual", 0, MAIL_CACHE_FIELD_FIXED_SIZE,
 	  sizeof(uoff_t), 0 },
 	{ "size.physical", 0, MAIL_CACHE_FIELD_FIXED_SIZE,
@@ -136,11 +136,11 @@
 
 time_t index_mail_get_cached_received_date(struct index_mail *mail)
 {
-	time_t t;
+	uint32_t t;
 
 	if (!index_mail_get_fixed_field(mail, MAIL_CACHE_RECEIVED_DATE,
 					&t, sizeof(t)))
-		t = (time_t)-1;
+		return (time_t)-1;
 	return t;
 }
 
@@ -236,9 +236,8 @@
 	struct index_mail *mail = (struct index_mail *) _mail;
 	struct index_mail_data *data = &mail->data;
 	const char *str;
-	int tz;
 
-	if (data->sent_date.time != (time_t)-1) {
+	if (data->sent_date.time != (uint32_t)-1) {
 		if (timezone != NULL)
 			*timezone = data->sent_date.timezone;
 		return data->sent_date.time;
@@ -248,16 +247,19 @@
 					 &data->sent_date,
 					 sizeof(data->sent_date));
 
-	if (data->sent_date.time == (time_t)-1) {
+	if (data->sent_date.time == (uint32_t)-1) {
+		time_t t;
+		int tz;
+
 		str = mail_get_first_header(_mail, "Date");
 		if (str == NULL ||
 		    !message_date_parse((const unsigned char *)str,
-					strlen(str),
-					&data->sent_date.time, &tz)) {
+					strlen(str), &t, &tz)) {
 			/* 0 = not found / invalid */
-			data->sent_date.time = 0;
+			t = 0;
 			tz = 0;
 		}
+		data->sent_date.time = t;
 		data->sent_date.timezone = tz;
 		index_mail_cache_add(mail, MAIL_CACHE_SENT_DATE,
 				     &data->sent_date, sizeof(data->sent_date));
@@ -794,7 +796,7 @@
 	data->virtual_size = (uoff_t)-1;
 	data->physical_size = (uoff_t)-1;
 	data->received_date = (time_t)-1;
-	data->sent_date.time = (time_t)-1;
+	data->sent_date.time = (uint32_t)-1;
 
 	if (!index_mail_get_fixed_field(mail, MAIL_CACHE_FLAGS,
 					&data->cache_flags,

Index: index-mail.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-mail.h,v
retrieving revision 1.37.2.1
retrieving revision 1.37.2.2
diff -u -d -r1.37.2.1 -r1.37.2.2
--- index-mail.h	30 Jul 2006 23:02:15 -0000	1.37.2.1
+++ index-mail.h	13 Oct 2006 15:32:35 -0000	1.37.2.2
@@ -52,7 +52,7 @@
 };
 
 struct mail_sent_date {
-	time_t time;
+	uint32_t time;
 	int32_t timezone;
 };
 



More information about the dovecot-cvs mailing list