[mirrorbrain-commits] r8017 - /trunk/mirrordoctor/mb/hashes.py

From: <poeml_at_mirrorbrain.org>
Date: Sat, 27 Mar 2010 02:59:16 -0000
Author: poeml
Date: Sat Mar 27 03:59:15 2010
New Revision: 8017

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8017&view=rev
Log:
mb makehashes:
- handle zero-length files when guessing the best hash sizes

Modified:
    trunk/mirrordoctor/mb/hashes.py

Modified: trunk/mirrordoctor/mb/hashes.py
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mirrordoctor/mb/hashes.py?rev=8017&r1=8016&r2=8017&view=diff
==============================================================================
--- trunk/mirrordoctor/mb/hashes.py (original)
+++ trunk/mirrordoctor/mb/hashes.py Sat Mar 27 03:59:15 2010
_at_@ -340,7 +340,7 @@
         else:
             seq_matches = 1
 
-        rsum_len = math.ceil(((math.log(size) + math.log(blocksize)) / math.log(2) - 8.6) / seq_matches / 8)
+        rsum_len = math.ceil(((math.log(size or 1) + math.log(blocksize)) / math.log(2) - 8.6) / seq_matches / 8)
 
         # min and max lengths of rsums to store
         if rsum_len > 4:
_at_@ -350,7 +350,7 @@
 
         # Now the checksum length; min of two calculations
         checksum_len = math.ceil(
-                (20 + (math.log(size) + math.log(1 + size / blocksize)) / math.log(2))
+                (20 + (math.log(size or 1) + math.log(1 + size / blocksize)) / math.log(2))
                 / seq_matches / 8)
         checksum_len2 = (7.9 + (20 + math.log(1 + size / blocksize) / math.log(2))) / 8
 




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Sat Mar 27 2010 - 02:59:25 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT