summaryrefslogtreecommitdiff
path: root/rsc
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2014-12-19 10:24:04 +0100
committerNoel Grandin <noelgrandin@gmail.com>2014-12-19 13:48:56 +0000
commit5712983f18e7cdec16ea20a9b3d94a1586de543e (patch)
tree80180ebbf5662ead34dff534e5a14b251dafa28d /rsc
parent1e2786ac6d51838308c27a2cb84ce8ad9acd59c9 (diff)
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 <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'rsc')
-rw-r--r--rsc/source/parser/rscdb.cxx9
-rw-r--r--rsc/source/prj/start.cxx6
-rw-r--r--rsc/source/rsc/rsc.cxx6
-rw-r--r--rsc/source/tools/rscdef.cxx11
4 files changed, 10 insertions, 22 deletions
diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx
index 25d78f66d5b4..6af2194d4890 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 d42f0d8a58d1..fd2de9478a2b 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 4b48405b76cf..3a2115bca037 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 d89700ef0072..99bec484a792 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 );
};