From: Timo Sirainen Date: Thu, 8 Jul 2004 21:27:22 +0000 (+0300) Subject: Fixed compression. X-Git-Tag: 1.1.alpha1~3807 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aff7542e1d2f48b030560a4f01096a2cc3f671ce;p=thirdparty%2Fdovecot%2Fcore.git Fixed compression. --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-cache-compress.c b/src/lib-index/mail-cache-compress.c index 31780c1c0b..30e419b559 100644 --- a/src/lib-index/mail-cache-compress.c +++ b/src/lib-index/mail-cache-compress.c @@ -184,13 +184,16 @@ mail_cache_copy(struct mail_cache *cache, struct mail_index_view *view, int fd) } } - 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 @@ mail_cache_copy(struct mail_cache *cache, struct mail_index_view *view, int fd) 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); }