From 54b3494de710e3732283879bc91b5dd300e93f3d Mon Sep 17 00:00:00 2001 From: ApurvR20 Date: Sun, 19 Jul 2026 16:17:36 +0530 Subject: [PATCH] tdf#147132 : Flatten Basic function implementations Flatten implementation of SbRtl_Weekday in basic/source/runtime/methods1.cxx. Change-Id: I17931cfecc24be9c114daa9c6c221e6c00a4e3aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208256 Tested-by: Jenkins Reviewed-by: Neil Roberts --- basic/source/runtime/methods1.cxx | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 4c37e964de73..90bdc513e3eb 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -1621,22 +1621,18 @@ void SbRtl_Weekday(StarBASIC *, SbxArray & rPar, bool) sal_uInt32 nParCount = rPar.Count(); if ( nParCount < 2 || nParCount > 3 ) { - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); } - else + double aDate = rPar.Get(1)->GetDate(); + bool bFirstDay = false; + sal_Int16 nFirstDay = 0; + if ( nParCount > 2 ) { - double aDate = rPar.Get(1)->GetDate(); - - bool bFirstDay = false; - sal_Int16 nFirstDay = 0; - if ( nParCount > 2 ) - { - nFirstDay = rPar.Get(2)->GetInteger(); - bFirstDay = true; - } - sal_Int16 nDay = implGetWeekDay( aDate, bFirstDay, nFirstDay ); - rPar.Get(0)->PutInteger(nDay); + nFirstDay = rPar.Get(2)->GetInteger(); + bFirstDay = true; } + sal_Int16 nDay = implGetWeekDay( aDate, bFirstDay, nFirstDay ); + rPar.Get(0)->PutInteger(nDay); } namespace {