diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-22 13:11:34 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-23 07:54:51 +0100 |
commit | 9af8f190ed1bf3f76897ad0c078db16451d6fb69 (patch) | |
tree | 015089ee72a67eca7db999845cabb8104c8ce3aa /extensions | |
parent | 9602e63c818722c3910343b7af53917d031861c8 (diff) |
More loplugin:cstylecast on Windows
Automatic rewrite (of loplugin:cstylecast and loplugin:unnecessaryparen) after
cab0427cadddb3aaf1349c66f2fa13a4234ba4b2 "Enable loplugin:cstylecast for some
more cases" and a409d32e7f6fc09e041079d6dbc3c927497adfed "More
loplugin:cstylecast"
Change-Id: Ib3355159dd08333e1b7a8d091caf2069cdcc7862
Reviewed-on: https://gerrit.libreoffice.org/48317
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/activex/SOActiveX.cxx | 6 | ||||
-rw-r--r-- | extensions/source/ole/oleobjw.cxx | 16 | ||||
-rw-r--r-- | extensions/source/ole/unoconversionutilities.hxx | 10 | ||||
-rw-r--r-- | extensions/source/ole/unoobjw.cxx | 6 | ||||
-rw-r--r-- | extensions/source/scanner/scanwin.cxx | 4 |
5 files changed, 21 insertions, 21 deletions
diff --git a/extensions/source/activex/SOActiveX.cxx b/extensions/source/activex/SOActiveX.cxx index c2e1fbb74ca4..cda7fff13df4 100644 --- a/extensions/source/activex/SOActiveX.cxx +++ b/extensions/source/activex/SOActiveX.cxx @@ -566,7 +566,7 @@ HRESULT CSOActiveX::CreateFrameOldWay( HWND hwnd, int width, int height ) if( !SUCCEEDED( hr ) ) return hr; // initialize window - CComVariant aTransparent( (long)0xFFFFFFFF ); + CComVariant aTransparent( long(0xFFFFFFFF) ); hr = ExecuteFunc( mpDispWin, L"setBackground", &aTransparent, 1, &dummyResult ); if( !SUCCEEDED( hr ) ) return hr; @@ -671,7 +671,7 @@ HRESULT CSOActiveX::CallDispatchMethod( OLECHAR const * sUrl, CComVariant aArgs[3]; aArgs[2] = CComVariant( pdispURL ); aArgs[1] = CComVariant( L"" ); - aArgs[0] = CComVariant( (int)0 ); + aArgs[0] = CComVariant( int(0) ); hr = GetIDispByFunc( mpDispFrame, L"queryDispatch", aArgs, @@ -680,7 +680,7 @@ HRESULT CSOActiveX::CallDispatchMethod( OLECHAR const * sUrl, if( !SUCCEEDED( hr ) ) return hr; SAFEARRAY FAR* pPropVals = SafeArrayCreateVector( VT_DISPATCH, 0, count ); - for( long ix = 0; ix < (long)count; ix ++ ) + for( long ix = 0; ix < static_cast<long>(count); ix ++ ) { CComPtr<IDispatch> pdispPropVal; hr = GetUnoStruct( L"com.sun.star.beans.PropertyValue", pdispPropVal ); diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index c856992fbc96..91819f0239a6 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -939,7 +939,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName, "[automation bridge]IUnknownWrapper_Impl::" "invokeWithDispIdUnoTlb\n" "Could not create out parameter at index: " + - OUString::number((sal_Int32) i)); + OUString::number(static_cast<sal_Int32>(i))); } CComPtr<IUnknown> pUnk(pParamObject->GetUnknown()); @@ -1020,7 +1020,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName, { if( pMethod->pParams[i].bOut ) { - OutParamIndex[outIndex]= (sal_Int16) i; + OutParamIndex[outIndex]= static_cast<sal_Int16>(i); Any outAny; if( !bJScriptObject) { @@ -1325,7 +1325,7 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con { throw InvocationTargetException( "[automation bridge] ITypeInfo::GetIDsOfNames returned error " - + OUString::number((sal_Int32) hr, 16), Reference<XInterface>(), Any()); + + OUString::number(static_cast<sal_Int32>(hr), 16), Reference<XInterface>(), Any()); } } @@ -1693,7 +1693,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, OUStringBuffer buf(256); buf.append("[automation bridge] There are too many arguments for this method"); throw IllegalArgumentException( buf.makeStringAndClear(), - Reference<XInterface>(), (sal_Int16) dispparams.cArgs); + Reference<XInterface>(), static_cast<sal_Int16>(dispparams.cArgs)); } //Set up the array of DISPIDs (DISPPARAMS::rgdispidNamedArgs) @@ -1775,7 +1775,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, { throw InvocationTargetException( "[automation bridge] ITypeInfo::GetIDsOfNames returned error " - + OUString::number((sal_Int32) hr, 16), Reference<XInterface>(), Any()); + + OUString::number(static_cast<sal_Int32>(hr), 16), Reference<XInterface>(), Any()); } } @@ -1786,7 +1786,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, arRefArgs = ptrRefArgs.get(); try { - for (i = 0; i < (sal_Int32) dispparams.cArgs; i++) + for (i = 0; i < static_cast<sal_Int32>(dispparams.cArgs); i++) { revIndex= dispparams.cArgs - i -1; arRefArgs[revIndex].byref=nullptr; @@ -1814,7 +1814,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, buf.append(OUString::number(i)); buf.append(" (index starting at 0)."); throw IllegalArgumentException( buf.makeStringAndClear(), - Reference<XInterface>(), (sal_Int16) i); + Reference<XInterface>(), static_cast<sal_Int16>(i)); } // Property Put arguments @@ -2008,7 +2008,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, } catch (IllegalArgumentException & e) { - e.ArgumentPosition = (sal_Int16)paramIndex; + e.ArgumentPosition = static_cast<sal_Int16>(paramIndex); throw; } catch (CannotConvertException & e) diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index 95b0e69cab79..008396ae4f96 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -554,15 +554,15 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, throw CannotConvertException( "[automation bridge]UnoConversionUtilities<T>::variantToAny \n" "Cannot convert the value of vartype :\"" + - OUString::number((sal_Int32) var.vt) + + OUString::number(static_cast<sal_Int32>(var.vt)) + "\" to the expected UNO type of type class: " + - OUString::number((sal_Int32) ptype.getTypeClass()), + OUString::number(static_cast<sal_Int32>(ptype.getTypeClass())), nullptr, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0); if (bFail) throw IllegalArgumentException( "[automation bridge]UnoConversionUtilities<T>:variantToAny\n" - "The provided VARIANT of type\" " + OUString::number((sal_Int32) var.vt) + + "The provided VARIANT of type\" " + OUString::number(static_cast<sal_Int32>(var.vt)) + "\" is unappropriate for conversion!", Reference<XInterface>(), -1); } catch (const CannotConvertException &) @@ -630,14 +630,14 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny, "Cannot convert the value of type :\"" + rAny.getValueTypeName() + "\" to the expected Automation type of VARTYPE: " + - OUString::number((sal_Int32)type), + OUString::number(static_cast<sal_Int32>(type)), nullptr, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0); throw BridgeRuntimeError( "[automation bridge]UnoConversionUtilities<T>::anyToVariant \n" "Conversion of any with " + rAny.getValueType().getTypeName() + - " to VARIANT with type: " + OUString::number((sal_Int32) type) + + " to VARIANT with type: " + OUString::number(static_cast<sal_Int32>(type)) + " failed! Error code: " + OUString::number(hr)); } diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index f3355d2acf21..4ae722cf2111 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -253,11 +253,11 @@ STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/, if (d.flags != 0) { m_MemberInfos.push_back(d); - iter = m_nameToDispIdMap.emplace(exactName, (DISPID)m_MemberInfos.size()).first; + iter = m_nameToDispIdMap.emplace(exactName, static_cast<DISPID>(m_MemberInfos.size())).first; if (exactName != name) { - iter = m_nameToDispIdMap.emplace(name, (DISPID)m_MemberInfos.size()).first; + iter = m_nameToDispIdMap.emplace(name, static_cast<DISPID>(m_MemberInfos.size())).first; } } } @@ -798,7 +798,7 @@ STDMETHODIMP InterfaceOleWrapper_Impl::Invoke(DISPID dispidMember, if( bHandled) return ret; - if ((dispidMember > 0) && ((size_t)dispidMember <= m_MemberInfos.size()) && m_xInvocation.is()) + if ((dispidMember > 0) && (static_cast<size_t>(dispidMember) <= m_MemberInfos.size()) && m_xInvocation.is()) { MemberInfo d = m_MemberInfos[dispidMember - 1]; DWORD flags = wFlags & d.flags; diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx index 02ce3425d01a..052eeebf9271 100644 --- a/extensions/source/scanner/scanwin.cxx +++ b/extensions/source/scanner/scanwin.cxx @@ -58,8 +58,8 @@ using namespace ::com::sun::star; #define PFUNC (*pDSM) #define PTWAINMSG MSG* -#define FIXTODOUBLE( nFix ) ((double)nFix.Whole+(double)nFix.Frac/65536.) -#define FIXTOLONG( nFix ) ((long)floor(FIXTODOUBLE(nFix)+0.5)) +#define FIXTODOUBLE( nFix ) (static_cast<double>(nFix.Whole)+static_cast<double>(nFix.Frac)/65536.) +#define FIXTOLONG( nFix ) (static_cast<long>(floor(FIXTODOUBLE(nFix)+0.5))) #define TWAIN_FUNCNAME "DSM_Entry" #if defined(TWH_64BIT) |