[Libreoffice-commits] core.git: basic/source

Michael Weghorn m.weghorn at posteo.de
Sat Dec 6 06:13:05 PST 2014


 basic/source/classes/eventatt.cxx |    2 +-
 basic/source/classes/sbunoobj.cxx |    2 +-
 basic/source/comp/scanner.cxx     |    3 +--
 basic/source/runtime/ddectrl.cxx  |    3 +--
 basic/source/uno/namecont.cxx     |    3 +--
 5 files changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 93124f771062eb2917212c16a64b0a67f5baaff4
Author: Michael Weghorn <m.weghorn at posteo.de>
Date:   Sat Dec 6 01:31:14 2014 +0100

    reduce scope of local variables
    
    This eliminates some of the warnings from Cppcheck report of
    2014-11-29.
    
    Change-Id: Ic4bf3bd8f5982d2ea2f25a28c0dd61084c59af11
    Reviewed-on: https://gerrit.libreoffice.org/13331
    Reviewed-by: Samuel Mehrbrodt <s.mehrbrodt at gmail.com>
    Tested-by: Samuel Mehrbrodt <s.mehrbrodt at gmail.com>

diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index 3718e16..d7f97ab 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -464,9 +464,9 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
     uno::Reference< beans::XPropertySet > xDlgModPropSet( xDialogModel, uno::UNO_QUERY );
     if( xDlgModPropSet.is() )
     {
-        bool bDecoration = true;
         try
         {
+            bool bDecoration = true;
             OUString aDecorationPropName("Decoration");
             Any aDecorationAny = xDlgModPropSet->getPropertyValue( aDecorationPropName );
             aDecorationAny >>= bDecoration;
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 36e419e..0627a7f 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -3630,7 +3630,6 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
             // Parameter count -1 because of Param0 == this
             sal_uInt32 nParamCount = pParams ? ((sal_uInt32)pParams->Count() - 1) : 0;
             Sequence<Any> args;
-            bool bOutParams = false;
 
             Reference< XServiceConstructorDescription > xCtor = pUnoCtor->getServiceCtorDesc();
             Sequence< Reference< XParameter > > aParameterSeq = xCtor->getParameters();
@@ -3689,6 +3688,7 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
 
             if( !bParameterError )
             {
+                bool bOutParams = false;
                 if( nAllocParamCount > 0 )
                 {
                     args.realloc( nAllocParamCount );
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index 6065e26..7708bc9 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -440,7 +440,6 @@ bool SbiScanner::NextSym()
         // Hex literals are signed Integers ( as defined by basic
         // e.g. -2,147,483,648 through 2,147,483,647 (signed)
         sal_uInt32 lu = 0;
-        int i;
         bool bBufOverflow = false;
         while(nCol < aLine.getLength() &&  theBasicCharClass::get().isAlphaNumeric(aLine[nCol] & 0xFF, bCompatible))
         {
@@ -461,7 +460,7 @@ bool SbiScanner::NextSym()
         *p = 0;
         for( p = buf; *p; ++p )
         {
-            i = (*p & 0xFF) - '0';
+            int i = (*p & 0xFF) - '0';
             if( i > 9 ) i -= 7;
             lu = ( lu * base ) + i;
             if( !ndig-- )
diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx
index 9641289..2557c9e 100644
--- a/basic/source/runtime/ddectrl.cxx
+++ b/basic/source/runtime/ddectrl.cxx
@@ -140,10 +140,9 @@ SbError SbiDdeControl::Terminate( size_t nChannel )
 
 SbError SbiDdeControl::TerminateAll()
 {
-    DdeConnection *conv;
     for (size_t nChannel = 0; nChannel < aConvList.size(); ++nChannel)
     {
-        conv = aConvList[nChannel];
+        DdeConnection *conv = aConvList[nChannel];
 
         if (conv != DDE_FREECHANNEL)
         {
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index d95596d..f9a5fd5 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -1681,11 +1681,10 @@ bool SfxLibraryContainer::implLoadLibraryIndexFile(  SfxLibrary* pLib,
 {
     Reference< XParser > xParser = xml::sax::Parser::create(mxContext);
 
-    bool bLink = false;
     bool bStorage = false;
     if( pLib )
     {
-        bLink = pLib->mbLink;
+        bool bLink = pLib->mbLink;
         bStorage = xStorage.is() && !bLink;
     }
 


More information about the Libreoffice-commits mailing list