summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-01-10 19:58:20 +0000
committerMichael Stahl <michael.stahl@allotropia.de>2022-01-12 11:08:13 +0100
commitf5e2f6ea32359cb2ad793c5ed844a00456786dd0 (patch)
tree761ce0dfaa92be94c0246df321803803cdbb41c0 /lotuswordpro
parent55cf4a8acc4e25c6198742bb3e04c3c630a3c0b4 (diff)
ofz#43509 use std::vector and at()
Change-Id: Id0c5e4ccc22b41caee95ca5f53f6ae7cf70490f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128238 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwpdrawobj.cxx40
-rw-r--r--lotuswordpro/source/filter/lwpsdwdrawheader.hxx4
2 files changed, 18 insertions, 26 deletions
diff --git a/lotuswordpro/source/filter/lwpdrawobj.cxx b/lotuswordpro/source/filter/lwpdrawobj.cxx
index 89eaf1c0a255..6806f68a95dc 100644
--- a/lotuswordpro/source/filter/lwpdrawobj.cxx
+++ b/lotuswordpro/source/filter/lwpdrawobj.cxx
@@ -1128,16 +1128,8 @@ LwpDrawTextArt::LwpDrawTextArt(SvStream* pStream, DrawingOffsetAndScale* pTransD
LwpDrawTextArt::~LwpDrawTextArt()
{
- if (m_aTextArtRec.aPath[0].pPts)
- {
- delete [] m_aTextArtRec.aPath[0].pPts;
- m_aTextArtRec.aPath[0].pPts = nullptr;
- }
- if (m_aTextArtRec.aPath[1].pPts)
- {
- delete [] m_aTextArtRec.aPath[1].pPts;
- m_aTextArtRec.aPath[1].pPts = nullptr;
- }
+ m_aTextArtRec.aPath[0].aPts.clear();
+ m_aTextArtRec.aPath[1].aPts.clear();
if (m_aTextArtRec.pTextString)
{
delete [] m_aTextArtRec.pTextString;
@@ -1149,8 +1141,8 @@ LwpDrawTextArt::~LwpDrawTextArt()
void LwpDrawTextArt::CreateFWPath(XFDrawPath* pPath)
{
sal_Int16 nX, nY;
- nX = (m_aTextArtRec.aPath[0].pPts[0].x + m_aTextArtRec.aPath[1].pPts[0].x) / 2;
- nY = (m_aTextArtRec.aPath[0].pPts[0].y + m_aTextArtRec.aPath[1].pPts[0].y) / 2;
+ nX = (m_aTextArtRec.aPath[0].aPts[0].x + m_aTextArtRec.aPath[1].aPts[0].x) / 2;
+ nY = (m_aTextArtRec.aPath[0].aPts[0].y + m_aTextArtRec.aPath[1].aPts[0].y) / 2;
XFPoint aStart(static_cast<double>(nX)/TWIPS_PER_CM * m_pTransData->fScaleX,
static_cast<double>(nY)/TWIPS_PER_CM * m_pTransData->fScaleY);
pPath->MoveTo(aStart);
@@ -1158,20 +1150,20 @@ void LwpDrawTextArt::CreateFWPath(XFDrawPath* pPath)
sal_uInt8 nPtIndex = 1;
for (sal_uInt16 nC = 1; nC <= m_aTextArtRec.aPath[0].n; nC++)
{
- nX = (m_aTextArtRec.aPath[0].pPts[nPtIndex].x + m_aTextArtRec.aPath[1].pPts[nPtIndex].x) / 2;
- nY = (m_aTextArtRec.aPath[0].pPts[nPtIndex].y + m_aTextArtRec.aPath[1].pPts[nPtIndex].y) / 2;
+ nX = (m_aTextArtRec.aPath[0].aPts.at(nPtIndex).x + m_aTextArtRec.aPath[1].aPts.at(nPtIndex).x) / 2;
+ nY = (m_aTextArtRec.aPath[0].aPts.at(nPtIndex).y + m_aTextArtRec.aPath[1].aPts.at(nPtIndex).y) / 2;
XFPoint aCtrl1(static_cast<double>(nX)/TWIPS_PER_CM * m_pTransData->fScaleX,
static_cast<double>(nY)/TWIPS_PER_CM * m_pTransData->fScaleY);
nPtIndex++;
- nX = (m_aTextArtRec.aPath[0].pPts[nPtIndex].x + m_aTextArtRec.aPath[1].pPts[nPtIndex].x) / 2;
- nY = (m_aTextArtRec.aPath[0].pPts[nPtIndex].y + m_aTextArtRec.aPath[1].pPts[nPtIndex].y) / 2;
+ nX = (m_aTextArtRec.aPath[0].aPts.at(nPtIndex).x + m_aTextArtRec.aPath[1].aPts.at(nPtIndex).x) / 2;
+ nY = (m_aTextArtRec.aPath[0].aPts.at(nPtIndex).y + m_aTextArtRec.aPath[1].aPts.at(nPtIndex).y) / 2;
XFPoint aCtrl2(static_cast<double>(nX)/TWIPS_PER_CM * m_pTransData->fScaleX,
static_cast<double>(nY)/TWIPS_PER_CM * m_pTransData->fScaleY);
nPtIndex++;
- nX = (m_aTextArtRec.aPath[0].pPts[nPtIndex].x + m_aTextArtRec.aPath[1].pPts[nPtIndex].x) / 2;
- nY = (m_aTextArtRec.aPath[0].pPts[nPtIndex].y + m_aTextArtRec.aPath[1].pPts[nPtIndex].y) / 2;
+ nX = (m_aTextArtRec.aPath[0].aPts.at(nPtIndex).x + m_aTextArtRec.aPath[1].aPts.at(nPtIndex).x) / 2;
+ nY = (m_aTextArtRec.aPath[0].aPts.at(nPtIndex).y + m_aTextArtRec.aPath[1].aPts.at(nPtIndex).y) / 2;
XFPoint aDest(static_cast<double>(nX)/TWIPS_PER_CM * m_pTransData->fScaleX,
static_cast<double>(nY)/TWIPS_PER_CM * m_pTransData->fScaleY);
@@ -1202,13 +1194,13 @@ void LwpDrawTextArt::Read()
throw BadRead();
m_aTextArtRec.aPath[0].n = nPointNumber;
- m_aTextArtRec.aPath[0].pPts = new SdwPoint[nPoints];
+ m_aTextArtRec.aPath[0].aPts.resize(nPoints);
for (size_t nPt = 0; nPt < nPoints; ++nPt)
{
m_pStream->ReadInt16( nX );
m_pStream->ReadInt16( nY );
- m_aTextArtRec.aPath[0].pPts[nPt].x = nX;
- m_aTextArtRec.aPath[0].pPts[nPt].y = nY;
+ m_aTextArtRec.aPath[0].aPts[nPt].x = nX;
+ m_aTextArtRec.aPath[0].aPts[nPt].y = nY;
}
m_pStream->ReadUInt16( nPointNumber );
@@ -1218,13 +1210,13 @@ void LwpDrawTextArt::Read()
throw BadRead();
m_aTextArtRec.aPath[1].n = nPointNumber;
- m_aTextArtRec.aPath[1].pPts = new SdwPoint[nPoints];
+ m_aTextArtRec.aPath[1].aPts.resize(nPoints);
for (size_t nPt = 0; nPt < nPoints; ++nPt)
{
m_pStream->ReadInt16( nX );
m_pStream->ReadInt16( nY );
- m_aTextArtRec.aPath[1].pPts[nPt].x = nX;
- m_aTextArtRec.aPath[1].pPts[nPt].y = nY;
+ m_aTextArtRec.aPath[1].aPts[nPt].x = nX;
+ m_aTextArtRec.aPath[1].aPts[nPt].y = nY;
}
m_pStream->SeekRel(1);
diff --git a/lotuswordpro/source/filter/lwpsdwdrawheader.hxx b/lotuswordpro/source/filter/lwpsdwdrawheader.hxx
index 13696f453a74..85318afbfb19 100644
--- a/lotuswordpro/source/filter/lwpsdwdrawheader.hxx
+++ b/lotuswordpro/source/filter/lwpsdwdrawheader.hxx
@@ -64,6 +64,7 @@
#include <config_lgpl.h>
#include <sal/types.h>
+#include <vector>
const sal_uInt8 DRAW_FACESIZE = 32;
const double THRESHOLD = 0.0001;
@@ -288,10 +289,9 @@ struct SdwTextBoxRecord
struct SdwFMPATH
{
sal_uInt16 n;
- SdwPoint* pPts;
+ std::vector<SdwPoint> aPts;
SdwFMPATH()
: n(0)
- , pPts(nullptr)
{
}
};