Commit 910d2872 authored by Elvis Angelaccio's avatar Elvis Angelaccio

Fix mismatched new[] / delete[] valgrind warning

QScopedPointer by default uses `delete`, even if we used `new []`.
We would have to use the following verbose syntax:

    QScopedPointer<uchar, QScopedPointerArrayDeleter<uchar>> buf(new uchar[...]);

But `std::unique_ptr` can do the right thing by just looking at the template
parameter, so let's use that.
parent b36f24ed
......@@ -489,13 +489,13 @@ bool LibzipPlugin::testArchive()
zip_file *zipFile = zip_fopen_index(archive, i, 0);
QScopedPointer<uchar> buf(new uchar[statBuffer.size]);
const int len = zip_fread(zipFile,, statBuffer.size);
std::unique_ptr<uchar[]> buf(new uchar[statBuffer.size]);
const int len = zip_fread(zipFile, buf.get(), statBuffer.size);
if (len == -1 || uint(len) != statBuffer.size) {
qCCritical(ARK) << "Failed to read data for" <<;
return false;
if (statBuffer.crc != crc32(0, &[0], len)) {
if (statBuffer.crc != crc32(0, &buf.get()[0], len)) {
qCCritical(ARK) << "CRC check failed for" <<;
return false;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment