coverity#707499 coverity#735400 coverity#738541
Change-Id: Idc00fe9ad5158043cf2eee652567581111c89177 Reviewed-on: https://gerrit.libreoffice.org/2277 Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
This commit is contained in:
@@ -401,9 +401,6 @@ inline bool checkUnoStructCopy( bool bVBA, SbxVariableRef& refVal, SbxVariableRe
|
|||||||
|
|
||||||
SbUnoStructRefObject* pUnoStructObj = PTR_CAST(SbUnoStructRefObject,(SbxObject*)xVarObj);
|
SbUnoStructRefObject* pUnoStructObj = PTR_CAST(SbUnoStructRefObject,(SbxObject*)xVarObj);
|
||||||
|
|
||||||
if ( ( !pUnoVal && !pUnoStructVal ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
OUString sClassName = pUnoVal ? pUnoVal->GetClassName() : pUnoStructVal->GetClassName();
|
OUString sClassName = pUnoVal ? pUnoVal->GetClassName() : pUnoStructVal->GetClassName();
|
||||||
OUString sName = pUnoVal ? pUnoVal->GetName() : pUnoStructVal->GetName();
|
OUString sName = pUnoVal ? pUnoVal->GetName() : pUnoStructVal->GetName();
|
||||||
|
|
||||||
@@ -965,19 +962,18 @@ void SbiRuntime::StepREDIMP()
|
|||||||
short nDimsNew = pNewArray->GetDims();
|
short nDimsNew = pNewArray->GetDims();
|
||||||
short nDimsOld = pOldArray->GetDims();
|
short nDimsOld = pOldArray->GetDims();
|
||||||
short nDims = nDimsNew;
|
short nDims = nDimsNew;
|
||||||
bool bRangeError = false;
|
|
||||||
|
|
||||||
// Store dims to use them for copying later
|
|
||||||
sal_Int32* pLowerBounds = new sal_Int32[nDims];
|
|
||||||
sal_Int32* pUpperBounds = new sal_Int32[nDims];
|
|
||||||
sal_Int32* pActualIndices = new sal_Int32[nDims];
|
|
||||||
|
|
||||||
if( nDimsOld != nDimsNew )
|
if( nDimsOld != nDimsNew )
|
||||||
{
|
{
|
||||||
bRangeError = true;
|
StarBASIC::Error( SbERR_OUT_OF_RANGE );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Store dims to use them for copying later
|
||||||
|
sal_Int32* pLowerBounds = new sal_Int32[nDims];
|
||||||
|
sal_Int32* pUpperBounds = new sal_Int32[nDims];
|
||||||
|
sal_Int32* pActualIndices = new sal_Int32[nDims];
|
||||||
|
|
||||||
// Compare bounds
|
// Compare bounds
|
||||||
for( short i = 1 ; i <= nDims ; i++ )
|
for( short i = 1 ; i <= nDims ; i++ )
|
||||||
{
|
{
|
||||||
@@ -991,24 +987,16 @@ void SbiRuntime::StepREDIMP()
|
|||||||
pActualIndices[j] = pLowerBounds[j] = lBoundNew;
|
pActualIndices[j] = pLowerBounds[j] = lBoundNew;
|
||||||
pUpperBounds[j] = uBoundNew;
|
pUpperBounds[j] = uBoundNew;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( bRangeError )
|
|
||||||
{
|
|
||||||
StarBASIC::Error( SbERR_OUT_OF_RANGE );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Copy data from old array by going recursively through all dimensions
|
// Copy data from old array by going recursively through all dimensions
|
||||||
// (It would be faster to work on the flat internal data array of an
|
// (It would be faster to work on the flat internal data array of an
|
||||||
// SbyArray but this solution is clearer and easier)
|
// SbyArray but this solution is clearer and easier)
|
||||||
implCopyDimArray( pNewArray, pOldArray, nDims - 1,
|
implCopyDimArray( pNewArray, pOldArray, nDims - 1,
|
||||||
0, pActualIndices, pLowerBounds, pUpperBounds );
|
0, pActualIndices, pLowerBounds, pUpperBounds );
|
||||||
|
delete[] pUpperBounds;
|
||||||
|
delete[] pLowerBounds;
|
||||||
|
delete[] pActualIndices;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] pUpperBounds;
|
|
||||||
delete[] pLowerBounds;
|
|
||||||
delete[] pActualIndices;
|
|
||||||
refRedimpArray = NULL;
|
refRedimpArray = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user