Avoid nedless buffer initialization
Not possible yet to use std::make_unique_for_overwrite, baseline compiler versions are not ready. Change-Id: Ie14ac5210fa63dcdc7755bb8c722800a877acd44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173381 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
parent
7d30c7b938
commit
61deab29ca
1 changed files with 3 additions and 3 deletions
|
@ -1164,11 +1164,11 @@ std::tuple<sal_Int64, sal_Int64, sal_Int64> ZipFile::findCentralDirectory()
|
|||
aGrabber.seek( nEnd );
|
||||
|
||||
auto nSize = nLength - nEnd;
|
||||
std::vector<sal_Int8> aBuffer(nSize);
|
||||
if (nSize != aGrabber.readBytes(aBuffer.data(), nSize))
|
||||
std::unique_ptr<sal_Int8[]> aBuffer(new sal_Int8[nSize]);
|
||||
if (nSize != aGrabber.readBytes(aBuffer.get(), nSize))
|
||||
throw ZipException(u"Zip END signature not found!"_ustr );
|
||||
|
||||
const sal_Int8 *pBuffer = aBuffer.data();
|
||||
const sal_Int8 *pBuffer = aBuffer.get();
|
||||
|
||||
sal_Int64 nEndPos = {};
|
||||
nPos = nSize - ENDHDR;
|
||||
|
|
Loading…
Reference in a new issue