summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-20 22:56:37 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-24 08:47:01 +0100
commit7d41b30eb43a02da5e1c2b0262e73b5b32c31462 (patch)
tree24be16817c5c6d09fd1ebc9cfb867cc3b29969d2
parent6525d1663f8d03e2c28e626fadc2e3e848798224 (diff)
-Werror,-Wint-to-pointer-cast
Change-Id: I27098dec221b5019aaef927cf9567910621fdd3d
-rw-r--r--extensions/source/ole/oleobjw.cxx14
-rw-r--r--extensions/source/ole/unoconversionutilities.hxx48
-rw-r--r--extensions/source/ole/unoobjw.cxx4
3 files changed, 29 insertions, 37 deletions
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index ac431e61ff23..66742712b24d 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -78,16 +78,16 @@ namespace ole_adapter
// called.
// Before UNO object is wrapped to COM object this map is checked
// to see if the UNO object is already a wrapper.
-std::unordered_map<sal_uInt32, sal_uInt32> AdapterToWrapperMap;
+std::unordered_map<sal_uIntPtr, sal_uIntPtr> AdapterToWrapperMap;
// key: XInterface of the wrapper object.
// value: XInterface of the Interface created by the Invocation Adapter Factory.
// A COM wrapper is responsible for removing the corresponding entry
// in AdapterToWrappperMap if it is being destroyed. Because the wrapper does not
// know about its adapted interface it uses WrapperToAdapterMap to get the
// adapted interface which is then used to locate the entry in AdapterToWrapperMap.
-std::unordered_map<sal_uInt32,sal_uInt32> WrapperToAdapterMap;
+std::unordered_map<sal_uIntPtr,sal_uIntPtr> WrapperToAdapterMap;
-std::unordered_map<sal_uInt32, WeakReference<XInterface> > ComPtrToWrapperMap;
+std::unordered_map<sal_uIntPtr, WeakReference<XInterface> > ComPtrToWrapperMap;
/*****************************************************************************
class implementation IUnknownWrapper_Impl
@@ -114,17 +114,17 @@ IUnknownWrapper_Impl::~IUnknownWrapper_Impl()
#endif
// remove entries in global maps
- typedef std::unordered_map<sal_uInt32, sal_uInt32>::iterator _IT;
- _IT it= WrapperToAdapterMap.find( (sal_uInt32) xIntRoot);
+ typedef std::unordered_map<sal_uIntPtr, sal_uIntPtr>::iterator _IT;
+ _IT it= WrapperToAdapterMap.find( (sal_uIntPtr) xIntRoot);
if( it != WrapperToAdapterMap.end())
{
- sal_uInt32 adapter= it->second;
+ sal_uIntPtr adapter= it->second;
AdapterToWrapperMap.erase( adapter);
WrapperToAdapterMap.erase( it);
}
- IT_Com it_c= ComPtrToWrapperMap.find( (sal_uInt32) m_spUnknown.p);
+ IT_Com it_c= ComPtrToWrapperMap.find( (sal_uIntPtr) m_spUnknown.p);
if(it_c != ComPtrToWrapperMap.end())
ComPtrToWrapperMap.erase(it_c);
}
diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx
index 0599c1ed609d..be18ec9748f0 100644
--- a/extensions/source/ole/unoconversionutilities.hxx
+++ b/extensions/source/ole/unoconversionutilities.hxx
@@ -63,17 +63,17 @@ using namespace com::sun::star::bridge::ModelDependent;
using namespace com::sun::star::bridge::oleautomation;
namespace ole_adapter
{
-extern std::unordered_map<sal_uInt32, sal_uInt32> AdapterToWrapperMap;
-extern std::unordered_map<sal_uInt32, sal_uInt32> WrapperToAdapterMap;
-typedef std::unordered_map<sal_uInt32, sal_uInt32>::iterator IT_Wrap;
-typedef std::unordered_map<sal_uInt32, sal_uInt32>::iterator CIT_Wrap;
+extern std::unordered_map<sal_uIntPtr, sal_uIntPtr> AdapterToWrapperMap;
+extern std::unordered_map<sal_uIntPtr, sal_uIntPtr> WrapperToAdapterMap;
+typedef std::unordered_map<sal_uIntPtr, sal_uIntPtr>::iterator IT_Wrap;
+typedef std::unordered_map<sal_uIntPtr, sal_uIntPtr>::iterator CIT_Wrap;
//Maps IUnknown pointers to a weak reference of the respective wrapper class (e.g.
// IUnknownWrapperImpl. It is the responsibility of the wrapper to remove the entry when
// it is being destroyed.
// Used to ensure that an Automation object is always mapped to the same UNO objects.
-extern std::unordered_map<sal_uInt32, WeakReference<XInterface> > ComPtrToWrapperMap;
-typedef std::unordered_map<sal_uInt32, WeakReference<XInterface> >::iterator IT_Com;
-typedef std::unordered_map<sal_uInt32, WeakReference<XInterface> >::const_iterator CIT_Com;
+extern std::unordered_map<sal_uIntPtr, WeakReference<XInterface> > ComPtrToWrapperMap;
+typedef std::unordered_map<sal_uIntPtr, WeakReference<XInterface> >::iterator IT_Com;
+typedef std::unordered_map<sal_uIntPtr, WeakReference<XInterface> >::const_iterator CIT_Com;
// Maps XInterface pointers to a weak reference of its wrapper class (i.e.
// InterfaceOleWrapper_Impl). It is the responsibility of the wrapper to remove the entry when
@@ -81,9 +81,9 @@ typedef std::unordered_map<sal_uInt32, WeakReference<XInterface> >::const_iterat
// is mapped to IDispatch which is kept alive in the COM environment. If the same
// UNO interface is mapped again to COM then the IDispach of the first mapped instance
// must be returned.
-extern std::unordered_map<sal_uInt32, WeakReference<XInterface> > UnoObjToWrapperMap;
-typedef std::unordered_map<sal_uInt32, WeakReference<XInterface> >::iterator IT_Uno;
-typedef std::unordered_map<sal_uInt32, WeakReference<XInterface> >::const_iterator CIT_Uno;
+extern std::unordered_map<sal_uIntPtr, WeakReference<XInterface> > UnoObjToWrapperMap;
+typedef std::unordered_map<sal_uIntPtr, WeakReference<XInterface> >::iterator IT_Uno;
+typedef std::unordered_map<sal_uIntPtr, WeakReference<XInterface> >::const_iterator CIT_Uno;
#ifdef __MINGW32__
inline void reduceRange( Any& any);
#endif
@@ -1375,7 +1375,7 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT
Reference<XInterface> xIntWrapper;
// Does a UNO wrapper exist already ?
- IT_Uno it_uno = UnoObjToWrapperMap.find( (sal_uInt32) xInt.get());
+ IT_Uno it_uno = UnoObjToWrapperMap.find( (sal_uIntPtr) xInt.get());
if(it_uno != UnoObjToWrapperMap.end())
{
xIntWrapper = it_uno->second;
@@ -1390,9 +1390,9 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT
else
{
Reference<XInterface> xIntComWrapper = xInt;
- typedef std::unordered_map<sal_uInt32,sal_uInt32>::iterator _IT;
+ typedef std::unordered_map<sal_uIntPtr,sal_uIntPtr>::iterator _IT;
// Adapter? then get the COM wrapper to which the adapter delegates its calls
- _IT it= AdapterToWrapperMap.find( (sal_uInt32) xInt.get());
+ _IT it= AdapterToWrapperMap.find( (sal_uIntPtr) xInt.get());
if( it != AdapterToWrapperMap.end() )
xIntComWrapper= reinterpret_cast<XInterface*>(it->second);
@@ -1445,7 +1445,7 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT
// be mapped again and there is already a wrapper then the old wrapper
// will be used.
if(xInt.is()) // only interfaces
- UnoObjToWrapperMap[(sal_uInt32) xInt.get()]= xNewWrapper;
+ UnoObjToWrapperMap[(sal_uIntPtr) xInt.get()]= xNewWrapper;
convertSelfToCom(xNewWrapper, pVar);
return;
}
@@ -1753,7 +1753,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type&
// wrap ordinary dispatch objects. The dispatch-UNO objects usually are adapted to represent
// particular UNO interfaces.
Reference<XInterface> xIntWrapper;
- CIT_Com cit_currWrapper= ComPtrToWrapperMap.find( reinterpret_cast<sal_uInt32>(spUnknown.p));
+ CIT_Com cit_currWrapper= ComPtrToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(spUnknown.p));
if(cit_currWrapper != ComPtrToWrapperMap.end())
xIntWrapper = cit_currWrapper->second;
if (xIntWrapper.is())
@@ -1762,7 +1762,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type&
//find the proper Adapter. The pointer in the WrapperToAdapterMap are valid as long as
//we get a pointer to the wrapper from ComPtrToWrapperMap, because the Adapter hold references
//to the wrapper.
- CIT_Wrap it = WrapperToAdapterMap.find((sal_uInt32) xIntWrapper.get());
+ CIT_Wrap it = WrapperToAdapterMap.find((sal_uIntPtr) xIntWrapper.get());
if (it == WrapperToAdapterMap.end())
{
// No adapter available.
@@ -1823,21 +1823,13 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type&
OSL_ASSERT( xInit.is());
Any params[3];
-#ifdef __MINGW32__
- params[0] <<= reinterpret_cast<sal_uInt32>( spUnknown.p );
-#else
params[0] <<= reinterpret_cast<sal_uIntPtr>(spUnknown.p);
-#endif
sal_Bool bDisp = pVar->vt == VT_DISPATCH ? sal_True : sal_False;
params[1].setValue( & bDisp, cppu::UnoType<bool>::get());
params[2] <<= seqTypes;
xInit->initialize( Sequence<Any>( params, 3));
-#ifdef __MINGW32__
- ComPtrToWrapperMap[reinterpret_cast<sal_uInt32>( spUnknown.p )]= xIntNewProxy;
-#else
- ComPtrToWrapperMap[reinterpret_cast<sal_uInt32>(spUnknown.p)]= xIntNewProxy;
-#endif
+ ComPtrToWrapperMap[reinterpret_cast<sal_uInt64>(spUnknown.p)] = xIntNewProxy;
// we have a wrapper object
//The wrapper implements already XInvocation and XInterface. If
@@ -1876,9 +1868,9 @@ Reference<XInterface> UnoConversionUtilities<T>::createAdapter(const Sequence<Ty
// in a global map. Thus we can determine in a call to createUnoObjectWrapper whether the UNO
// object is a wrapped COM object. In that case we extract the original COM object rather than
// creating a wrapper around the UNO object.
- typedef std::unordered_map<sal_uInt32,sal_uInt32>::value_type VALUE;
- AdapterToWrapperMap.insert( VALUE( (sal_uInt32) xIntAdapted.get(), (sal_uInt32) receiver.get()));
- WrapperToAdapterMap.insert( VALUE( (sal_uInt32) receiver.get(), (sal_uInt32) xIntAdapted.get()));
+ typedef std::unordered_map<sal_uInt64,sal_uInt64>::value_type VALUE;
+ AdapterToWrapperMap.insert( VALUE( (sal_uInt64) xIntAdapted.get(), (sal_uInt64) receiver.get()));
+ WrapperToAdapterMap.insert( VALUE( (sal_uInt64) receiver.get(), (sal_uInt64) xIntAdapted.get()));
}
else
{
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 5d1c62ddc9ca..c60d7f6a8bd5 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -67,7 +67,7 @@ extern "C" const GUID IID_IDispatchEx;
namespace ole_adapter
{
-std::unordered_map<sal_uInt32, WeakReference<XInterface> > UnoObjToWrapperMap;
+std::unordered_map<sal_uIntPtr, WeakReference<XInterface> > UnoObjToWrapperMap;
static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource);
static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource);
static HRESULT mapCannotConvertException(const CannotConvertException &e, unsigned int * puArgErr);
@@ -96,7 +96,7 @@ InterfaceOleWrapper_Impl::~InterfaceOleWrapper_Impl()
{
MutexGuard guard(getBridgeMutex());
// remove entries in global map
- IT_Uno it= UnoObjToWrapperMap.find( (sal_uInt32) m_xOrigin.get());
+ IT_Uno it= UnoObjToWrapperMap.find( (sal_uIntPtr) m_xOrigin.get());
if(it != UnoObjToWrapperMap.end())
UnoObjToWrapperMap.erase(it);
}