diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 09:37:07 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-30 08:02:23 +0200 |
commit | 9265b53978e1ed5a61db9941b5661b88d0efd31b (patch) | |
tree | 1915de28c381bddc457e23b984be4dbc8bd2bf9e /extensions/source/ole | |
parent | 04a2e941cf976894bb69e4d2e1d946a5e513225b (diff) |
Prepare for removal of non-const operator[] from Sequence in extensions
Change-Id: Id57b187aaa669d4b9a35ab726a6df1a9b4823f1d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124364
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'extensions/source/ole')
-rw-r--r-- | extensions/source/ole/oleobjw.cxx | 14 | ||||
-rw-r--r-- | extensions/source/ole/unoconversionutilities.hxx | 5 | ||||
-rw-r--r-- | extensions/source/ole/unoobjw.cxx | 9 |
3 files changed, 17 insertions, 11 deletions
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index ba33772c171a..85f410c54604 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -1018,7 +1018,9 @@ Any IUnknownWrapper::invokeWithDispIdUnoTlb(const OUString& sFunctionName, if( outParameterCount && pMethod) { OutParamIndex.realloc( outParameterCount); + auto pOutParamIndex = OutParamIndex.getArray(); OutParam.realloc( outParameterCount); + auto pOutParam = OutParam.getArray(); sal_Int32 outIndex=0; int i = 0; try @@ -1027,13 +1029,13 @@ Any IUnknownWrapper::invokeWithDispIdUnoTlb(const OUString& sFunctionName, { if( pMethod->pParams[i].bOut ) { - OutParamIndex[outIndex]= static_cast<sal_Int16>(i); + pOutParamIndex[outIndex]= static_cast<sal_Int16>(i); Any outAny; if( !bJScriptObject) { variantToAny( &pVarParamsRef[outIndex], outAny, Type(pMethod->pParams[i].pTypeRef), false); - OutParam[outIndex++]= outAny; + pOutParam[outIndex++]= outAny; } else //JScriptObject { @@ -1047,7 +1049,7 @@ Any IUnknownWrapper::invokeWithDispIdUnoTlb(const OUString& sFunctionName, { variantToAny( &varOut, outAny, Type(pMethod->pParams[parameterCount - 1 - i].pTypeRef), false); - OutParam[outParameterCount - 1 - outIndex++]= outAny; + pOutParam[outParameterCount - 1 - outIndex++]= outAny; } else bConvRet= false; @@ -1985,6 +1987,8 @@ Any IUnknownWrapper::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, // Convert out params if (outParamsCount) { + auto pOutParamIndex = OutParamIndex.getArray(); + auto pOutParam = OutParam.getArray(); int outParamIndex=0; for (int paramIndex = 0; paramIndex < nUnoArgs; paramIndex ++) { @@ -2021,8 +2025,8 @@ Any IUnknownWrapper::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, e.ArgumentIndex = paramIndex; throw; } - OutParam[outParamIndex] = outAny; - OutParamIndex[outParamIndex] = ::sal::static_int_cast< sal_Int16, int >( paramIndex ); + pOutParam[outParamIndex] = outAny; + pOutParamIndex[outParamIndex] = ::sal::static_int_cast< sal_Int16, int >( paramIndex ); outParamIndex++; } OutParam.realloc(outParamIndex); diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index 338d85b622da..6cf3dc961731 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -1280,7 +1280,7 @@ void UnoConversionUtilities<T>::getElementCountAndTypeOfSequence( const Any& rS { sal_Int32 dimCount= (*static_cast<uno_Sequence* const *>(rSeq.getValue()))->nElements; if( dimCount > seqElementCounts[ dim-1]) - seqElementCounts[ dim-1]= dimCount; + seqElementCounts.getArray()[ dim-1]= dimCount; // we need the element type to construct the any that is // passed into getElementCountAndTypeOfSequence again @@ -2331,11 +2331,12 @@ Sequence<Type> UnoConversionUtilities<T>::getImplementedInterfaces(IUnknown* pUn if( anyNames >>= seqAny) { seqTypes.realloc( seqAny.getLength()); + auto pseqTypes = seqTypes.getArray(); for( sal_Int32 i=0; i < seqAny.getLength(); i++) { OUString typeName; seqAny[i] >>= typeName; - seqTypes[i]= Type( TypeClass_INTERFACE, typeName); + pseqTypes[i]= Type( TypeClass_INTERFACE, typeName); } } } diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 81fbae1a0aca..034d7cec62a1 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -2326,6 +2326,7 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments ) aMethods.getLength() > 0); int nMemId = 1; + auto ArgumentsRange = asNonConstRange(Arguments); // Skip the three XInterface methods for (int i = 3; i < aMethods.getLength(); i++) { @@ -2419,21 +2420,21 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments ) case VT_BYREF|VT_I2: { SHORT *pI = static_cast<SHORT*>(aDispParams.rgvarg[j].byref); - Arguments[nIncomingArgIndex] <<= static_cast<sal_Int16>(*pI); + ArgumentsRange[nIncomingArgIndex] <<= static_cast<sal_Int16>(*pI); delete pI; } break; case VT_BYREF|VT_I4: { LONG *pL = static_cast<LONG*>(aDispParams.rgvarg[j].byref); - Arguments[nIncomingArgIndex] <<= static_cast<sal_Int32>(*pL); + ArgumentsRange[nIncomingArgIndex] <<= static_cast<sal_Int32>(*pL); delete pL; } break; case VT_BYREF|VT_BSTR: { BSTR *pBstr = static_cast<BSTR*>(aDispParams.rgvarg[j].byref); - Arguments[nIncomingArgIndex] <<= OUString(o3tl::toU(*pBstr)); + ArgumentsRange[nIncomingArgIndex] <<= OUString(o3tl::toU(*pBstr)); // Undo SysAllocString() done in anyToVariant() SysFreeString(*pBstr); delete pBstr; @@ -2443,7 +2444,7 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments ) { VARIANT_BOOL *pBool = static_cast<VARIANT_BOOL*>(aDispParams.rgvarg[j].byref); // SAL_ DEBUG("===> VT_BOOL: byref is now " << aDispParams.rgvarg[j].byref << ", " << (int)*pBool); - Arguments[nIncomingArgIndex] <<= (*pBool != VARIANT_FALSE); + ArgumentsRange[nIncomingArgIndex] <<= (*pBool != VARIANT_FALSE); delete pBool; } break; |