basic/source/runtime/methods.cxx | 73 +++++++++------------- sw/qa/extras/rtfimport/data/.~lock.tdf116269.rtf# | 1 2 files changed, 32 insertions(+), 42 deletions(-)
New commits: commit 0fbe68c63bc21e392a13e0fa8e60a3dd1e4a5a22 Author: Nam Bui <ndbu...@gmail.com> AuthorDate: Thu Apr 3 16:06:45 2025 -0400 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Apr 23 19:44:11 2025 +0200 tdf#147132 Flatten Basic function implementations Flattened SbRtl_RmDir() and SbRtl_FuncCaller() Change-Id: I28168d88209b0d72333849633a64f269735591f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183690 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 77f79291f035..5d611ee23dd7 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -648,47 +648,43 @@ static void implRemoveDirRecursive( const OUString& aDirPath ) void SbRtl_RmDir(StarBASIC *, SbxArray & rPar, bool) { rPar.Get(0)->PutEmpty(); - if (rPar.Count() == 2) + if (rPar.Count() != 2) + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + + OUString aPath = rPar.Get(1)->GetOUString(); + if( hasUno() ) { - OUString aPath = rPar.Get(1)->GetOUString(); - if( hasUno() ) + const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess(); + if( xSFI.is() ) { - const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess(); - if( xSFI.is() ) + try { - try + if( !xSFI->isFolder( aPath ) ) { - if( !xSFI->isFolder( aPath ) ) - { - return StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND ); - } - SbiInstance* pInst = GetSbData()->pInst; - bool bCompatibility = ( pInst && pInst->IsCompatibility() ); - if( bCompatibility ) - { - Sequence< OUString > aContent = xSFI->getFolderContents( aPath, true ); - if( aContent.hasElements() ) - { - return StarBASIC::Error( ERRCODE_BASIC_ACCESS_ERROR ); - } - } - - xSFI->kill( getFullPath( aPath ) ); + return StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND ); } - catch(const Exception & ) + SbiInstance* pInst = GetSbData()->pInst; + bool bCompatibility = ( pInst && pInst->IsCompatibility() ); + if( bCompatibility ) { - StarBASIC::Error( ERRCODE_IO_GENERAL ); + Sequence< OUString > aContent = xSFI->getFolderContents( aPath, true ); + if( aContent.hasElements() ) + { + return StarBASIC::Error( ERRCODE_BASIC_ACCESS_ERROR ); + } } + + xSFI->kill( getFullPath( aPath ) ); + } + catch(const Exception & ) + { + StarBASIC::Error( ERRCODE_IO_GENERAL ); } - } - else - { - implRemoveDirRecursive( getFullPath( aPath ) ); } } else { - StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + implRemoveDirRecursive( getFullPath( aPath ) ); } } @@ -764,21 +760,16 @@ void SbRtl_Hex(StarBASIC *, SbxArray & rPar, bool) void SbRtl_FuncCaller(StarBASIC *, SbxArray & rPar, bool) { - if ( SbiRuntime::isVBAEnabled() && GetSbData()->pInst && GetSbData()->pInst->pRun ) - { - if ( GetSbData()->pInst->pRun->GetExternalCaller() ) - *rPar.Get(0) = *GetSbData()->pInst->pRun->GetExternalCaller(); - else - { - SbxVariableRef pVar = new SbxVariable(SbxVARIANT); - *rPar.Get(0) = *pVar; - } - } + if (!SbiRuntime::isVBAEnabled() || GetSbData()->pInst == nullptr || GetSbData()->pInst->pRun == nullptr) + return StarBASIC::Error(ERRCODE_BASIC_NOT_IMPLEMENTED); + + if ( GetSbData()->pInst->pRun->GetExternalCaller() ) + *rPar.Get(0) = *GetSbData()->pInst->pRun->GetExternalCaller(); else { - StarBASIC::Error( ERRCODE_BASIC_NOT_IMPLEMENTED ); + SbxVariableRef pVar = new SbxVariable(SbxVARIANT); + *rPar.Get(0) = *pVar; } - } // InStr( [start],string,string,[compare] ) commit 1a55fe96641a55662be013659ab9ac734614d54c Author: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> AuthorDate: Wed Apr 23 17:14:18 2025 +0200 Commit: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> CommitDate: Wed Apr 23 19:44:05 2025 +0200 Remove lock file Accidentally merged in 5268e13d3924a62f164f5c2b018c8289fbcc1ac4 Change-Id: I1579ce72fb873545b5465a61d15966d2e2fc5bb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184516 Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> Tested-by: Jenkins diff --git a/sw/qa/extras/rtfimport/data/.~lock.tdf116269.rtf# b/sw/qa/extras/rtfimport/data/.~lock.tdf116269.rtf# deleted file mode 100755 index 59761cebfa1a..000000000000 --- a/sw/qa/extras/rtfimport/data/.~lock.tdf116269.rtf# +++ /dev/null @@ -1 +0,0 @@ -,CIB/Olivers,twisterix2,16.04.2025 16:29,file:///D:/develop/LO/old_build/core-master/instdir; \ No newline at end of file