Hello,
Here is a small patch for Cppcheck cleaning on dbaccess
Question :
In the last "git-updated" cppcheck I use, i found this in core part of
dbaccess :
[./api/query.cxx:310]: (error) instance of "OAutoActionReset" object
destroyed immediately
I took a look and I don't understand what's the use of this class.
in query.cxx, we have this :
m_eDoingCurrently = SETTING_PROPERTIES; <- OK why not
OAutoActionReset(this); <- the constructor followed directly by the
destructor since the object is not used at all
m_xCommandDefinition->setPropertyValue(sAggPropName, _rValue);
in query.hxx
//
------------------------------------------------------------------------
/** a class which automatically resets m_eDoingCurrently in it's
destructor
*/
class OAutoActionReset; // just for the following friend
declaration
friend class OAutoActionReset;
class OAutoActionReset
{
OQuery* m_pActor;
public:
OAutoActionReset(OQuery* _pActor) : m_pActor(_pActor) { }
~OAutoActionReset() { m_pActor->m_eDoingCurrently = NONE; }
};
And i saw that m_eDoingCurrently wasn't used after in query.cxx
Could someone explain the meaning of all this ?
By the way, we can see the same kind of thing in api/querycontainer.cxx
(line 193)
(LGPLv3+ / MPL)
Julien
commit d0aa16bfd3e43a170d7cadd98066715112f333ed
Author: serval <serval2...@yahoo.fr>
Date: Sat Jan 15 00:00:46 2011 +0100
Some cppcheck cleaning
diff --git a/dbaccess/source/core/api/RowSet.cxx
b/dbaccess/source/core/api/RowSet.cxx
index 3775896..f12afb9 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -1821,7 +1821,6 @@ void
ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
::rtl::Reference< ::connectivity::OSQLColumns> aColumns = new
::connectivity::OSQLColumns();
::std::vector< ::rtl::OUString> aNames;
::rtl::OUString aDescription;
- sal_Int32 nFormatKey = 0;
const ::std::map<sal_Int32,sal_Int32>& rKeyColumns =
m_pCache->getKeyColumns();
if(!m_xColumns.is())
@@ -1872,7 +1871,7 @@ void
ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
try
{
- nFormatKey = 0;
+ sal_Int32 nFormatKey = 0;
if(m_xNumberFormatTypes.is())
nFormatKey =
::dbtools::getDefaultNumberFormat(pColumn,m_xNumberFormatTypes,aLocale);
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx
b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index 26d9ec1..b45850b 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -570,7 +570,7 @@ Reference< XComponent > SAL_CALL
ODocumentContainer::loadComponentFromURL( const
{
throw IllegalArgumentException();
}
- catch(WrappedTargetException e)
+ catch(WrappedTargetException &e)
{
throw;
}
diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx
b/dbaccess/source/ui/misc/linkeddocuments.cxx
index 517ab5b..69ef514 100644
--- a/dbaccess/source/ui/misc/linkeddocuments.cxx
+++ b/dbaccess/source/ui/misc/linkeddocuments.cxx
@@ -364,7 +364,7 @@ namespace dbaui
}
return xRet;
}
- catch (com::sun::star::io::WrongFormatException e)
+ catch (com::sun::star::io::WrongFormatException &e)
{
com::sun::star::sdbc::SQLException aSQLException;
aSQLException.Message = e.Message;
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice