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


julien2412 píše v Ne 18. 03. 2012 v 10:24 -0700:
Hello,

Cppcheck reports this in sdext module :
[source/minimizer/optimizerdialog.cxx:276]: (warning) Logical disjunction
always evaluates to true: nNewStep >= 0 || nNewStep <= 4
Here is the line :
if ( ( nNewStep != mnCurrentStep ) && ( ( nNewStep <= MAX_STEP ) || (
nNewStep >= 0 ) ) )

Shouldn't it be :
if ( ( nNewStep != mnCurrentStep ) && ( nNewStep <= MAX_STEP ) && ( nNewStep
= 0 ) )

Yup, it makes perfect sense. I have pushed the change into both master
and 3-5 branch, see
http://cgit.freedesktop.org/libreoffice/core/commit/?id=9481eb32e76568fc675982479cc07c57c6a7cb39
http://cgit.freedesktop.org/libreoffice/core/commit/?h=libreoffice-3-5&id=8eb5b36284c3a6c6535508a3f0651be1b5ada2dc


Moreover, if I'm right, should we additionnally throw an exception (which
one ?) if "nNewStep" is not between 0 and MAX_STEP 

I would leave it as is. The affected method is
OptimizerDialog::SwitchPage. IMHO, it is better to do not switch pages
instead of canceling the whole operation with an useless exception.


Best Regards,
Petr


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.