diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-05-27 11:40:36 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-05-27 11:40:36 +0200 |
commit | 9549fb88f0d00c384b291645df45f4af5d6e8a8a (patch) | |
tree | d57186911752dbcf07d7d0b6fecd6cbac425da0e | |
parent | 668408fa1c69eaf0f0a37f24e2ec8b4a38fe3db7 (diff) |
Prevent accidental mis-uses of VclPtr address-of operator
Change-Id: Ie3588d502e9545ea64bf836b2a0bdc0caead2247
-rw-r--r-- | dbaccess/source/ui/dlg/advancedsettings.cxx | 36 | ||||
-rw-r--r-- | include/vcl/vclptr.hxx | 8 |
2 files changed, 28 insertions, 16 deletions
diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx index 2fe318634f13..c09ebabd7bef 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.cxx +++ b/dbaccess/source/ui/dlg/advancedsettings.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <memory> + #include "advancedsettings.hxx" #include "advancedsettingsdlg.hxx" #include "moduledbu.hxx" @@ -169,22 +173,22 @@ namespace dbaui // for easier maintenance, write the table in this form, then copy it to m_aBooleanSettings BooleanSettingDesc aSettings[] = { - { &m_pIsSQL92Check, "usesql92", DSID_SQL92CHECK, false }, - { &m_pAppendTableAlias, "append", DSID_APPEND_TABLE_ALIAS, false }, - { &m_pAsBeforeCorrelationName, "useas", DSID_AS_BEFORE_CORRNAME, false }, - { &m_pEnableOuterJoin, "useoj", DSID_ENABLEOUTERJOIN, false }, - { &m_pIgnoreDriverPrivileges, "ignoreprivs", DSID_IGNOREDRIVER_PRIV, false }, - { &m_pParameterSubstitution, "replaceparams", DSID_PARAMETERNAMESUBST, false }, - { &m_pSuppressVersionColumn, "displayver", DSID_SUPPRESSVERSIONCL, true }, - { &m_pCatalog, "usecatalogname", DSID_CATALOG, false }, - { &m_pSchema, "useschemaname", DSID_SCHEMA, false }, - { &m_pIndexAppendix, "createindex", DSID_INDEXAPPENDIX, false }, - { &m_pDosLineEnds, "eol", DSID_DOSLINEENDS, false }, - { &m_pCheckRequiredFields, "ignorecurrency", DSID_CHECK_REQUIRED_FIELDS, false }, - { &m_pIgnoreCurrency, "inputchecks", DSID_IGNORECURRENCY, false }, - { &m_pEscapeDateTime, "useodbcliterals", DSID_ESCAPE_DATETIME, false }, - { &m_pPrimaryKeySupport, "primarykeys", DSID_PRIMARY_KEY_SUPPORT, false }, - { &m_pRespectDriverResultSetType, "resulttype", DSID_RESPECTRESULTSETTYPE, false } + { std::addressof(m_pIsSQL92Check), "usesql92", DSID_SQL92CHECK, false }, + { std::addressof(m_pAppendTableAlias), "append", DSID_APPEND_TABLE_ALIAS, false }, + { std::addressof(m_pAsBeforeCorrelationName), "useas", DSID_AS_BEFORE_CORRNAME, false }, + { std::addressof(m_pEnableOuterJoin), "useoj", DSID_ENABLEOUTERJOIN, false }, + { std::addressof(m_pIgnoreDriverPrivileges), "ignoreprivs", DSID_IGNOREDRIVER_PRIV, false }, + { std::addressof(m_pParameterSubstitution), "replaceparams", DSID_PARAMETERNAMESUBST, false }, + { std::addressof(m_pSuppressVersionColumn), "displayver", DSID_SUPPRESSVERSIONCL, true }, + { std::addressof(m_pCatalog), "usecatalogname", DSID_CATALOG, false }, + { std::addressof(m_pSchema), "useschemaname", DSID_SCHEMA, false }, + { std::addressof(m_pIndexAppendix), "createindex", DSID_INDEXAPPENDIX, false }, + { std::addressof(m_pDosLineEnds), "eol", DSID_DOSLINEENDS, false }, + { std::addressof(m_pCheckRequiredFields), "ignorecurrency", DSID_CHECK_REQUIRED_FIELDS, false }, + { std::addressof(m_pIgnoreCurrency), "inputchecks", DSID_IGNORECURRENCY, false }, + { std::addressof(m_pEscapeDateTime), "useodbcliterals", DSID_ESCAPE_DATETIME, false }, + { std::addressof(m_pPrimaryKeySupport), "primarykeys", DSID_PRIMARY_KEY_SUPPORT, false }, + { std::addressof(m_pRespectDriverResultSetType), "resulttype", DSID_RESPECTRESULTSETTYPE, false } }; for ( const BooleanSettingDesc& pCopy : aSettings ) diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx index ad7d1e20d9eb..c1b1fb656926 100644 --- a/include/vcl/vclptr.hxx +++ b/include/vcl/vclptr.hxx @@ -223,6 +223,14 @@ public: { return (m_rInnerRef > handle.m_rInnerRef); } + + /** Deleted address-of operator. + + To avoid confusion whether it returns the address of either the + pointed-to raw object (for which to use VclPtr::get instead) or the + wrapper itself (for which to use std::addressof instead). + */ + void operator &() = delete; }; // class VclPtr template<typename T1, typename T2> |