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:
committed by
Ashod Nakashian
parent
eb581eff6a
commit
5c5ab9c129
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user