[SOLVED] Re: Cppcheck reports 'nMaxWidth' is assigned a value never used (svtools module)

Julien Nabet serval2412 at yahoo.fr
Fri Mar 1 03:29:08 PST 2013


On 28/02/2013 12:58, Caolán McNamara wrote:
> On Tue, 2013-02-12 at 08:13 -0800, julien2412 wrote:
>>      544     if( nMaxWidth>  aSize.Width() )
>>      545     {
>> ...
>>      556     }
>>      557     else
>>      558         nMaxWidth = aSize.Width();
>>
>> see
>> http://opengrok.libreoffice.org/xref/core/svtools/source/dialogs/filedlg2.cxx#544
>>
>> Any idea what should be done with this?
> It's another "been like this since day 0", go ahead and remove the
> does-nothing else branch. (The exciting manual move of widgets around
> and determination of the size etc can all eventually go if it gets
> converted to the widget layout stuff)
>
>> I noticed these lines in tools/inc/tools/gen.hxx:
>> long            Width() const  { return nA; }
>> long&             Width() const  { return nA; }
>> I must recognize I don't understand the interest since there's a setWidth
>> function
> and setWidth just calls the second Width() variant. I can only speculate
> it was an ancient abandoned incremental cleanup effort to remove one or
> the other.
As usual, thank you for your feedback Caolán! :-)
I pushed a commit on master, see 
http://cgit.freedesktop.org/libreoffice/core/commit/?id=9509f5c7923ebd9a95068dd7b9231af79080b6bf
Finally, I replaced Width() by setWidth method to make it clearer.

Julien


More information about the LibreOffice mailing list