rsc/source/parser/rscdb.cxx |    9 +++------
 rsc/source/prj/start.cxx    |    6 ++----
 rsc/source/rsc/rsc.cxx      |    6 ++----
 rsc/source/tools/rscdef.cxx |   11 +++--------
 4 files changed, 10 insertions(+), 22 deletions(-)

New commits:
commit 5712983f18e7cdec16ea20a9b3d94a1586de543e
Author: Michael Weghorn <m.wegh...@posteo.de>
Date:   Fri Dec 19 10:24:04 2014 +0100

    fdo#39440 rsc: reduce scope of local variables
    
    This addresses some cppcheck warnings.
    
    Change-Id: I69454a75c8ce4aecf9e68f5887f38f8bf6fe6dca
    Reviewed-on: https://gerrit.libreoffice.org/13543
    Reviewed-by: Noel Grandin <noelgran...@gmail.com>
    Tested-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx
index 25d78f66..6af2194 100644
--- a/rsc/source/parser/rscdb.cxx
+++ b/rsc/source/parser/rscdb.cxx
@@ -329,18 +329,15 @@ void RscTypCont :: WriteInc( FILE * fOutput, sal_uLong 
lFileKey )
     }
     else
     {
-        RscDepend *     pDep;
-        RscFile   *     pFile;
-
         RscFile   *     pFName = aFileTab.Get( lFileKey );
         if( pFName )
         {
             for ( size_t i = 0, n = pFName->aDepLst.size(); i < n; ++i )
             {
-                pDep = pFName->aDepLst[ i ];
+                RscDepend* pDep = pFName->aDepLst[ i ];
                 if( pDep->GetFileKey() != lFileKey )
                 {
-                    pFile = aFileTab.GetFile( pDep->GetFileKey() );
+                    RscFile* pFile = aFileTab.GetFile( pDep->GetFileKey() );
                     if( pFile )
                     {
                         fprintf( fOutput, "#include " );
@@ -525,7 +522,6 @@ ERRTYPE RscTypCont::WriteRc( WriteRcContext& rContext )
 void RscTypCont :: WriteSrc( FILE * fOutput, sal_uLong nFileKey,
                              bool bName )
 {
-    RscFile     *   pFName;
     RscEnumerateRef aEnumRef( this, pRoot, fOutput );
 
     unsigned char aUTF8BOM[3] = { 0xef, 0xbb, 0xbf };
@@ -534,6 +530,7 @@ void RscTypCont :: WriteSrc( FILE * fOutput, sal_uLong 
nFileKey,
     SAL_WARN_IF(!bSuccess, "rsc", "short write");
     if( bName )
     {
+        RscFile* pFName;
         WriteInc( fOutput, nFileKey );
 
         if( NOFILE_INDEX == nFileKey )
diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx
index d42f0d8..fd2de94 100644
--- a/rsc/source/prj/start.cxx
+++ b/rsc/source/prj/start.cxx
@@ -157,7 +157,6 @@ static bool CallRsc2( RscStrList * pInputList,
                       const OString &rSrsName, RscPtrPtr * pCmdLine )
 {
     int nRet;
-    OString*  pString;
     RscVerbosity eVerbosity = RscVerbosityNormal;
 
     RscPtrPtr aNewCmdL;
@@ -196,7 +195,7 @@ static bool CallRsc2( RscStrList * pInputList,
 
     for ( size_t i = 0, n = pInputList->size(); i < n; ++i )
     {
-        pString = (*pInputList)[ i ];
+        OString* pString = (*pInputList)[ i ];
         aNewCmdL.Append( rsc_strdup( pString->getStr() ) );
     }
 
@@ -231,7 +230,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
     char **     ppStr;
     RscPtrPtr   aCmdLine;       // Kommandozeile
     sal_uInt32  i;
-    OString*    pString;
 
     pStr = ::ResponseFile( &aCmdLine, argv, argc );
     if( pStr )
@@ -314,7 +312,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
 
         for ( size_t k = 0, n = aInputList.size(); k < n; ++k )
         {
-            pString = aInputList[ k ];
+            OString* pString = aInputList[ k ];
             aTmpName = ::GetTmpFileName();
             if( !CallPrePro( *pString, aTmpName, &aCmdLine, bResponse ) )
             {
diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx
index 4b48405..3a2115b 100644
--- a/rsc/source/rsc/rsc.cxx
+++ b/rsc/source/rsc/rsc.cxx
@@ -390,7 +390,6 @@ void RscCompiler::EndCompile()
         if( !(pCL->nCommands & NOSYNTAX_FLAG) )
         {
             FILE        * foutput;
-            RscFile     * pFN;
 
             if( NULL == (foutput = fopen( pCL->aOutputSrs.getStr(), "w" )) )
                 pTC->pEH->FatalError( ERR_OPENFILE, RscId(), 
pCL->aOutputSrs.getStr() );
@@ -400,7 +399,7 @@ void RscCompiler::EndCompile()
                 sal_uIntPtr aIndex = pTC->aFileTab.FirstIndex();
                 while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND )
                 {
-                    pFN = pTC->aFileTab.Get( aIndex );
+                    RscFile* pFN = pTC->aFileTab.Get( aIndex );
                     if( !pFN->IsIncFile() )
                     {
                         pTC->WriteSrc( foutput, NOFILE_INDEX, false );
@@ -476,14 +475,13 @@ ERRTYPE RscCompiler :: ParseOneFile( sal_uLong lFileKey,
         aError = ERR_ERROR;
     else if( !pFName->bLoaded )
     {
-        RscDepend * pDep;
 
         //Include-Dateien vorher lesen
         pFName->bLoaded = true; //Endlos Rekursion vermeiden
 
         for ( size_t i = 0; i < pFName->aDepLst.size() && aError.IsOk(); ++i )
         {
-            pDep = pFName->aDepLst[ i ];
+            RscDepend* pDep = pFName->aDepLst[ i ];
             aError = ParseOneFile( pDep->GetFileKey(), pOutputFile, pContext );
         }
 
diff --git a/rsc/source/tools/rscdef.cxx b/rsc/source/tools/rscdef.cxx
index d89700e..99bec48 100644
--- a/rsc/source/tools/rscdef.cxx
+++ b/rsc/source/tools/rscdef.cxx
@@ -392,11 +392,9 @@ RscFile :: ~RscFile()
 
 bool RscFile::Depend( sal_uLong lDepend, sal_uLong lFree )
 {
-    RscDepend * pDep;
-
     for ( size_t i = aDepLst.size(); i > 0; )
     {
-        pDep = aDepLst[ --i ];
+        RscDepend * pDep = aDepLst[ --i ];
         if( pDep->GetFileKey() == lDepend )
         {
             for ( size_t j = i ? --i : 0; j > 0; )
@@ -442,10 +440,9 @@ RscDefTree::~RscDefTree()
 
 void RscDefTree::Remove()
 {
-    RscDefine * pDef;
     while( pDefRoot )
     {
-        pDef = pDefRoot;
+        RscDefine * pDef = pDefRoot;
         pDefRoot = static_cast<RscDefine *>(pDefRoot->Remove( pDefRoot ));
         pDef->DecRef();
     }
@@ -647,11 +644,9 @@ void RscFileTab :: DeleteFileContext( sal_uLong lFileKey )
     pFName = GetFile( lFileKey );
     if( pFName )
     {
-        RscDefine * pDef;
-
         for ( size_t i = 0, n = pFName->aDefLst.maList.size(); i < n; ++i )
         {
-            pDef = pFName->aDefLst.maList[ i ];
+            RscDefine * pDef = pFName->aDefLst.maList[ i ];
             aDefTree.Remove( pDef );
         };
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to