[frameworks/karchive] src: Revert "kzip: write data in chunks"

George Florea Bănuș <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 973a52a4a8d7a25b7ac46c158ed4c88a89d4afb0 by George Florea Bănuș.
Committed on 27/07/2026 at 14:58.
Pushed by georgefb into branch 'master'.

Revert "kzip: write data in chunks"

This reverts commit 2cf5f281c3e1995e2941d605a26a5f2c161020ce.

M  +2    -15   src/kzip.cpp

https://invent.kde.org/frameworks/karchive/-/commit/973a52a4a8d7a25b7ac46c158ed4c88a89d4afb0

diff --git a/src/kzip.cpp b/src/kzip.cpp
index d16ee76..27e0a2c 100644
--- a/src/kzip.cpp
+++ b/src/kzip.cpp
@@ -1528,22 +1528,9 @@ bool KZip::doWriteData(const char *data, qint64 size)
     // and they didn't mention it in their docs...
     d->m_crc = crc32(d->m_crc, (const Bytef *)data, size);
 
-    constexpr qint64 chunkSize = 2 * 1024 * 1024;
-    qint64 totalWritten = 0;
-    while (totalWritten < size) {
-        qint64 chunk = std::min(chunkSize, size - totalWritten);
-
-        qint64 currentWritten = d->m_currentDev->write(data + totalWritten, chunk);
-        if (currentWritten != chunk) {
-            setErrorString(tr("Error writing data chunk: %1").arg(d->m_currentDev->errorString()));
-            return false;
-        }
-
-        totalWritten += currentWritten;
-    }
-
+    qint64 written = d->m_currentDev->write(data, size);
     // qCDebug(KArchiveLog) << "wrote" << size << "bytes.";
-    const bool ok = totalWritten == size;
+    const bool ok = written == size;
 
     if (!ok) {
         setErrorString(tr("Error writing data: %1").arg(d->m_currentDev->errorString()));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.