[Libreoffice-commits] core.git: 9 commits - cui/source sc/source svx/source sw/source vcl/source
Caolán McNamara
caolanm at redhat.com
Fri Jun 23 09:56:16 UTC 2017
cui/source/options/optgdlg.cxx | 22 +++++++++++------
sc/source/core/tool/interpr4.cxx | 5 ++--
svx/source/dialog/hdft.cxx | 1
sw/source/uibase/dochdl/gloshdl.cxx | 3 ++
vcl/source/filter/sgvmain.cxx | 45 ++++++++++++++++++++----------------
vcl/source/filter/sgvmain.hxx | 17 ++++++-------
vcl/source/filter/sgvtext.cxx | 4 +--
vcl/source/window/errinf.cxx | 7 ++++-
8 files changed, 61 insertions(+), 43 deletions(-)
New commits:
commit 40c9ebbb6fbba3fbb70ae652acd53928d8f26803
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 23 10:10:20 2017 +0100
convert to std::vector
Change-Id: I37a866f4248ad6441cb73b826c13b3602b96e03a
diff --git a/vcl/source/filter/sgvmain.cxx b/vcl/source/filter/sgvmain.cxx
index 35cade1d954a..63d756aaf5ef 100644
--- a/vcl/source/filter/sgvmain.cxx
+++ b/vcl/source/filter/sgvmain.cxx
@@ -782,11 +782,11 @@ void DrawObjkList( SvStream& rInp, OutputDevice& rOut )
SAL_WARN("vcl", "file is shorter than requested len");
nSize = nRemainingSize;
}
- UCHAR *pBuffer = new UCHAR[nSize+1]; // add one for LookAhead at CK-separation
- size_t nReadSize = rInp.ReadBytes(pBuffer, nSize);
- pBuffer[nReadSize] = 0;
- if (!rInp.GetError() && nReadSize == aText.BufSize) aText.Draw(rOut, pBuffer);
- delete[] pBuffer;
+ std::vector<UCHAR> aBuffer(nSize+1); // add one for LookAhead at CK-separation
+ size_t nReadSize = rInp.ReadBytes(aBuffer.data(), nSize);
+ aBuffer[nReadSize] = 0;
+ if (!rInp.GetError() && nReadSize == aText.BufSize)
+ aText.Draw(rOut, aBuffer.data());
}
} break;
case ObjBmap: {
commit ce45dcf8d7ae0b41e898850090cc2ad4fdc0bfd4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 23 10:06:32 2017 +0100
coverity#1412987 Untrusted value as argument
Change-Id: Ia41c81d7cf864a5b38594b85577139bdaf5fc7bb
diff --git a/vcl/source/filter/sgvmain.cxx b/vcl/source/filter/sgvmain.cxx
index 8fb9f0529aa8..35cade1d954a 100644
--- a/vcl/source/filter/sgvmain.cxx
+++ b/vcl/source/filter/sgvmain.cxx
@@ -775,9 +775,17 @@ void DrawObjkList( SvStream& rInp, OutputDevice& rOut )
TextType aText;
ReadTextType( rInp, aText );
if (!rInp.GetError()) {
- UCHAR *pBuffer = new UCHAR[aText.BufSize+1]; // add one for LookAhead at CK-separation
- rInp.ReadBytes(pBuffer, aText.BufSize);
- if (!rInp.GetError()) aText.Draw(rOut, pBuffer);
+ const size_t nRemainingSize = rInp.remainingSize();
+ size_t nSize = aText.BufSize;
+ if (nSize > nRemainingSize)
+ {
+ SAL_WARN("vcl", "file is shorter than requested len");
+ nSize = nRemainingSize;
+ }
+ UCHAR *pBuffer = new UCHAR[nSize+1]; // add one for LookAhead at CK-separation
+ size_t nReadSize = rInp.ReadBytes(pBuffer, nSize);
+ pBuffer[nReadSize] = 0;
+ if (!rInp.GetError() && nReadSize == aText.BufSize) aText.Draw(rOut, pBuffer);
delete[] pBuffer;
}
} break;
commit 75ab9e5cf8e23639f1d7d38e9a8279ac702dca3a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 23 09:53:13 2017 +0100
move pBuffer out of class
Change-Id: I88120530b21ebe72796ddee39c2446a70c3fd193
diff --git a/vcl/source/filter/sgvmain.cxx b/vcl/source/filter/sgvmain.cxx
index c7a8576f2890..8fb9f0529aa8 100644
--- a/vcl/source/filter/sgvmain.cxx
+++ b/vcl/source/filter/sgvmain.cxx
@@ -303,7 +303,6 @@ SvStream& ReadTextType(SvStream& rInp, TextType& rText)
rInp.ReadInt16(rText.FitBreit);
assert(rInp.GetError() || rInp.Tell() == nOldPos + TextSize);
(void) nOldPos;
- rText.Buffer=nullptr;
return rInp;
}
SvStream& ReadBmapType(SvStream& rInp, BmapType& rBmap)
@@ -405,11 +404,11 @@ void SetArea(ObjAreaType& rArea, OutputDevice& rOut)
rOut.SetFillColor( Sgv2SvFarbe( rArea.FFarbe,rArea.FBFarbe,rArea.FIntens ) );
}
-void ObjkType::Draw(OutputDevice&)
+void ObjkType::Draw(OutputDevice&, UCHAR *)
{
}
-void StrkType::Draw(OutputDevice& rOut)
+void StrkType::Draw(OutputDevice& rOut, UCHAR *)
{
SetLine(L,rOut);
rOut.DrawLine(Point(Pos1.x,Pos1.y),Point(Pos2.x,Pos2.y)); // !!!
@@ -508,7 +507,7 @@ void DrawSlideRect(sal_Int16 x1, sal_Int16 y1, sal_Int16 x2, sal_Int16 y2, ObjAr
}
}
-void RectType::Draw(OutputDevice& rOut)
+void RectType::Draw(OutputDevice& rOut, UCHAR *)
{
if (L.LMuster!=0) L.LMuster=1; // no line separator here, only on or off
SetArea(F,rOut);
@@ -543,7 +542,7 @@ void RectType::Draw(OutputDevice& rOut)
}
}
-void PolyType::Draw(OutputDevice& rOut)
+void PolyType::Draw(OutputDevice& rOut, UCHAR *)
{
if ((Flags & PolyClosBit) !=0) SetArea(F,rOut);
SetLine(L,rOut);
@@ -557,7 +556,7 @@ void PolyType::Draw(OutputDevice& rOut)
}
}
-void SplnType::Draw(OutputDevice& rOut)
+void SplnType::Draw(OutputDevice& rOut, UCHAR *)
{
if ((Flags & PolyClosBit) !=0) SetArea(F,rOut);
SetLine(L,rOut);
@@ -660,7 +659,7 @@ void DrawSlideCirc(sal_Int16 cx, sal_Int16 cy, sal_Int16 rx, sal_Int16 ry, ObjAr
}
}
-void CircType::Draw(OutputDevice& rOut)
+void CircType::Draw(OutputDevice& rOut, UCHAR *)
{
tools::Rectangle aRect(Center.x-Radius.x,Center.y-Radius.y,Center.x+Radius.x,Center.y+Radius.y);
@@ -711,7 +710,7 @@ void CircType::Draw(OutputDevice& rOut)
}
}
-void BmapType::Draw(OutputDevice& rOut)
+void BmapType::Draw(OutputDevice& rOut, UCHAR *)
{
//ifstream aInp;
sal_uInt16 nVersion;
@@ -769,24 +768,24 @@ void DrawObjkList( SvStream& rInp, OutputDevice& rOut )
ReadObjkType( rInp, aObjk );
if (!rInp.GetError()) {
switch(aObjk.Art) {
- case ObjStrk: { StrkType aStrk; ReadStrkType( rInp, aStrk ); if (!rInp.GetError()) aStrk.Draw(rOut); } break;
- case ObjRect: { RectType aRect; ReadRectType( rInp, aRect ); if (!rInp.GetError()) aRect.Draw(rOut); } break;
- case ObjCirc: { CircType aCirc; ReadCircType( rInp, aCirc ); if (!rInp.GetError()) aCirc.Draw(rOut); } break;
+ case ObjStrk: { StrkType aStrk; ReadStrkType( rInp, aStrk ); if (!rInp.GetError()) aStrk.Draw(rOut, nullptr); } break;
+ case ObjRect: { RectType aRect; ReadRectType( rInp, aRect ); if (!rInp.GetError()) aRect.Draw(rOut, nullptr); } break;
+ case ObjCirc: { CircType aCirc; ReadCircType( rInp, aCirc ); if (!rInp.GetError()) aCirc.Draw(rOut, nullptr); } break;
case ObjText: {
TextType aText;
ReadTextType( rInp, aText );
if (!rInp.GetError()) {
- aText.Buffer=new UCHAR[aText.BufSize+1]; // add one for LookAhead at CK-separation
- rInp.ReadBytes(aText.Buffer, aText.BufSize);
- if (!rInp.GetError()) aText.Draw(rOut);
- delete[] aText.Buffer;
+ UCHAR *pBuffer = new UCHAR[aText.BufSize+1]; // add one for LookAhead at CK-separation
+ rInp.ReadBytes(pBuffer, aText.BufSize);
+ if (!rInp.GetError()) aText.Draw(rOut, pBuffer);
+ delete[] pBuffer;
}
} break;
case ObjBmap: {
BmapType aBmap;
ReadBmapType( rInp, aBmap );
if (!rInp.GetError()) {
- aBmap.Draw(rOut);
+ aBmap.Draw(rOut, nullptr);
}
} break;
case ObjPoly: {
@@ -799,7 +798,7 @@ void DrawObjkList( SvStream& rInp, OutputDevice& rOut )
rInp.ReadInt16(aPoly.EckP[i].x);
rInp.ReadInt16(aPoly.EckP[i].y);
}
- if (!rInp.GetError()) aPoly.Draw(rOut);
+ if (!rInp.GetError()) aPoly.Draw(rOut, nullptr);
delete[] aPoly.EckP;
}
} break;
@@ -813,7 +812,7 @@ void DrawObjkList( SvStream& rInp, OutputDevice& rOut )
rInp.ReadInt16(aSpln.EckP[i].x);
rInp.ReadInt16(aSpln.EckP[i].y);
}
- if (!rInp.GetError()) aSpln.Draw(rOut);
+ if (!rInp.GetError()) aSpln.Draw(rOut, nullptr);
delete[] aSpln.EckP;
}
} break;
@@ -826,7 +825,7 @@ void DrawObjkList( SvStream& rInp, OutputDevice& rOut )
}
} break;
default: {
- aObjk.Draw(rOut); // object name on 2. Screen
+ aObjk.Draw(rOut, nullptr); // object name on 2. Screen
ObjkOverSeek(rInp,aObjk); // to next object
}
}
diff --git a/vcl/source/filter/sgvmain.hxx b/vcl/source/filter/sgvmain.hxx
index d15ffc6e6280..83fa65000ac7 100644
--- a/vcl/source/filter/sgvmain.hxx
+++ b/vcl/source/filter/sgvmain.hxx
@@ -155,7 +155,7 @@ public:
{
}
virtual ~ObjkType() {}
- virtual void Draw(OutputDevice& rOut);
+ virtual void Draw(OutputDevice& rOut, UCHAR *pBuffer);
};
#define StrkSize 38
@@ -167,7 +167,7 @@ public:
PointType Pos1; // start point
PointType Pos2; // end point
friend SvStream& ReadStrkType(SvStream& rIStream, StrkType& rStrk);
- virtual void Draw(OutputDevice& rOut) override;
+ virtual void Draw(OutputDevice& rOut, UCHAR *pBuffer) override;
};
#define RectSize 52
@@ -183,7 +183,7 @@ public:
sal_uInt16 RotationAngle; // 315...<45
sal_uInt16 Slant; // >270...<90
friend SvStream& ReadRectType(SvStream& rIStream, RectType& rRect);
- virtual void Draw(OutputDevice& rOut) override;
+ virtual void Draw(OutputDevice& rOut, UCHAR *pBuffer) override;
};
#define PolySize 44
@@ -198,7 +198,7 @@ public:
sal_uInt32 SD_EckP; // pointer to corner point (StarDraw)
PointType* EckP; // pointer to corner points (StarView (is not read from disk!))
friend SvStream& ReadPolyType(SvStream& rIStream, PolyType& rPoly);
- virtual void Draw(OutputDevice& rOut) override;
+ virtual void Draw(OutputDevice& rOut, UCHAR *pBuffer) override;
};
#define PolyClosBit 0x01 // kinds of Poly: 0: polyLine 1: polygon
@@ -214,7 +214,7 @@ public:
sal_uInt32 SD_EckP; // pointer to corner points (StarDraw)
PointType* EckP; // pointer to corner points (StarView (is not read from disk!))
friend SvStream& ReadSplnType(SvStream& rIStream, SplnType& rSpln);
- virtual void Draw(OutputDevice& rOut) override;
+ virtual void Draw(OutputDevice& rOut, UCHAR *pBuffer) override;
};
// kinds of Spline: see Poly
@@ -231,7 +231,7 @@ public:
sal_uInt16 StartAngle; // and not for full circles
sal_uInt16 RelAngle; // and full ellipses
friend SvStream& ReadCircType(SvStream& rIStream, CircType& rCirc);
- virtual void Draw(OutputDevice& rOut) override;
+ virtual void Draw(OutputDevice& rOut, UCHAR *pBuffer) override;
};
#define CircFull 0x00 /* kinds of circle: 0: full circle */
#define CircSect 0x01 /* 1: circle sector */
@@ -254,9 +254,8 @@ public:
sal_uInt16 ExtLo,ExtHi; // (Ptr) text over more frames << ShortArr, otherwise DWord-Align needed
PointType FitSize; // size of origin for Fit2Size
sal_Int16 FitBreit; // width to format for Fit2Size
- UCHAR* Buffer; // this variable is not set by reading from disk, but explicit!
friend SvStream& ReadTextType(SvStream& rIStream, TextType& rText);
- virtual void Draw(OutputDevice& rOut) override;
+ virtual void Draw(OutputDevice& rOut, UCHAR *pBuffer) override;
};
#define TextOutlBit 0x01 /* 1=Sourcecode for outliner (ignored byDrawObject()) */
#define TextFitSBit 0x02 /* Bit1: 1=Text-Fit2Size, also outliner (2.0) */
@@ -301,7 +300,7 @@ public:
}
friend SvStream& ReadBmapType(SvStream& rIStream, BmapType& rBmap);
- virtual void Draw(OutputDevice& rOut) override;
+ virtual void Draw(OutputDevice& rOut, UCHAR *pBuffer) override;
};
#define GrupSize 48
diff --git a/vcl/source/filter/sgvtext.cxx b/vcl/source/filter/sgvtext.cxx
index dfc2e0a7a8a9..282766a2ae52 100644
--- a/vcl/source/filter/sgvtext.cxx
+++ b/vcl/source/filter/sgvtext.cxx
@@ -862,7 +862,7 @@ void DrawChar(OutputDevice& rOut, UCHAR c, ObjTextType T, PointType Pos, sal_uIn
rOut.DrawText( Point( Pos.x, Pos.y ), s );
}
-void TextType::Draw(OutputDevice& rOut)
+void TextType::Draw(OutputDevice& rOut, UCHAR* pBuffer)
{
if ((Flags & TextOutlBit)!=0) return; // source text for Outliner !!
@@ -892,7 +892,7 @@ void TextType::Draw(OutputDevice& rOut)
sal_uInt16 FitYMul;
sal_uInt16 FitYDiv;
bool Error;
- UCHAR* Buf=Buffer; // pointer to the letters
+ UCHAR* Buf = pBuffer; // pointer to the letters
pSgfFonts->ReadList();
xLine.reset(new short[ChrXPosArrSize]);
commit 155d8942c3054a9d0b635c51e9ac0813a856eb44
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 23 09:23:58 2017 +0100
coverity#1412873 Dereference null return value
Change-Id: I7b812c3381237cd52902fd15667e6e70bb36d53e
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 8fd9d5142667..5df85fad9e75 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1298,6 +1298,7 @@ void ScInterpreter::GetExternalDoubleRef(
formula::FormulaTokenArrayPlainIterator aIter(*pArray);
formula::FormulaToken* pToken = aIter.First();
+ assert(pToken);
if (pToken->GetType() == svError)
{
SetError( pToken->GetError());
commit f489bbfd954e359d611b29a2824018b8e9575519
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 23 09:26:14 2017 +0100
silence some unique_ptr warnings
Change-Id: Ibf3a8d00e8b91be79117d9c060b4cb2a7bafe651
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index b21e1c839f4b..2f798cc5cf25 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -120,7 +120,7 @@ private:
public:
OpenGLCfg();
- ~OpenGLCfg() COVERITY_NOEXCEPT_FALSE;
+ ~OpenGLCfg();
bool useOpenGL() const;
bool forceOpenGL() const;
@@ -144,16 +144,22 @@ void OpenGLCfg::reset()
mbModified = false;
}
-OpenGLCfg::~OpenGLCfg() COVERITY_NOEXCEPT_FALSE
+OpenGLCfg::~OpenGLCfg()
{
if (mbModified)
{
- std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
- if (!officecfg::Office::Common::VCL::UseOpenGL::isReadOnly())
- officecfg::Office::Common::VCL::UseOpenGL::set(mbUseOpenGL, batch);
- if (!officecfg::Office::Common::VCL::ForceOpenGL::isReadOnly())
- officecfg::Office::Common::VCL::ForceOpenGL::set(mbForceOpenGL, batch);
- batch->commit();
+ try
+ {
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
+ if (!officecfg::Office::Common::VCL::UseOpenGL::isReadOnly())
+ officecfg::Office::Common::VCL::UseOpenGL::set(mbUseOpenGL, batch);
+ if (!officecfg::Office::Common::VCL::ForceOpenGL::isReadOnly())
+ officecfg::Office::Common::VCL::ForceOpenGL::set(mbForceOpenGL, batch);
+ batch->commit();
+ }
+ catch (...)
+ {
+ }
}
}
commit 493450087c6de7692478af6823841a119adf221d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 23 09:22:04 2017 +0100
coverity#1412992 Unused value
Change-Id: I37c27b69ba2be2ffcc0d961d7b4faf527a671807
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index ac1fa114b4e7..24b263019f08 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -828,7 +828,6 @@ void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet )
}
m_pBspWin->setFooterFillAttributes(aFooterFillAttributes);
- nWhich = GetWhich(SID_ATTR_BORDER_OUTER);
}
}
commit a93dec5936322122df3df6b969570b4c5b07d5e1
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 23 09:16:27 2017 +0100
coverity#735795 Unchecked dynamic_cast
Change-Id: I3599c03d43761da73b89beae990f8688bd0b549b
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 6b5247b0889b..8fd9d5142667 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -3431,8 +3431,8 @@ void ScInterpreter::ScMacro()
else if ( eResType & SbxARRAY )
{
SbxBase* pElemObj = refRes->GetObject();
- SbxDimArray* pDimArray = dynamic_cast< SbxDimArray *>( pElemObj );
- short nDim = pDimArray->GetDims();
+ SbxDimArray* pDimArray = dynamic_cast<SbxDimArray*>(pElemObj);
+ short nDim = pDimArray ? pDimArray->GetDims() : 0;
if ( 1 <= nDim && nDim <= 2 )
{
sal_Int32 nCs, nCe, nRs, nRe;
commit 62256ce4c2f2376f020186a456622091fb902236
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 23 09:13:26 2017 +0100
coverity#1412988 Uninitialized scalar field
Change-Id: I98bcb9f45caab6b8b052737baf5500766f94f88d
diff --git a/vcl/source/window/errinf.cxx b/vcl/source/window/errinf.cxx
index 7c1fe5e654d5..7815e67bb11a 100644
--- a/vcl/source/window/errinf.cxx
+++ b/vcl/source/window/errinf.cxx
@@ -227,6 +227,10 @@ class ImplDynamicErrorInfo
friend class ErrorInfo;
private:
+ explicit ImplDynamicErrorInfo(DialogMask nInMask)
+ : nMask(nInMask)
+ {
+ }
void RegisterError(DynamicErrorInfo *);
static void UnRegisterError(DynamicErrorInfo const *);
static ErrorInfo* GetDynamicErrorInfo(ErrCode nId);
@@ -287,10 +291,9 @@ ErrorInfo::~ErrorInfo()
DynamicErrorInfo::DynamicErrorInfo(ErrCode nArgUserId, DialogMask nMask)
: ErrorInfo(nArgUserId),
- pImpl(new ImplDynamicErrorInfo)
+ pImpl(new ImplDynamicErrorInfo(nMask))
{
pImpl->RegisterError(this);
- pImpl->nMask=nMask;
}
DynamicErrorInfo::~DynamicErrorInfo()
commit 2becde65c64897b9621ca786a22fd7e942fc21be
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 23 09:08:48 2017 +0100
coverity#1412991 Resource leak
Change-Id: I0fc9b64ba8783530a0b7d597edbf8be8a43f5fd6
diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx
index 0d024d7f02ec..71b5c12b1a66 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -721,6 +721,9 @@ bool SwGlossaryHdl::ImportGlossaries( const OUString& rName )
bRet = aReader.ReadGlossaries( *pR, *pGlossary,
rCfg.IsSaveRelFile() );
}
+
+ if (!pCurGrp)
+ delete pGlossary;
}
}
}
More information about the Libreoffice-commits
mailing list