From 7d41b30eb43a02da5e1c2b0262e73b5b32c31462 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 20 Nov 2015 22:56:37 +0100 Subject: -Werror,-Wint-to-pointer-cast Change-Id: I27098dec221b5019aaef927cf9567910621fdd3d --- extensions/source/ole/unoconversionutilities.hxx | 48 ++++++++++-------------- 1 file changed, 20 insertions(+), 28 deletions(-) (limited to 'extensions/source/ole/unoconversionutilities.hxx') 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 AdapterToWrapperMap; -extern std::unordered_map WrapperToAdapterMap; -typedef std::unordered_map::iterator IT_Wrap; -typedef std::unordered_map::iterator CIT_Wrap; +extern std::unordered_map AdapterToWrapperMap; +extern std::unordered_map WrapperToAdapterMap; +typedef std::unordered_map::iterator IT_Wrap; +typedef std::unordered_map::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 > ComPtrToWrapperMap; -typedef std::unordered_map >::iterator IT_Com; -typedef std::unordered_map >::const_iterator CIT_Com; +extern std::unordered_map > ComPtrToWrapperMap; +typedef std::unordered_map >::iterator IT_Com; +typedef std::unordered_map >::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 >::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 > UnoObjToWrapperMap; -typedef std::unordered_map >::iterator IT_Uno; -typedef std::unordered_map >::const_iterator CIT_Uno; +extern std::unordered_map > UnoObjToWrapperMap; +typedef std::unordered_map >::iterator IT_Uno; +typedef std::unordered_map >::const_iterator CIT_Uno; #ifdef __MINGW32__ inline void reduceRange( Any& any); #endif @@ -1375,7 +1375,7 @@ void UnoConversionUtilities::createUnoObjectWrapper(const Any & rObj, VARIANT Reference 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::createUnoObjectWrapper(const Any & rObj, VARIANT else { Reference xIntComWrapper = xInt; - typedef std::unordered_map::iterator _IT; + typedef std::unordered_map::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(it->second); @@ -1445,7 +1445,7 @@ void UnoConversionUtilities::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::createOleObjectWrapper(VARIANT* pVar, const Type& // wrap ordinary dispatch objects. The dispatch-UNO objects usually are adapted to represent // particular UNO interfaces. Reference xIntWrapper; - CIT_Com cit_currWrapper= ComPtrToWrapperMap.find( reinterpret_cast(spUnknown.p)); + CIT_Com cit_currWrapper= ComPtrToWrapperMap.find( reinterpret_cast(spUnknown.p)); if(cit_currWrapper != ComPtrToWrapperMap.end()) xIntWrapper = cit_currWrapper->second; if (xIntWrapper.is()) @@ -1762,7 +1762,7 @@ Any UnoConversionUtilities::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::createOleObjectWrapper(VARIANT* pVar, const Type& OSL_ASSERT( xInit.is()); Any params[3]; -#ifdef __MINGW32__ - params[0] <<= reinterpret_cast( spUnknown.p ); -#else params[0] <<= reinterpret_cast(spUnknown.p); -#endif sal_Bool bDisp = pVar->vt == VT_DISPATCH ? sal_True : sal_False; params[1].setValue( & bDisp, cppu::UnoType::get()); params[2] <<= seqTypes; xInit->initialize( Sequence( params, 3)); -#ifdef __MINGW32__ - ComPtrToWrapperMap[reinterpret_cast( spUnknown.p )]= xIntNewProxy; -#else - ComPtrToWrapperMap[reinterpret_cast(spUnknown.p)]= xIntNewProxy; -#endif + ComPtrToWrapperMap[reinterpret_cast(spUnknown.p)] = xIntNewProxy; // we have a wrapper object //The wrapper implements already XInvocation and XInterface. If @@ -1876,9 +1868,9 @@ Reference UnoConversionUtilities::createAdapter(const Sequence::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::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 { -- cgit