diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-05-24 16:36:54 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-05-25 09:26:14 +0100 |
commit | cf9b0830c5e574d6c4a16ea2a179720dde26e811 (patch) | |
tree | 0187bcefb37d8fc47382c7c3aa84412e1542e09b /rsc | |
parent | 268ddf96756be5a850645f0c67e91cf7369a77f4 (diff) |
WaE: return value of fwrite unchecked
Change-Id: Ib3713290a7dcd4bbbb58232d144e35694653a4a5
Diffstat (limited to 'rsc')
-rw-r--r-- | rsc/source/tools/rsctools.cxx | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx index 70ef44138f0b..bda03a4c7291 100644 --- a/rsc/source/tools/rsctools.cxx +++ b/rsc/source/tools/rsctools.cxx @@ -145,20 +145,20 @@ sal_Bool Append(FILE * fDest, const rtl::OString &rTmpFile) fclose( fSource ); return sal_False; } - 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 ); + bool bSuccess = true; + char szBuf[ MAX_BUF ]; + size_t nItems; - fclose( fSource ); - }; - return sal_True; + do //appemd + { + nItems = fread( szBuf, 1, MAX_BUF, fSource ); + bSuccess = (nItems == fwrite(szBuf, 1, nItems, fDest)); + SAL_WARN_IF(!bSuccess, "rsc", "short write"); + } while (MAX_BUF == nItems && bSuccess); + + fclose( fSource ); + return bSuccess; } sal_Bool Append(const rtl::OString &rOutputSrs, const rtl::OString &rTmpFile) |