diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-12-09 12:42:25 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-12-09 12:49:33 +0000 |
commit | a4539f31078e13e559d512bfe0b0aa51c12a4d2f (patch) | |
tree | 0fa26ba0c408c18812dce00ef0ee4f65d4eacdf1 /rsc | |
parent | b36e3ef54890ce518e7331eba78fa80319bd7c40 (diff) |
cppcheck: can reduce the scope of these variables
Diffstat (limited to 'rsc')
-rw-r--r-- | rsc/source/tools/rsctools.cxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx index 91f88fa2c75c..15bf715fbc3a 100644 --- a/rsc/source/tools/rsctools.cxx +++ b/rsc/source/tools/rsctools.cxx @@ -152,18 +152,20 @@ ByteString GetTmpFileName() BOOL Append( FILE * fDest, ByteString aTmpFile ) { #define MAX_BUF 4096 - char szBuf[ MAX_BUF ]; - int nItems; - FILE *fSource; - - fSource = fopen( aTmpFile.GetBuffer(), "rb" ); - if( !fDest || !fSource ){ + FILE *fSource = fopen( aTmpFile.GetBuffer(), "rb" ); + if( !fDest || !fSource ) + { if( fSource ) fclose( fSource ); return FALSE; } - else{ - do{ // append + else + { + char szBuf[ MAX_BUF ]; + int nItems; + + do //appemd + { nItems = fread( szBuf, sizeof( char ), MAX_BUF, fSource ); fwrite( szBuf, sizeof( char ), nItems, fDest ); } while( MAX_BUF == nItems ); |