core.git: basic/source

2024-05-05 Thread Arnaud VERSINI (via logerrit)
 basic/source/sbx/sbxres.cxx |   94 ++--
 1 file changed, 47 insertions(+), 47 deletions(-)

New commits:
commit a123c5b39a4e936121f51c4fc705f5652db3a700
Author: Arnaud VERSINI 
AuthorDate: Mon Apr 29 10:00:04 2024 +0200
Commit: Arnaud Versini 
CommitDate: Sun May 5 14:44:04 2024 +0200

basic : use more OUString literals

Change-Id: I38f57c64c0d110e892982eaed2619c0915fe93b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166825
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Arnaud Versini 

diff --git a/basic/source/sbx/sbxres.cxx b/basic/source/sbx/sbxres.cxx
index 125969e3efd9..d29383cf076c 100644
--- a/basic/source/sbx/sbxres.cxx
+++ b/basic/source/sbx/sbxres.cxx
@@ -22,59 +22,59 @@
 
 #include 
 
-static const char* pSbxRes[] = {
-"Empty",
-"Null",
-"Integer",
-"Long",
-"Single",
-"Double",
-"Currency",
-"Date",
-"String",
-"Object",
-"Error",
-"Boolean",
-"Variant",
-"Any",
-"Type14",
-"Type15",
-"Char",
-"Byte",
-"UShort",
-"ULong",
-"Long64",
-"ULong64",
-"Int",
-"UInt",
-"Void",
-"HResult",
-"Pointer",
-"DimArray",
-"CArray",
-"Any",
-"LpStr",
-"LpWStr",
-" As ",
-"Optional ",
-"Byref ",
+constexpr OUString pSbxRes[] = {
+u"Empty"_ustr,
+u"Null"_ustr,
+u"Integer"_ustr,
+u"Long"_ustr,
+u"Single"_ustr,
+u"Double"_ustr,
+u"Currency"_ustr,
+u"Date"_ustr,
+u"String"_ustr,
+u"Object"_ustr,
+u"Error"_ustr,
+u"Boolean"_ustr,
+u"Variant"_ustr,
+u"Any"_ustr,
+u"Type14"_ustr,
+u"Type15"_ustr,
+u"Char"_ustr,
+u"Byte"_ustr,
+u"UShort"_ustr,
+u"ULong"_ustr,
+u"Long64"_ustr,
+u"ULong64"_ustr,
+u"Int"_ustr,
+u"UInt"_ustr,
+u"Void"_ustr,
+u"HResult"_ustr,
+u"Pointer"_ustr,
+u"DimArray"_ustr,
+u"CArray"_ustr,
+u"Any"_ustr,
+u"LpStr"_ustr,
+u"LpWStr"_ustr,
+u" As "_ustr,
+u"Optional "_ustr,
+u"Byref "_ustr,
 
-"Name",
-"Parent",
-"Application",
-"Count",
-"Add",
-"Item",
-"Remove",
+u"Name"_ustr,
+u"Parent"_ustr,
+u"Application"_ustr,
+u"Count"_ustr,
+u"Add"_ustr,
+u"Item"_ustr,
+u"Remove"_ustr,
 
-"Error ",   // with blank!
-"False",
-"True"
+u"Error "_ustr,   // with blank!
+u"False"_ustr,
+u"True"_ustr
 };
 
 OUString GetSbxRes( StringId nId )
 {
-return OUString::createFromAscii( ( nId > StringId::LastValue ) ? "???" : 
pSbxRes[ static_cast( nId ) ] );
+return  ( nId > StringId::LastValue ) ? u"???"_ustr : pSbxRes[ 
static_cast( nId ) ];
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


core.git: basic/source

2024-05-05 Thread Arnaud VERSINI (via logerrit)
 basic/source/sbx/sbxform.cxx |   28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 7ab8d335226a74b864dc61775050b2fbddfaa18a
Author: Arnaud VERSINI 
AuthorDate: Sun May 5 09:45:16 2024 +0200
Commit: Arnaud Versini 
CommitDate: Sun May 5 13:42:05 2024 +0200

basic : use std::u16string_view and new OUString literal

Change-Id: Id3cd708b98e1b0551955562afe3ac594bdc6e50a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167153
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Arnaud Versini 

diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index 84e5f22fd8da..49d45ccc5f38 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -62,24 +62,24 @@ COMMENT: Visual-Basic treats the following (invalid) 
format-strings
 #define FORMAT_SEPARATOR';'
 
 // predefined formats for the Format$()-command:
-constexpr OUString BASICFORMAT_GENERALNUMBER = u"General Number"_ustr;
-constexpr OUString BASICFORMAT_CURRENCY = u"Currency"_ustr;
-constexpr OUString BASICFORMAT_FIXED = u"Fixed"_ustr;
-constexpr OUString BASICFORMAT_STANDARD = u"Standard"_ustr;
-constexpr OUString BASICFORMAT_PERCENT = u"Percent"_ustr;
-constexpr OUString BASICFORMAT_SCIENTIFIC = u"Scientific"_ustr;
-constexpr OUString BASICFORMAT_YESNO = u"Yes/No"_ustr;
-constexpr OUString BASICFORMAT_TRUEFALSE = u"True/False"_ustr;
-constexpr OUString BASICFORMAT_ONOFF = u"On/Off"_ustr;
+constexpr std::u16string_view BASICFORMAT_GENERALNUMBER = u"General Number";
+constexpr std::u16string_view BASICFORMAT_CURRENCY = u"Currency";
+constexpr std::u16string_view BASICFORMAT_FIXED = u"Fixed";
+constexpr std::u16string_view BASICFORMAT_STANDARD = u"Standard";
+constexpr std::u16string_view BASICFORMAT_PERCENT = u"Percent";
+constexpr std::u16string_view BASICFORMAT_SCIENTIFIC = u"Scientific";
+constexpr std::u16string_view BASICFORMAT_YESNO = u"Yes/No";
+constexpr std::u16string_view BASICFORMAT_TRUEFALSE = u"True/False";
+constexpr std::u16string_view BASICFORMAT_ONOFF = u"On/Off";
 
 // Comment: Visual-Basic has a maximum of 12 positions after the
 //  decimal point for floating-point-numbers.
 // all format-strings are compatible to Visual-Basic:
-constexpr OUStringLiteral GENERALNUMBER_FORMAT = u"0.";
-constexpr OUStringLiteral FIXED_FORMAT = u"0.00";
-constexpr OUStringLiteral STANDARD_FORMAT = u"@0.00";
-constexpr OUStringLiteral PERCENT_FORMAT = u"0.00%";
-constexpr OUStringLiteral SCIENTIFIC_FORMAT = u"#.00E+00";
+constexpr OUString GENERALNUMBER_FORMAT = u"0."_ustr;
+constexpr OUString FIXED_FORMAT = u"0.00"_ustr;
+constexpr OUString STANDARD_FORMAT = u"@0.00"_ustr;
+constexpr OUString PERCENT_FORMAT = u"0.00%"_ustr;
+constexpr OUString SCIENTIFIC_FORMAT = u"#.00E+00"_ustr;
 // Comment: the character @ means that thousand-separators shall
 //  be generated. That's a StarBasic 'extension'.
 


core.git: basic/source desktop/source forms/source include/basic svx/source

2024-05-02 Thread Caolán McNamara (via logerrit)
 basic/source/classes/sbxmod.cxx  |   12 +--
 basic/source/runtime/runtime.cxx |2 
 desktop/source/lib/init.cxx  |   27 +--
 forms/source/component/FormComponent.cxx |2 
 forms/source/component/Grid.cxx  |2 
 forms/source/misc/InterfaceContainer.cxx |2 
 forms/source/richtext/clipboarddispatcher.cxx|2 
 forms/source/richtext/richtextimplcontrol.cxx|2 
 forms/source/xforms/model.cxx|2 
 forms/source/xforms/model_ui.cxx |2 
 include/basic/sbmod.hxx  |2 
 svx/source/accessibility/svxrectctaccessiblecontext.cxx  |8 +-
 svx/source/dialog/connctrl.cxx   |2 
 svx/source/dialog/hdft.cxx   |2 
 svx/source/dialog/srchctrl.cxx   |2 
 svx/source/dialog/srchdlg.cxx|   10 ++
 svx/source/dialog/weldeditview.cxx   |2 
 svx/source/engine3d/view3d.cxx   |2 
 svx/source/engine3d/view3d1.cxx  |   20 ++---
 svx/source/fmcomp/fmgridcl.cxx   |2 
 svx/source/fmcomp/gridctrl.cxx   |2 
 svx/source/form/datanavi.cxx |   55 +++
 svx/source/form/fmshimp.cxx  |1 
 svx/source/form/navigatortree.cxx|   10 +-
 svx/source/form/navigatortreemodel.cxx   |6 -
 svx/source/inc/fmexpl.hxx|2 
 svx/source/items/numfmtsh.cxx|6 -
 svx/source/sdr/contact/objectcontactofobjlistpainter.cxx |2 
 svx/source/sdr/contact/viewcontact.cxx   |2 
 svx/source/svdraw/svdedtv.cxx|3 
 svx/source/svdraw/svdedtv2.cxx   |3 
 svx/source/svdraw/svdmrkv.cxx|5 +
 svx/source/svdraw/svdoedge.cxx   |1 
 svx/source/svdraw/svdouno.cxx|2 
 svx/source/svdraw/svdpntv.cxx|9 +-
 svx/source/svdraw/svdxcgv.cxx|2 
 svx/source/tbxctrls/fontworkgallery.cxx  |   10 +-
 svx/source/tbxctrls/grafctrl.cxx |3 
 svx/source/tbxctrls/lboxctrl.cxx |5 -
 svx/source/tbxctrls/linectrl.cxx |2 
 svx/source/tbxctrls/tbcontrl.cxx |8 +-
 41 files changed, 138 insertions(+), 108 deletions(-)

New commits:
commit 41590e7d1f8ee67c7d5c29c89a9b246c8c8f0f05
Author: Caolán McNamara 
AuthorDate: Wed May 1 20:28:16 2024 +0100
Commit: Caolán McNamara 
CommitDate: Thu May 2 09:24:11 2024 +0200

WaE: C6011 Dereferencing NULL pointer warnings

Change-Id: I8edb1fefe1b2b8a3db3ee8f3a0eed59c7f08a36e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166863
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 59eb93f665c4..8ca156b1238a 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1317,12 +1317,12 @@ void SbModule::ClearPrivateVars()
 }
 }
 
-void SbModule::implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, 
StarBASIC* pDeletedBasic )
+void SbModule::implClearIfVarDependsOnDeletedBasic(SbxVariable& rVar, 
StarBASIC* pDeletedBasic)
 {
-if( pVar->SbxValue::GetType() != SbxOBJECT || dynamic_cast( pVar) != nullptr )
+if (rVar.SbxValue::GetType() != SbxOBJECT || dynamic_cast() != nullptr)
 return;
 
-SbxObject* pObj = dynamic_cast( pVar->GetObject() );
+SbxObject* pObj = dynamic_cast(rVar.GetObject());
 if( pObj == nullptr )
 return;
 
@@ -1337,7 +1337,7 @@ void SbModule::implClearIfVarDependsOnDeletedBasic( 
SbxVariable* pVar, StarBASIC
 StarBASIC* pBasic = dynamic_cast( p  );
 if( pBasic != nullptr && pBasic == pDeletedBasic )
 {
-pVar->SbxValue::Clear();
+rVar.SbxValue::Clear();
 break;
 }
 }
@@ -1358,13 +1358,13 @@ void SbModule::ClearVarsDependingOnDeletedBasic( 
StarBASIC* pDeletedBasic )
 for (sal_uInt32 j = 0; j < pArray->Count(); j++)
 {
 SbxVariable* pVar = pArray->Get(j);
-implClearIfVarDependsOnDeletedBasic( pVar, 
pDeletedBasic );
+implClearIfVarDependsOnDeletedBasic(*pVar, 
pDeletedBasic);
 }
 }
 }
 else
 {
-implClearIfVarDependsOnDeletedBasic( p, pDeletedBasic );
+

core.git: basic/source

2024-05-02 Thread Noel Grandin (via logerrit)
 basic/source/runtime/methods.cxx |   82 +++
 1 file changed, 41 insertions(+), 41 deletions(-)

New commits:
commit 6c4760f89cf28688497414946457c04253a845be
Author: Noel Grandin 
AuthorDate: Wed May 1 20:45:43 2024 +0200
Commit: Noel Grandin 
CommitDate: Thu May 2 08:18:59 2024 +0200

use more OUString literal in getBasicTypeName

Change-Id: I6e307e4387cbecac6391000b9ca7e632b2152b24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166979
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 4dfcdc210ea3..dd8aabfde6d5 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3564,46 +3564,46 @@ void SbRtl_VarType(StarBASIC *, SbxArray & rPar, bool)
 // Exported function
 OUString getBasicTypeName( SbxDataType eType )
 {
-static const char* pTypeNames[] =
-{
-"Empty",// SbxEMPTY
-"Null", // SbxNULL
-"Integer",  // SbxINTEGER
-"Long", // SbxLONG
-"Single",   // SbxSINGLE
-"Double",   // SbxDOUBLE
-"Currency", // SbxCURRENCY
-"Date", // SbxDATE
-"String",   // SbxSTRING
-"Object",   // SbxOBJECT
-"Error",// SbxERROR
-"Boolean",  // SbxBOOL
-"Variant",  // SbxVARIANT
-"DataObject",   // SbxDATAOBJECT
-"Unknown Type",
-"Unknown Type",
-"Char", // SbxCHAR
-"Byte", // SbxBYTE
-"UShort",   // SbxUSHORT
-"ULong",// SbxULONG
-"Long64",   // SbxLONG64
-"ULong64",  // SbxULONG64
-"Int",  // SbxINT
-"UInt", // SbxUINT
-"Void", // SbxVOID
-"HResult",  // SbxHRESULT
-"Pointer",  // SbxPOINTER
-"DimArray", // SbxDIMARRAY
-"CArray",   // SbxCARRAY
-"Userdef",  // SbxUSERDEF
-"Lpstr",// SbxLPSTR
-"Lpwstr",   // SbxLPWSTR
-"Unknown Type", // SbxCoreSTRING
-"WString",  // SbxWSTRING
-"WChar",// SbxWCHAR
-"Int64",// SbxSALINT64
-"UInt64",   // SbxSALUINT64
-"Decimal",  // SbxDECIMAL
+static constexpr OUString pTypeNames[] =
+{
+u"Empty"_ustr,// SbxEMPTY
+u"Null"_ustr, // SbxNULL
+u"Integer"_ustr,  // SbxINTEGER
+u"Long"_ustr, // SbxLONG
+u"Single"_ustr,   // SbxSINGLE
+u"Double"_ustr,   // SbxDOUBLE
+u"Currency"_ustr, // SbxCURRENCY
+u"Date"_ustr, // SbxDATE
+u"String"_ustr,   // SbxSTRING
+u"Object"_ustr,   // SbxOBJECT
+u"Error"_ustr,// SbxERROR
+u"Boolean"_ustr,  // SbxBOOL
+u"Variant"_ustr,  // SbxVARIANT
+u"DataObject"_ustr,   // SbxDATAOBJECT
+u"Unknown Type"_ustr,
+u"Unknown Type"_ustr,
+u"Char"_ustr, // SbxCHAR
+u"Byte"_ustr, // SbxBYTE
+u"UShort"_ustr,   // SbxUSHORT
+u"ULong"_ustr,// SbxULONG
+u"Long64"_ustr,   // SbxLONG64
+u"ULong64"_ustr,  // SbxULONG64
+u"Int"_ustr,  // SbxINT
+u"UInt"_ustr, // SbxUINT
+u"Void"_ustr, // SbxVOID
+u"HResult"_ustr,  // SbxHRESULT
+u"Pointer"_ustr,  // SbxPOINTER
+u"DimArray"_ustr, // SbxDIMARRAY
+u"CArray"_ustr,   // SbxCARRAY
+u"Userdef"_ustr,  // SbxUSERDEF
+u"Lpstr"_ustr,// SbxLPSTR
+u"Lpwstr"_ustr,   // SbxLPWSTR
+u"Unknown Type"_ustr, // SbxCoreSTRING
+u"WString"_ustr,  // SbxWSTRING
+u"WChar"_ustr,// SbxWCHAR
+u"Int64"_ustr,// SbxSALINT64
+u"UInt64"_ustr,   // SbxSALUINT64
+u"Decimal"_ustr,  // SbxDECIMAL
 };
 
 size_t nPos = static_cast(eType) & 0x0FFF;
@@ -3612,7 +3612,7 @@ OUString getBasicTypeName( SbxDataType eType )
 {
 nPos = nTypeNameCount - 1;
 }
-return OUString::createFromAscii(pTypeNames[nPos]);
+return pTypeNames[nPos];
 }
 
 static OUString getObjectTypeName( SbxVariable* pVar )


core.git: basic/source

2024-04-09 Thread Tuukka Orava (via logerrit)
 basic/source/runtime/methods.cxx |  178 +--
 1 file changed, 81 insertions(+), 97 deletions(-)

New commits:
commit f3d0a184c4da57907a1fcf1ed784340be7d974d6
Author: Tuukka Orava 
AuthorDate: Tue Apr 9 09:28:27 2024 +0300
Commit: Mike Kaganski 
CommitDate: Tue Apr 9 10:51:14 2024 +0200

tdf#147132 Flatten Basic function implementations

Change-Id: I077e042c82cbefd1d46db5ca8d5983a0870a296c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165903
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index a97e66dc6c41..4dfcdc210ea3 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -429,18 +429,14 @@ void SbRtl_CurDir(StarBASIC *, SbxArray & rPar, bool)
 void SbRtl_ChDir(StarBASIC * pBasic, SbxArray & rPar, bool)
 {
 rPar.Get(0)->PutEmpty();
-if (rPar.Count() == 2)
-{
-// VBA: track current directory per document type (separately for 
Writer, Calc, Impress, etc.)
-if( SbiRuntime::isVBAEnabled() )
-{
-::basic::vba::registerCurrentDirectory(getDocumentModel(pBasic),
-   rPar.Get(1)->GetOUString());
-}
-}
-else
+if (rPar.Count() != 2)
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+// VBA: track current directory per document type (separately for Writer, 
Calc, Impress, etc.)
+if( SbiRuntime::isVBAEnabled() )
 {
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+::basic::vba::registerCurrentDirectory(getDocumentModel(pBasic),
+rPar.Get(1)->GetOUString());
 }
 }
 
@@ -448,9 +444,7 @@ void SbRtl_ChDrive(StarBASIC *, SbxArray & rPar, bool)
 {
 rPar.Get(0)->PutEmpty();
 if (rPar.Count() != 2)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 }
 
 
@@ -499,129 +493,119 @@ void implStepRenameOSL( const OUString& aSource, const 
OUString& aDest )
 void SbRtl_FileCopy(StarBASIC *, SbxArray & rPar, bool)
 {
 rPar.Get(0)->PutEmpty();
-if (rPar.Count() == 3)
+if (rPar.Count() != 3)
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+OUString aSource = rPar.Get(1)->GetOUString();
+OUString aDest = rPar.Get(2)->GetOUString();
+if( hasUno() )
 {
-OUString aSource = rPar.Get(1)->GetOUString();
-OUString aDest = rPar.Get(2)->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
-{
-xSFI->copy( getFullPath( aSource ), getFullPath( aDest ) );
-}
-catch(const Exception & )
-{
-StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND );
-}
+xSFI->copy( getFullPath( aSource ), getFullPath( aDest ) );
 }
-}
-else
-{
-FileBase::RC nRet = File::copy( getFullPath( aSource ), 
getFullPath( aDest ) );
-if( nRet != FileBase::E_None )
+catch(const Exception & )
 {
 StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND );
 }
 }
 }
 else
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+{
+FileBase::RC nRet = File::copy( getFullPath( aSource ), getFullPath( 
aDest ) );
+if( nRet != FileBase::E_None )
+{
+StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND );
+}
+}
 }
 
 void SbRtl_Kill(StarBASIC *, SbxArray & rPar, bool)
 {
 rPar.Get(0)->PutEmpty();
-if (rPar.Count() == 2)
-{
-OUString aFileSpec = rPar.Get(1)->GetOUString();
+if (rPar.Count() != 2)
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 
-if( hasUno() )
+OUString aFileSpec = 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() )
+OUString aFullPath = getFullPath( aFileSpec );
+if( !xSFI->exists( aFullPath ) || xSFI->isFolder( aFullPath ) )
 {
-OUString aFullPath = getFullPath( aFileSpec );
-if( !xSFI->exists( aFullPath ) || xSFI->isFolder( aFullPath ) )
-{
-StarBASIC::Error( ERRCODE_BASIC_FILE_NOT_FOUND );
-return;
-}
-try
-{

core.git: basic/source

2024-04-08 Thread AmandaQuaresmaCoutinho (via logerrit)
 basic/source/runtime/methods1.cxx |   42 +-
 1 file changed, 15 insertions(+), 27 deletions(-)

New commits:
commit bb89fe7ab67c1476b6cf250f236bd5b643a77c6e
Author: AmandaQuaresmaCoutinho 
AuthorDate: Mon Apr 1 02:22:52 2024 +0200
Commit: Ilmari Lauhakangas 
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 
Reviewed-by: Ilmari Lauhakangas 

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 &= 0x00FF;
-rPar.Get(0)->PutInteger(static_cast(nRGB));
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+sal_Int32 nRGB = rPar.Get(1)->GetLong();
+nRGB &= 0x00FF;
+rPar.Get(0)->PutInteger(static_cast(nRGB));
 }
 
 


core.git: basic/source

2024-04-02 Thread Mike Kaganski (via logerrit)
 basic/source/runtime/runtime.cxx |   95 ---
 1 file changed, 30 insertions(+), 65 deletions(-)

New commits:
commit f2482fd96eff00b806fae385096531f63f5f2bf5
Author: Mike Kaganski 
AuthorDate: Tue Apr 2 23:57:16 2024 +0500
Commit: Mike Kaganski 
CommitDate: Wed Apr 3 04:35:10 2024 +0200

Simplify VBALikeToRegexp a bit

This cleans up some unnecessary escaping both
inside and outside [] groups.

Change-Id: I5abcf0fce634f0d8809bf4d318f61b8c8f69a318
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165703
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 20bbedc9d6f0..b2f493689c0b 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1436,99 +1436,64 @@ void SbiRuntime::StepGE()   { StepCompare( SbxGE ); 
}
 
 namespace
 {
-bool NeedEsc(sal_Unicode cCode)
+OUString VBALikeToRegexp(std::u16string_view sIn)
 {
-if(!rtl::isAscii(cCode))
-{
-return false;
-}
-switch(cCode)
-{
-case '.':
-case '^':
-case '$':
-case '+':
-case '\':
-case '|':
-case '{':
-case '}':
-case '(':
-case ')':
-return true;
-default:
-return false;
-}
-}
-
-OUString VBALikeToRegexp(const OUString )
-{
-OUStringBuffer sResult;
-const sal_Unicode *start = rIn.getStr();
-const sal_Unicode *end = start + rIn.getLength();
-
-int seenright = 0;
-
-sResult.append("\A"); // Match at the beginning of the input
+OUStringBuffer sResult("\A"); // Match at the beginning of the input
 
-while (start < end)
+for (auto start = sIn.begin(), end = sIn.end(); start < end;)
 {
-switch (*start)
+switch (auto ch = *start++)
 {
 case '?':
 sResult.append('.');
-start++;
 break;
 case '*':
 sResult.append(".*");
-start++;
 break;
 case '#':
 sResult.append("[0-9]");
-start++;
-break;
-case ']':
-sResult.append('\');
-sResult.append(*start++);
 break;
 case '[':
-sResult.append(*start++);
-seenright = 0;
-if (start < end && *start == '!')
+sResult.append(ch);
+if (start < end)
 {
-sResult.append('^');
-start++;
+if (*start == '!')
+{
+sResult.append('^');
+++start;
+}
+else if (*start == '^')
+sResult.append('\');
 }
-while (start < end && !seenright)
+for (bool seenright = false; start < end && !seenright; 
++start)
 {
 switch (*start)
 {
 case '[':
-case '?':
-case '*':
+case '\':
 sResult.append('\');
-sResult.append(*start);
 break;
 case ']':
-sResult.append(*start);
-seenright = 1;
-break;
-default:
-if (NeedEsc(*start))
-{
-sResult.append('\');
-}
-sResult.append(*start);
+seenright = true;
 break;
 }
-start++;
+sResult.append(*start);
 }
 break;
+case '.':
+case '^':
+case '$':
+case '+':
+case '\':
+case '|':
+case '{':
+case '}':
+case '(':
+case ')':
+sResult.append('\');
+[[fallthrough]];
 default:
-if (NeedEsc(*start))
-{
-sResult.append('\');
-}
-sResult.append(*start++);
+sResult.append(ch);
 }
 }
 


core.git: basic/source

2024-04-02 Thread Gabor Kelemen (via logerrit)
 basic/source/classes/eventatt.cxx|1 -
 basic/source/runtime/iosys.cxx   |2 --
 basic/source/runtime/runtime.cxx |1 -
 basic/source/uno/dlgcont.cxx |1 -
 basic/source/uno/modsizeexceeded.cxx |1 -
 basic/source/uno/namecont.cxx|1 -
 basic/source/uno/scriptcont.cxx  |2 --
 7 files changed, 9 deletions(-)

New commits:
commit 49a6a819651caf493038a7d333764ff5cb370a23
Author: Gabor Kelemen 
AuthorDate: Fri Mar 29 14:06:47 2024 +0100
Commit: Gabor Kelemen 
CommitDate: Tue Apr 2 08:32:46 2024 +0200

tdf#146619 Drop unused 'using namespace' in: basic/

Change-Id: I55bd0c89880dd97307dde5a5b670e63f3ea66355
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165536
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen 

diff --git a/basic/source/classes/eventatt.cxx 
b/basic/source/classes/eventatt.cxx
index 93399726ef11..6cf371f3869a 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -58,7 +58,6 @@ using namespace ::com::sun::star::script;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::reflection;
 using namespace ::com::sun::star::awt;
 using namespace ::com::sun::star::io;
 using namespace ::cppu;
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 3d03274c46c0..015ed8abc29b 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -40,10 +40,8 @@
 #include 
 
 using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
 using namespace com::sun::star::ucb;
 using namespace com::sun::star::io;
-using namespace com::sun::star::bridge;
 
 
 namespace {
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 35627045eda8..5d8a2ba2ffc3 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -76,7 +76,6 @@ using com::sun::star::uno::Reference;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::container;
 using namespace com::sun::star::lang;
-using namespace com::sun::star::beans;
 using namespace com::sun::star::script;
 
 using namespace ::com::sun::star;
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 170a5c0c01cd..533deb182d58 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -53,7 +53,6 @@ using namespace com::sun::star::io;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::ucb;
 using namespace com::sun::star::lang;
-using namespace com::sun::star::script;
 using namespace com::sun::star::xml::sax;
 using namespace com::sun::star;
 using namespace cppu;
diff --git a/basic/source/uno/modsizeexceeded.cxx 
b/basic/source/uno/modsizeexceeded.cxx
index b85f285d820f..4210184b37d6 100644
--- a/basic/source/uno/modsizeexceeded.cxx
+++ b/basic/source/uno/modsizeexceeded.cxx
@@ -25,7 +25,6 @@
 
 using namespace com::sun::star;
 using namespace cppu;
-using namespace osl;
 
 ModuleSizeExceeded::ModuleSizeExceeded(const std::vector& sModules)
 {
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 2d1dea85fc67..228220182811 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -90,7 +90,6 @@ using namespace com::sun::star::frame;
 using namespace com::sun::star::deployment;
 using namespace com::sun::star;
 using namespace cppu;
-using namespace osl;
 
 using com::sun::star::uno::Reference;
 
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 2f5cb5f15198..d078deddece4 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -51,7 +51,6 @@
 namespace basic
 {
 
-using namespace com::sun::star::document;
 using namespace com::sun::star::container;
 using namespace com::sun::star::io;
 using namespace com::sun::star::uno;
@@ -61,7 +60,6 @@ using namespace com::sun::star::script;
 using namespace com::sun::star::xml::sax;
 using namespace com::sun::star;
 using namespace cppu;
-using namespace osl;
 
 
 // Implementation class SfxScriptLibraryContainer


core.git: basic/source

2024-03-27 Thread U-Aarons_LaptopAaron (via logerrit)
 basic/source/runtime/methods.cxx |  120 +++
 1 file changed, 47 insertions(+), 73 deletions(-)

New commits:
commit 26c30fd77bf31ad8c14da1413aaa61fa8aa45206
Author: U-Aarons_Laptop\Aaron 
AuthorDate: Tue Mar 26 14:59:04 2024 -0400
Commit: Michael Weghorn 
CommitDate: Wed Mar 27 11:48:19 2024 +0100

tdf#147132: Flatten Basic function implementations

Change-Id: I9fcbc87b7ce01d96ffb45ddd3a525831c7cdcdaa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165357
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 34d959669747..a97e66dc6c41 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1003,47 +1003,35 @@ void SbRtl_LCase(StarBASIC *, SbxArray & rPar, bool)
 void SbRtl_Left(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() < 3)
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+OUString aStr(rPar.Get(1)->GetOUString());
+sal_Int32 nResultLen = rPar.Get(2)->GetLong();
+if( nResultLen < 0 )
 {
+nResultLen = 0;
 StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 }
-else
+else if(nResultLen > aStr.getLength())
 {
-OUString aStr(rPar.Get(1)->GetOUString());
-sal_Int32 nResultLen = rPar.Get(2)->GetLong();
-if( nResultLen < 0 )
-{
-nResultLen = 0;
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else if(nResultLen > aStr.getLength())
-{
-nResultLen = aStr.getLength();
-}
-aStr = aStr.copy(0, nResultLen );
-rPar.Get(0)->PutString(aStr);
+nResultLen = aStr.getLength();
 }
+aStr = aStr.copy(0, nResultLen );
+rPar.Get(0)->PutString(aStr);
 }
 
 void SbRtl_Log(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() < 2)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else
-{
-double aArg = rPar.Get(1)->GetDouble();
-if ( aArg > 0 )
-{
-double d = log( aArg );
-checkArithmeticOverflow( d );
-rPar.Get(0)->PutDouble(d);
-}
-else
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+double aArg = rPar.Get(1)->GetDouble();
+if ( aArg <= 0 )
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+double d = log( aArg );
+checkArithmeticOverflow( d );
+rPar.Get(0)->PutDouble(d);
 }
 
 void SbRtl_LTrim(StarBASIC *, SbxArray & rPar, bool)
@@ -1164,18 +1152,14 @@ void SbRtl_Mid(StarBASIC *, SbxArray & rPar, bool 
bWrite)
 void SbRtl_Oct(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() < 2)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else
-{
-SbxVariableRef pArg = rPar.Get(1);
-// converting value to unsigned and limit to 2 or 4 byte representation
-sal_uInt32 nVal = pArg->IsInteger() ?
-static_cast(pArg->GetInteger()) :
-static_cast(pArg->GetLong());
-rPar.Get(0)->PutString(OUString::number(nVal, 8));
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+SbxVariableRef pArg = rPar.Get(1);
+// converting value to unsigned and limit to 2 or 4 byte representation
+sal_uInt32 nVal = pArg->IsInteger() ?
+static_cast(pArg->GetInteger()) :
+static_cast(pArg->GetLong());
+rPar.Get(0)->PutString(OUString::number(nVal, 8));
 }
 
 // Replace(expression, find, replace[, start[, count[, compare]]])
@@ -1184,9 +1168,7 @@ void SbRtl_Replace(StarBASIC *, SbxArray & rPar, bool)
 {
 const sal_uInt32 nArgCount = rPar.Count() - 1;
 if ( nArgCount < 3 || nArgCount > 6 )
-{
 return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
 
 sal_Int32 lStartPos = 1;
 if (nArgCount >= 4)
@@ -1287,26 +1269,22 @@ void SbRtl_Replace(StarBASIC *, SbxArray & rPar, bool)
 void SbRtl_Right(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() < 3)
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+const OUString& rStr = rPar.Get(1)->GetOUString();
+int nResultLen = rPar.Get(2)->GetLong();
+if( nResultLen < 0 )
 {
+nResultLen = 0;
 StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 }
-else
+int nStrLen = rStr.getLength();
+if ( nResultLen > nStrLen )
 {
-const OUString& rStr = rPar.Get(1)->GetOUString();
-int nResultLen = rPar.Get(2)->GetLong();
-if( nResultLen < 0 )
-{
-nResultLen = 0;
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-int nStrLen = rStr.getLength();
-if ( nResultLen > nStrLen )
-{
-nResultLen = nStrLen;
-}
-OUString aResultStr = 

core.git: basic/source

2024-03-11 Thread Arnaud VERSINI (via logerrit)
 basic/source/uno/dlgcont.cxx|6 +++---
 basic/source/uno/scriptcont.cxx |6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 68b73e7a290a340be48c8b9ed4d9f970d9a56204
Author: Arnaud VERSINI 
AuthorDate: Sun Mar 3 16:30:39 2024 +0100
Commit: Arnaud Versini 
CommitDate: Mon Mar 11 08:32:32 2024 +0100

basic : use OUstring literal for XServiceInfo implementation

Change-Id: Ic4501ec887bb3f1249ab4a8da1eae07f6b2a22ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164305
Tested-by: Jenkins
Reviewed-by: Arnaud Versini 

diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 666b6d355a00..170a5c0c01cd 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -471,13 +471,13 @@ SfxDialogLibraryContainer:: HasExecutableCode( const 
OUString& /*Library*/ )
 
 OUString SAL_CALL SfxDialogLibraryContainer::getImplementationName( )
 {
-return "com.sun.star.comp.sfx2.DialogLibraryContainer";
+return u"com.sun.star.comp.sfx2.DialogLibraryContainer"_ustr;
 }
 
 Sequence< OUString > SAL_CALL 
SfxDialogLibraryContainer::getSupportedServiceNames( )
 {
-return {"com.sun.star.script.DocumentDialogLibraryContainer",
-"com.sun.star.script.DialogLibraryContainer"}; // for compatibility
+return {u"com.sun.star.script.DocumentDialogLibraryContainer"_ustr,
+u"com.sun.star.script.DialogLibraryContainer"_ustr}; // for 
compatibility
 }
 
 // Implementation class SfxDialogLibrary
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 2a5a1249a017..2f5cb5f15198 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -1113,13 +1113,13 @@ sal_Bool SAL_CALL SfxScriptLibraryContainer:: 
HasExecutableCode( const OUString&
 // Service
 OUString SAL_CALL SfxScriptLibraryContainer::getImplementationName( )
 {
-return "com.sun.star.comp.sfx2.ScriptLibraryContainer";
+return u"com.sun.star.comp.sfx2.ScriptLibraryContainer"_ustr;
 }
 
 Sequence< OUString > SAL_CALL 
SfxScriptLibraryContainer::getSupportedServiceNames( )
 {
-return {"com.sun.star.script.DocumentScriptLibraryContainer",
-"com.sun.star.script.ScriptLibraryContainer"}; // for compatibility
+return {u"com.sun.star.script.DocumentScriptLibraryContainer"_ustr,
+u"com.sun.star.script.ScriptLibraryContainer"_ustr}; // for 
compatibility
 }
 
 // Implementation class SfxScriptLibrary


core.git: basic/source

2024-02-27 Thread Mike Kaganski (via logerrit)
 basic/source/comp/exprnode.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 60dd46ee18f98e4fc8ca0faa478911bfedf9ae13
Author: Mike Kaganski 
AuthorDate: Tue Feb 27 14:18:34 2024 +0600
Commit: Mike Kaganski 
CommitDate: Tue Feb 27 11:36:45 2024 +0100

Simplify a bit

Change-Id: Id9640825e117531ed1b67db9e83349c556f291c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164004
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index ade1d5832ba1..d6733e96d1ee 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -118,7 +118,7 @@ SbiExprNode::~SbiExprNode()
 
 SbiSymDef* SbiExprNode::GetVar()
 {
-if( eNodeType == SbxVARVAL )
+if (IsVariable())
 return aVar.pDef;
 else
 return nullptr;
@@ -136,7 +136,7 @@ SbiSymDef* SbiExprNode::GetRealVar()
 // From 1995-12-18
 SbiExprNode* SbiExprNode::GetRealNode()
 {
-if( eNodeType == SbxVARVAL )
+if (IsVariable())
 {
 SbiExprNode* p = this;
 while( p->aVar.pNext )


core.git: basic/source

2024-02-27 Thread Julien Nabet (via logerrit)
 basic/source/comp/loops.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit dd8fc8e24bae35ad392482d797e7db994ca03ac8
Author: Julien Nabet 
AuthorDate: Tue Feb 27 11:02:26 2024 +0100
Commit: Julien Nabet 
CommitDate: Tue Feb 27 11:02:51 2024 +0100

Typo: alredy->already

Change-Id: I67fa846c71cf91563c3457cec98195b1886e3fa9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164025
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx
index f903f650a2bf..2a756b6fb3a5 100644
--- a/basic/source/comp/loops.cxx
+++ b/basic/source/comp/loops.cxx
@@ -213,7 +213,7 @@ void SbiParser::For()
 if (!aLvalue.IsVariable())
 {
 bAbort = true;
-return; // the error is alredy set in SbiExpression ctor
+return; // the error is already set in SbiExpression ctor
 }
 aLvalue.Gen();  // variable on the Stack
 


core.git: basic/source

2024-02-27 Thread Mike Kaganski (via logerrit)
 basic/source/comp/loops.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 8bbfbe92c01bff38ed2241da56560b84f7954beb
Author: Mike Kaganski 
AuthorDate: Tue Feb 27 13:44:37 2024 +0600
Commit: Mike Kaganski 
CommitDate: Tue Feb 27 10:33:52 2024 +0100

tdf#159908: return early to avoid nullptr dereference

When aLvalue is not a variable, its GetRealVar() returns nullptr.
That was dereferenced unconditionally later in the check of the
variable after NEXT.

Change-Id: Ia46f23a7e720431bf62ace998848b684aa8449e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164002
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx
index 07aac44943a6..f903f650a2bf 100644
--- a/basic/source/comp/loops.cxx
+++ b/basic/source/comp/loops.cxx
@@ -210,6 +210,11 @@ void SbiParser::For()
 if( bForEach )
 Next();
 SbiExpression aLvalue( this, SbOPERAND );
+if (!aLvalue.IsVariable())
+{
+bAbort = true;
+return; // the error is alredy set in SbiExpression ctor
+}
 aLvalue.Gen();  // variable on the Stack
 
 if( bForEach )


core.git: basic/source external/libcmis include/oox

2024-02-22 Thread Mike Kaganski (via logerrit)
 basic/source/sbx/sbxbase.cxx  |6 
 external/libcmis/0001-Fix-warning-C4589-when-building-with-MSVC.patch |  222 
++
 external/libcmis/UnpackedTarball_libcmis.mk   |1 
 include/oox/helper/binaryinputstream.hxx  |4 
 include/oox/helper/binaryoutputstream.hxx |4 
 5 files changed, 226 insertions(+), 11 deletions(-)

New commits:
commit b3e6bec35090a88e6ae3c06fc7bb9734bf996e4a
Author: Mike Kaganski 
AuthorDate: Thu Feb 22 21:48:32 2024 +0600
Commit: Mike Kaganski 
CommitDate: Fri Feb 23 01:34:11 2024 +0100

Fix warning C4589 when building with MSVC without -Wv:18

Discovered by https://gerrit.libreoffice.org/c/core/+/163717

Like these:

 C:\libcmis\inc\libcmis/document.hxx(51): warning C4589: Constructor of 
abstract class 'libcmis::Document' ignores initializer for virtual base class 
'libcmis::Object'
 C:\libcmis\inc\libcmis/document.hxx(51): note: virtual base classes are 
only initialized by the most-derived type
 C:\libcmis\inc\libcmis/folder.hxx(58): warning C4589: Constructor of 
abstract class 'libcmis::Folder' ignores initializer for virtual base class 
'libcmis::Object'
 C:\libcmis\inc\libcmis/folder.hxx(58): note: virtual base classes are only 
initialized by the most-derived type

Change-Id: Icc7f94cc02796a86b47b025df69ec3db971ad11e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163777
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 3189977a6b8e..b90368f68f26 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -57,11 +57,7 @@ SbxBase::SbxBase()
 nFlags  = SbxFlagBits::ReadWrite;
 }
 
-SbxBase::SbxBase( const SbxBase& r )
-: SvRefBase( r )
-{
-nFlags  = r.nFlags;
-}
+SbxBase::SbxBase(const SbxBase& r) = default;
 
 SbxBase::~SbxBase()
 {
diff --git 
a/external/libcmis/0001-Fix-warning-C4589-when-building-with-MSVC.patch 
b/external/libcmis/0001-Fix-warning-C4589-when-building-with-MSVC.patch
new file mode 100644
index ..0883d708f3af
--- /dev/null
+++ b/external/libcmis/0001-Fix-warning-C4589-when-building-with-MSVC.patch
@@ -0,0 +1,222 @@
+From c86638560b3cb39b847d4e84ae9b8492f0c5fa22 Mon Sep 17 00:00:00 2001
+From: Mike Kaganski 
+Date: Thu, 22 Feb 2024 20:47:48 +0600
+Subject: [PATCH] Fix warning C4589 when building with MSVC
+
+C:\libcmis\inc\libcmis/document.hxx(51): warning C4589: Constructor of 
abstract class 'libcmis::Document' ignores initializer for virtual base class 
'libcmis::Object'
+C:\libcmis\inc\libcmis/document.hxx(51): note: virtual base classes are only 
initialized by the most-derived type
+C:\libcmis\inc\libcmis/folder.hxx(58): warning C4589: Constructor of abstract 
class 'libcmis::Folder' ignores initializer for virtual base class 
'libcmis::Object'
+C:\libcmis\inc\libcmis/folder.hxx(58): note: virtual base classes are only 
initialized by the most-derived type
+---
+ inc/libcmis/document.hxx| 1 -
+ inc/libcmis/folder.hxx  | 1 -
+ src/libcmis/atom-document.cxx   | 2 --
+ src/libcmis/atom-folder.cxx | 1 -
+ src/libcmis/gdrive-document.cxx | 2 --
+ src/libcmis/gdrive-folder.cxx   | 2 --
+ src/libcmis/onedrive-document.cxx   | 2 --
+ src/libcmis/onedrive-folder.cxx | 2 --
+ src/libcmis/sharepoint-document.cxx | 2 --
+ src/libcmis/sharepoint-folder.cxx   | 2 --
+ src/libcmis/ws-document.cxx | 1 -
+ src/libcmis/ws-folder.cxx   | 1 -
+ 12 files changed, 19 deletions(-)
+
+diff --git a/inc/libcmis/document.hxx b/inc/libcmis/document.hxx
+index 8f44313..ca18a84 100644
+--- a/inc/libcmis/document.hxx
 b/inc/libcmis/document.hxx
+@@ -48,7 +48,6 @@ namespace libcmis
+ class LIBCMIS_API Document : public virtual Object
+ {
+ public:
+-Document( Session* session ) : Object( session ) { }
+ virtual ~Document( ) { }
+ 
+ /** Get the folder parents for the document.
+diff --git a/inc/libcmis/folder.hxx b/inc/libcmis/folder.hxx
+index 0010dbd..24f4ac4 100644
+--- a/inc/libcmis/folder.hxx
 b/inc/libcmis/folder.hxx
+@@ -55,7 +55,6 @@ namespace libcmis
+ class LIBCMIS_API Folder : public virtual Object
+ {
+ public:
+-Folder( Session* session ) : Object( session ) { }
+ virtual ~Folder() { }
+ 
+ virtual std::vector< std::string > getPaths( );
+diff --git a/src/libcmis/atom-document.cxx b/src/libcmis/atom-document.cxx
+index e0400b1..8871dbc 100644
+--- a/src/libcmis/atom-document.cxx
 b/src/libcmis/atom-document.cxx
+@@ -43,7 +43,6 @@ using namespace libcmis;
+ 
+ AtomDocument::AtomDocument( AtomPubSession* session ) :
+ libcmis::Object( session ),
+-libcmis::Document( session ),
+ AtomObject( session ),
+ m_contentUrl( )
+ {
+@@ -52,7 +51,6 @@ 

core.git: basic/source

2024-02-12 Thread Adam Seskunas (via logerrit)
 basic/source/runtime/methods.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 95dace2eb1ae7ce2fc000cc67e134b7bfadf2c35
Author: Adam Seskunas 
AuthorDate: Thu Feb 8 21:41:13 2024 -0800
Commit: Mike Kaganski 
CommitDate: Tue Feb 13 05:51:04 2024 +0100

tdf#154285 Check upper bound of arguments in SbRtl_CurDir

The LibreOffice Basic specification says CurDir should accept one
argument and in the case of a non-Windows system, ignore that argument
and simply return the current directory. So check that SbRtl_CurDir
accepts a maximum of two arguments.

Change-Id: Ia60114fac31aa4261c8251e26ef172a0370e6abc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163150
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index d58a2cef9ee0..34d959669747 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -371,6 +371,9 @@ void SbRtl_CurDir(StarBASIC *, SbxArray & rPar, bool)
 // there's no possibility to detect the current one in a way that a 
virtual URL
 // could be delivered.
 
+if (rPar.Count() > 2)
+   return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
 #if defined(_WIN32)
 int nCurDir = 0;  // Current dir // JSM
 if (rPar.Count() == 2)


core.git: basic/source

2024-02-08 Thread Aron Budea (via logerrit)
 basic/source/runtime/methods.cxx |  190 ---
 1 file changed, 81 insertions(+), 109 deletions(-)

New commits:
commit 8318337c3e30075acc72fa8c9d5051c33319fdf5
Author: Aron Budea 
AuthorDate: Sun Jan 28 21:46:32 2024 +1030
Commit: Aron Budea 
CommitDate: Fri Feb 9 00:30:21 2024 +0100

tdf#147132 tdf#154285 basic: Flatten and check param count of Is* fns

Change-Id: I6d27dd49613a5cc26f4244dadc9bdd65361a0475
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162657
Tested-by: Jenkins
Reviewed-by: Aron Budea 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index ad3b638805a2..d58a2cef9ee0 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2272,162 +2272,134 @@ void SbRtl_Date(StarBASIC *, SbxArray & rPar, bool 
bWrite)
 
 void SbRtl_IsArray(StarBASIC *, SbxArray & rPar, bool)
 {
-if (rPar.Count() < 2)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else
-{
-rPar.Get(0)->PutBool((rPar.Get(1)->GetType() & SbxARRAY) != 0);
-}
+if (rPar.Count() != 2)
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+rPar.Get(0)->PutBool((rPar.Get(1)->GetType() & SbxARRAY) != 0);
 }
 
 void SbRtl_IsObject(StarBASIC *, SbxArray & rPar, bool)
 {
-if (rPar.Count() < 2)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else
-{
-SbxVariable* pVar = rPar.Get(1);
-bool bObject = pVar->IsObject();
-SbxBase* pObj = (bObject ? pVar->GetObject() : nullptr);
+if (rPar.Count() != 2)
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 
-if( auto pUnoClass = dynamic_cast( pObj) )
-{
-bObject = pUnoClass->getUnoClass().is();
-}
-rPar.Get(0)->PutBool(bObject);
+SbxVariable* pVar = rPar.Get(1);
+bool bObject = pVar->IsObject();
+SbxBase* pObj = (bObject ? pVar->GetObject() : nullptr);
+
+if( auto pUnoClass = dynamic_cast( pObj) )
+{
+bObject = pUnoClass->getUnoClass().is();
 }
+rPar.Get(0)->PutBool(bObject);
 }
 
 void SbRtl_IsDate(StarBASIC *, SbxArray & rPar, bool)
 {
-if (rPar.Count() < 2)
+if (rPar.Count() != 2)
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+// #46134 only string is converted, all other types result in sal_False
+SbxVariableRef xArg = rPar.Get(1);
+SbxDataType eType = xArg->GetType();
+bool bDate = false;
+
+if( eType == SbxDATE )
 {
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+bDate = true;
 }
-else
+else if( eType == SbxSTRING )
 {
-// #46134 only string is converted, all other types result in sal_False
-SbxVariableRef xArg = rPar.Get(1);
-SbxDataType eType = xArg->GetType();
-bool bDate = false;
-
-if( eType == SbxDATE )
-{
-bDate = true;
-}
-else if( eType == SbxSTRING )
-{
-ErrCode nPrevError = SbxBase::GetError();
-SbxBase::ResetError();
+ErrCode nPrevError = SbxBase::GetError();
+SbxBase::ResetError();
 
-// force conversion of the parameter to SbxDATE
-xArg->SbxValue::GetDate();
+// force conversion of the parameter to SbxDATE
+xArg->SbxValue::GetDate();
 
-bDate = !SbxBase::IsError();
+bDate = !SbxBase::IsError();
 
-SbxBase::ResetError();
-SbxBase::SetError( nPrevError );
-}
-rPar.Get(0)->PutBool(bDate);
+SbxBase::ResetError();
+SbxBase::SetError( nPrevError );
 }
+rPar.Get(0)->PutBool(bDate);
 }
 
 void SbRtl_IsEmpty(StarBASIC *, SbxArray & rPar, bool)
 {
-if (rPar.Count() < 2)
+if (rPar.Count() != 2)
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+SbxVariable* pVar = nullptr;
+if( SbiRuntime::isVBAEnabled() )
 {
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+pVar = getDefaultProp(rPar.Get(1));
+}
+if ( pVar )
+{
+pVar->Broadcast( SfxHintId::BasicDataWanted );
+rPar.Get(0)->PutBool(pVar->IsEmpty());
 }
 else
 {
-SbxVariable* pVar = nullptr;
-if( SbiRuntime::isVBAEnabled() )
-{
-pVar = getDefaultProp(rPar.Get(1));
-}
-if ( pVar )
-{
-pVar->Broadcast( SfxHintId::BasicDataWanted );
-rPar.Get(0)->PutBool(pVar->IsEmpty());
-}
-else
-{
-rPar.Get(0)->PutBool(rPar.Get(1)->IsEmpty());
-}
+rPar.Get(0)->PutBool(rPar.Get(1)->IsEmpty());
 }
 }
 
 void SbRtl_IsError(StarBASIC *, SbxArray & rPar, bool)
 {
-if (rPar.Count() < 2)
+if (rPar.Count() != 2)
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+SbxVariable* pVar = rPar.Get(1);
+SbUnoObject* pObj = dynamic_cast( pVar  

core.git: basic/source

2024-01-30 Thread Mike Kaganski (via logerrit)
 basic/source/uno/namecont.cxx |   22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

New commits:
commit 942e9a79f066a26276e299660ba56874874841c6
Author: Mike Kaganski 
AuthorDate: Wed Jan 31 10:26:04 2024 +0600
Commit: Mike Kaganski 
CommitDate: Wed Jan 31 06:56:42 2024 +0100

Related: tdf#159458 Move variable URL re-creation to a central place

Change-Id: Ib73ae476f308b2579a15c9b2474a55e3558c134c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162786
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index eb04dd2ee767..430cab8b3264 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -562,6 +562,7 @@ void checkAndCopyFileImpl( const INetURLObject& 
rSourceFolderInetObj,
 }
 
 constexpr OUString sUserBasicVariablePrefix = u"$(USER)/basic/"_ustr;
+constexpr OUString sInstBasicVariablePrefix = u"$(INST)/" LIBO_SHARE_FOLDER 
"/basic/"_ustr;
 
 void createVariableURL( OUString& rStr, std::u16string_view rLibName,
std::u16string_view rInfoFileName, bool bUser )
@@ -572,7 +573,7 @@ void createVariableURL( OUString& rStr, std::u16string_view 
rLibName,
 }
 else
 {
-rStr = "$(INST)/" LIBO_SHARE_FOLDER "/basic/";
+rStr = sInstBasicVariablePrefix;
 }
 rStr += OUString::Concat(rLibName) + "/" + rInfoFileName + ".xlb/";
 }
@@ -1268,7 +1269,13 @@ void SfxLibraryContainer::checkStorageURL( const 
OUString& aSourceURL,
 }
 else
 {
-aUnexpandedStorageURL.clear();
+// try to re-create the variable URL: helps moving the profile
+if (OUString aRest; 
aSourceURL.startsWith(expand_url(sUserBasicVariablePrefix), ))
+aUnexpandedStorageURL = sUserBasicVariablePrefix + aRest;
+else if (aSourceURL.startsWith(expand_url(sInstBasicVariablePrefix), 
))
+aUnexpandedStorageURL = sInstBasicVariablePrefix + aRest;
+else
+aUnexpandedStorageURL.clear(); // This will use eventual value of 
aLibInfoFileURL
 }
 
 INetURLObject aInetObj( aExpandedSourceURL );
@@ -2525,18 +2532,9 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const 
OUString& Name, const OU
  INetURLObject::EncodeMechanism::All );
 OUString aDestDirPath = aDestInetObj.GetMainURL( 
INetURLObject::DecodeMechanism::NONE );
 
-OUString aDestDirUnexpandedPath = aDestDirPath;
-if 
(pImplLib->maUnexpandedStorageURL.startsWith(sUserBasicVariablePrefix))
-{
-// try to re-create the variable URL: helps moving the profile
-OUString aUserBasicURL = expand_url(sUserBasicVariablePrefix);
-if (OUString aRest; aDestDirPath.startsWith(aUserBasicURL, ))
-aDestDirUnexpandedPath = sUserBasicVariablePrefix + aRest;
-}
-
 // Store new URL
 OUString aLibInfoFileURL = pImplLib->maLibInfoFileURL;
-checkStorageURL(aDestDirUnexpandedPath, pImplLib->maLibInfoFileURL, 
pImplLib->maStorageURL,
+checkStorageURL(aDestDirPath, pImplLib->maLibInfoFileURL, 
pImplLib->maStorageURL,
  pImplLib->maUnexpandedStorageURL );
 
 try


core.git: basic/source

2024-01-30 Thread Mike Kaganski (via logerrit)
 basic/source/uno/namecont.cxx |   27 +++
 1 file changed, 23 insertions(+), 4 deletions(-)

New commits:
commit 907d4107896234b2e7ebfd42f40cee3bd5b1d01e
Author: Mike Kaganski 
AuthorDate: Wed Jan 31 00:44:19 2024 +0600
Commit: Mike Kaganski 
CommitDate: Wed Jan 31 03:35:15 2024 +0100

tdf#159458: make sure to update unexpanded URL when renaming library

1. If passed new source URL is expanded (i.e., trying to expand it in
SfxLibraryContainer::checkStorageURL didn't change it), previously
aUnexpandedStorageURL was unchanged. It should be cleared - then it
will be set automatically to the URL to lib info file.

2. Try to create the "variable" path (starting with "$(USER)/basic/")
because this avoids absolute paths to the libraries, which make it
harder to move the profile.

Change-Id: Ie83ea9a32cfddf37727d238547663aeb72487ee3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162777
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index b133b064..eb04dd2ee767 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -537,7 +537,9 @@ void SAL_CALL SfxLibraryContainer::storeLibraries(  )
 }
 }
 
-static void checkAndCopyFileImpl( const INetURLObject& rSourceFolderInetObj,
+namespace
+{
+void checkAndCopyFileImpl( const INetURLObject& rSourceFolderInetObj,
   const INetURLObject& rTargetFolderInetObj,
   std::u16string_view rCheckFileName,
   std::u16string_view rCheckExtension,
@@ -559,12 +561,14 @@ static void checkAndCopyFileImpl( const INetURLObject& 
rSourceFolderInetObj,
 }
 }
 
-static void createVariableURL( OUString& rStr, std::u16string_view rLibName,
+constexpr OUString sUserBasicVariablePrefix = u"$(USER)/basic/"_ustr;
+
+void createVariableURL( OUString& rStr, std::u16string_view rLibName,
std::u16string_view rInfoFileName, bool bUser )
 {
 if( bUser )
 {
-rStr = "$(USER)/basic/";
+rStr = sUserBasicVariablePrefix;
 }
 else
 {
@@ -572,6 +576,7 @@ static void createVariableURL( OUString& rStr, 
std::u16string_view rLibName,
 }
 rStr += OUString::Concat(rLibName) + "/" + rInfoFileName + ".xlb/";
 }
+}
 
 void SfxLibraryContainer::init( const OUString& rInitialDocumentURL, const 
uno::Reference< embed::XStorage >& rxInitialStorage )
 {
@@ -1261,6 +1266,11 @@ void SfxLibraryContainer::checkStorageURL( const 
OUString& aSourceURL,
 {
 aUnexpandedStorageURL = aSourceURL;
 }
+else
+{
+aUnexpandedStorageURL.clear();
+}
+
 INetURLObject aInetObj( aExpandedSourceURL );
 OUString aExtension = aInetObj.getExtension();
 if( aExtension == "xlb" )
@@ -2515,9 +2525,18 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const 
OUString& Name, const OU
  INetURLObject::EncodeMechanism::All );
 OUString aDestDirPath = aDestInetObj.GetMainURL( 
INetURLObject::DecodeMechanism::NONE );
 
+OUString aDestDirUnexpandedPath = aDestDirPath;
+if 
(pImplLib->maUnexpandedStorageURL.startsWith(sUserBasicVariablePrefix))
+{
+// try to re-create the variable URL: helps moving the profile
+OUString aUserBasicURL = expand_url(sUserBasicVariablePrefix);
+if (OUString aRest; aDestDirPath.startsWith(aUserBasicURL, ))
+aDestDirUnexpandedPath = sUserBasicVariablePrefix + aRest;
+}
+
 // Store new URL
 OUString aLibInfoFileURL = pImplLib->maLibInfoFileURL;
-checkStorageURL( aDestDirPath, pImplLib->maLibInfoFileURL, 
pImplLib->maStorageURL,
+checkStorageURL(aDestDirUnexpandedPath, pImplLib->maLibInfoFileURL, 
pImplLib->maStorageURL,
  pImplLib->maUnexpandedStorageURL );
 
 try


core.git: basic/source include/tools sc/source tools/source vcl/source

2023-12-10 Thread Mike Kaganski (via logerrit)
 basic/source/classes/image.cxx  |3 +-
 basic/source/runtime/iosys.cxx  |2 -
 include/tools/stream.hxx|   32 ++-
 sc/source/filter/dif/difexp.cxx |2 -
 sc/source/ui/docshell/docsh.cxx |   13 +
 sc/source/ui/docshell/impex.cxx |   54 +++-
 sc/source/ui/inc/impex.hxx  |1 
 tools/source/stream/stream.cxx  |   17 +++-
 vcl/source/filter/wmf/wmfwr.cxx |2 -
 9 files changed, 37 insertions(+), 89 deletions(-)

New commits:
commit 2b4094195eb89d9bfd41908cbb32a8b964efd9fe
Author: Mike Kaganski 
AuthorDate: Sun Dec 10 21:11:32 2023 +0300
Commit: Mike Kaganski 
CommitDate: Mon Dec 11 07:10:31 2023 +0100

Clean up SvStream API a bit

Change-Id: Ic9847185e8f551eeb05715902374d7a9a9032f60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160546
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index ee490947029e..eafb129894ab 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -440,7 +440,8 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
 // old readers will not read this data after having read legacy data, 
and will proceed
 // straight to the end of the record. So no version restriction here.
 r.WriteUInt32(nUnicodeDataMagicNumber);
-write_uInt16s_FromOUString(r, std::u16string_view(pStrings.get(), 
nStringSize));
+r.WriteUnicodeOrByteText(std::u16string_view(pStrings.get(), 
nStringSize),
+ RTL_TEXTENCODING_UNICODE);
 
 SbiCloseRecord( r, nPos );
 }
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index be056aaf61e8..3d03274c46c0 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -562,7 +562,7 @@ namespace
 void WriteLines(SvStream , const OString& rStr)
 {
 OString aStr(convertLineEnd(rStr, rStream.GetLineDelimiter()) );
-write_uInt8s_FromOString(rStream, aStr);
+rStream.WriteBytes(aStr.getStr(), aStr.getLength());
 endl( rStream );
 }
 }
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index a6349c0be066..ad8a90ac70b3 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -364,10 +364,10 @@ public:
  sal_Int32 nMaxCodepointsToRead = 
0xFFFE );
 /** Write a sequence of Unicode characters if
 eDestCharSet==RTL_TEXTENCODING_UNICODE, otherwise write a sequence of
-Bytecodes converted to eDestCharSet */
-boolWriteUnicodeOrByteText(std::u16string_view rStr, 
rtl_TextEncoding eDestCharSet );
-boolWriteUnicodeOrByteText(std::u16string_view rStr )
-{ return WriteUnicodeOrByteText( rStr, GetStreamCharSet() 
); }
+Bytecodes converted to eDestCharSet. Write trailing zero, if bZero is 
true. */
+boolWriteUnicodeOrByteText(std::u16string_view rStr, 
rtl_TextEncoding eDestCharSet, bool bZero = false);
+boolWriteUnicodeOrByteText(std::u16string_view rStr, bool 
bZero = false)
+{ return WriteUnicodeOrByteText(rStr, GetStreamCharSet(), 
bZero); }
 
 /** Write a Unicode character if eDestCharSet==RTL_TEXTENCODING_UNICODE,
 otherwise write as Bytecode converted to eDestCharSet.
@@ -475,17 +475,6 @@ inline OUString 
read_uInt32_lenPrefixed_uInt16s_ToOUString(SvStream& rStrm)
 return read_uInt16s_ToOUString(rStrm, nUnits);
 }
 
-/// Attempt to write a prefixed sequence of nUnits 16bit units from an 
OUString,
-/// returned value is number of bytes written
-TOOLS_DLLPUBLIC std::size_t write_uInt16s_FromOUString(SvStream& rStrm,
-std::u16string_view rStr, std::size_t nUnits);
-
-inline std::size_t write_uInt16s_FromOUString(SvStream& rStrm,
-std::u16string_view rStr)
-{
-return write_uInt16s_FromOUString(rStrm, rStr, rStr.size());
-}
-
 /// Attempt to write a pascal-style length (of type prefix) prefixed sequence
 /// of 16bit units from an OUString, returned value is number of bytes written
 /// (including byte-count of prefix)
@@ -544,19 +533,6 @@ inline OUString 
read_uInt8_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm,
 return OStringToOUString(read_uInt8_lenPrefixed_uInt8s_ToOString(rStrm), 
eEnc);
 }
 
-/// Attempt to write a prefixed sequence of nUnits 8bit units from an OString,
-/// returned value is number of bytes written
-inline std::size_t write_uInt8s_FromOString(SvStream& rStrm, std::string_view 
rStr,
- std::size_t nUnits)
-{
-return rStrm.WriteBytes(rStr.data(), nUnits);
-}
-
-inline std::size_t write_uInt8s_FromOString(SvStream& rStrm, std::string_view 
rStr)
-{
-return write_uInt8s_FromOString(rStrm, rStr, rStr.size());
-}
-
 /// Attempt to write a pascal-style length (of type prefix) 

[Libreoffice-commits] core.git: basic/source

2023-11-20 Thread Stephan Bergmann (via logerrit)
 basic/source/sbx/sbxobj.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 1cb523eee4e61ab7eaff114aae45f38d4d234d10
Author: Stephan Bergmann 
AuthorDate: Mon Nov 20 07:31:42 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Nov 20 09:17:06 2023 +0100

Extended loplugin:ostr: basic

Change-Id: I041913b1fe2722145d770e5cdcf90cdf22957873
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159728
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index d405ff344417..be1aec16393a 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -703,7 +703,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
 OString aClassNameStr(OUStringToOString(aClassName, 
RTL_TEXTENCODING_ASCII_US));
 rStrm.WriteOString( "Object( " )
  .WriteOString( OString::number(reinterpret_cast(this)) 
).WriteOString( "=='" )
- .WriteOString( aNameStr.isEmpty() ? "" : aNameStr 
).WriteOString( "', " )
+ .WriteOString( aNameStr.isEmpty() ? ""_ostr : aNameStr 
).WriteOString( "', " )
  .WriteOString( "of class '" ).WriteOString( aClassNameStr 
).WriteOString( "', " )
  .WriteOString( "counts " )
  .WriteOString( OString::number(GetRefCount()) )
@@ -713,7 +713,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
 OString aParentNameStr(OUStringToOString(GetName(), 
RTL_TEXTENCODING_ASCII_US));
 rStrm.WriteOString( "in parent " )
  .WriteOString( 
OString::number(reinterpret_cast(GetParent())) )
- .WriteOString( "=='" ).WriteOString( aParentNameStr.isEmpty() ? 
"" : aParentNameStr ).WriteOString( "'" );
+ .WriteOString( "=='" ).WriteOString( aParentNameStr.isEmpty() ? 
""_ostr : aParentNameStr ).WriteOString( "'" );
 }
 else
 {


[Libreoffice-commits] core.git: basic/source

2023-10-19 Thread Stephan Bergmann (via logerrit)
 basic/source/basmgr/basicmanagerrepository.cxx |2 +-
 basic/source/basmgr/basmgr.cxx |   12 ++--
 basic/source/classes/sb.cxx|4 ++--
 basic/source/classes/sbunoobj.cxx  |   12 ++--
 basic/source/runtime/runtime.cxx   |2 +-
 basic/source/sbx/sbxform.cxx   |   18 +-
 basic/source/sbx/sbxscan.cxx   |2 +-
 basic/source/uno/dlgcont.cxx   |4 ++--
 8 files changed, 28 insertions(+), 28 deletions(-)

New commits:
commit 625705f10e765b6fa246c016acc9546cb0247301
Author: Stephan Bergmann 
AuthorDate: Thu Oct 19 10:30:04 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Oct 19 15:17:53 2023 +0200

Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: basic

Change-Id: Ic82e02ff43db09174a74f4e584e2ce50e8983556
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158145
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/basmgr/basicmanagerrepository.cxx 
b/basic/source/basmgr/basicmanagerrepository.cxx
index 7a2ed5efd20a..bf0c6ee53a46 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -382,7 +382,7 @@ namespace basic
 try
 {
 // ensure there's a standard library in the basic container
-static constexpr OUStringLiteral aStdLibName( u"Standard" );
+static constexpr OUString aStdLibName( u"Standard"_ustr );
 if ( !_rxBasicLibraries->hasByName( aStdLibName ) )
 {
 _rxBasicLibraries->createLibrary( aStdLibName );
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 6e2ce76d37ae..c619bbf1fb6a 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -88,12 +88,12 @@ typedef WeakImplHelper< script::XStarBasicAccess > 
StarBasicAccessHelper;
 // Version 2
 //  + bool  bReference
 
-constexpr OUStringLiteral szStdLibName = u"Standard";
-constexpr OUStringLiteral szBasicStorage = u"StarBASIC";
-constexpr OUStringLiteral szOldManagerStream = u"BasicManager";
-constexpr OUStringLiteral szManagerStream = u"BasicManager2";
-constexpr OUStringLiteral szImbedded = u"LIBIMBEDDED";
-constexpr OStringLiteral szCryptingKey = "CryptedBasic";
+constexpr OUString szStdLibName = u"Standard"_ustr;
+constexpr OUString szBasicStorage = u"StarBASIC"_ustr;
+constexpr OUString szOldManagerStream = u"BasicManager"_ustr;
+constexpr OUString szManagerStream = u"BasicManager2"_ustr;
+constexpr OUString szImbedded = u"LIBIMBEDDED"_ustr;
+constexpr OString szCryptingKey = "CryptedBasic"_ostr;
 
 
 const StreamMode eStreamReadMode = StreamMode::READ | StreamMode::NOCREATE | 
StreamMode::SHARE_DENYALL;
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 94b1becd04a5..eeef54222647 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -55,7 +55,7 @@
 
 using namespace ::com::sun::star::script;
 
-constexpr OUStringLiteral SB_RTLNAME = u"@SBRTL";
+constexpr OUString SB_RTLNAME = u"@SBRTL"_ustr;
 //  i#i68894#
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -1306,7 +1306,7 @@ SbxVariable* StarBASIC::Find( const OUString& rName, 
SbxClassType t )
 }
 }
 }
-static constexpr OUStringLiteral aMainStr(u"Main");
+static constexpr OUString aMainStr(u"Main"_ustr);
 if( !pRes && pNamed && ( t == SbxClassType::Method || t == 
SbxClassType::DontCare ) &&
 !pNamed->GetName().equalsIgnoreAsciiCase( aMainStr ) )
 {
diff --git a/basic/source/classes/sbunoobj.cxx 
b/basic/source/classes/sbunoobj.cxx
index b9db47dcd306..bf740aaafc0d 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -100,9 +100,9 @@ using namespace cppu;
 
 
 // Identifiers for creating the strings for dbg_Properties
-constexpr OUStringLiteral ID_DBG_SUPPORTEDINTERFACES = 
u"Dbg_SupportedInterfaces";
-constexpr OUStringLiteral ID_DBG_PROPERTIES = u"Dbg_Properties";
-constexpr OUStringLiteral ID_DBG_METHODS = u"Dbg_Methods";
+constexpr OUString ID_DBG_SUPPORTEDINTERFACES = 
u"Dbg_SupportedInterfaces"_ustr;
+constexpr OUString ID_DBG_PROPERTIES = u"Dbg_Properties"_ustr;
+constexpr OUString ID_DBG_METHODS = u"Dbg_Methods"_ustr;
 
 char const aSeqLevelStr[] = "[]";
 
@@ -2743,15 +2743,15 @@ void SbUnoObject::implCreateDbgProperties()
 Property aProp;
 
 // Id == -1: display the implemented interfaces corresponding the 
ClassProvider
-auto xVarRef = tools::make_ref( 
OUString(ID_DBG_SUPPORTEDINTERFACES), SbxSTRING, SbxSTRING, aProp, -1, false, 
false );
+auto xVarRef = tools::make_ref( ID_DBG_SUPPORTEDINTERFACES, 
SbxSTRING, SbxSTRING, aProp, -1, false, false );
 QuickInsert( xVarRef.get() );
 
 // Id == -2: output the properties
-xVarRef = tools::make_ref( OUString(ID_DBG_PROPERTIES), 

[Libreoffice-commits] core.git: basic/source

2023-10-19 Thread Stephan Bergmann (via logerrit)
 basic/source/classes/sb.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 7a349aa4f338982f99675ad4eed9d7474cab1ff0
Author: Stephan Bergmann 
AuthorDate: Wed Oct 18 15:24:13 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Oct 19 09:09:33 2023 +0200

Suppress some upcoming loplugin:ostr OUStringLiteral -> OUString rewrites

...which would not work, as calling constexpr SbxVariable::MakeHashCode on 
those
vars would no longer be constant expressions

Change-Id: Ib848a6405dc270a1a5b9a92084fa2d063ea37892
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158134
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 9d3a7706189c..94b1becd04a5 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1942,9 +1942,13 @@ void StarBASIC::DetachAllDocBasicItems()
 // #118116 Implementation Collection object
 
 
+// [-loplugin:ostr]
 constexpr OUStringLiteral pCountStr = u"Count";
+// [-loplugin:ostr]
 constexpr OUStringLiteral pAddStr = u"Add";
+// [-loplugin:ostr]
 constexpr OUStringLiteral pItemStr = u"Item";
+// [-loplugin:ostr]
 constexpr OUStringLiteral pRemoveStr = u"Remove";
 constexpr sal_uInt16 nCountHash = SbxVariable::MakeHashCode(pCountStr);
 constexpr sal_uInt16 nAddHash = SbxVariable::MakeHashCode(pAddStr);


[Libreoffice-commits] core.git: basic/source

2023-10-13 Thread Aron Budea (via logerrit)
 basic/source/runtime/methods.cxx |   14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

New commits:
commit c4c017d1b8fe30d1ef452782eef71371282deb37
Author: Aron Budea 
AuthorDate: Sat Jul 29 02:16:58 2023 +0200
Commit: Mike Kaganski 
CommitDate: Fri Oct 13 17:04:16 2023 +0200

tdf#147132  tdf#154285 Flatten and check param count of IsMissing fn

Change-Id: I17d79dcedf2b2e1cd45ef2eb82ff5e89a9bb2b46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155028
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 2e84e964d0be..ad3b638805a2 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2433,15 +2433,11 @@ void SbRtl_IsNumeric(StarBASIC *, SbxArray & rPar, bool)
 
 void SbRtl_IsMissing(StarBASIC *, SbxArray & rPar, bool)
 {
-if (rPar.Count() < 2)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else
-{
-// #57915 Missing is reported by an error
-rPar.Get(0)->PutBool(rPar.Get(1)->IsErr());
-}
+if (rPar.Count() != 2)
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+// #57915 Missing is reported by an error
+rPar.Get(0)->PutBool(rPar.Get(1)->IsErr());
 }
 
 // Function looks for wildcards, removes them and always returns the pure path


[Libreoffice-commits] core.git: basic/source

2023-10-07 Thread OmkarAcharekar (via logerrit)
 basic/source/runtime/methods.cxx |   24 
 1 file changed, 8 insertions(+), 16 deletions(-)

New commits:
commit 95df8cda94007e7e5b316a02176bed76259c21c4
Author: OmkarAcharekar 
AuthorDate: Sat Oct 7 12:39:40 2023 +0530
Commit: Ilmari Lauhakangas 
CommitDate: Sat Oct 7 17:40:00 2023 +0200

tdf#147132 Flatten Basic function implementations

Change-Id: I91ab40003011a7c537faa40daf3db85a13946c69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157669
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 8bfb362f98c9..2e84e964d0be 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1046,14 +1046,10 @@ void SbRtl_Log(StarBASIC *, SbxArray & rPar, bool)
 void SbRtl_LTrim(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() < 2)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else
-{
-OUString 
aStr(comphelper::string::stripStart(rPar.Get(1)->GetOUString(), ' '));
-rPar.Get(0)->PutString(aStr);
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+OUString aStr(comphelper::string::stripStart(rPar.Get(1)->GetOUString(), ' 
'));
+rPar.Get(0)->PutString(aStr);
 }
 
 
@@ -1318,14 +1314,10 @@ void SbRtl_RTL(StarBASIC * pBasic, SbxArray & rPar, 
bool)
 void SbRtl_RTrim(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() < 2)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else
-{
-OUString aStr(comphelper::string::stripEnd(rPar.Get(1)->GetOUString(), 
' '));
-rPar.Get(0)->PutString(aStr);
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+OUString aStr(comphelper::string::stripEnd(rPar.Get(1)->GetOUString(), ' 
'));
+rPar.Get(0)->PutString(aStr);
 }
 
 void SbRtl_Sgn(StarBASIC *, SbxArray & rPar, bool)


[Libreoffice-commits] core.git: basic/source

2023-09-20 Thread Arnaud Versini (via logerrit)
 basic/source/runtime/basrdll.cxx |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 08a2de20238e250d5ddf8cc43341a9f48ed9d759
Author: Arnaud Versini 
AuthorDate: Tue Sep 19 16:17:38 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 20 08:07:30 2023 +0200

basic : remove useless allocation in BasicDLLImpl

Change-Id: I8e2628da08cb621087915dcfb4d55ddacfeaabc1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157048
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx
index ba94fd7b9d2b..853863b4fcfd 100644
--- a/basic/source/runtime/basrdll.cxx
+++ b/basic/source/runtime/basrdll.cxx
@@ -37,12 +37,11 @@ struct BasicDLLImpl : public SvRefBase
 boolbDebugMode;
 boolbBreakEnabled;
 
-std::unique_ptr xSbxAppData;
+SbxAppData aSbxAppData;
 
 BasicDLLImpl()
 : bDebugMode(false)
 , bBreakEnabled(true)
-, xSbxAppData(new SbxAppData)
 { }
 
 static BasicDLLImpl* BASIC_DLL;
@@ -69,7 +68,7 @@ BasicDLL::~BasicDLL()
 std::scoped_lock aGuard(BasicDLLImpl::getMutex());
 const bool bLastRef = m_xImpl->GetRefCount() == 1;
 if (bLastRef) {
-BasicDLLImpl::BASIC_DLL->xSbxAppData->m_aGlobErr.clear();
+BasicDLLImpl::BASIC_DLL->aSbxAppData.m_aGlobErr.clear();
 }
 m_xImpl.clear();
 // only reset BASIC_DLL after the object had been destroyed
@@ -122,12 +121,12 @@ void BasicDLL::BasicBreak()
 
 SbxAppData& GetSbxData_Impl()
 {
-return *BasicDLLImpl::BASIC_DLL->xSbxAppData;
+return BasicDLLImpl::BASIC_DLL->aSbxAppData;
 }
 
 bool IsSbxData_Impl()
 {
-return BasicDLLImpl::BASIC_DLL && BasicDLLImpl::BASIC_DLL->xSbxAppData;
+return BasicDLLImpl::BASIC_DLL;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: basic/source connectivity/source hwpfilter/source linguistic/source sax/source sc/source sd/source sfx2/source starmath/source stoc/source svtools/source svx/source sw/

2023-09-10 Thread Noel Grandin (via logerrit)
 basic/source/runtime/iosys.cxx   |2 
 basic/source/runtime/methods.cxx |   14 ++---
 connectivity/source/cpool/ZConnectionPool.cxx|2 
 connectivity/source/drivers/mysqlc/mysqlc_driver.cxx |5 --
 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx |6 --
 hwpfilter/source/hwpreader.hxx   |   18 +++
 linguistic/source/hhconvdic.cxx  |5 --
 sax/source/expatwrap/sax_expat.cxx   |2 
 sax/source/expatwrap/saxwriter.cxx   |4 -
 sax/source/expatwrap/xml2utf.cxx |6 +-
 sc/source/core/tool/token.cxx|3 -
 sc/source/filter/oox/formulabuffer.cxx   |5 --
 sc/source/ui/dbgui/dapidata.cxx  |4 -
 sc/source/ui/docshell/docsh4.cxx |4 -
 sc/source/ui/unoobj/nameuno.cxx  |8 +--
 sc/source/ui/view/tabvwshg.cxx   |4 -
 sd/source/filter/html/HtmlOptionsDialog.cxx  |6 +-
 sd/source/ui/view/drtxtob.cxx|5 +-
 sd/source/ui/view/outlnvsh.cxx   |9 +--
 sfx2/source/appl/appmisc.cxx |6 +-
 sfx2/source/doc/doctempl.cxx |   25 
--
 sfx2/source/doc/objserv.cxx  |6 +-
 sfx2/source/view/viewfrm.cxx |   21 

 sfx2/source/view/viewsh.cxx  |7 +-
 starmath/source/document.cxx |6 +-
 stoc/source/corereflection/crefl.cxx |5 --
 svtools/source/dialogs/insdlg.cxx|4 -
 svx/source/form/fmpage.cxx   |4 -
 svx/source/form/fmundo.cxx   |8 +--
 svx/source/svdraw/svdouno.cxx|   12 
 svx/source/unodraw/UnoGraphicExporter.cxx|5 --
 sw/source/core/text/porlay.cxx   |6 +-
 sw/source/filter/ww8/ww8par.cxx  |   10 ++--
 sw/source/ui/config/optload.cxx  |2 
 sw/source/ui/index/cnttab.cxx|2 
 sw/source/uibase/shells/textsh.cxx   |4 -
 sw/source/uibase/uiview/view0.cxx|4 -
 ucb/source/ucp/file/filprp.cxx   |3 -
 unotools/source/config/configitem.cxx|5 --
 uui/source/secmacrowarnings.cxx  |3 -
 vcl/source/app/settings.cxx  |4 -
 vcl/unx/generic/fontmanager/fontconfig.cxx   |3 -
 winaccessibility/source/service/AccFrameEventListener.cxx|6 +-
 winaccessibility/source/service/msaaservice_impl.cxx |4 -
 44 files changed, 124 insertions(+), 153 deletions(-)

New commits:
commit e23d2be0ce41ea0a1f6d3d58d626a546c25cb516
Author: Noel Grandin 
AuthorDate: Sun Sep 10 18:46:44 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Sep 10 20:43:05 2023 +0200

using decls should come after #include

Change-Id: I058551e87bca42adede860f6f299b0f7ae2af3b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156798
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 705905acfce7..be056aaf61e8 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
@@ -44,7 +45,6 @@ using namespace com::sun::star::ucb;
 using namespace com::sun::star::io;
 using namespace com::sun::star::bridge;
 
-#include 
 
 namespace {
 
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 0c01e31126f1..8bfb362f98c9 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -74,14 +74,6 @@
 #include 
 #include 
 
-
-
-using namespace comphelper;
-using namespace osl;
-using namespace com::sun::star;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::uno;
-
 #include 
 #include 
 #include 
@@ -111,6 +103,12 @@ using namespace com::sun::star::uno;
 
 #include 
 
+using namespace comphelper;
+using namespace osl;
+using namespace com::sun::star;
+using namespace com::sun::star::lang;
+using namespace 

[Libreoffice-commits] core.git: basic/source comphelper/source embedserv/source oox/source scripting/source sc/source sdext/source sd/source sfx2/source sot/source svtools/source svx/source sw/source

2023-08-25 Thread Noel Grandin (via logerrit)
 basic/source/classes/sbxmod.cxx |4 
 comphelper/source/container/embeddedobjectcontainer.cxx |6 -
 comphelper/source/misc/instancelocker.cxx   |7 +
 comphelper/source/misc/storagehelper.cxx|4 
 embedserv/source/embed/docholder.cxx|   31 ++-
 oox/source/drawingml/chart/converterbase.cxx|8 +
 oox/source/ole/oleobjecthelper.cxx  |8 +
 oox/source/ole/vbamodule.cxx|8 +
 sc/source/filter/excel/xichart.cxx  |   13 ++-
 sc/source/filter/ftools/fapihelper.cxx  |4 
 sc/source/filter/oox/numberformatsbuffer.cxx|8 +
 sc/source/filter/oox/pivotcachebuffer.cxx   |8 +
 sc/source/filter/oox/pivottablebuffer.cxx   |8 +
 sc/source/filter/oox/worksheethelper.cxx|9 +-
 sc/source/filter/xml/xmlwrap.cxx|   11 +-
 sc/source/ui/docshell/docsh.cxx |8 +
 sc/source/ui/docshell/docsh4.cxx|8 +
 sc/source/ui/vba/vbaeventshelper.cxx|   16 +++
 scripting/source/vbaevents/eventhelper.cxx  |9 +-
 sd/source/console/PresenterHelper.cxx   |   15 ++-
 sd/source/console/PresenterScreen.cxx   |4 
 sd/source/console/PresenterSlideShowView.cxx|4 
 sd/source/core/stlsheet.cxx |6 -
 sd/source/filter/eppt/epptso.cxx|8 -
 sd/source/ui/annotations/annotationmanager.cxx  |   22 -
 sd/source/ui/slideshow/slideshowviewimpl.cxx|7 -
 sdext/source/minimizer/impoptimizer.cxx |   18 +---
 sdext/source/minimizer/optimizationstats.cxx|6 -
 sfx2/source/dialog/filedlghelper.cxx|7 +
 sfx2/source/doc/objmisc.cxx |4 
 sfx2/source/doc/objstor.cxx |   66 ++--
 sot/source/unoolestorage/xolesimplestorage.cxx  |7 +
 svtools/source/misc/bindablecontrolhelper.cxx   |6 -
 svx/source/smarttags/SmartTagMgr.cxx|   26 --
 svx/source/tbxctrls/tbcontrl.cxx|8 +
 svx/source/xml/xmlxtimp.cxx |8 +
 sw/source/core/ole/ndole.cxx|   10 --
 sw/source/core/swg/SwXMLTextBlocks.cxx  |8 -
 sw/source/core/unocore/unochart.cxx |9 +-
 sw/source/filter/xml/wrtxml.cxx |5 -
 toolkit/source/controls/grid/gridcontrol.cxx|9 +-
 toolkit/source/hatchwindow/documentcloser.cxx   |9 +-
 unotools/source/config/confignode.cxx   |9 +-
 unotools/source/config/lingucfg.cxx |8 -
 unotools/source/config/useroptions.cxx  |8 +
 vbahelper/source/msforms/vbauserform.cxx|6 +
 vbahelper/source/vbahelper/vbacolorformat.cxx   |8 +
 vbahelper/source/vbahelper/vbadocumentbase.cxx  |   13 ++-
 vbahelper/source/vbahelper/vbadocumentsbase.cxx |   31 ---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx   |6 +
 writerfilter/source/dmapper/ModelEventListener.cxx  |   10 +-
 writerfilter/source/dmapper/OLEHandler.cxx  |4 
 xmloff/source/chart/SchXMLTableContext.cxx  |8 -
 xmloff/source/core/XMLEmbeddedObjectImportContext.cxx   |   14 ++-
 54 files changed, 408 insertions(+), 167 deletions(-)

New commits:
commit 87db52ab1e9c39ad8319aaf9c0c59d4435b6ffb5
Author: Noel Grandin 
AuthorDate: Fri Aug 25 11:30:42 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 25 14:15:56 2023 +0200

Revert "use more Reference::query instead of UNO_QUERY_THROW"

This reverts commit 7fc6063914432d58d86cfcbd728d967e7c86ebfd.

sberg noticed that there is a difference now:

there's a subtle difference now, in that if  y  was null originally, it 
would have thrown a (caught) exception, whereas now it will crash in the  
y.query()  call.

Change-Id: Idbb5a08d635d15b5ca63f4822eddf05fb0a5afa0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156002
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 020f3814ec8c..15e4719569ba 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -395,8 +395,8 @@ static uno::Reference< vba::XVBACompatibility > 
getVBACompatibility( const uno::
 uno::Reference< vba::XVBACompatibility > xVBACompat;
 try
 {
-if (auto xModelProps = rxModel.query() )
-xVBACompat.set( xModelProps->getPropertyValue( "BasicLibraries" ), 
uno::UNO_QUERY );
+uno::Reference< beans::XPropertySet > xModelProps( 

[Libreoffice-commits] core.git: basic/source comphelper/source embedserv/source oox/source scripting/source sc/source sdext/source sd/source sfx2/source sot/source svtools/source svx/source sw/source

2023-08-18 Thread Noel Grandin (via logerrit)
 basic/source/classes/sbxmod.cxx |4 
 comphelper/source/container/embeddedobjectcontainer.cxx |6 -
 comphelper/source/misc/instancelocker.cxx   |7 -
 comphelper/source/misc/storagehelper.cxx|4 
 embedserv/source/embed/docholder.cxx|   31 ---
 oox/source/drawingml/chart/converterbase.cxx|8 -
 oox/source/ole/oleobjecthelper.cxx  |8 -
 oox/source/ole/vbamodule.cxx|8 -
 sc/source/filter/excel/xichart.cxx  |   13 ---
 sc/source/filter/ftools/fapihelper.cxx  |4 
 sc/source/filter/oox/numberformatsbuffer.cxx|8 -
 sc/source/filter/oox/pivotcachebuffer.cxx   |8 -
 sc/source/filter/oox/pivottablebuffer.cxx   |8 -
 sc/source/filter/oox/worksheethelper.cxx|9 --
 sc/source/filter/xml/xmlwrap.cxx|   11 +-
 sc/source/ui/docshell/docsh.cxx |8 -
 sc/source/ui/docshell/docsh4.cxx|8 -
 sc/source/ui/vba/vbaeventshelper.cxx|   16 ---
 scripting/source/vbaevents/eventhelper.cxx  |9 --
 sd/source/console/PresenterHelper.cxx   |   15 ---
 sd/source/console/PresenterScreen.cxx   |4 
 sd/source/console/PresenterSlideShowView.cxx|4 
 sd/source/core/stlsheet.cxx |6 -
 sd/source/filter/eppt/epptso.cxx|8 -
 sd/source/ui/annotations/annotationmanager.cxx  |   22 -
 sd/source/ui/slideshow/slideshowviewimpl.cxx|7 -
 sdext/source/minimizer/impoptimizer.cxx |   18 ++--
 sdext/source/minimizer/optimizationstats.cxx|6 -
 sfx2/source/dialog/filedlghelper.cxx|7 -
 sfx2/source/doc/objmisc.cxx |4 
 sfx2/source/doc/objstor.cxx |   66 +---
 sot/source/unoolestorage/xolesimplestorage.cxx  |7 -
 svtools/source/misc/bindablecontrolhelper.cxx   |6 -
 svx/source/smarttags/SmartTagMgr.cxx|   26 +-
 svx/source/tbxctrls/tbcontrl.cxx|8 -
 svx/source/xml/xmlxtimp.cxx |8 -
 sw/source/core/ole/ndole.cxx|   10 +-
 sw/source/core/swg/SwXMLTextBlocks.cxx  |8 +
 sw/source/core/unocore/unochart.cxx |9 --
 sw/source/filter/xml/wrtxml.cxx |5 -
 toolkit/source/controls/grid/gridcontrol.cxx|9 --
 toolkit/source/hatchwindow/documentcloser.cxx   |9 --
 unotools/source/config/confignode.cxx   |9 --
 unotools/source/config/lingucfg.cxx |8 +
 unotools/source/config/useroptions.cxx  |8 -
 vbahelper/source/msforms/vbauserform.cxx|6 -
 vbahelper/source/vbahelper/vbacolorformat.cxx   |8 -
 vbahelper/source/vbahelper/vbadocumentbase.cxx  |   13 ---
 vbahelper/source/vbahelper/vbadocumentsbase.cxx |   31 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx   |6 -
 writerfilter/source/dmapper/ModelEventListener.cxx  |   10 --
 writerfilter/source/dmapper/OLEHandler.cxx  |4 
 xmloff/source/chart/SchXMLTableContext.cxx  |8 +
 xmloff/source/core/XMLEmbeddedObjectImportContext.cxx   |   14 ---
 54 files changed, 167 insertions(+), 408 deletions(-)

New commits:
commit 7fc6063914432d58d86cfcbd728d967e7c86ebfd
Author: Noel Grandin 
AuthorDate: Thu Aug 17 15:42:01 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 18 11:03:02 2023 +0200

use more Reference::query instead of UNO_QUERY_THROW

since querying with exceptions is consideably more expensive

Change-Id: I968a9a40766b2abb0d3058549b0ed44011fd5716
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155791
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 15e4719569ba..020f3814ec8c 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -395,8 +395,8 @@ static uno::Reference< vba::XVBACompatibility > 
getVBACompatibility( const uno::
 uno::Reference< vba::XVBACompatibility > xVBACompat;
 try
 {
-uno::Reference< beans::XPropertySet > xModelProps( rxModel, 
uno::UNO_QUERY_THROW );
-xVBACompat.set( xModelProps->getPropertyValue( "BasicLibraries" ), 
uno::UNO_QUERY );
+if (auto xModelProps = rxModel.query() )
+xVBACompat.set( xModelProps->getPropertyValue( "BasicLibraries" ), 
uno::UNO_QUERY );
 }
 catch(const uno::Exception& )
 {
diff --git 

[Libreoffice-commits] core.git: basic/source

2023-08-09 Thread sahil (via logerrit)
 basic/source/runtime/methods.cxx |   36 
 1 file changed, 12 insertions(+), 24 deletions(-)

New commits:
commit a00cf4bc779b1da85423371fec43f8638c77e423
Author: sahil 
AuthorDate: Fri Jul 28 15:22:40 2023 +0530
Commit: Hossein 
CommitDate: Wed Aug 9 09:58:21 2023 +0200

tdf#147132 Flatten Basic function implementations

Change-Id: I0ba6e7c1e128f3216eb3b77246c659a728df1324
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155011
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 986860c935a3..0c01e31126f1 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -379,16 +379,12 @@ void SbRtl_CurDir(StarBASIC *, SbxArray & rPar, bool)
 {
 OUString aDrive = rPar.Get(1)->GetOUString();
 if ( aDrive.getLength() != 1 )
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-return;
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
 auto c = rtl::toAsciiUpperCase(aDrive[0]);
 if ( !rtl::isAsciiUpperCase( c ) )
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-return;
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
 nCurDir = c - 'A' + 1;
 }
 wchar_t pBuffer[ _MAX_PATH ];
@@ -398,14 +394,10 @@ void SbRtl_CurDir(StarBASIC *, SbxArray & rPar, bool)
 auto const handler = 
_set_thread_local_invalid_parameter_handler();
 auto const ok = _wgetdcwd( nCurDir, pBuffer, _MAX_PATH ) != nullptr;
 _set_thread_local_invalid_parameter_handler(handler);
-if ( ok )
-{
-rPar.Get(0)->PutString(OUString(o3tl::toU(pBuffer)));
-}
-else
-{
-StarBASIC::Error( ERRCODE_BASIC_NO_DEVICE );
-}
+if ( !ok )
+return StarBASIC::Error( ERRCODE_BASIC_NO_DEVICE );
+
+rPar.Get(0)->PutString(OUString(o3tl::toU(pBuffer)));
 
 #else
 
@@ -417,20 +409,16 @@ void SbRtl_CurDir(StarBASIC *, SbxArray & rPar, bool)
 {
 pMem.reset(new char[nSize]);
 if( !pMem )
-{
-StarBASIC::Error( ERRCODE_BASIC_NO_MEMORY );
-return;
-}
+return StarBASIC::Error( ERRCODE_BASIC_NO_MEMORY );
+
 if( getcwd( pMem.get(), nSize-1 ) != nullptr )
 {
 rPar.Get(0)->PutString(OUString::createFromAscii(pMem.get()));
 return;
 }
 if( errno != ERANGE )
-{
-StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR );
-return;
-}
+return StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR );
+
 nSize += PATH_INCR;
 };
 


[Libreoffice-commits] core.git: basic/source include/basic sfx2/source uui/inc uui/source

2023-07-24 Thread Andreas Heinisch (via logerrit)
 basic/source/basmgr/basmgr.cxx  |   13 +
 basic/source/classes/image.cxx  |   40 +---
 basic/source/classes/sbxmod.cxx |4 ++--
 basic/source/inc/filefmt.hxx|1 -
 basic/source/inc/image.hxx  |1 +
 basic/source/uno/scriptcont.cxx |2 +-
 include/basic/basmgr.hxx|6 +++---
 include/basic/sbmod.hxx |2 +-
 sfx2/source/appl/appbaslib.cxx  |4 ++--
 sfx2/source/doc/objstor.cxx |2 +-
 sfx2/source/inc/appbaslib.hxx   |2 +-
 uui/inc/ids.hrc |2 +-
 uui/source/iahndl.cxx   |   16 +++-
 13 files changed, 30 insertions(+), 65 deletions(-)

New commits:
commit 17154ceafe4b96b43fdc9994736e378d6a11f3e4
Author: Andreas Heinisch 
AuthorDate: Wed Mar 29 12:01:07 2023 +0200
Commit: Andreas Heinisch 
CommitDate: Mon Jul 24 13:55:28 2023 +0200

tdf#92620 - Adjust error message about exceeding legacy module size

Adjusted the error message about exceeding legacy module size and
removed the code for saving image version 11. Modules using image
version 11 still can be loaded. Saving modules always result in
an image version higher than image version 11 depending on the
size of the module.

In addition, some minor performance issues (construction of the error
message and the correct list of modules) were fixed.

Change-Id: I3bde9fcc1596b63446193c836fa7b5cb06eb7d97
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149687
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 206b917b7edd..f7a4fb2ae192 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1390,7 +1390,7 @@ void BasicManager::SetGlobalUNOConstant( const OUString& 
rName, const uno::Any&
 pStandardLib->Insert( xUnoObj.get() );
 }
 
-bool BasicManager::LegacyPsswdBinaryLimitExceeded( std::vector< OUString >& 
_out_rModuleNames )
+bool BasicManager::ImgVersion12PsswdBinaryLimitExceeded( std::vector< OUString 
>& _out_rModuleNames )
 {
 try
 {
@@ -1409,19 +1409,16 @@ bool BasicManager::LegacyPsswdBinaryLimitExceeded( 
std::vector< OUString >& _out
 
 uno::Reference< container::XNameAccess > xScriptLibrary( 
xScripts->getByName( scriptElementName ), uno::UNO_QUERY_THROW );
 const uno::Sequence< OUString > aElementNames( 
xScriptLibrary->getElementNames() );
-sal_Int32 nLen = aElementNames.getLength();
-
-std::vector< OUString > aBigModules( nLen );
-sal_Int32 nBigModules = 0;
 
+std::vector aBigModules;
 for ( auto const & libraryElementName : aElementNames )
 {
 SbModule* pMod = pBasicLib->FindModule( libraryElementName );
-if ( pMod && pMod->ExceedsLegacyModuleSize() )
-aBigModules[ nBigModules++ ] = libraryElementName;
+if ( pMod && pMod->ExceedsImgVersion12ModuleSize() )
+aBigModules.push_back(libraryElementName);
 }
 
-if ( nBigModules )
+if (!aBigModules.empty())
 {
 _out_rModuleNames.swap(aBigModules);
 return true;
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index eab5fe9e0905..ee490947029e 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -373,31 +373,13 @@ done:
 
 bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
 {
-bool bLegacy = ( nVer < B_IMG_VERSION_12 );
-
-// detect if old code exceeds legacy limits
-// if so, then disallow save
-if ( bLegacy && ExceedsLegacyLimits() )
-{
-SbiImage aEmptyImg;
-aEmptyImg.aName = aName;
-aEmptyImg.Save( r, B_IMG_VERSION_11 );
-return true;
-}
 // First of all the header
 sal_uInt64 nStart = SbiOpenRecord( r, FileOffset::Module, 1 );
 sal_uInt64 nPos;
 
 eCharSet = GetSOStoreTextEncoding( eCharSet );
-if ( bLegacy )
-{
-r.WriteInt32( B_IMG_VERSION_11 );
-}
-else
-{
-r.WriteInt32( nVer );
-}
-r .WriteInt32( eCharSet )
+r .WriteInt32( nVer )
+  .WriteInt32( eCharSet )
   .WriteInt32( nDimBase )
   .WriteInt16( static_cast(nFlags) )
   .WriteInt16( 0 )
@@ -429,17 +411,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
 if (aCode.size() && r.good())
 {
 nPos = SbiOpenRecord( r, FileOffset::PCode, 1 );
-if ( bLegacy )
-{
-PCodeBuffConvertor 
aNewToLegacy(aCode.data(), aCode.size());
-aNewToLegacy.convert();
-aLegacyPCode = aNewToLegacy.GetBuffer();
-r.WriteBytes(aLegacyPCode.data(), aLegacyPCode.size());
-}
-else
-{
-r.WriteBytes(aCode.data(), aCode.size());
-}
+r.WriteBytes(aCode.data(), 

[Libreoffice-commits] core.git: basic/source

2023-07-23 Thread Caolán McNamara (via logerrit)
 basic/source/sbx/sbxform.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit d28ba797dfb804e020e1cd8be5505f31b2adb74a
Author: Caolán McNamara 
AuthorDate: Sun Jul 23 10:55:28 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jul 23 15:04:29 2023 +0200

nDigitPos no longer appears in expression

so presumably we no longer need this suppression since:

commit d969715fa4df9de762c652a7af27601fa75fb275
Date:   Wed Jul 19 22:29:35 2023 +0200

Simplify a bit by removing a redundant condition

line 627 already contains: if( nMaxDigit > nDigitPos )

Change-Id: If6ff93f91f5bd20a9a03ed828d6f4e598ff4f3da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154804
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index 02bc6a01a8fd..e616a1878910 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -634,7 +634,6 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
 {
 bFirstDigit = false;
 }
-// coverity[copy_paste_error : FALSE] - this is 
correct and nDigitPos should not be j
 if( bGenerateThousandSeparator && c=='0' && j > 0 
&& (j % 3 == 0) )
 {
 sReturnStrg.append(cThousandSep );


[Libreoffice-commits] core.git: basic/source

2023-07-20 Thread Julien Nabet (via logerrit)
 basic/source/sbx/sbxform.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d969715fa4df9de762c652a7af27601fa75fb275
Author: Julien Nabet 
AuthorDate: Wed Jul 19 22:29:35 2023 +0200
Commit: Julien Nabet 
CommitDate: Thu Jul 20 09:10:06 2023 +0200

Simplify a bit by removing a redundant condition

line 627 already contains: if( nMaxDigit > nDigitPos )

so here we know that nMaxDigit >= nDigitPos

Change-Id: Ia7ed69e19a6567a5947edaa57f687bf97476a616
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154661
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index e97524a019e3..02bc6a01a8fd 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -635,7 +635,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
 bFirstDigit = false;
 }
 // coverity[copy_paste_error : FALSE] - this is 
correct and nDigitPos should not be j
-if( bGenerateThousandSeparator && ( c=='0' || 
nMaxDigit >= nDigitPos ) && j > 0 && (j % 3 == 0) )
+if( bGenerateThousandSeparator && c=='0' && j > 0 
&& (j % 3 == 0) )
 {
 sReturnStrg.append(cThousandSep );
 }


[Libreoffice-commits] core.git: basic/source chart2/source comphelper/source compilerplugins/clang connectivity/qa connectivity/source cpputools/source cui/source dbaccess/qa dbaccess/source desktop/s

2023-06-26 Thread Noel Grandin (via logerrit)
 basic/source/classes/sb.cxx  |
2 
 basic/source/sbx/sbxscan.cxx |
4 
 chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx  |
2 
 chart2/source/controller/dialogs/tp_DataSource.cxx   |
4 
 chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx |
4 
 chart2/source/model/template/PieChartTypeTemplate.cxx|
2 
 chart2/source/tools/InternalDataProvider.cxx |
2 
 chart2/source/tools/ObjectIdentifier.cxx |
8 -
 chart2/source/tools/RegressionCurveHelper.cxx|
2 
 chart2/source/tools/StatisticsHelper.cxx |
2 
 chart2/source/tools/UncachedDataSequence.cxx |
2 
 chart2/source/view/axes/VCartesianAxis.cxx   |
2 
 chart2/source/view/main/VLegend.cxx  |
2 
 comphelper/source/misc/backupfilehelper.cxx  |
6 
 compilerplugins/clang/constexprliteral.cxx   |   
68 
 compilerplugins/clang/test/constexprliteral.cxx  |   
24 +++
 connectivity/qa/connectivity/ado/DriverTest.cxx  |
6 
 connectivity/source/commontools/dbtools.cxx  |
2 
 connectivity/source/commontools/formattedcolumnvalue.cxx |
2 
 connectivity/source/commontools/statementcomposer.cxx|
4 
 connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx |
2 
 connectivity/source/drivers/hsqldb/HDriver.cxx   |
4 
 cpputools/source/unoexe/unoexe.cxx   |
2 
 cui/source/dialogs/hlmarkwn.cxx  |
6 
 cui/source/tabpages/chardlg.cxx  |
2 
 dbaccess/qa/extras/dialog-save.cxx   |
2 
 dbaccess/qa/extras/empty-stdlib-save.cxx |
2 
 dbaccess/qa/extras/nolib-save.cxx|
2 
 dbaccess/source/core/api/FilteredContainer.cxx   |
6 
 dbaccess/source/core/recovery/subcomponentrecovery.cxx   |
2 
 dbaccess/source/filter/xml/xmlExport.cxx |
2 
 dbaccess/source/ui/dlg/DbAdminImpl.cxx   |
2 
 dbaccess/source/ui/dlg/queryorder.cxx|
4 
 desktop/source/app/crashreport.cxx   |
4 
 desktop/source/deployment/registry/help/dp_help.cxx  |
2 
 desktop/source/deployment/registry/package/dp_package.cxx|
6 
 desktop/source/lib/init.cxx  |
2 
 desktop/source/migration/migration.cxx   |   
18 +-
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx   |
2 
 editeng/source/misc/unolingu.cxx |
2 
 editeng/source/xml/xmltxtexp.cxx |
2 
 editeng/source/xml/xmltxtimp.cxx |
2 
 embeddedobj/source/commonembedding/persistence.cxx   |
2 
 extensions/source/abpilot/fieldmappingimpl.cxx   |
4 
 filter/source/msfilter/escherex.cxx  |   
18 +-
 filter/source/msfilter/msdffimp.cxx  |   
12 -
 filter/source/pdf/pdfexport.cxx  |
4 
 filter/source/svg/svgwriter.cxx  |
8 -
 filter/source/xsltdialog/typedetectionexport.cxx |   
34 ++--
 forms/source/component/Columns.cxx   |
4 
 fpicker/source/office/iodlg.cxx  |
2 
 fpicker/source/win32/workbench/Test_fps.cxx  |
2 
 framework/source/accelerators/acceleratorconfiguration.cxx   |
2 
 framework/source/fwe/classes/addonsoptions.cxx   |
8 -
 framework/source/uielement/fontmenucontroller.cxx|
2 
 framework/source/uielement/fontsizemenucontroller.cxx|
2 
 framework/source/uielement/headermenucontroller.cxx  |
4 
 framework/source/uielement/langselectionmenucontroller.cxx   |
2 
 framework/source/uielement/langselectionstatusbarcontroller.cxx  |
2 
 framework/source/uielement/macrosmenucontroller.cxx  |

[Libreoffice-commits] core.git: basic/source

2023-06-18 Thread Mike Kaganski (via logerrit)
 basic/source/basmgr/basmgr.cxx|4 +--
 basic/source/classes/propacc.cxx  |   33 +
 basic/source/classes/sbunoobj.cxx |2 -
 basic/source/classes/sbxmod.cxx   |2 -
 basic/source/uno/dlgcont.cxx  |8 +++
 basic/source/uno/namecont.cxx |   42 +++---
 basic/source/uno/scriptcont.cxx   |4 +--
 7 files changed, 46 insertions(+), 49 deletions(-)

New commits:
commit 8da305acc9bc1fa0a31cd61d5da632e6bb4ae48c
Author: Mike Kaganski 
AuthorDate: Sun Apr 23 20:12:58 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Jun 18 09:34:24 2023 +0200

Use getXWeak in basic

Change-Id: I0915360548ccc02d731eb915b5d32508cedd1461
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150835
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index c00221f27a12..206b917b7edd 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1735,7 +1735,7 @@ void ModuleContainer_Impl::insertByName( const OUString& 
aName, const uno::Any&
 const uno::Type& aAnyType = aElement.getValueType();
 if( aModuleType != aAnyType )
 {
-throw lang::IllegalArgumentException("types do not match", 
static_cast(this), 2);
+throw lang::IllegalArgumentException("types do not match", getXWeak(), 
2);
 }
 uno::Reference< script::XStarBasicModuleInfo > xMod;
 aElement >>= xMod;
@@ -1899,7 +1899,7 @@ void DialogContainer_Impl::insertByName( const OUString&, 
const uno::Any& aEleme
 const uno::Type& aAnyType = aElement.getValueType();
 if( aModuleType != aAnyType )
 {
-throw lang::IllegalArgumentException("types do not match", 
static_cast(this), 2);
+throw lang::IllegalArgumentException("types do not match", getXWeak(), 
2);
 }
 uno::Reference< script::XStarBasicDialogInfo > xMod;
 aElement >>= xMod;
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index 4c948c3038af..f9eacc3d1298 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -129,7 +129,7 @@ Sequence< PropertyValue > 
SbPropertyValues::getPropertyValues()
 void SbPropertyValues::setPropertyValues(const Sequence< PropertyValue >& 
rPropertyValues )
 {
 if (!m_aPropVals.empty())
-throw IllegalArgumentException("m_aPropVals not empty", 
static_cast(this), -1);
+throw IllegalArgumentException("m_aPropVals not empty", getXWeak(), 
-1);
 
 for (const PropertyValue& i : rPropertyValues)
 {
@@ -150,26 +150,23 @@ void RTL_Impl_CreatePropertySet( SbxArray& rPar )
 
 // Get class names of struct
 
-Reference< XInterface > xInterface = static_cast(new 
SbPropertyValues());
+Reference xInterface(getXWeak(new SbPropertyValues()));
 
 SbxVariableRef refVar = rPar.Get(0);
-if( xInterface.is() )
+// Set PropertyValues
+Any aArgAsAny = sbxToUnoValue(rPar.Get(1),
+cppu::UnoType>::get() );
+auto pArg = o3tl::doAccess>(aArgAsAny);
+Reference< XPropertyAccess > xPropAcc( xInterface, UNO_QUERY );
+xPropAcc->setPropertyValues( *pArg );
+
+// Build a SbUnoObject and return it
+auto xUnoObj = tools::make_ref( 
"stardiv.uno.beans.PropertySet", Any(xInterface) );
+if( xUnoObj->getUnoAny().hasValue() )
 {
-// Set PropertyValues
-Any aArgAsAny = sbxToUnoValue(rPar.Get(1),
-cppu::UnoType>::get() );
-auto pArg = o3tl::doAccess>(aArgAsAny);
-Reference< XPropertyAccess > xPropAcc( xInterface, UNO_QUERY );
-xPropAcc->setPropertyValues( *pArg );
-
-// Build a SbUnoObject and return it
-auto xUnoObj = tools::make_ref( 
"stardiv.uno.beans.PropertySet", Any(xInterface) );
-if( xUnoObj->getUnoAny().hasValue() )
-{
-// Return object
-refVar->PutObject( xUnoObj.get() );
-return;
-}
+// Return object
+refVar->PutObject( xUnoObj.get() );
+return;
 }
 
 // Object could not be created
diff --git a/basic/source/classes/sbunoobj.cxx 
b/basic/source/classes/sbunoobj.cxx
index 36feb923a6de..b9db47dcd306 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -3960,7 +3960,7 @@ Any SAL_CALL InvocationToAllListenerMapper::invoke(const 
OUString& FunctionName,
 }
 
 AllEventObject aAllEvent;
-aAllEvent.Source = static_cast(this);
+aAllEvent.Source = getXWeak();
 aAllEvent.Helper = m_Helper;
 aAllEvent.ListenerType = Type(m_xListenerType->getTypeClass(), 
m_xListenerType->getName() );
 aAllEvent.MethodName = FunctionName;
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index cce2caca22b4..5b7ee24e1f9c 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -165,7 +165,7 @@ DocObjectWrapper::DocObjectWrapper( SbModule* 

[Libreoffice-commits] core.git: basic/source chart2/source comphelper/source configmgr/source connectivity/source editeng/source extensions/source fpicker/source framework/source sc/source sd/source s

2023-05-25 Thread Noel Grandin (via logerrit)
 basic/source/uno/namecont.cxx |5 -
 chart2/source/tools/ObjectIdentifier.cxx  |8 +-
 chart2/source/tools/PotentialRegressionCurveCalculator.cxx|4 -
 comphelper/source/misc/errcode.cxx|4 -
 configmgr/source/data.cxx |3 
 connectivity/source/drivers/dbase/DIndex.cxx  |3 
 editeng/source/accessibility/AccessibleStaticTextBase.cxx |3 
 extensions/source/abpilot/abpfinalpage.cxx|4 -
 extensions/source/scanner/sanedlg.cxx |8 +-
 fpicker/source/office/fileview.cxx|7 +
 framework/source/fwe/classes/addonsoptions.cxx|7 -
 sc/source/core/tool/chartarr.cxx  |7 -
 sc/source/core/tool/dbdata.cxx|9 --
 sc/source/filter/html/htmlexp2.cxx|   14 +--
 sc/source/ui/miscdlgs/solveroptions.cxx   |   16 ++--
 sd/source/filter/html/htmlex.cxx  |   15 +---
 sfx2/source/appl/sfxhelp.cxx  |   10 +-
 sfx2/source/control/listview.cxx  |8 +-
 sfx2/source/devtools/ObjectInspectorTreeHandler.cxx   |4 -
 sfx2/source/dialog/StyleList.cxx  |3 
 stoc/source/implementationregistration/implreg.cxx|6 -
 stoc/source/uriproc/UriReferenceFactory.cxx   |   36 
+++---
 stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx |3 
 svtools/source/svhtml/htmlout.cxx |   12 +--
 sw/source/core/doc/doc.cxx|   14 +--
 sw/source/core/undo/unins.cxx |   32 

 sw/source/filter/ww8/rtfattributeoutput.cxx   |   10 +-
 sw/source/filter/ww8/wrtw8nds.cxx |   13 ++-
 sw/source/filter/xml/xmltble.cxx  |7 -
 sw/source/uibase/docvw/edtwin2.cxx|4 -
 sw/source/uibase/uiview/srcview.cxx   |   17 ++--
 sw/source/uibase/uiview/view2.cxx |3 
 ucb/source/core/ucbstore.cxx  |   31 

 ucb/source/ucp/hierarchy/hierarchycontent.cxx |7 -
 ucb/source/ucp/package/pkgcontent.cxx |7 -
 xmloff/source/core/xmlexp.cxx |5 -
 xmloff/source/style/xmlexppr.cxx  |8 --
 xmloff/source/text/txtparae.cxx   |   17 +---
 38 files changed, 161 insertions(+), 213 deletions(-)

New commits:
commit e810bd2b99777e192fb464572fa64a34bc0768fe
Author: Noel Grandin 
AuthorDate: Thu May 25 14:24:11 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu May 25 18:43:52 2023 +0200

merge some stringadds

found with a lightly tweaked version of the loplugin:stringadd
and some hand-holding.

Change-Id: I146aadcaf665e98fea89a9cad2df4dc3935622f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152275
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index ca8beee5e74e..8c084d51a93c 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -1788,10 +1788,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const 
uno::Reference< embed::XSto
 sal_Int32 index = 0;
 do
 {
-OUStringBuffer aTempTargetName( aTempTargetNameBase );
-aTempTargetName.append( index++ );
-
-sTargetLibrariesStoreName = 
aTempTargetName.makeStringAndClear();
+sTargetLibrariesStoreName = aTempTargetNameBase + 
OUString::number( index++ );
 if ( !i_rStorage->hasByName( sTargetLibrariesStoreName ) )
 {
 break;
diff --git a/chart2/source/tools/ObjectIdentifier.cxx 
b/chart2/source/tools/ObjectIdentifier.cxx
index dae390073fc6..eed5cbe6a8b9 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -448,8 +448,8 @@ OUString 
ObjectIdentifier::createClassifiedIdentifierForParticles(
 if( eObjectType == OBJECTTYPE_UNKNOWN )
 eObjectType = ObjectIdentifier::getObjectType( rParentParticle );
 
-OUStringBuffer aRet( m_aProtocol );
-aRet.append( lcl_createClassificationStringForType( eObjectType, 
rDragMethodServiceName, rDragParameterString ));
+OUStringBuffer aRet( m_aProtocol +
+

[Libreoffice-commits] core.git: basic/source comphelper/source compilerplugins/clang connectivity/source dbaccess/source framework/inc framework/source i18nlangtag/source include/basic include/comphel

2023-04-13 Thread Noel Grandin (via logerrit)
 basic/source/classes/sbxmod.cxx   |2 
 basic/source/comp/token.cxx   |5 +
 basic/source/inc/token.hxx|2 
 comphelper/source/misc/fileurl.cxx|6 +-
 compilerplugins/clang/stringviewparam.cxx |   11 +--
 connectivity/source/commontools/CommonTools.cxx   |4 -
 dbaccess/source/ui/querydesign/QueryDesignView.cxx|2 
 dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx |6 +-
 dbaccess/source/ui/querydesign/SelectionBrowseBox.hxx |2 
 framework/inc/jobs/joburl.hxx |2 
 framework/source/jobs/joburl.cxx  |   17 +++--
 i18nlangtag/source/isolang/isolang.cxx|   11 ++-
 include/basic/sbmod.hxx   |2 
 include/comphelper/fileurl.hxx|2 
 include/connectivity/dbtools.hxx  |2 
 include/i18nlangtag/mslangid.hxx  |2 
 include/o3tl/string_view.hxx  |   52 +-
 include/oox/core/filterdetect.hxx |2 
 include/sfx2/linkmgr.hxx  |2 
 include/sfx2/objsh.hxx|2 
 include/sot/exchange.hxx  |2 
 include/test/sheet/xspreadsheets2.hxx |2 
 o3tl/qa/test-string_view.cxx  |   31 ++
 oox/source/core/filterdetect.cxx  |5 +
 sc/source/core/inc/addinhelpid.hxx|2 
 sc/source/core/tool/addinhelpid.cxx   |5 +
 sc/source/core/tool/interpr2.cxx  |5 +
 sc/source/filter/oox/defnamesbuffer.cxx   |4 -
 sc/source/ui/dbgui/scuiasciiopt.cxx   |6 +-
 sc/source/ui/docshell/impex.cxx   |2 
 sc/source/ui/inc/impex.hxx|2 
 sc/source/ui/inc/scuiasciiopt.hxx |2 
 sd/source/filter/eppt/pptexanimations.cxx |4 -
 sd/source/filter/eppt/pptexanimations.hxx |2 
 sd/source/filter/eppt/pptx-animations-nodectx.cxx |9 ++-
 sd/source/filter/eppt/pptx-animations.cxx |8 +-
 sfx2/source/appl/appopen.cxx  |2 
 sfx2/source/appl/linkmgr2.cxx |2 
 sfx2/source/doc/doctemplates.cxx  |6 +-
 sfx2/source/doc/objcont.cxx   |2 
 sfx2/source/inc/appopen.hxx   |2 
 sot/source/base/exchange.cxx  |6 +-
 svx/source/unodraw/unoshap2.cxx   |4 -
 sw/inc/SwAppletImpl.hxx   |2 
 sw/source/filter/basflt/fltini.cxx|6 +-
 sw/source/filter/html/SwAppletImpl.cxx|   41 +++---
 sw/source/filter/html/htmlfld.cxx |5 +
 sw/source/filter/html/htmlplug.cxx|2 
 sw/source/filter/html/svxcss1.cxx |5 +
 sw/source/filter/html/svxcss1.hxx |2 
 sw/source/filter/html/swhtml.hxx  |4 -
 test/source/sheet/xspreadsheets2.cxx  |   11 ++-
 ucb/source/ucp/webdav-curl/ContentProperties.cxx  |8 +-
 xmloff/inc/prstylecond.hxx|2 
 xmloff/source/style/prstylecond.cxx   |4 -
 xmloff/source/transform/TransformerBase.cxx   |6 +-
 56 files changed, 225 insertions(+), 124 deletions(-)

New commits:
commit bc2101646bc6e63944c42500af5a15134b9b2d17
Author: Noel Grandin 
AuthorDate: Wed Apr 12 10:50:46 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Apr 14 07:54:28 2023 +0200

loplugin:stringviewparam improvements

improve the check by checking for methods that exclude
using string_view, rather than checking for methods that
__can__ use string_view, which leads to exposing
some holes in our o3tl/string_view.hxx coverage.

Change-Id: Ic9dd60441c671f502692f9cd2a1bb67301c4b960
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150277
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 2453caa57c8c..cce2caca22b4 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1735,7 +1735,7 @@ void 
SbModule::GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache)
 }
 
 
-OUString SbModule::GetKeywordCase( const OUString& sKeyword )
+OUString SbModule::GetKeywordCase( std::u16string_view sKeyword )
 {
 return SbiParser::GetKeywordCase( sKeyword );
 }
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index a060b3fd9318..814d5488f8ee 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ 

[Libreoffice-commits] core.git: basic/source compilerplugins/clang dbaccess/source desktop/source editeng/source filter/source idl/source include/tools opencl/source sc/source sd/source sfx2/source sv

2023-04-10 Thread Mike Kaganski (via logerrit)
 basic/source/sbx/sbxobj.cxx |   40 +--
 basic/source/sbx/sbxvar.cxx |   12 
 compilerplugins/clang/store/svstreamoutputoperators.cxx |4 
 dbaccess/source/ui/misc/TokenWriter.cxx |  174 +++---
 desktop/source/app/updater.cxx  |2 
 editeng/source/editeng/impedit4.cxx |  146 ++--
 filter/source/msfilter/rtfutil.cxx  |2 
 idl/source/objects/basobj.cxx   |4 
 idl/source/objects/object.cxx   |   32 +-
 idl/source/objects/slot.cxx |   56 ++--
 idl/source/objects/types.cxx|   28 +-
 idl/source/prj/database.cxx |8 
 include/tools/stream.hxx|1 
 opencl/source/opencl_device.cxx |2 
 sc/source/filter/html/htmlexp.cxx   |  186 +++
 sc/source/filter/html/htmlexp2.cxx  |4 
 sc/source/filter/rtf/rtfexp.cxx |   46 +--
 sd/source/filter/html/htmlex.cxx|2 
 sfx2/source/bastyp/frmhtmlw.cxx |   16 -
 svtools/source/svhtml/HtmlWriter.cxx|   20 -
 svtools/source/svhtml/htmlout.cxx   |   44 +--
 svtools/source/svrtf/rtfout.cxx |   20 -
 svx/source/table/tablertfexporter.cxx   |   34 +-
 sw/qa/unit/swmodeltestbase.cxx  |4 
 sw/source/core/bastyp/swrect.cxx|2 
 sw/source/filter/html/css1atr.cxx   |   10 
 sw/source/filter/html/htmlatr.cxx   |   12 
 sw/source/filter/html/htmlbas.cxx   |4 
 sw/source/filter/html/htmlforw.cxx  |2 
 sw/source/filter/html/htmlftn.cxx   |4 
 sw/source/filter/html/htmlplug.cxx  |6 
 sw/source/filter/html/htmlreqifreader.cxx   |   74 +++---
 sw/source/filter/html/wrthtml.cxx   |   20 -
 sw/source/filter/writer/writer.cxx  |2 
 sw/source/filter/ww8/rtfattributeoutput.cxx |  194 +++-
 sw/source/filter/ww8/rtfexport.cxx  |  189 +++
 tools/source/inet/inetstrm.cxx  |4 
 tools/source/stream/stream.cxx  |   12 
 vcl/skia/SkiaHelper.cxx |6 
 vcl/source/filter/eps/eps.cxx   |   88 +++
 vcl/source/filter/ipdf/pdfdocument.cxx  |  174 +++---
 vcl/source/fontsubset/sft.cxx   |  100 
 vcl/source/opengl/win/WinDeviceInfo.cxx |4 
 vcl/source/treelist/imap.cxx|2 
 44 files changed, 891 insertions(+), 905 deletions(-)

New commits:
commit 5fe96b6dcec8f0ccb7c606fa8e981112e6160e7e
Author: Mike Kaganski 
AuthorDate: Mon Apr 10 22:43:04 2023 +0300
Commit: Mike Kaganski 
CommitDate: Mon Apr 10 23:13:32 2023 +0200

Drop SvStream::WriteCharPtr

WriteOString is a better replacement

Change-Id: Ic431b9aeb98d19fe61cff71360eee555105cc2bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150192
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index 002abfe38301..d405ff344417 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -689,7 +689,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
 static sal_uInt16 nLevel = 0;
 if ( nLevel > 10 )
 {
-rStrm.WriteCharPtr( "" ) << endl;
+rStrm.WriteOString( "" ) << endl;
 return;
 }
 ++nLevel;
@@ -701,38 +701,38 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
 // Output the data of the object itself
 OString aNameStr(OUStringToOString(GetName(), RTL_TEXTENCODING_ASCII_US));
 OString aClassNameStr(OUStringToOString(aClassName, 
RTL_TEXTENCODING_ASCII_US));
-rStrm.WriteCharPtr( "Object( " )
- .WriteOString( OString::number(reinterpret_cast(this)) 
).WriteCharPtr( "=='" )
- .WriteCharPtr( aNameStr.isEmpty() ?  "" : aNameStr.getStr()  
).WriteCharPtr( "', " )
- .WriteCharPtr( "of class '" ).WriteOString( aClassNameStr 
).WriteCharPtr( "', " )
- .WriteCharPtr( "counts " )
+rStrm.WriteOString( "Object( " )
+ .WriteOString( OString::number(reinterpret_cast(this)) 
).WriteOString( "=='" )
+ .WriteOString( aNameStr.isEmpty() ? "" : aNameStr 
).WriteOString( "', " )
+ .WriteOString( "of class '" ).WriteOString( aClassNameStr 
).WriteOString( "', " )
+ .WriteOString( "counts " )
  .WriteOString( OString::number(GetRefCount()) )
-   

[Libreoffice-commits] core.git: basic/source

2023-03-29 Thread Mike Kaganski (via logerrit)
 basic/source/classes/sbxmod.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 167b864fb1933d069293760e50e1f204a3d2e63d
Author: Mike Kaganski 
AuthorDate: Wed Mar 29 09:32:40 2023 +
Commit: Mike Kaganski 
CommitDate: Wed Mar 29 11:20:09 2023 +

Add an assert

Change-Id: Iee190f27323202d5bb673aaba3116071f294a85b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149695
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 9a4fd841c98d..2453caa57c8c 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -2015,13 +2015,14 @@ std::pair SbMethod::StoreData( 
SvStream& rStrm ) const
 return { false, 0 };
 
 //tdf#94617
-const sal_Int16 nMax = std::numeric_limits::max();
+const sal_uInt32 nMax = std::numeric_limits::max();
 // tdf#142391 - store method using binary format 0x13 only when actually 
needed, i.e.,
 // when method starts at an offset that would overflow 16 bits
 const sal_Int16 nStartTemp = nStart % nMax;
 sal_uInt16 nDebugFlagsTemp = static_cast(nDebugFlags);
 if (nStart >= nMax)
 {
+assert(nStart <= nMax * 0x7FFF); // Larger addresses can't be stored 
in version 13
 nDebugFlagsTemp = (nStart / nMax) | 0x8000;
 nVersion = B_IMG_VERSION_13;
 }


[Libreoffice-commits] core.git: basic/source include/basic sc/qa

2023-03-28 Thread Andreas Heinisch (via logerrit)
 basic/source/classes/image.cxx   |   12 +++
 basic/source/classes/sb.cxx  |   18 +++---
 basic/source/classes/sbxmod.cxx  |   53 ++-
 basic/source/inc/filefmt.hxx |6 +--
 basic/source/inc/image.hxx   |2 -
 basic/source/inc/sbjsmod.hxx |2 -
 basic/source/sbx/sbxarray.cxx|   18 +++---
 basic/source/sbx/sbxbase.cxx |9 ++---
 basic/source/sbx/sbxcoll.cxx |6 +--
 basic/source/sbx/sbxobj.cxx  |   22 +++-
 basic/source/sbx/sbxvalue.cxx|7 ++--
 basic/source/sbx/sbxvar.cxx  |   11 +++---
 include/basic/sbmeth.hxx |2 -
 include/basic/sbmod.hxx  |2 -
 include/basic/sbstar.hxx |2 -
 include/basic/sbx.hxx|6 +--
 include/basic/sbxcore.hxx|4 +-
 include/basic/sbxobj.hxx |2 -
 include/basic/sbxvar.hxx |4 +-
 sc/qa/extras/macros-test.cxx |   33 +++
 sc/qa/extras/testdocuments/tdf142391.ods |binary
 21 files changed, 141 insertions(+), 80 deletions(-)

New commits:
commit d622972dceba40d89852b1dc832c6e2a4612b2fa
Author: Andreas Heinisch 
AuthorDate: Mon Mar 20 17:13:26 2023 +0100
Commit: Andreas Heinisch 
CommitDate: Tue Mar 28 07:36:48 2023 +

tdf#142391 - Store method using 0x13 format only when actually needed

Change-Id: I907d234b20be5e3c7bee0d44407f1bf4c4b49f05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149175
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index e5f9ac3f5df2..eab5fe9e0905 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -124,11 +124,11 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
 nFlags = static_cast(nTmpFlags);
 eCharSet = nCharSet;
 eCharSet = GetSOLoadTextEncoding( eCharSet );
-bBadVer  = ( nVersion > B_CURVERSION );
+bBadVer  = ( nVersion > B_IMG_VERSION_13 );
 nDimBase = static_cast(lDimBase);
 }
 
-bool bLegacy = ( nVersion < B_EXT_IMG_VERSION );
+bool bLegacy = ( nVersion < B_IMG_VERSION_12 );
 
 sal_uInt64 nNext;
 while( ( nNext = r.Tell() ) < nLast )
@@ -373,7 +373,7 @@ done:
 
 bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
 {
-bool bLegacy = ( nVer < B_EXT_IMG_VERSION );
+bool bLegacy = ( nVer < B_IMG_VERSION_12 );
 
 // detect if old code exceeds legacy limits
 // if so, then disallow save
@@ -381,7 +381,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
 {
 SbiImage aEmptyImg;
 aEmptyImg.aName = aName;
-aEmptyImg.Save( r, B_LEGACYVERSION );
+aEmptyImg.Save( r, B_IMG_VERSION_11 );
 return true;
 }
 // First of all the header
@@ -391,11 +391,11 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
 eCharSet = GetSOStoreTextEncoding( eCharSet );
 if ( bLegacy )
 {
-r.WriteInt32( B_LEGACYVERSION );
+r.WriteInt32( B_IMG_VERSION_11 );
 }
 else
 {
-r.WriteInt32( B_CURVERSION );
+r.WriteInt32( nVer );
 }
 r .WriteInt32( eCharSet )
   .WriteInt32( nDimBase )
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 7f02e65d9b55..64ba5cd20c86 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1847,22 +1847,28 @@ bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer )
 return true;
 }
 
-bool StarBASIC::StoreData( SvStream& r ) const
+std::pair StarBASIC::StoreData( SvStream& r ) const
 {
-if( !SbxObject::StoreData( r ) )
+auto [bSuccess, nVersion] = SbxObject::StoreData(r);
+if( !bSuccess )
 {
-return false;
+return { false, 0 };
 }
 assert(pModules.size() < SAL_MAX_UINT16);
 r.WriteUInt16( static_cast(pModules.size()));
 for( const auto& rpModule: pModules )
 {
-if( !rpModule->Store( r ) )
+const auto& [bSuccessModule, nVersionModule] = rpModule->Store(r);
+if( !bSuccessModule )
 {
-return false;
+return { false, 0 };
+}
+else if (nVersionModule > nVersion)
+{
+nVersion = nVersionModule;
 }
 }
-return true;
+return { true, nVersion };
 }
 
 bool StarBASIC::GetUNOConstant( const OUString& rName, css::uno::Any& aOut )
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index aaad6cd9bb41..9a4fd841c98d 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1606,7 +1606,7 @@ bool SbModule::LoadData( SvStream& rStrm, sal_uInt16 nVer 
)
 return false;
 }
 // If the image is in old format, we fix up the method start offsets
-if ( nImgVer < 

[Libreoffice-commits] core.git: basic/source

2023-03-22 Thread adityasingh22 (via logerrit)
 basic/source/runtime/methods.cxx |  144 +--
 1 file changed, 48 insertions(+), 96 deletions(-)

New commits:
commit a49019618be881520a454550454c3f2d078d17fa
Author: adityasingh22 
AuthorDate: Thu Mar 9 00:20:17 2023 +0530
Commit: Hossein 
CommitDate: Wed Mar 22 10:02:29 2023 +

tdf#147132: Simplify usage of StarBASIC::Error()

Change-Id: Iedb499fa58798d40e7193c80c31dc9337a3a356b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148519
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 0b4f89d40115..2835a4915392 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -650,16 +650,14 @@ static void implRemoveDirRecursive( const OUString& 
aDirPath )
 
 if( !bExists || !bFolder )
 {
-StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND );
-return;
+return StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND );
 }
 
 Directory aDir( aDirPath );
 nRet = aDir.open();
 if( nRet != FileBase::E_None )
 {
-StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND );
-return;
+return StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND );
 }
 aDir.close();
 
@@ -682,8 +680,7 @@ void SbRtl_RmDir(StarBASIC *, SbxArray & rPar, bool)
 {
 if( !xSFI->isFolder( aPath ) )
 {
-StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND );
-return;
+return StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND 
);
 }
 SbiInstance* pInst = GetSbData()->pInst;
 bool bCompatibility = ( pInst && pInst->IsCompatibility() 
);
@@ -692,8 +689,7 @@ void SbRtl_RmDir(StarBASIC *, SbxArray & rPar, bool)
 Sequence< OUString > aContent = 
xSFI->getFolderContents( aPath, true );
 if( aContent.hasElements() )
 {
-StarBASIC::Error( ERRCODE_BASIC_ACCESS_ERROR );
-return;
+return StarBASIC::Error( 
ERRCODE_BASIC_ACCESS_ERROR );
 }
 }
 
@@ -1123,8 +1119,7 @@ void SbRtl_Mid(StarBASIC *, SbxArray & rPar, bool bWrite)
 bool bCompatibility = ( pInst && pInst->IsCompatibility() 
);
 if( bCompatibility )
 {
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-return;
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 }
 nStartPos = nArgLen;
 }
@@ -1205,8 +1200,7 @@ void SbRtl_Replace(StarBASIC *, SbxArray & rPar, bool)
 const sal_uInt32 nArgCount = rPar.Count() - 1;
 if ( nArgCount < 3 || nArgCount > 6 )
 {
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-return;
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 }
 
 sal_Int32 lStartPos = 1;
@@ -1218,8 +1212,7 @@ void SbRtl_Replace(StarBASIC *, SbxArray & rPar, bool)
 }
 if (lStartPos < 1)
 {
-StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
-return;
+return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
 }
 }
 --lStartPos; // Make it 0-based
@@ -1233,8 +1226,7 @@ void SbRtl_Replace(StarBASIC *, SbxArray & rPar, bool)
 }
 if (lCount < -1)
 {
-StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
-return;
+return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
 }
 }
 
@@ -1706,8 +1698,7 @@ void SbRtl_CDateToUnoDate(StarBASIC *, SbxArray & rPar, 
bool)
 {
 if (rPar.Count() != 2)
 {
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-return;
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 }
 
 unoToSbxValue(rPar.Get(0), Any(SbxDateToUNODate(rPar.Get(1;
@@ -1718,8 +1709,7 @@ void SbRtl_CDateFromUnoDate(StarBASIC *, SbxArray & rPar, 
bool)
 {
 if (rPar.Count() != 2 || rPar.Get(1)->GetType() != SbxOBJECT)
 {
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-return;
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 }
 
 Any aAny(sbxToUnoValue(rPar.Get(1), 
cppu::UnoType::get()));
@@ -1753,8 +1743,7 @@ void SbRtl_CDateToUnoTime(StarBASIC *, SbxArray & rPar, 
bool)
 {
 if (rPar.Count() != 2)
 {
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-return;
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 }
 
 unoToSbxValue(rPar.Get(0), Any(SbxDateToUNOTime(rPar.Get(1;
@@ -1765,8 +1754,7 @@ void SbRtl_CDateFromUnoTime(StarBASIC *, SbxArray & rPar, 
bool)
 {
 if (rPar.Count() != 2 || 

[Libreoffice-commits] core.git: basic/source

2023-03-16 Thread Baole Fang (via logerrit)
 basic/source/runtime/runtime.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit d34a3c92eb68b7f0b2cef698639a2853e19a898f
Author: Baole Fang 
AuthorDate: Thu Mar 16 21:25:58 2023 -0400
Commit: Mike Kaganski 
CommitDate: Fri Mar 17 04:46:46 2023 +

tdf#152690: Refactor fix

Change-Id: I170eba4968743afbab3cc6aa943706612b3e1a57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149035
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 69eeb19b1d1f..abcee4bcc42d 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1491,7 +1491,8 @@ namespace
 case '[':
 sResult.append(*start++);
 seenright = 0;
-if (start < end && *start=='!'){
+if (start < end && *start == '!')
+{
 sResult.append('^');
 start++;
 }


[Libreoffice-commits] core.git: basic/source chart2/source connectivity/source desktop/source framework/source helpcompiler/source jvmfwk/source sc/source sd/source sfx2/source svl/source sw/source un

2023-03-14 Thread Noel Grandin (via logerrit)
 basic/source/runtime/methods.cxx  |2 +-
 basic/source/sbx/sbxint.cxx   |6 ++
 chart2/source/inc/dumpxmltostring.hxx |5 +++--
 connectivity/source/drivers/evoab2/NResultSet.cxx |2 +-
 desktop/source/deployment/manager/dp_manager.cxx  |2 +-
 desktop/source/lib/init.cxx   |2 +-
 framework/source/uielement/spinfieldtoolbarcontroller.cxx |2 +-
 helpcompiler/source/HelpLinker.cxx|6 +++---
 jvmfwk/source/fwkbase.cxx |   14 --
 jvmfwk/source/libxmlutil.cxx  |2 +-
 sc/source/core/data/column4.cxx   |4 ++--
 sc/source/ui/dataprovider/csvdataprovider.cxx |3 +--
 sd/source/filter/html/htmlex.cxx  |2 +-
 sfx2/source/bastyp/helper.cxx |2 +-
 svl/source/numbers/zforlist.cxx   |   11 ---
 sw/source/uibase/docvw/edtwin2.cxx|5 ++---
 unoxml/source/dom/characterdata.cxx   |8 
 17 files changed, 33 insertions(+), 45 deletions(-)

New commits:
commit 899dfbca1755f730dc935ca0d929236f999b9879
Author: Noel Grandin 
AuthorDate: Tue Mar 14 12:50:39 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Mar 14 17:50:11 2023 +

elide some temporary OStrings

where we can pass a string_view into OStringToOUString

Change-Id: If7803ba49aa15f6e9c7bd386d32fb84003155390
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148844
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 3e0194f5783f..b6d9383d5b37 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -4168,7 +4168,7 @@ void SbRtl_StrConv(StarBASIC *, SbxArray & rPar, bool)
 }
 }
 pChar[nSize] = '\0';
-OString aOStr(pChar.get());
+std::string_view aOStr(pChar.get());
 
 // there is no concept about default codepage in unix. so it is 
incorrectly in unix
 OUString aOUStr = OStringToOUString(aOStr, encodingVal);
diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx
index 3e66e83fd7c4..1b57239ddba9 100644
--- a/basic/source/sbx/sbxint.cxx
+++ b/basic/source/sbx/sbxint.cxx
@@ -485,8 +485,7 @@ start:
 if( !p->pOUString )
 p->pOUString = new OUString;
 
-::OString  aOStr  = OString::number( n );
-(*p->pOUString) = ::OStringToOUString( aOStr, 
RTL_TEXTENCODING_ASCII_US );
+(*p->pOUString) = OUString::number(n);
 break;
 }
 case SbxOBJECT:
@@ -742,8 +741,7 @@ start:
 SbxBase::SetError( ERRCODE_BASIC_CONVERSION );
 else
 {
-::OString  aOStr  = OString::number( n );
-(*p->pOUString) = ::OStringToOUString( aOStr, 
RTL_TEXTENCODING_ASCII_US );
+(*p->pOUString) = OUString::number(n);
 }
 break;
 case SbxOBJECT:
diff --git a/chart2/source/inc/dumpxmltostring.hxx 
b/chart2/source/inc/dumpxmltostring.hxx
index d03f1cab9d45..b5cfe5a1fab8 100644
--- a/chart2/source/inc/dumpxmltostring.hxx
+++ b/chart2/source/inc/dumpxmltostring.hxx
@@ -32,9 +32,10 @@ template  OUString dumpXmlToString(F f)
 }
 f(writer);
 xmlFreeTextWriter(writer);
-OString s(reinterpret_cast(xmlBufferContent(buf)), 
xmlBufferLength(buf));
+std::string_view s(reinterpret_cast(xmlBufferContent(buf)), 
xmlBufferLength(buf));
+OUString rv = OStringToOUString(s, RTL_TEXTENCODING_ISO_8859_1); //TODO
 xmlBufferFree(buf);
-return OStringToOUString(s, RTL_TEXTENCODING_ISO_8859_1); //TODO
+return rv;
 }
 }
 
diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx 
b/connectivity/source/drivers/evoab2/NResultSet.cxx
index 965072f70537..2505cbf3dc81 100644
--- a/connectivity/source/drivers/evoab2/NResultSet.cxx
+++ b/connectivity/source/drivers/evoab2/NResultSet.cxx
@@ -88,7 +88,7 @@ static OUString
 valueToOUString( GValue& _rValue )
 {
 const char *pStr = g_value_get_string( &_rValue );
-OString aStr( pStr ? pStr : "" );
+std::string_view aStr( pStr ? pStr : "" );
 OUString sResult( OStringToOUString( aStr, RTL_TEXTENCODING_UTF8 ) );
 g_value_unset( &_rValue );
 return sResult;
diff --git a/desktop/source/deployment/manager/dp_manager.cxx 
b/desktop/source/deployment/manager/dp_manager.cxx
index 570f8be23330..9c4a849e2843 100644
--- a/desktop/source/deployment/manager/dp_manager.cxx
+++ b/desktop/source/deployment/manager/dp_manager.cxx
@@ -251,7 +251,7 @@ void PackageManagerImpl::initActivationLayer(
 ucbhelper::Content remFileContent(
 

[Libreoffice-commits] core.git: basic/source cui/source dbaccess/source desktop/source extensions/source formula/source

2023-03-07 Thread Noel Grandin (via logerrit)
 basic/source/inc/runtime.hxx|6 
 basic/source/runtime/methods.cxx|8 
 cui/source/inc/paragrph.hxx |   12 
 cui/source/tabpages/paragrph.cxx|  324 
 dbaccess/source/filter/xml/xmlExport.cxx|8 
 dbaccess/source/filter/xml/xmlExport.hxx|2 
 dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx|   10 
 dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx|4 
 desktop/source/deployment/dp_log.cxx|8 
 extensions/source/propctrlr/propertycontrolextender.cxx |   26 -
 extensions/source/propctrlr/propertycontrolextender.hxx |3 
 formula/source/ui/dlg/formula.cxx   |   16 
 12 files changed, 209 insertions(+), 218 deletions(-)

New commits:
commit c596fd59dc75823002bdfd3676d600a56e3bfb5e
Author: Noel Grandin 
AuthorDate: Tue Mar 7 15:56:53 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Mar 7 19:15:55 2023 +

no need to allocate these separately

they are all one or two words in size

Change-Id: I86611e14a32dda3ae2226bbfa775ad0234513888
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148425
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index f202a2acaa08..662a7d696859 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -32,12 +32,14 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 class SbiInstance;  // active StarBASIC process
 class SbiRuntime;   // active StarBASIC procedure instance
@@ -99,8 +101,6 @@ namespace o3tl
 template<> struct typed_flags : is_typed_flags {};
 }
 
-class WildCard;
-
 class SbiRTLData
 {
 public:
@@ -110,7 +110,7 @@ public:
 short   nCurDirPos;
 
 OUString sFullNameToBeChecked;
-std::unique_ptr pWildCard;
+std::optional moWildCard;
 
 css::uno::Sequence< OUString > aDirSeq;
 
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 8d50c6cc3409..3e0194f5783f 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2490,7 +2490,7 @@ static OUString implSetupWildcard(const OUString& 
rFileParam, SbiRTLData& rRTLDa
 static const char cWild1 = '*';
 static const char cWild2 = '?';
 
-rRTLData.pWildCard.reset();
+rRTLData.moWildCard.reset();
 rRTLData.sFullNameToBeChecked.clear();
 
 OUString aFileParam = rFileParam;
@@ -2544,7 +2544,7 @@ static OUString implSetupWildcard(const OUString& 
rFileParam, SbiRTLData& rRTLDa
 // invalid anyway because it was not accepted by OSL before
 if (aPureFileName != "*")
 {
-rRTLData.pWildCard = std::make_unique(aPureFileName);
+rRTLData.moWildCard.emplace(aPureFileName);
 }
 return aPathStr;
 }
@@ -2553,9 +2553,9 @@ static bool implCheckWildcard(std::u16string_view rName, 
SbiRTLData const& rRTLD
 {
 bool bMatch = true;
 
-if (rRTLData.pWildCard)
+if (rRTLData.moWildCard)
 {
-bMatch = rRTLData.pWildCard->Matches(rName);
+bMatch = rRTLData.moWildCard->Matches(rName);
 }
 return bMatch;
 }
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index c61e988d04f5..688602f122dc 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -52,17 +52,17 @@ private:
 
 // indentation
 bool m_bSplitLRSpace = false; ///< which items to use?
-std::unique_ptr m_xLeftIndent;
+SvxRelativeField m_aLeftIndent;
 
-std::unique_ptr m_xRightIndent;
+SvxRelativeField m_aRightIndent;
 
 std::unique_ptr m_xFLineLabel;
-std::unique_ptr m_xFLineIndent;
+SvxRelativeField m_aFLineIndent;
 std::unique_ptr m_xAutoCB;
 
 // distance
-std::unique_ptr m_xTopDist;
-std::unique_ptr m_xBottomDist;
+SvxRelativeField m_aTopDist;
+SvxRelativeField m_aBottomDist;
 std::unique_ptr m_xContextualCB;
 
 // line spacing
@@ -240,7 +240,7 @@ private:
 std::unique_ptr m_xMinWordLabel;
 std::unique_ptr m_xMinWordLength;
 std::unique_ptr m_xHyphenZoneLabel;
-std::unique_ptr m_xHyphenZone;
+SvxRelativeField m_aHyphenZone;
 
 // pagebreak
 std::unique_ptr m_xPageBreakBox;
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 04a4ad8c82ea..a873f0f8a584 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -167,34 +167,34 @@ void SvxStdParagraphTabPage::ELRLoseFocus()
 FieldUnit eUnit =
 MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
 
-sal_Int64 nL = m_xLeftIndent->denormalize(m_xLeftIndent->get_value(eUnit));
-sal_Int64 nR = 
m_xRightIndent->denormalize(m_xRightIndent->get_value(eUnit));
-OUString aTmp = 

[Libreoffice-commits] core.git: basic/source include/basic

2023-02-20 Thread Mike Kaganski (via logerrit)
 basic/source/sbx/sbxexec.cxx |   16 +---
 include/basic/sbmod.hxx  |3 ++-
 include/basic/sbxobj.hxx |5 ++---
 3 files changed, 9 insertions(+), 15 deletions(-)

New commits:
commit 527741d528ef347b28917976efffd366c62341b1
Author: Mike Kaganski 
AuthorDate: Tue Feb 21 08:00:26 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Feb 21 05:52:59 2023 +

Related: tdf#153752 Use virtual method to avoid dynamic casts

Change-Id: I97c09d82699621d5a43a525b5f2cf75ff5d131c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147353
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index de711944d36c..af7d12c00651 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -19,7 +19,6 @@
 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -350,7 +349,7 @@ SbxVariable* SbxObject::Execute( const OUString& rTxt )
 {
 SetError( ERRCODE_BASIC_SYNTAX ); break;
 }
-pVar = Assign( this, this, , IsModuleCompatible() );
+pVar = Assign( this, this, , IsOptionCompatible() );
 if( !pVar.is() )
 {
 break;
@@ -373,7 +372,7 @@ SbxVariable* SbxObject::FindQualified( const OUString& 
rName, SbxClassType t )
 {
 return nullptr;
 }
-pVar = QualifiedName( this, this, , t, IsModuleCompatible() );
+pVar = QualifiedName( this, this, , t, IsOptionCompatible() );
 p = SkipWhitespace( p );
 if( *p )
 {
@@ -382,15 +381,10 @@ SbxVariable* SbxObject::FindQualified( const OUString& 
rName, SbxClassType t )
 return pVar.get();
 }
 
-bool SbxObject::IsModuleCompatible() const
+bool SbxObject::IsOptionCompatible() const
 {
-const SbxObject* pObj = this;
-while (pObj)
-{
-if (auto pMod = dynamic_cast(pObj))
-return pMod->IsCompatible();
-pObj = pObj->GetParent();
-}
+if (const SbxObject* pObj = GetParent())
+return pObj->IsOptionCompatible();
 return false;
 }
 
diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx
index fac7f9e50121..7ca52276d012 100644
--- a/include/basic/sbmod.hxx
+++ b/include/basic/sbmod.hxx
@@ -94,6 +94,8 @@ protected:
 SAL_DLLPRIVATE virtual void Notify( SfxBroadcaster& rBC, const SfxHint& 
rHint ) override;
 SAL_DLLPRIVATE void handleProcedureProperties( SfxBroadcaster& rBC, const 
SfxHint& rHint );
 virtual ~SbModule() override;
+bool IsOptionCompatible() const override { return mbCompat; }
+
 public:
 SBX_DECL_PERSIST_NODATA(SBXID_BASICMOD,2);
 SbModule( const OUString&, bool bVBASupport = false );
@@ -123,7 +125,6 @@ public:
 SAL_DLLPRIVATE bool HasExeCode();
 bool IsVBASupport() const { return mbVBASupport; }
 SAL_DLLPRIVATE void SetVBASupport( bool bSupport );
-bool IsCompatible() const { return mbCompat; }
 sal_Int32 GetModuleType() const { return mnType; }
 void SetModuleType( sal_Int32 nType ) { mnType = nType; }
 bool isProxyModule() const { return bIsProxyModule; }
diff --git a/include/basic/sbxobj.hxx b/include/basic/sbxobj.hxx
index 34c117d33853..33ffc98c77d9 100644
--- a/include/basic/sbxobj.hxx
+++ b/include/basic/sbxobj.hxx
@@ -41,6 +41,8 @@ protected:
 virtual bool StoreData( SvStream& ) const override;
 virtual ~SbxObject() override;
 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+virtual bool IsOptionCompatible() const; // Module's Option Compatible
+
 public:
 SBX_DECL_PERSIST_NODATA(SBXID_OBJECT,1);
 SbxObject( const OUString& rClassname );
@@ -78,9 +80,6 @@ public:
 SbxArray* GetObjects()  { return pObjs.get(); }
 // Debugging
 void Dump( SvStream&, bool bDumpAll );
-
-private:
-bool IsModuleCompatible() const; // Module's Option Compatible
 };
 
 #endif // INCLUDED_BASIC_SBXOBJ_HXX


[Libreoffice-commits] core.git: basic/source include/basic include/unotest sc/qa sc/source unotest/source

2023-02-20 Thread Mike Kaganski (via logerrit)
 basic/source/classes/sb.cxx   |2 
 basic/source/classes/sbxmod.cxx   |   28 +
 basic/source/comp/parser.cxx  |6 +-
 basic/source/runtime/runtime.cxx  |2 
 basic/source/runtime/stdobj.cxx   |2 
 basic/source/sbx/sbxexec.cxx  |   66 +-
 include/basic/sbmod.hxx   |   10 ++-
 include/basic/sbxobj.hxx  |3 +
 include/unotest/macros_test.hxx   |3 -
 sc/qa/extras/testdocuments/ForEachInSelection.ods |binary
 sc/qa/extras/vba-macro-test.cxx   |   31 ++
 sc/source/core/tool/interpr4.cxx  |2 
 unotest/source/cpp/macros_test.cxx|9 +--
 13 files changed, 110 insertions(+), 54 deletions(-)

New commits:
commit ccd0ef98f76011f108f8ea1d282b96386dba0a6a
Author: Mike Kaganski 
AuthorDate: Mon Feb 20 16:16:40 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Feb 21 04:30:34 2023 +

tdf#153752: SbxObject::Execute: extra characters in Option Compatible mode

Change-Id: Ib3e4bd9eb9a249123a686f2434ded7b529fb050f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147345
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index f1ab6dd1da0c..0296e2238ca1 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -744,7 +744,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* 
pClassModule )
 }
 }
 SetModuleType( ModuleType::CLASS );
-mbVBACompat = pClassModule->mbVBACompat;
+mbVBASupport = pClassModule->mbVBASupport;
 }
 
 SbClassModuleObject::~SbClassModuleObject()
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index f38e729185db..aaad6cd9bb41 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -416,9 +416,9 @@ static bool getDefaultVBAMode( StarBASIC* pb )
 // A Basic module has set EXTSEARCH, so that the elements, that the module 
contains,
 // could be found from other module.
 
-SbModule::SbModule( const OUString& rName, bool bVBACompat )
+SbModule::SbModule( const OUString& rName, bool bVBASupport )
  : SbxObject( "StarBASICModule" ),
-   pBreaks(nullptr), mbVBACompat( bVBACompat ), bIsProxyModule( false )
+   pBreaks(nullptr), mbVBASupport(bVBASupport), mbCompat(bVBASupport), 
bIsProxyModule(false)
 {
 SetName( rName );
 SetFlag( SbxFlagBits::ExtSearch | SbxFlagBits::GlobalSearch );
@@ -802,11 +802,11 @@ void SbModule::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
 void SbModule::SetSource32( const OUString& r )
 {
 // Default basic mode to library container mode, but... allow Option 
VBASupport 0/1 override
-SetVBACompat( getDefaultVBAMode( static_cast< StarBASIC*>( GetParent() ) ) 
);
+SetVBASupport( getDefaultVBAMode( static_cast< StarBASIC*>( GetParent() ) 
) );
 aOUSource = r;
 StartDefinitions();
 SbiTokenizer aTok( r );
-aTok.SetCompatible( IsVBACompat() );
+aTok.SetCompatible( IsVBASupport() );
 
 while( !aTok.IsEof() )
 {
@@ -837,12 +837,13 @@ void SbModule::SetSource32( const OUString& r )
 eCurTok = aTok.Next();
 if( eCurTok == COMPATIBLE )
 {
+mbCompat = true;
 aTok.SetCompatible( true );
 }
 else if ( ( eCurTok == VBASUPPORT ) && ( aTok.Next() == 
NUMBER ) )
 {
 bool bIsVBA = ( aTok.GetDbl()== 1 );
-SetVBACompat( bIsVBA );
+SetVBASupport( bIsVBA );
 aTok.SetCompatible( bIsVBA );
 }
 }
@@ -974,15 +975,16 @@ static void ClearUnoObjectsInRTL_Impl( StarBASIC* pBasic )
 }
 
 
-void SbModule::SetVBACompat( bool bCompat )
+void SbModule::SetVBASupport( bool bSupport )
 {
-if( mbVBACompat == bCompat )
+if( mbVBASupport == bSupport )
 return;
 
-mbVBACompat = bCompat;
+mbVBASupport = bSupport;
 // initialize VBA document API
-if( mbVBACompat ) try
+if( mbVBASupport ) try
 {
+mbCompat = true;
 StarBASIC* pBasic = static_cast< StarBASIC* >( GetParent() );
 uno::Reference< lang::XMultiServiceFactory > xFactory( 
getDocumentModel( pBasic ), uno::UNO_QUERY_THROW );
 xFactory->createInstance( "ooo.vba.VBAGlobals" );
@@ -1067,7 +1069,7 @@ namespace
 // Run a Basic-subprogram
 void SbModule::Run( SbMethod* pMeth )
 {
-SAL_INFO("basic","About to run " << pMeth->GetName() << ", vba compatmode 
is " << mbVBACompat );
+SAL_INFO("basic","About to run " << pMeth->GetName() << ", vba compatmode 
is " << mbVBASupport );
 
 static sal_uInt16 nMaxCallLevel = 0;
 
@@ -1088,7 +1090,7 @@ 

[Libreoffice-commits] core.git: basic/source sc/qa

2023-02-19 Thread Mike Kaganski (via logerrit)
 basic/source/runtime/runtime.cxx  |   10 ++-
 sc/qa/extras/testdocuments/ForEachInSelection.ods |binary
 sc/qa/extras/vba-macro-test.cxx   |   30 ++
 3 files changed, 39 insertions(+), 1 deletion(-)

New commits:
commit fd6a0cf1eb8441acb23f22e9e9fafc477bf4e57e
Author: Mike Kaganski 
AuthorDate: Sun Feb 19 13:26:48 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Feb 19 13:37:42 2023 +

tdf#153724: make sure to retrieve the variable value before checking the 
type

Commit 5760c94b8847164f9a7a181f031c7c86643944af tried to avoid all cases
which could set an error in SbiRuntime::PushForEach. To do that, it checked
the type of xObjVar before trying to get an object from it, which otherwise
could set an error.

But the type of the contained value can be not known until it is retrieved
(which can happen inside SbxValue::Get in a call to SbxValue::Broadcast with
SfxHintId::BasicDataWanted). This happens e.g. when the container passed to
'for each' is a call to some special function, like VBA's 'Selection'. Then
SbxValue::GetFullType would return SbxEMPTY prior to SbxValue::Get.

Let's make sure to call SbxValue::Get first (asking for a Variant, to avoid
errors on type mismatch), and only then, check the actual result data type.

Change-Id: Iaa697f38285505e50504ae09f9307fbd29e09a53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147273
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index b521e3e8b458..e6f4f7b68a6b 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1146,7 +1146,15 @@ void SbiRuntime::PushForEach()
 pForStk = p;
 
 SbxVariableRef xObjVar = PopVar();
-SbxBase* pObj = xObjVar && xObjVar->GetFullType() == SbxOBJECT ? 
xObjVar->GetObject() : nullptr;
+SbxBase* pObj(nullptr);
+if (xObjVar)
+{
+SbxValues v(SbxVARIANT);
+// Here it may retrieve the value, and change the type from SbxEMPTY 
to SbxOBJECT
+xObjVar->Get(v);
+if (v.eType == SbxOBJECT)
+pObj = v.pObj;
+}
 
 if (SbxDimArray* pArray = dynamic_cast(pObj))
 {
diff --git a/sc/qa/extras/testdocuments/ForEachInSelection.ods 
b/sc/qa/extras/testdocuments/ForEachInSelection.ods
new file mode 100644
index ..7996c86eb953
Binary files /dev/null and b/sc/qa/extras/testdocuments/ForEachInSelection.ods 
differ
diff --git a/sc/qa/extras/vba-macro-test.cxx b/sc/qa/extras/vba-macro-test.cxx
index 29fdf213f8e7..04e4efece2cf 100644
--- a/sc/qa/extras/vba-macro-test.cxx
+++ b/sc/qa/extras/vba-macro-test.cxx
@@ -68,6 +68,7 @@ public:
 void testTdf118247();
 void testTdf126457();
 void testVbaPDFExport();
+void testForEachInSelection();
 
 CPPUNIT_TEST_SUITE(VBAMacroTest);
 CPPUNIT_TEST(testSimpleCopyAndPaste);
@@ -92,6 +93,7 @@ public:
 CPPUNIT_TEST(testTdf118247);
 CPPUNIT_TEST(testTdf126457);
 CPPUNIT_TEST(testVbaPDFExport);
+CPPUNIT_TEST(testForEachInSelection);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -870,6 +872,34 @@ void VBAMacroTest::testVbaPDFExport()
 SvFileStream aStream(aTempPdfFile.GetURL(), StreamMode::READ);
 CPPUNIT_ASSERT_MESSAGE("Failed to get the pdf document", 
aDocument.Read(aStream));
 }
+
+void VBAMacroTest::testForEachInSelection()
+{
+loadFromURL(u"ForEachInSelection.ods");
+SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(mxComponent);
+
+CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+ScDocShell* pDocSh = static_cast(pFoundShell);
+ScDocument& rDoc = pDocSh->GetDocument();
+
+CPPUNIT_ASSERT_EQUAL(OUString("foo"), rDoc.GetString(ScAddress(0, 0, 0)));
+CPPUNIT_ASSERT_EQUAL(OUString("bar"), rDoc.GetString(ScAddress(0, 1, 0)));
+CPPUNIT_ASSERT_EQUAL(OUString("baz"), rDoc.GetString(ScAddress(0, 2, 0)));
+
+// tdf#153724: without the fix, this would fail with
+// assertion failed
+// - Expression: false
+// - Unexpected dialog:  Error: BASIC runtime error.
+// '13'
+// Data type mismatch.
+executeMacro("vnd.sun.Star.script:Standard.Module1.TestForEachInSelection?"
+ "language=Basic=document");
+
+CPPUNIT_ASSERT_EQUAL(OUString("oof"), rDoc.GetString(ScAddress(0, 0, 0)));
+CPPUNIT_ASSERT_EQUAL(OUString("rab"), rDoc.GetString(ScAddress(0, 1, 0)));
+CPPUNIT_ASSERT_EQUAL(OUString("zab"), rDoc.GetString(ScAddress(0, 2, 0)));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(VBAMacroTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: basic/source

2023-01-29 Thread Stephan Bergmann (via logerrit)
 basic/source/classes/sbxmod.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit e3e259d551c0c8b7c106191f2c258e5929db1b29
Author: Stephan Bergmann 
AuthorDate: Sun Jan 29 11:51:10 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Sun Jan 29 12:09:07 2023 +

UNO fn FormObjEventListenerImpl::documentEventOccured must lock SolarMutex

When trying to address a deadlock issue involving 
NotifySingleListenerIgnoreRE
(sfx2/source/doc/sfxbasemodel.cxx), I hit the DBG_TESTSOLARMUTEX at

> DbgTestSolarMutex
> SfxBroadcaster::RemoveListener
> SfxListener::EndListening
> CheckParentsOnDelete
> SbxObject::~SbxObject
> SbUnoObject::~SbUnoObject
> SvRefBase::ReleaseRef
> tools::SvRef::operator=
> SbUserFormModule::ResetApiObj
> FormObjEventListenerImpl::documentEventOccured
> (anonymous 
namespace)::NotifySingleListenerIgnoreRE::operator
> 
comphelper::OInterfaceContainerHelper2::forEach>
> SfxBaseModel::postEvent_Impl
> SfxBaseModel::Notify
> ScModelObj::Notify
> SfxBroadcaster::Broadcast
> SfxApplication::NotifyEvent
> SfxBaseController::dispose
> (anonymous namespace)::XFrameImpl::setComponent
> (anonymous namespace)::XFrameImpl::close
> SfxFrame::DoClose
> SfxViewFrame::Notify
> SfxBroadcaster::Broadcast
> (anonymous namespace)::SfxModelListener_Impl::notifyClosing
> SfxBaseModel::close
> SfxBaseModel::dispose
> UnoApiTest::load
> UnoApiTest::loadFromURL
> VBAMacroTest::testVba

during CppunitTest_sc_vba_macro_test, which this commit fixes.  (I commit 
this
independently of any commit addressing that deadlock, as that involves some
SolarMutexReleaser hackery and might eventually get reverted, while this 
change
here looks correct and worthwhile even on its own.)

Change-Id: I4217098c33114653cd69f4bef61c9f8089ce8b24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146302
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 60bdc9171b48..00bfac58dd71 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -2375,6 +2375,7 @@ public:
 virtual void SAL_CALL documentEventOccured( const document::DocumentEvent& 
rEvent ) override
 {
 // early disposing on document event "OnUnload", to be sure Basic 
still exists when calling VBA "UserForm_Terminate"
+SolarMutexGuard g;
 if( rEvent.EventName == GlobalEventConfig::GetEventName( 
GlobalEventId::CLOSEDOC ) )
 {
 removeListener();


[Libreoffice-commits] core.git: basic/source

2023-01-27 Thread Mike Kaganski (via logerrit)
 basic/source/inc/runtime.hxx |1 -
 basic/source/runtime/runtime.cxx |9 ++---
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 0b1d6220c6ece62653963ef782ee32efb639016e
Author: Mike Kaganski 
AuthorDate: Thu Jan 26 22:03:42 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jan 27 08:27:06 2023 +

tdf#153235: Optimize Application::Reschedule calls in SbiRuntime::Step

Setup the "last reschedule time" counter at the first pass,
to avoid useless immediate reschedule.
Update the counter when running "when blocked" reschedules.

This seems to avoid the problem with the bugdoc.

Change-Id: Ib5958a1a2b048f5ec654c69ee9e977e8a26de6f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146215
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index fedf68236ad5..f202a2acaa08 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -250,7 +250,6 @@ class SbiRuntime
 BasicDebugFlagsnFlags;   // Debugging-Flags
 ErrCodenError = ERRCODE_NONE;
 sal_uInt16 nOps = 0; // opcode counter
-sal_uInt32 m_nLastTime = 0;
 
 std::vector  aRefSaved; // #74254 save temporary references
 std::vector   pGosubStk;  // GOSUB stack
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index d19c5c4354f1..b521e3e8b458 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -765,23 +765,26 @@ bool SbiRuntime::Step()
 {
 if( bRun )
 {
+static sal_uInt32 nLastTime = osl_getGlobalTimer();
+
 // in any case check casually!
 if( !( ++nOps & 0xF ) && pInst->IsReschedule() )
 {
 sal_uInt32 nTime = osl_getGlobalTimer();
-if (nTime - m_nLastTime > 5 ) // 20 ms
+if (nTime - nLastTime > 5) // 20 ms
 {
+nLastTime = nTime;
 Application::Reschedule();
-m_nLastTime = nTime;
 }
 }
 
 // #i48868 blocked by next call level?
 while( bBlocked )
 {
-if( pInst->IsReschedule() )
+if( pInst->IsReschedule() ) // And what if not? Busy loop?
 {
 Application::Reschedule();
+nLastTime = osl_getGlobalTimer();
 }
 }
 


[Libreoffice-commits] core.git: basic/source

2023-01-26 Thread Mike Kaganski (via logerrit)
 basic/source/inc/runtime.hxx |   36 ++--
 basic/source/runtime/runtime.cxx |   20 +---
 2 files changed, 19 insertions(+), 37 deletions(-)

New commits:
commit 7c3ea0abeff6e0cb9e2893cec8ed63025a274117
Author: Mike Kaganski 
AuthorDate: Thu Jan 26 22:00:27 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Jan 26 22:15:34 2023 +

Simplify SbiRuntime ctor

Change-Id: I18309ed4ed8ebb31b3bf9ffc676a2d501e2593b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146214
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index d0922e6a0e0a..fedf68236ad5 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -226,31 +226,31 @@ class SbiRuntime
 SbxArrayRefrefRedimpArray;   // Array saved to use for REDIM 
PRESERVE
 SbxVariableRef refRedim; // Array saved to use for REDIM
 SbxVariableRef xDummyVar;// substitute for variables that 
weren't found
-SbxVariable*   mpExtCaller;  // Caller ( external - e.g. button 
name, shape, range object etc. - only in vba mode )
-SbiForStack*   pForStk;  // FOR/NEXT-Stack
-sal_uInt16 nExprLvl; // depth of the expr-stack
-sal_uInt16 nForLvl;  // #118235: Maintain for level
+SbxVariable*   mpExtCaller = nullptr; // Caller ( external - e.g. 
button name, shape, range object etc. - only in vba mode )
+SbiForStack*   pForStk = nullptr; // FOR/NEXT-Stack
+sal_uInt16 nExprLvl = 0; // depth of the expr-stack
+sal_uInt16 nForLvl = 0;  // #118235: Maintain for level
 const sal_uInt8*   pCode;// current Code-Pointer
 const sal_uInt8*   pStmnt;   // beginning of the last statement
-const sal_uInt8*   pError;   // address of the current error 
handler
-const sal_uInt8*   pRestart; // restart-address
-const sal_uInt8*   pErrCode; // restart-address RESUME NEXT
-const sal_uInt8*   pErrStmnt;// restart-address RESUME 0
+const sal_uInt8*   pError = nullptr; // address of the current error 
handler
+const sal_uInt8*   pRestart = nullptr; // restart-address
+const sal_uInt8*   pErrCode = nullptr; // restart-address RESUME NEXT
+const sal_uInt8*   pErrStmnt = nullptr; // restart-address RESUME 0
 OUString   aLibName; // Lib-name for declare-call
 SbxArrayRefrefParams;// current procedure parameters
 SbxArrayRefrefLocals;// local variable
 SbxArrayRefrefArgv;
 // #74254, one refSaveObj is not enough! new: pRefSaveList (see above)
-short  nArgc;
-bool   bRun;
-bool   bError;   // true: handle errors
-bool   bInError; // true: in an error handler
-bool   bBlocked; // true: blocked by next call level, 
#i48868
+short  nArgc = 0;
+bool   bRun = true;
+bool   bError = true;// true: handle errors
+bool   bInError = false; // true: in an error handler
+bool   bBlocked = false; // true: blocked by next call level, 
#i48868
 bool   bVBAEnabled;
 BasicDebugFlagsnFlags;   // Debugging-Flags
-ErrCodenError;
-sal_uInt16 nOps; // opcode counter
-sal_uInt32 m_nLastTime;
+ErrCodenError = ERRCODE_NONE;
+sal_uInt16 nOps = 0; // opcode counter
+sal_uInt32 m_nLastTime = 0;
 
 std::vector  aRefSaved; // #74254 save temporary references
 std::vector   pGosubStk;  // GOSUB stack
@@ -349,8 +349,8 @@ public:
 void  SetVBAEnabled( bool bEnabled );
 bool  IsImageFlag( SbiImageFlags n ) const;
 sal_uInt16  GetBase() const;
-sal_Int32  nLine,nCol1,nCol2;
-SbiRuntime* pNext;   // Stack-Chain
+sal_Int32  nLine = 0, nCol1 = 0, nCol2 = 0;
+SbiRuntime* pNext = nullptr; // Stack-Chain
 
 // tdf#79426, tdf#125180 - adds the information about a missing parameter
 static void SetIsMissing( SbxVariable* );
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 3ef617d06e49..d19c5c4354f1 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -590,30 +590,12 @@ SbMethod* SbiInstance::GetCaller( sal_uInt16 nLevel )
 
 SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, sal_uInt32 nStart )
  : rBasic( *static_cast(pm->pParent) ), pInst( 
GetSbData()->pInst ),
-   pMod( pm ), pMeth( pe ), pImg( pMod->pImage.get() ), 
mpExtCaller(nullptr), m_nLastTime(0)
+   pMod( pm ), pMeth( pe ), pImg( pMod->pImage.get() )
 {
 nFlags= pe ? pe->GetDebugFlags() : 

[Libreoffice-commits] core.git: basic/source

2023-01-20 Thread Radhey Parekh (via logerrit)
 basic/source/runtime/methods.cxx |   56 ---
 1 file changed, 24 insertions(+), 32 deletions(-)

New commits:
commit d0700f45c510385a95a181f646d6bb99d085fcaa
Author: Radhey Parekh 
AuthorDate: Mon Aug 29 20:05:00 2022 +0530
Commit: Hossein 
CommitDate: Fri Jan 20 16:56:26 2023 +

tdf#147132 Flatten Basic function implementations

Change-Id: Icd7610a3b7415838f632579deb2cd2cc505b44a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139001
Tested-by: Jenkins
Reviewed-by: Hossein 

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)


[Libreoffice-commits] core.git: basic/source

2023-01-19 Thread Stephan Bergmann (via logerrit)
 basic/source/inc/namecont.hxx |7 +++
 basic/source/uno/namecont.cxx |8 
 2 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 41f659b49250dd62abc141afaa3c73cc63a425e3
Author: Stephan Bergmann 
AuthorDate: Thu Jan 19 14:47:03 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Jan 19 16:07:12 2023 +

Base SfxLibrary on WeakComponentImplHelper

...rather than on the deprecated OComponentHelper.

The two classes SfxDialogLibrary and SfxScriptLibrary, both deriving from
SfxLibrary, had been found to implement their respective queryInterface in 
a way
that is incompatible with the XAggregation protocol inherited via
OComponentHelper.  It looks like no code actually made use of the 
XAggregation
offered by these Sfx*Library classes, so the easiest fix for those
queryInterface implementations appears to switch from OComponentHelper to
WeakComponentImplHelper (thereby dropping XAggregation, and thus rendering 
the
existing queryInterface implementations OK).

Ideally, SfxLibrary would derive from 
WeakComponentImplHelper covering all 
the
UNO interface classes from which it currently derives manually.  But 
changing
that manual implementation across SfxLibrary and its SfxDialogLibrary and
SfxScriptLibrary derived classes looks tricky, so merely introduce an 
"empty"
WeakComponentImplHelper<> for now and keep all the manual stuff, and leave
proper clean up for later.

Change-Id: I12dc5bad2c017b8d76ce28ac189e95cf2e3810e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145792
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 5875b6369faf..b5a261c2dde1 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -47,7 +47,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -470,7 +469,7 @@ class SfxLibrary
 , public css::container::XContainer
 , public css::util::XChangesNotifier
 , public ::cppu::BaseMutex
-, public ::cppu::OComponentHelper
+, public ::cppu::WeakComponentImplHelper<>
 {
 friend class SfxLibraryContainer;
 friend class SfxDialogLibraryContainer;
@@ -550,8 +549,8 @@ public:
 
 // Methods XInterface
 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType 
) override;
-virtual void SAL_CALL acquire() noexcept override { 
OComponentHelper::acquire(); }
-virtual void SAL_CALL release() noexcept override { 
OComponentHelper::release(); }
+virtual void SAL_CALL acquire() noexcept override { 
WeakComponentImplHelper::acquire(); }
+virtual void SAL_CALL release() noexcept override { 
WeakComponentImplHelper::release(); }
 
 // Methods XElementAccess
 virtual css::uno::Type SAL_CALL getElementType(  ) override;
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 431f55b2a4d2..24bcddbded53 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -2930,7 +2930,7 @@ sal_Bool SAL_CALL SfxLibraryContainer::supportsService( 
const OUString& _rServic
 // Ctor
 SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType,
 const Reference< XSimpleFileAccess3 >& xSFI )
-: OComponentHelper( m_aMutex )
+: WeakComponentImplHelper( m_aMutex )
 , mxSFI( xSFI )
 , mrModifiable( _rModifiable )
 , maNameContainer( new NameContainer(aType) )
@@ -2952,7 +2952,7 @@ SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, 
const Type& aType,
 SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType,
 const Reference< XSimpleFileAccess3 >& xSFI,
 OUString aLibInfoFileURL, OUString aStorageURL, bool ReadOnly )
-: OComponentHelper( m_aMutex )
+: WeakComponentImplHelper( m_aMutex )
 , mxSFI( xSFI )
 , mrModifiable( _rModifiable )
 , maNameContainer( new NameContainer(aType) )
@@ -3004,7 +3004,7 @@ Any SAL_CALL SfxLibrary::queryInterface( const Type& 
rType )
 static_cast< XChangesNotifier * >( this ) );
 if( !aRet.hasValue() )
 {
-aRet = OComponentHelper::queryInterface( rType );
+aRet = WeakComponentImplHelper::queryInterface( rType );
 }
 return aRet;
 }
@@ -3140,7 +3140,7 @@ Sequence< Type > SfxLibrary::getTypes()
 cppu::UnoType::get(),
 cppu::UnoType::get(),
 cppu::UnoType::get(),
-OComponentHelper::getTypes() );
+WeakComponentImplHelper::getTypes() );
 
 return ourTypes_NameContainer.getTypes();
 }


[Libreoffice-commits] core.git: basic/source

2023-01-07 Thread Eike Rathke (via logerrit)
 basic/source/runtime/methods1.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit e06198e1544f33419be4ce303458da8b5160bc1a
Author: Eike Rathke 
AuthorDate: Sat Jan 7 20:29:38 2023 +0100
Commit: Eike Rathke 
CommitDate: Sat Jan 7 20:28:55 2023 +

Resolves: tdf#152917 Add ConvertFromUrl() put result back, tdf#147132 
follow-up

Regression from

commit 6b3e66cd7a355061bf1dec76bbc4f389b6b60f2d
CommitDate: Mon Sep 5 16:04:25 2022 +0200

tdf147132 basic : flaten some functions

Change-Id: I20e6b00ed613b98a5e58623a010d894b1bcb4c6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145172
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/basic/source/runtime/methods1.cxx 
b/basic/source/runtime/methods1.cxx
index 9e5356a6327b..b4f7dfb5fd9a 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1419,6 +1419,7 @@ void SbRtl_ConvertFromUrl(StarBASIC *, SbxArray & rPar, 
bool)
 {
 aSysPath = aStr;
 }
+rPar.Get(0)->PutString(aSysPath);
 }
 
 


[Libreoffice-commits] core.git: basic/source

2022-12-25 Thread Andreas Heinisch (via logerrit)
 basic/source/comp/scanner.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e431417aa67d4b31f57e9d751b63e8e8cf002567
Author: Andreas Heinisch 
AuthorDate: Sun Dec 25 18:19:09 2022 +0100
Commit: Andreas Heinisch 
CommitDate: Sun Dec 25 19:41:05 2022 +

Fixed a copy paste error in a comment

Change-Id: Ibcd4c2f0cccb233647f3b079f02d01f156d30138
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144818
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index b5a923969bfd..45b65a29b129 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -668,7 +668,7 @@ PrevLineCommentLbl:
 bPrevLineExtentsComment = false;
 aSym = "REM";
 sal_Int32 nLen = aLine.getLength() - nLineIdx;
-// tdf#149402 - don't extend comment if line ends in a whitespace 
(asicCharClass::isWhitespace)
+// tdf#149402 - don't extend comment if line ends in a whitespace 
(BasicCharClass::isWhitespace)
 if (bCompatible && !bLineEndsWithWhitespace && aLine[nLineIdx + nLen - 
1] == '_'
 && aLine[nLineIdx + nLen - 2] == ' ')
 bPrevLineExtentsComment = true;


[Libreoffice-commits] core.git: basic/source

2022-12-25 Thread Mike Kaganski (via logerrit)
 basic/source/runtime/runtime.cxx |   13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

New commits:
commit 5bd5dd4c3ebbb4258fe7c17df1da6b81b016a0e2
Author: Mike Kaganski 
AuthorDate: Sun Dec 25 10:51:02 2022 +
Commit: Mike Kaganski 
CommitDate: Sun Dec 25 11:50:06 2022 +

Simplify a bit

Change-Id: I2c4df04cc7c57649077f61bfd0bc9fb0e9b42a4c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144795
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 6a15cb1606e6..3ef617d06e49 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -114,11 +114,8 @@ private:
 
 bool SbiRuntime::isVBAEnabled()
 {
-bool bResult = false;
 SbiInstance* pInst = GetSbData()->pInst;
-if ( pInst && GetSbData()->pInst->pRun )
-bResult = pInst->pRun->bVBAEnabled;
-return bResult;
+return pInst && pInst->pRun && pInst->pRun->bVBAEnabled;
 }
 
 void StarBASIC::SetVBAEnabled( bool bEnabled )
@@ -131,13 +128,7 @@ void StarBASIC::SetVBAEnabled( bool bEnabled )
 
 bool StarBASIC::isVBAEnabled() const
 {
-if ( bDocBasic )
-{
-if( SbiRuntime::isVBAEnabled() )
-return true;
-return bVBAEnabled;
-}
-return false;
+return bDocBasic && (bVBAEnabled || SbiRuntime::isVBAEnabled());
 }
 
 struct SbiArgv {   // Argv stack:


[Libreoffice-commits] core.git: basic/source

2022-12-14 Thread Stephan Bergmann (via logerrit)
 basic/source/basmgr/basicmanagerrepository.cxx |3 ++-
 basic/source/inc/scriptcont.hxx|8 +++-
 basic/source/uno/scriptcont.cxx|   11 +++
 3 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 5b8cd77c112bc8c0e92b8fec215c3c8e802bbc0a
Author: Stephan Bergmann 
AuthorDate: Tue Dec 13 11:18:35 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Dec 14 09:16:36 2022 +

loplugin:unocast (basic::SfxScriptLibraryContainer)

(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)

Change-Id: I962b2a11a6407a543fb8b4ad972128d59f62a8a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144142
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/basmgr/basicmanagerrepository.cxx 
b/basic/source/basmgr/basicmanagerrepository.cxx
index 7a2ed5efd20a..803d8ed4caa0 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -462,7 +463,7 @@ namespace basic
 }
 
 // knit the containers with the BasicManager
-LibraryContainerInfo aInfo( xBasicLibs, xDialogLibs, dynamic_cast< 
SfxScriptLibraryContainer* >( xBasicLibs.get() ) );
+LibraryContainerInfo aInfo( xBasicLibs, xDialogLibs, 
comphelper::getFromUnoTunnel< SfxScriptLibraryContainer >( xBasicLibs ) );
 OSL_ENSURE( aInfo.mpOldBasicPassword, 
"ImplRepository::impl_createManagerForModel: wrong BasicLibraries 
implementation!" );
 _out_rpBasicManager->SetLibraryContainerInfo( aInfo );
 
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index 2d0e8bcf3232..f4886d216fad 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -21,15 +21,18 @@
 
 #include "namecont.hxx"
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 
 namespace basic
 {
 
 
-class SfxScriptLibraryContainer final : public SfxLibraryContainer
+class SfxScriptLibraryContainer final :
+public cppu::ImplInheritanceHelper
 {
 css::uno::Reference< css::container::XNameAccess > mxCodeNameAccess;
 
@@ -99,6 +102,9 @@ public:
 
 // Library password handling for 5.0 documents
 void setLibraryPassword( const OUString& rLibraryName, const OUString& 
rPassword );
+
+sal_Int64 SAL_CALL getSomething(css::uno::Sequence const & 
aIdentifier) override;
+static css::uno::Sequence const & getUnoTunnelId();
 };
 
 
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index eea449ac47fc..ea69032aa795 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -107,6 +108,16 @@ void SfxScriptLibraryContainer::setLibraryPassword( const 
OUString& rLibraryName
 catch(const NoSuchElementException& ) {}
 }
 
+sal_Int64 SfxScriptLibraryContainer::getSomething(css::uno::Sequence 
const & aIdentifier)
+{
+return comphelper::getSomethingImpl(aIdentifier, this);
+}
+
+css::uno::Sequence const & 
SfxScriptLibraryContainer::getUnoTunnelId() {
+static comphelper::UnoIdInit const id;
+return id.getSeq();
+}
+
 // Ctor for service
 SfxScriptLibraryContainer::SfxScriptLibraryContainer()
 {


[Libreoffice-commits] core.git: basic/source compilerplugins/clang include/basic

2022-11-25 Thread Stephan Bergmann (via logerrit)
 basic/source/basmgr/basicmanagerrepository.cxx |4 ++--
 basic/source/basmgr/basmgr.cxx |4 +++-
 basic/source/inc/scriptcont.hxx|8 
 basic/source/uno/scriptcont.cxx|3 +--
 compilerplugins/clang/mergeclasses.results |1 -
 include/basic/basmgr.hxx   |   15 +++
 6 files changed, 13 insertions(+), 22 deletions(-)

New commits:
commit a534361141d69096d896e6e0552d19f3138eeeb3
Author: Stephan Bergmann 
AuthorDate: Fri Nov 25 00:17:50 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Nov 25 10:12:38 2022 +0100

Fold OldBasicPassword into basic::SfxScriptLibraryContainer

Change-Id: Iaeaf30f63760185a2b1dd72feb980b94d9931d55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143253
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/basmgr/basicmanagerrepository.cxx 
b/basic/source/basmgr/basicmanagerrepository.cxx
index 5d04fc3f78ab..7a2ed5efd20a 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -300,7 +300,7 @@ namespace basic
 // Dialog container
 rtl::Reference pDialogCont = new 
SfxDialogLibraryContainer( Reference< XStorage >() );
 
-LibraryContainerInfo aInfo( pBasicCont, pDialogCont, static_cast< 
OldBasicPassword* >( pBasicCont.get() ) );
+LibraryContainerInfo aInfo( pBasicCont, pDialogCont, pBasicCont.get() 
);
 pBasicManager->SetLibraryContainerInfo( aInfo );
 
 // global constants
@@ -462,7 +462,7 @@ namespace basic
 }
 
 // knit the containers with the BasicManager
-LibraryContainerInfo aInfo( xBasicLibs, xDialogLibs, dynamic_cast< 
OldBasicPassword* >( xBasicLibs.get() ) );
+LibraryContainerInfo aInfo( xBasicLibs, xDialogLibs, dynamic_cast< 
SfxScriptLibraryContainer* >( xBasicLibs.get() ) );
 OSL_ENSURE( aInfo.mpOldBasicPassword, 
"ImplRepository::impl_createManagerForModel: wrong BasicLibraries 
implementation!" );
 _out_rpBasicManager->SetLibraryContainerInfo( aInfo );
 
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index d3a711f4a677..72776dd08153 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -41,6 +41,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -567,7 +569,7 @@ void BasicManager::SetLibraryContainerInfo( const 
LibraryContainerInfo& rInfo )
 copyToLibraryContainer( pLib, maContainerInfo );
 if (rpBasLibInfo->HasPassword())
 {
-OldBasicPassword* pOldBasicPassword =
+basic::SfxScriptLibraryContainer* pOldBasicPassword =
 maContainerInfo.mpOldBasicPassword;
 if( pOldBasicPassword )
 {
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index f80fd81791b0..2d0e8bcf3232 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -29,7 +29,7 @@ namespace basic
 {
 
 
-class SfxScriptLibraryContainer final : public SfxLibraryContainer, public 
OldBasicPassword
+class SfxScriptLibraryContainer final : public SfxLibraryContainer
 {
 css::uno::Reference< css::container::XNameAccess > mxCodeNameAccess;
 
@@ -75,9 +75,6 @@ class SfxScriptLibraryContainer final : public 
SfxLibraryContainer, public OldBa
 virtual void onNewRootStorage() override;
 
 
-// OldBasicPassword interface
-virtual void setLibraryPassword( const OUString& rLibraryName, const 
OUString& rPassword ) override;
-
 virtual OUString getInfoFileName() const override;
 virtual OUString getOldInfoFileName() const override;
 virtual OUString getLibElementFileExtension() const override;
@@ -99,6 +96,9 @@ public:
 // Methods XServiceInfo
 virtual OUString SAL_CALL getImplementationName( ) override;
 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( 
) override;
+
+// Library password handling for 5.0 documents
+void setLibraryPassword( const OUString& rLibraryName, const OUString& 
rPassword );
 };
 
 
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 52413b759d15..eea449ac47fc 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -87,7 +87,6 @@ OUString SfxScriptLibraryContainer::getLibrariesDir() const
 return sBasic;
 }
 
-// OldBasicPassword interface
 void SfxScriptLibraryContainer::setLibraryPassword( const OUString& 
rLibraryName, const OUString& rPassword )
 {
 try
@@ -341,7 +340,7 @@ void SfxScriptLibraryContainer::importFromOldStorage( const 
OUString& aFile )
 auto pBasicManager = std::make_unique ( *xStorage, aFile 
);
 
 // Set info
-LibraryContainerInfo aInfo( this, nullptr, static_cast< 
OldBasicPassword* >( 

[Libreoffice-commits] core.git: basic/source

2022-11-05 Thread Stephan Bergmann (via logerrit)
 basic/source/sbx/sbxform.cxx |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit e88cb2d41fa8cbd4513285d0b2521f91561dd971
Author: Stephan Bergmann 
AuthorDate: Sat Nov 5 15:54:12 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Sat Nov 5 17:17:54 2022 +0100

-Werror,-Wdeprecated-declarations (sprintf, macOS 13 SDK): basic

Change-Id: If70c3bf8d7d6c855baf23b02cccb3f3b5ccb9f64
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142321
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index 76372bf23f2a..e97524a019e3 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -24,7 +24,9 @@
 #include 
 
 #include 
+#include 
 #include 
+#include 
 #include 
 
 /*
@@ -234,17 +236,16 @@ void SbxBasicFormater::InitScan( double _dNum )
 dNum = _dNum;
 InitExp( get_number_of_digits( dNum ) );
 // maximum of 15 positions behind the decimal point, example: 
-1.234E-001
-/*int nCount =*/ sprintf( sBuffer,"%+22.15lE",dNum );
+/*int nCount =*/ o3tl::sprintf( sBuffer,"%+22.15lE",dNum );
 sSciNumStrg = OUString::createFromAscii( sBuffer );
 }
 
 
 void SbxBasicFormater::InitExp( double _dNewExp )
 {
-char sBuffer[ MAX_DOUBLE_BUFFER_LENGTH ];
 nNumExp = static_cast(_dNewExp);
-/*int nCount =*/ sprintf( sBuffer,"%+i",nNumExp );
-sNumExpStrg = OUString::createFromAscii( sBuffer );
+sNumExpStrg = (nNumExp >= 0 ? std::u16string_view(u"+") : 
std::u16string_view(u""))
++ OUString::number(nNumExp);
 nExpExp = static_cast(get_number_of_digits( 
static_cast(nNumExp) ));
 }
 


[Libreoffice-commits] core.git: basic/source

2022-10-25 Thread Stephan Bergmann (via logerrit)
 basic/source/inc/expr.hxx |   38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

New commits:
commit 16045087e6541925be340d585e68a35147489b59
Author: Stephan Bergmann 
AuthorDate: Tue Oct 25 14:10:23 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Oct 25 15:55:06 2022 +0200

Address a constexpr template point of instantiation issue

...that hits at least when building with Clang and --with-latest-c++ against
recent libc++ or MSVC standard library (where C++20 and esp. C++23 made 
more and
more class template member functions constexpr).  My understanding is that 
there
is some leeway at what point a compiler should instantiate such function
specializations, and Clang decides to instantiate constexpr ones early (cf.


"C++11 half of r147023: In C++11, additionally eagerly instantiate:" and 
its "Do
not defer instantiations of constexpr functions" comment, and the 
discussion at

).

> In file included from basic/source/comp/codegen.cxx:21:
> In file included from include/basic/sberrors.hxx:23:
> In file included from include/vcl/errcode.hxx:23:
> In file included from include/rtl/ustring.hxx:34:
> In file included from ~/llvm/inst/bin/../include/c++/v1/ostream:168:
> ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:47:19: error: 
invalid application of 'sizeof' to an incomplete type 'SbiExprList'
> static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
>   ^~~
> ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:281:7: note: in 
instantiation of member function 'std::default_delete::operator()' 
requested here
>   __ptr_.second()(__tmp);
>   ^
> ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:247:75: note: in 
instantiation of member function 'std::unique_ptr::reset' 
requested here
>   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { 
reset(); }
>   
^
> basic/source/inc/expr.hxx:118:66: note: in instantiation of member 
function 'std::unique_ptr::~unique_ptr' requested here
> SbiExprNode( const SbiSymDef&, SbxDataType, SbiExprListPtr = nullptr 
);
>  ^
> basic/source/inc/expr.hxx:30:7: note: forward declaration of 'SbiExprList'
> class SbiExprList;
>   ^

Change-Id: I3bde85164ae6b829b7c24d9645fd412ed3fd815d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141810
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx
index d5130c39dae9..d1e7fbcfa25d 100644
--- a/basic/source/inc/expr.hxx
+++ b/basic/source/inc/expr.hxx
@@ -85,6 +85,25 @@ enum RecursiveMode
 PREVENT_CALL
 };
 
+class SbiExprList final {// class for parameters and dims
+std::vector> aData;
+short nDim;
+bool  bError;
+bool  bBracket;
+public:
+SbiExprList();
+~SbiExprList();
+static SbiExprListPtr ParseParameters(SbiParser*, bool 
bStandaloneExpression = false, bool bPar = true);
+static SbiExprListPtr ParseDimList( SbiParser* );
+bool  IsBracket() const { return bBracket;}
+bool  IsValid() const   { return !bError; }
+short GetSize() const   { return aData.size();}
+short GetDims() const   { return nDim;}
+SbiExpression* Get( size_t );
+void  Gen( SbiCodeGen& rGen);// code generation
+void addExpression( std::unique_ptr&& pExpr  );
+};
+
 class SbiExprNode final {   // operators (and operands)
 friend class SbiExpression;
 friend class SbiConstExpression;
@@ -205,23 +224,4 @@ public: // numeric constant
 short GetShortValue();
 };
 
-class SbiExprList final {// class for parameters and dims
-std::vector> aData;
-short nDim;
-bool  bError;
-bool  bBracket;
-public:
-SbiExprList();
-~SbiExprList();
-static SbiExprListPtr ParseParameters(SbiParser*, bool 
bStandaloneExpression = false, bool bPar = true);
-static SbiExprListPtr ParseDimList( SbiParser* );
-bool  IsBracket() const { return bBracket;}
-bool  IsValid() const   { return !bError; }
-short GetSize() const   { return aData.size();}
-short GetDims() const   { return nDim;}
-SbiExpression* Get( size_t );
-void  Gen( SbiCodeGen& rGen);// code generation
-void addExpression( std::unique_ptr&& pExpr  );
-};
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: basic/source

2022-10-17 Thread Michael Meeks (via logerrit)
 basic/source/classes/sbxmod.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit da6a1a05b2b718a60d31858f19f3af8629d602a9
Author: Michael Meeks 
AuthorDate: Mon Oct 17 23:01:34 2022 +0100
Commit: Michael Meeks 
CommitDate: Tue Oct 18 01:05:59 2022 +0200

basic: s/helt/held/ and some cleanup.

Change-Id: Idebd2eef29230056caa605c79028e46d34891c44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141485
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 8f3a56c17d7b..2766d9be6ab2 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -916,8 +916,8 @@ static void SendHint( SbxObject* pObj, SfxHintId nId, 
SbMethod* p )
 SendHint_( pObj, nId, p );
 }
 
-// #57841 Clear Uno-Objects, which were helt in RTL functions,
-// at the end of the program, so that nothing were helt.
+// #57841 Clear Uno-Objects, which were held in RTL functions,
+// at the end of the program, so that nothing is held
 static void ClearUnoObjectsInRTL_Impl_Rek( StarBASIC* pBasic )
 {
 // delete the return value of CreateUnoService
@@ -1179,8 +1179,8 @@ void SbModule::Run( SbMethod* pMeth )
 
 if( bDelInst )
 {
-// #57841 Clear Uno-Objects, which were helt in RTL functions,
-// at the end of the program, so that nothing were helt.
+// #57841 Clear Uno-Objects, which were held in RTL functions,
+// at the end of the program, so that nothing is held.
 ClearUnoObjectsInRTL_Impl( xBasic.get() );
 
 clearNativeObjectWrapperVector();
@@ -1224,8 +1224,8 @@ void SbModule::Run( SbMethod* pMeth )
 StarBASIC* pBasic = dynamic_cast( GetParent() );
 if( bDelInst )
 {
-   // #57841 Clear Uno-Objects, which were helt in RTL functions,
-   // the end of the program, so that nothing were helt.
+// #57841 Clear Uno-Objects, which were held in RTL functions,
+// the end of the program, so that nothing is held.
 ClearUnoObjectsInRTL_Impl( xBasic.get() );
 
 delete pSbData->pInst;


[Libreoffice-commits] core.git: basic/source

2022-10-17 Thread Michael Meeks (via logerrit)
 basic/source/runtime/runtime.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c0ce606701080bb93a8dff1d7e5df6006f19683a
Author: Michael Meeks 
AuthorDate: Mon Oct 17 22:44:35 2022 +0100
Commit: Michael Meeks 
CommitDate: Tue Oct 18 00:55:50 2022 +0200

basic: correct reference to method that doesn't exist.

Apparently not there in basic from prior to its open-sourcing.

Change-Id: I9b2da35abfc9971ee380c68f33e239fe63b381c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141483
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 4f77fecb56e2..6a15cb1606e6 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -4422,7 +4422,7 @@ void SbiRuntime::StepSTMNT( sal_uInt32 nOp1, sal_uInt32 
nOp2 )
 }
 
 // 16.10.96: #31460 new concept for StepInto/Over/Out
-// see explanation at _ImplGetBreakCallLevel
+// see explanation at SbiInstance::CalcBreakCallLevel
 if( pInst->nCallLvl <= pInst->nBreakCallLvl )
 {
 StarBASIC* pStepBasic = GetCurrentBasic(  );


[Libreoffice-commits] core.git: basic/source

2022-09-15 Thread Mike Kaganski (via logerrit)
 basic/source/runtime/runtime.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit 5a60014858384e8ae2a092cb699dc6fc1de61360
Author: Mike Kaganski 
AuthorDate: Thu Sep 15 15:30:59 2022 +0200
Commit: Mike Kaganski 
CommitDate: Thu Sep 15 16:31:44 2022 +0200

This comment is obsolete

A leftover from commit f6e0527033be682dbf6b60bd9b060fdd853ffe33
  Date   Mon Mar 21 12:55:40 2011 +0100
Remove most of dead code inlibs-core (basic)

which dropped the related commented out code for "not implemented"
stub, being there since c25ec0608a167bcf1d891043f02273761c351701
"initial import".

Change-Id: Ic09a0c63921f1c5daa277fe7bb6dfc194895b673
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139978
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index c2f8e060ed30..5ff568140c75 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1280,8 +1280,6 @@ void SbiRuntime::DllCall
   SbxDataType eResType, // return value
   bool bCDecl ) // true: according to C-conventions
 {
-// NOT YET IMPLEMENTED
-
 SbxVariable* pRes = new SbxVariable( eResType );
 SbiDllMgr* pDllMgr = pInst->GetDllMgr();
 ErrCode nErr = pDllMgr->Call( aFuncName, aDLLName, pArgs, *pRes, bCDecl );


[Libreoffice-commits] core.git: basic/source

2022-09-05 Thread Arnaud VERSINI (via logerrit)
 basic/source/runtime/methods1.cxx |  438 +++---
 1 file changed, 178 insertions(+), 260 deletions(-)

New commits:
commit 6b3e66cd7a355061bf1dec76bbc4f389b6b60f2d
Author: Arnaud VERSINI 
AuthorDate: Sun Jul 31 17:33:25 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Sep 5 16:04:25 2022 +0200

tdf147132 basic : flaten some functions

Change-Id: I462cbac4183f304e9f4b296a6361a05a4615c7eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137650
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/runtime/methods1.cxx 
b/basic/source/runtime/methods1.cxx
index f0c26ae5a9de..9e5356a6327b 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -338,15 +338,11 @@ void SbRtl_CInt(StarBASIC *, SbxArray & rPar, bool)  // 
JSM
 void SbRtl_CLng(StarBASIC *, SbxArray & rPar, bool)  // JSM
 {
 sal_Int32 nVal = 0;
-if (rPar.Count() == 2)
-{
-SbxVariable* pSbxVariable = rPar.Get(1);
-nVal = pSbxVariable->GetLong();
-}
-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->GetLong();
 rPar.Get(0)->PutLong(nVal);
 }
 
@@ -382,16 +378,11 @@ void SbRtl_CSng(StarBASIC *, SbxArray & rPar, bool)  // 
JSM
 
 void SbRtl_CStr(StarBASIC *, SbxArray & rPar, bool)  // JSM
 {
-OUString aString;
-if (rPar.Count() == 2)
-{
-SbxVariable* pSbxVariable = rPar.Get(1);
-aString = pSbxVariable->GetOUString();
-}
-else
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
+if (rPar.Count() != 2)
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+SbxVariable* pSbxVariable = rPar.Get(1);
+OUString aString = pSbxVariable->GetOUString();
 rPar.Get(0)->PutString(aString);
 }
 
@@ -412,98 +403,76 @@ void SbRtl_CVar(StarBASIC *, SbxArray & rPar, bool)  // 
JSM
 
 void SbRtl_CVErr(StarBASIC *, SbxArray & rPar, bool)
 {
-sal_Int16 nErrCode = 0;
-if (rPar.Count() == 2)
-{
-SbxVariable* pSbxVariable = rPar.Get(1);
-nErrCode = 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);
+sal_Int16 nErrCode = pSbxVariable->GetInteger();
 rPar.Get(0)->PutErr(nErrCode);
 }
 
 void SbRtl_Iif(StarBASIC *, SbxArray & rPar, bool) // JSM
 {
-if (rPar.Count() == 4)
+if (rPar.Count() != 4)
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+if (rPar.Get(1)->GetBool())
 {
-if (rPar.Get(1)->GetBool())
-{
-*rPar.Get(0) = *rPar.Get(2);
-}
-else
-{
-*rPar.Get(0) = *rPar.Get(3);
-}
+*rPar.Get(0) = *rPar.Get(2);
 }
 else
 {
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+*rPar.Get(0) = *rPar.Get(3);
 }
+
 }
 
 void SbRtl_GetSystemType(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() != 1)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else
-{
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
 // Removed for SRC595
-rPar.Get(0)->PutInteger(-1);
-}
+rPar.Get(0)->PutInteger(-1);
 }
 
 void SbRtl_GetGUIType(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() != 1)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else
-{
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
 // 17.7.2000 Make simple solution for testtool / fat office
 #if   defined(_WIN32)
-rPar.Get(0)->PutInteger(1);
+rPar.Get(0)->PutInteger(1);
 #elif defined(UNX)
-rPar.Get(0)->PutInteger(4);
+rPar.Get(0)->PutInteger(4);
 #else
-rPar.Get(0)->PutInteger(-1);
+rPar.Get(0)->PutInteger(-1);
 #endif
-}
 }
 
 void SbRtl_Red(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() != 2)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else
-{
-sal_Int32 nRGB = rPar.Get(1)->GetLong();
-nRGB &= 0x00FF;
-nRGB >>= 16;
-rPar.Get(0)->PutInteger(static_cast(nRGB));
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+sal_Int32 nRGB = rPar.Get(1)->GetLong();
+nRGB &= 0x00FF;
+nRGB >>= 16;
+rPar.Get(0)->PutInteger(static_cast(nRGB));
+
 }
 
 void SbRtl_Green(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() != 2)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else
-{
-sal_Int32 nRGB = rPar.Get(1)->GetLong();
-nRGB &= 0xFF00;
-nRGB >>= 8;
-

[Libreoffice-commits] core.git: basic/source

2022-09-05 Thread Arnaud VERSINI (via logerrit)
 basic/source/runtime/methods.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit f2a98e85948451a9540831e0090422f08b945560
Author: Arnaud VERSINI 
AuthorDate: Sun Jul 24 20:07:25 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Sep 5 15:59:06 2022 +0200

BASIC : missing parameter check in SbRtl_CreateObject

Change-Id: I44e8c17274e20eb080494b2eaf25f74d33a35b36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137394
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index c2f979f2cb8f..3b718d78a9af 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -182,6 +182,9 @@ static uno::Reference< ucb::XSimpleFileAccess3 > const & 
getFileAccess()
 
 void SbRtl_CreateObject(StarBASIC * pBasic, SbxArray & rPar, bool)
 {
+if( rPar.Count() < 2 )
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
 OUString aClass(rPar.Get(1)->GetOUString());
 SbxObjectRef p = SbxBase::CreateObject( aClass );
 if( !p.is() )


[Libreoffice-commits] core.git: basic/source

2022-08-18 Thread Caolán McNamara (via logerrit)
 basic/source/classes/sb.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6e1be9f852f8b4901f3ae030fa50282c4468d61e
Author: Caolán McNamara 
AuthorDate: Thu Aug 18 11:54:08 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Aug 18 15:10:02 2022 +0200

cid#1500645 silence Resource leak

Change-Id: I1548017a39f5080dce0731169811fcb0a059c4d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138478
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 4e3e716a56ca..8d87330e469b 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -756,8 +756,8 @@ SbClassModuleObject::~SbClassModuleObject()
 if( !pDocBasicItem->isDocClosed() )
 triggerTerminateEvent();
 
-// prevent the base class destructor from deleting these because
-// we do not actually own them
+// prevent the base class destructor from deleting this because:
+// coverity[leaked_storage] - we do not actually own it
 pImage.release();
 pBreaks = nullptr;
 }


[Libreoffice-commits] core.git: basic/source

2022-08-16 Thread Caolán McNamara (via logerrit)
 basic/source/classes/sbunoobj.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 707f8c10328290c8bcd928755101cbb88ab6a8cb
Author: Caolán McNamara 
AuthorDate: Tue Aug 16 10:00:00 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Aug 16 13:58:45 2022 +0200

cid#1509215 Using a moved object

and

cid#1509294 Using a moved object

Change-Id: Ic4ef9bbc94d7b946d7d1904edf4b5b23278baafd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138348
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/basic/source/classes/sbunoobj.cxx 
b/basic/source/classes/sbunoobj.cxx
index d08460bc6ae4..fd7eee031799 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -4676,7 +4676,8 @@ SbxVariable* SbUnoStructRefObject::Find( const OUString& 
rName, SbxClassType t )
 Property aProp;
 aProp.Name = rName;
 aProp.Type = css::uno::Type( it->second->getTypeClass(), 
it->second->getTypeName() );
-SbUnoProperty* pProp = new SbUnoProperty( rName, eSbxType, 
eRealSbxType, std::move(aProp), 0, false, ( aProp.Type.getTypeClass() == 
css::uno::TypeClass_STRUCT) );
+const bool bIsStruct = aProp.Type.getTypeClass() == 
css::uno::TypeClass_STRUCT;
+SbUnoProperty* pProp = new SbUnoProperty( rName, eSbxType, 
eRealSbxType, std::move(aProp), 0, false, bIsStruct );
 SbxVariableRef xVarRef = pProp;
 QuickInsert( xVarRef.get() );
 pRes = xVarRef.get();
@@ -4736,7 +4737,8 @@ void SbUnoStructRefObject::implCreateAll()
 Property aProp;
 aProp.Name = rName;
 aProp.Type = css::uno::Type( field.second->getTypeClass(), 
field.second->getTypeName() );
-SbUnoProperty* pProp = new SbUnoProperty( rName, eSbxType, 
eRealSbxType, std::move(aProp), 0, false, ( aProp.Type.getTypeClass() == 
css::uno::TypeClass_STRUCT) );
+const bool bIsStruct = aProp.Type.getTypeClass() == 
css::uno::TypeClass_STRUCT;
+SbUnoProperty* pProp = new SbUnoProperty( rName, eSbxType, 
eRealSbxType, std::move(aProp), 0, false, bIsStruct );
 SbxVariableRef xVarRef = pProp;
 QuickInsert( xVarRef.get() );
 }


[Libreoffice-commits] core.git: basic/source bridges/source cppu/source include/vcl slideshow/source sw/source vcl/unx

2022-08-10 Thread Stephan Bergmann (via logerrit)
 basic/source/sbx/sbxobj.cxx  |4 ++--
 basic/source/sbx/sbxvar.cxx  |2 +-
 bridges/source/cpp_uno/shared/component.cxx  |4 ++--
 cppu/source/uno/lbenv.cxx|4 ++--
 include/vcl/weld.hxx |2 +-
 slideshow/source/engine/animationnodes/nodetools.cxx |2 +-
 sw/source/core/fields/cellfml.cxx|   12 ++--
 vcl/unx/gtk3/gtksalmenu.cxx  |2 +-
 8 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit ca550863f7d2e650116582dee298388ea3a97725
Author: Stephan Bergmann 
AuthorDate: Tue Aug 9 11:30:32 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Aug 10 13:40:09 2022 +0200

Better cast to sal_[u]IntPtr when passing pointer to O[U]String::number

Change-Id: I5b7a0fa060c1e0ae4aa194e0c1862f303dd8a2d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138062
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index a6cbeaba5ca7..f83324a26bb8 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -700,7 +700,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
 OString aNameStr(OUStringToOString(GetName(), RTL_TEXTENCODING_ASCII_US));
 OString aClassNameStr(OUStringToOString(aClassName, 
RTL_TEXTENCODING_ASCII_US));
 rStrm.WriteCharPtr( "Object( " )
- .WriteOString( OString::number(reinterpret_cast(this)) 
).WriteCharPtr( "=='" )
+ .WriteOString( OString::number(reinterpret_cast(this)) 
).WriteCharPtr( "=='" )
  .WriteCharPtr( aNameStr.isEmpty() ?  "" : aNameStr.getStr()  
).WriteCharPtr( "', " )
  .WriteCharPtr( "of class '" ).WriteOString( aClassNameStr 
).WriteCharPtr( "', " )
  .WriteCharPtr( "counts " )
@@ -710,7 +710,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
 {
 OString aParentNameStr(OUStringToOString(GetName(), 
RTL_TEXTENCODING_ASCII_US));
 rStrm.WriteCharPtr( "in parent " )
- .WriteOString( 
OString::number(reinterpret_cast(GetParent())) )
+ .WriteOString( 
OString::number(reinterpret_cast(GetParent())) )
  .WriteCharPtr( "=='" ).WriteCharPtr( aParentNameStr.isEmpty() ? 
"" : aParentNameStr.getStr()   ).WriteCharPtr( "'" );
 }
 else
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 947b24ff9421..b73b93c0733d 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -572,7 +572,7 @@ void SbxVariable::Dump( SvStream& rStrm, bool bFill )
 {
 OString aBNameStr(OUStringToOString(GetName( SbxNameType::ShortTypes ), 
RTL_TEXTENCODING_ASCII_US));
 rStrm.WriteCharPtr( "Variable( " )
- .WriteOString( OString::number(reinterpret_cast(this)) 
).WriteCharPtr( "==" )
+ .WriteOString( OString::number(reinterpret_cast(this)) 
).WriteCharPtr( "==" )
  .WriteOString( aBNameStr );
 OString aBParentNameStr(OUStringToOString(GetParent()->GetName(), 
RTL_TEXTENCODING_ASCII_US));
 if ( GetParent() )
diff --git a/bridges/source/cpp_uno/shared/component.cxx 
b/bridges/source/cpp_uno/shared/component.cxx
index cef72d8b6a8e..0a2f1a25150f 100644
--- a/bridges/source/cpp_uno/shared/component.cxx
+++ b/bridges/source/cpp_uno/shared/component.cxx
@@ -88,12 +88,12 @@ static void s_stub_computeObjectIdentifier(va_list * pParam)
 {
 // interface
 OUString aRet =
-OUString::number( reinterpret_cast< sal_Int64 >(xHome.get()), 
16 ) +
+OUString::number( reinterpret_cast< sal_IntPtr >(xHome.get()), 
16 ) +
 ";" +
 // ;environment[context]
 OUString::unacquired(>aBase.pTypeName) +
 "[" +
-OUString::number( reinterpret_cast< sal_Int64 
>(pEnv->aBase.pContext), 16 ) +
+OUString::number( reinterpret_cast< sal_IntPtr 
>(pEnv->aBase.pContext), 16 ) +
 // ];good guid
 cppu_cppenv_getStaticOIdPart();
 *ppOId = aRet.pData;
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index 3e0152c969a1..55195bc228b7 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -850,10 +850,10 @@ static void unoenv_computeObjectIdentifier(
 (*pUnoI->release)( pUnoI );
 OUString aStr(
 // interface
-OUString::number( reinterpret_cast< sal_Int64 >(pUnoI), 16 ) + ";"
+OUString::number( reinterpret_cast< sal_IntPtr >(pUnoI), 16 ) + ";"
 // environment[context]
 + OUString::unacquired(>aBase.pTypeName) + "["
-+ OUString::number( reinterpret_cast< sal_Int64 >(
++ OUString::number( reinterpret_cast< sal_IntPtr >(
 reinterpret_cast<
 uno_Environment * >(pEnv)->pContext ), 16 )
 // 

[Libreoffice-commits] core.git: basic/source chart2/source compilerplugins/clang emfio/source filter/source sc/source sd/source sfx2/source svx/source sw/source vcl/source

2022-07-25 Thread Noel Grandin (via logerrit)
 basic/source/classes/sbunoobj.cxx  |2 
 chart2/source/controller/main/DragMethod_PieSegment.cxx|4 
 chart2/source/controller/main/DragMethod_RotateDiagram.cxx |2 
 compilerplugins/clang/moveit.cxx   |  165 -
 compilerplugins/clang/test/moveit.cxx  |   36 ++
 emfio/source/reader/mtftools.cxx   |4 
 filter/source/msfilter/escherex.cxx|6 
 filter/source/msfilter/msdffimp.cxx|2 
 sc/source/core/tool/scmatrix.cxx   |4 
 sd/source/ui/annotations/annotationtag.cxx |2 
 sd/source/ui/view/DocumentRenderer.cxx |2 
 sfx2/source/dialog/backingwindow.cxx   |2 
 svx/source/customshapes/EnhancedCustomShape2d.cxx  |2 
 svx/source/customshapes/EnhancedCustomShape3d.cxx  |2 
 svx/source/customshapes/EnhancedCustomShapeFontWork.cxx|2 
 svx/source/diagram/IDiagramHelper.cxx  |4 
 svx/source/dialog/contwnd.cxx  |2 
 svx/source/engine3d/dragmt3d.cxx   |2 
 svx/source/engine3d/extrud3d.cxx   |2 
 svx/source/engine3d/lathe3d.cxx|2 
 svx/source/engine3d/view3d.cxx |4 
 svx/source/form/fmtextcontrolshell.cxx |2 
 svx/source/mnuctrls/smarttagmenu.cxx   |2 
 svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx  |4 
 svx/source/sdr/contact/viewcontactofsdredgeobj.cxx |4 
 svx/source/sdr/contact/viewcontactofsdrpathobj.cxx |4 
 svx/source/sdr/overlay/overlaytools.cxx|2 
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx   |4 
 svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx  |2 
 svx/source/svdraw/svdcrtv.cxx  |2 
 svx/source/svdraw/svddrgmt.cxx |   10 
 svx/source/svdraw/svdedtv2.cxx |4 
 svx/source/svdraw/svdfmtf.cxx  |   10 
 svx/source/svdraw/svdobj.cxx   |4 
 svx/source/svdraw/svdotxtr.cxx |4 
 svx/source/svdraw/svdpdf.cxx   |2 
 svx/source/xoutdev/xattr.cxx   |4 
 sw/source/core/fields/expfld.cxx   |2 
 sw/source/uibase/shells/grfsh.cxx  |2 
 sw/source/uibase/shells/textsh1.cxx|4 
 vcl/source/filter/svm/SvmConverter.cxx |   22 -
 vcl/source/gdi/gradient.cxx|2 
 42 files changed, 162 insertions(+), 187 deletions(-)

New commits:
commit 8a843f7e98dfe6bfb04e91e5b16e3a1df18fbf58
Author: Noel Grandin 
AuthorDate: Fri Jul 22 09:54:45 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 25 10:04:06 2022 +0200

loplugin:moveit

make the plugin more conservative, so we see less false+
(although we also miss some possibilities in the process)

Change-Id: I91b1806271e7f802d7459834ab7bcc569047da3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137342
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/classes/sbunoobj.cxx 
b/basic/source/classes/sbunoobj.cxx
index 8ad9e3fe9e66..d08460bc6ae4 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -4714,7 +4714,7 @@ void SbUnoStructRefObject::implCreateDbgProperties()
 QuickInsert( xVarRef.get() );
 
 // Id == -3: output the Methods
-xVarRef = new SbUnoProperty( ID_DBG_METHODS, SbxSTRING, SbxSTRING, aProp, 
-3, false, false );
+xVarRef = new SbUnoProperty( ID_DBG_METHODS, SbxSTRING, SbxSTRING, 
std::move(aProp), -3, false, false );
 QuickInsert( xVarRef.get() );
 }
 
diff --git a/chart2/source/controller/main/DragMethod_PieSegment.cxx 
b/chart2/source/controller/main/DragMethod_PieSegment.cxx
index 002c54ec037d..174f93d2184e 100644
--- a/chart2/source/controller/main/DragMethod_PieSegment.cxx
+++ b/chart2/source/controller/main/DragMethod_PieSegment.cxx
@@ -142,8 +142,8 @@ void DragMethod_PieSegment::createSdrDragEntries()
 
 if( pObj && pPV )
 {
-const basegfx::B2DPolyPolygon aNewPolyPolygon(pObj->TakeXorPoly());
-addSdrDragEntry(std::unique_ptr(new 
SdrDragEntryPolyPolygon(aNewPolyPolygon)));
+basegfx::B2DPolyPolygon aNewPolyPolygon(pObj->TakeXorPoly());
+addSdrDragEntry(std::unique_ptr(new 
SdrDragEntryPolyPolygon(std::move(aNewPolyPolygon;
 }
 }
 } //namespace chart
diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx 
b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx
index 34efccfd9550..fb6aeab01b2b 

[Libreoffice-commits] core.git: basic/source

2022-07-13 Thread Roman Kuznetsov (via logerrit)
 basic/source/runtime/methods.cxx |  114 +++
 1 file changed, 56 insertions(+), 58 deletions(-)

New commits:
commit c2bf1ff91fab4574dd27808a2e4391c7a4b99d20
Author: Roman Kuznetsov 
AuthorDate: Wed Jul 6 10:18:02 2022 +0200
Commit: Roman Kuznetsov 
CommitDate: Wed Jul 13 14:57:10 2022 +0200

tdf#147132 Flatten a Basic function

Change-Id: I85eef5ca499197cfd96fecc4d05a82f7d11089cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136856
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index fe654bbe6fd5..a397a31fddf5 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -889,78 +889,76 @@ void SbRtl_InStrRev(StarBASIC *, SbxArray & rPar, bool)
 const sal_uInt32 nArgCount = rPar.Count() - 1;
 if ( nArgCount < 2 )
 {
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 }
-else
-{
-const OUString aStr1 = rPar.Get(1)->GetOUString();
-const OUString aToken = rPar.Get(2)->GetOUString();
 
-sal_Int32 nStartPos = -1;
-if ( nArgCount >= 3 )
-{
-nStartPos = rPar.Get(3)->GetLong();
-if( nStartPos <= 0 && nStartPos != -1 )
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-nStartPos = -1;
-}
-}
+const OUString aStr1 = rPar.Get(1)->GetOUString();
+const OUString aToken = rPar.Get(2)->GetOUString();
 
-SbiInstance* pInst = GetSbData()->pInst;
-bool bTextMode;
-bool bCompatibility = ( pInst && pInst->IsCompatibility() );
-if( bCompatibility )
-{
-SbiRuntime* pRT = pInst->pRun;
-bTextMode = pRT && pRT->IsImageFlag( SbiImageFlags::COMPARETEXT );
-}
-else
-{
-bTextMode = true;
-}
-if ( nArgCount == 4 )
+sal_Int32 nStartPos = -1;
+if ( nArgCount >= 3 )
+{
+nStartPos = rPar.Get(3)->GetLong();
+if( nStartPos <= 0 && nStartPos != -1 )
 {
-bTextMode = rPar.Get(4)->GetInteger();
+StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+nStartPos = -1;
 }
-const sal_Int32 nStrLen = aStr1.getLength();
-if( nStartPos == -1 )
+}
+
+SbiInstance* pInst = GetSbData()->pInst;
+bool bTextMode;
+bool bCompatibility = ( pInst && pInst->IsCompatibility() );
+if( bCompatibility )
+{
+SbiRuntime* pRT = pInst->pRun;
+bTextMode = pRT && pRT->IsImageFlag( SbiImageFlags::COMPARETEXT );
+}
+else
+{
+bTextMode = true;
+}
+if ( nArgCount == 4 )
+{
+bTextMode = rPar.Get(4)->GetInteger();
+}
+const sal_Int32 nStrLen = aStr1.getLength();
+if( nStartPos == -1 )
+{
+nStartPos = nStrLen;
+}
+
+sal_Int32 nPos = 0;
+if( nStartPos <= nStrLen )
+{
+sal_Int32 nTokenLen = aToken.getLength();
+if( !nTokenLen )
 {
-nStartPos = nStrLen;
+   // Always find empty string
+   nPos = nStartPos;
 }
-
-sal_Int32 nPos = 0;
-if( nStartPos <= nStrLen )
+else if( nStrLen > 0 )
 {
-sal_Int32 nTokenLen = aToken.getLength();
-if( !nTokenLen )
+if( !bTextMode )
 {
-// Always find empty string
-nPos = nStartPos;
+   nPos = aStr1.lastIndexOf( aToken, nStartPos ) + 1;
 }
-else if( nStrLen > 0 )
+else
 {
-if( !bTextMode )
-{
-nPos = aStr1.lastIndexOf( aToken, nStartPos ) + 1;
-}
-else
-{
-// tdf#143332 - case-insensitive operation for non-ASCII 
characters
-i18nutil::SearchOptions2 aSearchOptions;
-aSearchOptions.searchString = aToken;
-aSearchOptions.AlgorithmType2 = 
util::SearchAlgorithms2::ABSOLUTE;
-aSearchOptions.transliterateFlags |= 
TransliterationFlags::IGNORE_CASE;
-utl::TextSearch textSearch(aSearchOptions);
-
-sal_Int32 nStart = 0;
-sal_Int32 nEnd = nStartPos;
-nPos = textSearch.SearchBackward(aStr1, , ) ? 
nStart : 0;
-}
+   // tdf#143332 - case-insensitive operation for non-ASCII 
characters
+   i18nutil::SearchOptions2 aSearchOptions;
+   aSearchOptions.searchString = aToken;
+   aSearchOptions.AlgorithmType2 = 
util::SearchAlgorithms2::ABSOLUTE;
+   aSearchOptions.transliterateFlags |= 
TransliterationFlags::IGNORE_CASE;
+   utl::TextSearch 

[Libreoffice-commits] core.git: basic/source

2022-06-22 Thread Caolán McNamara (via logerrit)
 basic/source/inc/scanner.hxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 5bb823073f9df786eb6dbaaec71f572b2059e818
Author: Caolán McNamara 
AuthorDate: Wed Jun 22 15:56:53 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jun 22 20:08:57 2022 +0200

crashtesting: assert seen with forum-mso-de-125088

where at restoring the SaveIndex the underlying aLine string had
been replaced, so the index is for a different string. Save and
restore the aLine too. Not entirely sure this is what we want,
but it does seem to be what this restoring code expects.

Change-Id: I25bd02fad72d9b0729b9504fe04416340d0e070a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136286
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/basic/source/inc/scanner.hxx b/basic/source/inc/scanner.hxx
index 3f2c7e2e2cff..2a1b48ffdda2 100644
--- a/basic/source/inc/scanner.hxx
+++ b/basic/source/inc/scanner.hxx
@@ -33,6 +33,7 @@ class SbiScanner
 {
 OUString   aBuf; // input buffer
 OUString   aLine;
+OUString   aSaveLine;
 sal_Int32 nLineIdx;
 sal_Int32 nSaveLineIdx;
 StarBASIC* pBasic;  // instance for error callbacks
@@ -80,8 +81,8 @@ public:
 sal_Int32 GetCol1() const   { return nCol1;   }
 void  SetCol1( sal_Int32 n ){ nCol1 = n;  }
 StarBASIC* GetBasic()   { return pBasic;  }
-void  SaveLine(){ nSaveLineIdx = nLineIdx; }
-void  RestoreLine() { nLineIdx = nSaveLineIdx; }
+void  SaveLine(){ aSaveLine = aLine; nSaveLineIdx = 
nLineIdx; }
+void  RestoreLine() { nLineIdx = nSaveLineIdx; aLine = 
aSaveLine; }
 void  LockColumn();
 void  UnlockColumn();
 bool  DoesColonFollow();


[Libreoffice-commits] core.git: basic/source chart2/source compilerplugins/clang cui/source desktop/source drawinglayer/source editeng/source emfio/source filter/source forms/source lingucomponent/sou

2022-06-10 Thread Noel Grandin (via logerrit)
 basic/source/classes/sbunoobj.cxx  |6 
 chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx |6 
 compilerplugins/clang/moveit.cxx   |  250 
++
 compilerplugins/clang/test/moveit.cxx  |   60 ++
 cui/source/dialogs/SpellDialog.cxx |2 
 cui/source/options/optasian.cxx|2 
 cui/source/options/optgdlg.cxx |3 
 cui/source/tabpages/autocdlg.cxx   |4 
 desktop/source/app/officeipcthread.cxx |4 
 drawinglayer/source/primitive2d/svggradientprimitive2d.cxx |2 
 editeng/source/editeng/editdoc.cxx |2 
 editeng/source/editeng/impedit5.cxx|2 
 editeng/source/items/svxfont.cxx   |6 
 editeng/source/misc/svxacorr.cxx   |2 
 emfio/source/reader/emfreader.cxx  |   14 
 emfio/source/reader/mtftools.cxx   |2 
 emfio/source/reader/wmfreader.cxx  |4 
 filter/source/msfilter/svdfppt.cxx |2 
 filter/source/pdf/pdfexport.cxx|2 
 forms/source/runtime/formoperations.cxx|4 
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx  |2 
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx|2 
 reportdesign/source/ui/misc/UITools.cxx|3 
 sc/source/ui/docshell/externalrefmgr.cxx   |2 
 sc/source/ui/view/viewfun2.cxx |4 
 scripting/source/stringresource/stringresource.cxx |4 
 sd/source/core/drawdoc.cxx |3 
 sd/source/ui/animations/CustomAnimationList.cxx|2 
 sdext/source/pdfimport/wrapper/wrapper.cxx |2 
 sfx2/source/control/dispatch.cxx   |2 
 solenv/CompilerTest_compilerplugins_clang.mk   |1 
 sot/source/sdstor/stgdir.cxx   |6 
 svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx |2 
 sw/source/core/SwNumberTree/SwNumberTree.cxx   |2 
 sw/source/core/bastyp/calc.cxx |2 
 sw/source/core/edit/edlingu.cxx|4 
 sw/source/core/fields/expfld.cxx   |3 
 sw/source/core/fields/reffld.cxx   |6 
 sw/source/core/text/guess.cxx  |2 
 sw/source/core/txtnode/thints.cxx  |2 
 sw/source/filter/ww8/ww8scan.cxx   |2 
 toolkit/source/controls/unocontrolmodel.cxx|3 
 ucb/source/ucp/cmis/cmis_content.cxx   |2 
 unoidl/source/sourceprovider-parser.y  |2 
 unoxml/source/rdf/librdf_repository.cxx|2 
 vcl/jsdialog/jsdialogbuilder.cxx   |3 
 vcl/qt5/QtBitmap.cxx   |4 
 vcl/source/control/fmtfield.cxx|3 
 vcl/source/uitest/uno/uiobject_uno.cxx |2 
 vcl/unx/generic/printer/cpdmgr.cxx |2 
 writerfilter/source/rtftok/rtfdispatchdestination.cxx  |2 
 writerfilter/source/rtftok/rtfdispatchsymbol.cxx   |2 
 writerfilter/source/rtftok/rtfdispatchvalue.cxx|2 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   54 +-
 writerfilter/source/rtftok/rtfsdrimport.cxx|2 
 xmloff/source/style/xmlnumfe.cxx   |4 
 56 files changed, 413 insertions(+), 113 deletions(-)

New commits:
commit f71606c920a3f78294da745cd9ef1eacde010224
Author: Noel Grandin 
AuthorDate: Thu Jun 9 08:36:33 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Jun 10 13:13:15 2022 +0200

new loplugin:moveit

look for local variables that can be std::move'd to parameters

off by default, since it doesn't do proper data flow analysis

Change-Id: I3403a0fcffd165bdea6a772528bc53995c5fdb40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135527
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/classes/sbunoobj.cxx 
b/basic/source/classes/sbunoobj.cxx
index 06b67ba8bd86..51b1b956b170 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -2053,7 +2053,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
 {
 

[Libreoffice-commits] core.git: basic/source

2022-06-03 Thread Roman Kuznetsov (via logerrit)
 basic/source/runtime/methods.cxx |   18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

New commits:
commit f30af7b3516d783d717745b63134499ea0d049fc
Author: Roman Kuznetsov 
AuthorDate: Fri Jun 3 14:30:32 2022 +0200
Commit: Roman Kuznetsov 
CommitDate: Fri Jun 3 16:36:32 2022 +0200

tdf#147132 Flatten Basic function

Change-Id: I1e445a565dc9c45810e85b045e68db08a56207f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135271
Tested-by: Jenkins
Reviewed-by: Roman Kuznetsov 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index c6d12c3c033f..2761caba0309 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -771,17 +771,15 @@ void SbRtl_Hex(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() < 2)
 {
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else
-{
-SbxVariableRef pArg = rPar.Get(1);
-// converting value to unsigned and limit to 2 or 4 byte representation
-sal_uInt32 nVal = pArg->IsInteger() ?
-static_cast(pArg->GetInteger()) :
-static_cast(pArg->GetLong());
-rPar.Get(0)->PutString(OUString::number(nVal, 16).toAsciiUpperCase());
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 }
+
+SbxVariableRef pArg = rPar.Get(1);
+// converting value to unsigned and limit to 2 or 4 byte representation
+sal_uInt32 nVal = pArg->IsInteger() ?
+static_cast(pArg->GetInteger()) :
+static_cast(pArg->GetLong());
+rPar.Get(0)->PutString(OUString::number(nVal, 16).toAsciiUpperCase());
 }
 
 void SbRtl_FuncCaller(StarBASIC *, SbxArray & rPar, bool)


[Libreoffice-commits] core.git: basic/source

2022-06-03 Thread Roman Kuznetsov (via logerrit)
 basic/source/runtime/methods.cxx |   49 +++
 1 file changed, 24 insertions(+), 25 deletions(-)

New commits:
commit 66fe1fa945a161b2f617ab3576ddef23d84148f8
Author: Roman Kuznetsov 
AuthorDate: Fri Jun 3 09:11:28 2022 +0200
Commit: Mike Kaganski 
CommitDate: Fri Jun 3 10:17:02 2022 +0200

tdf#147132 Flatten Basic function

Change-Id: Ib2646bfbebdfb6d8e8a3cd1355db75b0405ccfe6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135268
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

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(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(aFileStatus.getFileSize());
+}
+rPar.Get(0)->PutLong(nLen);
 }
 
 
+
 void SbRtl_Hex(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() < 2)


[Libreoffice-commits] core.git: basic/source

2022-06-02 Thread Stephan Bergmann (via logerrit)
 basic/source/classes/sbunoobj.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit c387bc7dd1762f807128ecdbf79ec63884aa33b6
Author: Stephan Bergmann 
AuthorDate: Wed Jun 1 23:35:27 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jun 2 08:07:08 2022 +0200

The elements of XInvocation::invoke aOutParamIndex are non-negative

..so use o3tl::make_unsigned when comparing them against an expression of
unsigned integer type, instead of casting that expression to a signed type

Change-Id: I4fc0bd4447f55d5fd9bf893a4b22d6d2c2cfe3d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135280
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/classes/sbunoobj.cxx 
b/basic/source/classes/sbunoobj.cxx
index ad4aefb52f72..06b67ba8bd86 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -20,6 +20,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1534,7 +1535,7 @@ static Any invokeAutomationMethod( const OUString& Name, 
Sequence< Any > const &
 for( sal_uInt32 j = 0 ; j < nLen ; j++ )
 {
 sal_Int16 iTarget = pIndices[ j ];
-if( iTarget >= static_cast(nParamCount) )
+if( o3tl::make_unsigned(iTarget) >= nParamCount )
 break;
 unoToSbxValue(pParams->Get(j + 1), pNewValues[j]);
 }


[Libreoffice-commits] core.git: basic/source

2022-06-01 Thread Stephan Bergmann (via logerrit)
 basic/source/classes/image.cxx   |6 ++---
 basic/source/inc/image.hxx   |2 -
 basic/source/runtime/runtime.cxx |   40 +++
 3 files changed, 24 insertions(+), 24 deletions(-)

New commits:
commit 0af4324c57a2ee22afcba72c0244c56cb7df8d4b
Author: Stephan Bergmann 
AuthorDate: Wed Jun 1 16:05:07 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jun 1 21:20:29 2022 +0200

Use more appropriate type for SbiImage::GetString nId param

Change-Id: I4207830e3923ce9b4f7c0f59cf5880dfcf89979b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135243
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index 677e0a68c8f1..e5f9ac3f5df2 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -643,14 +643,14 @@ void SbiImage::AddEnum(SbxObject* pObject) // Register 
enum type
 }
 
 // Note: IDs start with 1
-OUString SbiImage::GetString( short nId, SbxDataType *eType ) const
+OUString SbiImage::GetString( sal_uInt32 nId, SbxDataType *eType ) const
 {
-if( nId && nId <= short(mvStringOffsets.size()) )
+if( nId && nId <= mvStringOffsets.size() )
 {
 sal_uInt32 nOff = mvStringOffsets[ nId - 1 ];
 sal_Unicode* pStr = pStrings.get() + nOff;
 
-sal_uInt32 nNextOff = (nId < short(mvStringOffsets.size())) ? 
mvStringOffsets[ nId ] : nStringSize;
+sal_uInt32 nNextOff = (nId < mvStringOffsets.size()) ? 
mvStringOffsets[ nId ] : nStringSize;
 sal_uInt32 nLen = nNextOff - nOff - 1;
 // #i42467: Special treatment for vbNullChar
 if (*pStr == 0)
diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx
index 4bd4201a46f9..f89776af09b9 100644
--- a/basic/source/inc/image.hxx
+++ b/basic/source/inc/image.hxx
@@ -85,7 +85,7 @@ public:
 const sal_uInt8* GetCode() const { return aCode.data(); }
 sal_uInt32 GetCodeSize() const { return aCode.size(); }
 sal_uInt16  GetBase() const { return nDimBase;  }
-OUStringGetString( short nId, SbxDataType *eType = nullptr ) const;
+OUStringGetString( sal_uInt32 nId, SbxDataType *eType = nullptr ) 
const;
 const SbxObject* FindType (const OUString& aTypeName) const;
 
 const SbxArrayRef& GetEnums() const { return rEnums; }
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 871f1127d8a7..f5792fe33dba 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -2848,7 +2848,7 @@ void SbiRuntime::StepLOADNC( sal_uInt32 nOp1 )
 // tdf#143707 - check if the data type character was added after the 
string termination symbol
 SbxDataType eTypeStr;
 // #57844 use localized function
-OUString aStr = pImg->GetString(static_cast(nOp1), );
+OUString aStr = pImg->GetString(nOp1, );
 // also allow , !!!
 sal_Int32 iComma = aStr.indexOf(',');
 if( iComma >= 0 )
@@ -2894,7 +2894,7 @@ void SbiRuntime::StepLOADNC( sal_uInt32 nOp1 )
 void SbiRuntime::StepLOADSC( sal_uInt32 nOp1 )
 {
 SbxVariable* p = new SbxVariable;
-p->PutString( pImg->GetString( static_cast( nOp1 ) ) );
+p->PutString( pImg->GetString( nOp1 ) );
 PushVar( p );
 }
 
@@ -2916,7 +2916,7 @@ void SbiRuntime::StepARGN( sal_uInt32 nOp1 )
 StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR );
 else
 {
-OUString aAlias( pImg->GetString( static_cast( nOp1 ) ) );
+OUString aAlias( pImg->GetString( nOp1 ) );
 SbxVariableRef pVal = PopVar();
 if( bVBAEnabled &&
 ( dynamic_cast( pVal.get()) != nullptr
@@ -3427,7 +3427,7 @@ void SbiRuntime::StepSETCLASS_impl( sal_uInt32 nOp1, bool 
bHandleDflt )
 {
 SbxVariableRef refVal = PopVar();
 SbxVariableRef refVar = PopVar();
-OUString aClass( pImg->GetString( static_cast( nOp1 ) ) );
+OUString aClass( pImg->GetString( nOp1 ) );
 
 bool bOk = checkClass_Impl( refVal, aClass, true, true );
 if( bOk )
@@ -3449,7 +3449,7 @@ void SbiRuntime::StepSETCLASS( sal_uInt32 nOp1 )
 void SbiRuntime::StepTESTCLASS( sal_uInt32 nOp1 )
 {
 SbxVariableRef xObjVal = PopVar();
-OUString aClass( pImg->GetString( static_cast( nOp1 ) ) );
+OUString aClass( pImg->GetString( nOp1 ) );
 bool bDefault = !bVBAEnabled;
 bool bOk = checkClass_Impl( xObjVal, aClass, false, bDefault );
 
@@ -3462,7 +3462,7 @@ void SbiRuntime::StepTESTCLASS( sal_uInt32 nOp1 )
 
 void SbiRuntime::StepLIB( sal_uInt32 nOp1 )
 {
-aLibName = pImg->GetString( static_cast( nOp1 ) );
+aLibName = pImg->GetString( nOp1 );
 }
 
 // TOS is incremented by BASE, BASE is pushed before (+BASE)
@@ -3516,7 +3516,7 @@ SbxVariable* SbiRuntime::FindElement( SbxObject* pObj, 
sal_uInt32 nOp1, sal_uInt
 {
 bool bFatalError = false;
 SbxDataType t = static_cast(nOp2);
-OUString aName( pImg->GetString( static_cast( nOp1 & 0x7FFF ) ) 
);
+

[Libreoffice-commits] core.git: basic/source

2022-05-31 Thread Stephan Bergmann (via logerrit)
 basic/source/sbx/sbxarray.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit bd279d30025e13125e9c5736f7baa9b00484156d
Author: Stephan Bergmann 
AuthorDate: Tue May 31 20:40:55 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Tue May 31 22:42:34 2022 +0200

Use more appropriate index variable type

Change-Id: I0a6de93876d316a1aa094cf98dc2ee5c7eddebbf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135205
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index 4bd933b126ad..ec95e5e10602 100644
--- a/basic/source/sbx/sbxarray.cxx
+++ b/basic/source/sbx/sbxarray.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 struct SbxVarEntry
@@ -562,7 +563,7 @@ bool SbxDimArray::StoreData( SvStream& rStrm ) const
 {
 assert(m_vDimensions.size() <= 
sal::static_int_cast(std::numeric_limits::max()));
 rStrm.WriteInt16( m_vDimensions.size() );
-for( sal_Int32 i = 1; i <= static_cast(m_vDimensions.size()); 
i++ )
+for( std::size_t i = 1; i <= m_vDimensions.size(); i++ )
 {
 sal_Int32 lb32, ub32;
 GetDim(i, lb32, ub32);


[Libreoffice-commits] core.git: basic/source

2022-05-31 Thread Stephan Bergmann (via logerrit)
 basic/source/classes/image.cxx |4 ++--
 basic/source/inc/image.hxx |3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit b19a2dfafa366f5fea1b70a1bae2d39a76a54a8e
Author: Stephan Bergmann 
AuthorDate: Tue May 31 20:39:43 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Tue May 31 22:03:42 2022 +0200

Use more appropriate type for SbiImage::nStringIdx

Change-Id: I1448739b373c6f7b9f5e6ee5a725fa0a129a4fb4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135204
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index 229dc8058518..677e0a68c8f1 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -578,7 +578,7 @@ void SbiImage::MakeStrings( short nSize )
 // growing in 1K-Steps
 void SbiImage::AddString( const OUString& r )
 {
-if( nStringIdx >= short(mvStringOffsets.size()) )
+if( nStringIdx >= mvStringOffsets.size() )
 {
 bError = true;
 }
@@ -606,7 +606,7 @@ void SbiImage::AddString( const OUString& r )
 memcpy( pStrings.get() + nStringOff, r.getStr(), len * sizeof( 
sal_Unicode ) );
 nStringOff = nStringOff + len;
 // Last String? The update the size of the buffer
-if( nStringIdx >= short(mvStringOffsets.size()) )
+if( nStringIdx >= mvStringOffsets.size() )
 {
 nStringSize = nStringOff;
 }
diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx
index b33009c1e029..4bd4201a46f9 100644
--- a/basic/source/inc/image.hxx
+++ b/basic/source/inc/image.hxx
@@ -23,6 +23,7 @@
 #include 
 #include "filefmt.hxx"
 #include 
+#include 
 #include 
 
 // This class reads in the image that's been produced by the compiler
@@ -56,7 +57,7 @@ class SbiImage {
 sal_uInt16 nDimBase;// OPTION BASE value
 rtl_TextEncoding eCharSet;
 // temporary management-variable:
-short  nStringIdx;
+std::size_tnStringIdx;
 sal_uInt32 nStringOff;  // current Pos in the stringbuffer
 // routines for the compiler:
 void MakeStrings( short );  // establish StringPool


[Libreoffice-commits] core.git: basic/source comphelper/source framework/source include/comphelper

2022-05-30 Thread Caolán McNamara (via logerrit)
 basic/source/classes/propacc.cxx  |   15 +++--
 basic/source/inc/propacc.hxx  |3 ++
 comphelper/source/property/propertysetinfo.cxx|   20 --
 framework/source/fwi/uielement/constitemcontainer.cxx |   14 +++-
 include/comphelper/propertysetinfo.hxx|1 
 5 files changed, 20 insertions(+), 33 deletions(-)

New commits:
commit a6856795267509aaf0b4f59a9fb3a626411d1cb6
Author: Caolán McNamara 
AuthorDate: Mon May 30 12:24:42 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon May 30 16:00:35 2022 +0200

cid#1504574 Resource leak

make an owner for the PropertyMapEntries

Change-Id: Ie915a8a312f2b24488566814ad67fdeef89b5941
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135123
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index 06bba39073d7..4c948c3038af 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -54,17 +54,10 @@ Reference< XPropertySetInfo > 
SbPropertyValues::getPropertySetInfo()
 // create on demand?
 if (!m_xInfo.is())
 {
-uno::Sequence props(m_aPropVals.size());
-for (size_t n = 0; n < m_aPropVals.size(); ++n)
-{
-Property  = props.getArray()[n];
-const PropertyValue  = m_aPropVals[n];
-rProp.Name = rPropVal.Name;
-rProp.Handle = rPropVal.Handle;
-rProp.Type = cppu::UnoType::get();
-rProp.Attributes = 0;
-}
-m_xInfo.set(new ::comphelper::PropertySetInfo(props));
+assert(m_aPropInfos.empty());
+for (auto const& it : m_aPropVals)
+m_aPropInfos.emplace_back(it.Name, it.Handle, 
cppu::UnoType::get(), 0, 0);
+m_xInfo.set(new ::comphelper::PropertySetInfo(m_aPropInfos));
 }
 return m_xInfo;
 }
diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx
index 66dd26cefe63..bb2d13d50216 100644
--- a/basic/source/inc/propacc.hxx
+++ b/basic/source/inc/propacc.hxx
@@ -22,11 +22,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
 
 typedef std::vector SbPropertyValueArr_Impl;
+typedef std::vector SbPropertyInfoArr_Impl;
 
 typedef ::cppu::WeakImplHelper< css::beans::XPropertySet,
 css::beans::XPropertyAccess > 
SbPropertyValuesHelper;
@@ -35,6 +37,7 @@ typedef ::cppu::WeakImplHelper< css::beans::XPropertySet,
 class SbPropertyValues final : public SbPropertyValuesHelper
 {
 SbPropertyValueArr_Impl m_aPropVals;
+SbPropertyInfoArr_Impl m_aPropInfos;
 css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo;
 
 private:
diff --git a/comphelper/source/property/propertysetinfo.cxx 
b/comphelper/source/property/propertysetinfo.cxx
index 6385965c0d56..206129c5f595 100644
--- a/comphelper/source/property/propertysetinfo.cxx
+++ b/comphelper/source/property/propertysetinfo.cxx
@@ -47,26 +47,6 @@ PropertySetInfo::PropertySetInfo( o3tl::span pMap ) noex
 }
 }
 
-PropertySetInfo::PropertySetInfo(uno::Sequence const& rProps) 
noexcept
-{
-PropertyMapEntry * pEntries(new PropertyMapEntry[rProps.getLength()]);
-PropertyMapEntry * pEntry([0]);
-for (auto const& it : rProps)
-{
-// check for duplicates
-assert(maPropertyMap.find(it.Name) == maPropertyMap.end());
-
-pEntry->maName = it.Name;
-pEntry->mnHandle = it.Handle;
-pEntry->maType = it.Type;
-pEntry->mnAttributes = it.Attributes;
-pEntry->mnMemberId = 0;
-
-maPropertyMap.emplace(it.Name, pEntry);
-++pEntry;
-}
-}
-
 PropertySetInfo::~PropertySetInfo() noexcept
 {
 }
diff --git a/framework/source/fwi/uielement/constitemcontainer.cxx 
b/framework/source/fwi/uielement/constitemcontainer.cxx
index f9840d52ec3b..7e43a5009c36 100644
--- a/framework/source/fwi/uielement/constitemcontainer.cxx
+++ b/framework/source/fwi/uielement/constitemcontainer.cxx
@@ -190,12 +190,24 @@ Any SAL_CALL ConstItemContainer::getByIndex( sal_Int32 
Index )
 return Any( m_aItemVector[Index] );
 }
 
+namespace
+{
+std::vector makePropertyMap(const 
css::uno::Sequence& rProps)
+{
+std::vector aEntries;
+for (auto const& it : rProps)
+aEntries.emplace_back(it.Name, it.Handle, it.Type, it.Attributes, 
0);
+return aEntries;
+}
+}
+
 // XPropertySet
 Reference< XPropertySetInfo > SAL_CALL ConstItemContainer::getPropertySetInfo()
 {
 // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
 // (Use method "getInfoHelper()".)
-static Reference< XPropertySetInfo > xInfo(new 
comphelper::PropertySetInfo(getInfoHelper().getProperties()));
+static std::vector 
aPropertyInfos(makePropertyMap(getInfoHelper().getProperties()));
+static Reference< XPropertySetInfo > xInfo(new 

[Libreoffice-commits] core.git: basic/source

2022-05-30 Thread Roman Kuznetsov (via logerrit)
 basic/source/runtime/methods.cxx |   14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 43458f83f29067752cfb3df2ccfe0eeb940f4b71
Author: Roman Kuznetsov 
AuthorDate: Sun May 29 15:32:53 2022 +0200
Commit: Roman Kuznetsov 
CommitDate: Mon May 30 08:45:42 2022 +0200

tdf#147132 Flatten Basic function implementation

Change-Id: Ife73d08e57bb1c896a27f8cbbd6b1f4b106587a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135062
Tested-by: Jenkins
Reviewed-by: Roman Kuznetsov 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 4dbe3f526626..122e87947ee0 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -721,14 +721,12 @@ void SbRtl_SendKeys(StarBASIC *, SbxArray & rPar, bool)
 void SbRtl_Exp(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() < 2)
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-else
-{
-double aDouble = rPar.Get(1)->GetDouble();
-aDouble = exp( aDouble );
-checkArithmeticOverflow( aDouble );
-rPar.Get(0)->PutDouble(aDouble);
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+double aDouble = rPar.Get(1)->GetDouble();
+aDouble = exp( aDouble );
+checkArithmeticOverflow( aDouble );
+rPar.Get(0)->PutDouble(aDouble);
 }
 
 void SbRtl_FileLen(StarBASIC *, SbxArray & rPar, bool)


[Libreoffice-commits] core.git: basic/source svx/source

2022-05-24 Thread Noel Grandin (via logerrit)
 basic/source/classes/sb.cxx  |2 +-
 svx/source/svdraw/presetooxhandleadjustmentrelations.cxx |   10 ++
 2 files changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 30f1ef51e59f00aad687b7b1f59592111feb1269
Author: Noel Grandin 
AuthorDate: Mon May 23 14:17:19 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue May 24 08:08:07 2022 +0200

elide some OUString allocation

Change-Id: Iacbf1da6cdc77466d9f9da399b5cc17f5a87f0ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134833
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index def34b3718d6..570447246cf9 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1305,7 +1305,7 @@ SbxVariable* StarBASIC::Find( const OUString& rName, 
SbxClassType t )
 }
 }
 }
-OUString aMainStr("Main");
+static constexpr OUStringLiteral aMainStr(u"Main");
 if( !pRes && pNamed && ( t == SbxClassType::Method || t == 
SbxClassType::DontCare ) &&
 !pNamed->GetName().equalsIgnoreAsciiCase( aMainStr ) )
 {
diff --git a/svx/source/svdraw/presetooxhandleadjustmentrelations.cxx 
b/svx/source/svdraw/presetooxhandleadjustmentrelations.cxx
index 5e31fd3e6341..528c8b35cd50 100644
--- a/svx/source/svdraw/presetooxhandleadjustmentrelations.cxx
+++ b/svx/source/svdraw/presetooxhandleadjustmentrelations.cxx
@@ -25,7 +25,7 @@ struct HandleAdjRel
 // Shape name without leading "ooxml-", underscore, zero based handle index
 // e.g. The third handle in shape of type "ooxml-circularArrow" will be
 // identified by key "circularArrow_2"
-const OUString sShape_Handle;
+const char* sShape_Handle;
 
 // 4 tokens with separator "|"
 // first: RefX or RefR, na if not exists
@@ -35,13 +35,13 @@ struct HandleAdjRel
 // e.g. The third handle in shape  has in the preset
 // the tag  .
 // The resulting value in the map here is "RefR|adj5|na|na"
-const OUString sAdjReferences;
+const char* sAdjReferences;
 };
 
 // The array initializer has been extracted from
 // oox/source/drawingml/customshapes/presetShapeDefinitions.xml
 // by using an XSLT file. That file is attached to tdf#126512.
-const HandleAdjRel aHandleAdjRelArray[]
+constexpr HandleAdjRel aHandleAdjRelArray[]
 = { { "accentBorderCallout1_0", "RefX|adj2|RefY|adj1" },
 { "accentBorderCallout1_1", "RefX|adj4|RefY|adj3" },
 { "accentBorderCallout2_0", "RefX|adj2|RefY|adj1" },
@@ -308,8 +308,10 @@ void PresetOOXHandleAdj::GetOOXHandleAdjRelation(
 {
 static const HandleAdjRelHashMap s_HashMap = []() {
 HandleAdjRelHashMap aH;
+aH.reserve(std::size(aHandleAdjRelArray));
 for (const auto& item : aHandleAdjRelArray)
-aH[item.sShape_Handle] = item.sAdjReferences;
+aH.emplace(OUString::createFromAscii(item.sShape_Handle),
+   OUString::createFromAscii(item.sAdjReferences));
 return aH;
 }();
 


[Libreoffice-commits] core.git: basic/source

2022-05-24 Thread Noel Grandin (via logerrit)
 basic/source/basmgr/basicmanagerrepository.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 086e5347dcf71bab57c66afd23218ac08623b7ed
Author: Noel Grandin 
AuthorDate: Mon May 23 17:18:11 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue May 24 08:07:31 2022 +0200

elide OUString allocation

Change-Id: I92d487b657c7d67a4301a499ba05b4b285cfed3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134837
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/basmgr/basicmanagerrepository.cxx 
b/basic/source/basmgr/basicmanagerrepository.cxx
index 0b34621bfcb8..aed39f9f2924 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -382,7 +382,7 @@ namespace basic
 try
 {
 // ensure there's a standard library in the basic container
-OUString aStdLibName( "Standard" );
+static constexpr OUStringLiteral aStdLibName( u"Standard" );
 if ( !_rxBasicLibraries->hasByName( aStdLibName ) )
 {
 _rxBasicLibraries->createLibrary( aStdLibName );


[Libreoffice-commits] core.git: basic/source compilerplugins/clang sal/qa sd/qa sw/source unoxml/source vcl/unx

2022-05-18 Thread Stephan Bergmann (via logerrit)
 basic/source/classes/sbxmod.cxx  |6 +++---
 compilerplugins/clang/redundantcast.cxx  |   10 ++
 compilerplugins/clang/test/redundantcast.cxx |6 ++
 sal/qa/rtl/textenc/rtl_textcvt.cxx   |2 +-
 sd/qa/unit/tiledrendering/tiledrendering.cxx |2 +-
 sw/source/core/tox/txmsrt.cxx|2 +-
 sw/source/core/txtnode/swfont.cxx|8 
 unoxml/source/dom/node.cxx   |2 +-
 unoxml/source/rdf/librdf_repository.cxx  |2 +-
 vcl/unx/generic/window/salframe.cxx  |2 +-
 vcl/unx/gtk3/gtkinst.cxx |2 +-
 11 files changed, 30 insertions(+), 14 deletions(-)

New commits:
commit 41a967af06a9584a997e11079c3c931d34158c09
Author: Stephan Bergmann 
AuthorDate: Wed May 18 09:51:46 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed May 18 10:52:59 2022 +0200

Extend loplugin:redundantcast to trivial reinterpret_cast from T to itself

Change-Id: I7c0be7b435d6b5f97bdd40484023584146638d70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134506
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 67bf03ef9ecb..1e5e7ec36a7f 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1450,7 +1450,7 @@ const sal_uInt8* SbModule::FindNextStmnt( const 
sal_uInt8* p, sal_uInt16& nLine,
 const sal_uInt8* SbModule::FindNextStmnt( const sal_uInt8* p, sal_uInt16& 
nLine, sal_uInt16& nCol,
 bool bFollowJumps, const SbiImage* pImg ) const
 {
-sal_uInt32 nPC = static_cast( p - reinterpret_cast(pImage->GetCode()) );
+sal_uInt32 nPC = static_cast( p - pImage->GetCode() );
 while( nPC < pImage->GetCodeSize() )
 {
 SbiOpcode eOp = static_cast( *p++ );
@@ -1460,7 +1460,7 @@ const sal_uInt8* SbModule::FindNextStmnt( const 
sal_uInt8* p, sal_uInt16& nLine,
 SAL_WARN_IF( !pImg, "basic", "FindNextStmnt: pImg==NULL with 
FollowJumps option" );
 sal_uInt32 nOp1 = *p++; nOp1 |= *p++ << 8;
 nOp1 |= *p++ << 16; nOp1 |= *p++ << 24;
-p = reinterpret_cast(pImg->GetCode()) + nOp1;
+p = pImg->GetCode() + nOp1;
 }
 else if( eOp >= SbiOpcode::SbOP1_START && eOp <= SbiOpcode::SbOP1_END )
 {
@@ -1497,7 +1497,7 @@ bool SbModule::IsBreakable( sal_uInt16 nLine ) const
 {
 if( !pImage )
 return false;
-const sal_uInt8* p = reinterpret_cast(pImage->GetCode());
+const sal_uInt8* p = pImage->GetCode();
 sal_uInt16 nl, nc;
 while( ( p = FindNextStmnt( p, nl, nc ) ) != nullptr )
 if( nl == nLine )
diff --git a/compilerplugins/clang/redundantcast.cxx 
b/compilerplugins/clang/redundantcast.cxx
index 1cfe44c9305e..87c4d14458fd 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -577,6 +577,16 @@ bool RedundantCast::VisitCXXReinterpretCastExpr(
 if (ignoreLocation(expr)) {
 return true;
 }
+if (expr->getTypeAsWritten() == expr->getSubExprAsWritten()->getType())
+//TODO: instead of exact QualType match, allow some variation?
+{
+report(
+DiagnosticsEngine::Warning, "redundant reinterpret_cast from %0 to 
%1",
+expr->getExprLoc())
+<< expr->getSubExprAsWritten()->getType() << 
expr->getTypeAsWritten()
+<< expr->getSourceRange();
+return true;
+}
 if (auto const sub = dyn_cast(expr->getSubExpr())) {
 if (sub->getCastKind() == CK_ArrayToPointerDecay && sub->getType() == 
expr->getType())
 //TODO: instead of exact QualType match, allow some variation?
diff --git a/compilerplugins/clang/test/redundantcast.cxx 
b/compilerplugins/clang/test/redundantcast.cxx
index d1803aafbca7..7a102cca5d0a 100644
--- a/compilerplugins/clang/test/redundantcast.cxx
+++ b/compilerplugins/clang/test/redundantcast.cxx
@@ -329,6 +329,11 @@ void testArithmeticTypedefs() {
 (void) static_cast(c); // expected-error {{redundant}}
 }
 
+void testReinterpretCast() {
+int * p;
+(void) reinterpret_cast(p); // expected-error {{redundant 
reinterpret_cast from 'int *' to 'int *' [loplugin:redundantcast]}}
+}
+
 void testReinterpretConstCast() {
 int n = 0;
 (void) reinterpret_cast((const_cast())); // 
expected-error-re {{redundant const_cast from 'int *' to 'const int *' within 
reinterpret_cast to fundamental type 'std::size_t' (aka 'unsigned {{.+}}') 
[loplugin:redundantcast]}}
@@ -442,6 +447,7 @@ int main() {
 testFunctionalCast();
 testCStyleCast();
 testCStyleCastOfTemplateMethodResult(nullptr);
+testReinterpretCast();
 testReinterpretConstCast();
 testDynamicCast();
 testIntermediaryStaticCast();
diff --git a/sal/qa/rtl/textenc/rtl_textcvt.cxx 
b/sal/qa/rtl/textenc/rtl_textcvt.cxx
index 8fa8b4e8dc96..55804bd32838 100644
--- 

[Libreoffice-commits] core.git: basic/source

2022-05-11 Thread Noel Grandin (via logerrit)
 basic/source/classes/sbunoobj.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit cfb15d06e82ff9af6a9de2dab815b15e9724c9c6
Author: Noel Grandin 
AuthorDate: Wed May 11 13:17:38 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed May 11 21:55:45 2022 +0200

in SbUnoObject constructor, only query for XTypeProvider

if we're going to use the result

Change-Id: I49ad11e287f58c1021e509f56d934aa3ce745b0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134201
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/classes/sbunoobj.cxx 
b/basic/source/classes/sbunoobj.cxx
index 3dc1b8f643a0..8968f19161c5 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -2311,12 +2311,9 @@ SbUnoObject::SbUnoObject( const OUString& aName_, const 
Any& aUnoObj_ )
 return;
 }
 
-Reference< XTypeProvider > xTypeProvider;
 // Did the object have an invocation itself?
 mxInvocation.set( x, UNO_QUERY );
 
-xTypeProvider.set( x, UNO_QUERY );
-
 if( mxInvocation.is() )
 {
 
@@ -2324,6 +2321,7 @@ SbUnoObject::SbUnoObject( const OUString& aName_, const 
Any& aUnoObj_ )
 mxExactNameInvocation.set( mxInvocation, UNO_QUERY );
 
 // The remainder refers only to the introspection
+Reference< XTypeProvider > xTypeProvider( x, UNO_QUERY );
 if( !xTypeProvider.is() )
 {
 bNeedIntrospection = false;


[Libreoffice-commits] core.git: basic/source include/basic scripting/source sfx2/source

2022-05-11 Thread Noel Grandin (via logerrit)
 basic/source/basmgr/basmgr.cxx |   19 +--
 include/basic/basmgr.hxx   |4 ++--
 scripting/source/basprov/basscript.cxx |2 +-
 sfx2/source/appl/macroloader.cxx   |2 +-
 4 files changed, 13 insertions(+), 14 deletions(-)

New commits:
commit cde416fea13c6020805ac663e254a50b2c885abd
Author: Noel Grandin 
AuthorDate: Wed May 11 13:17:09 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed May 11 21:55:11 2022 +0200

in SetGlobalUNOConstant, only retrieve old value if we need it

removes some unnecessary Find() work

Change-Id: I6af9c4d9a043d4361fcca1a034b2025fe7c10c28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134200
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index fec7e5eaa496..4e01bff8cc9d 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1367,25 +1367,24 @@ bool BasicManager::GetGlobalUNOConstant( const 
OUString& rName, uno::Any& aOut )
 return bRes;
 }
 
-uno::Any BasicManager::SetGlobalUNOConstant( const OUString& rName, const 
uno::Any& _rValue )
+void BasicManager::SetGlobalUNOConstant( const OUString& rName, const 
uno::Any& _rValue, css::uno::Any* pOldValue )
 {
-uno::Any aOldValue;
-
 StarBASIC* pStandardLib = GetStdLib();
 OSL_PRECOND( pStandardLib, "BasicManager::SetGlobalUNOConstant: no lib to 
insert into!" );
 if ( !pStandardLib )
-return aOldValue;
+return;
 
-// obtain the old value
-SbxVariable* pVariable = pStandardLib->Find( rName, SbxClassType::Object );
-if ( pVariable )
-aOldValue = sbxToUnoValue( pVariable );
+if (pOldValue)
+{
+// obtain the old value
+SbxVariable* pVariable = pStandardLib->Find( rName, 
SbxClassType::Object );
+if ( pVariable )
+*pOldValue = sbxToUnoValue( pVariable );
+}
 SbxObjectRef xUnoObj = GetSbUnoObject( _rValue.getValueType ().getTypeName 
() , _rValue );
 xUnoObj->SetName(rName);
 xUnoObj->SetFlag( SbxFlagBits::DontStore );
 pStandardLib->Insert( xUnoObj.get() );
-
-return aOldValue;
 }
 
 bool BasicManager::LegacyPsswdBinaryLimitExceeded( std::vector< OUString >& 
_out_rModuleNames )
diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx
index 11c90fea1dfa..94fea1a0bf77 100644
--- a/include/basic/basmgr.hxx
+++ b/include/basic/basmgr.hxx
@@ -174,10 +174,10 @@ public:
 /** sets a global constant in the basic library, referring to some UNO 
object, to a new value.
 
 If a constant with this name already existed before, its value is 
changed, and the old constant is
-returned. If it does not yet exist, it is newly created, and inserted 
into the basic library.
+returned in pOldValue. If it does not yet exist, it is newly created, 
and inserted into the basic library.
 */
 IF_MERGELIBS(BASIC_DLLPUBLIC)
-css::uno::Any   SetGlobalUNOConstant( const OUString& rName, const 
css::uno::Any& _rValue );
+voidSetGlobalUNOConstant( const OUString& rName, const 
css::uno::Any& _rValue, css::uno::Any* pOldValue = nullptr );
 
 /** retrieves a global constant in the basic library, referring to some 
UNO object, returns true if a value is found ( value is in aOut ) false 
otherwise. */
 IF_MERGELIBS(BASIC_DLLPUBLIC)
diff --git a/scripting/source/basprov/basscript.cxx 
b/scripting/source/basprov/basscript.cxx
index d64fa5af4357..b5a3f6136534 100644
--- a/scripting/source/basprov/basscript.cxx
+++ b/scripting/source/basprov/basscript.cxx
@@ -242,7 +242,7 @@ constexpr OUStringLiteral BASSCRIPT_PROPERTY_CALLER = 
u"Caller";
 // if it's a document-based script, temporarily reset 
ThisComponent to the script invocation context
 Any aOldThisComponent;
 if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
-aOldThisComponent = 
m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", Any( 
m_xDocumentScriptContext ) );
+m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", 
Any( m_xDocumentScriptContext ),  );
 
 if ( m_caller.hasElements() && m_caller[ 0 ].hasValue()  )
 {
diff --git a/sfx2/source/appl/macroloader.cxx b/sfx2/source/appl/macroloader.cxx
index fff7fc140450..0892bb78e4d9 100644
--- a/sfx2/source/appl/macroloader.cxx
+++ b/sfx2/source/appl/macroloader.cxx
@@ -275,7 +275,7 @@ ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, 
css::uno::Any& rRetval,
 if ( bSetGlobalThisComponent )
 {
 // document is executed via AppBASIC, adjust ThisComponent 
variable
-aOldThisComponent = pAppMgr->SetGlobalUNOConstant( 
"ThisComponent", Any( pDoc->GetModel() ) );
+pAppMgr->SetGlobalUNOConstant( "ThisComponent", Any( 
pDoc->GetModel() ),  );
 }
 
 

[Libreoffice-commits] core.git: basic/source

2022-05-10 Thread Noel Grandin (via logerrit)
 basic/source/uno/namecont.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 3c25a2a114c0bb66641ad27499610fe5ee4393b9
Author: Noel Grandin 
AuthorDate: Tue May 10 12:42:13 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue May 10 19:41:31 2022 +0200

tdf#121740 dont bother checking for VBA libraries

speeds up loading by 2%

Change-Id: I63bf7ea2ab8087d6bb60b655fdf7718532050b89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134114
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 2ff7817dd44a..2f7d76d2251e 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -972,6 +972,10 @@ void SfxLibraryContainer::init_Impl( const OUString& 
rInitialDocumentURL,
 if( meInitMode != DEFAULT )
 return;
 
+// tdf#121740 speed up loading documents with lots of embedded documents 
by avoid the UCB work of updating non-existent VBA libraries
+if (rInitialDocumentURL.isEmpty())
+return;
+
 INetURLObject aUserBasicInetObj( o3tl::getToken(maLibraryPath, 1, ';') );
 OUString aStandardStr("Standard");
 


[Libreoffice-commits] core.git: basic/source

2022-05-10 Thread Noel Grandin (via logerrit)
 basic/source/uno/namecont.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit e7d3243d22d6a94930e0cd21721442a2608e03fa
Author: Noel Grandin 
AuthorDate: Tue May 10 11:28:12 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue May 10 19:25:41 2022 +0200

move creation of xParser to where it is used

Change-Id: I03511a8c7b01b0abb69b276b900bf712549e5873
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134113
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 86b7d699fe9a..2ff7817dd44a 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -649,8 +649,6 @@ void SfxLibraryContainer::init_Impl( const OUString& 
rInitialDocumentURL,
 maLibraryPath = SvtPathOptions().GetBasicPath();
 }
 
-Reference< XParser > xParser = xml::sax::Parser::create(mxContext);
-
 uno::Reference< io::XInputStream > xInput;
 
 mxStorage = xStorage;
@@ -784,6 +782,7 @@ void SfxLibraryContainer::init_Impl( const OUString& 
rInitialDocumentURL,
 // start parsing
 auto pLibArray = std::make_unique<::xmlscript::LibDescriptorArray> 
( );
 
+Reference< XParser > xParser = xml::sax::Parser::create(mxContext);
 try
 {
 xParser->setDocumentHandler( 
::xmlscript::importLibraryContainer( pLibArray.get() ) );


[Libreoffice-commits] core.git: basic/source

2022-05-10 Thread Caolán McNamara (via logerrit)
 basic/source/runtime/methods.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 070b34c2a40c5e7d93022e331a5c90626ca603eb
Author: Caolán McNamara 
AuthorDate: Tue May 10 08:54:42 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue May 10 10:51:20 2022 +0200

fix --disable-scripting build

Change-Id: I41e0da3d379d54ec59f9eba46978cfe7f9e09d33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134105
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 4393041b7808..4dbe3f526626 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -110,6 +110,8 @@ using namespace com::sun::star::uno;
 
 #include 
 
+static sal_Int32 GetDayDiff(const Date& rDate) { return rDate - 
Date(1899'12'30); }
+
 #if HAVE_FEATURE_SCRIPTING
 
 static void FilterWhiteSpace( OUString& rStr )
@@ -133,8 +135,6 @@ static void FilterWhiteSpace( OUString& rStr )
 rStr = aRet.makeStringAndClear();
 }
 
-static sal_Int32 GetDayDiff(const Date& rDate) { return rDate - 
Date(1899'12'30); }
-
 static const CharClass& GetCharClass()
 {
 static CharClass aCharClass( Application::GetSettings().GetLanguageTag() );


[Libreoffice-commits] core.git: basic/source vbahelper/source

2022-05-09 Thread Mike Kaganski (via logerrit)
 basic/source/runtime/methods1.cxx |3 +--
 vbahelper/source/vbahelper/vbaapplicationbase.cxx |3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit bc1ab88ffa21ab67dbd56b5d3c724fe28c2b5a5b
Author: Mike Kaganski 
AuthorDate: Mon May 9 18:32:54 2022 +0100
Commit: Mike Kaganski 
CommitDate: Tue May 10 06:58:24 2022 +0200

More usual 1899-12-30 base Date in Basic

Omissions from commit 8189d815641c583b5506d482f0b4f1ab47924f6a

Change-Id: I6b205f7bcc9ff9c30e55b03d39d02b9be15a01c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134064
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/methods1.cxx 
b/basic/source/runtime/methods1.cxx
index 6ce744dbe034..f0c26ae5a9de 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -3033,9 +3033,8 @@ bool LibreOffice6FloatingPointMode()
 
 sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam, sal_Int16 
nFirstDay )
 {
-Date aRefDate( 1,1,1900 );
+Date aRefDate(1899'12'30);
 sal_Int32 nDays = static_cast(aDate);
-nDays -= 2; // normalize: 1.1.1900 => 0
 aRefDate.AddDays( nDays);
 DayOfWeek aDay = aRefDate.GetDayOfWeek();
 sal_Int16 nDay;
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx 
b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index f5624d40bc9f..fe00e0c89739 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -75,9 +75,8 @@ public:
 static double GetNow()
 {
 DateTime aNow( DateTime::SYSTEM );
-Date aRefDate( 1,1,1900 );
+Date aRefDate(1899'12'30);
 tools::Long nDiffDays = aNow - aRefDate;
-nDiffDays += 2; // Change VisualBasic: 1.Jan.1900 == 2
 
 tools::Long nDiffSeconds = aNow.GetHour() * 3600 + aNow.GetMin() * 60 
+ aNow.GetSec();
 return static_cast(nDiffDays) + 
static_cast(nDiffSeconds)/double(24*3600);


[Libreoffice-commits] core.git: basic/source

2022-05-09 Thread Mike Kaganski (via logerrit)
 basic/source/runtime/methods.cxx |   19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

New commits:
commit ced3501a93fd44621d7d5e0479df72657a0f085d
Author: Mike Kaganski 
AuthorDate: Mon May 9 16:31:32 2022 +0100
Commit: Mike Kaganski 
CommitDate: Mon May 9 21:42:29 2022 +0200

Unify and simplify SbRtl_Hex and SbRtl_Oct

OUStringNumber::toAsciiUpperCase is cheaper than OUString::toAsciiUpperCase.

Let SbRtl_Oct use OUString::number as well.

Change-Id: I3a97ec5d3a7b0005fc300310198bae47c62dfbc6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134061
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 2ebae2751157..4393041b7808 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -783,9 +783,7 @@ void SbRtl_Hex(StarBASIC *, SbxArray & rPar, bool)
 sal_uInt32 nVal = pArg->IsInteger() ?
 static_cast(pArg->GetInteger()) :
 static_cast(pArg->GetLong());
-OUString aStr(OUString::number( nVal, 16 ));
-aStr = aStr.toAsciiUpperCase();
-rPar.Get(0)->PutString(aStr);
+rPar.Get(0)->PutString(OUString::number(nVal, 16).toAsciiUpperCase());
 }
 }
 
@@ -1202,17 +1200,12 @@ void SbRtl_Oct(StarBASIC *, SbxArray & rPar, bool)
 }
 else
 {
-char aBuffer[16];
 SbxVariableRef pArg = rPar.Get(1);
-if ( pArg->IsInteger() )
-{
-snprintf( aBuffer, sizeof(aBuffer), "%o", pArg->GetInteger() );
-}
-else
-{
-snprintf( aBuffer, sizeof(aBuffer), "%lo", static_cast(pArg->GetLong()) );
-}
-rPar.Get(0)->PutString(OUString::createFromAscii(aBuffer));
+// converting value to unsigned and limit to 2 or 4 byte representation
+sal_uInt32 nVal = pArg->IsInteger() ?
+static_cast(pArg->GetInteger()) :
+static_cast(pArg->GetLong());
+rPar.Get(0)->PutString(OUString::number(nVal, 8));
 }
 }
 


[Libreoffice-commits] core.git: basic/source

2022-05-09 Thread Mike Kaganski (via logerrit)
 basic/source/runtime/methods.cxx |   33 ++---
 1 file changed, 6 insertions(+), 27 deletions(-)

New commits:
commit 8189d815641c583b5506d482f0b4f1ab47924f6a
Author: Mike Kaganski 
AuthorDate: Mon May 9 16:09:21 2022 +0100
Commit: Mike Kaganski 
CommitDate: Mon May 9 19:04:46 2022 +0200

Use usual 1899-12-30 base Date in Basic

It matches VBA, has an optimization in the code, and doesn't
need any additional "-2" hackery.

Change-Id: I4b90674ae643788eda5ce618b4c42e2cc045ec04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134060
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index e86ac2d64c63..2ebae2751157 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -133,7 +133,7 @@ static void FilterWhiteSpace( OUString& rStr )
 rStr = aRet.makeStringAndClear();
 }
 
-static tools::Long GetDayDiff( const Date& rDate );
+static sal_Int32 GetDayDiff(const Date& rDate) { return rDate - 
Date(1899'12'30); }
 
 static const CharClass& GetCharClass()
 {
@@ -1681,9 +1681,8 @@ void SbRtl_Val(StarBASIC *, SbxArray & rPar, bool)
 // Helper functions for date conversion
 sal_Int16 implGetDateDay( double aDate )
 {
-aDate -= 2.0; // standardize: 1.1.1900 => 0.0
 aDate = floor( aDate );
-Date aRefDate( 1, 1, 1900 );
+Date aRefDate(1899'12'30);
 aRefDate.AddDays( aDate );
 
 sal_Int16 nRet = static_cast( aRefDate.GetDay() );
@@ -1692,9 +1691,8 @@ sal_Int16 implGetDateDay( double aDate )
 
 sal_Int16 implGetDateMonth( double aDate )
 {
-Date aRefDate( 1,1,1900 );
+Date aRefDate(1899'12'30);
 sal_Int32 nDays = static_cast(aDate);
-nDays -= 2; // standardize: 1.1.1900 => 0.0
 aRefDate.AddDays( nDays );
 sal_Int16 nRet = static_cast( aRefDate.GetMonth() );
 return nRet;
@@ -4653,28 +4651,10 @@ void SbRtl_Partition(StarBASIC *, SbxArray & rPar, bool)
 
 #endif
 
-static tools::Long GetDayDiff( const Date& rDate )
-{
-Date aRefDate( 1,1,1900 );
-tools::Long nDiffDays;
-if ( aRefDate > rDate )
-{
-nDiffDays = aRefDate - rDate;
-nDiffDays *= -1;
-}
-else
-{
-nDiffDays = rDate - aRefDate;
-}
-nDiffDays += 2; // adjustment VisualBasic: 1.Jan.1900 == 2
-return nDiffDays;
-}
-
 sal_Int16 implGetDateYear( double aDate )
 {
-Date aRefDate( 1,1,1900 );
-tools::Long nDays = static_cast(aDate);
-nDays -= 2; // standardize: 1.1.1900 => 0.0
+Date aRefDate(1899'12'30);
+sal_Int32 nDays = static_cast(aDate);
 aRefDate.AddDays( nDays );
 sal_Int16 nRet = aRefDate.GetYear();
 return nRet;
@@ -4786,8 +4766,7 @@ bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, 
sal_Int16 nDay,
 }
 }
 
-tools::Long nDiffDays = GetDayDiff( aCurDate );
-rdRet = static_cast(nDiffDays);
+rdRet = GetDayDiff(aCurDate);
 return true;
 }
 


[Libreoffice-commits] core.git: basic/source

2022-05-09 Thread Xisco Fauli (via logerrit)
 basic/source/sbx/sbxarray.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 7251f9c1b840721b5ba1f1d5f8b65b405260945b
Author: Xisco Fauli 
AuthorDate: Mon May 9 17:03:50 2022 +0200
Commit: Xisco Fauli 
CommitDate: Mon May 9 18:30:35 2022 +0200

basic: remove commented out line

Introduced in 90d33f5945336fa46b7c02f425100af794768b15
"tdf#148358 - Compare Non-ASCII variable names case-insensitive"

Change-Id: I5bccb3f2f54ac61f2fbf960e78e3d4e4a0893f85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134081
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index 5f70345e6f2a..53c0ed36fa73 100644
--- a/basic/source/sbx/sbxarray.cxx
+++ b/basic/source/sbx/sbxarray.cxx
@@ -277,7 +277,6 @@ SbxVariable* SbxArray::Find( const OUString& rName, 
SbxClassType t )
 return nullptr;
 bool bExtSearch = IsSet( SbxFlagBits::ExtSearch );
 sal_uInt16 nHash = SbxVariable::MakeHashCode( rName );
-//const OUString aNameCI = SbxVariable::NameToCaseInsensitiveName(rName);
 const OUString aNameCI = SbxVariable::NameToCaseInsensitiveName(rName);
 for (auto& rEntry : mVarEntries)
 {


[Libreoffice-commits] core.git: basic/source

2022-05-09 Thread Mike Kaganski (via logerrit)
 basic/source/runtime/methods.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7c8f27e3d8ff9c22409313a093bf538256fa2f7f
Author: Mike Kaganski 
AuthorDate: Mon May 9 15:39:39 2022 +0100
Commit: Mike Kaganski 
CommitDate: Mon May 9 17:52:11 2022 +0200

sal_Int32 cast to tools::Long to pass to a function taking sal_Int32

Change-Id: I81bb794e6a154dd3d022b34ce1348f32c854f52b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134059
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 8cc49c2a5024..e86ac2d64c63 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -765,7 +765,7 @@ void SbRtl_FileLen(StarBASIC *, SbxArray & rPar, bool)
 (void)aItem.getFileStatus( aFileStatus );
 nLen = static_cast(aFileStatus.getFileSize());
 }
-rPar.Get(0)->PutLong(static_cast(nLen));
+rPar.Get(0)->PutLong(nLen);
 }
 }
 


[Libreoffice-commits] core.git: basic/source bridges/source chart2/source comphelper/source connectivity/source cppuhelper/source cui/source dbaccess/source desktop/source editeng/source extensions/so

2022-05-05 Thread Noel Grandin (via logerrit)
 basic/source/classes/eventatt.cxx  |   10 +-
 bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx  |5 -
 chart2/source/controller/main/DrawCommandDispatch.cxx  |5 -
 comphelper/source/misc/servicedecl.cxx |1 
 connectivity/source/commontools/AutoRetrievingBase.cxx |3 
 connectivity/source/drivers/flat/ETable.cxx|4 -
 connectivity/source/drivers/postgresql/pq_databasemetadata.cxx |   22 ++---
 cppuhelper/source/servicemanager.cxx   |2 
 cppuhelper/source/shlib.cxx|1 
 cui/source/customize/CustomNotebookbarGenerator.cxx|3 
 cui/source/customize/SvxNotebookbarConfigPage.cxx  |2 
 cui/source/dialogs/scriptdlg.cxx   |3 
 cui/source/options/optaboutconfig.cxx  |1 
 cui/source/options/optpath.cxx |2 
 cui/source/tabpages/numpages.cxx   |5 -
 dbaccess/source/ui/app/AppControllerDnD.cxx|4 -
 dbaccess/source/ui/misc/HtmlReader.cxx |2 
 desktop/source/splash/splash.cxx   |1 
 editeng/source/outliner/outliner.cxx   |   12 +--
 extensions/source/bibliography/bibload.cxx |5 -
 filter/source/msfilter/escherex.cxx|   17 ++--
 filter/source/msfilter/util.cxx|5 -
 fpicker/source/office/iodlg.cxx|6 -
 framework/source/accelerators/acceleratorconfiguration.cxx |   32 
 framework/source/uiconfiguration/windowstateconfiguration.cxx  |   17 ++--
 framework/source/uielement/styletoolbarcontroller.cxx  |   13 +--
 helpcompiler/source/HelpIndexer.cxx|5 -
 idlc/source/astdeclaration.cxx |1 
 idlc/source/idlccompile.cxx|   12 +--
 idlc/source/idlcproduce.cxx|8 +-
 idlc/source/options.cxx|3 
 idlc/source/scanner.l  |7 +
 jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx   |3 
 jvmfwk/plugins/sunmajor/pluginlib/util.cxx |2 
 l10ntools/source/cfgmerge.cxx  |1 
 lingucomponent/source/lingutil/lingutil.cxx|2 
 oox/source/ole/axcontrol.cxx   |8 +-
 oox/source/vml/vmlshape.cxx|6 -
 reportdesign/source/filter/xml/xmlExport.cxx   |   17 ++--
 reportdesign/source/filter/xml/xmlGroup.cxx|   25 +++---
 reportdesign/source/ui/report/ReportController.cxx |   20 ++---
 sc/source/core/tool/ddelink.cxx|   11 +-
 sc/source/filter/excel/xecontent.cxx   |4 -
 sc/source/filter/html/htmlpars.cxx |2 
 sc/source/filter/oox/sheetdatacontext.cxx  |   10 +-
 sc/source/ui/miscdlgs/sharedocdlg.cxx  |4 -
 sc/source/ui/vba/vbafont.cxx   |7 +
 sc/source/ui/view/viewfun5.cxx |5 -
 sd/source/filter/ppt/pptinanimations.cxx   |   10 +-
 sd/source/ui/docshell/docshel2.cxx |   21 ++---
 sd/source/ui/framework/factories/FullScreenPane.cxx|9 +-
 sd/source/ui/func/fuexecuteinteraction.cxx |7 +
 sd/source/ui/slideshow/slideshowimpl.cxx   |6 -
 sd/source/ui/unoidl/unoobj.cxx |   25 ++
 sfx2/source/appl/newhelp.cxx   |   10 +-
 svl/source/misc/inettype.cxx   |2 
 svtools/source/config/extcolorcfg.cxx  |   11 +-
 svtools/source/misc/imagemgr.cxx   |   12 +--
 svx/source/form/fmobj.cxx  |5 -
 sw/source/core/doc/docnum.cxx  |   14 +--
 sw/source/core/tox/tox.cxx |   40 
+-
 sw/source/filter/html/htmlform.cxx |5 -
 sw/source/filter/html/parcss1.cxx  |7 +
 sw/source/ui/dbui/createaddresslistdialog.cxx  |   11 +-
 sw/source/ui/dialog/uiregionsw.cxx |   22 ++---
 sw/source/ui/fldui/fldvar.cxx  |4 -
 sw/source/ui/index/cnttab.cxx  |8 +-
 sw/source/uibase/dochdl/gloshdl.cxx  

[Libreoffice-commits] core.git: basic/source

2022-04-27 Thread Caolán McNamara (via logerrit)
 basic/source/uno/namecont.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 09530aec3c0687df316704eec96b3e2a96b1d804
Author: Caolán McNamara 
AuthorDate: Wed Apr 27 11:54:55 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Apr 27 15:58:45 2022 +0200

cid#738565 Uninitialized scalar field

Change-Id: I17a675d3b7468e528faef89de7ea862de37a57db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133504
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 21baaf99fb5c..f7eae5d4ef08 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -345,6 +345,7 @@ SfxLibraryContainer::SfxLibraryContainer()
 , maVBAScriptListeners( m_aMutex )
 , mnRunningVBAScripts( 0 )
 , mbVBACompat( false )
+, meVBATextEncoding( RTL_TEXTENCODING_DONTKNOW )
 , maModifiable( *this, m_aMutex )
 , maNameContainer( new NameContainer(cppu::UnoType::get()) )
 , mbOldInfoFormat( false )


[Libreoffice-commits] core.git: basic/source

2022-04-21 Thread Julien Nabet (via logerrit)
 basic/source/inc/rtlproto.hxx|1 +
 basic/source/runtime/methods.cxx |   20 +---
 basic/source/runtime/stdobj.cxx  |7 +++
 3 files changed, 25 insertions(+), 3 deletions(-)

New commits:
commit 98f88ac1ffaee21f38615f9db27691b01491457c
Author: Julien Nabet 
AuthorDate: Mon Apr 18 19:37:10 2022 +0200
Commit: Julien Nabet 
CommitDate: Thu Apr 21 09:59:43 2022 +0200

tdf#148651: implement VBA.FormatPercent

I started from a copy/paste of FormatNumber.
Then I deduplicated the code (it saved about 99% of it).

Change-Id: Ibcb9ffbf8cebf45d5ffac4713e3d220b8499ba11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133133
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/basic/source/inc/rtlproto.hxx b/basic/source/inc/rtlproto.hxx
index 6296a0475b5e..002359435749 100644
--- a/basic/source/inc/rtlproto.hxx
+++ b/basic/source/inc/rtlproto.hxx
@@ -232,6 +232,7 @@ extern void SbRtl_IsUnoStruct(StarBASIC * pBasic, SbxArray 
& rPar, bool bWrite);
 extern void SbRtl_FileDateTime(StarBASIC * pBasic, SbxArray & rPar, bool 
bWrite);
 extern void SbRtl_Format(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
 extern void SbRtl_FormatNumber(StarBASIC* pBasic, SbxArray& rPar, bool bWrite);
+extern void SbRtl_FormatPercent(StarBASIC* pBasic, SbxArray& rPar, bool 
bWrite);
 extern void SbRtl_GetAttr(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
 extern void SbRtl_Randomize(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); 
// JSM
 extern void SbRtl_Round(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 2bc1fb64f07c..17b6092a3278 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3298,8 +3298,7 @@ void SbRtl_Format(StarBASIC *, SbxArray & rPar, bool)
 }
 }
 
-// 
https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/formatnumber-function
-void SbRtl_FormatNumber(StarBASIC*, SbxArray& rPar, bool)
+static void lcl_FormatNumberPercent(SbxArray& rPar, bool isPercent)
 {
 const sal_uInt32 nArgCount = rPar.Count();
 if (nArgCount < 2 || nArgCount > 6)
@@ -3382,6 +3381,8 @@ void SbRtl_FormatNumber(StarBASIC*, SbxArray& rPar, bool)
 }
 
 double fVal = rPar.Get(1)->GetDouble();
+if (isPercent)
+fVal *= 100;
 const bool bNegative = fVal < 0;
 if (bNegative)
 fVal = fabs(fVal); // Always work with non-negatives, to easily handle 
leading zero
@@ -3413,10 +3414,23 @@ void SbRtl_FormatNumber(StarBASIC*, SbxArray& rPar, 
bool)
 else
 aResult.insert(0, '-');
 }
-
+if (isPercent)
+aResult.append('%');
 rPar.Get(0)->PutString(aResult.makeStringAndClear());
 }
 
+// 
https://docs.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/formatnumber-function
+void SbRtl_FormatNumber(StarBASIC*, SbxArray& rPar, bool)
+{
+return lcl_FormatNumberPercent(rPar, false);
+}
+
+// 
https://docs.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/formatpercent-function
+void SbRtl_FormatPercent(StarBASIC*, SbxArray& rPar, bool)
+{
+return lcl_FormatNumberPercent(rPar, true);
+}
+
 namespace {
 
 // note: BASIC does not use comphelper::random, because
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 6f38e12e03a9..215f879369df 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -401,6 +401,13 @@ constexpr Method aMethods[] = {
 arg(u"useParensForNegativeNumbers", SbxINTEGER, OPT_), // vbTriState
 arg(u"groupDigits", SbxINTEGER, OPT_), // vbTriState
 
+{ u"FormatPercent",  SbxSTRING,   5 | FUNCTION_ | COMPATONLY_, 
SbRtl_FormatPercent  },
+arg(u"expression",  SbxDOUBLE),
+arg(u"numDigitsAfterDecimal",   SbxINTEGER, OPT_),
+arg(u"includeLeadingDigit", SbxINTEGER, OPT_), // vbTriState
+arg(u"useParensForNegativeNumbers", SbxINTEGER, OPT_), // vbTriState
+arg(u"groupDigits", SbxINTEGER, OPT_), // vbTriState
+
 { u"Frac",  SbxDOUBLE,   1 | FUNCTION_,
SbRtl_Frac },
 arg(u"number", SbxDOUBLE),
 


[Libreoffice-commits] core.git: basic/source

2022-04-15 Thread Stephan Bergmann (via logerrit)
 basic/source/runtime/dllmgr-x64.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit f23f594b17a2b117e0940ecff86b878955bf6e3e
Author: Stephan Bergmann 
AuthorDate: Thu Apr 14 23:03:16 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Apr 15 08:38:43 2022 +0200

loplugin:stringviewparam

Change-Id: Id3bd8576b134728140dc68b00eebf78a8f3fd4ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133056
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/basic/source/runtime/dllmgr-x64.cxx 
b/basic/source/runtime/dllmgr-x64.cxx
index 82d909398a77..0a3d334ce49d 100644
--- a/basic/source/runtime/dllmgr-x64.cxx
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -483,7 +484,7 @@ struct ProcData {
 };
 
 ErrCode call(
-OUString const & dll, ProcData const & proc, SbxArray * arguments,
+std::u16string_view dll, ProcData const & proc, SbxArray * arguments,
 SbxVariable & result)
 {
 if (arguments && arguments->Count() > 20)
@@ -497,7 +498,7 @@ ErrCode call(
 // requires special handling in unmarshalString; other functions might
 // require similar treatment, too:
 bool special =
-dll.equalsIgnoreAsciiCase("KERNEL32.DLL") &&
+o3tl::equalsIgnoreAsciiCase(dll, u"KERNEL32.DLL") &&
 (proc.name == "GetLogicalDriveStringsA");
 for (sal_uInt32 i = 1; i < (arguments == nullptr ? 0 : 
arguments->Count()); ++i)
 {


[Libreoffice-commits] core.git: basic/source chart2/source connectivity/source editeng/source filter/source framework/source include/comphelper include/o3tl oox/source sc/source sdext/source sd/source

2022-04-08 Thread Noel Grandin (via logerrit)
 basic/source/runtime/dllmgr-x64.cxx|3 
 basic/source/runtime/dllmgr-x86.cxx|3 
 chart2/source/tools/InternalDataProvider.cxx   |   16 +-
 chart2/source/tools/PropertyHelper.cxx |2 
 chart2/source/tools/XMLRangeHelper.cxx |4 
 connectivity/source/drivers/dbase/DTable.cxx   |7 -
 connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx |5 
 connectivity/source/drivers/odbc/ODatabaseMetaData.cxx |6 -
 editeng/source/misc/svxacorr.cxx   |4 
 filter/source/msfilter/util.cxx|4 
 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx   |4 
 framework/source/fwe/helper/actiontriggerhelper.cxx|4 
 include/comphelper/string.hxx  |   58 
--
 include/o3tl/string_view.hxx   |   26 
 oox/source/docprop/docprophandler.cxx  |   18 +--
 oox/source/drawingml/customshapepresetdata.cxx |6 -
 oox/source/drawingml/customshapeproperties.cxx |4 
 oox/source/drawingml/hyperlinkcontext.cxx  |4 
 oox/source/helper/attributelist.cxx|   14 +-
 oox/source/ole/axcontrol.cxx   |6 -
 oox/source/ppt/pptshape.cxx|6 -
 oox/source/ppt/presentationfragmenthandler.cxx |8 -
 oox/source/vml/vmldrawing.cxx  |4 
 oox/source/vml/vmlformatting.cxx   |8 -
 oox/source/vml/vmlshape.cxx|8 -
 oox/source/vml/vmlshapecontext.cxx |4 
 sc/source/core/data/global2.cxx|8 -
 sc/source/core/data/table4.cxx |5 
 sc/source/filter/oox/formulaparser.cxx |6 -
 sc/source/filter/oox/pagesettings.cxx  |6 -
 sc/source/filter/oox/sheetdatacontext.cxx  |6 -
 sc/source/ui/docshell/impex.cxx|   12 +-
 sc/source/ui/miscdlgs/acredlin.cxx |4 
 sd/source/filter/xml/sdxmlwrp.cxx  |6 -
 sd/source/ui/presenter/PresenterTextView.cxx   |6 -
 sdext/source/pdfimport/wrapper/wrapper.cxx |6 -
 sfx2/source/appl/appopen.cxx   |3 
 sfx2/source/appl/childwin.cxx  |7 -
 sfx2/source/bastyp/mieclip.cxx |9 -
 sfx2/source/doc/docfile.cxx|3 
 sfx2/source/doc/sfxbasemodel.cxx   |3 
 svl/source/numbers/zformat.cxx |4 
 svx/source/xoutdev/xattr.cxx   |4 
 sw/source/core/doc/doclay.cxx  |4 
 sw/source/core/doc/docnum.cxx  |3 
 sw/source/core/doc/doctxm.cxx  |4 
 sw/source/core/docnode/ndsect.cxx  |4 
 sw/source/core/fields/cellfml.cxx  |3 
 sw/source/core/unocore/XMLRangeHelper.cxx  |4 
 sw/source/core/unocore/unotbl.cxx  |3 
 sw/source/filter/ascii/wrtasc.cxx  |4 
 sw/source/filter/html/htmlatr.cxx  |4 
 sw/source/filter/ww8/wrtww8gr.cxx  |4 
 sw/source/ui/vba/vbaparagraphformat.cxx|4 
 sw/source/uibase/app/docsh2.cxx|2 
 sw/source/uibase/fldui/fldmgr.cxx  |5 
 sw/source/uibase/misc/redlndlg.cxx |4 
 sw/source/uibase/uiview/view2.cxx  |5 
 sw/source/uibase/utlui/unotools.cxx|2 
 ucbhelper/source/client/proxydecider.cxx   |6 -
 unotools/source/config/dynamicmenuoptions.cxx  |4 
 vbahelper/source/vbahelper/vbalineformat.cxx   |2 
 vcl/source/control/field2.cxx  |9 -
 vcl/source/pdf/PDFiumLibrary.cxx   |   14 +-
 vcl/unx/generic/printer/jobdata.cxx|   12 +-
 vcl/unx/generic/printer/ppdparser.cxx  |7 -
 writerfilter/source/dmapper/ConversionHelper.cxx   |6 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx  |6 -
 writerfilter/source/rtftok/rtfdocumentimpl.cxx  

[Libreoffice-commits] core.git: basic/source

2022-04-08 Thread Mike Kaganski (via logerrit)
 basic/source/runtime/dllmgr-x64.cxx |1 +
 basic/source/runtime/dllmgr-x86.cxx |1 +
 2 files changed, 2 insertions(+)

New commits:
commit ad7b90fc541413f091f6ff4bc7e2ced9fee8700b
Author: Mike Kaganski 
AuthorDate: Fri Apr 8 16:03:22 2022 +0300
Commit: Mike Kaganski 
CommitDate: Fri Apr 8 16:39:19 2022 +0200

Fix build

... after commit 36e0e88b28e818faf25b8e32cc8c4dc444b8a0be

Change-Id: I540d19f7146651035cd5fafe077c0ccdfcee11ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132733
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/dllmgr-x64.cxx 
b/basic/source/runtime/dllmgr-x64.cxx
index 15226cc3fb3c..2372ecd7144d 100644
--- a/basic/source/runtime/dllmgr-x64.cxx
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -31,6 +31,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/basic/source/runtime/dllmgr-x86.cxx 
b/basic/source/runtime/dllmgr-x86.cxx
index 3433282c22ec..32ddf68b6818 100644
--- a/basic/source/runtime/dllmgr-x86.cxx
+++ b/basic/source/runtime/dllmgr-x86.cxx
@@ -31,6 +31,7 @@
 
 #include 
 #include 
+#include 
 #include "runtime.hxx"
 #include 
 #include 


[Libreoffice-commits] core.git: basic/source chart2/source connectivity/source editeng/source filter/source framework/source oox/source sc/source sd/source sfx2/source svl/source svx/source sw/source

2022-04-08 Thread Noel Grandin (via logerrit)
 basic/source/runtime/dllmgr-x64.cxx|2 -
 basic/source/runtime/dllmgr-x86.cxx|2 -
 chart2/source/tools/InternalDataProvider.cxx   |   15 
 chart2/source/tools/PropertyHelper.cxx |3 +
 chart2/source/tools/XMLRangeHelper.cxx |3 +
 connectivity/source/drivers/dbase/DTable.cxx   |6 +--
 connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx |4 +-
 connectivity/source/drivers/odbc/ODatabaseMetaData.cxx |5 +-
 editeng/source/misc/svxacorr.cxx   |3 +
 filter/source/msfilter/util.cxx|3 +
 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx   |3 +
 framework/source/fwe/helper/actiontriggerhelper.cxx|3 +
 oox/source/docprop/docprophandler.cxx  |   17 
+-
 oox/source/drawingml/customshapepresetdata.cxx |5 +-
 oox/source/drawingml/customshapeproperties.cxx |3 +
 oox/source/drawingml/hyperlinkcontext.cxx  |3 +
 oox/source/helper/attributelist.cxx|   13 ---
 oox/source/ole/axcontrol.cxx   |5 +-
 oox/source/ppt/pptshape.cxx|5 +-
 oox/source/ppt/presentationfragmenthandler.cxx |7 ++--
 oox/source/vml/vmldrawing.cxx  |3 +
 oox/source/vml/vmlformatting.cxx   |7 ++--
 oox/source/vml/vmlshape.cxx|7 ++--
 oox/source/vml/vmlshapecontext.cxx |3 +
 sc/source/core/data/global2.cxx|7 ++--
 sc/source/core/data/table4.cxx |4 +-
 sc/source/filter/oox/formulaparser.cxx |5 +-
 sc/source/filter/oox/pagesettings.cxx  |5 +-
 sc/source/filter/oox/sheetdatacontext.cxx  |5 +-
 sc/source/ui/docshell/impex.cxx|   11 +++---
 sc/source/ui/miscdlgs/acredlin.cxx |3 +
 sd/source/filter/xml/sdxmlwrp.cxx  |5 +-
 sd/source/ui/presenter/PresenterTextView.cxx   |5 +-
 sfx2/source/appl/appopen.cxx   |3 +
 sfx2/source/appl/childwin.cxx  |6 +--
 sfx2/source/bastyp/mieclip.cxx |9 ++---
 sfx2/source/doc/docfile.cxx|3 +
 sfx2/source/doc/sfxbasemodel.cxx   |3 +
 svl/source/numbers/zformat.cxx |2 -
 svx/source/xoutdev/xattr.cxx   |3 +
 sw/source/core/doc/doclay.cxx  |   10 +++--
 sw/source/core/doc/docnum.cxx  |2 -
 sw/source/core/doc/doctxm.cxx  |3 +
 sw/source/core/docnode/ndsect.cxx  |3 +
 sw/source/core/fields/cellfml.cxx  |2 -
 sw/source/core/unocore/XMLRangeHelper.cxx  |4 +-
 sw/source/core/unocore/unotbl.cxx  |2 -
 sw/source/filter/html/htmlatr.cxx  |   11 +++---
 sw/source/filter/html/wrthtml.hxx  |2 -
 sw/source/filter/ww8/wrtww8gr.cxx  |3 +
 sw/source/ui/vba/vbaparagraphformat.cxx|3 +
 sw/source/uibase/app/docsh2.cxx|3 +
 sw/source/uibase/fldui/fldmgr.cxx  |4 +-
 sw/source/uibase/misc/redlndlg.cxx |3 +
 sw/source/uibase/uiview/view2.cxx  |5 +-
 ucbhelper/source/client/proxydecider.cxx   |5 +-
 unotools/source/config/dynamicmenuoptions.cxx  |8 ++--
 vbahelper/source/vbahelper/vbalineformat.cxx   |2 -
 vcl/inc/ppdparser.hxx  |2 -
 vcl/source/control/field2.cxx  |8 ++--
 vcl/source/pdf/PDFiumLibrary.cxx   |   13 ---
 vcl/unx/generic/printer/jobdata.cxx|   11 +++---
 vcl/unx/generic/printer/ppdparser.cxx  |   17 
--
 writerfilter/source/dmapper/ConversionHelper.cxx   |5 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx  |7 ++--
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 +--
 xmloff/source/chart/SchXMLChartContext.cxx |5 +-
 

[Libreoffice-commits] core.git: basic/source chart2/qa comphelper/source compilerplugins/clang connectivity/source desktop/source filter/source forms/source include/comphelper include/o3tl l10ntools/i

2022-04-08 Thread Noel Grandin (via logerrit)
 basic/source/sbx/sbxcurr.cxx  |   36 +---
 chart2/qa/extras/chart2dump/chart2dump.cxx|5 +
 comphelper/source/misc/string.cxx |2 
 compilerplugins/clang/stringviewparam.cxx |3 -
 connectivity/source/drivers/firebird/Util.cxx |9 +--
 connectivity/source/drivers/firebird/Util.hxx |2 
 desktop/source/app/officeipcthread.cxx|9 +--
 filter/source/msfilter/msvbahelper.cxx|   31 +-
 forms/source/xforms/xpathlib/xpathlib.cxx |7 +-
 include/comphelper/string.hxx |2 
 include/o3tl/string_view.hxx  |   66 ++
 l10ntools/inc/lngmerge.hxx|2 
 l10ntools/source/lngmerge.cxx |   12 ++--
 sw/source/filter/ww8/docxattributeoutput.cxx  |8 +-
 sw/source/filter/ww8/docxattributeoutput.hxx  |2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 +
 16 files changed, 138 insertions(+), 63 deletions(-)

New commits:
commit 3a88b513fd90f4793b6de7a7412fa33369542f40
Author: Noel Grandin 
AuthorDate: Thu Apr 7 10:46:26 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Apr 8 10:26:10 2022 +0200

loplugin:stringviewparam convert methods using trim

for which we add a new o3tl::trim method

Change-Id: I9d37b6264eea106aa2f3502bd24b8cccf7850938
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132658
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx
index 416229afbc95..ad558f2284c1 100644
--- a/basic/source/sbx/sbxcurr.cxx
+++ b/basic/source/sbx/sbxcurr.cxx
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 #include "sbxconv.hxx"
 
 
@@ -85,7 +86,7 @@ static OUString ImpCurrencyToString( sal_Int64 rVal )
 }
 
 
-static sal_Int64 ImpStringToCurrency( const OUString  )
+static sal_Int64 ImpStringToCurrency( std::u16string_view rStr )
 {
 
 sal_Int32   nFractDigit = 4;
@@ -99,50 +100,47 @@ static sal_Int64 ImpStringToCurrency( const OUString  
)
 // we should share some existing ( possibly from calc is there a currency
 // conversion there ? #TODO check )
 
-OUString sTmp( rStr.trim() );
-const sal_Unicode* p =  sTmp.getStr();
+std::u16string_view sTmp = o3tl::trim( rStr );
+auto p = sTmp.begin();
+auto pEnd = sTmp.end();
 
 // normalise string number by removing thousand & decimal point separators
-OUStringBuffer sNormalisedNumString( sTmp.getLength() +  nFractDigit );
+OUStringBuffer sNormalisedNumString( static_cast(sTmp.size()) + 
nFractDigit );
 
-if ( *p == '-'  || *p == '+' )
+if ( p != pEnd && (*p == '-'  || *p == '+' ) )
 sNormalisedNumString.append( *p++ );
 
-while ( *p >= '0' && *p <= '9' )
+while ( p != pEnd && *p >= '0' && *p <= '9' )
 {
 sNormalisedNumString.append( *p++ );
 // #TODO in vba mode set runtime error when a space ( or other )
 // illegal character is found
-if( *p == c1000Sep )
+if( p != pEnd && *p == c1000Sep )
 p++;
 }
 
 bool bRoundUp = false;
 
-if( *p == cDeciPnt )
+if( p != pEnd && *p == cDeciPnt )
 {
 p++;
-while( nFractDigit && *p >= '0' && *p <= '9' )
+while( nFractDigit && p != pEnd && *p >= '0' && *p <= '9' )
 {
 sNormalisedNumString.append( *p++ );
 nFractDigit--;
 }
 // Consume trailing content
-if ( p != nullptr )
-{
-// Round up if necessary
-if( *p >= '5' && *p <= '9' )
-bRoundUp = true;
-while( *p >= '0' && *p <= '9' )
-p++;
-}
-
+// Round up if necessary
+if( p != pEnd && *p >= '5' && *p <= '9' )
+bRoundUp = true;
+while( p != pEnd && *p >= '0' && *p <= '9' )
+p++;
 }
 // can we raise error here ? ( previous behaviour was more forgiving )
 // so... not sure that could break existing code, let's see if anyone
 // complains.
 
-if ( p != sTmp.getStr() + sTmp.getLength() )
+if ( p != pEnd )
 SbxBase::SetError( ERRCODE_BASIC_CONVERSION );
 while( nFractDigit )
 {
diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx 
b/chart2/qa/extras/chart2dump/chart2dump.cxx
index bae904d4faf3..7418b80a8d5a 100644
--- a/chart2/qa/extras/chart2dump/chart2dump.cxx
+++ b/chart2/qa/extras/chart2dump/chart2dump.cxx
@@ -16,6 +16,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -157,12 +158,12 @@ protected:
 return OUString(sTemp.data(), sTemp.length(), RTL_TEXTENCODING_UTF8);
 }
 
-void writeActual(const OUString& sActualValue, const OUString& sCheck)
+void writeActual(std::u16string_view sActualValue, const OUString& sCheck)
 {
 assert(m_bDumpMode);
 assert(m_aDumpFile.is_open());
 

[Libreoffice-commits] core.git: basic/source include/basic

2022-04-05 Thread Mike Kaganski (via logerrit)
 basic/source/classes/sb.cxx |5 +
 basic/source/sbx/sbxvar.cxx |8 +++-
 include/basic/sbxvar.hxx|1 +
 3 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit b32c85d0beb219e9f4ba9f043ae712b5d3ce2c18
Author: Mike Kaganski 
AuthorDate: Tue Apr 5 09:38:11 2022 +0300
Commit: Mike Kaganski 
CommitDate: Tue Apr 5 11:30:24 2022 +0200

Move creation of case-insensitive variable name to a central place

SbxVariable::NameToCaseInsensitiveName might then be used wherever
such names may be needed (see e.g. tdf#148358).

Change-Id: I7749a12a05225398848cbf72700c6f0bc119bc22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132561
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 902f7adfd91f..def34b3718d6 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -47,9 +47,6 @@
 #include 
 #include 
 
-#include 
-#include 
-
 #include 
 #include 
 
@@ -2079,7 +2076,7 @@ sal_Int32 BasicCollection::implGetIndexForName(const 
OUString& rName)
 if (pVar->GetHashCode() == nNameHash)
 {
 if (aNameCI.isEmpty() && !rName.isEmpty())
-aNameCI = SbGlobal::GetTransliteration().transliterate(rName, 
0, rName.getLength());
+aNameCI = SbxVariable::NameToCaseInsensitiveName(rName);
 if (aNameCI == pVar->GetName(SbxNameType::CaseInsensitive))
 return i;
 }
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index a08122961b66..f0d99d7f3654 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -181,6 +181,12 @@ void SbxVariable::SetParameters( SbxArray* p )
 
 // Name of the variables
 
+// static
+OUString SbxVariable::NameToCaseInsensitiveName(const OUString& rName)
+{
+return SbGlobal::GetTransliteration().transliterate(rName, 0, 
rName.getLength());
+}
+
 void SbxVariable::SetName( const OUString& rName )
 {
 maName = rName;
@@ -198,7 +204,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
 if (t == SbxNameType::CaseInsensitive)
 {
 if (maNameCI.isEmpty() && !maName.isEmpty())
-maNameCI = SbGlobal::GetTransliteration().transliterate(maName, 0, 
maName.getLength());
+maNameCI = NameToCaseInsensitiveName(maName);
 return maNameCI;
 }
 // Request parameter-information (not for objects)
diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx
index d302f26637bd..01f5b650ebe0 100644
--- a/include/basic/sbxvar.hxx
+++ b/include/basic/sbxvar.hxx
@@ -271,6 +271,7 @@ public:
 void SetName( const OUString& );
 const OUString& GetName( SbxNameType = SbxNameType::NONE ) const;
 sal_uInt16 GetHashCode() const  { return nHash; }
+static OUString NameToCaseInsensitiveName(const OUString& rName);
 
 virtual void SetModified( bool ) override;
 


  1   2   3   4   5   6   7   8   >