[SOLVED] Re: Cppcheck: redundantAssignment about encoding in CreatePasswordToModifyHash (docfile.cxx, sfx2 module)

Julien Nabet serval2412 at yahoo.fr
Thu Apr 4 11:15:09 PDT 2013


On 04/04/2013 15:21, Caolán McNamara wrote:
> On Tue, 2013-04-02 at 14:13 -0700, julien2412 wrote:
>> ...
>> Cppcheck reported this:
>> sfx2/source/doc/docfile.cxx
>> 2626	redundantAssignment	style	Variable 'nEncoding' is reassigned a value
>> before the old one has been used.
>> ...
>> I took a look to the git history but it's quite confusing. Moreover UTF8
>> doesn't appear in the switch some lines below.
> back before b1ec4b2cd5a9e6ece0e2a928cc0a11fef6bbe818 there was a bMSType
> argument which protected the switch so it wasn't redundant back then.
>
> Looks like the remaining first branch "aka writer" means in practice the
> ms .doc format, and the other is the .xls format.
>
> Using the system encoding is rather foul looking to me but if that's the
> way it has "always" been done I'm comfortable enough just changing the
> code to be ...
>
> rtl_TextEncoding nEncoding = osl_getThreadTextEncoding();
Thank you Caolán for your feedback! I pushed the change on master 
sources (see 
http://cgit.freedesktop.org/libreoffice/core/commit/?id=7dce1c9fd2d26c9c2c53f0d307aa281972d2e82d)

Julien


More information about the LibreOffice mailing list