Cppcheck reports "Division by zero" in new.cxx (sfx2 module)
julien2412
serval2412 at yahoo.fr
Sat Mar 22 06:50:03 PDT 2014
Hello,
Cppcheck reported this:
sfx2/source/doc/new.cxx
81 zerodiv error Division by zero.
Indeed we have this:
74 #define FRAME 4
75 long nWidth = pWindow->GetOutputSize().Width() - 2*FRAME;
76 long nHeight = pWindow->GetOutputSize().Height() - 2*FRAME;
77 if( nWidth < 0 ) nWidth = 0;
78 if( nHeight < 0 ) nHeight = 0;
79
80 double dRatio=((double)aTmpSize.Width())/aTmpSize.Height();
81 double dRatioPreV=((double) nWidth ) / nHeight;
(see http://opengrok.libreoffice.org/xref/core/sfx2/source/doc/new.cxx#74)
Should line 78 be replaced by:
if( nHeight < 0 ) nHeight = 1;
or should we do something completely different?
Julien
--
View this message in context: http://nabble.documentfoundation.org/Cppcheck-reports-Division-by-zero-in-new-cxx-sfx2-module-tp4102613.html
Sent from the Dev mailing list archive at Nabble.com.
More information about the LibreOffice
mailing list