diff options
author | Noel Grandin <noel@peralex.com> | 2014-06-18 12:14:29 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-06-24 11:34:21 +0200 |
commit | e2080e70fe8b085f18e868e46340454720fa94ca (patch) | |
tree | 4038d1d57b41b68a47d5ebbbe6ad390648ec6303 /connectivity | |
parent | f910280b8704ed9c289150a4ca3c8d60e15d0d97 (diff) |
new compilerplugin returnbyref
Find places where we are returning a pointer to something, where we can
be returning a reference.
e.g.
class A {
struct X x;
public X* getX() { return &x; }
}
which can be:
public X& getX() { return x; }
Change-Id: I796fd23fd36a18aedf6e36bc28f8fab4f518c6c7
Diffstat (limited to 'connectivity')
6 files changed, 10 insertions, 10 deletions
diff --git a/connectivity/source/drivers/mork/MNSINIParser.hxx b/connectivity/source/drivers/mork/MNSINIParser.hxx index afdd742d5185..1967cf3d4675 100644 --- a/connectivity/source/drivers/mork/MNSINIParser.hxx +++ b/connectivity/source/drivers/mork/MNSINIParser.hxx @@ -63,7 +63,7 @@ class IniParser { IniSectionMap mAllSection; public: - IniSectionMap * getAllSection(){return &mAllSection;}; + IniSectionMap& getAllSection() { return mAllSection; } IniParser(OUString const & rIniName) throw(com::sun::star::io::IOException); }; diff --git a/connectivity/source/drivers/mork/MNSProfileDiscover.cxx b/connectivity/source/drivers/mork/MNSProfileDiscover.cxx index 7622c8074fd3..401fc48bf1ee 100644 --- a/connectivity/source/drivers/mork/MNSProfileDiscover.cxx +++ b/connectivity/source/drivers/mork/MNSProfileDiscover.cxx @@ -66,7 +66,7 @@ namespace connectivity OUString regDir = getRegistryDir(product); OUString profilesIni = regDir + "profiles.ini"; IniParser parser( profilesIni ); - IniSectionMap &mAllSection = *(parser.getAllSection()); + IniSectionMap &mAllSection = parser.getAllSection(); IniSectionMap::iterator iBegin = mAllSection.begin(); IniSectionMap::iterator iEnd = mAllSection.end(); diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx index b5795c1c668b..7a5a2acc4d45 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx @@ -62,7 +62,7 @@ class IniParser { IniSectionMap mAllSection; public: - IniSectionMap * getAllSection(){return &mAllSection;}; + IniSectionMap& getAllSection() { return mAllSection; } IniParser(OUString const & rIniName) throw(com::sun::star::io::IOException); }; diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx index 6660a5c9b690..1d5e5d34c820 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx @@ -148,7 +148,7 @@ namespace connectivity OUString regDir = getRegistryDir(product); OUString profilesIni = regDir + "profiles.ini"; IniParser parser( profilesIni ); - IniSectionMap &mAllSection = *(parser.getAllSection()); + IniSectionMap &mAllSection = parser.getAllSection(); IniSectionMap::iterator iBegin = mAllSection.begin(); IniSectionMap::iterator iEnd = mAllSection.end(); diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx index 67dfaeef65ed..74eb5c327b27 100644 --- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx +++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx @@ -373,8 +373,8 @@ void OPreparedStatement::setParameter(const sal_Int32 parameterIndex, const sal_ SQLSMALLINT fCType, fSqlType; OTools::getBindTypes(useWChar, m_pConnection->useOldDateFormat(), OTools::jdbcTypeToOdbc(_nType), fCType, fSqlType); - SQLLEN *pDataLen=boundParams[parameterIndex-1].getBindLengthBuffer(); - *pDataLen=_nDataLen; + SQLLEN& rDataLen = boundParams[parameterIndex-1].getBindLengthBuffer(); + rDataLen = _nDataLen; SQLRETURN nRetcode; nRetcode = (*(T3SQLBindParameter)m_pConnection->getOdbcFunction(ODBC3SQLBindParameter))( @@ -389,7 +389,7 @@ void OPreparedStatement::setParameter(const sal_Int32 parameterIndex, const sal_ // we trust the ODBC driver not to touch it because SQL_PARAM_INPUT const_cast<void*>(_pData), _nDataAllocLen, - pDataLen); + &rDataLen); OTools::ThrowException(m_pConnection, nRetcode, m_aStatementHandle, SQL_HANDLE_STMT, *this); } @@ -742,7 +742,7 @@ SQLLEN* OPreparedStatement::getLengthBuf (sal_Int32 index) if ((index >= 1) && (index <= numParams)) { - b = boundParams[index - 1].getBindLengthBuffer (); + b = &boundParams[index - 1].getBindLengthBuffer (); } return b; diff --git a/connectivity/source/inc/odbc/OBoundParam.hxx b/connectivity/source/inc/odbc/OBoundParam.hxx index 4c0eaccb8243..d851e2a2740e 100644 --- a/connectivity/source/inc/odbc/OBoundParam.hxx +++ b/connectivity/source/inc/odbc/OBoundParam.hxx @@ -73,9 +73,9 @@ namespace connectivity // getBindLengthBuffer // Returns the length buffer to be used when binding to a parameter - SQLLEN* getBindLengthBuffer () + SQLLEN& getBindLengthBuffer () { - return ¶mLength; + return paramLength; } |