[Libreoffice-commits] core.git: 2 commits - cui/source dbaccess/source framework/source include/vcl sc/source svtools/source svx/source sw/htmlexport-swobjects.patch sw/source

Stephan Bergmann sbergman at redhat.com
Wed May 27 02:41:50 PDT 2015


 cui/source/dialogs/dlgname.cxx                          |    4 
 dbaccess/source/ui/app/AppSwapWindow.cxx                |    2 
 dbaccess/source/ui/dlg/advancedsettings.cxx             |   36 ++++---
 framework/source/classes/fwktabwindow.cxx               |    2 
 include/vcl/vclptr.hxx                                  |    8 +
 sc/source/ui/sidebar/CellLineStyleControl.cxx           |    2 
 svtools/source/control/filectrl.cxx                     |    2 
 svx/source/sidebar/text/TextCharacterSpacingControl.cxx |    2 
 svx/source/sidebar/text/TextUnderlineControl.cxx        |    2 
 sw/htmlexport-swobjects.patch                           |   79 ++++++++++++++++
 sw/source/ui/config/mailconfigpage.cxx                  |    2 
 11 files changed, 116 insertions(+), 25 deletions(-)

New commits:
commit 9549fb88f0d00c384b291645df45f4af5d6e8a8a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 27 11:40:36 2015 +0200

    Prevent accidental mis-uses of VclPtr address-of operator
    
    Change-Id: Ie3588d502e9545ea64bf836b2a0bdc0caead2247

diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx
index 2fe3186..c09ebab 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 ad7d1e2..c1b1fb6 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>
commit 668408fa1c69eaf0f0a37f24e2ec8b4a38fe3db7
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 27 11:40:22 2015 +0200

    Fix accidental mis-uses of VclPtr address-of operator
    
    Change-Id: I3a82423378d3198a25f90ddfbf42af55d85c96fb

diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index 60849f1..b16f852 100644
--- a/cui/source/dialogs/dlgname.cxx
+++ b/cui/source/dialogs/dlgname.cxx
@@ -41,7 +41,7 @@ SvxNameDialog::SvxNameDialog( vcl::Window* pWindow, const OUString& rName, const
     pFtDescription->SetText( rDesc );
     pEdtName->SetText( rName );
     pEdtName->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
-    ModifyHdl(&pEdtName);
+    ModifyHdl(pEdtName.get());
     pEdtName->SetModifyHdl(LINK(this, SvxNameDialog, ModifyHdl));
 }
 
@@ -82,7 +82,7 @@ SvxObjectNameDialog::SvxObjectNameDialog(
 
     // activate name
     pEdtName->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
-    ModifyHdl(&pEdtName);
+    ModifyHdl(pEdtName.get());
     pEdtName->SetModifyHdl(LINK(this, SvxObjectNameDialog, ModifyHdl));
 }
 
diff --git a/dbaccess/source/ui/app/AppSwapWindow.cxx b/dbaccess/source/ui/app/AppSwapWindow.cxx
index 05f9a06..d365473 100644
--- a/dbaccess/source/ui/app/AppSwapWindow.cxx
+++ b/dbaccess/source/ui/app/AppSwapWindow.cxx
@@ -118,7 +118,7 @@ void OApplicationSwapWindow::clearSelection()
     SvxIconChoiceCtrlEntry* pEntry = m_aIconControl->GetSelectedEntry(nPos);
     if ( pEntry )
         m_aIconControl->InvalidateEntry(pEntry);
-    m_aIconControl->GetClickHdl().Call(&m_aIconControl);
+    m_aIconControl->GetClickHdl().Call(m_aIconControl.get());
 }
 
 void OApplicationSwapWindow::createIconAutoMnemonics( MnemonicGenerator& _rMnemonics )
diff --git a/framework/source/classes/fwktabwindow.cxx b/framework/source/classes/fwktabwindow.cxx
index 9e16a6f..e6cc7e3 100644
--- a/framework/source/classes/fwktabwindow.cxx
+++ b/framework/source/classes/fwktabwindow.cxx
@@ -338,7 +338,7 @@ FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< bea
 void FwkTabWindow::ActivatePage( sal_Int32 nIndex )
 {
     m_aTabCtrl->SetCurPageId( static_cast< sal_uInt16 >( nIndex ) );
-    ActivatePageHdl( &m_aTabCtrl );
+    ActivatePageHdl( m_aTabCtrl.get() );
 }
 
 void FwkTabWindow::RemovePage( sal_Int32 nIndex )
diff --git a/sc/source/ui/sidebar/CellLineStyleControl.cxx b/sc/source/ui/sidebar/CellLineStyleControl.cxx
index 9ef1f83..3098858 100644
--- a/sc/source/ui/sidebar/CellLineStyleControl.cxx
+++ b/sc/source/ui/sidebar/CellLineStyleControl.cxx
@@ -118,7 +118,7 @@ void CellLineStyleControl::SetAllNoSel()
 
 IMPL_LINK(CellLineStyleControl, VSSelectHdl, void *, pControl)
 {
-    if(pControl == &maCellLineStyleValueSet)
+    if(pControl == maCellLineStyleValueSet.get())
     {
         const sal_uInt16 iPos(maCellLineStyleValueSet->GetSelectItemId());
         SvxLineItem aLineItem(SID_FRAME_LINESTYLE);
diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx
index ab520bf..4482cf4 100644
--- a/svtools/source/control/filectrl.cxx
+++ b/svtools/source/control/filectrl.cxx
@@ -246,7 +246,7 @@ void FileControl::ImplBrowseFile( )
                 if ( aObj.GetProtocol() == INetProtocol::File )
                     aNewText = aObj.PathToFileName();
                 SetText( aNewText );
-                maEdit->GetModifyHdl().Call( &maEdit );
+                maEdit->GetModifyHdl().Call( maEdit.get() );
             }
         }
     }
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
index 45137f2..70acce2 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
@@ -308,7 +308,7 @@ IMPL_LINK(TextCharacterSpacingControl, VSSelHdl, void *, pControl)
 {
     mnLastCus = SPACING_CLOSE_BY_CLICK_ICON;
 
-    if(pControl == &maVSSpacing)
+    if(pControl == maVSSpacing.get())
     {
         sal_uInt16 iPos = maVSSpacing->GetSelectItemId();
         short nKern = 0;
diff --git a/svx/source/sidebar/text/TextUnderlineControl.cxx b/svx/source/sidebar/text/TextUnderlineControl.cxx
index 690578b..b861deb 100644
--- a/svx/source/sidebar/text/TextUnderlineControl.cxx
+++ b/svx/source/sidebar/text/TextUnderlineControl.cxx
@@ -214,7 +214,7 @@ void TextUnderlineControl::Rearrange(FontUnderline eLine)
 
 IMPL_LINK(TextUnderlineControl, VSSelectHdl, void *, pControl)
 {
-    if ( pControl == &maVSUnderline )
+    if ( pControl == maVSUnderline.get() )
     {
         const sal_uInt16 iPos = maVSUnderline->GetSelectItemId();
         const FontUnderline eUnderline = ( iPos == 0 )
diff --git a/sw/htmlexport-swobjects.patch b/sw/htmlexport-swobjects.patch
new file mode 100644
index 0000000..35e440a
--- /dev/null
+++ b/sw/htmlexport-swobjects.patch
@@ -0,0 +1,79 @@
+diff --git a/sw/CppunitTest_sw_htmlexport.mk b/sw/CppunitTest_sw_htmlexport.mk
+index 23cdef1..69803cd 100644
+--- a/sw/CppunitTest_sw_htmlexport.mk
++++ b/sw/CppunitTest_sw_htmlexport.mk
+@@ -15,23 +15,48 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_htmlexport, \
+     sw/qa/extras/htmlexport/htmlexport \
+ ))
+ 
++$(eval $(call gb_CppunitTest_set_componentfile,sw_htmlexport,sw/util/sw))
++
++$(eval $(call gb_CppunitTest_use_library_objects,sw_htmlexport,sw))
++
+ $(eval $(call gb_CppunitTest_use_libraries,sw_htmlexport, \
++    $(call gb_Helper_optional,AVMEDIA,avmedia) \
++    basegfx \
+     comphelper \
+     cppu \
+ 	cppuhelper \
++    drawinglayer \
++    editeng \
+ 	i18nlangtag \
++    i18nutil \
++    lng \
+     sal \
+-    sw \
++    salhelper \
++	sax \
++    sb \
++    sfx \
++    sot \
++    svl \
++    svt \
++    svx \
++    svxcore \
+     test \
++    tk \
+ 	tl \
++    ucbhelper \
+     unotest \
+     utl \
++    $(if $(filter TRUE,$(DISABLE_SCRIPTING)),, \
++        vbahelper) \
+     vcl \
++    xmlreader \
++    xo \
+ 	$(gb_UWINAPI) \
+ ))
+ 
+ $(eval $(call gb_CppunitTest_use_externals,sw_htmlexport,\
+ 	boost_headers \
++	icuuc \
+     libxml2 \
+ ))
+ 
+@@ -71,7 +96,6 @@ $(eval $(call gb_CppunitTest_use_components,sw_htmlexport,\
+ 	sc/util/scfilt \
+     package/util/package2 \
+     sax/source/expatwrap/expwrap \
+-    sw/util/sw \
+     sw/util/swd \
+     sw/util/msword \
+     sfx2/util/sfx \
+diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
+index 2db20ef..d9a8d15 100644
+--- a/sw/qa/extras/htmlexport/htmlexport.cxx
++++ b/sw/qa/extras/htmlexport/htmlexport.cxx
+@@ -32,6 +32,12 @@ public:
+         m_eUnit(FUNIT_NONE)
+     {}
+ 
++    void setUp() SAL_OVERRIDE
++    {
++        SwModelTestBase::setUp();
++        SwGlobals::ensure();
++    }
++
+ private:
+     bool mustCalcLayoutOf(const char* filename) SAL_OVERRIDE
+     {
diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx
index 5424a43..06937b7 100644
--- a/sw/source/ui/config/mailconfigpage.cxx
+++ b/sw/source/ui/config/mailconfigpage.cxx
@@ -191,7 +191,7 @@ void SwMailConfigPage::Reset( const SfxItemSet* /*rSet*/ )
 
     m_pReplyToED->SetText(m_pConfigItem->GetMailReplyTo()) ;
     m_pReplyToCB->Check(m_pConfigItem->IsMailReplyTo());
-    m_pReplyToCB->GetClickHdl().Call(&m_pReplyToCB);
+    m_pReplyToCB->GetClickHdl().Call(m_pReplyToCB.get());
 
     m_pServerED->SetText(m_pConfigItem->GetMailServer());
     m_pPortNF->SetValue(m_pConfigItem->GetMailPort());


More information about the Libreoffice-commits mailing list