basic/source/runtime/methods1.cxx |   42 +++++++++++++-------------------------
 1 file changed, 15 insertions(+), 27 deletions(-)

New commits:
commit bb89fe7ab67c1476b6cf250f236bd5b643a77c6e
Author:     AmandaQuaresmaCoutinho <quaresmaaman...@gmail.com>
AuthorDate: Mon Apr 1 02:22:52 2024 +0200
Commit:     Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
CommitDate: Mon Apr 8 19:29:34 2024 +0200

    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.lauhakan...@libreoffice.org>
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>

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));
 }
 
 

Reply via email to