diff options
-rw-r--r-- | include/vcl/BinaryDataContainer.hxx | 33 | ||||
-rw-r--r-- | include/vcl/filter/PngImageReader.hxx | 5 | ||||
-rw-r--r-- | include/vcl/gfxlink.hxx | 2 | ||||
-rw-r--r-- | include/vcl/graphicfilter.hxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/sdview3.cxx | 7 | ||||
-rw-r--r-- | vcl/qa/cppunit/BinaryDataContainerTest.cxx | 33 | ||||
-rw-r--r-- | vcl/qa/cppunit/svm/svmtest.cxx | 10 | ||||
-rw-r--r-- | vcl/source/filter/graphicfilter.cxx | 116 | ||||
-rw-r--r-- | vcl/source/filter/ieps/ieps.cxx | 58 | ||||
-rw-r--r-- | vcl/source/filter/ipdf/pdfcompat.cxx | 6 | ||||
-rw-r--r-- | vcl/source/filter/png/PngImageReader.cxx | 31 | ||||
-rw-r--r-- | vcl/source/filter/wmf/wmf.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/TypeSerializer.cxx | 9 | ||||
-rw-r--r-- | vcl/source/gdi/gfxlink.cxx | 10 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/vectorgraphicdata.cxx | 5 | ||||
-rw-r--r-- | vcl/source/graphic/BinaryDataContainer.cxx | 19 |
17 files changed, 127 insertions, 230 deletions
diff --git a/include/vcl/BinaryDataContainer.hxx b/include/vcl/BinaryDataContainer.hxx index b7421e9874c0..e6e13cd340d8 100644 --- a/include/vcl/BinaryDataContainer.hxx +++ b/include/vcl/BinaryDataContainer.hxx @@ -10,7 +10,11 @@ #pragma once +#include <sal/config.h> + +#include <tools/stream.hxx> #include <vcl/dllapi.h> + #include <vector> #include <memory> @@ -26,35 +30,22 @@ private: std::shared_ptr<std::vector<sal_uInt8>> mpData; public: - BinaryDataContainer(); - BinaryDataContainer(const sal_uInt8* pData, size_t nSize); - BinaryDataContainer(std::unique_ptr<std::vector<sal_uInt8>> rData); + BinaryDataContainer() = default; + BinaryDataContainer(SvStream& stream, size_t size); - BinaryDataContainer(const BinaryDataContainer& rBinaryDataContainer) - : mpData(rBinaryDataContainer.mpData) - { - } + BinaryDataContainer(const BinaryDataContainer& rBinaryDataContainer) = default; - BinaryDataContainer(BinaryDataContainer&& rBinaryDataContainer) noexcept - : mpData(std::move(rBinaryDataContainer.mpData)) - { - } + BinaryDataContainer(BinaryDataContainer&& rBinaryDataContainer) noexcept = default; - BinaryDataContainer& operator=(const BinaryDataContainer& rBinaryDataContainer) - { - mpData = rBinaryDataContainer.mpData; - return *this; - } + BinaryDataContainer& operator=(const BinaryDataContainer& rBinaryDataContainer) = default; - BinaryDataContainer& operator=(BinaryDataContainer&& rBinaryDataContainer) noexcept - { - mpData = std::move(rBinaryDataContainer.mpData); - return *this; - } + BinaryDataContainer& operator=(BinaryDataContainer&& rBinaryDataContainer) noexcept = default; size_t getSize() const { return mpData ? mpData->size() : 0; } bool isEmpty() const { return !mpData || mpData->empty(); } const sal_uInt8* getData() const { return mpData ? mpData->data() : nullptr; } + // Returns the data as a stream open for reading + SvMemoryStream getMemoryStream(); size_t calculateHash() const; diff --git a/include/vcl/filter/PngImageReader.hxx b/include/vcl/filter/PngImageReader.hxx index bbb5b7c8d672..34b8279bc654 100644 --- a/include/vcl/filter/PngImageReader.hxx +++ b/include/vcl/filter/PngImageReader.hxx @@ -14,8 +14,10 @@ #include <sal/config.h> #include <memory> +#include <vector> #include <vcl/dllapi.h> +#include <vcl/BinaryDataContainer.hxx> #include <com/sun/star/uno/Reference.hxx> @@ -45,8 +47,7 @@ public: // Returns the contents of the msOG chunk (containing a Gif image), if it exists. // Does not change position in the stream. - static std::unique_ptr<sal_uInt8[]> getMicrosoftGifChunk(SvStream& rStream, - sal_Int32* chunkSize = nullptr); + static BinaryDataContainer getMicrosoftGifChunk(SvStream& rStream); }; } // namespace vcl diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx index 852f418d7ef7..8c0f5fd32b05 100644 --- a/include/vcl/gfxlink.hxx +++ b/include/vcl/gfxlink.hxx @@ -24,7 +24,6 @@ #include <vcl/dllapi.h> #include <vcl/mapmod.hxx> #include <vcl/BinaryDataContainer.hxx> -#include <memory> class SvStream; @@ -72,7 +71,6 @@ private: public: GfxLink(); - explicit GfxLink(std::unique_ptr<sal_uInt8[]> pBuf, sal_uInt32 nBufSize, GfxLinkType nType); explicit GfxLink(BinaryDataContainer aDataConainer, GfxLinkType nType); bool operator==( const GfxLink& ) const; diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index 787439773bc4..fd183b0e0bb3 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -25,6 +25,7 @@ #include <vcl/graph.hxx> #include <comphelper/errcode.hxx> #include <o3tl/typed_flags_set.hxx> +#include <vcl/BinaryDataContainer.hxx> #include <vcl/graphic/GraphicMetadata.hxx> #include <memory> @@ -306,11 +307,11 @@ public: static ErrCode readGIF(SvStream& rStream, Graphic& rGraphic, GfxLinkType& rLinkType); static ErrCode readPNG(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, - std::unique_ptr<sal_uInt8[]> & rpGraphicContent, sal_Int32& rGraphicContentSize); + BinaryDataContainer & rpGraphicContent); static ErrCode readJPEG(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, GraphicFilterImportFlags nImportFlags); static ErrCode readSVG(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, - std::unique_ptr<sal_uInt8[]> & rpGraphicContent, sal_Int32& rGraphicContentSize); + BinaryDataContainer & rpGraphicContent); static ErrCode readXBM(SvStream & rStream, Graphic & rGraphic); static ErrCode readXPM(SvStream & rStream, Graphic & rGraphic); diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 0cbd41b00950..6a1b776f4ead 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -691,13 +691,10 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, Graphic aGraphic; if (vcl::ImportPDF(*xStm, aGraphic)) { - std::unique_ptr<sal_uInt8[]> pGraphicContent; - const sal_Int32 nGraphicContentSize(xStm->Tell()); - pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]); xStm->Seek(0); - xStm->ReadBytes(pGraphicContent.get(), nGraphicContentSize); - aGraphic.SetGfxLink(std::make_shared<GfxLink>(std::move(pGraphicContent), nGraphicContentSize, GfxLinkType::NativePdf)); + BinaryDataContainer aGraphicContent(*xStm, nGraphicContentSize); + aGraphic.SetGfxLink(std::make_shared<GfxLink>(aGraphicContent, GfxLinkType::NativePdf)); InsertGraphic(aGraphic, mnAction, aInsertPos, nullptr, nullptr); bReturn = true; diff --git a/vcl/qa/cppunit/BinaryDataContainerTest.cxx b/vcl/qa/cppunit/BinaryDataContainerTest.cxx index 09bb036d8602..2f72a9d18214 100644 --- a/vcl/qa/cppunit/BinaryDataContainerTest.cxx +++ b/vcl/qa/cppunit/BinaryDataContainerTest.cxx @@ -30,45 +30,34 @@ void BinaryDataContainerTest::testConstruct() { { BinaryDataContainer aContainer; - CPPUNIT_ASSERT_EQUAL(true, aContainer.isEmpty()); + CPPUNIT_ASSERT(aContainer.isEmpty()); CPPUNIT_ASSERT_EQUAL(size_t(0), aContainer.getSize()); } { - std::vector<sal_uInt8> aTestByteArray = { 1, 2, 3, 4 }; - BinaryDataContainer aContainer(aTestByteArray.data(), aTestByteArray.size()); - CPPUNIT_ASSERT_EQUAL(false, aContainer.isEmpty()); + // construct a data array + sal_uInt8 aTestByteArray[] = { 1, 2, 3, 4 }; + SvMemoryStream stream(aTestByteArray, std::size(aTestByteArray), StreamMode::READ); + + BinaryDataContainer aContainer(stream, std::size(aTestByteArray)); + + CPPUNIT_ASSERT(!aContainer.isEmpty()); CPPUNIT_ASSERT_EQUAL(size_t(4), aContainer.getSize()); // Test Copy BinaryDataContainer aCopyOfContainer = aContainer; - CPPUNIT_ASSERT_EQUAL(false, aCopyOfContainer.isEmpty()); + CPPUNIT_ASSERT(!aCopyOfContainer.isEmpty()); CPPUNIT_ASSERT_EQUAL(size_t(4), aCopyOfContainer.getSize()); CPPUNIT_ASSERT_EQUAL(aCopyOfContainer.getData(), aContainer.getData()); // Test Move BinaryDataContainer aMovedInContainer = std::move(aCopyOfContainer); - CPPUNIT_ASSERT_EQUAL(false, aMovedInContainer.isEmpty()); + CPPUNIT_ASSERT(!aMovedInContainer.isEmpty()); CPPUNIT_ASSERT_EQUAL(size_t(4), aMovedInContainer.getSize()); CPPUNIT_ASSERT_EQUAL(aMovedInContainer.getData(), aContainer.getData()); - CPPUNIT_ASSERT_EQUAL(true, aCopyOfContainer.isEmpty()); + CPPUNIT_ASSERT(aCopyOfContainer.isEmpty()); CPPUNIT_ASSERT_EQUAL(size_t(0), aCopyOfContainer.getSize()); } - { - // construct a unique_ptr data array - std::vector<sal_uInt8> aTestByteArray = { 1, 2, 3, 4 }; - auto aConstructionByteArray = std::make_unique<std::vector<sal_uInt8>>(aTestByteArray); - - // remember for later to compare - const sal_uInt8* pInternal = aConstructionByteArray->data(); - - BinaryDataContainer aContainer(std::move(aConstructionByteArray)); - - // make sure the unique_ptr was moved into BinaryDataContainer - CPPUNIT_ASSERT_EQUAL(false, bool(aConstructionByteArray)); - // make sure we didn't copy data into BinaryDataContainer (pointers match) - CPPUNIT_ASSERT_EQUAL(pInternal, aContainer.getData()); - } } } // namespace diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index e8925ffda064..c5ca008b0a9b 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -2190,11 +2190,9 @@ void SvmTest::testEPS() ScopedVclPtrInstance<VirtualDevice> pVirtualDev; setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile); - sal_uInt32 nDataSize = 3; - std::unique_ptr<sal_uInt8[]> pBuffer (new sal_uInt8[nDataSize]); - pBuffer[0] = 'a'; - pBuffer[1] = 'b'; - pBuffer[2] = 'c'; + sal_uInt8 aBuffer[] = { 'a','b','c' }; + SvMemoryStream stream(aBuffer, std::size(aBuffer), StreamMode::READ); + BinaryDataContainer aContainer(stream, std::size(aBuffer)); MapMode aMapMode1(MapUnit::Map100thInch); aMapMode1.SetOrigin(Point(0, 1)); @@ -2208,7 +2206,7 @@ void SvmTest::testEPS() pVirtualDev1->DrawPixel(Point(1, 8)); pVirtualDev1->DrawPixel(Point(2, 7)); - GfxLink aGfxLink(std::move(pBuffer), nDataSize, GfxLinkType::EpsBuffer); + GfxLink aGfxLink(aContainer, GfxLinkType::EpsBuffer); aGfxLink.SetPrefMapMode(aMapMode1); aGfxLink.SetUserId(12345); aGfxLink.SetPrefSize(Size(3, 6)); diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index aab76c8968de..dc7b47598d71 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -664,7 +664,7 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra if (rContext.m_nStatus == ERRCODE_NONE && (rContext.m_eLinkType != GfxLinkType::NONE) && !rContext.m_pGraphic->GetReaderContext()) { - std::unique_ptr<sal_uInt8[]> pGraphicContent; + BinaryDataContainer aGraphicContent; const sal_uInt64 nStreamEnd = rContext.m_pStream->Tell(); sal_Int32 nGraphicContentSize = nStreamEnd - rContext.m_nStreamBegin; @@ -673,22 +673,17 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra { try { - pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]); + rContext.m_pStream->Seek(rContext.m_nStreamBegin); + aGraphicContent = BinaryDataContainer(*rContext.m_pStream, nGraphicContentSize); } catch (const std::bad_alloc&) { rContext.m_nStatus = ERRCODE_GRFILTER_TOOBIG; } - - if (rContext.m_nStatus == ERRCODE_NONE) - { - rContext.m_pStream->Seek(rContext.m_nStreamBegin); - rContext.m_pStream->ReadBytes(pGraphicContent.get(), nGraphicContentSize); - } } if (rContext.m_nStatus == ERRCODE_NONE) - rContext.m_pGraphic->SetGfxLink(std::make_shared<GfxLink>(std::move(pGraphicContent), nGraphicContentSize, rContext.m_eLinkType)); + rContext.m_pGraphic->SetGfxLink(std::make_shared<GfxLink>(aGraphicContent, rContext.m_eLinkType)); } if (rContext.m_nStatus != ERRCODE_NONE) @@ -758,8 +753,7 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size OUString aFilterName = pConfig->GetImportFilterName(nFormat); - std::unique_ptr<sal_uInt8[]> pGraphicContent; - sal_Int32 nGraphicContentSize = 0; + BinaryDataContainer aGraphicContent; // read graphic { @@ -770,8 +764,8 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size else if (aFilterName.equalsIgnoreAsciiCase(IMP_PNG)) { // check if this PNG contains a GIF chunk! - pGraphicContent = vcl::PngImageReader::getMicrosoftGifChunk(rIStream, &nGraphicContentSize); - if( pGraphicContent ) + aGraphicContent = vcl::PngImageReader::getMicrosoftGifChunk(rIStream); + if (!aGraphicContent.isEmpty()) eLinkType = GfxLinkType::NativeGif; else eLinkType = GfxLinkType::NativePng; @@ -802,20 +796,15 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size if (!rIStream.GetError() && nMemoryLength >= 0) { - nGraphicContentSize = nMemoryLength; - pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]); - aMemStream.Seek(STREAM_SEEK_TO_BEGIN); - aMemStream.ReadBytes(pGraphicContent.get(), nGraphicContentSize); + aGraphicContent = BinaryDataContainer(aMemStream, nMemoryLength); bOkay = true; } } else { - nGraphicContentSize = nStreamLength; - pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]); - rIStream.ReadBytes(pGraphicContent.get(), nStreamLength); + aGraphicContent = BinaryDataContainer(rIStream, nStreamLength); bOkay = true; } @@ -843,8 +832,6 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size aFilterName.equalsIgnoreAsciiCase(IMP_WMZ) || aFilterName.equalsIgnoreAsciiCase(IMP_EMZ)) { - nGraphicContentSize = nStreamLength; - pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]); rIStream.Seek(nStreamBegin); if (ZCodec::IsZCompressed(rIStream)) { @@ -857,16 +844,13 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size if (!rIStream.GetError() && nMemoryLength >= 0) { - nGraphicContentSize = nMemoryLength; - pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]); - aMemStream.Seek(STREAM_SEEK_TO_BEGIN); - aMemStream.ReadBytes(pGraphicContent.get(), nGraphicContentSize); + aGraphicContent = BinaryDataContainer(aMemStream, nMemoryLength); } } else { - rIStream.ReadBytes(pGraphicContent.get(), nStreamLength); + aGraphicContent = BinaryDataContainer(rIStream, nStreamLength); } if (!rIStream.GetError()) { @@ -908,26 +892,19 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size if (nStatus == ERRCODE_NONE && eLinkType != GfxLinkType::NONE) { - if (!pGraphicContent) + if (aGraphicContent.isEmpty()) { - nGraphicContentSize = nStreamLength; - - if (nGraphicContentSize > 0) + if (nStreamLength > 0) { try { - pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]); + rIStream.Seek(nStreamBegin); + aGraphicContent = BinaryDataContainer(rIStream, nStreamLength); } catch (const std::bad_alloc&) { nStatus = ERRCODE_GRFILTER_TOOBIG; } - - if (nStatus == ERRCODE_NONE) - { - rIStream.Seek(nStreamBegin); - nGraphicContentSize = rIStream.ReadBytes(pGraphicContent.get(), nGraphicContentSize); - } } } @@ -937,14 +914,14 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size Size aLogicSize; if (eLinkType == GfxLinkType::NativeGif) { - SvMemoryStream aMemoryStream(pGraphicContent.get(), nGraphicContentSize, StreamMode::READ); + SvMemoryStream aMemoryStream(aGraphicContent.getMemoryStream()); bAnimated = IsGIFAnimated(aMemoryStream, aLogicSize); if (!pSizeHint && aLogicSize.getWidth() && aLogicSize.getHeight()) { pSizeHint = &aLogicSize; } } - aGraphic.SetGfxLink(std::make_shared<GfxLink>(std::move(pGraphicContent), nGraphicContentSize, eLinkType)); + aGraphic.SetGfxLink(std::make_shared<GfxLink>(aGraphicContent, eLinkType)); aGraphic.ImplGetImpGraphic()->setPrepared(bAnimated, pSizeHint); } } @@ -969,18 +946,18 @@ ErrCode GraphicFilter::readGIF(SvStream & rStream, Graphic & rGraphic, GfxLinkTy return ERRCODE_GRFILTER_FILTERERROR; } -ErrCode GraphicFilter::readPNG(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, std::unique_ptr<sal_uInt8[]> & rpGraphicContent, - sal_Int32& rGraphicContentSize) +ErrCode GraphicFilter::readPNG(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, BinaryDataContainer& rpGraphicContent) { ErrCode aReturnCode = ERRCODE_NONE; // check if this PNG contains a GIF chunk! - rpGraphicContent = vcl::PngImageReader::getMicrosoftGifChunk(rStream, &rGraphicContentSize); - if( rpGraphicContent ) + if (auto aMSGifChunk = vcl::PngImageReader::getMicrosoftGifChunk(rStream); + !aMSGifChunk.isEmpty()) { - SvMemoryStream aIStrm(rpGraphicContent.get(), rGraphicContentSize, StreamMode::READ); + SvMemoryStream aIStrm(aMSGifChunk.getMemoryStream()); ImportGIF(aIStrm, rGraphic); rLinkType = GfxLinkType::NativeGif; + rpGraphicContent = aMSGifChunk; return aReturnCode; } @@ -1026,8 +1003,7 @@ ErrCode GraphicFilter::readJPEG(SvStream & rStream, Graphic & rGraphic, GfxLinkT return aReturnCode; } -ErrCode GraphicFilter::readSVG(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, std::unique_ptr<sal_uInt8[]> & rpGraphicContent, - sal_Int32& rGraphicContentSize) +ErrCode GraphicFilter::readSVG(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, BinaryDataContainer& rpGraphicContent) { ErrCode aReturnCode = ERRCODE_NONE; @@ -1054,19 +1030,13 @@ ErrCode GraphicFilter::readSVG(SvStream & rStream, Graphic & rGraphic, GfxLinkTy if (!rStream.GetError() && nMemoryLength >= 0) { - auto aNewData = std::make_unique<std::vector<sal_uInt8>>(nMemoryLength); aMemStream.Seek(STREAM_SEEK_TO_BEGIN); - aMemStream.ReadBytes(aNewData->data(), aNewData->size()); + rpGraphicContent = BinaryDataContainer(aMemStream, nMemoryLength); // Make a uncompressed copy for GfxLink - rGraphicContentSize = nMemoryLength; - rpGraphicContent.reset(new sal_uInt8[rGraphicContentSize]); - std::copy(std::cbegin(*aNewData), std::cend(*aNewData), rpGraphicContent.get()); - if (!aMemStream.GetError()) { - BinaryDataContainer aDataContainer(std::move(aNewData)); - auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aDataContainer, VectorGraphicDataType::Svg); + auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(rpGraphicContent, VectorGraphicDataType::Svg); rGraphic = Graphic(aVectorGraphicDataPtr); bOkay = true; } @@ -1074,13 +1044,11 @@ ErrCode GraphicFilter::readSVG(SvStream & rStream, Graphic & rGraphic, GfxLinkTy } else { - auto aNewData = std::make_unique<std::vector<sal_uInt8>>(nStreamLength); - rStream.ReadBytes(aNewData->data(), aNewData->size()); + BinaryDataContainer aNewData(rStream, nStreamLength); if (!rStream.GetError()) { - BinaryDataContainer aDataContainer(std::move(aNewData)); - auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aDataContainer, VectorGraphicDataType::Svg); + auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, VectorGraphicDataType::Svg); rGraphic = Graphic(aVectorGraphicDataPtr); bOkay = true; } @@ -1137,14 +1105,10 @@ ErrCode GraphicFilter::readWMF_EMF(SvStream & rStream, Graphic & rGraphic, GfxLi aNewStream = &aMemStream; } } - auto aNewData = std::make_unique<std::vector<sal_uInt8>>(nStreamLength); - aNewStream->ReadBytes(aNewData->data(), aNewData->size()); + BinaryDataContainer aNewData(*aNewStream, nStreamLength); if (!aNewStream->GetError()) { - const VectorGraphicDataType aDataType(eType); - BinaryDataContainer aDataContainer(std::move(aNewData)); - - auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aDataContainer, aDataType); + auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, eType); rGraphic = Graphic(aVectorGraphicDataPtr); rLinkType = GfxLinkType::NativeWmf; @@ -1332,8 +1296,7 @@ ErrCode GraphicFilter::ImportGraphic(Graphic& rGraphic, std::u16string_view rPat GfxLinkType eLinkType = GfxLinkType::NONE; const bool bLinkSet = rGraphic.IsGfxLink(); - std::unique_ptr<sal_uInt8[]> pGraphicContent; - sal_Int32 nGraphicContentSize = 0; + BinaryDataContainer aGraphicContent; ResetLastError(); @@ -1385,7 +1348,7 @@ ErrCode GraphicFilter::ImportGraphic(Graphic& rGraphic, std::u16string_view rPat } else if (aFilterName.equalsIgnoreAsciiCase(IMP_PNG)) { - nStatus = readPNG(rIStream, rGraphic, eLinkType, pGraphicContent, nGraphicContentSize); + nStatus = readPNG(rIStream, rGraphic, eLinkType, aGraphicContent); } else if (aFilterName.equalsIgnoreAsciiCase(IMP_JPEG)) { @@ -1393,7 +1356,7 @@ ErrCode GraphicFilter::ImportGraphic(Graphic& rGraphic, std::u16string_view rPat } else if (aFilterName.equalsIgnoreAsciiCase(IMP_SVG) || aFilterName.equalsIgnoreAsciiCase(IMP_SVGZ)) { - nStatus = readSVG(rIStream, rGraphic, eLinkType, pGraphicContent, nGraphicContentSize); + nStatus = readSVG(rIStream, rGraphic, eLinkType, aGraphicContent); } else if( aFilterName.equalsIgnoreAsciiCase( IMP_XBM ) ) { @@ -1481,32 +1444,27 @@ ErrCode GraphicFilter::ImportGraphic(Graphic& rGraphic, std::u16string_view rPat if( nStatus == ERRCODE_NONE && ( eLinkType != GfxLinkType::NONE ) && !rGraphic.GetReaderContext() && !bLinkSet ) { - if (!pGraphicContent) + if (aGraphicContent.isEmpty()) { const sal_uInt64 nStreamEnd = rIStream.Tell(); - nGraphicContentSize = nStreamEnd - nStreamBegin; + const sal_uInt64 nGraphicContentSize = nStreamEnd - nStreamBegin; if (nGraphicContentSize > 0) { try { - pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]); + rIStream.Seek(nStreamBegin); + aGraphicContent = BinaryDataContainer(rIStream, nGraphicContentSize); } catch (const std::bad_alloc&) { nStatus = ERRCODE_GRFILTER_TOOBIG; } - - if( nStatus == ERRCODE_NONE ) - { - rIStream.Seek(nStreamBegin); - rIStream.ReadBytes(pGraphicContent.get(), nGraphicContentSize); - } } } if( nStatus == ERRCODE_NONE ) { - rGraphic.SetGfxLink(std::make_shared<GfxLink>(std::move(pGraphicContent), nGraphicContentSize, eLinkType)); + rGraphic.SetGfxLink(std::make_shared<GfxLink>(aGraphicContent, eLinkType)); } } diff --git a/vcl/source/filter/ieps/ieps.cxx b/vcl/source/filter/ieps/ieps.cxx index 57462ccd4dc8..3dbadda9b9bb 100644 --- a/vcl/source/filter/ieps/ieps.cxx +++ b/vcl/source/filter/ieps/ieps.cxx @@ -51,7 +51,7 @@ class FilterConfigItem; |* *************************************************************************/ -static sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, sal_uInt8 const * pDest, size_t nComp, size_t nSize ) +static const sal_uInt8* ImplSearchEntry( const sal_uInt8* pSource, sal_uInt8 const * pDest, size_t nComp, size_t nSize ) { while ( nComp-- >= nSize ) { @@ -70,7 +70,7 @@ static sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, sal_uInt8 const * pDest, // SecurityCount is the buffersize of the buffer in which we will parse for a number -static tools::Long ImplGetNumber(sal_uInt8* &rBuf, sal_uInt32& nSecurityCount) +static tools::Long ImplGetNumber(const sal_uInt8* &rBuf, sal_uInt32& nSecurityCount) { bool bValid = true; bool bNegative = false; @@ -112,7 +112,7 @@ static tools::Long ImplGetNumber(sal_uInt8* &rBuf, sal_uInt32& nSecurityCount) } -static int ImplGetLen( sal_uInt8* pBuf, int nMax ) +static int ImplGetLen(const sal_uInt8* pBuf, int nMax) { int nLen = 0; while( nLen != nMax ) @@ -465,7 +465,7 @@ static void CreateMtfReplacementAction( GDIMetaFile& rMtf, SvStream& rStrm, sal_ } //there is no preview -> make a red box -static void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead, +static void MakePreview(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, tools::Long nWidth, tools::Long nHeight, Graphic &rGraphic) { GDIMetaFile aMtf; @@ -487,7 +487,7 @@ static void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead, OUString aString; int nLen; - sal_uInt8* pDest = ImplSearchEntry( pBuf, reinterpret_cast<sal_uInt8 const *>("%%Title:"), nBytesRead - 32, 8 ); + const sal_uInt8* pDest = ImplSearchEntry( pBuf, reinterpret_cast<sal_uInt8 const *>("%%Title:"), nBytesRead - 32, 8 ); sal_uInt32 nRemainingBytes = pDest ? (nBytesRead - (pDest - pBuf)) : 0; if (nRemainingBytes >= 8) { @@ -501,13 +501,11 @@ static void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead, nLen = ImplGetLen(pDest, std::min<sal_uInt32>(nRemainingBytes, 32)); if (o3tl::make_unsigned(nLen) < nRemainingBytes) { - sal_uInt8 aOldValue(pDest[ nLen ]); pDest[ nLen ] = 0; - if ( strcmp( reinterpret_cast<char*>(pDest), "none" ) != 0 ) + std::string_view chunk(reinterpret_cast<const char*>(pDest), nLen); + if (chunk != "none") { - const char* pStr = reinterpret_cast<char*>(pDest); - aString += " Title:" + OUString(pStr, strlen(pStr), RTL_TEXTENCODING_ASCII_US) + "\n"; + aString += " Title:" + OStringToOUString(chunk, RTL_TEXTENCODING_ASCII_US) + "\n"; } - pDest[ nLen ] = aOldValue; } } pDest = ImplSearchEntry( pBuf, reinterpret_cast<sal_uInt8 const *>("%%Creator:"), nBytesRead - 32, 10 ); @@ -524,10 +522,8 @@ static void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead, nLen = ImplGetLen(pDest, std::min<sal_uInt32>(nRemainingBytes, 32)); if (o3tl::make_unsigned(nLen) < nRemainingBytes) { - sal_uInt8 aOldValue(pDest[nLen]); pDest[nLen] = 0; - const char* pStr = reinterpret_cast<char*>(pDest); - aString += " Creator:" + OUString(pStr, strlen(pStr), RTL_TEXTENCODING_ASCII_US) + "\n"; - pDest[nLen] = aOldValue; + std::string_view chunk(reinterpret_cast<const char*>(pDest), nLen); + aString += " Creator:" + OStringToOUString(chunk, RTL_TEXTENCODING_ASCII_US) + "\n"; } } pDest = ImplSearchEntry( pBuf, reinterpret_cast<sal_uInt8 const *>("%%CreationDate:"), nBytesRead - 32, 15 ); @@ -544,14 +540,11 @@ static void MakePreview(sal_uInt8* pBuf, sal_uInt32 nBytesRead, nLen = ImplGetLen(pDest, std::min<sal_uInt32>(nRemainingBytes, 32)); if (o3tl::make_unsigned(nLen) < nRemainingBytes) { - sal_uInt8 aOldValue(pDest[ nLen ]); pDest[ nLen ] = 0; - if ( strcmp( reinterpret_cast<char*>(pDest), "none" ) != 0 ) + std::string_view chunk(reinterpret_cast<const char*>(pDest), nLen); + if (chunk != "none") { - aString += " CreationDate:" + OUString::createFromAscii( reinterpret_cast<char*>(pDest) ) + "\n"; - const char* pStr = reinterpret_cast<char*>(pDest); - aString += " CreationDate:" + OUString(pStr, strlen(pStr), RTL_TEXTENCODING_ASCII_US) + "\n"; + aString += " CreationDate:" + OStringToOUString(chunk, RTL_TEXTENCODING_ASCII_US) + "\n"; } - pDest[ nLen ] = aOldValue; } } pDest = ImplSearchEntry( pBuf, reinterpret_cast<sal_uInt8 const *>("%%LanguageLevel:"), nBytesRead - 4, 16 ); @@ -649,19 +642,18 @@ bool ImportEpsGraphic( SvStream & rStream, Graphic & rGraphic) } if (bOk) { - std::unique_ptr<sal_uInt8[]> pBuf( new sal_uInt8[ nPSSize ] ); - sal_uInt32 nBufStartPos = rStream.Tell(); - sal_uInt32 nBytesRead = rStream.ReadBytes(pBuf.get(), nPSSize); - if ( nBytesRead == nPSSize ) + BinaryDataContainer aBuf(rStream, nPSSize); + if (!aBuf.isEmpty()) { + sal_uInt32 nBytesRead = aBuf.getSize(); sal_uInt32 nSecurityCount = 32; // if there is no tiff/wmf preview, we will parse for a preview in // the eps prolog if (!bHasPreview && nBytesRead >= nSecurityCount) { - sal_uInt8* pDest = ImplSearchEntry( pBuf.get(), reinterpret_cast<sal_uInt8 const *>("%%BeginPreview:"), nBytesRead - nSecurityCount, 15 ); - sal_uInt32 nRemainingBytes = pDest ? (nBytesRead - (pDest - pBuf.get())) : 0; + const sal_uInt8* pDest = ImplSearchEntry( aBuf.getData(), reinterpret_cast<sal_uInt8 const *>("%%BeginPreview:"), nBytesRead - nSecurityCount, 15 ); + sal_uInt32 nRemainingBytes = pDest ? (nBytesRead - (pDest - aBuf.getData())) : 0; if (nRemainingBytes >= 15) { pDest += 15; @@ -679,7 +671,7 @@ bool ImportEpsGraphic( SvStream & rStream, Graphic & rGraphic) } if (bOk) { - rStream.Seek( nBufStartPos + ( pDest - pBuf.get() ) ); + rStream.Seek( nBufStartPos + ( pDest - aBuf.getData() ) ); vcl::bitmap::RawBitmap aBitmap( Size( nWidth, nHeight ), 24 ); { @@ -766,8 +758,8 @@ bool ImportEpsGraphic( SvStream & rStream, Graphic & rGraphic) } } - sal_uInt8* pDest = ImplSearchEntry( pBuf.get(), reinterpret_cast<sal_uInt8 const *>("%%BoundingBox:"), nBytesRead, 14 ); - sal_uInt32 nRemainingBytes = pDest ? (nBytesRead - (pDest - pBuf.get())) : 0; + const sal_uInt8* pDest = ImplSearchEntry( aBuf.getData(), reinterpret_cast<sal_uInt8 const *>("%%BoundingBox:"), nBytesRead, 14 ); + sal_uInt32 nRemainingBytes = pDest ? (nBytesRead - (pDest - aBuf.getData())) : 0; if (nRemainingBytes >= 14) { pDest += 14; @@ -791,19 +783,19 @@ bool ImportEpsGraphic( SvStream & rStream, Graphic & rGraphic) // if there is no preview -> try with gs to make one if (!bHasPreview && !utl::ConfigManager::IsFuzzing()) { - bHasPreview = RenderAsEMF(pBuf.get(), nBytesRead, aGraphic); + bHasPreview = RenderAsEMF(aBuf.getData(), nBytesRead, aGraphic); if (!bHasPreview) - bHasPreview = RenderAsBMP(pBuf.get(), nBytesRead, aGraphic); + bHasPreview = RenderAsBMP(aBuf.getData(), nBytesRead, aGraphic); } // if there is no preview -> make a red box if( !bHasPreview ) { - MakePreview(pBuf.get(), nBytesRead, nWidth, nHeight, + MakePreview(aBuf.getData(), nBytesRead, nWidth, nHeight, aGraphic); } - GfxLink aGfxLink( std::move(pBuf), nPSSize, GfxLinkType::EpsBuffer ) ; + GfxLink aGfxLink( aBuf, GfxLinkType::EpsBuffer ) ; aMtf.AddAction( static_cast<MetaAction*>( new MetaEPSAction( Point(), Size( nWidth, nHeight ), std::move(aGfxLink), aGraphic.GetGDIMetaFile() ) ) ); CreateMtfReplacementAction( aMtf, rStream, nOrigPos, nPSSize, nPosWMF, nSizeWMF, nPosTIFF, nSizeTIFF ); diff --git a/vcl/source/filter/ipdf/pdfcompat.cxx b/vcl/source/filter/ipdf/pdfcompat.cxx index 62413e585be9..6f431c25130f 100644 --- a/vcl/source/filter/ipdf/pdfcompat.cxx +++ b/vcl/source/filter/ipdf/pdfcompat.cxx @@ -99,14 +99,12 @@ BinaryDataContainer createBinaryDataContainer(SvStream& rStream) const sal_uInt32 nStreamLength = aMemoryStream.TellEnd(); - auto aPdfData = std::make_unique<std::vector<sal_uInt8>>(nStreamLength); - aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN); - aMemoryStream.ReadBytes(aPdfData->data(), aPdfData->size()); + BinaryDataContainer aPdfData(aMemoryStream, nStreamLength); if (aMemoryStream.GetError()) return {}; - return { std::move(aPdfData) }; + return aPdfData; } } // end vcl::filter::ipdf namespace diff --git a/vcl/source/filter/png/PngImageReader.cxx b/vcl/source/filter/png/PngImageReader.cxx index 6a3053a72e12..5b92c351d8d2 100644 --- a/vcl/source/filter/png/PngImageReader.cxx +++ b/vcl/source/filter/png/PngImageReader.cxx @@ -421,12 +421,10 @@ bool reader(SvStream& rStream, BitmapEx& rBitmapEx, return true; } -std::unique_ptr<sal_uInt8[]> getMsGifChunk(SvStream& rStream, sal_Int32* chunkSize) +BinaryDataContainer getMsGifChunk(SvStream& rStream) { - if (chunkSize) - *chunkSize = 0; if (!isPng(rStream)) - return nullptr; + return {}; // It's easier to read manually the contents and find the chunk than // try to get it using libpng. // https://en.wikipedia.org/wiki/Portable_Network_Graphics#File_format @@ -438,7 +436,7 @@ std::unique_ptr<sal_uInt8[]> getMsGifChunk(SvStream& rStream, sal_Int32* chunkSi rStream.ReadUInt32(length); rStream.ReadUInt32(type); if (!rStream.good()) - return nullptr; + return {}; constexpr sal_uInt32 PNGCHUNK_msOG = 0x6d734f47; // Microsoft Office Animated GIF constexpr sal_uInt64 MSGifHeaderSize = 11; // "MSOFFICE9.0" if (type == PNGCHUNK_msOG && length > MSGifHeaderSize) @@ -451,32 +449,30 @@ std::unique_ptr<sal_uInt8[]> getMsGifChunk(SvStream& rStream, sal_Int32* chunkSi sal_uInt32 computedCrc = rtl_crc32(0, &typeForCrc, 4); const sal_uInt64 pos = rStream.Tell(); if (pos + length >= rStream.TellEnd()) - return nullptr; // broken PNG + return {}; // broken PNG char msHeader[MSGifHeaderSize]; if (rStream.ReadBytes(msHeader, MSGifHeaderSize) != MSGifHeaderSize) - return nullptr; + return {}; computedCrc = rtl_crc32(computedCrc, msHeader, MSGifHeaderSize); length -= MSGifHeaderSize; - std::unique_ptr<sal_uInt8[]> chunk(new sal_uInt8[length]); - if (rStream.ReadBytes(chunk.get(), length) != length) - return nullptr; - computedCrc = rtl_crc32(computedCrc, chunk.get(), length); + BinaryDataContainer chunk(rStream, length); + if (chunk.isEmpty()) + return {}; + computedCrc = rtl_crc32(computedCrc, chunk.getData(), chunk.getSize()); rStream.ReadUInt32(crc); if (!ignoreCrc && crc != computedCrc) continue; // invalid chunk, ignore - if (chunkSize) - *chunkSize = length; return chunk; } if (rStream.remainingSize() < length) - return nullptr; + return {}; rStream.SeekRel(length); rStream.ReadUInt32(crc); constexpr sal_uInt32 PNGCHUNK_IEND = 0x49454e44; if (type == PNGCHUNK_IEND) - return nullptr; + return {}; } } #if defined __GNUC__ && __GNUC__ == 8 && !defined __clang__ @@ -501,13 +497,12 @@ BitmapEx PngImageReader::read() return bitmap; } -std::unique_ptr<sal_uInt8[]> PngImageReader::getMicrosoftGifChunk(SvStream& rStream, - sal_Int32* chunkSize) +BinaryDataContainer PngImageReader::getMicrosoftGifChunk(SvStream& rStream) { sal_uInt64 originalPosition = rStream.Tell(); SvStreamEndian originalEndian = rStream.GetEndian(); rStream.SetEndian(SvStreamEndian::BIG); - std::unique_ptr<sal_uInt8[]> chunk = getMsGifChunk(rStream, chunkSize); + auto chunk = getMsGifChunk(rStream); rStream.SetEndian(originalEndian); rStream.Seek(originalPosition); return chunk; diff --git a/vcl/source/filter/wmf/wmf.cxx b/vcl/source/filter/wmf/wmf.cxx index bf91502b426e..c8e4e7d7d9cb 100644 --- a/vcl/source/filter/wmf/wmf.cxx +++ b/vcl/source/filter/wmf/wmf.cxx @@ -42,9 +42,7 @@ bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF ) // Read binary data to mem array const sal_uInt32 nStreamLength(nStreamEnd - nStreamStart); - auto rData = std::make_unique<std::vector<sal_uInt8>>(nStreamLength); - rStream.ReadBytes(rData->data(), rData->size()); - BinaryDataContainer aDataContainer(std::move(rData)); + BinaryDataContainer aDataContainer(rStream, nStreamLength); rStream.Seek(nStreamStart); if (rStream.good()) diff --git a/vcl/source/gdi/TypeSerializer.cxx b/vcl/source/gdi/TypeSerializer.cxx index 0c7b68b8eb1b..83f77bed1379 100644 --- a/vcl/source/gdi/TypeSerializer.cxx +++ b/vcl/source/gdi/TypeSerializer.cxx @@ -124,10 +124,7 @@ void TypeSerializer::readGfxLink(GfxLink& rGfxLink) nDataSize = nRemainingData; } - std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[nDataSize]); - mrStream.ReadBytes(pBuffer.get(), nDataSize); - - rGfxLink = GfxLink(std::move(pBuffer), nDataSize, static_cast<GfxLinkType>(nType)); + rGfxLink = GfxLink(BinaryDataContainer(mrStream, nDataSize), static_cast<GfxLinkType>(nType)); rGfxLink.SetUserId(nUserId); if (bMapAndSizeValid) @@ -282,9 +279,7 @@ void TypeSerializer::readGraphic(Graphic& rGraphic) if (nLength) { - auto rData = std::make_unique<std::vector<sal_uInt8>>(nLength); - mrStream.ReadBytes(rData->data(), rData->size()); - BinaryDataContainer aDataContainer(std::move(rData)); + BinaryDataContainer aDataContainer(mrStream, nLength); if (!mrStream.GetError()) { diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx index 39467b25dc69..c6ca4678b007 100644 --- a/vcl/source/gdi/gfxlink.cxx +++ b/vcl/source/gdi/gfxlink.cxx @@ -36,16 +36,6 @@ GfxLink::GfxLink() { } -GfxLink::GfxLink(std::unique_ptr<sal_uInt8[]> pBuf, sal_uInt32 nSize, GfxLinkType nType) - : meType(nType) - , mnUserId(0) - , maDataContainer(pBuf.get(), nSize) - , maHash(0) - , mbPrefMapModeValid(false) - , mbPrefSizeValid(false) -{ -} - GfxLink::GfxLink(BinaryDataContainer aDataConainer, GfxLinkType nType) : meType(nType) , mnUserId(0) diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 2e1edf1a1a68..67b27461d7d7 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -1619,9 +1619,7 @@ bool ImpGraphic::swapInGraphic(SvStream& rStream) if (nVectorGraphicDataSize) { - auto rData = std::make_unique<std::vector<sal_uInt8>>(nVectorGraphicDataSize); - rStream.ReadBytes(rData->data(), nVectorGraphicDataSize); - BinaryDataContainer aDataContainer(std::move(rData)); + BinaryDataContainer aDataContainer(rStream, nVectorGraphicDataSize); if (rStream.GetError()) return false; diff --git a/vcl/source/gdi/vectorgraphicdata.cxx b/vcl/source/gdi/vectorgraphicdata.cxx index e55cd14784e0..d2a0aa06a682 100644 --- a/vcl/source/gdi/vectorgraphicdata.cxx +++ b/vcl/source/gdi/vectorgraphicdata.cxx @@ -319,12 +319,11 @@ VectorGraphicData::VectorGraphicData( const sal_uInt32 nStmLen(rIStm.remainingSize()); if (nStmLen) { - auto pData = std::make_unique<std::vector<sal_uInt8>>(nStmLen); - rIStm.ReadBytes(pData->data(), pData->size()); + BinaryDataContainer aData(rIStm, nStmLen); if (!rIStm.GetError()) { - maDataContainer = BinaryDataContainer(std::move(pData)); + maDataContainer = aData; } } } diff --git a/vcl/source/graphic/BinaryDataContainer.cxx b/vcl/source/graphic/BinaryDataContainer.cxx index 339d28d601d0..af6e5968911c 100644 --- a/vcl/source/graphic/BinaryDataContainer.cxx +++ b/vcl/source/graphic/BinaryDataContainer.cxx @@ -11,17 +11,11 @@ #include <vcl/BinaryDataContainer.hxx> #include <o3tl/hash_combine.hxx> -BinaryDataContainer::BinaryDataContainer() = default; - -BinaryDataContainer::BinaryDataContainer(const sal_uInt8* pData, size_t nSize) - : mpData(std::make_shared<std::vector<sal_uInt8>>(nSize)) -{ - std::copy(pData, pData + nSize, mpData->data()); -} - -BinaryDataContainer::BinaryDataContainer(std::unique_ptr<std::vector<sal_uInt8>> aData) - : mpData(std::shared_ptr<std::vector<sal_uInt8>>(aData.release(), aData.get_deleter())) +BinaryDataContainer::BinaryDataContainer(SvStream& stream, size_t size) { + auto pBuffer = std::make_shared<std::vector<sal_uInt8>>(size); + if (stream.ReadBytes(pBuffer->data(), pBuffer->size()) == size) + mpData = std::move(pBuffer); } size_t BinaryDataContainer::calculateHash() const @@ -33,4 +27,9 @@ size_t BinaryDataContainer::calculateHash() const return nSeed; } +SvMemoryStream BinaryDataContainer::getMemoryStream() +{ + return SvMemoryStream(mpData ? mpData->data() : nullptr, getSize(), StreamMode::READ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |