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 /extensions | |
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 'extensions')
-rw-r--r-- | extensions/source/plugin/base/evtlstnr.cxx | 2 | ||||
-rw-r--r-- | extensions/source/plugin/base/manager.cxx | 2 | ||||
-rw-r--r-- | extensions/source/plugin/base/nfuncs.cxx | 6 | ||||
-rw-r--r-- | extensions/source/plugin/base/plcom.cxx | 4 | ||||
-rw-r--r-- | extensions/source/plugin/base/xplugin.cxx | 24 | ||||
-rw-r--r-- | extensions/source/plugin/inc/plugin/impl.hxx | 6 | ||||
-rw-r--r-- | extensions/source/propctrlr/standardcontrol.cxx | 30 |
7 files changed, 37 insertions, 37 deletions
diff --git a/extensions/source/plugin/base/evtlstnr.cxx b/extensions/source/plugin/base/evtlstnr.cxx index 6e6a58c72348..228778b86dda 100644 --- a/extensions/source/plugin/base/evtlstnr.cxx +++ b/extensions/source/plugin/base/evtlstnr.cxx @@ -65,7 +65,7 @@ PluginEventListener::~PluginEventListener() void PluginEventListener::disposing( const ::com::sun::star::lang::EventObject& /*rEvt*/ ) throw(std::exception) { m_pPlugin->getPluginComm()-> - NPP_URLNotify( m_pPlugin->getNPPInstance(), + NPP_URLNotify( &m_pPlugin->getNPPInstance(), m_pUrl, NPRES_DONE, m_pNotifyData ); diff --git a/extensions/source/plugin/base/manager.cxx b/extensions/source/plugin/base/manager.cxx index 8f55228d84ed..dc0936694387 100644 --- a/extensions/source/plugin/base/manager.cxx +++ b/extensions/source/plugin/base/manager.cxx @@ -149,7 +149,7 @@ XPlugin_Impl* XPluginManager_Impl::getXPluginFromNPP( NPP instance ) for( iter = PluginManager::get().getPlugins().begin(); iter != PluginManager::get().getPlugins().end(); ++iter ) { - if( (*iter)->getNPPInstance() == instance ) + if( &(*iter)->getNPPInstance() == instance ) return *iter; } diff --git a/extensions/source/plugin/base/nfuncs.cxx b/extensions/source/plugin/base/nfuncs.cxx index aaf14bd420eb..c5d25be1f54d 100644 --- a/extensions/source/plugin/base/nfuncs.cxx +++ b/extensions/source/plugin/base/nfuncs.cxx @@ -306,7 +306,7 @@ extern "C" { PluginOutputStream* pStream = new PluginOutputStream( pImpl, "", 0, 0 ); - *stream = pStream->getStream(); + *stream = &pStream->getStream(); try { @@ -443,10 +443,10 @@ extern "C" { do { nNow = pPlugin->getPluginComm()-> - NPP_WriteReady( pPlugin->getNPPInstance(), + NPP_WriteReady( &pPlugin->getNPPInstance(), stream ); nNow = pPlugin->getPluginComm()-> - NPP_Write( pPlugin->getNPPInstance(), + NPP_Write( &pPlugin->getNPPInstance(), stream, rangeList->offset + nPos, nNow, diff --git a/extensions/source/plugin/base/plcom.cxx b/extensions/source/plugin/base/plcom.cxx index 48a6bda2beaf..c5c620624488 100644 --- a/extensions/source/plugin/base/plcom.cxx +++ b/extensions/source/plugin/base/plcom.cxx @@ -69,12 +69,12 @@ PluginComm::~PluginComm() NPError PluginComm::NPP_SetWindow( XPlugin_Impl* i_pImpl ) { - return NPP_SetWindow( i_pImpl->getNPPInstance(), i_pImpl->getNPWindow() ); + return NPP_SetWindow( &i_pImpl->getNPPInstance(), &i_pImpl->getNPWindow() ); } NPError PluginComm::NPP_Destroy( XPlugin_Impl* i_pImpl, NPSavedData** save ) { - return NPP_Destroy( i_pImpl->getNPPInstance(), save ); + return NPP_Destroy( &i_pImpl->getNPPInstance(), save ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx index 83a488bdfd85..d9509f013a08 100644 --- a/extensions/source/plugin/base/xplugin.cxx +++ b/extensions/source/plugin/base/xplugin.cxx @@ -554,7 +554,7 @@ void XPlugin_Impl::loadPlugin() getPluginComm()-> NPP_New( (char*)OUStringToOString( m_aDescription.Mimetype, m_aEncoding).getStr(), - getNPPInstance(), + &getNPPInstance(), m_aPluginMode == PluginMode::FULL ? NP_FULL : NP_EMBED, ::sal::static_int_cast< int16_t, int >( m_nArgs ), (char**)(m_nArgs ? m_pArgn : NULL), @@ -629,12 +629,12 @@ PluginStream* XPlugin_Impl::getStreamFromNPStream( NPStream* stream ) std::list<PluginInputStream*>::iterator iter; for( iter = m_aInputStreams.begin(); iter != m_aInputStreams.end(); ++iter ) - if( (*iter)->getStream() == stream ) + if( &(*iter)->getStream() == stream ) return *iter; std::list<PluginOutputStream*>::iterator iter2; for( iter2 = m_aOutputStreams.begin(); iter2 != m_aOutputStreams.end(); ++iter2 ) - if( (*iter2)->getStream() == stream ) + if( &(*iter2)->getStream() == stream ) return *iter2; return NULL; @@ -741,7 +741,7 @@ sal_Bool XPlugin_Impl::provideNewStream(const OUString& mimetype, uno::Reference< com::sun::star::io::XOutputStream > xNewStream( pStream ); if( iter != m_aPEventListeners.end() ) - pStream->getStream()->notifyData = (*iter)->getNotifyData(); + pStream->getStream().notifyData = (*iter)->getNotifyData(); uint16_t stype = 0; @@ -761,7 +761,7 @@ sal_Bool XPlugin_Impl::provideNewStream(const OUString& mimetype, #endif if( ! m_pPluginComm->NPP_NewStream( &m_aInstance, (char*)aMIME.getStr(), - pStream->getStream(), isfile, + &pStream->getStream(), isfile, &stype ) ) { #if OSL_DEBUG_LEVEL > 1 @@ -789,7 +789,7 @@ sal_Bool XPlugin_Impl::provideNewStream(const OUString& mimetype, aFileName = OUStringToOString( url, m_aEncoding ); m_pPluginComm-> NPP_StreamAsFile( &m_aInstance, - pStream->getStream(), + &pStream->getStream(), aFileName.getStr() ); } else @@ -937,7 +937,7 @@ PluginStream::~PluginStream() if( m_pPlugin && m_pPlugin->getPluginComm() ) { - m_pPlugin->getPluginComm()->NPP_DestroyStream( m_pPlugin->getNPPInstance(), + m_pPlugin->getPluginComm()->NPP_DestroyStream( &m_pPlugin->getNPPInstance(), &m_aNPStream, NPRES_DONE ); m_pPlugin->checkListeners( m_aNPStream.url ); m_pPlugin->getPluginComm()->NPP_SetWindow( m_pPlugin ); @@ -1001,7 +1001,7 @@ PluginInputStream::~PluginInputStream() if( m_nMode == NP_ASFILE ) { m_pPlugin->getPluginComm()-> - NPP_StreamAsFile( m_pPlugin->getNPPInstance(), + NPP_StreamAsFile( &m_pPlugin->getNPPInstance(), &m_aNPStream, aFileName.getStr() ); } @@ -1029,8 +1029,8 @@ void PluginInputStream::load() INetURLObject aUrl; aUrl.SetSmartProtocol( INET_PROT_FILE ); aUrl.SetSmartURL( - OUString( getStream()->url, - strlen( getStream()->url ), + OUString( getStream().url, + strlen( getStream().url ), RTL_TEXTENCODING_MS_1252 ) ); try @@ -1081,7 +1081,7 @@ void PluginInputStream::writeBytes( const Sequence<sal_Int8>& Buffer ) throw(std while( m_nMode != NP_ASFILEONLY && m_nWritePos < nPos && (nBytes = m_pPlugin->getPluginComm()-> NPP_WriteReady( - m_pPlugin->getNPPInstance(), &m_aNPStream )) > 0 ) + &m_pPlugin->getNPPInstance(), &m_aNPStream )) > 0 ) { nBytes = (nBytes > nPos - m_nWritePos) ? nPos - m_nWritePos : nBytes; @@ -1093,7 +1093,7 @@ void PluginInputStream::writeBytes( const Sequence<sal_Int8>& Buffer ) throw(std try { nBytesRead = m_pPlugin->getPluginComm()->NPP_Write( - m_pPlugin->getNPPInstance(), &m_aNPStream, m_nWritePos, nBytes, pBuffer.get() ); + &m_pPlugin->getNPPInstance(), &m_aNPStream, m_nWritePos, nBytes, pBuffer.get() ); } catch( ... ) { diff --git a/extensions/source/plugin/inc/plugin/impl.hxx b/extensions/source/plugin/inc/plugin/impl.hxx index 6ade5f26ecbe..7aabb9201925 100644 --- a/extensions/source/plugin/inc/plugin/impl.hxx +++ b/extensions/source/plugin/inc/plugin/impl.hxx @@ -196,8 +196,8 @@ public: Reference< com::sun::star::lang::XMultiServiceFactory > getServiceManager() { return m_xSMgr; } const com::sun::star::plugin::PluginDescription& getDescription() const { return m_aDescription; } rtl_TextEncoding getTextEncoding() { return m_aEncoding; } - NPP getNPPInstance() { return &m_aInstance; } - NPWindow* getNPWindow() { return &m_aNPWindow; } + NPP_t& getNPPInstance() { return m_aInstance; } + NPWindow& getNPWindow() { return m_aNPWindow; } SysPlugData& getSysPlugData() { return *m_pSysPlugData; } void enterPluginCallback() { m_nCalledFromPlugin++; } @@ -336,7 +336,7 @@ public: const char* url, sal_uInt32 len, sal_uInt32 lastmod ); virtual ~PluginStream(); - NPStream* getStream() { return &m_aNPStream; } + NPStream& getStream() { return m_aNPStream; } XPlugin_Impl* getPlugin() { return m_pPlugin; } virtual PluginStreamType getStreamType() = 0; diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 66aca51f7b92..4039e6f1384e 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -968,7 +968,7 @@ namespace pcr public: OMultilineFloatingEdit(Window* _pParen); - MultiLineEdit* getEdit() { return &m_aImplEdit; } + MultiLineEdit& getEdit() { return m_aImplEdit; } protected: virtual bool PreNotify(NotifyEvent& _rNEvt) SAL_OVERRIDE; @@ -1047,14 +1047,14 @@ namespace pcr m_pFloatingEdit = new OMultilineFloatingEdit(this); //FloatingWindow m_pFloatingEdit->SetPopupModeEndHdl( LINK( this, DropDownEditControl, ReturnHdl ) ); - m_pFloatingEdit->getEdit()->SetReadOnly( ( _nStyle & WB_READONLY ) != 0 ); + m_pFloatingEdit->getEdit().SetReadOnly( ( _nStyle & WB_READONLY ) != 0 ); } void DropDownEditControl::setControlHelper( ControlHelper& _rControlHelper ) { DropDownEditControl_Base::setControlHelper( _rControlHelper ); - m_pFloatingEdit->getEdit()->SetModifyHdl( LINK( &_rControlHelper, ControlHelper, ModifiedHdl ) ); + m_pFloatingEdit->getEdit().SetModifyHdl( LINK( &_rControlHelper, ControlHelper, ModifiedHdl ) ); m_pImplEdit->SetGetFocusHdl( LINK( &_rControlHelper, ControlHelper, GetFocusHdl ) ); m_pImplEdit->SetModifyHdl( LINK( &_rControlHelper, ControlHelper, ModifiedHdl ) ); m_pImplEdit->SetLoseFocusHdl( LINK( &_rControlHelper, ControlHelper, LoseFocusHdl ) ); @@ -1140,8 +1140,8 @@ namespace pcr } Invalidate(); ShowDropDown( true ); - m_pFloatingEdit->getEdit()->GrabFocus(); - m_pFloatingEdit->getEdit()->SetSelection( aSel ); + m_pFloatingEdit->getEdit().GrabFocus(); + m_pFloatingEdit->getEdit().SetSelection( aSel ); Window* pFocusWin = Application::GetFocusWindow(); pFocusWin->KeyInput( *rNEvt.GetKeyEvent() ); } @@ -1214,11 +1214,11 @@ namespace pcr m_pFloatingEdit->StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN ); m_pFloatingEdit->Show(); - m_pFloatingEdit->getEdit()->GrabFocus(); - m_pFloatingEdit->getEdit()->SetSelection(Selection(m_pFloatingEdit->getEdit()->GetText().getLength())); + m_pFloatingEdit->getEdit().GrabFocus(); + m_pFloatingEdit->getEdit().SetSelection(Selection(m_pFloatingEdit->getEdit().GetText().getLength())); m_bDropdown = true; if ( m_nOperationMode == eMultiLineText ) - m_pFloatingEdit->getEdit()->SetText( m_pImplEdit->GetText() ); + m_pFloatingEdit->getEdit().SetText( m_pImplEdit->GetText() ); m_pImplEdit->SetText(""); } else @@ -1228,7 +1228,7 @@ namespace pcr m_pFloatingEdit->Update(); // transfer the text from the floating edit to our own edit - OUString sDisplayText( m_pFloatingEdit->getEdit()->GetText() ); + OUString sDisplayText( m_pFloatingEdit->getEdit().GetText() ); if ( m_nOperationMode == eStringList ) sDisplayText = lcl_convertListToDisplayText( lcl_convertMultiLineToList( sDisplayText ) ); @@ -1244,9 +1244,9 @@ namespace pcr long DropDownEditControl::FindPos(long nSinglePos) { - long nPos=0; + long nPos = 0; OUString aOutput; - OUString aStr=m_pFloatingEdit->getEdit()->GetText(); + OUString aStr = m_pFloatingEdit->getEdit().GetText(); OUString aStr1 = GetText(); if ((nSinglePos == 0) || (nSinglePos == aStr1.getLength())) @@ -1302,7 +1302,7 @@ namespace pcr IMPL_LINK( DropDownEditControl, ReturnHdl, OMultilineFloatingEdit*, /*pMEd*/) { - OUString aStr = m_pFloatingEdit->getEdit()->GetText(); + OUString aStr = m_pFloatingEdit->getEdit().GetText(); OUString aStr2 = GetText(); ShowDropDown(false); @@ -1326,13 +1326,13 @@ namespace pcr void DropDownEditControl::SetStringListValue( const StlSyntaxSequence< OUString >& _rStrings ) { SetText( lcl_convertListToDisplayText( _rStrings ) ); - m_pFloatingEdit->getEdit()->SetText( lcl_convertListToMultiLine( _rStrings ) ); + m_pFloatingEdit->getEdit().SetText( lcl_convertListToMultiLine( _rStrings ) ); } StlSyntaxSequence< OUString > DropDownEditControl::GetStringListValue() const { - return lcl_convertMultiLineToList( m_pFloatingEdit->getEdit()->GetText() ); + return lcl_convertMultiLineToList( m_pFloatingEdit->getEdit().GetText() ); } @@ -1340,7 +1340,7 @@ namespace pcr { OSL_PRECOND( m_nOperationMode == eMultiLineText, "DropDownEditControl::SetTextValue: illegal call!" ); - m_pFloatingEdit->getEdit()->SetText( _rText ); + m_pFloatingEdit->getEdit().SetText( _rText ); SetText( _rText ); } |