diff options
author | offtkp <parisoplop@gmail.com> | 2022-04-01 21:10:20 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-04-03 12:32:27 +0200 |
commit | 6bc187b2eb6b9520c942f232b1abcb4fb29bfa04 (patch) | |
tree | f8a891c34d22089f557810a854c773c5bd793ceb /basic | |
parent | 84dfdac1f7139337e61288af0e75aef66c19b29a (diff) |
tdf#147132 Flatten Basic function implementations
Change-Id: I21b0ec23de99aaf9b4398d59a5cc56d7d386ad58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132444
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/runtime/methods.cxx | 54 |
1 files changed, 20 insertions, 34 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 897f49d3144b..2bc1fb64f07c 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -3971,56 +3971,42 @@ void SbRtl_LBound(StarBASIC *, SbxArray & rPar, bool) { const sal_uInt32 nParCount = rPar.Count(); if ( nParCount != 3 && nParCount != 2 ) - { - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); - return; - } + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + SbxBase* pParObj = rPar.Get(1)->GetObject(); SbxDimArray* pArr = dynamic_cast<SbxDimArray*>( pParObj ); - if( pArr ) - { - sal_Int32 nLower, nUpper; - short nDim = (nParCount == 3) ? static_cast<short>(rPar.Get(2)->GetInteger()) : 1; - if (!pArr->GetDim(nDim, nLower, nUpper)) - StarBASIC::Error( ERRCODE_BASIC_OUT_OF_RANGE ); - else - rPar.Get(0)->PutLong(nLower); - } - else - StarBASIC::Error( ERRCODE_BASIC_MUST_HAVE_DIMS ); + if( !pArr ) + return StarBASIC::Error( ERRCODE_BASIC_MUST_HAVE_DIMS ); + + sal_Int32 nLower, nUpper; + short nDim = (nParCount == 3) ? static_cast<short>(rPar.Get(2)->GetInteger()) : 1; + if (!pArr->GetDim(nDim, nLower, nUpper)) + return StarBASIC::Error( ERRCODE_BASIC_OUT_OF_RANGE ); + rPar.Get(0)->PutLong(nLower); } void SbRtl_UBound(StarBASIC *, SbxArray & rPar, bool) { const sal_uInt32 nParCount = rPar.Count(); if ( nParCount != 3 && nParCount != 2 ) - { - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); - return; - } + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); SbxBase* pParObj = rPar.Get(1)->GetObject(); SbxDimArray* pArr = dynamic_cast<SbxDimArray*>( pParObj ); - if( pArr ) - { - sal_Int32 nLower, nUpper; - short nDim = (nParCount == 3) ? static_cast<short>(rPar.Get(2)->GetInteger()) : 1; - if (!pArr->GetDim(nDim, nLower, nUpper)) - StarBASIC::Error( ERRCODE_BASIC_OUT_OF_RANGE ); - else - rPar.Get(0)->PutLong(nUpper); - } - else - StarBASIC::Error( ERRCODE_BASIC_MUST_HAVE_DIMS ); + if( !pArr ) + return StarBASIC::Error( ERRCODE_BASIC_MUST_HAVE_DIMS ); + + sal_Int32 nLower, nUpper; + short nDim = (nParCount == 3) ? static_cast<short>(rPar.Get(2)->GetInteger()) : 1; + if (!pArr->GetDim(nDim, nLower, nUpper)) + return StarBASIC::Error( ERRCODE_BASIC_OUT_OF_RANGE ); + rPar.Get(0)->PutLong(nUpper); } void SbRtl_RGB(StarBASIC *, SbxArray & rPar, bool) { if (rPar.Count() != 4) - { - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); - return; - } + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); sal_Int32 nRed = rPar.Get(1)->GetInteger() & 0xFF; sal_Int32 nGreen = rPar.Get(2)->GetInteger() & 0xFF; |