diff --git a/src/zimsplit.cpp b/src/zimsplit.cpp index f0ee2386..1918a658 100644 --- a/src/zimsplit.cpp +++ b/src/zimsplit.cpp @@ -130,20 +130,10 @@ class ZimSplitter zim::offset_type last(0); for(auto offset:offsets) { auto chunkSize = offset-last; - if (chunkSize > maxPartSize) { - // One part is bigger than what we want :/ - // Still have to write it. - if (currentPartSize) { - new_file(); - } - copy_out(chunkSize); - } else { - if (currentPartSize+chunkSize > maxPartSize) { - // It would be too much to write the current part in the current file. - new_file(); - } - copy_out(chunkSize); + if (currentPartSize > 0 && currentPartSize + chunkSize > maxPartSize) { + new_file(); } + copy_out(chunkSize); last = offset; } }