From af180b00a7d300a3331259af2935ea568619a71d Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Tue, 27 Mar 2007 22:56:45 -0700 Subject: [PATCH] pyfec: fix bug in easyfec --- 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 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) -- 2.45.2