DecompressHelper: retain the error from internal counter
We never copied the error string so after the call to 'clear' it went away completely. Additionally, stop clearing the error string in clear() since we reset it when the encoding is set, in case the object is reused. Pick-to: 6.8 6.5 Fixes: QTBUG-129697 Change-Id: Ia64e1d13a99b62760f61cac6b67ae3cff5e2c9da Reviewed-by: Mate Barany <mate.barany@qt.io>
This commit is contained in:
parent
7ad855e51e
commit
f84c83be52
@ -234,8 +234,11 @@ void QDecompressHelper::feed(QByteArray &&data)
|
|||||||
Q_ASSERT(contentEncoding != None);
|
Q_ASSERT(contentEncoding != None);
|
||||||
totalCompressedBytes += data.size();
|
totalCompressedBytes += data.size();
|
||||||
compressedDataBuffer.append(std::move(data));
|
compressedDataBuffer.append(std::move(data));
|
||||||
if (!countInternal(compressedDataBuffer[compressedDataBuffer.bufferCount() - 1]))
|
if (!countInternal(compressedDataBuffer[compressedDataBuffer.bufferCount() - 1])) {
|
||||||
|
if (errorStr.isEmpty() && countHelper)
|
||||||
|
errorStr = countHelper->errorString();
|
||||||
clear(); // If our counting brother failed then so will we :|
|
clear(); // If our counting brother failed then so will we :|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -247,8 +250,11 @@ void QDecompressHelper::feed(const QByteDataBuffer &buffer)
|
|||||||
Q_ASSERT(contentEncoding != None);
|
Q_ASSERT(contentEncoding != None);
|
||||||
totalCompressedBytes += buffer.byteAmount();
|
totalCompressedBytes += buffer.byteAmount();
|
||||||
compressedDataBuffer.append(buffer);
|
compressedDataBuffer.append(buffer);
|
||||||
if (!countInternal(buffer))
|
if (!countInternal(buffer)) {
|
||||||
|
if (errorStr.isEmpty() && countHelper)
|
||||||
|
errorStr = countHelper->errorString();
|
||||||
clear(); // If our counting brother failed then so will we :|
|
clear(); // If our counting brother failed then so will we :|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -261,8 +267,11 @@ void QDecompressHelper::feed(QByteDataBuffer &&buffer)
|
|||||||
totalCompressedBytes += buffer.byteAmount();
|
totalCompressedBytes += buffer.byteAmount();
|
||||||
const QByteDataBuffer copy(buffer);
|
const QByteDataBuffer copy(buffer);
|
||||||
compressedDataBuffer.append(std::move(buffer));
|
compressedDataBuffer.append(std::move(buffer));
|
||||||
if (!countInternal(copy))
|
if (!countInternal(copy)) {
|
||||||
|
if (errorStr.isEmpty() && countHelper)
|
||||||
|
errorStr = countHelper->errorString();
|
||||||
clear(); // If our counting brother failed then so will we :|
|
clear(); // If our counting brother failed then so will we :|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -552,8 +561,6 @@ void QDecompressHelper::clear()
|
|||||||
totalBytesRead = 0;
|
totalBytesRead = 0;
|
||||||
totalUncompressedBytes = 0;
|
totalUncompressedBytes = 0;
|
||||||
totalCompressedBytes = 0;
|
totalCompressedBytes = 0;
|
||||||
|
|
||||||
errorStr.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qsizetype QDecompressHelper::readZLib(char *data, const qsizetype maxSize)
|
qsizetype QDecompressHelper::readZLib(char *data, const qsizetype maxSize)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user