svtools/source/contnr/imivctl.hxx | 14 +++-- svtools/source/dialogs/addresstemplate.cxx | 3 + svtools/source/graphic/grfcache.cxx | 4 + svx/source/engine3d/view3d.cxx | 4 + svx/source/svdraw/svdfmtf.hxx | 7 +- svx/source/table/tablertfimporter.cxx | 4 + sw/qa/extras/ww8export/ww8export.cxx | 2 sw/source/core/text/possiz.hxx | 77 +++++++++++++---------------- sw/source/filter/ww8/ww8scan.cxx | 30 +++++++---- xmloff/source/draw/shapeexport.cxx | 2 xmloff/source/style/xmlbahdl.cxx | 4 - xmloff/source/style/xmlexppr.cxx | 2 12 files changed, 90 insertions(+), 63 deletions(-)
New commits: commit e008aebbcf366a64d5870ad3a5df39cac429b81c Author: Caolán McNamara <caol...@redhat.com> Date: Wed Aug 12 09:32:23 2015 +0100 cppcheck: noCopyConstructor Change-Id: Ice596f9d05703c944d12d2c00e2364ca6950d39c diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index bb5575f..d806740 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -316,6 +316,10 @@ class SvxIconChoiceCtrl_Impl bool IsMnemonicChar( sal_Unicode cChar, sal_uLong& rPos ) const; + // Copy assignment is forbidden and not implemented. + SvxIconChoiceCtrl_Impl (const SvxIconChoiceCtrl_Impl &) SAL_DELETED_FUNCTION; + SvxIconChoiceCtrl_Impl & operator= (const SvxIconChoiceCtrl_Impl &) SAL_DELETED_FUNCTION; + public: long nGridDX; @@ -512,14 +516,12 @@ public: void CallEventListeners( sal_uLong nEvent, void* pData = NULL ); - inline ::svt::IAccessibleFactory& GetAccessibleFactory() - { - return aAccFactory.getFactory(); - } + ::svt::IAccessibleFactory& GetAccessibleFactory() + { + return aAccFactory.getFactory(); + } }; - - typedef std::map<sal_uInt16, SvxIconChoiceCtrlEntryPtrVec> IconChoiceMap; class IcnCursor_Impl diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index 368ba40..01b730b 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -500,6 +500,9 @@ void AssignmentPersistentData::ImplCommit() delete pConfigData; } + // Copy assignment is forbidden and not implemented. + AddressBookSourceDialogData (const AddressBookSourceDialogData &) SAL_DELETED_FUNCTION; + AddressBookSourceDialogData & operator= (const AddressBookSourceDialogData &) SAL_DELETED_FUNCTION; }; diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index 3c0dbd3..d34c5b7 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -392,6 +392,10 @@ private: static bool IsCacheableAsBitmap( const GDIMetaFile& rMtf, OutputDevice* pOut, const Size& rSz ); + // Copy assignment is forbidden and not implemented. + GraphicDisplayCacheEntry (const GraphicDisplayCacheEntry &) SAL_DELETED_FUNCTION; + GraphicDisplayCacheEntry & operator= (const GraphicDisplayCacheEntry &) SAL_DELETED_FUNCTION; + public: static sal_uLong GetNeededSize( OutputDevice* pOut, const Point& rPt, const Size& rSz, diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 3241733..14c5e74 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -92,6 +92,10 @@ class Impl3DMirrorConstructOverlay // the overlay geometry from selected objects drawinglayer::primitive2d::Primitive2DSequence maFullOverlay; + // Copy assignment is forbidden and not implemented. + Impl3DMirrorConstructOverlay (const Impl3DMirrorConstructOverlay &) SAL_DELETED_FUNCTION; + Impl3DMirrorConstructOverlay & operator= (const Impl3DMirrorConstructOverlay &) SAL_DELETED_FUNCTION; + public: explicit Impl3DMirrorConstructOverlay(const E3dView& rView); ~Impl3DMirrorConstructOverlay(); diff --git a/svx/source/svdraw/svdfmtf.hxx b/svx/source/svdraw/svdfmtf.hxx index c7c32f4..c290ceb 100644 --- a/svx/source/svdraw/svdfmtf.hxx +++ b/svx/source/svdraw/svdfmtf.hxx @@ -39,8 +39,6 @@ class SvdProgressInfo; // Helper Class ImpSdrGDIMetaFileImport - - class ImpSdrGDIMetaFileImport { protected: @@ -154,6 +152,11 @@ protected: void DoLoopActions(GDIMetaFile& rMtf, SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport); +private: + // Copy assignment is forbidden and not implemented. + ImpSdrGDIMetaFileImport (const ImpSdrGDIMetaFileImport &) SAL_DELETED_FUNCTION; + ImpSdrGDIMetaFileImport & operator= (const ImpSdrGDIMetaFileImport &) SAL_DELETED_FUNCTION; + public: ImpSdrGDIMetaFileImport( SdrModel& rModel, diff --git a/svx/source/table/tablertfimporter.cxx b/svx/source/table/tablertfimporter.cxx index 3740bc7..3a4d6dc 100644 --- a/svx/source/table/tablertfimporter.cxx +++ b/svx/source/table/tablertfimporter.cxx @@ -120,6 +120,10 @@ private: RTFCellDefault* mpDefMerge; Reference< XTable > mxTable; + + // Copy assignment is forbidden and not implemented. + SdrTableRTFParser (const SdrTableRTFParser &) SAL_DELETED_FUNCTION; + SdrTableRTFParser & operator= (const SdrTableRTFParser &) SAL_DELETED_FUNCTION; }; SdrTableRTFParser::SdrTableRTFParser( SdrTableObj& rTableObj ) commit aca3f5ef4feae793afa765a56ea0cfc797eb4076 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Aug 12 09:31:13 2015 +0100 cppcheck: redundantAssignment Change-Id: I552211d79144fa11f25fe22d84901c33dcd1aa1d diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index cdf6d14..5a536f7 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -337,10 +337,10 @@ DECLARE_WW8EXPORT_TEST(testBorderColoursExport, "bordercolours.odt") CPPUNIT_ASSERT_BORDER_EQUAL(expectedTop, border); border = getProperty<table::BorderLine2>(cell, "LeftBorder"); CPPUNIT_ASSERT_BORDER_EQUAL(expectedLeft, border); - border = getProperty<table::BorderLine2>(cell, "BottomBorder"); #if 0 // #if'd out because the "fine dashed" border line style for table borders // does not seem to save or load correctly in odt format at present + border = getProperty<table::BorderLine2>(cell, "BottomBorder"); CPPUNIT_ASSERT_BORDER_EQUAL(expectedBottom, border); #endif commit 981adae1b0705c94ac8a712fe484aff911d8b086 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Aug 12 09:27:50 2015 +0100 ditch some inline keywords Change-Id: Idc5c0608a9bc5b6230f603d1deb2327887960204 diff --git a/sw/source/core/text/possiz.hxx b/sw/source/core/text/possiz.hxx index 1efb941..4c59142 100644 --- a/sw/source/core/text/possiz.hxx +++ b/sw/source/core/text/possiz.hxx @@ -28,48 +28,45 @@ class SwPosSize sal_uInt16 nWidth; sal_uInt16 nHeight; public: - inline SwPosSize( const sal_uInt16 nW = 0, const sal_uInt16 nH = 0 ) - : nWidth(nW), nHeight(nH) { } - explicit inline SwPosSize( const Size &rSize ) - : nWidth(sal_uInt16(rSize.Width())), nHeight(sal_uInt16(rSize.Height())){ } - inline sal_uInt16 Height() const { return nHeight; } - inline void Height( const sal_uInt16 nNew ) { nHeight = nNew; } - inline sal_uInt16 Width() const { return nWidth; } - inline void Width( const sal_uInt16 nNew ) { nWidth = nNew; } - - inline Size SvLSize() const { return Size( nWidth, nHeight ); } - inline void SvLSize( const Size &rSize ); - inline void SvXSize( const Size &rSize ); - inline SwPosSize &operator=( const SwPosSize &rSize ); - inline SwPosSize &operator=( const Size &rSize ); + SwPosSize( const sal_uInt16 nW = 0, const sal_uInt16 nH = 0 ) + : nWidth(nW) + , nHeight(nH) + { + } + explicit SwPosSize( const Size &rSize ) + : nWidth(sal_uInt16(rSize.Width())) + ,nHeight(sal_uInt16(rSize.Height())) + { + } + sal_uInt16 Height() const { return nHeight; } + void Height( const sal_uInt16 nNew ) { nHeight = nNew; } + sal_uInt16 Width() const { return nWidth; } + void Width( const sal_uInt16 nNew ) { nWidth = nNew; } + Size SvLSize() const { return Size( nWidth, nHeight ); } + void SvLSize( const Size &rSize ) + { + nWidth = sal_uInt16(rSize.Width()); + nHeight = sal_uInt16(rSize.Height()); + } + void SvXSize( const Size &rSize ) + { + nHeight = sal_uInt16(rSize.Width()); + nWidth = sal_uInt16(rSize.Height()); + } + SwPosSize& operator=(const SwPosSize &rSize ) + { + nWidth = rSize.Width(); + nHeight = rSize.Height(); + return *this; + } + SwPosSize& operator=( const Size &rSize ) + { + nWidth = sal_uInt16(rSize.Width()); + nHeight = sal_uInt16(rSize.Height()); + return *this; + } }; -inline SwPosSize &SwPosSize::operator=(const SwPosSize &rSize ) -{ - nWidth = rSize.Width(); - nHeight = rSize.Height(); - return *this; -} - -inline void SwPosSize::SvLSize( const Size &rSize ) -{ - nWidth = sal_uInt16(rSize.Width()); - nHeight = sal_uInt16(rSize.Height()); -} - -inline void SwPosSize::SvXSize( const Size &rSize ) -{ - nHeight = sal_uInt16(rSize.Width()); - nWidth = sal_uInt16(rSize.Height()); -} - -inline SwPosSize &SwPosSize::operator=( const Size &rSize ) -{ - nWidth = sal_uInt16(rSize.Width()); - nHeight = sal_uInt16(rSize.Height()); - return *this; -} - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 7ae8e767b9696bac18a867c90c13af246786c335 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Aug 12 09:23:13 2015 +0100 cppcheck: variableScope Change-Id: If24e86a0bdc0c5bdce02bed9981232070b38393c diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index b1b7da3..96b673d 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -4188,7 +4188,6 @@ void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< bean bool bHandles = false; uno::Sequence< beans::PropertyValues > aHandles; - bool bCoordinates = false; uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > aSegments; uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aCoordinates; @@ -4209,6 +4208,7 @@ void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< bean if ( aGeoPropSet >>= aGeoPropSeq ) { + bool bCoordinates = false; const OUString sCustomShapeType( "non-primitive" ); OUString aCustomShapeType( sCustomShapeType ); commit 59b5e3faeb0564023e99f4e7298eb9cbb0bdc75f Author: Caolán McNamara <caol...@redhat.com> Date: Wed Aug 12 09:22:03 2015 +0100 cppcheck: redundantAssignment Change-Id: I0dcbe0d2afe3741c146027569a906b19abdfdc06 diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx index 6c93da9..c7ead92 100644 --- a/xmloff/source/style/xmlbahdl.cxx +++ b/xmloff/source/style/xmlbahdl.cxx @@ -512,10 +512,8 @@ XMLHexPropHdl::~XMLHexPropHdl() bool XMLHexPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const { - bool bRet = false; sal_uInt32 nRsid; - - bRet = SvXMLUnitConverter::convertHex( nRsid, rStrImpValue ); + bool bRet = SvXMLUnitConverter::convertHex( nRsid, rStrImpValue ); rValue <<= nRsid; return bRet; commit 233cec3fe516876277d34771b5564db63d78e5d3 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Aug 12 09:21:28 2015 +0100 cppcheck: silence redundantAssignment Change-Id: If1080d99357b45486739120b9ba43c0f14f39ea8 diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx index ce43f2f..a7876d4 100644 --- a/xmloff/source/style/xmlexppr.cxx +++ b/xmloff/source/style/xmlexppr.cxx @@ -629,7 +629,7 @@ vector<XMLPropertyState> SvXMLExportPropertyMapper::_Filter( // getPropertySetInfo returns a new object; such property set infos must // not be cached: WeakReference < XPropertySetInfo > xWeakInfo( xInfo ); - xInfo = 0; + xInfo.clear(); xInfo = xWeakInfo; if( xInfo.is() ) { commit 2d33d18c4857d7b845a1c6dae4e5aa391f4a781d Author: Caolán McNamara <caol...@redhat.com> Date: Wed Aug 12 09:14:34 2015 +0100 consider negative nPN a failure translate and consolidate end before start warnings to SAL_WARN Change-Id: I547075c0ca668da184f477112086f401cc9ec4ee diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 6d1089a..59b133d 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -2158,7 +2158,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN) bool failure = false; nIMax = ncpN; - if ((nIMax < 1) || (nIMax > (WW8_CP_MAX - 4)/6) || ((nPN + ncpN) > USHRT_MAX)) + if ((nIMax < 1) || (nIMax > (WW8_CP_MAX - 4)/6) || ((nPN + ncpN) > USHRT_MAX) || nPN < 0) failure = true; if (!failure) @@ -2172,7 +2172,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN) failure = true; // construct FC entries // first FC entry of each Fkp - if (checkSeek(rSt, static_cast<sal_uInt32>( nPN + i ) << 9 )) + if (checkSeek(rSt, ( nPN + i ) << 9 )) continue; WW8_CP nFc(0); rSt.ReadInt32( nFc ); @@ -2220,7 +2220,7 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN) } } - OSL_ENSURE( !failure, "Document has corrupt PLCF, ignoring it" ); + SAL_WARN_IF(failure, "sw.ww8", "Document has corrupt PLCF, ignoring it"); if (failure) MakeFailedPLCF(); @@ -4400,8 +4400,8 @@ void WW8PLCFMan::AdjustEnds( WW8PLCFxDesc& rDesc ) void WW8PLCFxDesc::ReduceByOffset() { - OSL_ENSURE((WW8_CP_MAX == nStartPos) || (nStartPos <= nEndPos), - "Attr-Anfang und -Ende ueber Kreuz" ); + SAL_WARN_IF(WW8_CP_MAX != nStartPos && nStartPos > nEndPos, "sw.ww8", + "End " << nEndPos << " before Start " << nStartPos); if( nStartPos != WW8_CP_MAX ) { @@ -4439,8 +4439,8 @@ void WW8PLCFMan::GetNewNoSprms( WW8PLCFxDesc& rDesc ) rDesc.nCp2OrIdx = rDesc.pPLCFx->GetNoSprms(rDesc.nStartPos, rDesc.nEndPos, rDesc.nSprmsLen); - OSL_ENSURE((WW8_CP_MAX == rDesc.nStartPos) || (rDesc.nStartPos <= rDesc.nEndPos), - "Attr-Anfang und -Ende ueber Kreuz" ); + SAL_WARN_IF(WW8_CP_MAX != rDesc.nStartPos && rDesc.nStartPos > rDesc.nEndPos, "sw.ww8", + "End " << rDesc.nEndPos << " before Start " << rDesc.nStartPos); rDesc.ReduceByOffset(); @@ -4950,7 +4950,8 @@ void WW8PLCFMan::AdvSprm(short nIdx, bool bStart) p->nSprmsLen = 0; GetNewSprms( *p ); } - OSL_ENSURE( p->nStartPos <= p->nEndPos, "Attribut ueber Kreuz" ); + SAL_WARN_IF(p->nStartPos > p->nEndPos, "sw.ww8", + "End " << p->nEndPos << " before Start " << p->nStartPos); } } } commit 25d396589e22a047d8e31655a8c2df61182088c1 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Aug 12 08:50:51 2015 +0100 test for end before start, e.g. hang-3.doc Change-Id: I3b0c7766cdba31d6303de7fe34a5c85567de8116 diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 8ad6e09..6d1089a 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -6670,6 +6670,11 @@ bool WW8PLCF_HdFt::GetTextPos(sal_uInt8 grpfIhdt, sal_uInt8 nWhich, WW8_CP& rSta aPLCF.SetIdx( nIdx ); // Lookup suitable CP aPLCF.Get( rStart, nEnd, pData ); + if (nEnd < rStart) + { + SAL_WARN("sw.ww8", "End " << nEnd << " before Start " << rStart); + return false; + } rLen = nEnd - rStart; aPLCF.advance(); @@ -6683,7 +6688,13 @@ bool WW8PLCF_HdFt::GetTextPosExact(short nIdx, WW8_CP& rStart, WW8_CP& rLen) aPLCF.SetIdx( nIdx ); // Lookup suitable CP aPLCF.Get( rStart, nEnd, pData ); - rLen = static_cast<sal_uInt32>(nEnd) - static_cast<sal_uInt32>(rStart); + if (nEnd < rStart) + { + SAL_WARN("sw.ww8", "End " << nEnd << " before Start " << rStart); + return false; + } + rLen = nEnd - rStart; + return true; }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits