[Libreoffice-commits] core.git: basic/source

Norbert Thiebaud nthiebaud at gmail.com
Thu Feb 21 23:54:15 PST 2013


 basic/source/runtime/step0.cxx |   30 +++++++++---------------------
 1 file changed, 9 insertions(+), 21 deletions(-)

New commits:
commit 7ca8407b403bf97a472ce2ade7e3fa1cb588cf24
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Tue Feb 19 16:03:51 2013 -0600

    coverity#707499 coverity#735400 coverity#738541
    
    Change-Id: Idc00fe9ad5158043cf2eee652567581111c89177
    Reviewed-on: https://gerrit.libreoffice.org/2277
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 2388722..f762d57 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;
         }
     }


More information about the Libreoffice-commits mailing list