From 6dbae37b8d2d2d1ecad85c772fd684803b5a52cb Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 28 Aug 2018 11:15:47 +0200 Subject: loplugin:constantparam (1) Change-Id: I25077e391ecca1b678062d261a83d88daadf0a58 Reviewed-on: https://gerrit.libreoffice.org/59701 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cppu/source/uno/sequence.cxx | 78 ++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'cppu') diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx index 3420e5c8ec27..513ae613c93a 100644 --- a/cppu/source/uno/sequence.cxx +++ b/cppu/source/uno/sequence.cxx @@ -313,7 +313,7 @@ static inline bool idefaultConstructElements( static inline bool icopyConstructFromElements( uno_Sequence ** ppSeq, void * pSourceElements, typelib_TypeDescriptionReference * pElementType, - sal_Int32 nStartIndex, sal_Int32 nStopIndex, + sal_Int32 nStopIndex, uno_AcquireFunc acquire, sal_Int32 nAlloc ) { @@ -325,9 +325,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Unicode) * nStartIndex), - static_cast(pSourceElements) + (sizeof(sal_Unicode) * nStartIndex), - sizeof(sal_Unicode) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Unicode) * nStopIndex ); } break; case typelib_TypeClass_BOOLEAN: @@ -335,9 +335,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Bool) * nStartIndex), - static_cast(pSourceElements) + (sizeof(sal_Bool) * nStartIndex), - sizeof(sal_Bool) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Bool) * nStopIndex ); } break; case typelib_TypeClass_BYTE: @@ -345,9 +345,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Int8) * nStartIndex), - static_cast(pSourceElements) + (sizeof(sal_Int8) * nStartIndex), - sizeof(sal_Int8) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Int8) * nStopIndex ); } break; case typelib_TypeClass_SHORT: @@ -356,9 +356,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Int16) * nStartIndex), - static_cast(pSourceElements) + (sizeof(sal_Int16) * nStartIndex), - sizeof(sal_Int16) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Int16) * nStopIndex ); } break; case typelib_TypeClass_LONG: @@ -367,9 +367,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Int32) * nStartIndex), - static_cast(pSourceElements) + (sizeof(sal_Int32) * nStartIndex), - sizeof(sal_Int32) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Int32) * nStopIndex ); } break; case typelib_TypeClass_HYPER: @@ -378,9 +378,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Int64) * nStartIndex), - static_cast(pSourceElements) + (sizeof(sal_Int64) * nStartIndex), - sizeof(sal_Int64) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Int64) * nStopIndex ); } break; case typelib_TypeClass_FLOAT: @@ -388,9 +388,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(float) * nStartIndex), - static_cast(pSourceElements) + (sizeof(float) * nStartIndex), - sizeof(float) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(float) * nStopIndex ); } break; case typelib_TypeClass_DOUBLE: @@ -398,9 +398,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(double) * nStartIndex), - static_cast(pSourceElements) + (sizeof(double) * nStartIndex), - sizeof(double) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(double) * nStopIndex ); } break; case typelib_TypeClass_ENUM: @@ -408,9 +408,9 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { memcpy( - pSeq->elements + (sizeof(sal_Int32) * nStartIndex), - static_cast(pSourceElements) + (sizeof(sal_Int32) * nStartIndex), - sizeof(sal_Int32) * (nStopIndex - nStartIndex) ); + pSeq->elements, + pSourceElements, + sizeof(sal_Int32) * nStopIndex ); } break; case typelib_TypeClass_STRING: @@ -419,7 +419,7 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { rtl_uString ** pDestElements = reinterpret_cast(pSeq->elements); - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) + for ( sal_Int32 nPos = 0; nPos < nStopIndex; ++nPos ) { // This code tends to trigger coverity's overrun-buffer-arg warning // coverity[index_parm_via_loop_bound] - https://communities.coverity.com/thread/2993 @@ -438,7 +438,7 @@ static inline bool icopyConstructFromElements( { typelib_TypeDescriptionReference ** pDestElements = reinterpret_cast(pSeq->elements); - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) + for ( sal_Int32 nPos = 0; nPos < nStopIndex; ++nPos ) { TYPE_ACQUIRE( static_cast( @@ -456,7 +456,7 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { uno_Any * pDestElements = reinterpret_cast(pSeq->elements); - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) + for ( sal_Int32 nPos = 0; nPos < nStopIndex; ++nPos ) { uno_Any * pSource = static_cast(pSourceElements) + nPos; _copyConstructAny( @@ -482,7 +482,7 @@ static inline bool icopyConstructFromElements( typelib_CompoundTypeDescription * pTypeDescr = reinterpret_cast(pElementTypeDescr); - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) + for ( sal_Int32 nPos = 0; nPos < nStopIndex; ++nPos ) { char * pDest = pDestElements + (nElementSize * nPos); @@ -527,7 +527,7 @@ static inline bool icopyConstructFromElements( typelib_TypeDescriptionReference * pSeqElementType = reinterpret_cast(pElementTypeDescr)->pType; uno_Sequence ** pDestElements = reinterpret_cast(pSeq->elements); - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) + for ( sal_Int32 nPos = 0; nPos < nStopIndex; ++nPos ) { uno_Sequence * pNew = icopyConstructSequence( static_cast(pSourceElements)[nPos], @@ -547,7 +547,7 @@ static inline bool icopyConstructFromElements( if (pSeq != nullptr) { void ** pDestElements = reinterpret_cast(pSeq->elements); - for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) + for ( sal_Int32 nPos = 0; nPos < nStopIndex; ++nPos ) { _acquire( pDestElements[nPos] = static_cast(pSourceElements)[nPos], acquire ); @@ -596,7 +596,7 @@ static inline bool ireallocSequence( { ret = icopyConstructFromElements( &pNew, pSeq->elements, pElementType, - 0, nCopy, acquire, + nCopy, acquire, nSize ); // alloc to nSize } if (ret && nRest > 0) @@ -683,7 +683,7 @@ sal_Bool SAL_CALL uno_type_sequence_construct( { ret = icopyConstructFromElements( ppSequence, pElements, pElementType, - 0, len, acquire, + len, acquire, len ); // alloc to len } @@ -724,7 +724,7 @@ sal_Bool SAL_CALL uno_sequence_construct( { ret = icopyConstructFromElements( ppSequence, pElements, pElementType, - 0, len, acquire, + len, acquire, len ); // alloc to len } } @@ -800,7 +800,7 @@ sal_Bool SAL_CALL uno_type_sequence_reference2One( ret = icopyConstructFromElements( &pNew, pSequence->elements, reinterpret_cast(pTypeDescr)->pType, - 0, pSequence->nElements, acquire, + pSequence->nElements, acquire, pSequence->nElements ); // alloc nElements if (ret) { @@ -844,7 +844,7 @@ sal_Bool SAL_CALL uno_sequence_reference2One( ret = icopyConstructFromElements( &pNew, pSequence->elements, reinterpret_cast(pTypeDescr)->pType, - 0, pSequence->nElements, acquire, + pSequence->nElements, acquire, pSequence->nElements ); // alloc nElements if (ret) { -- cgit v1.2.3