From 3ead3ad52f9bb2f9d1d6cf8dfc73a0a25e6778ed Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 30 Apr 2015 10:20:00 +0200 Subject: Gradually typed Link Turn the Link class into a template abstracting over the link's argument and return types, but provide default template arguments that keep the generic, unsafe "void* in, sal_IntPtr out" behvior. That way, individual uses of the Link class can be updated over time. All the related macros are duplicated with ..._TYPED counterparts, that additionally take the RetType (except for LINK_TYPED, which manages to infer the relevant types from the supplied Member). (It would have been attractive to change the "untyped" LinkStubs from taking a void* to a properly typed ArgType parameter, too, but that would cause -fsanitize=function to flag uses of "untyped" Link::Call.) Change-Id: I3b0140378bad99abbf240140ebb4a46a05d2d2f8 --- unotools/source/config/syslocaleoptions.cxx | 8 ++++---- unotools/source/ucbhelper/ucblockbytes.cxx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'unotools') diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx index ad5a61fcde51..f72c1c00cf7f 100644 --- a/unotools/source/config/syslocaleoptions.cxx +++ b/unotools/source/config/syslocaleoptions.cxx @@ -43,7 +43,7 @@ sal_Int32 SvtSysLocaleOptions::nRefCount = 0; namespace { struct CurrencyChangeLink - : public rtl::Static {}; + : public rtl::Static, CurrencyChangeLink> {}; } class SvtSysLocaleOptions_Impl : public utl::ConfigItem @@ -679,7 +679,7 @@ OUString SvtSysLocaleOptions::CreateCurrencyConfigString( } // static -void SvtSysLocaleOptions::SetCurrencyChangeLink( const Link& rLink ) +void SvtSysLocaleOptions::SetCurrencyChangeLink( const Link<>& rLink ) { MutexGuard aGuard( GetMutex() ); DBG_ASSERT( !CurrencyChangeLink::get().IsSet(), "SvtSysLocaleOptions::SetCurrencyChangeLink: already set" ); @@ -687,7 +687,7 @@ void SvtSysLocaleOptions::SetCurrencyChangeLink( const Link& rLink ) } // static -const Link& SvtSysLocaleOptions::GetCurrencyChangeLink() +const Link<>& SvtSysLocaleOptions::GetCurrencyChangeLink() { MutexGuard aGuard( GetMutex() ); return CurrencyChangeLink::get(); @@ -697,7 +697,7 @@ void SvtSysLocaleOptions::ConfigurationChanged( utl::ConfigurationBroadcaster* p { if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) { - const Link& rLink = GetCurrencyChangeLink(); + const Link<>& rLink = GetCurrencyChangeLink(); if ( rLink.IsSet() ) rLink.Call( NULL ); } diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx index e5dd6b2da1e1..d33c570cc68c 100644 --- a/unotools/source/ucbhelper/ucblockbytes.cxx +++ b/unotools/source/ucbhelper/ucblockbytes.cxx @@ -125,10 +125,10 @@ public: */ class ProgressHandler_Impl: public ::cppu::WeakImplHelper1< XProgressHandler > { - Link m_aProgress; + Link<> m_aProgress; public: - ProgressHandler_Impl( const Link& rLink ) + ProgressHandler_Impl( const Link<>& rLink ) : m_aProgress( rLink ) {} // XProgressHandler -- cgit