Cppcheck: some other reports in dbaccess

julien2412 serval2412 at yahoo.fr
Wed Jun 12 13:45:39 PDT 2013


Hello,

Cppcheck reported these:
[source/filter/xml/dbloader2.cxx:626] ->
[source/filter/xml/dbloader2.cxx:629]: (performance) Variable 'xNewKey' is
reassigned a value before the old one has been used.
[source/ui/browser/dbloader.cxx:166] ->
[source/ui/browser/dbloader.cxx:170]: (performance) Variable 'xNewKey' is
reassigned a value before the old one has been used.
in both codes, we can find this part:
    166     Reference< XRegistryKey> xNewKey = xKey->createKey( aImpltwo );
    167     aImpltwo = aImpl;
    168     aImpltwo += "/Loader";
    169     Reference< XRegistryKey >  xLoaderKey = xKey->createKey(
aImpltwo );
    170     xNewKey = xLoaderKey->createKey( OUString("Pattern") );
    171     xNewKey->setAsciiValue( OUString(".component:DB*") );
http://opengrok.libreoffice.org/xref/core/dbaccess/source/ui/browser/dbloader.cxx#156

[source/ui/app/AppDetailPageHelper.cxx:259]: (style) Variable 'm_pLists' is
assigned a value that is never used.
    251         if ( m_pLists[i] )
    252         {
    253             m_pLists[i]->clearCurrentSelection();
    254             m_pLists[i]->Hide();
    255             SAL_WNODEPRECATED_DECLARATIONS_PUSH
    256             ::std::auto_ptr<DBTreeListBox> aTemp(m_pLists[i]);
    257             SAL_WNODEPRECATED_DECLARATIONS_POP
    258             m_pLists[i]->clearCurrentSelection();   // why a second
time?
    259             m_pLists[i] = NULL;
    260         }
See
http://opengrok.libreoffice.org/xref/core/dbaccess/source/ui/app/AppDetailPageHelper.cxx#196
In any method I would have thought about a false positive but in a
destructor?
Also notice the double clearCurrentSelection as indicated by the comment +
mechanism to ignore deprecated part, this whole part is quite confusing.

[source/ui/querydesign/QueryDesignView.cxx:1389] ->
[source/ui/querydesign/QueryDesignView.cxx:1391]: (performance) Variable
'eErrorCode' is reassigned a value before the old one has been used.
   1386             if ( SQL_ISRULE( pSearchCondition, search_condition) )
// we have a or
   1387             {
   1388                 _pSelectionBrw->DuplicateConditionLevel( nLevel);
   1389                 eErrorCode =
GetORCriteria(_pView,_pSelectionBrw,pSearchCondition->getChild(0),
nLevel,bHaving,bMustAddOrOnOneLine );
   1390                 ++nLevel;
   1391                 eErrorCode =
GetORCriteria(_pView,_pSelectionBrw,pSearchCondition->getChild(2),
nLevel,bHaving,bMustAddOrOnOneLine );
   1392             }
Like this since commit 1c9a2c66530772d4c31f9115ec88e33b2dcdee39, 2009/11/11

Julien



--
View this message in context: http://nabble.documentfoundation.org/Cppcheck-some-other-reports-in-dbaccess-tp4061159.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list