[Libreoffice-commits] core.git: 2 commits - bridges/source compilerplugins/clang connectivity/source cppu/source include/uno lotuswordpro/source registry/source sal/osl sal/qa sfx2/source stoc/source vcl/generic vcl/unx
Stephan Bergmann
sbergman at redhat.com
Wed Jan 28 04:51:14 PST 2015
bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx | 4
bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx | 2
bridges/source/jni_uno/jni_java2uno.cxx | 2
bridges/source/jni_uno/jni_uno2java.cxx | 8 -
compilerplugins/clang/cstylecast.cxx | 13 +-
connectivity/source/drivers/odbc/OPreparedStatement.cxx | 2
connectivity/source/drivers/postgresql/pq_connection.cxx | 4
cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx | 4
cppu/source/uno/copy.hxx | 6 -
cppu/source/uno/lbmap.cxx | 2
cppu/source/uno/sequence.cxx | 2
include/uno/current_context.hxx | 4
include/uno/mapping.hxx | 2
lotuswordpro/source/filter/lwptools.cxx | 8 -
registry/source/keyimpl.cxx | 8 -
registry/source/regimpl.cxx | 4
registry/source/registry.cxx | 8 -
registry/source/regkey.cxx | 18 +--
sal/osl/unx/module.cxx | 80 ++++++++-------
sal/qa/osl/module/osl_Module.cxx | 21 +++
sal/qa/osl/process/osl_process.cxx | 3
sfx2/source/appl/shutdowniconunx.cxx | 2
stoc/source/invocation_adapterfactory/iafactory.cxx | 2
stoc/source/security/access_controller.cxx | 8 -
vcl/generic/fontmanager/parseAFM.cxx | 22 ++--
vcl/unx/generic/printer/cupsmgr.cxx | 2
26 files changed, 131 insertions(+), 110 deletions(-)
New commits:
commit 4e3da621fe26c2ad85258692c63a044d0541bd64
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Jan 28 13:50:17 2015 +0100
Some more loplugin:cstylecast clean-up
Change-Id: I132d22e2af3cf673c17d8964f690d48990834884
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
index 767a7fe..ef6cdec 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
@@ -237,7 +237,7 @@ static typelib_TypeClass cpp2uno_call(
uno_destructData( pUnoReturn, pReturnTypeDescr, 0 );
}
// complex return ptr is set to return reg
- *(void **)pRegisterReturn = pCppReturn;
+ *reinterpret_cast<void **>(pRegisterReturn) = pCppReturn;
}
if ( pReturnTypeDescr )
{
@@ -348,7 +348,7 @@ typelib_TypeClass cpp_vtable_call(
XInterface * pInterface = 0;
(*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)
( pCppI->getBridge()->getCppEnv(),
- (void **)&pInterface,
+ reinterpret_cast<void **>(&pInterface),
pCppI->getOid().pData,
reinterpret_cast<typelib_InterfaceTypeDescription *>( pTD ) );
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
index 12cc933..fb286db 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
@@ -404,7 +404,7 @@ void unoInterfaceProxyDispatch(
uno_Interface * pInterface = 0;
(*pThis->getBridge()->getUnoEnv()->getRegisteredInterface)(
pThis->getBridge()->getUnoEnv(),
- (void **)&pInterface, pThis->oid.pData, reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) );
+ reinterpret_cast<void **>(&pInterface), pThis->oid.pData, reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) );
if (pInterface)
{
diff --git a/bridges/source/jni_uno/jni_java2uno.cxx b/bridges/source/jni_uno/jni_java2uno.cxx
index b827a1e..5c992f1 100644
--- a/bridges/source/jni_uno/jni_java2uno.cxx
+++ b/bridges/source/jni_uno/jni_java2uno.cxx
@@ -186,7 +186,7 @@ jobject Bridge::call_uno(
#endif
(nParams * sizeof (void *)) +
return_size + (nParams * sizeof (largest)) );
- void ** uno_args = (void **) mem;
+ void ** uno_args = reinterpret_cast<void **>(mem);
void * uno_ret = return_size == 0 ? 0 : (mem + (nParams * sizeof (void *)));
largest * uno_args_mem = reinterpret_cast<largest *>
(mem + (nParams * sizeof (void *)) + return_size);
diff --git a/bridges/source/jni_uno/jni_uno2java.cxx b/bridges/source/jni_uno/jni_uno2java.cxx
index c36e8a1..a9798e3 100644
--- a/bridges/source/jni_uno/jni_uno2java.cxx
+++ b/bridges/source/jni_uno/jni_uno2java.cxx
@@ -489,7 +489,7 @@ uno_Interface * Bridge::map_to_uno(
uno_Interface * pUnoI = 0;
(*m_uno_env->getRegisteredInterface)(
- m_uno_env, (void **)&pUnoI,
+ m_uno_env, reinterpret_cast<void **>(&pUnoI),
oid.pData, reinterpret_cast<typelib_InterfaceTypeDescription *>(info->m_td.get()) );
if (0 == pUnoI) // no existing interface, register new proxy
@@ -500,7 +500,7 @@ uno_Interface * Bridge::map_to_uno(
javaI, static_cast<jstring>(jo_oid.get()), oid, info );
(*m_uno_env->registerProxyInterface)(
- m_uno_env, (void **)&pUnoI,
+ m_uno_env, reinterpret_cast<void **>(&pUnoI),
UNO_proxy_free,
oid.pData, reinterpret_cast<typelib_InterfaceTypeDescription *>(info->m_td.get()) );
}
@@ -667,7 +667,7 @@ void SAL_CALL UNO_proxy_dispatch(
uno_Interface * pInterface = 0;
(*bridge->m_uno_env->getRegisteredInterface)(
bridge->m_uno_env,
- (void **) &pInterface, that->m_oid.pData,
+ reinterpret_cast<void **>(&pInterface), that->m_oid.pData,
reinterpret_cast<typelib_InterfaceTypeDescription *>(demanded_td.get()) );
if (0 == pInterface)
@@ -719,7 +719,7 @@ void SAL_CALL UNO_proxy_dispatch(
(*bridge->m_uno_env->registerProxyInterface)(
bridge->m_uno_env,
- (void **) &pUnoI2,
+ reinterpret_cast<void **>(&pUnoI2),
UNO_proxy_free, that->m_oid.pData,
reinterpret_cast<
typelib_InterfaceTypeDescription * >(
diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index b8f3b5b..b6bb453 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -96,18 +96,17 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
std::string incompFrom;
std::string incompTo;
if( expr->getCastKind() == CK_BitCast ) {
- QualType t1 = resolvePointers(expr->getSubExprAsWritten()->getType());
- QualType t2 = resolvePointers(expr->getType());
- // Ignore "safe" casts for now that involve casting from or to void*
- // (and can thus not be interpreted as either a static_cast or a
+ QualType t = resolvePointers(expr->getSubExprAsWritten()->getType());
+ // Ignore "safe" casts for now that involve casting from void* (and can
+ // thus not be interpreted as either a static_cast or a
// reinterpret_cast, with potentially different results):
- if (t1->isVoidType() || t2->isVoidType()) {
+ if (t->isVoidType()) {
return true;
}
- if (t1->isIncompleteType()) {
+ if (t->isIncompleteType()) {
incompFrom = "incomplete ";
}
- if (t2->isIncompleteType()) {
+ if (resolvePointers(expr->getType())->isIncompleteType()) {
incompTo = "incomplete ";
}
}
diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
index dec05dd..82f5c98 100644
--- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx
+++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
@@ -186,7 +186,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeExc
// Get the parameter number that requires data
sal_Int32* paramIndex = 0;
- nReturn = N3SQLParamData(m_aStatementHandle,(SQLPOINTER*)¶mIndex);
+ nReturn = N3SQLParamData(m_aStatementHandle, reinterpret_cast<SQLPOINTER*>(¶mIndex));
// If the parameter index is -1, there is no
// more data required
diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx
index 285462d..c349146 100644
--- a/connectivity/source/drivers/postgresql/pq_connection.cxx
+++ b/connectivity/source/drivers/postgresql/pq_connection.cxx
@@ -146,8 +146,8 @@ static sal_Int32 readLogLevelFromConfiguration()
{
sal_Int32 loglevel = LogLevel::NONE;
OUString fileName;
- osl_getModuleURLFromAddress(
- (void*) readLogLevelFromConfiguration, &fileName.pData );
+ osl_getModuleURLFromFunctionAddress(
+ reinterpret_cast<oslGenericFunction>(readLogLevelFromConfiguration), &fileName.pData );
fileName = fileName.copy( fileName.lastIndexOf( '/' )+1 );
#ifdef MACOSX
fileName += "../Resources/";
diff --git a/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx b/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx
index bb29e13..5e03243 100644
--- a/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx
+++ b/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx
@@ -163,7 +163,7 @@ void Mapping::mapInterface(
OSL_ASSERT(pOId);
// try to get any known interface from target environment
- m_to.get()->pExtEnv->getRegisteredInterface(m_to.get()->pExtEnv, (void **)ppOut, pOId, pTypeDescr);
+ m_to.get()->pExtEnv->getRegisteredInterface(m_to.get()->pExtEnv, reinterpret_cast<void **>(ppOut), pOId, pTypeDescr);
if (!*ppOut) // not yet there, register new proxy interface
{
@@ -179,7 +179,7 @@ void Mapping::mapInterface(
// proxy may be exchanged during registration
m_to.get()->pExtEnv->registerProxyInterface(m_to.get()->pExtEnv,
- (void **)&pProxy,
+ reinterpret_cast<void **>(&pProxy),
Proxy_free,
pOId,
pTypeDescr);
diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx
index fc2ca00..24d7864 100644
--- a/cppu/source/uno/copy.hxx
+++ b/cppu/source/uno/copy.hxx
@@ -479,16 +479,16 @@ inline uno_Sequence * icopyConstructSequence(
if (pDest != 0)
{
char * pElements = pDest->elements;
- void ** pSourceElements = (void **)pSource->elements;
+ void ** pSourceElements = reinterpret_cast<void **>(pSource->elements);
typelib_TypeDescription * pElementTypeDescr = 0;
TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType );
for ( sal_Int32 nPos = nElements; nPos--; )
{
- ((void **)pElements)[nPos] = 0;
+ reinterpret_cast<void **>(pElements)[nPos] = 0;
if (((void **)pSourceElements)[nPos])
{
(*mapping->mapInterface)(
- mapping, (void **)pElements + nPos,
+ mapping, reinterpret_cast<void **>(pElements) + nPos,
pSourceElements[nPos],
reinterpret_cast<typelib_InterfaceTypeDescription *>(
pElementTypeDescr) );
diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx
index aa6587f..2354e7d8 100644
--- a/cppu/source/uno/lbmap.cxx
+++ b/cppu/source/uno/lbmap.cxx
@@ -228,7 +228,7 @@ static void SAL_CALL mediate_mapInterface(
uno_Mapping * pFrom2Uno = that->aFrom2Uno.get();
uno_Interface * pUnoI = 0;
- (*pFrom2Uno->mapInterface)( pFrom2Uno, (void **) &pUnoI, pInterface, pInterfaceTypeDescr );
+ (*pFrom2Uno->mapInterface)( pFrom2Uno, reinterpret_cast<void **>(&pUnoI), pInterface, pInterfaceTypeDescr );
if (0 == pUnoI)
{
void * pOut = *ppOut;
diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx
index 9575fcc..7dc3e9f 100644
--- a/cppu/source/uno/sequence.cxx
+++ b/cppu/source/uno/sequence.cxx
@@ -568,7 +568,7 @@ static inline bool icopyConstructFromElements(
pSeq = reallocSeq( pSeq, sizeof(void *), nAlloc );
if (pSeq != 0)
{
- void ** pDestElements = (void **) pSeq->elements;
+ void ** pDestElements = reinterpret_cast<void **>(pSeq->elements);
for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos )
{
_acquire( pDestElements[nPos] =
diff --git a/include/uno/current_context.hxx b/include/uno/current_context.hxx
index 9e04349..5627044 100644
--- a/include/uno/current_context.hxx
+++ b/include/uno/current_context.hxx
@@ -45,7 +45,7 @@ inline Reference< XCurrentContext > SAL_CALL getCurrentContext()
{
Reference< XCurrentContext > xRet;
::rtl::OUString aEnvTypeName( CPPU_CURRENT_LANGUAGE_BINDING_NAME );
- ::uno_getCurrentContext( (void **)&xRet, aEnvTypeName.pData, 0 );
+ ::uno_getCurrentContext( reinterpret_cast<void **>(&xRet), aEnvTypeName.pData, 0 );
return xRet;
}
/** Setting the current context.
@@ -95,7 +95,7 @@ public:
inline ContextLayer::ContextLayer( Reference< XCurrentContext > const & xNewContext )
: m_aEnvTypeName( CPPU_CURRENT_LANGUAGE_BINDING_NAME )
{
- ::uno_getCurrentContext( (void **)&m_xPreviousContext, m_aEnvTypeName.pData, 0 );
+ ::uno_getCurrentContext( reinterpret_cast<void **>(&m_xPreviousContext), m_aEnvTypeName.pData, 0 );
::uno_setCurrentContext( xNewContext.get(), m_aEnvTypeName.pData, 0 );
}
diff --git a/include/uno/mapping.hxx b/include/uno/mapping.hxx
index 1199c71..51a12d3 100644
--- a/include/uno/mapping.hxx
+++ b/include/uno/mapping.hxx
@@ -325,7 +325,7 @@ inline bool mapToUno( uno_Interface ** ppRet, const Reference< C > & x )
::rtl::OUString( UNO_LB_UNO ) );
OSL_ASSERT( aMapping.is() );
aMapping.mapInterface(
- (void **)ppRet, x.get(), ::cppu::getTypeFavourUnsigned( &x ) );
+ reinterpret_cast<void **>(ppRet), x.get(), ::cppu::getTypeFavourUnsigned( &x ) );
return (0 != *ppRet);
}
diff --git a/lotuswordpro/source/filter/lwptools.cxx b/lotuswordpro/source/filter/lwptools.cxx
index 7015651..72a86e0 100644
--- a/lotuswordpro/source/filter/lwptools.cxx
+++ b/lotuswordpro/source/filter/lwptools.cxx
@@ -261,13 +261,13 @@ XFDateStyle* LwpTools::GetSystemDateStyle(bool bLongFormat)
UErrorCode status = U_ZERO_ERROR;
UChar* pattern = NULL;
- nLengthNeed = udat_toPattern((void *const *)fmt,sal_False,NULL,nLength,&status);
+ nLengthNeed = udat_toPattern(reinterpret_cast<void **>(fmt),sal_False,NULL,nLength,&status);
if (status == U_BUFFER_OVERFLOW_ERROR)
{
status = U_ZERO_ERROR;
nLength = nLengthNeed +1;
pattern = (UChar*)malloc(sizeof(UChar)*nLength);
- udat_toPattern((void *const *)fmt,sal_False,pattern,nLength,&status);
+ udat_toPattern(reinterpret_cast<void **>(fmt),sal_False,pattern,nLength,&status);
}
if (pattern == NULL)
return NULL;
@@ -649,13 +649,13 @@ XFTimeStyle* LwpTools::GetSystemTimeStyle()
int32_t nLengthNeed;
UErrorCode status = U_ZERO_ERROR;
UChar* pattern = NULL;
- nLengthNeed = udat_toPattern((void *const *)fmt,false,NULL,nLength,&status);
+ nLengthNeed = udat_toPattern(reinterpret_cast<void **>(fmt),false,NULL,nLength,&status);
if (status == U_BUFFER_OVERFLOW_ERROR)
{
status = U_ZERO_ERROR;
nLength = nLengthNeed +1;
pattern = (UChar*)malloc(sizeof(UChar)*nLength);
- udat_toPattern((void *const *)fmt,false,pattern,nLength,&status);
+ udat_toPattern(reinterpret_cast<void **>(fmt),false,pattern,nLength,&status);
}
if (pattern == NULL)
diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx
index 3913c82..e8c1a67 100644
--- a/registry/source/keyimpl.cxx
+++ b/registry/source/keyimpl.cxx
@@ -90,7 +90,7 @@ RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubK
ORegKey* pKey = this;
if ( !keyName.isEmpty() )
{
- _ret = openKey(keyName, (RegKeyHandle*)&pKey);
+ _ret = openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pKey));
if (_ret != REG_NO_ERROR)
return _ret;
}
@@ -113,7 +113,7 @@ RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubK
OUString const sSubKeyName = iter.m_pszName;
ORegKey* pOpenSubKey = 0;
- _ret = pKey->openKey(sSubKeyName, (RegKeyHandle*)&pOpenSubKey);
+ _ret = pKey->openKey(sSubKeyName, reinterpret_cast<RegKeyHandle*>(&pOpenSubKey));
if (_ret != REG_NO_ERROR)
{
*phOpenSubKeys = NULL;
@@ -130,7 +130,7 @@ RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubK
_err = rStoreDir.next(iter);
}
- *phOpenSubKeys = (RegKeyHandle*)pSubKeys;
+ *phOpenSubKeys = reinterpret_cast<RegKeyHandle*>(pSubKeys);
if (!keyName.isEmpty())
{
(void) releaseKey(pKey);
@@ -154,7 +154,7 @@ RegError ORegKey::getKeyNames(const OUString& keyName,
ORegKey* pKey = this;
if (!keyName.isEmpty())
{
- _ret = openKey(keyName, (RegKeyHandle*)&pKey);
+ _ret = openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pKey));
if (_ret != REG_NO_ERROR)
return _ret;
}
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 039cde3..90c1cee 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -830,7 +830,7 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName)
}
ORegKey* pOldKey = 0;
- _ret = pKey->openKey(keyName, (RegKeyHandle*)&pOldKey);
+ _ret = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pOldKey));
if (_ret != REG_NO_ERROR)
return _ret;
@@ -1363,7 +1363,7 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey,
}
ORegKey* pTmpKey = 0;
- _ret = pSourceKey->openKey(keyName, (RegKeyHandle*)&pTmpKey);
+ _ret = pSourceKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pTmpKey));
if (_ret != REG_NO_ERROR)
return _ret;
diff --git a/registry/source/registry.cxx b/registry/source/registry.cxx
index fc1412d..961b1ac 100644
--- a/registry/source/registry.cxx
+++ b/registry/source/registry.cxx
@@ -264,14 +264,14 @@ static RegError REGISTRY_CALLTYPE loadKey(RegHandle hReg,
ORegKey* pNewKey = 0;
- RegError _ret = pKey->openKey(keyName, (RegKeyHandle*)&pNewKey);
+ RegError _ret = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pNewKey));
if (_ret == REG_NO_ERROR)
{
pKey->releaseKey(pNewKey);
pKey->deleteKey(keyName);
}
- _ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey);
+ _ret = pKey->createKey(keyName, reinterpret_cast<RegKeyHandle*>(&pNewKey));
if (_ret != REG_NO_ERROR)
return _ret;
@@ -312,7 +312,7 @@ static RegError REGISTRY_CALLTYPE saveKey(RegHandle hReg,
return REG_INVALID_KEY;
ORegKey* pNewKey = 0;
- RegError _ret = pKey->openKey(keyName, (RegKeyHandle*)&pNewKey);
+ RegError _ret = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pNewKey));
if (_ret != REG_NO_ERROR)
return _ret;
@@ -355,7 +355,7 @@ static RegError REGISTRY_CALLTYPE mergeKey(RegHandle hReg,
if (keyName->length)
{
ORegKey* pNewKey = 0;
- RegError _ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey);
+ RegError _ret = pKey->createKey(keyName, reinterpret_cast<RegKeyHandle*>(&pNewKey));
if (_ret != REG_NO_ERROR)
return _ret;
diff --git a/registry/source/regkey.cxx b/registry/source/regkey.cxx
index 2512dfd..6e314e0 100644
--- a/registry/source/regkey.cxx
+++ b/registry/source/regkey.cxx
@@ -218,7 +218,7 @@ RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey,
if (keyName->length)
{
ORegKey* pSubKey = 0;
- RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey));
if (_ret1 != REG_NO_ERROR)
return _ret1;
@@ -260,7 +260,7 @@ RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle hKey,
if (keyName->length)
{
ORegKey* pSubKey = 0;
- RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey));
if (_ret1 != REG_NO_ERROR)
return _ret1;
@@ -302,7 +302,7 @@ RegError REGISTRY_CALLTYPE setStringListValue(RegKeyHandle hKey,
if (keyName->length)
{
ORegKey* pSubKey = 0;
- RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey));
if (_ret1 != REG_NO_ERROR)
return _ret1;
@@ -344,7 +344,7 @@ RegError REGISTRY_CALLTYPE setUnicodeListValue(RegKeyHandle hKey,
if (keyName->length)
{
ORegKey* pSubKey = 0;
- RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey));
if (_ret1 != REG_NO_ERROR)
return _ret1;
@@ -389,7 +389,7 @@ RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle hKey,
if (keyName->length)
{
ORegKey* pSubKey = 0;
- RegError _ret = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ RegError _ret = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey));
if (_ret != REG_NO_ERROR)
return _ret;
@@ -435,7 +435,7 @@ RegError REGISTRY_CALLTYPE getValue(RegKeyHandle hKey,
if (keyName->length)
{
ORegKey* pSubKey = 0;
- RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey));
if (_ret1 != REG_NO_ERROR)
return _ret1;
@@ -474,7 +474,7 @@ RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle hKey,
if (keyName->length)
{
ORegKey* pSubKey = 0;
- RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey));
if (_ret1 != REG_NO_ERROR)
return _ret1;
@@ -513,7 +513,7 @@ RegError REGISTRY_CALLTYPE getStringListValue(RegKeyHandle hKey,
if (keyName->length)
{
ORegKey* pSubKey = 0;
- RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey));
if (_ret1 != REG_NO_ERROR)
return _ret1;
@@ -550,7 +550,7 @@ RegError REGISTRY_CALLTYPE getUnicodeListValue(RegKeyHandle hKey,
if (keyName->length)
{
ORegKey* pSubKey = 0;
- RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ RegError _ret1 = pKey->openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pSubKey));
if (_ret1 != REG_NO_ERROR)
return _ret1;
diff --git a/sal/qa/osl/module/osl_Module.cxx b/sal/qa/osl/module/osl_Module.cxx
index 1612662..60a3363 100644
--- a/sal/qa/osl/module/osl_Module.cxx
+++ b/sal/qa/osl/module/osl_Module.cxx
@@ -38,7 +38,8 @@ inline ::rtl::OUString getDllURL( void )
#endif
::rtl::OUString dirPath, dllPath;
- osl::Module::getUrlFromAddress( ( void* ) &getDllURL, dirPath );
+ osl::Module::getUrlFromAddress(
+ reinterpret_cast<oslGenericFunction>(&getDllURL), dirPath);
dirPath = dirPath.copy( 0, dirPath.lastIndexOf('/') + 1);
osl::FileBase::getAbsoluteFileURL( dirPath, libPath, dllPath );
@@ -81,7 +82,10 @@ namespace osl_Module
void ctors_name_mode( )
{
OUString aFileURL;
- bRes = osl::Module::getUrlFromAddress( ( void* ) &::osl_Module::testClass::myFunc, aFileURL );
+ bRes = osl::Module::getUrlFromAddress(
+ reinterpret_cast<oslGenericFunction>(
+ &osl_Module::testClass::myFunc),
+ aFileURL);
if ( !( bRes ) )
{
@@ -113,7 +117,10 @@ namespace osl_Module
void getUrlFromAddress_001( )
{
OUString aFileURL;
- bRes = osl::Module::getUrlFromAddress( ( void* ) &::osl_Module::testClass::myFunc, aFileURL ) ;
+ bRes = osl::Module::getUrlFromAddress(
+ reinterpret_cast<oslGenericFunction>(
+ &osl_Module::testClass::myFunc),
+ aFileURL);
if ( !( bRes ) )
{
CPPUNIT_ASSERT_MESSAGE("Cannot locate current module.", false );
@@ -131,7 +138,8 @@ namespace osl_Module
FuncPtr pFunc = ( FuncPtr ) aMod.getSymbol( rtl::OUString("firstfunc") );
OUString aFileURL;
- bRes = osl::Module::getUrlFromAddress( ( void* )pFunc, aFileURL );
+ bRes = osl::Module::getUrlFromAddress(
+ reinterpret_cast<oslGenericFunction>(pFunc), aFileURL);
if ( !( bRes ) )
{
CPPUNIT_ASSERT_MESSAGE("Cannot locate current module.", false );
@@ -214,7 +222,10 @@ namespace osl_Module
void is_001( )
{
OUString aFileURL;
- bRes = osl::Module::getUrlFromAddress( ( void* ) &::osl_Module::testClass::myFunc, aFileURL );
+ bRes = osl::Module::getUrlFromAddress(
+ reinterpret_cast<oslGenericFunction>(
+ osl_Module::testClass::myFunc),
+ aFileURL);
if ( !( bRes ) )
{
CPPUNIT_ASSERT_MESSAGE("Cannot locate current module - using executable instead", false );
diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx
index 5a5e8a8..a1e5a20 100644
--- a/sal/qa/osl/process/osl_process.cxx
+++ b/sal/qa/osl/process/osl_process.cxx
@@ -83,7 +83,8 @@ using ::rtl::OString;
inline ::rtl::OUString getExecutablePath( void )
{
::rtl::OUString dirPath;
- osl::Module::getUrlFromAddress( ( void* ) &getExecutablePath, dirPath );
+ osl::Module::getUrlFromAddress(
+ reinterpret_cast<oslGenericFunction>(&getExecutablePath), dirPath);
dirPath = dirPath.copy( 0, dirPath.lastIndexOf('/') );
dirPath = dirPath.copy( 0, dirPath.lastIndexOf('/') + 1);
dirPath += rtl::OUString("Executable");
diff --git a/sfx2/source/appl/shutdowniconunx.cxx b/sfx2/source/appl/shutdowniconunx.cxx
index 8c85946..b5aee73 100644
--- a/sfx2/source/appl/shutdowniconunx.cxx
+++ b/sfx2/source/appl/shutdowniconunx.cxx
@@ -428,7 +428,7 @@ void plugin_shutdown_sys_tray()
if (pMonitor)
{
g_signal_handlers_disconnect_by_func(pMonitor,
- (void*)notify_file_changed, pMonitor);
+ reinterpret_cast<gpointer>(¬ify_file_changed), pMonitor);
g_file_monitor_cancel(pMonitor);
g_object_unref(pMonitor);
pMonitor = NULL;
diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx
index a300a25..6d6f35a 100644
--- a/stoc/source/invocation_adapterfactory/iafactory.cxx
+++ b/stoc/source/invocation_adapterfactory/iafactory.cxx
@@ -851,7 +851,7 @@ Reference< XInterface > FactoryImpl::createAdapter(
// map one interface to C++
uno_Interface * pUnoI = &that->m_pInterfaces[ 0 ];
m_aUno2Cpp.mapInterface(
- (void **)&xRet, pUnoI, ::getCppuType( &xRet ) );
+ reinterpret_cast<void **>(&xRet), pUnoI, ::getCppuType( &xRet ) );
that->release();
OSL_ASSERT( xRet.is() );
if (! xRet.is())
diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx
index 721b095..a50fb99 100644
--- a/stoc/source/security/access_controller.cxx
+++ b/stoc/source/security/access_controller.cxx
@@ -792,7 +792,7 @@ void AccessController::checkPermission(
// first dynamic check of ac contexts
Reference< XCurrentContext > xContext;
- ::uno_getCurrentContext( (void **)&xContext, s_envType.pData, 0 );
+ ::uno_getCurrentContext( reinterpret_cast<void **>(&xContext), s_envType.pData, 0 );
Reference< security::XAccessControlContext > xACC( getDynamicRestriction( xContext ) );
if (xACC.is())
{
@@ -823,7 +823,7 @@ Any AccessController::doRestricted(
if (xRestriction.is())
{
Reference< XCurrentContext > xContext;
- ::uno_getCurrentContext( (void **)&xContext, s_envType.pData, 0 );
+ ::uno_getCurrentContext( reinterpret_cast<void **>(&xContext), s_envType.pData, 0 );
// override restriction
Reference< XCurrentContext > xNewContext(
@@ -856,7 +856,7 @@ Any AccessController::doPrivileged(
}
Reference< XCurrentContext > xContext;
- ::uno_getCurrentContext( (void **)&xContext, s_envType.pData, 0 );
+ ::uno_getCurrentContext( reinterpret_cast<void **>(&xContext), s_envType.pData, 0 );
Reference< security::XAccessControlContext > xOldRestr(
getDynamicRestriction( xContext ) );
@@ -891,7 +891,7 @@ Reference< security::XAccessControlContext > AccessController::getContext()
}
Reference< XCurrentContext > xContext;
- ::uno_getCurrentContext( (void **)&xContext, s_envType.pData, 0 );
+ ::uno_getCurrentContext( reinterpret_cast<void **>(&xContext), s_envType.pData, 0 );
return acc_Intersection::create(
getDynamicRestriction( xContext ),
diff --git a/vcl/generic/fontmanager/parseAFM.cxx b/vcl/generic/fontmanager/parseAFM.cxx
index 6d341ba..b73ea9b 100644
--- a/vcl/generic/fontmanager/parseAFM.cxx
+++ b/vcl/generic/fontmanager/parseAFM.cxx
@@ -732,7 +732,7 @@ static int parseCharMetrics( FileInputStream* fp, FontInfo* fi)
case CODE:
if (!(count < fi->numOfChars))
{
- reallocFontMetrics( (void**)&(fi->cmi),
+ reallocFontMetrics( reinterpret_cast<void**>(&fi->cmi),
&(fi->numOfChars), enlargeCount(fi->numOfChars),
sizeof(CharMetricInfo) );
temp = &(fi->cmi[ count - 1 ]);
@@ -756,7 +756,7 @@ static int parseCharMetrics( FileInputStream* fp, FontInfo* fi)
case CODEHEX:
if (!(count < fi->numOfChars ))
{
- reallocFontMetrics( (void**)&(fi->cmi),
+ reallocFontMetrics( reinterpret_cast<void**>(&fi->cmi),
&(fi->numOfChars), enlargeCount(fi->numOfChars),
sizeof(CharMetricInfo) );
temp = &(fi->cmi[ count - 1 ]);
@@ -841,7 +841,7 @@ static int parseCharMetrics( FileInputStream* fp, FontInfo* fi)
} /* while */
if ((error == ok) && (count != fi->numOfChars))
- error = reallocFontMetrics( (void**)&(fi->cmi), &(fi->numOfChars),
+ error = reallocFontMetrics( reinterpret_cast<void**>(&fi->cmi), &(fi->numOfChars),
count, sizeof(CharMetricInfo) );
if ((error == ok) && (count != fi->numOfChars))
@@ -907,7 +907,7 @@ static int parseTrackKernData( FileInputStream* fp, FontInfo* fi)
case TRACKKERN:
if (!(tcount < fi->numOfTracks))
{
- reallocFontMetrics( (void**)&(fi->tkd), &(fi->numOfTracks),
+ reallocFontMetrics( reinterpret_cast<void**>(&fi->tkd), &(fi->numOfTracks),
enlargeCount(fi->numOfTracks), sizeof(TrackKernData) );
}
@@ -947,7 +947,7 @@ static int parseTrackKernData( FileInputStream* fp, FontInfo* fi)
} /* while */
if (error == ok && tcount != fi->numOfTracks)
- error = reallocFontMetrics( (void**)&(fi->tkd), &(fi->numOfTracks),
+ error = reallocFontMetrics( reinterpret_cast<void**>(&fi->tkd), &(fi->numOfTracks),
tcount, sizeof(TrackKernData) );
if (error == ok && tcount != fi->numOfTracks)
@@ -1013,7 +1013,7 @@ static int parsePairKernData( FileInputStream* fp, FontInfo* fi)
case KERNPAIR:
if (!(pcount < fi->numOfPairs))
{
- reallocFontMetrics( (void**)&(fi->pkd), &(fi->numOfPairs),
+ reallocFontMetrics( reinterpret_cast<void**>(&fi->pkd), &(fi->numOfPairs),
enlargeCount(fi->numOfPairs), sizeof(PairKernData) );
}
if (pcount < fi->numOfPairs)
@@ -1037,7 +1037,7 @@ static int parsePairKernData( FileInputStream* fp, FontInfo* fi)
case KERNPAIRXAMT:
if (!(pcount < fi->numOfPairs))
{
- reallocFontMetrics( (void**)&(fi->pkd), &(fi->numOfPairs),
+ reallocFontMetrics( reinterpret_cast<void**>(&fi->pkd), &(fi->numOfPairs),
enlargeCount(fi->numOfPairs), sizeof(PairKernData) );
}
if (pcount < fi->numOfPairs)
@@ -1072,7 +1072,7 @@ static int parsePairKernData( FileInputStream* fp, FontInfo* fi)
} /* while */
if ((error == ok) && (pcount != fi->numOfPairs))
- error = reallocFontMetrics( (void**)&(fi->pkd), &(fi->numOfPairs),
+ error = reallocFontMetrics( reinterpret_cast<void**>(&fi->pkd), &(fi->numOfPairs),
pcount, sizeof(PairKernData) );
if (error == ok && pcount != fi->numOfPairs)
@@ -1117,7 +1117,7 @@ static int parseCompCharData( FileInputStream* fp, FontInfo* fi)
}
if (ccount > fi->numOfComps)
{
- reallocFontMetrics( (void**)&(fi->ccd), &(fi->numOfComps),
+ reallocFontMetrics( reinterpret_cast<void**>(&fi->ccd), &(fi->numOfComps),
enlargeCount(fi->numOfComps), sizeof(CompCharData) );
}
if (ccount > fi->numOfComps)
@@ -1155,7 +1155,7 @@ static int parseCompCharData( FileInputStream* fp, FontInfo* fi)
case COMPCHAR:
if (!(ccount < fi->numOfComps))
{
- reallocFontMetrics( (void**)&(fi->ccd), &(fi->numOfComps),
+ reallocFontMetrics( reinterpret_cast<void**>(&fi->ccd), &(fi->numOfComps),
enlargeCount(fi->numOfComps), sizeof(CompCharData) );
}
if (ccount < fi->numOfComps)
@@ -1209,7 +1209,7 @@ static int parseCompCharData( FileInputStream* fp, FontInfo* fi)
} /* while */
if (error == ok && ccount != fi->numOfComps)
- reallocFontMetrics( (void**)&(fi->ccd), &(fi->numOfComps),
+ reallocFontMetrics( reinterpret_cast<void**>(&fi->ccd), &(fi->numOfComps),
ccount, sizeof(CompCharData) );
if (error == ok && ccount != fi->numOfComps)
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index 52a2553..2dc978a 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -647,7 +647,7 @@ bool CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTi
// setup cups options
int nNumOptions = 0;
cups_option_t* pOptions = NULL;
- getOptionsFromDocumentSetup( rDocumentJobData, bBanner, nNumOptions, (void**)&pOptions );
+ getOptionsFromDocumentSetup( rDocumentJobData, bBanner, nNumOptions, reinterpret_cast<void**>(&pOptions) );
OString sJobName(OUStringToOString(rJobTitle, aEnc));
commit 4b60941b60262be4861f5e8fba95366d3187c445
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Jan 28 13:49:09 2015 +0100
Clean up implementation of osl_getSymbol et al
Change-Id: Ic71b7bc8e8b5783deb1f9fa89136537c24281a55
diff --git a/sal/osl/unx/module.cxx b/sal/osl/unx/module.cxx
index e8ae7b5..ca3318f 100644
--- a/sal/osl/unx/module.cxx
+++ b/sal/osl/unx/module.cxx
@@ -25,6 +25,8 @@
#include <osl/thread.h>
#include <osl/process.h>
#include <osl/file.h>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
#include <assert.h>
#include "system.hxx"
#include "file_url.hxx"
@@ -232,13 +234,44 @@ void SAL_CALL osl_unloadModule(oslModule hModule)
#endif // !DISABLE_DYNLOADING
+namespace {
+
+void * getSymbol(oslModule module, char const * symbol) {
+ assert(symbol != nullptr);
+ // We do want to use dlsym() also in the DISABLE_DYNLOADING case
+ // just to look up symbols in the static executable, I think:
+ void * p = dlsym(module, symbol);
+ SAL_INFO_IF(
+ p == nullptr, "sal.osl",
+ "dlsym(" << module << ", " << symbol << "): " << dlerror());
+ return p;
+}
+
+}
+
/*****************************************************************************/
/* osl_getSymbol */
/*****************************************************************************/
void* SAL_CALL
osl_getSymbol(oslModule Module, rtl_uString* pSymbolName)
{
- return (void *) osl_getFunctionSymbol(Module, pSymbolName);
+ // Arbitrarily using UTF-8:
+ OString s;
+ if (!OUString::unacquired(&pSymbolName).convertToString(
+ &s, RTL_TEXTENCODING_UTF8,
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
+ {
+ SAL_INFO(
+ "sal.osl", "cannot convert \"" << OUString::unacquired(&pSymbolName)
+ << "\" to UTF-8");
+ return nullptr;
+ }
+ if (s.indexOf('\0') != -1) {
+ SAL_INFO("sal.osl", "\"" << s << "\" contains embedded NUL");
+ return nullptr;
+ }
+ return getSymbol(Module, s.getStr());
}
/*****************************************************************************/
@@ -247,19 +280,9 @@ osl_getSymbol(oslModule Module, rtl_uString* pSymbolName)
oslGenericFunction SAL_CALL
osl_getAsciiFunctionSymbol(oslModule Module, const sal_Char *pSymbol)
{
- void *fcnAddr = NULL;
-
- // We do want to use dlsym() also in the DISABLE_DYNLOADING case
- // just to look up symbols in the static executable, I think.
- if (pSymbol)
- {
- fcnAddr = dlsym(Module, pSymbol);
- SAL_INFO_IF(
- fcnAddr == 0, "sal.osl",
- "dlsym(" << Module << ", " << pSymbol << "): " << dlerror());
- }
-
- return (oslGenericFunction) fcnAddr;
+ return reinterpret_cast<oslGenericFunction>(getSymbol(Module, pSymbol));
+ // requires conditionally-supported conversion from void * to function
+ // pointer
}
/*****************************************************************************/
@@ -268,26 +291,10 @@ osl_getAsciiFunctionSymbol(oslModule Module, const sal_Char *pSymbol)
oslGenericFunction SAL_CALL
osl_getFunctionSymbol(oslModule module, rtl_uString *puFunctionSymbolName)
{
- oslGenericFunction pSymbol = NULL;
-
- if( puFunctionSymbolName )
- {
- rtl_String* pSymbolName = NULL;
-
- rtl_uString2String( &pSymbolName,
- rtl_uString_getStr(puFunctionSymbolName),
- rtl_uString_getLength(puFunctionSymbolName),
- RTL_TEXTENCODING_UTF8,
- OUSTRING_TO_OSTRING_CVTFLAGS );
-
- if( pSymbolName != NULL )
- {
- pSymbol = osl_getAsciiFunctionSymbol(module, rtl_string_getStr(pSymbolName));
- rtl_string_release(pSymbolName);
- }
- }
-
- return pSymbol;
+ return reinterpret_cast<oslGenericFunction>(
+ osl_getSymbol(module, puFunctionSymbolName));
+ // requires conditionally-supported conversion from void * to function
+ // pointer
}
/*****************************************************************************/
@@ -333,7 +340,10 @@ sal_Bool SAL_CALL osl_getModuleURLFromAddress(void * addr, rtl_uString ** ppLibr
/*****************************************************************************/
sal_Bool SAL_CALL osl_getModuleURLFromFunctionAddress(oslGenericFunction addr, rtl_uString ** ppLibraryUrl)
{
- return osl_getModuleURLFromAddress((void*)addr, ppLibraryUrl);
+ return osl_getModuleURLFromAddress(
+ reinterpret_cast<void*>(addr), ppLibraryUrl);
+ // requires conditionally-supported conversion from function pointer to
+ // void *
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list