Cscott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/296547

Change subject: Bug fix: preserve cluster compression type after clear().
......................................................................

Bug fix: preserve cluster compression type after clear().

By nulling out the cluster implementation on clear, we were also
resetting the cluster compression type.  This caused the ZimCreator
API to not compress compressible clusters after the first one.
This is a follow-up to f5de40f94b30795f42bb9388cbb46df9cd605167,
which reused cluster objects instead of recreating them from scratch
each time.

Related issue: the `size()` of an empty cluster is actually 4, not 0,
since even an empty cluster contains an field which counts the number
of offsets in the cluster.

Change-Id: I468a1719a33c450db9a28d9704b539bdb97cd7fc
---
M zimlib/include/zim/cluster.h
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/openzim refs/changes/47/296547/1

diff --git a/zimlib/include/zim/cluster.h b/zimlib/include/zim/cluster.h
index c26c24c..bd55cb5 100644
--- a/zimlib/include/zim/cluster.h
+++ b/zimlib/include/zim/cluster.h
@@ -88,8 +88,8 @@
       Blob getBlob(size_type n) const;
 
       size_type count() const   { return impl ? impl->getCount() : 0; }
-      size_type size() const    { return impl ? impl->getSize() : 0; }
-      void clear()              { impl = 0; }
+      size_type size() const    { return impl ? impl->getSize(): 
sizeof(size_type); }
+      void clear()              { if (impl) impl->clear(); }
 
       void addBlob(const char* data, unsigned size) { getImpl()->addBlob(data, 
size); }
       void addBlob(const Blob& blob)                { 
getImpl()->addBlob(blob); }

-- 
To view, visit https://gerrit.wikimedia.org/r/296547
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I468a1719a33c450db9a28d9704b539bdb97cd7fc
Gerrit-PatchSet: 1
Gerrit-Project: openzim
Gerrit-Branch: master
Gerrit-Owner: Cscott <canan...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to