diff options
author | AmandaQuaresmaCoutinho <quaresmaamanda4@gmail.com> | 2024-04-01 02:22:52 +0200 |
---|---|---|
committer | Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> | 2024-04-08 19:29:34 +0200 |
commit | bb89fe7ab67c1476b6cf250f236bd5b643a77c6e (patch) | |
tree | bd6822bdaf2126eb97748d6655e5e2733ae396e8 /basic | |
parent | ef802f7dbeee84262b56ab72079cd1c3a40784e0 (diff) |
tdf#147132 Flatten Basic function implementations
Change-Id: Ife7a94cdfa8b31ba2a2bcbdf28c9620bbc5348ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165641
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/runtime/methods1.cxx | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index b4f7dfb5fd9a..57d95b93a526 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -279,15 +279,11 @@ void SbRtl_CDec(StarBASIC *, SbxArray & rPar, bool) void SbRtl_CDate(StarBASIC *, SbxArray & rPar, bool) // JSM { double nVal = 0.0; - if (rPar.Count() == 2) - { - SbxVariable* pSbxVariable = rPar.Get(1); - nVal = pSbxVariable->GetDate(); - } - else - { - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); - } + if (rPar.Count() != 2) + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + + SbxVariable* pSbxVariable = rPar.Get(1); + nVal = pSbxVariable->GetDate(); rPar.Get(0)->PutDate(nVal); } @@ -323,15 +319,11 @@ void SbRtl_CDbl(StarBASIC *, SbxArray & rPar, bool) // JSM void SbRtl_CInt(StarBASIC *, SbxArray & rPar, bool) // JSM { sal_Int16 nVal = 0; - if (rPar.Count() == 2) - { - SbxVariable* pSbxVariable = rPar.Get(1); - nVal = pSbxVariable->GetInteger(); - } - else - { - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); - } + if (rPar.Count() != 2) + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + + SbxVariable* pSbxVariable = rPar.Get(1); + nVal = pSbxVariable->GetInteger(); rPar.Get(0)->PutInteger(nVal); } @@ -478,15 +470,11 @@ void SbRtl_Green(StarBASIC *, SbxArray & rPar, bool) void SbRtl_Blue(StarBASIC *, SbxArray & rPar, bool) { if (rPar.Count() != 2) - { - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); - } - else - { - sal_Int32 nRGB = rPar.Get(1)->GetLong(); - nRGB &= 0x000000FF; - rPar.Get(0)->PutInteger(static_cast<sal_Int16>(nRGB)); - } + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + + sal_Int32 nRGB = rPar.Get(1)->GetLong(); + nRGB &= 0x000000FF; + rPar.Get(0)->PutInteger(static_cast<sal_Int16>(nRGB)); } |