diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-03-07 09:50:11 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-03-07 08:30:54 +0000 |
commit | a31f61e233a08025c0acaeabd02c12981258c83d (patch) | |
tree | caf66e0781651c0afd68aa1f7c718808ab58715a /vcl/source | |
parent | d9ba2fbdc81705d387f932700289b2dda8ea81dc (diff) |
Drop VectorGraphicDataArray
Change-Id: If444317edf35d0627c6bc3a8c36ba973a8a0af8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148371
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 20 | ||||
-rw-r--r-- | vcl/source/gdi/vectorgraphicdata.cxx | 7 |
2 files changed, 13 insertions, 14 deletions
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index ef9f45485565..aab76c8968de 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1054,18 +1054,18 @@ ErrCode GraphicFilter::readSVG(SvStream & rStream, Graphic & rGraphic, GfxLinkTy if (!rStream.GetError() && nMemoryLength >= 0) { - VectorGraphicDataArray aNewData(nMemoryLength); + auto aNewData = std::make_unique<std::vector<sal_uInt8>>(nMemoryLength); aMemStream.Seek(STREAM_SEEK_TO_BEGIN); - aMemStream.ReadBytes(aNewData.getArray(), nMemoryLength); + aMemStream.ReadBytes(aNewData->data(), aNewData->size()); // Make a uncompressed copy for GfxLink rGraphicContentSize = nMemoryLength; rpGraphicContent.reset(new sal_uInt8[rGraphicContentSize]); - std::copy(std::cbegin(aNewData), std::cend(aNewData), rpGraphicContent.get()); + std::copy(std::cbegin(*aNewData), std::cend(*aNewData), rpGraphicContent.get()); if (!aMemStream.GetError()) { - BinaryDataContainer aDataContainer(reinterpret_cast<const sal_uInt8*>(aNewData.getConstArray()), aNewData.getLength()); + BinaryDataContainer aDataContainer(std::move(aNewData)); auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aDataContainer, VectorGraphicDataType::Svg); rGraphic = Graphic(aVectorGraphicDataPtr); bOkay = true; @@ -1074,12 +1074,12 @@ ErrCode GraphicFilter::readSVG(SvStream & rStream, Graphic & rGraphic, GfxLinkTy } else { - VectorGraphicDataArray aNewData(nStreamLength); - rStream.ReadBytes(aNewData.getArray(), nStreamLength); + auto aNewData = std::make_unique<std::vector<sal_uInt8>>(nStreamLength); + rStream.ReadBytes(aNewData->data(), aNewData->size()); if (!rStream.GetError()) { - BinaryDataContainer aDataContainer(reinterpret_cast<const sal_uInt8*>(aNewData.getConstArray()), aNewData.getLength()); + BinaryDataContainer aDataContainer(std::move(aNewData)); auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aDataContainer, VectorGraphicDataType::Svg); rGraphic = Graphic(aVectorGraphicDataPtr); bOkay = true; @@ -1137,12 +1137,12 @@ ErrCode GraphicFilter::readWMF_EMF(SvStream & rStream, Graphic & rGraphic, GfxLi aNewStream = &aMemStream; } } - VectorGraphicDataArray aNewData(nStreamLength); - aNewStream->ReadBytes(aNewData.getArray(), nStreamLength); + auto aNewData = std::make_unique<std::vector<sal_uInt8>>(nStreamLength); + aNewStream->ReadBytes(aNewData->data(), aNewData->size()); if (!aNewStream->GetError()) { const VectorGraphicDataType aDataType(eType); - BinaryDataContainer aDataContainer(reinterpret_cast<const sal_uInt8*>(aNewData.getConstArray()), aNewData.getLength()); + BinaryDataContainer aDataContainer(std::move(aNewData)); auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aDataContainer, aDataType); diff --git a/vcl/source/gdi/vectorgraphicdata.cxx b/vcl/source/gdi/vectorgraphicdata.cxx index 27479f3b0c34..e55cd14784e0 100644 --- a/vcl/source/gdi/vectorgraphicdata.cxx +++ b/vcl/source/gdi/vectorgraphicdata.cxx @@ -319,13 +319,12 @@ VectorGraphicData::VectorGraphicData( const sal_uInt32 nStmLen(rIStm.remainingSize()); if (nStmLen) { - VectorGraphicDataArray aVectorGraphicDataArray(nStmLen); - auto pData = aVectorGraphicDataArray.getArray(); - rIStm.ReadBytes(pData, nStmLen); + auto pData = std::make_unique<std::vector<sal_uInt8>>(nStmLen); + rIStm.ReadBytes(pData->data(), pData->size()); if (!rIStm.GetError()) { - maDataContainer = BinaryDataContainer(reinterpret_cast<const sal_uInt8*>(pData), nStmLen); + maDataContainer = BinaryDataContainer(std::move(pData)); } } } |