From cf9b0830c5e574d6c4a16ea2a179720dde26e811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 24 May 2012 16:36:54 +0100 Subject: [PATCH] WaE: return value of fwrite unchecked Change-Id: Ib3713290a7dcd4bbbb58232d144e35694653a4a5 --- rsc/source/tools/rsctools.cxx | 24 ++++++++++++------------ 1 file 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 + + bool bSuccess = true; + char szBuf[ MAX_BUF ]; + size_t nItems; + + do //appemd { - char szBuf[ MAX_BUF ]; - int nItems; + 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); - do //appemd - { - nItems = fread( szBuf, sizeof( char ), MAX_BUF, fSource ); - fwrite( szBuf, sizeof( char ), nItems, fDest ); - } while( MAX_BUF == nItems ); - - fclose( fSource ); - }; - return sal_True; + fclose( fSource ); + return bSuccess; } sal_Bool Append(const rtl::OString &rOutputSrs, const rtl::OString &rTmpFile)