]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
pyfec: fix bug in easyfec
authorZooko O'Whielacronx <zooko@zooko.com>
Wed, 28 Mar 2007 05:56:45 +0000 (22:56 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Wed, 28 Mar 2007 05:56:45 +0000 (22:56 -0700)
pyfec/fec/easyfec.py

index 3c0581306ed45e4e49b233656e5b07317ba56534..a2b5ec4d53da5ee7a26dce65aa81ef2220f92a55 100644 (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)