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

julien2412 serval2412 at yahoo.fr
Tue Apr 2 14:13:09 PDT 2013


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.

   2610 sal_uInt32 SfxMedium::CreatePasswordToModifyHash( const
::rtl::OUString& aPasswd, sal_Bool bWriter )
   2611 {
   2612     sal_uInt32 nHash = 0;
   2613 
   2614     if ( !aPasswd.isEmpty() )
   2615     {
   2616         if ( bWriter )
   2617         {
   2618             nHash =
::comphelper::DocPasswordHelper::GetWordHashAsUINT32( aPasswd );
   2619         }
   2620         else
   2621         {
   2622             rtl_TextEncoding nEncoding = RTL_TEXTENCODING_UTF8;
   2623 
   2624             // if the MS-filter should be used
   2625             // use the inconsistent algorithm to find the encoding
specified by MS
   2626             nEncoding = osl_getThreadTextEncoding();

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.

Any idea how should it be changed ?

Julien



--
View this message in context: http://nabble.documentfoundation.org/Cppcheck-redundantAssignment-about-encoding-in-CreatePasswordToModifyHash-docfile-cxx-sfx2-module-tp4047586.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list