basic/source/runtime/methods.cxx |   56 ++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 32 deletions(-)

New commits:
commit d0700f45c510385a95a181f646d6bb99d085fcaa
Author:     Radhey Parekh <radhey.par...@gmail.com>
AuthorDate: Mon Aug 29 20:05:00 2022 +0530
Commit:     Hossein <hoss...@libreoffice.org>
CommitDate: Fri Jan 20 16:56:26 2023 +0000

    tdf#147132 Flatten Basic function implementations
    
    Change-Id: Icd7610a3b7415838f632579deb2cd2cc505b44a8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139001
    Tested-by: Jenkins
    Reviewed-by: Hossein <hoss...@libreoffice.org>

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)

Reply via email to