[dovecot-cvs] dovecot/src/lib-index mail-cache-compress.c, 1.10, 1.11

cras at dovecot.org cras at dovecot.org
Fri Jul 9 00:27:24 EEST 2004


Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv2465/lib-index

Modified Files:
	mail-cache-compress.c 
Log Message:
Fixed compression.



Index: mail-cache-compress.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-cache-compress.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mail-cache-compress.c	8 Jul 2004 20:26:15 -0000	1.10
+++ mail-cache-compress.c	8 Jul 2004 21:27:22 -0000	1.11
@@ -184,13 +184,16 @@
 			}
 		}
 
-		if (buffer_get_used_size(ctx.buffer) == sizeof(cache_rec))
+		cache_rec.size = buffer_get_used_size(ctx.buffer);
+		if (cache_rec.size == sizeof(cache_rec))
 			continue;
 
 		mail_index_update_cache(t, seq, hdr.file_seq,
 					output->offset, &old_offset);
+
+		buffer_write(ctx.buffer, 0, &cache_rec, sizeof(cache_rec));
 		o_stream_send(output, buffer_get_data(ctx.buffer, NULL),
-			      buffer_get_used_size(ctx.buffer));
+			      cache_rec.size);
 	}
 	hdr.used_file_size = output->offset;
 	buffer_free(ctx.buffer);
@@ -209,7 +212,7 @@
 		return -1;
 	}
 
-	if (output->offset < MAIL_CACHE_INITIAL_SIZE) {
+	if (hdr.used_file_size < MAIL_CACHE_INITIAL_SIZE) {
 		/* grow the file some more. doesn't matter if it fails */
 		(void)file_set_size(fd, MAIL_CACHE_INITIAL_SIZE);
 	}



More information about the dovecot-cvs mailing list