diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2013-02-19 16:03:51 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2013-02-22 07:53:55 +0000 |
commit | 7ca8407b403bf97a472ce2ade7e3fa1cb588cf24 (patch) | |
tree | e98c1ca669b5a2a4268c2f59d5ab822303c79d36 | |
parent | 558e956403f03c7c463597138c43ca1322b5d84b (diff) |
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>
-rw-r--r-- | basic/source/runtime/step0.cxx | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx index 2388722acbe5..f762d57e44a7 100644 --- a/basic/source/runtime/step0.cxx +++ b/basic/source/runtime/step0.cxx @@ -401,9 +401,6 @@ inline bool checkUnoStructCopy( bool bVBA, SbxVariableRef& refVal, SbxVariableRe SbUnoStructRefObject* pUnoStructObj = PTR_CAST(SbUnoStructRefObject,(SbxObject*)xVarObj); - if ( ( !pUnoVal && !pUnoStructVal ) ) - return false; - OUString sClassName = pUnoVal ? pUnoVal->GetClassName() : pUnoStructVal->GetClassName(); OUString sName = pUnoVal ? pUnoVal->GetName() : pUnoStructVal->GetName(); @@ -965,19 +962,18 @@ void SbiRuntime::StepREDIMP() short nDimsNew = pNewArray->GetDims(); short nDimsOld = pOldArray->GetDims(); 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 ) { - bRangeError = true; + StarBASIC::Error( SbERR_OUT_OF_RANGE ); } 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 for( short i = 1 ; i <= nDims ; i++ ) { @@ -991,24 +987,16 @@ void SbiRuntime::StepREDIMP() pActualIndices[j] = pLowerBounds[j] = lBoundNew; pUpperBounds[j] = uBoundNew; } - } - - if( bRangeError ) - { - StarBASIC::Error( SbERR_OUT_OF_RANGE ); - } - else - { // 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 // SbyArray but this solution is clearer and easier) implCopyDimArray( pNewArray, pOldArray, nDims - 1, 0, pActualIndices, pLowerBounds, pUpperBounds ); + delete[] pUpperBounds; + delete[] pLowerBounds; + delete[] pActualIndices; } - delete[] pUpperBounds; - delete[] pLowerBounds; - delete[] pActualIndices; refRedimpArray = NULL; } } |