pdfium: Returning a const std::shared_ptr<...>& is not recommended.

Change-Id: Iff6acef712c5b95c8cc222fc5293c9304b1c03ec
(cherry picked from commit c0a3f61ef5c42d6cfa7484a2c759e7638da2c096)
Reviewed-on: https://gerrit.libreoffice.org/77692
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Jan Holesovsky
2019-08-25 13:42:52 +02:00
committed by Ashod Nakashian
parent eb581eff6a
commit 5c5ab9c129
8 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -202,7 +202,7 @@ public:
GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const;
bool isEmbeddedPdfData() const;
std::shared_ptr<std::vector<sal_Int8>> const & getEmbeddedPdfData() const;
std::shared_ptr<std::vector<sal_Int8>> const getEmbeddedPdfData() const;
/// Returns the page number of the embedded data (typically to re-render or import it).
sal_Int32 getEmbeddedPageNumber() const;
+1 -1
View File
@@ -224,7 +224,7 @@ public:
const VectorGraphicDataPtr& getVectorGraphicData() const;
void setPdfData(const std::shared_ptr<std::vector<sal_Int8>>& rPdfData);
const std::shared_ptr<std::vector<sal_Int8>>& getPdfData() const;
std::shared_ptr<std::vector<sal_Int8>> getPdfData() const;
bool hasPdfData() const;
/// Set the page number of the multi-page source this Graphic is rendered from.
+1 -1
View File
@@ -907,7 +907,7 @@ bool SdrGrafObj::isEmbeddedPdfData() const
return mpGraphicObject->GetGraphic().hasPdfData();
}
std::shared_ptr<std::vector<sal_Int8>> const & SdrGrafObj::getEmbeddedPdfData() const
std::shared_ptr<std::vector<sal_Int8>> const SdrGrafObj::getEmbeddedPdfData() const
{
return mpGraphicObject->GetGraphic().getPdfData();
}
+1 -1
View File
@@ -760,7 +760,7 @@ OUString SvXMLGraphicHelper::implSaveGraphic(css::uno::Reference<css::graphic::X
std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(aStream.xStream));
if (bUseGfxLink && aGfxLink.GetDataSize() && aGfxLink.GetData())
{
const std::shared_ptr<std::vector<sal_Int8>>& rPdfData = aGraphic.getPdfData();
const std::shared_ptr<std::vector<sal_Int8>> rPdfData = aGraphic.getPdfData();
if (rPdfData && !rPdfData->empty())
{
// See if we have this PDF already, and avoid duplicate storage.
+1 -1
View File
@@ -185,7 +185,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
SfxMedium aMedium(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::WRITE|StreamMode::SHARE_DENYNONE|StreamMode::TRUNC);
if (SvStream* pOutStream = aMedium.GetOutStream())
{
const std::shared_ptr<std::vector<sal_Int8>>& rPdfData = rGraphic.getPdfData();
const std::shared_ptr<std::vector<sal_Int8>> rPdfData(rGraphic.getPdfData());
pOutStream->WriteBytes(rPdfData->data(), rPdfData->size());
aMedium.Commit();
if (!aMedium.GetError())
+1 -1
View File
@@ -227,7 +227,7 @@ private:
const VectorGraphicDataPtr& getVectorGraphicData() const;
const std::shared_ptr<std::vector<sal_Int8>>& getPdfData() const;
std::shared_ptr<std::vector<sal_Int8>> getPdfData() const;
void setPdfData(const std::shared_ptr<std::vector<sal_Int8>>& rPdfData);
+2 -2
View File
@@ -553,14 +553,14 @@ void Graphic::setPdfData(const std::shared_ptr<std::vector<sal_Int8>>& rPdfData)
mxImpGraphic->setPdfData(rPdfData);
}
const std::shared_ptr<std::vector<sal_Int8>>& Graphic::getPdfData() const
std::shared_ptr<std::vector<sal_Int8>> Graphic::getPdfData() const
{
return mxImpGraphic->getPdfData();
}
bool Graphic::hasPdfData() const
{
std::shared_ptr<std::vector<sal_Int8>> pPdfData = getPdfData();
std::shared_ptr<std::vector<sal_Int8>> pPdfData(getPdfData());
return pPdfData && !pPdfData->empty();
}
+1 -1
View File
@@ -477,7 +477,7 @@ void ImpGraphic::setPdfData(const std::shared_ptr<std::vector<sal_Int8>>& rPdfDa
mpPdfData = rPdfData;
}
const std::shared_ptr<std::vector<sal_Int8>>& ImpGraphic::getPdfData() const
std::shared_ptr<std::vector<sal_Int8>> ImpGraphic::getPdfData() const
{
ensureAvailable();