1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-01-03 05:35:58 +00:00

Fix corner case bug in chunify()

This commit is contained in:
Jonas Borgström 2010-10-19 19:07:35 +02:00
parent 8d25f180f2
commit a1bbe57460
3 changed files with 3 additions and 4 deletions

View file

@ -111,11 +111,10 @@ ChunkifyIter_iternext(PyObject *self)
c->window_size);
}
c->i++;
if(c->i == c->buf_size && c->last == c->window_size - 1)
if(c->i == c->buf_size && c->last == -1)
{
int old_last = c->last;
c->last = c->i - 1;
printf("Max chunk size reached %d\n", c->last - old_last);
return PyString_FromStringAndSize((char *)(c->data + old_last + 1),
c->last - old_last);
}

View file

@ -73,7 +73,7 @@ def next(self):
self.data[self.i],
self.window_size)
self.i += 1
if self.i == self.buf_size and self.last == self.window_size - 1:
if self.i == self.buf_size and self.last == -1:
old_last = self.last
self.last = self.i - 1
return self.data[old_last + 1:self.last + 1]

View file

@ -8,7 +8,7 @@
author=u'Jonas Borgström',
author_email='jonas@borgstrom.se',
packages=['dedupestore'],
ext_modules=[Extension('_speedups', ['dedupestore/_speedups.c'])],
ext_modules=[Extension('dedupestore._speedups', ['dedupestore/_speedups.c'])],
entry_points = {
'console_scripts': [
'dedupestore = dedupestore.archiver:main',