cppcheck: duplicate branch for ParaPropertyPanel (svx) + interpr7.cxx (sc)

julien2412 serval2412 at yahoo.fr
Fri Sep 27 14:52:36 PDT 2013


Hello,

Cppcheck reported this:
sc/source/core/tool/interpr7.cxx
94	duplicateBranch	style	Found duplicate branches for 'if' and 'else'.

     87                         if(pNodeSet->nodeTab[0]->type ==
XML_NAMESPACE_DECL)
     88                         {
     89                             xmlNsPtr ns =
(xmlNsPtr)pNodeSet->nodeTab[0];
     90                             xmlNodePtr cur = (xmlNodePtr)ns->next;
     91                             boost::shared_ptr<xmlChar>
pChar2(xmlNodeGetContent(cur), xmlFree);
     92                             aResult =
OUString::createFromAscii((char*)pChar2.get());
     93                         }
     94                         else if(pNodeSet->nodeTab[0]->type ==
XML_ELEMENT_NODE)
     95                         {
     96                             xmlNodePtr cur = pNodeSet->nodeTab[0];
     97                             boost::shared_ptr<xmlChar>
pChar2(xmlNodeGetContent(cur), xmlFree);
     98                             aResult =
OUString::createFromAscii((char*)pChar2.get());
     99                         }
    100                         else
    101                         {
    102                             xmlNodePtr cur = pNodeSet->nodeTab[0];
    103                             boost::shared_ptr<xmlChar>
pChar2(xmlNodeGetContent(cur), xmlFree);
    104                             aResult =
OUString::createFromAscii((char*)pChar2.get());
    105                         }

See
http://opengrok.libreoffice.org/xref/core/sc/source/core/tool/interpr7.cxx#87

and this:
svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
309	duplicateBranch	style	Found duplicate branches for 'if' and 'else'.
328	duplicateBranch	style	Found duplicate branches for 'if' and 'else'.
Indeed:
    309     if( Application::GetSettings().GetLayoutRTL())
    310     {
    311         mpTbxIndent_IncDec->SetItemImage(nIdIncrement,
maIncIndentControl.GetIcon());
    312         mpTbxIndent_IncDec->SetItemImage(nIdDecrement,
maDecIndentControl.GetIcon());
    313     }
    314     else
    315     {
    316         mpTbxIndent_IncDec->SetItemImage(nIdIncrement,
maIncIndentControl.GetIcon());
    317         mpTbxIndent_IncDec->SetItemImage(nIdDecrement,
maDecIndentControl.GetIcon());
    318     }

(the same for part around line 328)
See
http://opengrok.libreoffice.org/xref/core/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx#309

I suppose it should be fixed but I don't know how.
Any idea?

Julien




--
View this message in context: http://nabble.documentfoundation.org/cppcheck-duplicate-branch-for-ParaPropertyPanel-svx-interpr7-cxx-sc-tp4075486.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list