diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-09-15 10:46:30 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-09-15 11:28:16 +0200 |
commit | 61deab29ca5d792aeea2201010481b7219913c21 (patch) | |
tree | 1499c00901d0f1583a1e0d3f9fd63ceb922c7c33 /package/source | |
parent | 7d30c7b93848f46f6ba3bfee7e93b12ac75af6a6 (diff) |
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>
Diffstat (limited to 'package/source')
-rw-r--r-- | package/source/zipapi/ZipFile.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index d3da523b5542..7b55d2bea684 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -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; |