From e7eab7f18484a175fa10ef1f632629ce31c44b1b Mon Sep 17 00:00:00 2001 From: zooko <zooko@zooko.com> Date: Wed, 28 Mar 2007 11:26:45 +0530 Subject: [PATCH] pyfec: fix bug in easyfec darcs-hash:879246ab55ce272c6df2c433d970a888f4b2fc53 --- pyfec/fec/easyfec.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- 2.45.2