From: Zooko O'Whielacronx Date: Wed, 28 Mar 2007 05:56:45 +0000 (-0700) Subject: pyfec: fix bug in easyfec X-Git-Url: https://git.rkrishnan.org/listings/FOOURL?a=commitdiff_plain;h=af180b00a7d300a3331259af2935ea568619a71d;p=tahoe-lafs%2Ftahoe-lafs.git pyfec: fix bug in easyfec --- diff --git a/pyfec/fec/easyfec.py b/pyfec/fec/easyfec.py index 3c058130..a2b5ec4d 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)