Cppcheck: redundantAssignment about encoding in CreatePasswordToModifyHash (docfile.cxx, sfx2 module)

Caolán McNamara caolanm at redhat.com
Thu Apr 4 06:21:58 PDT 2013


On Tue, 2013-04-02 at 14:13 -0700, julien2412 wrote:
> Hello,
> 
> Cppcheck reported this:
> sfx2/source/doc/docfile.cxx
> 2626	redundantAssignment	style	Variable 'nEncoding' is reassigned a value
> before the old one has been used.
> 
> See
> http://opengrok.libreoffice.org/xref/core/sfx2/source/doc/docfile.cxx#2610
> 
> 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();

C.



More information about the LibreOffice mailing list