[Libreoffice-commits] core.git: tools/source ucb/source

2021-05-28 Thread Noel Grandin (via logerrit)
 tools/source/generic/poly.cxx|8 
 ucb/source/cacher/cachedcontentresultset.cxx |8 
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 3e0c39f9aeaa5c8791df94418ab8b4b78e005ac1
Author: Noel Grandin 
AuthorDate: Thu May 27 15:55:18 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri May 28 13:28:31 2021 +0200

no need to allocate these on the heap

Change-Id: I0f477edb666ff2c6dc9def45ec68c4ce1a34634a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116289
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 210764086743..f0a0a7388b06 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -141,12 +141,12 @@ ImplPolygon::ImplPolygon( const tools::Rectangle& rRect, 
sal_uInt32 nHorzRound,
 const Point aTR( aRect.Right() - nHorzRound, aRect.Top() + 
nVertRound );
 const Point aBR( aRect.Right() - nHorzRound, aRect.Bottom() - 
nVertRound );
 const Point aBL( aRect.Left() + nHorzRound, aRect.Bottom() - 
nVertRound );
-std::unique_ptr pEllipsePoly( new tools::Polygon( 
Point(), nHorzRound, nVertRound ) );
-sal_uInt16 i, nEnd, nSize4 = pEllipsePoly->GetSize() >> 2;
+tools::Polygon aEllipsePoly( Point(), nHorzRound, nVertRound );
+sal_uInt16 i, nEnd, nSize4 = aEllipsePoly.GetSize() >> 2;
 
-ImplInitSize(pEllipsePoly->GetSize() + 1);
+ImplInitSize(aEllipsePoly.GetSize() + 1);
 
-const Point* pSrcAry = pEllipsePoly->GetConstPointAry();
+const Point* pSrcAry = aEllipsePoly.GetConstPointAry();
 Point* pDstAry = mxPointAry.get();
 
 for( i = 0, nEnd = nSize4; i < nEnd; i++ )
diff --git a/ucb/source/cacher/cachedcontentresultset.cxx 
b/ucb/source/cacher/cachedcontentresultset.cxx
index 297453f1540c..9d1b8d8c7a0d 100644
--- a/ucb/source/cacher/cachedcontentresultset.cxx
+++ b/ucb/source/cacher/cachedcontentresultset.cxx
@@ -446,8 +446,8 @@ CCRS_PropertySetInfo::CCRS_PropertySetInfo(
 if( nFetchDirection != -1 )
 nDeleted++;
 
-std::unique_ptr > pOrigProps(new Sequence ( 
*m_pProperties ));
-sal_Int32 nOrigProps = pOrigProps->getLength();
+Sequence< Property > aOrigProps( *m_pProperties );
+sal_Int32 nOrigProps = aOrigProps.getLength();
 
 m_pProperties->realloc( nOrigProps + 2 - nDeleted );//note that nDeleted 
is <= 2
 for( sal_Int32 n = 0, m = 0; n < nOrigProps; n++, m++ )
@@ -455,7 +455,7 @@ CCRS_PropertySetInfo::CCRS_PropertySetInfo(
 if( n == nFetchSize || n == nFetchDirection )
 m--;
 else
-(*m_pProperties)[ m ] = (*pOrigProps)[ n ];
+(*m_pProperties)[ m ] = aOrigProps[ n ];
 }
 {
 Property& rMyProp = (*m_pProperties)[ nOrigProps - nDeleted ];
@@ -464,7 +464,7 @@ CCRS_PropertySetInfo::CCRS_PropertySetInfo(
 rMyProp.Attributes = PropertyAttribute::BOUND | 
PropertyAttribute::MAYBEDEFAULT;
 
 if( nFetchSize != -1 )
-m_nFetchSizePropertyHandle = (*pOrigProps)[nFetchSize].Handle;
+m_nFetchSizePropertyHandle = aOrigProps[nFetchSize].Handle;
 else
 m_nFetchSizePropertyHandle = impl_getRemainedHandle();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: tools/source ucb/source unotools/source unoxml/source writerfilter/source xmlhelp/source xmloff/source

2020-04-17 Thread Noel Grandin (via logerrit)
 tools/source/generic/poly.cxx |   16 +
 tools/source/memtools/multisel.cxx|   23 +-
 tools/source/zcodec/zcodec.cxx|   10 -
 ucb/source/ucp/file/filrset.cxx   |3 
 ucb/source/ucp/file/filtask.cxx   |5 
 ucb/source/ucp/ftp/ftpurl.cxx |   12 -
 unotools/source/config/bootstrap.cxx  |3 
 unotools/source/misc/datetime.cxx |  165 +-
 unoxml/source/rdf/CURI.cxx|   12 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   18 +
 writerfilter/source/dmapper/NumberingManager.cxx  |4 
 xmlhelp/source/cxxhelp/provider/databases.cxx |   22 +-
 xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx |5 
 xmlhelp/source/treeview/tvread.cxx|5 
 xmloff/source/forms/formattributes.cxx|3 
 xmloff/source/style/xmlnumfe.cxx  |7 
 16 files changed, 193 insertions(+), 120 deletions(-)

New commits:
commit 0b2ddcda730897cb5b2801731f03191d77409273
Author: Noel Grandin 
AuthorDate: Fri Apr 17 11:39:49 2020 +0200
Commit: Noel Grandin 
CommitDate: Fri Apr 17 12:44:46 2020 +0200

loplugin:buriedassign in tools..xmloff

Change-Id: I31df6c4fd82c6f6d15bbe5228e92e5171cacba51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92410
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index fba7a80bd23d..72e7532874ad 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -332,10 +332,12 @@ ImplPolygon::ImplPolygon( const Point& rBezPt1, const 
Point& rCtrlPt1,
 Point& rPt = mxPointAry[i];
 
 fK_2 = fK_1;
-fK_3 = ( fK_2 *= fK_1 );
+fK_2 *= fK_1;
+fK_3 = fK_2;
 fK_3 *= fK_1;
 fK1_2 = fK1_1;
-fK1_3 = ( fK1_2 *= fK1_1 );
+fK1_2 *= fK1_1;
+fK1_3 = fK1_2;
 fK1_3 *= fK1_1;
 double fK12 = fK_1 * fK1_2;
 double fK21 = fK_2 * fK1_1;
@@ -1250,10 +1252,14 @@ Vector2D& Vector2D::Normalize()
 {
 double fLen = Scalar( *this );
 
-if( ( fLen != 0.0 ) && ( fLen != 1.0 ) && ( ( fLen = sqrt( fLen ) ) != 0.0 
) )
+if( ( fLen != 0.0 ) && ( fLen != 1.0 ) )
 {
-mfX /= fLen;
-mfY /= fLen;
+fLen = sqrt( fLen );
+if( fLen != 0.0 )
+{
+mfX /= fLen;
+mfY /= fLen;
+}
 }
 
 return *this;
diff --git a/tools/source/memtools/multisel.cxx 
b/tools/source/memtools/multisel.cxx
index 8fd0c61aeb27..7a8df48d0049 100644
--- a/tools/source/memtools/multisel.cxx
+++ b/tools/source/memtools/multisel.cxx
@@ -379,10 +379,11 @@ sal_Int32 MultiSelection::FirstSelected()
 nCurSubSel = 0;
 
 bCurValid = !aSels.empty();
-if ( bCurValid )
-return nCurIndex = aSels[ 0 ].Min();
+if ( !bCurValid )
+return SFX_ENDOFSELECTION;
 
-return SFX_ENDOFSELECTION;
+nCurIndex = aSels[ 0 ].Min();
+return nCurIndex;
 }
 
 sal_Int32 MultiSelection::LastSelected()
@@ -390,10 +391,11 @@ sal_Int32 MultiSelection::LastSelected()
 nCurSubSel = aSels.size() - 1;
 bCurValid = !aSels.empty();
 
-if ( bCurValid )
-return nCurIndex = aSels[ nCurSubSel ].Max();
+if ( !bCurValid )
+return SFX_ENDOFSELECTION;
 
-return SFX_ENDOFSELECTION;
+nCurIndex = aSels[ nCurSubSel ].Max();
+return nCurIndex;
 }
 
 sal_Int32 MultiSelection::NextSelected()
@@ -406,11 +408,12 @@ sal_Int32 MultiSelection::NextSelected()
 return ++nCurIndex;
 
 // are there further sub selections?
-if ( ++nCurSubSel < sal_Int32(aSels.size()) )
-return nCurIndex = aSels[ nCurSubSel ].Min();
+if ( ++nCurSubSel >= sal_Int32(aSels.size()) )
+// we are at the end!
+return SFX_ENDOFSELECTION;
 
-// we are at the end!
-return SFX_ENDOFSELECTION;
+nCurIndex = aSels[ nCurSubSel ].Min();
+return nCurIndex;
 }
 
 void MultiSelection::SetTotalRange( const Range& rTotRange )
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
index a29127be7232..b6b1b2112b32 100644
--- a/tools/source/zcodec/zcodec.cxx
+++ b/tools/source/zcodec/zcodec.cxx
@@ -119,9 +119,12 @@ void ZCodec::Compress( SvStream& rIStm, SvStream& rOStm )
 InitCompress();
 mpInBuf = new sal_uInt8[ mnInBufSize ];
 auto pStream = static_cast(mpsC_Stream);
-while ((pStream->avail_in = rIStm.ReadBytes(
-pStream->next_in = mpInBuf, mnInBufSize )) != 0)
+for (;;)
 {
+pStream->next_in = mpInBuf;
+pStream->avail_in = rIStm.ReadBytes( pStream->next_in, mnInBufSize );
+if (pStream->avail_in == 0)
+break;
 if ( pStream->avail_out == 0 )
 ImplWriteBack();
 if ( deflate( pStream, Z_NO_FLUSH ) < 0 )
@@ 

[Libreoffice-commits] core.git: tools/source ucb/source vbahelper/source vcl/android vcl/headless vcl/inc vcl/ios vcl/opengl vcl/osx vcl/qt5 vcl/quartz vcl/source vcl/unx vcl/win writerperfect/qa writ

2019-02-08 Thread Libreoffice Gerrit user
 tools/source/fsys/fileutil.cxx|9 +-
 tools/source/xml/XmlWalker.cxx|3 
 tools/source/xml/XmlWriter.cxx|3 
 ucb/source/ucp/ftp/ftpcontent.cxx |3 
 ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx |3 
 ucb/source/ucp/webdav/webdavcontentcaps.cxx   |3 
 ucb/source/ucp/webdav/webdavdatasupplier.cxx  |5 -
 vbahelper/source/msforms/vbauserform.cxx  |3 
 vcl/android/androidinst.cxx   |3 
 vcl/headless/headlessinst.cxx |3 
 vcl/headless/svpdata.cxx  |3 
 vcl/inc/BitmapScaleConvolutionFilter.hxx  |7 -
 vcl/inc/font/FeatureCollector.hxx |1 
 vcl/inc/pch/precompiled_vcl.hxx   |1 
 vcl/ios/iosinst.cxx   |3 
 vcl/opengl/FixedTextureAtlas.cxx  |4 -
 vcl/opengl/salbmp.cxx |   11 +--
 vcl/osx/salinst.cxx   |3 
 vcl/qt5/Qt5Graphics_Text.cxx  |3 
 vcl/qt5/Qt5Instance.cxx   |3 
 vcl/quartz/salbmp.cxx |   13 +--
 vcl/quartz/salgdi.cxx |3 
 vcl/source/app/salvtables.cxx |   79 ++
 vcl/source/app/svdata.cxx |3 
 vcl/source/control/button.cxx |3 
 vcl/source/edit/texteng.cxx   |   13 +--
 vcl/source/edit/textview.cxx  |8 --
 vcl/source/filter/graphicfilter.cxx   |7 -
 vcl/source/filter/igif/gifread.cxx|3 
 vcl/source/filter/ipdf/pdfdocument.cxx|3 
 vcl/source/font/FeatureCollector.cxx  |1 
 vcl/source/gdi/impgraph.cxx   |   11 +--
 vcl/source/gdi/impvect.cxx|3 
 vcl/source/gdi/pdfwriter_impl.cxx |5 -
 vcl/source/gdi/pngread.cxx|9 +-
 vcl/source/gdi/region.cxx |   21 ++---
 vcl/source/gdi/svmconverter.cxx   |3 
 vcl/source/gdi/wall.cxx   |   21 ++---
 vcl/source/graphic/Manager.cxx|1 
 vcl/source/treelist/svtabbx.cxx   |3 
 vcl/source/treelist/treelist.cxx  |3 
 vcl/source/treelist/treelistbox.cxx   |8 +-
 vcl/source/uitest/uno/uiobject_uno.cxx|3 
 vcl/source/window/builder.cxx |9 +-
 vcl/source/window/errinf.cxx  |5 -
 vcl/unx/generic/app/salinst.cxx   |3 
 vcl/unx/generic/gdi/cairotextrender.cxx   |3 
 vcl/unx/generic/gdi/salvd.cxx |3 
 vcl/unx/generic/print/genpspgraphics.cxx  |3 
 vcl/unx/gtk/gtkinst.cxx   |5 -
 vcl/unx/gtk3/gtk3gtkinst.cxx  |   60 
 vcl/unx/kde5/KDE5SalInstance.cxx  |1 
 vcl/win/app/salinst.cxx   |3 
 vcl/win/gdi/winlayout.cxx |3 
 writerperfect/qa/unit/DirectoryStreamTest.cxx |2 
 writerperfect/source/common/DirectoryStream.cxx   |4 -
 xmlhelp/source/cxxhelp/provider/content.cxx   |5 -
 xmloff/inc/pch/precompiled_xo.hxx |1 
 xmloff/source/chart/MultiPropertySetHandler.hxx   |3 
 xmloff/source/chart/SchXMLImport.cxx  |   23 +++---
 xmloff/source/core/unoatrcn.cxx   |3 
 xmloff/source/core/xmlexp.cxx |5 -
 xmloff/source/core/xmlimp.cxx |   21 ++---
 xmloff/source/draw/animationimport.cxx|6 -
 xmloff/source/draw/sdxmlimp.cxx   |   21 ++---
 xmloff/source/draw/shapeexport.cxx|3 
 xmloff/source/draw/shapeimport.cxx|   18 ++---
 xmloff/source/draw/xexptran.cxx   |3 
 xmloff/source/draw/ximpcustomshape.cxx|3 
 xmloff/source/draw/ximpstyl.cxx   |5 -
 xmloff/source/forms/controlpropertyhdl.cxx|   18 ++---
 xmloff/source/forms/elementexport.cxx |6 -
 xmloff/source/forms/propertyexport.cxx|4 -
 xmloff/source/style/impastpl.cxx  |8 +-
 xmloff/source/style/xmlnumfi.cxx  |   16 +---
 xmloff/source/style/xmlnumi.cxx   |3 
 xmloff/source/style/xmlstyle.cxx  |3 
 xmloff/source/style/xmltabi.cxx   |3 
 xmloff/source/text/XMLTextColumnsContext.cxx  |3 
 xmloff/source/text/XMLTextFrameContext.cxx|3 
 xmloff/source/text/txtlists.cxx   |   10 +-
 xmloff/source/text/txtparae.cxx   |3 
 xmloff/source/text/txtparai.cxx   

[Libreoffice-commits] core.git: tools/source ucb/source unoidl/source vbahelper/source vcl/inc vcl/source vcl/unx xmlhelp/source xmloff/source xmlsecurity/qa

2016-07-27 Thread Noel Grandin
 tools/source/inet/inetmime.cxx |3 +--
 ucb/source/ucp/file/filglob.hxx|4 ++--
 ucb/source/ucp/file/filtask.hxx|2 +-
 unoidl/source/unoidlprovider.cxx   |2 +-
 vbahelper/source/msforms/vbacontrols.cxx   |2 +-
 vbahelper/source/vbahelper/vbacommandbarhelper.hxx |2 +-
 vcl/inc/fontsubset.hxx |4 ++--
 vcl/inc/headless/svpgdi.hxx|2 +-
 vcl/inc/headless/svpinst.hxx   |2 +-
 vcl/inc/impgraph.hxx   |8 
 vcl/inc/opengl/program.hxx |2 +-
 vcl/inc/opengl/texture.hxx |2 +-
 vcl/inc/openglgdiimpl.hxx  |4 ++--
 vcl/inc/salgdi.hxx |2 +-
 vcl/inc/salinst.hxx|2 +-
 vcl/inc/textlayout.hxx |4 ++--
 vcl/inc/unx/genpspgraphics.h   |2 +-
 vcl/inc/unx/gtk/gtkinst.hxx|2 +-
 vcl/inc/unx/printergfx.hxx |2 +-
 vcl/inc/unx/printerjob.hxx |2 +-
 vcl/inc/unx/salbmp.h   |2 +-
 vcl/inc/unx/salgdi.h   |2 +-
 vcl/inc/unx/salinst.h  |2 +-
 vcl/source/edit/textdoc.hxx|2 +-
 vcl/source/gdi/pdfwriter_impl.hxx  |   16 
 vcl/source/outdev/font.cxx |2 +-
 vcl/unx/generic/dtrans/X11_selection.hxx   |2 +-
 vcl/unx/generic/printer/ppdparser.cxx  |2 +-
 xmlhelp/source/cxxhelp/provider/databases.hxx  |2 +-
 xmloff/source/style/impastpl.hxx   |4 ++--
 xmloff/source/style/xmlexppr.cxx   |2 +-
 xmlsecurity/qa/unit/signing/signing.cxx|8 
 32 files changed, 50 insertions(+), 51 deletions(-)

New commits:
commit 9870f02b310567c1d50c8e11a49afea5fdc549a0
Author: Noel Grandin 
Date:   Mon Jul 25 14:04:19 2016 +0200

loplugin:countusersofdefaultparams in tools..xmlsecurity

find methods with default params with only zero or one call site

Change-Id: Ie5b30f60e9fe00ba1acf0dfc79b005ded46f05a0
Reviewed-on: https://gerrit.libreoffice.org/27512
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index 33bf396..2e4b74a 100644
--- a/tools/source/inet/inetmime.cxx
+++ b/tools/source/inet/inetmime.cxx
@@ -446,8 +446,7 @@ public:
 
 void includes(sal_uInt32 nChar);
 
-rtl_TextEncoding getPreferredEncoding(rtl_TextEncoding eDefault
-  = RTL_TEXTENCODING_DONTKNOW)
+rtl_TextEncoding getPreferredEncoding(rtl_TextEncoding eDefault)
 const;
 
 void reset();
diff --git a/ucb/source/ucp/file/filglob.hxx b/ucb/source/ucp/file/filglob.hxx
index 2bbecb3..d1e9a4a 100644
--- a/ucb/source/ucp/file/filglob.hxx
+++ b/ucb/source/ucp/file/filglob.hxx
@@ -63,7 +63,7 @@ namespace fileaccess {
 
 extern osl::FileBase::RC osl_File_copy( const OUString& strPath,
 const OUString& strDestPath,
-bool test = false );
+bool test );
 
 /**
  *  special move:
@@ -84,7 +84,7 @@ namespace fileaccess {
const css::uno::Reference< 
css::ucb::XCommandEnvironment >& xEnv,
const OUString& aUncPath,
BaseContent* pContent,
-   bool isHandled = false);
+   bool isHandled);
// the physical URL of the object
 
 } // end namespace fileaccess
diff --git a/ucb/source/ucp/file/filtask.hxx b/ucb/source/ucp/file/filtask.hxx
index 9af0e04..f2b0d89 100644
--- a/ucb/source/ucp/file/filtask.hxx
+++ b/ucb/source/ucp/file/filtask.hxx
@@ -94,7 +94,7 @@ namespace fileaccess
 }
 
 void SAL_CALL installError( sal_Int32 nErrorCode,
-sal_Int32 nMinorCode = 
TASKHANDLER_NO_ERROR )
+sal_Int32 nMinorCode )
 {
 m_nErrorCode = nErrorCode;
 m_nMinorCode = nMinorCode;
diff --git a/unoidl/source/unoidlprovider.cxx b/unoidl/source/unoidlprovider.cxx
index 800d112..acf443b 100644
--- a/unoidl/source/unoidlprovider.cxx
+++ b/unoidl/source/unoidlprovider.cxx
@@ -551,7 +551,7 @@ std::vector< OUString > readAnnotations(
 
 ConstantValue readConstant(
 rtl::Reference< MappedFile > const & file, sal_uInt32 offset,
-sal_uInt32 * newOffset 

[Libreoffice-commits] core.git: tools/source ucb/source

2015-09-17 Thread Stephan Bergmann
 tools/source/fsys/urlobj.cxx   |7 ++-
 tools/source/inet/inetmime.cxx |   13 +
 ucb/source/regexp/regexp.cxx   |9 +++--
 3 files changed, 10 insertions(+), 19 deletions(-)

New commits:
commit 01d0f0f6adf7e3a340dd44690db5d7d7ed08d3e5
Author: Stephan Bergmann 
Date:   Thu Sep 17 14:31:07 2015 +0200

"unnamed namespaces don't work well yet" is no longer true

Change-Id: I7a04c2d04e3fc52982d83119755e0b349d232a47

diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 65f451c..51887b7 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -46,9 +46,6 @@
 #include 
 #include 
 
-namespace unnamed_tools_urlobj {} using namespace unnamed_tools_urlobj;
-// unnamed namespaces don't work well yet...
-
 using namespace css;
 
 //  INetURLObject
@@ -420,7 +417,7 @@ inline void INetURLObject::appendEscape(OUStringBuffer & 
rTheText,
 rTheText.append( (sal_Unicode)INetMIME::getHexDigit(int(nOctet & 15)) );
 }
 
-namespace unnamed_tools_urlobj {
+namespace {
 
 enum
 {
@@ -616,7 +613,7 @@ std::unique_ptr INetURLObject::getData()
 return nullptr;
 }
 
-namespace unnamed_tools_urlobj {
+namespace {
 
 INetURLObject::FSysStyle guessFSysStyleByCounting(sal_Unicode const * pBegin,
   sal_Unicode const * pEnd,
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index 88e2cf9..44c0fdf 100644
--- a/tools/source/inet/inetmime.cxx
+++ b/tools/source/inet/inetmime.cxx
@@ -27,10 +27,7 @@
 #include 
 #include 
 
-namespace unnamed_tools_inetmime {} using namespace unnamed_tools_inetmime;
-// unnamed namespaces don't work well yet
-
-namespace unnamed_tools_inetmime {
+namespace {
 
 class Charset
 {
@@ -98,7 +95,7 @@ inline INetMIMECharsetList_Impl::Node::Node(const Charset & 
rTheCharset,
 m_pNext(pTheNext)
 {}
 
-namespace unnamed_tools_inetmime {
+namespace {
 
 struct Parameter
 {
@@ -174,7 +171,7 @@ bool Charset::contains(sal_uInt32 nChar) const
 
 //  appendISO88591
 
-namespace unnamed_tools_inetmime {
+namespace {
 
 void appendISO88591(OUString & rText, sal_Char const * pBegin,
 sal_Char const * pEnd)
@@ -251,7 +248,7 @@ Parameter ** ParameterList::find(const OString& rAttribute,
 
 //  parseParameters
 
-namespace unnamed_tools_inetmime {
+namespace {
 
 bool parseParameters(ParameterList const & rInput,
  INetContentTypeParameterList * pOutput)
@@ -1025,7 +1022,7 @@ const sal_Char * 
INetMIME::getCharsetName(rtl_TextEncoding eEncoding)
 }
 }
 
-namespace unnamed_tools_inetmime {
+namespace {
 
 struct EncodingEntry
 {
diff --git a/ucb/source/regexp/regexp.cxx b/ucb/source/regexp/regexp.cxx
index 41254c9..5856dbf 100644
--- a/ucb/source/regexp/regexp.cxx
+++ b/ucb/source/regexp/regexp.cxx
@@ -27,9 +27,6 @@
 #include 
 #include 
 
-namespace unnamed_ucb_regexp {} using namespace unnamed_ucb_regexp;
-// unnamed namespaces don't work well yet...
-
 using namespace com::sun::star;
 using namespace ucb_impl;
 
@@ -56,7 +53,7 @@ inline Regexp::Regexp(Kind eTheKind, OUString const & 
rThePrefix,
 }
 
 
-namespace unnamed_ucb_regexp {
+namespace {
 
 bool matchStringIgnoreCase(sal_Unicode const ** pBegin,
sal_Unicode const * pEnd,
@@ -174,7 +171,7 @@ bool Regexp::matches(OUString const & rString,
 }
 
 
-namespace unnamed_ucb_regexp {
+namespace {
 
 bool isScheme(OUString const & rString, bool bColon)
 {
@@ -292,7 +289,7 @@ OUString Regexp::getRegexp(bool bReverse) const
 }
 
 
-namespace unnamed_ucb_regexp {
+namespace {
 
 bool matchString(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
  sal_Char const * pString, size_t nStringLength)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: tools/source ucb/source unoxml/source vbahelper/source

2015-01-18 Thread Michael Weghorn
 tools/source/generic/bigint.cxx |6 ++
 tools/source/generic/poly.cxx   |5 ++---
 ucb/source/sorter/sortresult.cxx|6 ++
 ucb/source/ucp/ftp/test_ftpurl.cxx  |4 ++--
 unoxml/source/xpath/xpathapi.cxx|5 ++---
 vbahelper/source/vbahelper/vbapagesetupbase.cxx |   20 
 6 files changed, 22 insertions(+), 24 deletions(-)

New commits:
commit 5901827bd44dc3600bf66c83882e6847439d59d6
Author: Michael Weghorn m.wegh...@posteo.de
Date:   Sat Jan 17 00:37:31 2015 +0100

fdo#39440 reduce scope of local variables

This addresses some cppcheck warnings.

Change-Id: I1cd8b118e2598b8b18fb445851a3bb41e554267b
Reviewed-on: https://gerrit.libreoffice.org/13967
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Noel Grandin noelgran...@gmail.com

diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx
index 7804597..cf0df72 100644
--- a/tools/source/generic/bigint.cxx
+++ b/tools/source/generic/bigint.cxx
@@ -310,7 +310,6 @@ void BigInt::MultLong( const BigInt rB, BigInt rErg ) 
const
 void BigInt::DivLong( const BigInt rB, BigInt rErg ) const
 {
 inti, j;
-long   nTmp;
 sal_uInt16 nK, nQ, nMult;
 short  nLenB  = rB.nLen;
 short  nLenB1 = rB.nLen - 1;
@@ -329,7 +328,7 @@ void BigInt::DivLong( const BigInt rB, BigInt rErg ) const
 
 for (j = aTmpA.nLen - 1; j = nLenB; j--)
 { // guess divisor
-nTmp = ( (long)aTmpA.nNum[j]  16 ) + aTmpA.nNum[j - 1];
+long nTmp = ( (long)aTmpA.nNum[j]  16 ) + aTmpA.nNum[j - 1];
 if (aTmpA.nNum[j] == aTmpB.nNum[nLenB1])
 nQ = 0x;
 else
@@ -379,7 +378,6 @@ void BigInt::DivLong( const BigInt rB, BigInt rErg ) const
 void BigInt::ModLong( const BigInt rB, BigInt rErg ) const
 {
 short  i, j;
-long   nTmp;
 sal_uInt16 nK, nQ, nMult;
 short  nLenB  = rB.nLen;
 short  nLenB1 = rB.nLen - 1;
@@ -398,7 +396,7 @@ void BigInt::ModLong( const BigInt rB, BigInt rErg ) const
 
 for (j = aTmpA.nLen - 1; j = nLenB; j--)
 { // Guess divisor
-nTmp = ( (long)aTmpA.nNum[j]  16 ) + aTmpA.nNum[j - 1];
+long nTmp = ( (long)aTmpA.nNum[j]  16 ) + aTmpA.nNum[j - 1];
 if (aTmpA.nNum[j] == aTmpB.nNum[nLenB1])
 nQ = 0x;
 else
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index e949835..5df7ef3 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -1069,7 +1069,6 @@ void Polygon::Rotate( const Point rCenter, double fSin, 
double fCos )
 {
 ImplMakeUnique();
 
-long nX, nY;
 long nCenterX = rCenter.X();
 long nCenterY = rCenter.Y();
 
@@ -1077,8 +1076,8 @@ void Polygon::Rotate( const Point rCenter, double fSin, 
double fCos )
 {
 Point rPt = mpImplPolygon-mpPointAry[ i ];
 
-nX = rPt.X() - nCenterX;
-nY = rPt.Y() - nCenterY;
+const long nX = rPt.X() - nCenterX;
+const long nY = rPt.Y() - nCenterY;
 rPt.X() = (long) FRound( fCos * nX + fSin * nY ) + nCenterX;
 rPt.Y() = -(long) FRound( fSin * nX - fCos * nY ) + nCenterY;
 }
diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx
index 7e1dde0..d5fcabf 100644
--- a/ucb/source/sorter/sortresult.cxx
+++ b/ucb/source/sorter/sortresult.cxx
@@ -1278,12 +1278,11 @@ sal_IntPtr SortedResultSet::FindPos( SortListData 
*pEntry,
 sal_IntPtr nEnd   = _nEnd;
 sal_IntPtr nMid = 0, nCompare = 0;
 
-SortListData*pMid;
 
 while ( nStart = nEnd )
 {
 nMid = ( nEnd - nStart ) / 2 + nStart;
-pMid = maS2O.GetData( nMid );
+SortListData *pMid = maS2O.GetData( nMid );
 nCompare = Compare( pEntry, pMid );
 
 if ( !nCompare )
@@ -1771,12 +1770,11 @@ void SortedResultSet::ResortModified( EventList* pList )
 void SortedResultSet::ResortNew( EventList* pList )
 {
 sal_IntPtri, j, nNewPos, nVal;
-SortListData*pData;
 
 try {
 for ( i = mnLastSort; i(sal_IntPtr)maS2O.Count(); i++ )
 {
-pData = (SortListData*) maModList.GetObject( i );
+SortListData *pData = (SortListData*) maModList.GetObject( i );
 nNewPos = FindPos( pData, 1, mnLastSort );
 if ( nNewPos != i )
 {
diff --git a/ucb/source/ucp/ftp/test_ftpurl.cxx 
b/ucb/source/ucp/ftp/test_ftpurl.cxx
index bbc99ca..b93d2b0 100644
--- a/ucb/source/ucp/ftp/test_ftpurl.cxx
+++ b/ucb/source/ucp/ftp/test_ftpurl.cxx
@@ -245,7 +245,7 @@ int test_ftpopen(void)
 
 FILE* file = url.open();
 if(file) {
-int nbuf,ndest;
+int nbuf;
 const int bffsz = 256;
 char buff[bffsz];
 char *dest = (char*) malloc(sizeof(char));
@@ -254,7 +254,7 @@ int test_ftpopen(void)
 memset((void*)buff, 0, bffsz);
 fread(buff,bffsz-1,1,file);
 nbuf =