diff options
author | Radhey Parekh <radhey.parekh@gmail.com> | 2022-08-29 20:05:00 +0530 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2023-01-20 16:56:26 +0000 |
commit | d0700f45c510385a95a181f646d6bb99d085fcaa (patch) | |
tree | 5a9856507bcefcb3273c2236be41aa6ab39eb94c /basic/source/runtime/methods.cxx | |
parent | f14640a60344452d31edfe246aaad73f91116e57 (diff) |
tdf#147132 Flatten Basic function implementations
Change-Id: Icd7610a3b7415838f632579deb2cd2cc505b44a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139001
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'basic/source/runtime/methods.cxx')
-rw-r--r-- | basic/source/runtime/methods.cxx | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 9cc839a1e154..975495fa41cf 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -975,51 +975,43 @@ void SbRtl_InStrRev(StarBASIC *, SbxArray & rPar, bool) void SbRtl_Int(StarBASIC *, SbxArray & rPar, bool) { if (rPar.Count() < 2) - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); - else - { - SbxVariableRef pArg = rPar.Get(1); - double aDouble= pArg->GetDouble(); - /* - floor( 2.8 ) = 2.0 - floor( -2.8 ) = -3.0 - */ - aDouble = floor( aDouble ); - rPar.Get(0)->PutDouble(aDouble); - } + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + + SbxVariableRef pArg = rPar.Get(1); + double aDouble= pArg->GetDouble(); + /* + floor( 2.8 ) = 2.0 + floor( -2.8 ) = -3.0 + */ + aDouble = floor( aDouble ); + rPar.Get(0)->PutDouble(aDouble); } void SbRtl_Fix(StarBASIC *, SbxArray & rPar, bool) { if (rPar.Count() < 2) - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + + SbxVariableRef pArg = rPar.Get(1); + double aDouble = pArg->GetDouble(); + if ( aDouble >= 0.0 ) + aDouble = floor( aDouble ); else - { - SbxVariableRef pArg = rPar.Get(1); - double aDouble = pArg->GetDouble(); - if ( aDouble >= 0.0 ) - aDouble = floor( aDouble ); - else - aDouble = ceil( aDouble ); - rPar.Get(0)->PutDouble(aDouble); - } + aDouble = ceil( aDouble ); + rPar.Get(0)->PutDouble(aDouble); } void SbRtl_LCase(StarBASIC *, SbxArray & rPar, bool) { if (rPar.Count() < 2) - { - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); - } - else - { - const CharClass& rCharClass = GetCharClass(); - OUString aStr(rPar.Get(1)->GetOUString()); - aStr = rCharClass.lowercase(aStr); - rPar.Get(0)->PutString(aStr); - } + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + + const CharClass& rCharClass = GetCharClass(); + OUString aStr(rPar.Get(1)->GetOUString()); + aStr = rCharClass.lowercase(aStr); + rPar.Get(0)->PutString(aStr); } void SbRtl_Left(StarBASIC *, SbxArray & rPar, bool) |