summaryrefslogtreecommitdiff
path: root/cli_ure
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-03-30 12:55:22 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-03-30 12:55:22 +0200
commit50b02731ca8494592a8d9a844530baca0e870e3c (patch)
treec2b36222f5d0ad66add5be6ab5f02da0e0d476d5 /cli_ure
parent6ec9e87ced60add494f8d397017f8f9ffc65a00a (diff)
Replace scary reinterpret_casts with OUString::unacquired
...and actually fix some of them Change-Id: I3493ceb65f305466d167304bd77058adb042067c
Diffstat (limited to 'cli_ure')
-rw-r--r--cli_ure/source/uno_bridge/cli_base.h2
-rw-r--r--cli_ure/source/uno_bridge/cli_bridge.cxx5
-rw-r--r--cli_ure/source/uno_bridge/cli_data.cxx26
-rw-r--r--cli_ure/source/uno_bridge/cli_proxy.cxx4
4 files changed, 18 insertions, 19 deletions
diff --git a/cli_ure/source/uno_bridge/cli_base.h b/cli_ure/source/uno_bridge/cli_base.h
index 47aa720a519b..8c29e66f28c4 100644
--- a/cli_ure/source/uno_bridge/cli_base.h
+++ b/cli_ure/source/uno_bridge/cli_base.h
@@ -160,7 +160,7 @@ inline TypeDescr::TypeDescr( typelib_TypeDescriptionReference * td_ref )
{
throw BridgeRuntimeError(
"cannot get comprehensive type description for " +
- *reinterpret_cast< OUString const * >( &td_ref->pTypeName ) );
+ OUString::unacquired(&td_ref->pTypeName) );
}
}
diff --git a/cli_ure/source/uno_bridge/cli_bridge.cxx b/cli_ure/source/uno_bridge/cli_bridge.cxx
index 279c4bb10e23..241581ddac18 100644
--- a/cli_ure/source/uno_bridge/cli_bridge.cxx
+++ b/cli_ure/source/uno_bridge/cli_bridge.cxx
@@ -296,10 +296,9 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping(
}
- OUString const & from_env_typename = *reinterpret_cast< OUString const * >(
+ OUString const & from_env_typename = OUString::unacquired(
&pFrom->pTypeName );
- OUString const & to_env_typename = *reinterpret_cast< OUString const * >(
- &pTo->pTypeName );
+ OUString const & to_env_typename = OUString::unacquired( &pTo->pTypeName );
uno_Mapping * mapping = 0;
diff --git a/cli_ure/source/uno_bridge/cli_data.cxx b/cli_ure/source/uno_bridge/cli_data.cxx
index 68cd3aa20936..5a8a4ac8b17c 100644
--- a/cli_ure/source/uno_bridge/cli_data.cxx
+++ b/cli_ure/source/uno_bridge/cli_data.cxx
@@ -1069,7 +1069,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
}
else
{
- throw BridgeRuntimeError("[map_to_uno(): Member: " + *reinterpret_cast< OUString const * >(comp_td->ppMemberNames[nPos]));
+ throw BridgeRuntimeError("[map_to_uno(): Member: " + OUString::unacquired(&comp_td->ppMemberNames[nPos]));
}
}
else
@@ -1167,7 +1167,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
OUString str = "[map_to_uno():";
if (cliType)
{
- str += mapCliString(cliType->FullName) + "." + *reinterpret_cast< OUString const * >(comp_td->ppMemberNames[nPos]) + " ";
+ str += mapCliString(cliType->FullName) + "." + OUString::unacquired(&comp_td->ppMemberNames[nPos]) + " ";
}
str += e.m_message;
throw BridgeRuntimeError(str);
@@ -1178,7 +1178,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
OUString str = "[map_to_uno():";
if (cliType)
{
- str += mapCliString(cliType->FullName) + "." + *reinterpret_cast< OUString const * >(comp_td->ppMemberNames[nPos]);
+ str += mapCliString(cliType->FullName) + "." + OUString::unacquired(&comp_td->ppMemberNames[nPos]);
}
str += "] Value has not the required type.";
throw BridgeRuntimeError(str);
@@ -1345,20 +1345,20 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
}
default:
{
- throw BridgeRuntimeError("[map_to_uno():" + *reinterpret_cast< OUString const * >( &type->pTypeName ) +
- "] unsupported sequence element type: " + *reinterpret_cast< OUString const * >( &element_type->pTypeName ));
+ throw BridgeRuntimeError("[map_to_uno():" + OUString::unacquired( &type->pTypeName ) +
+ "] unsupported sequence element type: " + OUString::unacquired( &element_type->pTypeName ));
}
}
}
catch (BridgeRuntimeError& e)
{
- throw BridgeRuntimeError("[map_to_uno():" + *reinterpret_cast< OUString const * >( &type->pTypeName ) + "] conversion failed\n " + e.m_message);
+ throw BridgeRuntimeError("[map_to_uno():" + OUString::unacquired( &type->pTypeName ) + "] conversion failed\n " + e.m_message);
}
catch (System::InvalidCastException^ )
{
// Ok, checked
- throw BridgeRuntimeError("[map_to_uno():" + *reinterpret_cast< OUString const * >( &type->pTypeName) +
- "] could not convert sequence element type: " + *reinterpret_cast< OUString const * >( &element_type->pTypeName ));
+ throw BridgeRuntimeError("[map_to_uno():" + OUString::unacquired( &type->pTypeName) +
+ "] could not convert sequence element type: " + OUString::unacquired( &element_type->pTypeName ));
}
catch (...)
{
@@ -1401,7 +1401,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
default:
{
//ToDo check
- throw BridgeRuntimeError("[map_to_uno():" + *reinterpret_cast< OUString const * >( &type->pTypeName ) + "] unsupported type!");
+ throw BridgeRuntimeError("[map_to_uno():" + OUString::unacquired( &type->pTypeName ) + "] unsupported type!");
}
}
}
@@ -1409,7 +1409,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data,
catch (System::InvalidCastException^ )
{
//ToDo check
- throw BridgeRuntimeError("[map_to_uno():" + *reinterpret_cast< OUString const * >( &type->pTypeName ) + "] could not convert type!");
+ throw BridgeRuntimeError("[map_to_uno():" + OUString::unacquired( &type->pTypeName ) + "] could not convert type!");
}
catch (System::NullReferenceException ^ e)
{
@@ -1892,8 +1892,8 @@ void Bridge::map_to_cli(
}
default:
{
- throw BridgeRuntimeError("[map_to_cli():" + *reinterpret_cast< OUString const * >( &type->pTypeName ) +
- "] unsupported element type: " + *reinterpret_cast< OUString const * >( &element_type->pTypeName ));
+ throw BridgeRuntimeError("[map_to_cli():" + OUString::unacquired( &type->pTypeName ) +
+ "] unsupported element type: " + OUString::unacquired( &element_type->pTypeName ));
}
}
break;
@@ -1914,7 +1914,7 @@ void Bridge::map_to_cli(
default:
{
//ToDo check this exception. The String is probably crippled
- throw BridgeRuntimeError("[map_to_cli():" + *reinterpret_cast< OUString const * >( &type->pTypeName ) + "] unsupported type!");
+ throw BridgeRuntimeError("[map_to_cli():" + OUString::unacquired( &type->pTypeName ) + "] unsupported type!");
}
} //switch
} // method
diff --git a/cli_ure/source/uno_bridge/cli_proxy.cxx b/cli_ure/source/uno_bridge/cli_proxy.cxx
index 90add1df52b1..85489b3a1f2c 100644
--- a/cli_ure/source/uno_bridge/cli_proxy.cxx
+++ b/cli_ure/source/uno_bridge/cli_proxy.cxx
@@ -79,7 +79,7 @@ UnoInterfaceInfo::UnoInterfaceInfo(Bridge const * bridge, uno_Interface* unoI,
sal_Bool bComplete = ::typelib_typedescription_complete( & _pt);
if( ! bComplete)
{
- throw BridgeRuntimeError("cannot make type complete: " + *reinterpret_cast< OUString const * >(& m_typeDesc->aBase.pTypeName));
+ throw BridgeRuntimeError("cannot make type complete: " + OUString::unacquired(& m_typeDesc->aBase.pTypeName));
}
}
}
@@ -542,7 +542,7 @@ srrm::IMessage^ UnoInterfaceProxy::Invoke(srrm::IMessage^ callmsg)
// ToDo check if the message of the exception is not crippled
// the thing that should not be... no method info found!
throw BridgeRuntimeError("[cli_uno bridge]calling undeclared function on interface " +
- *reinterpret_cast< OUString const * >(& ((typelib_TypeDescription *)info->m_typeDesc)->pTypeName) +
+ OUString::unacquired(& ((typelib_TypeDescription *)info->m_typeDesc)->pTypeName) +
": " + usMethodName);
}
catch (BridgeRuntimeError & err)