pyfec: fix bug in easyfec

This commit is contained in:
Zooko O'Whielacronx 2007-03-27 22:56:45 -07:00
parent 3c5d50797f
commit af180b00a7
1 changed files with 2 additions and 1 deletions

View File

@ -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)