Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hello,

Taking a look at this cppcheck report:
dlc/source/idlccompile.cxx
198     nullPointer     error   Possible null pointer dereference: source - otherwise
it is redundant to check it against null.

I don't understand the function "sal_Bool copyFile(const OString* source,
const OString& target)", above all this part:
    192     while ( !feof(pSource) )
    193     {
    194         if ( (readSize = fread(pBuffer, 1, totalSize, pSource)) > 0
&& !ferror(pSource) )
    195         {
    196             if ( (fwrite(pBuffer, 1, readSize, pTarget)) != readSize
|| ferror(pTarget) )
    197             {
    198                 if (source != 0) {
    199                     fclose(pSource);
    200                 }
    201                 fclose(pTarget);
    202                 return sal_False;
    203             }
    204         }
    205     }
see
http://opengrok.libreoffice.org/xref/core/idlc/source/idlccompile.cxx#173
Isn't it overcomplicated? Why reading a file 1 per 1 byte for example?

Julien



--
View this message in context: 
http://nabble.documentfoundation.org/About-idlc-source-idlccompile-cxx-tp4028889.html
Sent from the Dev mailing list archive at Nabble.com.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.