Changeset View
Changeset View
Standalone View
Standalone View
src/karchive.cpp
Show First 20 Lines • Show All 819 Lines • ▼ Show 20 Line(s) | 810 | { | |||
---|---|---|---|---|---|
820 | return filePerms; | 820 | return filePerms; | ||
821 | } | 821 | } | ||
822 | 822 | | |||
823 | bool KArchiveFile::copyTo(const QString &dest) const | 823 | bool KArchiveFile::copyTo(const QString &dest) const | ||
824 | { | 824 | { | ||
825 | QFile f(dest + QLatin1Char('/') + name()); | 825 | QFile f(dest + QLatin1Char('/') + name()); | ||
826 | if (f.open(QIODevice::ReadWrite | QIODevice::Truncate)) { | 826 | if (f.open(QIODevice::ReadWrite | QIODevice::Truncate)) { | ||
827 | QIODevice *inputDev = createDevice(); | 827 | QIODevice *inputDev = createDevice(); | ||
828 | if (!inputDev) { | ||||
829 | f.remove(); | ||||
830 | return false; | ||||
831 | } | ||||
828 | 832 | | |||
829 | // Read and write data in chunks to minimize memory usage | 833 | // Read and write data in chunks to minimize memory usage | ||
830 | const qint64 chunkSize = 1024 * 1024; | 834 | const qint64 chunkSize = 1024 * 1024; | ||
831 | qint64 remainingSize = d->size; | 835 | qint64 remainingSize = d->size; | ||
832 | QByteArray array; | 836 | QByteArray array; | ||
833 | array.resize(int(qMin(chunkSize, remainingSize))); | 837 | array.resize(int(qMin(chunkSize, remainingSize))); | ||
834 | 838 | | |||
835 | while (remainingSize > 0) { | 839 | while (remainingSize > 0) { | ||
▲ Show 20 Lines • Show All 200 Lines • Show Last 20 Lines |