diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-26 15:28:40 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-26 15:33:30 +0100 |
commit | ac3ebf3bde458a31e4cde5da554189c51cba6bcf (patch) | |
tree | 3954e06c36353cbea4df10447863341d331d4d26 /extensions/source | |
parent | 812e5e8ed7c408cb7f2388ab718365354bfc9a41 (diff) |
const_cast: convert some C-style casts and remove some redundant ones
Change-Id: Id0a3194e20128ad6defb95b51757dd01fcab9eb1
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/bibliography/bibload.cxx | 4 | ||||
-rw-r--r-- | extensions/source/bibliography/toolbar.cxx | 8 | ||||
-rw-r--r-- | extensions/source/plugin/base/xplugin.cxx | 6 | ||||
-rw-r--r-- | extensions/source/plugin/inc/plugin/unx/plugcon.hxx | 3 | ||||
-rw-r--r-- | extensions/source/plugin/unx/npnapi.cxx | 2 | ||||
-rw-r--r-- | extensions/source/plugin/unx/nppapi.cxx | 4 | ||||
-rw-r--r-- | extensions/source/scanner/sane.cxx | 5 | ||||
-rw-r--r-- | extensions/source/scanner/sane.hxx | 6 |
8 files changed, 19 insertions, 19 deletions
diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index 3d9f5c250c39..1bc0bfd77fe8 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -384,11 +384,11 @@ Reference< XNameAccess > BibliographyLoader::GetDataColumns() const xRowSet = NULL; } else - ((BibliographyLoader*)this)->m_xCursor = xRowSet.get(); + const_cast<BibliographyLoader*>(this)->m_xCursor = xRowSet.get(); Reference< sdbcx::XColumnsSupplier > xSupplyCols(m_xCursor, UNO_QUERY); if (xSupplyCols.is()) - ((BibliographyLoader*)this)->m_xColumns = xSupplyCols->getColumns(); + const_cast<BibliographyLoader*>(this)->m_xColumns = xSupplyCols->getColumns(); } return m_xColumns; diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index c831dc5036e0..ecfe1fec0c72 100644 --- a/extensions/source/bibliography/toolbar.cxx +++ b/extensions/source/bibliography/toolbar.cxx @@ -306,7 +306,7 @@ void BibToolBar::Select() else { Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray(); + PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); pPropertyVal[0].Name="QueryText"; OUString aSelection = aEdQuery.GetText(); pPropertyVal[0].Value <<= aSelection; @@ -434,7 +434,7 @@ bool BibToolBar::PreNotify( NotifyEvent& rNEvt ) if(nKey == KEY_RETURN) { Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray(); + PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); pPropertyVal[0].Name = "QueryText"; OUString aSelection = aEdQuery.GetText(); pPropertyVal[0].Value <<= aSelection; @@ -460,7 +460,7 @@ IMPL_LINK( BibToolBar, SelHdl, ListBox*, /*pLb*/ ) IMPL_LINK( BibToolBar, SendSelHdl, Timer*,/*pT*/) { Sequence<PropertyValue> aPropVal(1); - PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray(); + PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); pPropertyVal[0].Name = "DataSourceName"; OUString aEntry( MnemonicGenerator::EraseAllMnemonicChars( aLBSource.GetSelectEntry() ) ); OUString aSelection = aEntry; @@ -488,7 +488,7 @@ IMPL_LINK( BibToolBar, MenuHdl, ToolBox*, /*pToolbox*/) nSelMenuItem=nId; aQueryField = MnemonicGenerator::EraseAllMnemonicChars( aPopupMenu.GetItemText(nId) ); Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray(); + PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); pPropertyVal[0].Name = "QueryText"; OUString aSelection = aEdQuery.GetText(); pPropertyVal[0].Value <<= aSelection; diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx index 62451c77f69a..2107b6de5957 100644 --- a/extensions/source/plugin/base/xplugin.cxx +++ b/extensions/source/plugin/base/xplugin.cxx @@ -559,8 +559,8 @@ void XPlugin_Impl::loadPlugin() } getPluginComm()-> - NPP_New( (char*)OUStringToOString( m_aDescription.Mimetype, - m_aEncoding).getStr(), + NPP_New( const_cast<char*>(OUStringToOString( m_aDescription.Mimetype, + m_aEncoding).getStr()), &getNPPInstance(), m_aPluginMode == PluginMode::FULL ? NP_FULL : NP_EMBED, ::sal::static_int_cast< int16_t, int >( m_nArgs ), @@ -767,7 +767,7 @@ sal_Bool XPlugin_Impl::provideNewStream(const OUString& mimetype, #endif if( ! m_pPluginComm->NPP_NewStream( &m_aInstance, - (char*)aMIME.getStr(), + const_cast<char*>(aMIME.getStr()), &pStream->getStream(), isfile, &stype ) ) { diff --git a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx index 3ae38b0242b5..921486e1f941 100644 --- a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx +++ b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx @@ -203,7 +203,8 @@ enum CommandAtoms const char* GetCommandName( CommandAtoms ); -#define POST_STRING( x ) x ? x : const_cast<char*>(""), x ? strlen(x) : 1 +#define POST_NONCONST_STRING( x ) x ? x : const_cast<char*>(""), x ? strlen(x) : 1 +#define POST_STRING( x ) x ? x : "", x ? strlen(x) : 1 #endif // INCLUDED_EXTENSIONS_SOURCE_PLUGIN_INC_PLUGIN_UNX_PLUGCON_HXX diff --git a/extensions/source/plugin/unx/npnapi.cxx b/extensions/source/plugin/unx/npnapi.cxx index e33892172bc9..7e345300a556 100644 --- a/extensions/source/plugin/unx/npnapi.cxx +++ b/extensions/source/plugin/unx/npnapi.cxx @@ -886,7 +886,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) osl_getAsciiFunctionSymbol( pPluginLib, "NPP_GetMIMEDescription" )); char* pMIME = pNPP_GetMIMEDescription(); Respond( pMessage->m_nID, - POST_STRING( pMIME ), + POST_NONCONST_STRING( pMIME ), NULL ); } break; diff --git a/extensions/source/plugin/unx/nppapi.cxx b/extensions/source/plugin/unx/nppapi.cxx index fe82daaa2450..68802abfd1cf 100644 --- a/extensions/source/plugin/unx/nppapi.cxx +++ b/extensions/source/plugin/unx/nppapi.cxx @@ -310,7 +310,7 @@ IMPL_LINK( PluginConnector, WorkOnNewMessageHdl, Mediator*, /*pMediator*/ ) NPP instance = m_aInstances[ nInstance ]->instance; const char* pAnswer = NPN_UserAgent( instance ); Respond( pMessage->m_nID, - (char*)pAnswer, strlen( pAnswer ), + const_cast<char*>(pAnswer), strlen( pAnswer ), NULL ); } break; @@ -607,7 +607,7 @@ char* UnxPluginComm::NPP_GetMIMEDescription() Transact( eNPP_GetMIMEDescription, NULL ); if( ! pMes ) - return (char*)""; + return const_cast<char*>(""); if( pDesc ) delete [] pDesc; diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index 1d42f039bf0e..fe150b925b81 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -276,8 +276,7 @@ void Sane::ReloadOptions() mppOptions = new const SANE_Option_Descriptor*[ mnOptions ]; mppOptions[ 0 ] = pZero; for( int i = 1; i < mnOptions; i++ ) - mppOptions[ i ] = (SANE_Option_Descriptor*) - p_get_option_descriptor( maHandle, i ); + mppOptions[ i ] = p_get_option_descriptor( maHandle, i ); CheckConsistency( NULL, true ); @@ -312,7 +311,7 @@ bool Sane::Open( int n ) if( n >= 0 && n < nDevices ) { mnDevice = n; - return Open( (char*)ppDevices[n]->name ); + return Open( ppDevices[n]->name ); } return false; } diff --git a/extensions/source/scanner/sane.hxx b/extensions/source/scanner/sane.hxx index ba7cf2c47bef..d0ae220ce38a 100644 --- a/extensions/source/scanner/sane.hxx +++ b/extensions/source/scanner/sane.hxx @@ -127,9 +127,9 @@ public: { return ppDevices[n]->type ? OUString( ppDevices[n]->type, strlen(ppDevices[n]->type), osl_getThreadTextEncoding() ) : OUString(); } OUString GetOptionName( int n ) - { return mppOptions[n]->name ? OUString( (char*)mppOptions[n]->name, strlen((char*)mppOptions[n]->name), osl_getThreadTextEncoding() ) : OUString(); } + { return mppOptions[n]->name ? OUString( mppOptions[n]->name, strlen(mppOptions[n]->name), osl_getThreadTextEncoding() ) : OUString(); } OUString GetOptionTitle( int n ) - { return mppOptions[n]->title ? OUString( (char*)mppOptions[n]->title, strlen((char*)mppOptions[n]->title), osl_getThreadTextEncoding() ) : OUString(); } + { return mppOptions[n]->title ? OUString( mppOptions[n]->title, strlen(mppOptions[n]->title), osl_getThreadTextEncoding() ) : OUString(); } SANE_Value_Type GetOptionType( int n ) { return mppOptions[n]->type; } SANE_Unit GetOptionUnit( int n ) @@ -140,7 +140,7 @@ public: SANE_Constraint_Type GetOptionConstraintType( int n ) { return mppOptions[n]->constraint_type; } const char** GetStringConstraint( int n ) - { return (const char**)mppOptions[n]->constraint.string_list; } + { return const_cast<const char**>(mppOptions[n]->constraint.string_list); } int GetRange( int, double*& ); inline int GetOptionElements( int n ); |