util/disk_cache: fix compressed size calculation
authorGrazvydas Ignotas <notasas@gmail.com>
Thu, 9 Mar 2017 00:54:52 +0000 (02:54 +0200)
committerTimothy Arceri <tarceri@itsqueeze.com>
Thu, 9 Mar 2017 09:26:23 +0000 (20:26 +1100)
It incorrectly doubles the size on each iteration.

Fixes: 85a9b1b5 "util/disk_cache: compress individual cache entries"
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/util/disk_cache.c

index 31a93365825f99b0869605f28d5951ae39d16526..5470688df3233ce956fb93b797e4cca78dccab36 100644 (file)
@@ -696,7 +696,7 @@ deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest,
          assert(ret != Z_STREAM_ERROR);  /* state not clobbered */
 
          size_t have = BUFSIZE - strm.avail_out;
-         compressed_size += compressed_size + have;
+         compressed_size += have;
 
          size_t written = 0;
          for (size_t len = 0; len < have; len += written) {