From: zooko Date: Wed, 28 Mar 2007 05:56:45 +0000 (+0530) Subject: pyfec: fix bug in easyfec X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/frontends/flags/%3C?a=commitdiff_plain;h=e7eab7f18484a175fa10ef1f632629ce31c44b1b;p=tahoe-lafs%2Fzfec.git pyfec: fix bug in easyfec darcs-hash:879246ab55ce272c6df2c433d970a888f4b2fc53 --- diff --git a/pyfec/fec/easyfec.py b/pyfec/fec/easyfec.py index 3c05813..a2b5ec4 100644 --- a/pyfec/fec/easyfec.py +++ b/pyfec/fec/easyfec.py @@ -18,7 +18,8 @@ class Encoder(object): """ chunksize = div_ceil(len(data), self.fec.k) numchunks = div_ceil(len(data), chunksize) - l = [ data[i:i+chunksize] for i in range(numchunks) ] + l = [ data[i:i+chunksize] for i in range(0, len(data), chunksize) ] + # padding if len(l[-1]) != len(l[0]): l[-1] = l[-1] + ('\x00'*(len(l[0])-len(l[-1]))) return self.fec.encode(l)