[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;
 


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

2022-04-04 Thread Mike Kaganski (via logerrit)
 basic/source/classes/sb.cxx   |   16 
 basic/source/inc/sbunoobj.hxx |2 +-
 basic/source/sbx/sbxvar.cxx   |9 +
 include/basic/sbxdef.hxx  |1 +
 include/basic/sbxvar.hxx  |6 +++---
 5 files changed, 22 insertions(+), 12 deletions(-)

New commits:
commit de81c2545aec06a1b269218b7d00656e97d8b66c
Author: Mike Kaganski 
AuthorDate: Mon Apr 4 09:58:53 2022 +0300
Commit: Mike Kaganski 
CommitDate: Mon Apr 4 11:06:00 2022 +0200

Related: tdf#144245 Optimize case-insensitive handling

1. Make BasicCollection::implGetIndexForName take OUString again,
after commit f7de7de1189ae4e63f73468076da47b37fe61ede made it take
std::u16string_view. All call sites pass OUStrings, and commit
ef32c3b4f9b80918d6018e14297fa41245afd381 made it create OUString
from the argument.
2. Have SbxVariable cache a case-insensitive variant of the name.
It is currently only used in the Collection implementation, but
may be used in other places; Tthe names are case-insensitive in
Basic, and VBA allows non-ASCII characters in names, so this
caching might be useful elsewhere.
3. Skip non-ASCII characters when calculating name hash, to allow
non-ASCII-containing strings still have some hash variance, when
at least some of the first 6 characters are ASCII.

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

diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 5c99408847b6..902f7adfd91f 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -2065,26 +2065,26 @@ sal_Int32 BasicCollection::implGetIndex( SbxVariable 
const * pIndexVar )
 return nIndex;
 }
 
-sal_Int32 BasicCollection::implGetIndexForName(std::u16string_view rName)
+sal_Int32 BasicCollection::implGetIndexForName(const OUString& rName)
 {
-sal_Int32 nIndex = -1;
 sal_Int32 nCount = xItemArray->Count();
 sal_Int32 nNameHash = MakeHashCode( rName );
 
 // tdf#144245 - case-insensitive operation for non-ASCII characters
-utl::TransliterationWrapper& rTransliteration = 
SbGlobal::GetTransliteration();
+OUString aNameCI; // Only initialize when matching hash found
 
 for( sal_Int32 i = 0 ; i < nCount ; i++ )
 {
 SbxVariable* pVar = xItemArray->Get(i);
-if (pVar->GetHashCode() == nNameHash
-&& rTransliteration.isEqual(pVar->GetName(), OUString(rName)))
+if (pVar->GetHashCode() == nNameHash)
 {
-nIndex = i;
-break;
+if (aNameCI.isEmpty() && !rName.isEmpty())
+aNameCI = SbGlobal::GetTransliteration().transliterate(rName, 
0, rName.getLength());
+if (aNameCI == pVar->GetName(SbxNameType::CaseInsensitive))
+return i;
 }
 }
-return nIndex;
+return -1;
 }
 
 void BasicCollection::CollAdd( SbxArray* pPar_ )
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index 1f3042951e51..1fc8ebe4e6c1 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -350,7 +350,7 @@ class BasicCollection final : public SbxObject
 virtual ~BasicCollection() override;
 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
 sal_Int32 implGetIndex( SbxVariable const * pIndexVar );
-sal_Int32 implGetIndexForName(std::u16string_view rName);
+sal_Int32 implGetIndexForName(const OUString& rName);
 void CollAdd( SbxArray* pPar_ );
 void CollItem( SbxArray* pPar_ );
 void CollRemove( SbxArray* pPar_ );
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 8fb11bf9f2a2..a08122961b66 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -30,6 +30,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 using namespace com::sun::star::uno;
@@ -183,6 +185,7 @@ void SbxVariable::SetName( const OUString& rName )
 {
 maName = rName;
 nHash = MakeHashCode( rName );
+maNameCI.clear();
 }
 
 const OUString& SbxVariable::GetName( SbxNameType t ) const
@@ -192,6 +195,12 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
 {
 return maName;
 }
+if (t == SbxNameType::CaseInsensitive)
+{
+if (maNameCI.isEmpty() && !maName.isEmpty())
+maNameCI = SbGlobal::GetTransliteration().transliterate(maName, 0, 
maName.getLength());
+return maNameCI;
+}
 // Request parameter-information (not for objects)
 const_cast(this)->GetInfo();
 // Append nothing, if it is a simple property (no empty brackets)
diff --git a/include/basic/sbxdef.hxx b/include/basic/sbxdef.hxx
index b52b0beb3c7d..e85f1a209664 100644
--- a/include/basic/sbxdef.hxx
+++ b/include/basic/sbxdef.hxx
@@ -122,6 +122,7 @@ enum SbxOperator {
 
 enum class SbxNameType {  // 

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

2022-04-03 Thread offtkp (via logerrit)
 basic/source/runtime/methods.cxx |   54 ++-
 1 file changed, 20 insertions(+), 34 deletions(-)

New commits:
commit 6bc187b2eb6b9520c942f232b1abcb4fb29bfa04
Author: offtkp 
AuthorDate: Fri Apr 1 21:10:20 2022 +0300
Commit: Mike Kaganski 
CommitDate: Sun Apr 3 12:32:27 2022 +0200

tdf#147132 Flatten Basic function implementations

Change-Id: I21b0ec23de99aaf9b4398d59a5cc56d7d386ad58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132444
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov 
Reviewed-by: Mike Kaganski 

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 897f49d3144b..2bc1fb64f07c 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3971,56 +3971,42 @@ void SbRtl_LBound(StarBASIC *, SbxArray & rPar, bool)
 {
 const sal_uInt32 nParCount = rPar.Count();
 if ( nParCount != 3 && nParCount != 2 )
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-return;
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
 SbxBase* pParObj = rPar.Get(1)->GetObject();
 SbxDimArray* pArr = dynamic_cast( pParObj );
-if( pArr )
-{
-sal_Int32 nLower, nUpper;
-short nDim = (nParCount == 3) ? 
static_cast(rPar.Get(2)->GetInteger()) : 1;
-if (!pArr->GetDim(nDim, nLower, nUpper))
-StarBASIC::Error( ERRCODE_BASIC_OUT_OF_RANGE );
-else
-rPar.Get(0)->PutLong(nLower);
-}
-else
-StarBASIC::Error( ERRCODE_BASIC_MUST_HAVE_DIMS );
+if( !pArr )
+return StarBASIC::Error( ERRCODE_BASIC_MUST_HAVE_DIMS );
+
+sal_Int32 nLower, nUpper;
+short nDim = (nParCount == 3) ? 
static_cast(rPar.Get(2)->GetInteger()) : 1;
+if (!pArr->GetDim(nDim, nLower, nUpper))
+return StarBASIC::Error( ERRCODE_BASIC_OUT_OF_RANGE );
+rPar.Get(0)->PutLong(nLower);
 }
 
 void SbRtl_UBound(StarBASIC *, SbxArray & rPar, bool)
 {
 const sal_uInt32 nParCount = rPar.Count();
 if ( nParCount != 3 && nParCount != 2 )
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-return;
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 
 SbxBase* pParObj = rPar.Get(1)->GetObject();
 SbxDimArray* pArr = dynamic_cast( pParObj );
-if( pArr )
-{
-sal_Int32 nLower, nUpper;
-short nDim = (nParCount == 3) ? 
static_cast(rPar.Get(2)->GetInteger()) : 1;
-if (!pArr->GetDim(nDim, nLower, nUpper))
-StarBASIC::Error( ERRCODE_BASIC_OUT_OF_RANGE );
-else
-rPar.Get(0)->PutLong(nUpper);
-}
-else
-StarBASIC::Error( ERRCODE_BASIC_MUST_HAVE_DIMS );
+if( !pArr )
+return StarBASIC::Error( ERRCODE_BASIC_MUST_HAVE_DIMS );
+
+sal_Int32 nLower, nUpper;
+short nDim = (nParCount == 3) ? 
static_cast(rPar.Get(2)->GetInteger()) : 1;
+if (!pArr->GetDim(nDim, nLower, nUpper))
+return StarBASIC::Error( ERRCODE_BASIC_OUT_OF_RANGE );
+rPar.Get(0)->PutLong(nUpper);
 }
 
 void SbRtl_RGB(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() != 4)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-return;
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
 
 sal_Int32 nRed = rPar.Get(1)->GetInteger() & 0xFF;
 sal_Int32 nGreen = rPar.Get(2)->GetInteger() & 0xFF;


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

2022-03-28 Thread Stephan Bergmann (via logerrit)
 basic/source/comp/exprtree.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit 630dc472627e4bb56648b4c7326b7bfc8b4b5316
Author: Stephan Bergmann 
AuthorDate: Mon Mar 28 14:35:52 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Mar 28 17:50:39 2022 +0200

-Werror,-Wunused-but-set-variable

...since 8e73111faeb9620117801fee89a838a407f0b7e5 "CWS-TOOLING: integrate 
CWS
ab72"

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

diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 6b101ce81ca6..989f1c6330c5 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -719,7 +719,6 @@ std::unique_ptr SbiExpression::Comp()
 std::unique_ptr pNd = Cat();
 if( m_eMode != EXPRMODE_EMPTY_PAREN )
 {
-short nCount = 0;
 for( ;; )
 {
 SbiToken eTok = pParser->Peek();
@@ -734,7 +733,6 @@ std::unique_ptr SbiExpression::Comp()
 }
 eTok = pParser->Next();
 pNd = std::make_unique( std::move(pNd), eTok, Cat() );
-nCount++;
 }
 }
 return pNd;


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

2022-02-28 Thread Caolán McNamara (via logerrit)
 basic/source/sbx/sbxdbl.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 25bcd30895f8ebd2d47a8bab5a291690cf0e0aba
Author: Caolán McNamara 
AuthorDate: Mon Feb 28 12:02:05 2022 +
Commit: Caolán McNamara 
CommitDate: Mon Feb 28 15:44:21 2022 +0100

cid#707501 Uninitialized scalar variable

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

diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx
index aca18b3197e3..206a835b4e27 100644
--- a/basic/source/sbx/sbxdbl.cxx
+++ b/basic/source/sbx/sbxdbl.cxx
@@ -61,9 +61,7 @@ double ImpGetDouble( const SbxValues* p )
 nRes = ImpSalUInt64ToDouble( p->uInt64 ); break;
 case SbxDECIMAL:
 case SbxBYREF | SbxDECIMAL:
-if( p->pDecimal )
-p->pDecimal->getDouble( nRes );
-else
+if (!p->pDecimal || !p->pDecimal->getDouble(nRes))
 nRes = 0.0;
 break;
 case SbxBYREF | SbxSTRING:


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

2022-02-28 Thread Caolán McNamara (via logerrit)
 basic/source/sbx/sbxdate.cxx |8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

New commits:
commit 34d3f1601cf2dcb1c931d9454f2a06741f9e8b87
Author: Caolán McNamara 
AuthorDate: Mon Feb 28 12:01:05 2022 +
Commit: Caolán McNamara 
CommitDate: Mon Feb 28 15:43:56 2022 +0100

cid#707500 Uninitialized scalar variable

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

diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx
index 6b695a9c40c7..057e16f09d03 100644
--- a/basic/source/sbx/sbxdate.cxx
+++ b/basic/source/sbx/sbxdate.cxx
@@ -84,14 +84,8 @@ double ImpGetDate( const SbxValues* p )
 break;
 case SbxDECIMAL:
 case SbxBYREF | SbxDECIMAL:
-if( p->pDecimal )
-{
-p->pDecimal->getDouble( nRes );
-}
-else
-{
+if (!p->pDecimal || !p->pDecimal->getDouble(nRes))
 nRes = 0.0;
-}
 break;
 case SbxBYREF | SbxSTRING:
 case SbxSTRING:


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

2022-02-28 Thread Caolán McNamara (via logerrit)
 basic/source/sbx/sbxsng.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit d83323462452fb793b849758a0d975f3bd353ac9
Author: Caolán McNamara 
AuthorDate: Mon Feb 28 12:02:58 2022 +
Commit: Caolán McNamara 
CommitDate: Mon Feb 28 15:43:11 2022 +0100

cid#707503 Uninitialized scalar variable

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

diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx
index 2353968d2fde..ba5a5428775f 100644
--- a/basic/source/sbx/sbxsng.cxx
+++ b/basic/source/sbx/sbxsng.cxx
@@ -54,9 +54,7 @@ start:
 nRes = p->nSingle; break;
 case SbxDECIMAL:
 case SbxBYREF | SbxDECIMAL:
-if( p->pDecimal )
-p->pDecimal->getSingle( nRes );
-else
+if (!p->pDecimal || !p->pDecimal->getSingle(nRes))
 nRes = 0.0;
 break;
 case SbxDATE:


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

2022-02-22 Thread Ramreiso Kashung (via logerrit)
 basic/source/runtime/methods.cxx |  188 +--
 1 file changed, 82 insertions(+), 106 deletions(-)

New commits:
commit bcaf13205052a64373599245ae0b1020b04b1385
Author: Ramreiso Kashung 
AuthorDate: Sun Feb 20 13:13:27 2022 +0530
Commit: Mike Kaganski 
CommitDate: Tue Feb 22 09:34:20 2022 +0100

tdf#147132: Flatten Basic function implementations

Some SbRtl_* functions have been flattened at 
basic/source/runtime/methods.cxx

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

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 3839d84852ea..897f49d3144b 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -185,13 +185,11 @@ void SbRtl_CreateObject(StarBASIC * pBasic, SbxArray & 
rPar, bool)
 OUString aClass(rPar.Get(1)->GetOUString());
 SbxObjectRef p = SbxBase::CreateObject( aClass );
 if( !p.is() )
-StarBASIC::Error( ERRCODE_BASIC_CANNOT_LOAD );
-else
-{
-// Convenience: enter BASIC as parent
-p->SetParent( pBasic );
-rPar.Get(0)->PutObject(p.get());
-}
+return StarBASIC::Error( ERRCODE_BASIC_CANNOT_LOAD );
+
+// Convenience: enter BASIC as parent
+p->SetParent( pBasic );
+rPar.Get(0)->PutObject(p.get());
 }
 
 // Error( n )
@@ -199,54 +197,51 @@ void SbRtl_CreateObject(StarBASIC * pBasic, SbxArray & 
rPar, bool)
 void SbRtl_Error(StarBASIC * pBasic, SbxArray & rPar, bool)
 {
 if( !pBasic )
-StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR );
+return StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR );
+
+OUString aErrorMsg;
+ErrCode nErr = ERRCODE_NONE;
+sal_Int32 nCode = 0;
+if (rPar.Count() == 1)
+{
+nErr = StarBASIC::GetErrBasic();
+aErrorMsg = StarBASIC::GetErrorMsg();
+}
 else
 {
-OUString aErrorMsg;
-ErrCode nErr = ERRCODE_NONE;
-sal_Int32 nCode = 0;
-if (rPar.Count() == 1)
-{
-nErr = StarBASIC::GetErrBasic();
-aErrorMsg = StarBASIC::GetErrorMsg();
-}
-else
+nCode = rPar.Get(1)->GetLong();
+if( nCode > 65535 )
 {
-nCode = rPar.Get(1)->GetLong();
-if( nCode > 65535 )
-{
-StarBASIC::Error( ERRCODE_BASIC_CONVERSION );
-}
-else
-{
-nErr = StarBASIC::GetSfxFromVBError( 
static_cast(nCode) );
-}
-}
-
-bool bVBA = SbiRuntime::isVBAEnabled();
-OUString tmpErrMsg;
-if( bVBA && !aErrorMsg.isEmpty())
-{
-tmpErrMsg = aErrorMsg;
+StarBASIC::Error( ERRCODE_BASIC_CONVERSION );
 }
 else
 {
-StarBASIC::MakeErrorText( nErr, aErrorMsg );
-tmpErrMsg = StarBASIC::GetErrorText();
+nErr = StarBASIC::GetSfxFromVBError( 
static_cast(nCode) );
 }
-// If this rtlfunc 'Error' passed an errcode the same as the active 
Err Objects's
-// current err then  return the description for the error message if 
it is set
-// ( complicated isn't it ? )
-if (bVBA && rPar.Count() > 1)
+}
+bool bVBA = SbiRuntime::isVBAEnabled();
+OUString tmpErrMsg;
+if( bVBA && !aErrorMsg.isEmpty())
+{
+tmpErrMsg = aErrorMsg;
+}
+else
+{
+StarBASIC::MakeErrorText( nErr, aErrorMsg );
+tmpErrMsg = StarBASIC::GetErrorText();
+}
+// If this rtlfunc 'Error' passed an errcode the same as the active Err 
Objects's
+// current err then  return the description for the error message if it is 
set
+// ( complicated isn't it ? )
+if (bVBA && rPar.Count() > 1)
+{
+uno::Reference< ooo::vba::XErrObject > xErrObj( 
SbxErrObject::getUnoErrObject() );
+if ( xErrObj.is() && xErrObj->getNumber() == nCode && 
!xErrObj->getDescription().isEmpty() )
 {
-uno::Reference< ooo::vba::XErrObject > xErrObj( 
SbxErrObject::getUnoErrObject() );
-if ( xErrObj.is() && xErrObj->getNumber() == nCode && 
!xErrObj->getDescription().isEmpty() )
-{
-tmpErrMsg = xErrObj->getDescription();
-}
+tmpErrMsg = xErrObj->getDescription();
 }
-rPar.Get(0)->PutString(tmpErrMsg);
 }
+rPar.Get(0)->PutString(tmpErrMsg);
 }
 
 // Sinus
@@ -254,106 +249,87 @@ void SbRtl_Error(StarBASIC * pBasic, SbxArray & rPar, 
bool)
 void SbRtl_Sin(StarBASIC *, SbxArray & rPar, bool)
 {
 if (rPar.Count() < 2)
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-else
-{
-SbxVariableRef pArg = rPar.Get(1);
-rPar.Get(0)->PutDouble(sin(pArg->GetDouble()));
-}
+return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
+
+

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

2022-02-03 Thread Andreas Heinisch (via logerrit)
 basic/source/classes/sbxmod.cxx  |6 ++
 sc/qa/extras/macros-test.cxx |   30 ++
 sc/qa/extras/testdocuments/tdf146742.ods |binary
 scripting/source/basprov/basscript.cxx   |5 -
 4 files changed, 36 insertions(+), 5 deletions(-)

New commits:
commit 6a0f00d3b9d1a74637c92ec6eff1ba5fedc82f3d
Author: Andreas Heinisch 
AuthorDate: Mon Jan 31 20:02:50 2022 +0100
Commit: Andreas Heinisch 
CommitDate: Thu Feb 3 09:43:37 2022 +0100

tdf#146742 - Move the initialization code of a method to SbMethod::Call

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

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 2d38de16dcfd..e9502a29aa13 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -2062,6 +2062,12 @@ ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* 
pCaller )
 if( bInvalid && !pMod_->Compile() )
 StarBASIC::Error( ERRCODE_BASIC_BAD_PROP_VALUE );
 
+// tdf#143582 - clear return value of the method before calling it
+const SbxFlagBits nSavFlags = GetFlags();
+SetFlag(SbxFlagBits::ReadWrite | SbxFlagBits::NoBroadcast);
+Clear();
+SetFlags(nSavFlags);
+
 Get( aVals );
 if ( pRet )
 pRet->Put( aVals );
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 2326f101626e..a774129f5ae7 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -66,6 +66,7 @@ public:
 void testTdf143582();
 void testTdf144085();
 void testTdf130307();
+void testTdf146742();
 void testMacroButtonFormControlXlsxExport();
 
 CPPUNIT_TEST_SUITE(ScMacrosTest);
@@ -92,6 +93,7 @@ public:
 CPPUNIT_TEST(testTdf143582);
 CPPUNIT_TEST(testTdf144085);
 CPPUNIT_TEST(testTdf130307);
+CPPUNIT_TEST(testTdf146742);
 CPPUNIT_TEST(testMacroButtonFormControlXlsxExport);
 
 CPPUNIT_TEST_SUITE_END();
@@ -266,6 +268,34 @@ void ScMacrosTest::testRowColumn()
 pDocSh->DoClose();
 }
 
+void ScMacrosTest::testTdf146742()
+{
+OUString aFileName;
+createFileURL(u"tdf146742.ods", aFileName);
+uno::Reference xComponent = 
loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+
+// Export to ODS and reload the file
+saveAndReload(xComponent, "calc8");
+CPPUNIT_ASSERT(xComponent);
+
+SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(xComponent);
+CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+ScDocShell* pDocSh = static_cast(pFoundShell);
+ScDocument& rDoc = pDocSh->GetDocument();
+
+CPPUNIT_ASSERT_EQUAL(OUString("1"), rDoc.GetString(ScAddress(0,0,0)));
+CPPUNIT_ASSERT_EQUAL(OUString("2"), rDoc.GetString(ScAddress(0,1,0)));
+
+CPPUNIT_ASSERT_EQUAL(OUString("TRUE"), rDoc.GetString(ScAddress(1,0,0)));
+// Without the fix in place, this test would have failed with
+// - Expected: FALSE
+// - Actual  : TRUE
+CPPUNIT_ASSERT_EQUAL(OUString("FALSE"), rDoc.GetString(ScAddress(1,1,0)));
+
+css::uno::Reference xCloseable(xComponent, 
css::uno::UNO_QUERY_THROW);
+xCloseable->close(true);
+}
+
 void ScMacrosTest::testMacroButtonFormControlXlsxExport()
 {
 // Given a button form control with an associated macro:
diff --git a/sc/qa/extras/testdocuments/tdf146742.ods 
b/sc/qa/extras/testdocuments/tdf146742.ods
new file mode 100644
index ..18ede8a040a0
Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf146742.ods differ
diff --git a/scripting/source/basprov/basscript.cxx 
b/scripting/source/basprov/basscript.cxx
index 2cc67d4feb05..9054ee4bfc27 100644
--- a/scripting/source/basprov/basscript.cxx
+++ b/scripting/source/basprov/basscript.cxx
@@ -244,11 +244,6 @@ constexpr OUStringLiteral BASSCRIPT_PROPERTY_CALLER = 
u"Caller";
 if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
 aOldThisComponent = 
m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( 
m_xDocumentScriptContext ) );
 
-// tdf#143582 - clear return value of the method before calling it
-const SbxFlagBits nSavFlags = m_xMethod->GetFlags();
-m_xMethod->SetFlag(SbxFlagBits::ReadWrite | 
SbxFlagBits::NoBroadcast);
-m_xMethod->Clear();
-m_xMethod->SetFlags(nSavFlags);
 if ( m_caller.hasElements() && m_caller[ 0 ].hasValue()  )
 {
 SbxVariableRef xCallerVar = new SbxVariable( SbxVARIANT );


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

2022-02-02 Thread Mike Kaganski (via logerrit)
 basic/source/classes/sb.cxx |5 -
 include/basic/sbstar.hxx|3 +--
 2 files changed, 1 insertion(+), 7 deletions(-)

New commits:
commit 30483a6e0642c287d95e8d617e1a3da26e29f9f2
Author: Mike Kaganski 
AuthorDate: Thu Feb 3 07:16:27 2022 +0100
Commit: Mike Kaganski 
CommitDate: Thu Feb 3 08:16:03 2022 +0100

Use default argument

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

diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index c38a6c04989b..5c99408847b6 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1682,11 +1682,6 @@ bool StarBASIC::RTError( ErrCode code, const OUString& 
rMsg, sal_Int32 l, sal_In
 }
 }
 
-void StarBASIC::Error( ErrCode n )
-{
-Error( n, OUString() );
-}
-
 void StarBASIC::Error( ErrCode n, const OUString& rMsg )
 {
 if( GetSbData()->pInst )
diff --git a/include/basic/sbstar.hxx b/include/basic/sbstar.hxx
index 08040a4d5510..1629ab16c774 100644
--- a/include/basic/sbstar.hxx
+++ b/include/basic/sbstar.hxx
@@ -87,8 +87,7 @@ public:
 SbModule*   MakeModule( const OUString& rName, const OUString& rSrc );
 SbModule*   MakeModule( const OUString& rName, const 
css::script::ModuleInfo& mInfo, const OUString& rSrc );
 static void Stop();
-static void Error( ErrCode );
-static void Error( ErrCode, const OUString& rMsg );
+static void Error( ErrCode, const OUString& rMsg = {} );
 static void FatalError( ErrCode );
 static void FatalError( ErrCode, const OUString& rMsg );
 static bool IsRunning();


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

2022-02-02 Thread Mike Kaganski (via logerrit)
 basic/source/inc/rtlproto.hxx|1 -
 basic/source/runtime/methods.cxx |   19 +++
 basic/source/runtime/stdobj.cxx  |6 +++---
 3 files changed, 6 insertions(+), 20 deletions(-)

New commits:
commit af3316b6f6f10fe7713d5d4e761d1fd03878cb34
Author: Mike Kaganski 
AuthorDate: Wed Feb 2 13:50:48 2022 +0100
Commit: Mike Kaganski 
CommitDate: Wed Feb 2 18:04:17 2022 +0100

SbRtl_Spc is exactly the same as SbRtl_Space

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

diff --git a/basic/source/inc/rtlproto.hxx b/basic/source/inc/rtlproto.hxx
index cf342f337256..6296a0475b5e 100644
--- a/basic/source/inc/rtlproto.hxx
+++ b/basic/source/inc/rtlproto.hxx
@@ -201,7 +201,6 @@ extern void SbRtl_Tan(StarBASIC * pBasic, SbxArray & rPar, 
bool bWrite);
 extern void SbRtl_UCase(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
 extern void SbRtl_Val(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
 extern void SbRtl_Len(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
-extern void SbRtl_Spc(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
 extern void SbRtl_DateSerial(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
 extern void SbRtl_TimeSerial(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
 extern void SbRtl_DateValue(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 8b62ba2260cd..fd0c0531168c 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1422,22 +1422,9 @@ void SbRtl_Space(StarBASIC *, SbxArray & rPar, bool)
 }
 else
 {
-OUStringBuffer aBuf;
-string::padToLength(aBuf, rPar.Get(1)->GetLong(), ' ');
-rPar.Get(0)->PutString(aBuf.makeStringAndClear());
-}
-}
-
-void SbRtl_Spc(StarBASIC *, SbxArray & rPar, bool)
-{
-if (rPar.Count() < 2)
-{
-StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-}
-else
-{
-OUStringBuffer aBuf;
-string::padToLength(aBuf, rPar.Get(1)->GetLong(), ' ');
+const sal_Int32 nCount = rPar.Get(1)->GetLong();
+OUStringBuffer aBuf(nCount);
+string::padToLength(aBuf, nCount, ' ');
 rPar.Get(0)->PutString(aBuf.makeStringAndClear());
 }
 }
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 4adda6efafec..44f99349bf8d 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -763,10 +763,10 @@ constexpr Method aMethods[] = {
 arg(u"Period",  SbxDOUBLE),
 
 { u"Space", SbxSTRING,1 | FUNCTION_,   
SbRtl_Space},
-arg(u"string", SbxLONG),
+arg(u"Number", SbxLONG),
 
-{ u"Spc",   SbxSTRING,1 | FUNCTION_,   
SbRtl_Spc  },
-arg(u"Count", SbxLONG),
+{ u"Spc",   SbxSTRING,1 | FUNCTION_,   
SbRtl_Space},
+arg(u"Number", SbxLONG),
 
 { u"Split", SbxOBJECT,3 | FUNCTION_,   
SbRtl_Split},
 arg(u"expression", SbxSTRING),


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

2022-02-02 Thread Mike Kaganski (via logerrit)
 basic/source/runtime/methods.cxx |   26 +-
 1 file changed, 9 insertions(+), 17 deletions(-)

New commits:
commit 6c4bc632180c25b3ceb30e32383b3f5db8eaf0e2
Author: Mike Kaganski 
AuthorDate: Wed Feb 2 13:33:38 2022 +0100
Commit: Mike Kaganski 
CommitDate: Wed Feb 2 16:05:29 2022 +0100

Use OUStringBuffer in SbRtl_FormatNumber

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

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 26350d6d85f3..8b62ba2260cd 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3423,42 +3423,34 @@ void SbRtl_FormatNumber(StarBASIC*, SbxArray& rPar, 
bool)
 fVal = fabs(fVal); // Always work with non-negatives, to easily handle 
leading zero
 
 static const sal_Unicode decSep = localeData.getNumDecimalSep().toChar();
-OUString aResult = rtl::math::doubleToUString(
+OUStringBuffer aResult;
+rtl::math::doubleToUStringBuffer(aResult,
 fVal, rtl_math_StringFormat_F, nNumDigitsAfterDecimal, decSep,
 bGroupDigits ? localeData.getDigitGrouping().getConstArray() : nullptr,
 localeData.getNumThousandSep().toChar());
 
-if (!bIncludeLeadingDigit && aResult.getLength() > 1 && 
aResult.startsWith("0"))
-aResult = aResult.copy(1);
+if (!bIncludeLeadingDigit && aResult.getLength() > 1)
+aResult.stripStart('0');
 
 if (nNumDigitsAfterDecimal > 0)
 {
-sal_Int32 nActualDigits;
 const sal_Int32 nSepPos = aResult.indexOf(decSep);
-if (nSepPos == -1)
-nActualDigits = 0;
-else
-nActualDigits = aResult.getLength() - nSepPos - 1;
 
 // VBA allows up to 255 digits; rtl::math::doubleToUString outputs up 
to 15 digits
 // for ~small numbers, so pad them as appropriate.
-if (nActualDigits < nNumDigitsAfterDecimal)
-{
-OUStringBuffer sBuf;
-comphelper::string::padToLength(sBuf, nNumDigitsAfterDecimal - 
nActualDigits, '0');
-aResult += sBuf;
-}
+if (nSepPos >= 0)
+comphelper::string::padToLength(aResult, nSepPos + 
nNumDigitsAfterDecimal + 1, '0');
 }
 
 if (bNegative)
 {
 if (bUseParensForNegativeNumbers)
-aResult = "(" + aResult + ")";
+aResult.insert(0, '(').append(')');
 else
-aResult = "-" + aResult;
+aResult.insert(0, '-');
 }
 
-rPar.Get(0)->PutString(aResult);
+rPar.Get(0)->PutString(aResult.makeStringAndClear());
 }
 
 namespace {


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

2022-01-30 Thread Mike Kaganski (via logerrit)
 basic/source/runtime/methods.cxx |   62 +++
 1 file changed, 38 insertions(+), 24 deletions(-)

New commits:
commit a03b7d2a8d0f0fd7e710202bbeecf165f0fcd06a
Author: Mike Kaganski 
AuthorDate: Sun Jan 30 14:12:46 2022 +0300
Commit: Mike Kaganski 
CommitDate: Sun Jan 30 15:19:39 2022 +0100

tdf#132388: reimplement fix for tdf#142487

Each call to css::i18n::XTextSearch::SearchForward transliterates input 
string,
making performance of repeated calls unacceptable. So prepare the 
transliterated
strings once, and use the offset sequence to map search results to indices 
into
original string.

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

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 2361466ea5e3..26350d6d85f3 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -67,6 +67,7 @@
 #include 
 
 // include search util
+#include 
 #include 
 #include 
 #include 
@@ -1263,6 +1264,7 @@ void SbRtl_Replace(StarBASIC *, SbxArray & rPar, bool)
 return;
 }
 }
+--lStartPos; // Make it 0-based
 
 sal_Int32 lCount = -1;
 if (nArgCount >= 5)
@@ -1298,40 +1300,52 @@ void SbRtl_Replace(StarBASIC *, SbxArray & rPar, bool)
 }
 
 const OUString aExpStr = rPar.Get(1)->GetOUString();
-const OUString aFindStr = rPar.Get(2)->GetOUString();
+OUString aFindStr = rPar.Get(2)->GetOUString();
 const OUString aReplaceStr = rPar.Get(3)->GetOUString();
-const sal_Int32 nExpStrLen = aExpStr.getLength();
-const sal_Int32 nFindStrLen = aFindStr.getLength();
 
-// tdf#142487 - use utl::TextSearch in order to implement the replace 
algorithm
-i18nutil::SearchOptions2 aSearchOptions;
-aSearchOptions.searchString = aFindStr;
-aSearchOptions.AlgorithmType2 = util::SearchAlgorithms2::ABSOLUTE;
+OUString aSrcStr(aExpStr);
+sal_Int32 nPrevPos = std::min(lStartPos, aSrcStr.getLength());
+css::uno::Sequence aOffset;
 if (bCaseInsensitive)
-aSearchOptions.transliterateFlags |= TransliterationFlags::IGNORE_CASE;
-utl::TextSearch textSearch(aSearchOptions);
+{
+// tdf#132389: case-insensitive operation for non-ASCII characters
+// tdf#142487: use css::i18n::Transliteration to correctly handle ß -> 
ss expansion
+// tdf#132388: We can't use utl::TextSearch (css::i18n::XTextSearch), 
because each call to
+// css::i18n::XTextSearch::SearchForward transliterates 
input string, making
+// performance of repeated calls unacceptable
+auto xTrans = 
css::i18n::Transliteration::create(comphelper::getProcessComponentContext());
+xTrans->loadModule(css::i18n::TransliterationModules_IGNORE_CASE, {});
+aFindStr = xTrans->transliterate(aFindStr, 0, aFindStr.getLength(), 
aOffset);
+aSrcStr = xTrans->transliterate(aSrcStr, nPrevPos, aSrcStr.getLength() 
- nPrevPos, aOffset);
+nPrevPos = std::distance(aOffset.begin(),
+ std::lower_bound(aOffset.begin(), 
aOffset.end(), nPrevPos));
+}
+
+auto getExpStrPos = [aOffset, nExpLen = aExpStr.getLength()](sal_Int32 
nSrcStrPos) -> sal_Int32
+{
+assert(!aOffset.hasElements() || aOffset.getLength() >= nSrcStrPos);
+if (!aOffset.hasElements())
+return nSrcStrPos;
+return aOffset.getLength() > nSrcStrPos ? aOffset[nSrcStrPos] : 
nExpLen;
+};
 
 // Note: the result starts from lStartPos, removing everything to the 
left. See i#94895.
-sal_Int32 nPrevPos = std::min(lStartPos - 1, nExpStrLen);
-OUStringBuffer sResult(nExpStrLen - nPrevPos);
+OUStringBuffer sResult(aSrcStr.getLength() - nPrevPos);
 sal_Int32 nCounts = 0;
 while (lCount == -1 || lCount > nCounts)
 {
-sal_Int32 nStartPos = nPrevPos;
-sal_Int32 aEndPos = aExpStr.getLength();
-if (textSearch.SearchForward(aExpStr, , ))
-{
-sResult.append(aExpStr.getStr() + nPrevPos, nStartPos - nPrevPos);
-sResult.append(aReplaceStr);
-nPrevPos = nStartPos + nFindStrLen;
-nCounts++;
-}
-else
-{
+sal_Int32 nPos = aSrcStr.indexOf(aFindStr, nPrevPos);
+if (nPos < 0)
 break;
-}
+
+lStartPos = getExpStrPos(nPrevPos);
+sResult.append(aExpStr.getStr() + lStartPos, getExpStrPos(nPos) - 
lStartPos);
+sResult.append(aReplaceStr);
+nPrevPos = nPos + aFindStr.getLength();
+nCounts++;
 }
-sResult.append(aExpStr.getStr() + nPrevPos, nExpStrLen - nPrevPos);
+lStartPos = getExpStrPos(nPrevPos);
+sResult.append(aExpStr.getStr() + lStartPos, aExpStr.getLength() - 
lStartPos);
 

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

2022-01-28 Thread Ramreiso Kashung (via logerrit)
 basic/source/runtime/stdobj1.cxx |   40 ++-
 1 file changed, 23 insertions(+), 17 deletions(-)

New commits:
commit 124059f64a87d8074a0be32d6cc5f74c71bf836e
Author: Ramreiso Kashung 
AuthorDate: Fri Jan 7 18:23:16 2022 +0530
Commit: Hossein 
CommitDate: Fri Jan 28 12:22:55 2022 +0100

tdf#145614: Convert #define to enum

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

diff --git a/basic/source/runtime/stdobj1.cxx b/basic/source/runtime/stdobj1.cxx
index ee7df8d7a62d..c24c59af95a3 100644
--- a/basic/source/runtime/stdobj1.cxx
+++ b/basic/source/runtime/stdobj1.cxx
@@ -22,23 +22,26 @@
 #include 
 #include 
 
-#define ATTR_IMP_TYPE   1
-#define ATTR_IMP_WIDTH  2
-#define ATTR_IMP_HEIGHT 3
-#define ATTR_IMP_BOLD   4
-#define ATTR_IMP_ITALIC 5
-#define ATTR_IMP_STRIKETHROUGH  6
-#define ATTR_IMP_UNDERLINE  7
-#define ATTR_IMP_SIZE   9
-#define ATTR_IMP_NAME   10
-
-#define METH_CLEAR  20
-#define METH_GETDATA21
-#define METH_GETFORMAT  22
-#define METH_GETTEXT23
-#define METH_SETDATA24
-#define METH_SETTEXT25
-
+namespace {
+enum UserData
+{
+ATTR_IMP_TYPE   = 1,
+ATTR_IMP_WIDTH  = 2,
+ATTR_IMP_HEIGHT = 3,
+ATTR_IMP_BOLD   = 4,
+ATTR_IMP_ITALIC = 5,
+ATTR_IMP_STRIKETHROUGH  = 6,
+ATTR_IMP_UNDERLINE  = 7,
+ATTR_IMP_SIZE   = 9,
+ATTR_IMP_NAME   = 10,
+METH_CLEAR  = 20,
+METH_GETDATA= 21,
+METH_GETFORMAT  = 22,
+METH_GETTEXT= 23,
+METH_SETDATA= 24,
+METH_SETTEXT= 25
+};
+}
 
 SbStdFactory::SbStdFactory()
 {
@@ -144,6 +147,7 @@ void SbStdPicture::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
 case ATTR_IMP_TYPE: PropType( pVar, bWrite ); return;
 case ATTR_IMP_WIDTH:PropWidth( pVar, bWrite ); return;
 case ATTR_IMP_HEIGHT:   PropHeight( pVar, bWrite ); return;
+default: break;
 }
 
 SbxObject::Notify( rBC, rHint );
@@ -264,6 +268,7 @@ void SbStdFont::Notify( SfxBroadcaster& rBC, const SfxHint& 
rHint )
 case ATTR_IMP_UNDERLINE:PropUnderline( pVar, bWrite ); return;
 case ATTR_IMP_SIZE: PropSize( pVar, bWrite ); return;
 case ATTR_IMP_NAME: PropName( pVar, bWrite ); return;
+default: break;
 }
 
 SbxObject::Notify( rBC, rHint );
@@ -412,6 +417,7 @@ void SbStdClipboard::Notify( SfxBroadcaster& rBC, const 
SfxHint& rHint )
 case METH_GETTEXT:  MethGetText( pVar, pPar_ ); return;
 case METH_SETDATA:  MethSetData( pPar_ ); return;
 case METH_SETTEXT:  MethSetText( pPar_ ); return;
+default: break;
 }
 
 SbxObject::Notify( rBC, rHint );


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

2022-01-25 Thread VaibhavMalik4187 (via logerrit)
 basic/source/inc/runtime.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d1207a5f3a573dbe39a7874931ce373e5c88628d
Author: VaibhavMalik4187 
AuthorDate: Tue Jan 25 13:52:11 2022 +0530
Commit: Mike Kaganski 
CommitDate: Tue Jan 25 19:54:54 2022 +0100

tdf#90341 Clean Up Excessive const_cast'ing

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

diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index d09db071a1a9..d0922e6a0e0a 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -188,7 +188,7 @@ public:
 SbiDdeControl* GetDdeControl() { return pDdeCtrl.get(); }
 StarBASIC* GetBasic() { return pBasic; }
 SbiDllMgr* GetDllMgr();
-SbiRTLData& GetRTLData() const { return const_cast(aRTLData); 
}
+SbiRTLData& GetRTLData() { return aRTLData; }
 
 std::shared_ptr const & GetNumberFormatter();
 sal_uInt32 GetStdDateIdx() const { return nStdDateIdx; }


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

2022-01-22 Thread Julien Nabet (via logerrit)
 basic/source/inc/rtlproto.hxx   |1 +
 basic/source/runtime/props.cxx  |2 +-
 basic/source/runtime/stdobj.cxx |1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit c1205c1cf6e08d94e6e2e2753679d99bc1842ca0
Author: Julien Nabet 
AuthorDate: Sat Jan 22 14:31:00 2022 +0100
Commit: Julien Nabet 
CommitDate: Sat Jan 22 15:56:25 2022 +0100

Related tdf#146909: add missing IDIGNORE in Basic

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

diff --git a/basic/source/inc/rtlproto.hxx b/basic/source/inc/rtlproto.hxx
index 06f0bd8b0c30..cf342f337256 100644
--- a/basic/source/inc/rtlproto.hxx
+++ b/basic/source/inc/rtlproto.hxx
@@ -72,6 +72,7 @@ extern void SbRtl_IDOK(StarBASIC * pBasic, SbxArray & rPar, 
bool bWrite);
 extern void SbRtl_IDCANCEL(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
 extern void SbRtl_IDABORT(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
 extern void SbRtl_IDRETRY(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
+extern void SbRtl_IDIGNORE(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
 extern void SbRtl_IDYES(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
 extern void SbRtl_IDNO(StarBASIC * pBasic, SbxArray & rPar, bool bWrite);
 
diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx
index aa0a9e1c9d85..82478bf6d3cf 100644
--- a/basic/source/runtime/props.cxx
+++ b/basic/source/runtime/props.cxx
@@ -103,10 +103,10 @@ void SbRtl_MB_APPLMODAL(StarBASIC*, SbxArray& rPar, bool) 
{ rPar.Get(0)->PutInte
 void SbRtl_MB_SYSTEMMODAL(StarBASIC*, SbxArray& rPar, bool) { 
rPar.Get(0)->PutInteger(4096); }
 
 void SbRtl_IDOK(StarBASIC*, SbxArray& rPar, bool) { 
rPar.Get(0)->PutInteger(1); }
-
 void SbRtl_IDCANCEL(StarBASIC*, SbxArray& rPar, bool) { 
rPar.Get(0)->PutInteger(2); }
 void SbRtl_IDABORT(StarBASIC*, SbxArray& rPar, bool) { 
rPar.Get(0)->PutInteger(3); }
 void SbRtl_IDRETRY(StarBASIC*, SbxArray& rPar, bool) { 
rPar.Get(0)->PutInteger(4); }
+void SbRtl_IDIGNORE(StarBASIC*, SbxArray& rPar, bool) { 
rPar.Get(0)->PutInteger(5); }
 void SbRtl_IDYES(StarBASIC*, SbxArray& rPar, bool) { 
rPar.Get(0)->PutInteger(6); }
 void SbRtl_IDNO(StarBASIC*, SbxArray& rPar, bool) { 
rPar.Get(0)->PutInteger(7); }
 
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 0bb572bbcd33..4adda6efafec 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -451,6 +451,7 @@ constexpr Method aMethods[] = {
 
 { u"IDABORT",   SbxINTEGER,  CPROP_,   
SbRtl_IDABORT  },
 { u"IDCANCEL",  SbxINTEGER,  CPROP_,   
SbRtl_IDCANCEL },
+{ u"IDIGNORE",  SbxINTEGER,  CPROP_,   
SbRtl_IDIGNORE },
 { u"IDNO",  SbxINTEGER,  CPROP_,   
SbRtl_IDNO },
 { u"IDOK",  SbxINTEGER,  CPROP_,   
SbRtl_IDOK },
 { u"IDRETRY",   SbxINTEGER,  CPROP_,   
SbRtl_IDRETRY  },


[Libreoffice-commits] core.git: basic/source chart2/source comphelper/source editeng/source framework/source include/comphelper include/vcl scripting/source sc/source sd/source sfx2/inc sfx2/source sv

2022-01-14 Thread Noel Grandin (via logerrit)
 basic/source/classes/sbunoobj.cxx  |   
 4 
 chart2/source/tools/ModifyListenerHelper.cxx   |   
10 -
 chart2/source/tools/RangeHighlighter.cxx   |   
20 +-
 comphelper/source/misc/accessibleeventnotifier.cxx |   
16 -
 comphelper/source/misc/compbase.cxx|   
 4 
 comphelper/source/misc/instancelocker.cxx  |   
 8 
 editeng/source/uno/unotext2.cxx|   
 4 
 framework/source/uiconfiguration/imagemanagerimpl.cxx  |   
12 -
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx  |   
12 -
 framework/source/uiconfiguration/uiconfigurationmanager.cxx|   
12 -
 include/comphelper/interfacecontainer4.hxx |   
87 +++---
 include/comphelper/multiinterfacecontainer4.hxx|   
17 +
 include/vcl/weldutils.hxx  |   
24 +-
 sc/source/ui/Accessibility/DrawModelBroadcaster.cxx|   
24 --
 scripting/source/stringresource/stringresource.cxx |   
61 +++
 scripting/source/stringresource/stringresource.hxx |   
12 -
 sd/source/ui/slideshow/slideshowviewimpl.cxx   |   
40 ++--
 sd/source/ui/slideshow/slideshowviewimpl.hxx   |   
 4 
 sfx2/inc/unoctitm.hxx  |   
 2 
 sfx2/source/control/unoctitm.cxx   |   
21 --
 sfx2/source/doc/printhelper.cxx|   
 8 
 sfx2/source/notify/globalevents.cxx|   
52 +
 sfx2/source/view/viewsh.cxx|   
28 ++-
 svl/source/fsstor/oinputstreamcontainer.cxx|   
 8 
 svl/source/fsstor/ostreamcontainer.cxx |   
 8 
 svx/source/table/tabledesign.cxx   |   
12 -
 svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx |   
 4 
 sw/source/core/unocore/unobkm.cxx  |   
 4 
 sw/source/core/unocore/unochart.cxx|   
23 +-
 sw/source/core/unocore/unofield.cxx|   
37 ++--
 sw/source/core/unocore/unoframe.cxx|   
 8 
 sw/source/core/unocore/unoftn.cxx  |   
 4 
 sw/source/core/unocore/unoidx.cxx  |   
 4 
 sw/source/core/unocore/unoparagraph.cxx|   
 4 
 sw/source/core/unocore/unorefmk.cxx|   
 8 
 sw/source/core/unocore/unosect.cxx |   
 4 
 sw/source/core/unocore/unotbl.cxx  |   
32 +--
 sw/source/uibase/uno/unotxdoc.cxx  |   
 8 
 toolkit/source/controls/grid/gridcolumn.cxx|   
 7 
 toolkit/source/hatchwindow/documentcloser.cxx  |   
 4 
 ucbhelper/source/provider/resultset.cxx|   
16 +
 ucbhelper/source/provider/resultsethelper.cxx  |   
 6 
 42 files changed, 349 insertions(+), 334 deletions(-)

New commits:
commit a2eaf99e46f370ffb3b73828c2bdc53dc193b9a4
Author: Noel Grandin 
AuthorDate: Fri Jan 14 10:56:50 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 14 21:04:10 2022 +0100

make comphelper::OInterfaceContainerHelper4 more threadsafe

(*) make all the methods that require an external mutex take a
std::unique_lock as a parameter, so that call sites cannot forget

(*) make the forEach method drop the lock when firing listener methods,
to reduce the odds of deadlock

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

diff --git a/basic/source/classes/sbunoobj.cxx 
b/basic/source/classes/sbunoobj.cxx
index 97e217ca8ba5..72c94744 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -4364,13 +4364,13 @@ void SAL_CALL ModuleInvocationProxy::dispose()
 void SAL_CALL ModuleInvocationProxy::addEventListener( const Reference< 
XEventListener >& xListener )
 {
 std::unique_lock aGuard( m_aMutex );
-m_aListeners.addInterface( xListener );
+m_aListeners.addInterface( aGuard, xListener );
 }
 
 void SAL_CALL ModuleInvocationProxy::removeEventListener( const Reference< 

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

2021-12-27 Thread Andreas Heinisch (via logerrit)
 basic/source/sbx/sbxvar.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit d8428094c7f8b186b37c76fd7e9508a075424f80
Author: Andreas Heinisch 
AuthorDate: Thu Dec 23 20:04:30 2021 +0100
Commit: Andreas Heinisch 
CommitDate: Mon Dec 27 20:48:55 2021 +0100

tdf#144353, tdf#146281 - Correctly copy the information about variables

During the assignment of a variable, copy its information only if there
isn't already one present.

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

diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 8c5d6571feef..d2c9802c413b 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -282,7 +282,10 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r )
 {
 SbxValue::operator=( r );
 // tdf#144353 - copy information about a missing parameter. See 
SbiRuntime::SetIsMissing.
-if (r.pInfo && !dynamic_cast())
+// We cannot unconditionally assign the data about a variable because 
we would overwrite
+// the information about parameters (name, type, flags, and ids). For 
instance, in the case
+// where a method will be initialized with a literal.
+if (!pInfo)
 pInfo = r.pInfo;
 m_aDeclareClassName = r.m_aDeclareClassName;
 m_xComListener = r.m_xComListener;


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

2021-12-23 Thread Mike Kaganski (via logerrit)
 basic/source/sbx/sbxdec.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit be596c0192f059324d06716b625be6a11079f8ea
Author: Mike Kaganski 
AuthorDate: Wed Dec 22 14:51:39 2021 +0100
Commit: Mike Kaganski 
CommitDate: Thu Dec 23 10:34:19 2021 +0100

Nullify passed pointer in releaseDecimalPtr unconditionally

This was an implementation error ever since it was introduced
in commit 79d3bc479950127ecfd40f73978c0fc84c1e7908.
The function is used to release the refcounted object, and the
calling code does not always set the pointer to another value
or discard it (see uses in basic/source/sbx/sbxvalue.cxx). If
it resets the pointer in some cases, it must do it always.

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

diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index e47713445cf7..acfc31acfbd0 100644
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -80,10 +80,8 @@ void releaseDecimalPtr( SbxDecimal*& rpDecimal )
 {
 rpDecimal->mnRefCount--;
 if( rpDecimal->mnRefCount == 0 )
-{
 delete rpDecimal;
-rpDecimal = nullptr;
-}
+rpDecimal = nullptr;
 }
 }
 


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

2021-12-18 Thread Noel Grandin (via logerrit)
 basic/source/basmgr/basicmanagerrepository.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit de9fa7b24c14473ce97fac2edc124093e5a17814
Author: Noel Grandin 
AuthorDate: Fri Dec 17 18:52:59 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Dec 18 19:08:28 2021 +0100

osl::Mutex->std::mutex in ImplRepository

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

diff --git a/basic/source/basmgr/basicmanagerrepository.cxx 
b/basic/source/basmgr/basicmanagerrepository.cxx
index a70c49eb1149..3a0405f472d0 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -42,6 +42,7 @@
 #include 
 
 #include 
+#include 
 
 
 namespace basic
@@ -206,8 +207,8 @@ namespace basic
 {
 tools::SvRef& repository = 
GetSbxData_Impl().mrImplRepository;
 {
-static osl::Mutex aMutex;
-osl::MutexGuard aGuard(aMutex);
+static std::mutex aMutex;
+std::unique_lock aGuard(aMutex);
 if (!repository)
 repository = new ImplRepository;
 }


  1   2   3   4   5   6   7   8   >