summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorRoman Kuznetsov <antilibreoffice@gmail.com>2022-06-03 09:11:28 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2022-06-03 10:17:02 +0200
commit66fe1fa945a161b2f617ab3576ddef23d84148f8 (patch)
tree7842f399f64ee8a5061ad2ba90c602a15b5ba554 /basic
parenta658129012f1d183f95f8bf5dd6d7ff6926cd495 (diff)
tdf#147132 Flatten Basic function
Change-Id: Ib2646bfbebdfb6d8e8a3cd1355db75b0405ccfe6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135268 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/runtime/methods.cxx49
1 files changed, 24 insertions, 25 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 122e87947ee0..c6d12c3c033f 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -733,41 +733,40 @@ void SbRtl_FileLen(StarBASIC *, SbxArray & rPar, bool)
{
if (rPar.Count() < 2)
{
- StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+ return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
}
- else
+
+ SbxVariableRef pArg = rPar.Get(1);
+ OUString aStr( pArg->GetOUString() );
+ sal_Int32 nLen = 0;
+ if( hasUno() )
{
- SbxVariableRef pArg = rPar.Get(1);
- OUString aStr( pArg->GetOUString() );
- sal_Int32 nLen = 0;
- if( hasUno() )
+ const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
+ if( xSFI.is() )
{
- const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
- if( xSFI.is() )
+ try
{
- try
- {
- nLen = xSFI->getSize( getFullPath( aStr ) );
- }
- catch(const Exception & )
- {
- StarBASIC::Error( ERRCODE_IO_GENERAL );
- }
+ nLen = xSFI->getSize( getFullPath( aStr ) );
+ }
+ catch(const Exception & )
+ {
+ StarBASIC::Error( ERRCODE_IO_GENERAL );
}
}
- else
- {
- DirectoryItem aItem;
- (void)DirectoryItem::get( getFullPath( aStr ), aItem );
- FileStatus aFileStatus( osl_FileStatus_Mask_FileSize );
- (void)aItem.getFileStatus( aFileStatus );
- nLen = static_cast<sal_Int32>(aFileStatus.getFileSize());
- }
- rPar.Get(0)->PutLong(nLen);
}
+ else
+ {
+ DirectoryItem aItem;
+ (void)DirectoryItem::get( getFullPath( aStr ), aItem );
+ FileStatus aFileStatus( osl_FileStatus_Mask_FileSize );
+ (void)aItem.getFileStatus( aFileStatus );
+ nLen = static_cast<sal_Int32>(aFileStatus.getFileSize());
+ }
+ rPar.Get(0)->PutLong(nLen);
}
+
void SbRtl_Hex(StarBASIC *, SbxArray & rPar, bool)
{
if (rPar.Count() < 2)