[Libreoffice-commits] core.git: include/vcl vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 12 12:46:47 UTC 2021
include/vcl/metaact.hxx | 4 ++--
vcl/source/filter/svm/SvmReader.cxx | 3 +--
vcl/source/gdi/metaact.cxx | 8 ++------
3 files changed, 5 insertions(+), 10 deletions(-)
New commits:
commit 1a9ca0179e51e96e495c88f262a111a2a5f4c740
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jul 11 19:38:23 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jul 12 14:46:12 2021 +0200
move the existing std::unique_ptr<tools::Long[]> rather than duplicating it
Change-Id: I8686fc15254f922b1963eb86151c6aa770c2d578
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118758
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
index d43e646811fa..68c16b978fa7 100644
--- a/include/vcl/metaact.hxx
+++ b/include/vcl/metaact.hxx
@@ -562,12 +562,12 @@ public:
const OUString& GetText() const { return maStr; }
sal_Int32 GetIndex() const { return mnIndex; }
sal_Int32 GetLen() const { return mnLen; }
- tools::Long* GetDXArray() const { return mpDXAry.get(); }
+ tools::Long* GetDXArray() const { return mpDXAry.get(); }
void SetPoint(Point& rPt) { maStartPt = rPt; }
void SetText(OUString& rStr) { maStr = rStr; }
void SetIndex(sal_Int32 rIndex) { mnIndex = rIndex; }
void SetLen(sal_Int32 rLen) { mnLen = rLen; }
- void SetDXArray(tools::Long* rDXAry, sal_Int32 nAryLen);
+ void SetDXArray(std::unique_ptr<tools::Long[]> aArray);
};
class SAL_DLLPUBLIC_RTTI MetaStretchTextAction final : public MetaAction
diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx
index 815ddae52a38..c51b0cd3815f 100644
--- a/vcl/source/filter/svm/SvmReader.cxx
+++ b/vcl/source/filter/svm/SvmReader.cxx
@@ -739,8 +739,7 @@ rtl::Reference<MetaAction> SvmReader::TextArrayHandler(ImplMetaReadData* pData)
}
}
- if (aArray)
- pAction->SetDXArray(aArray.get(), nTmpLen);
+ pAction->SetDXArray(std::move(aArray));
return pAction;
}
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 2348db306853..d5e4cc81bb94 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -1242,13 +1242,9 @@ void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
}
}
-void MetaTextArrayAction::SetDXArray(tools::Long* pDXAry, sal_Int32 nAryLen)
+void MetaTextArrayAction::SetDXArray(std::unique_ptr<tools::Long[]> aArray)
{
- if (nAryLen > 0)
- {
- mpDXAry.reset( new tools::Long[ nAryLen ] );
- memcpy( mpDXAry.get(), pDXAry, nAryLen * sizeof(tools::Long) );
- }
+ mpDXAry = std::move(aArray);
}
MetaStretchTextAction::MetaStretchTextAction() :
More information about the Libreoffice-commits
mailing list