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

2023-11-28 Thread Mike Kaganski (via logerrit)
 unotools/source/misc/mediadescriptor.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit c36cba38cc33f22e3388968814f426e88b7f1cd8
Author: Mike Kaganski 
AuthorDate: Tue Nov 28 23:25:30 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Nov 28 22:29:03 2023 +0100

Prevent attempts to create UCB content from .component URIs

After commit 86c682273d907c77404637c89e584047de1c1099 (tdf#96401:
allow to detect a broken ZIP package, 2023-11-26) impl_openStream
is called from TypeDetection::impl_detectTypeFlatAndDeep for URIs
like ".component:Bibliography/View1". For some reasons, sometimes
GIO UCP tries to handle these URIs; failing that, it shows an
error message.

This started to fail UITest_writer_tests4 (specifically, test for
tdf92611), like this:

  Thread 1 (Thread 0x7f51cd99b1c0 (LWP 1424555) "soffice.bin"):
  #10 std::condition_variable::wait_for, 
SvpSalInstance::ImplYield(bool, bool):: > (__rtime=, 
__p=..., __lock=..., this=0x13d78e0) at 
~/gcc/inst/include/c++/14.0.0/condition_variable:177
  #11 SvpSalInstance::ImplYield(bool, bool) (this=this@entry=0x13d7690, 
bWait=bWait@entry=true, 
bHandleAllCurrentEvents=bHandleAllCurrentEvents@entry=false) at 
vcl/headless/svpinst.cxx:451
  #12 0x7f51d9d85695 in SvpSalInstance::DoYield(bool, bool) 
(this=0x13d7690, bWait=, bHandleAllCurrentEvents=) at vcl/headless/svpinst.cxx:471
  #13 0x7f51d9add654 in ImplYield(bool, bool) 
(i_bWait=i_bWait@entry=true, i_bAllEvents=i_bAllEvents@entry=false) at 
vcl/source/app/svapp.cxx:390
  #14 0x7f51d9addc73 in Application::Yield() () at 
vcl/source/app/svapp.cxx:474
  #15 0x7f51d946de4f in Dialog::Execute() (this=0x14554e40) at 
vcl/source/window/dialog.cxx:1078
  #16 0x7f51d9a5ccec in virtual thunk to SalInstanceDialog::run() () at 
vcl/inc/salvtables.hxx:543
  #17 0x7f51d92b45b2 in (anonymous namespace)::executeErrorDialog 
(nButtonMask=(anonymous namespace)::MessageBoxStyle::Ok, rMessage=Python 
Exception : value has been optimized out
  , rContext=Python Exception : value has been optimized 
out
  , 
eClassification=com::sun::star::task::InteractionClassification::InteractionClassification_ERROR,
 pParent=) at uui/source/iahndl-errorhandler.cxx:123
  #18 
UUIInteractionHelper::handleErrorHandlerRequest(com::sun::star::task::InteractionClassification,
 ErrCode, std::__debug::vector > 
const&, 
com::sun::star::uno::Sequence
 > const&, bool, bool&, rtl::OUString&) (this=this@entry=0x1408c9a8, 
eClassification=com::sun::star::task::InteractionClassification::InteractionClassification_ERROR,
 nErrorCode=..., nErrorCode@entry=..., rArguments=std::__debug::vector of 
length 0, capacity 0, rContinuations=uno::Sequence of length 1 = {...}, 
bObtainErrorStringOnly=bObtainErrorStringOnly@entry=false, 
bHasErrorString=@0x7ffd36859b90: false, rErrorString="") at 
uui/source/iahndl-errorhandler.cxx:250
  #19 0x7f51d92bbcd5 in 
UUIInteractionHelper::handleInteractiveIOException(com::sun::star::uno::Reference
 const&, bool, bool&, rtl::OUString&) (this=this@entry=0x1408c9a8, 
rRequest=uno::Reference to (ucbhelper::InteractionRequest *) 0x136bdcc8, 
bObtainErrorStringOnly=bObtainErrorStringOnly@entry=false, 
bHasErrorString=@0x7ffd36859b90: false, rErrorString="") at 
uui/source/iahndl-ioexceptions.cxx:265
  #20 0x7f51d92a9e33 in 
UUIInteractionHelper::handleRequest_impl(com::sun::star::uno::Reference
 const&, bool, bool&, rtl::OUString&) (this=this@entry=0x1408c9a8, 
rRequest=uno::Reference to (ucbhelper::InteractionRequest *) 0x136bdcc8, 
bObtainErrorStringOnly=bObtainErrorStringOnly@entry=false, 
bHasErrorString=@0x7ffd36859b90: false, rErrorString="") at 
uui/source/iahndl.cxx:474
  #21 0x7f51d92aca90 in 
UUIInteractionHelper::handleRequest(com::sun::star::uno::Reference
 const&) (this=this@entry=0x1408c9a8, rRequest=uno::Reference to 
(ucbhelper::InteractionRequest *) 0x136bdcc8) at uui/source/iahndl.cxx:177
  #22 0x7f51d92c2d36 in (anonymous 
namespace)::UUIInteractionHandler::handle(com::sun::star::uno::Reference
 const&) (this=0x1408c960, rRequest=) at 
uui/source/interactionhandler.cxx:194
  #23 0x7f51d8ff8607 in 
ucbhelper::cancelCommandExecution(com::sun::star::uno::Any const&, 
com::sun::star::uno::Reference 
const&) 
(rException=uno::Any("com.sun.star.ucb.InteractiveAugmentedIOException": ...), 
xEnv=uno::Reference to (ucbhelper::CommandEnvironment *) 0x1494c7e8) at 
ucbhelper/source/provider/cancelcommandexecution.cxx:52
  #24 0x7f5197fd8ddd in 
gio::Content::getFileInfo(com::sun::star::uno::Reference
 const&, _GFileInfo**, bool) (this=0x13658da0, env=uno::Reference to 
(ucbhelper::CommandEnvironment *) 0x1494c7e8, info=, 
fail=) at ucb/source/ucp/gio/gio_content.cxx:652
  #25 0x7f5197fdf515 in 
gio::Content::getPropertyValues(com::sun::star::uno::Sequence
 const&, 
com::sun::star::uno::Reference 
const&) 

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

2023-11-15 Thread Noel Grandin (via logerrit)
 unotools/source/config/securityoptions.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit def8f7699661f3ca9d763b6bd5e81759cf5b4e12
Author: Noel Grandin 
AuthorDate: Wed Nov 15 10:03:13 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 15 12:03:47 2023 +0100

tdf#158094 Can't remove trusted certificate in Macro Security

regression from
   commit 6ed8c5a0f19901ab413c6610649326b2475c3a8c
Author: Noel Grandin 
Date:   Sun Jul 25 21:35:05 2021 +0200
use officecfg for security options

where I accidentally dropped the chunk of code that removes
existing entries.

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

diff --git a/unotools/source/config/securityoptions.cxx 
b/unotools/source/config/securityoptions.cxx
index 2a9346a3e945..3197c60797d5 100644
--- a/unotools/source/config/securityoptions.cxx
+++ b/unotools/source/config/securityoptions.cxx
@@ -25,6 +25,9 @@
 #include 
 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -255,6 +258,18 @@ void SetTrustedAuthors( const std::vector< Certificate >& 
rAuthors )
 //return;
 
 Reference xHierarchyAccess = 
utl::ConfigManager::acquireTree(u"Office.Common/Security/Scripting");
+
+// first, clear existing entries
+{
+Reference xCont;
+
xHierarchyAccess->getByHierarchicalName(PROPERTYNAME_MACRO_TRUSTEDAUTHORS) >>= 
xCont;
+const Sequence< OUString > aNames = xCont->getElementNames();
+Reference xBatch(xHierarchyAccess, 
UNO_QUERY);
+for (const OUString& rName : aNames)
+xCont->removeByName(rName);
+xBatch->commitChanges();
+}
+
 sal_Int32   nCnt = rAuthors.size();
 for( sal_Int32 i = 0; i < nCnt; ++i )
 {


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

2023-10-20 Thread Stephan Bergmann (via logerrit)
 unotools/source/config/bootstrap.cxx  |6 +++---
 unotools/source/config/dynamicmenuoptions.cxx |6 +++---
 unotools/source/config/eventcfg.cxx   |4 ++--
 unotools/source/config/historyoptions.cxx |   18 +-
 unotools/source/config/lingucfg.cxx   |2 +-
 unotools/source/config/moduleoptions.cxx  |   22 +++---
 unotools/source/config/optionsdlg.cxx |8 
 unotools/source/config/securityoptions.cxx|8 
 unotools/source/config/syslocaleoptions.cxx   |   12 ++--
 unotools/source/config/viewoptions.cxx|8 
 10 files changed, 47 insertions(+), 47 deletions(-)

New commits:
commit a9a7ab4955bc9e18883331c78de407dd111776ea
Author: Stephan Bergmann 
AuthorDate: Thu Oct 19 10:30:38 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 20 16:14:06 2023 +0200

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

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

diff --git a/unotools/source/config/bootstrap.cxx 
b/unotools/source/config/bootstrap.cxx
index ef7ba57000c1..6aaac63f8f55 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -37,18 +37,18 @@
 // #define this to true, if remembering defaults is not supported properly
 #define RTL_BOOTSTRAP_DEFAULTS_BROKEN true
 
-constexpr OUStringLiteral BOOTSTRAP_ITEM_PRODUCT_KEY = u"ProductKey";
+constexpr OUString BOOTSTRAP_ITEM_PRODUCT_KEY = u"ProductKey"_ustr;
 constexpr OUStringLiteral BOOTSTRAP_ITEM_VERSIONFILE = u"Location";
 constexpr OUStringLiteral BOOTSTRAP_ITEM_BUILDID = u"buildid";
 
 constexpr OUStringLiteral BOOTSTRAP_ITEM_BASEINSTALLATION = u"BRAND_BASE_DIR";
 constexpr OUStringLiteral BOOTSTRAP_ITEM_USERINSTALLATION = 
u"UserInstallation";
 
-constexpr OUStringLiteral BOOTSTRAP_ITEM_USERDIR = u"UserDataDir";
+constexpr OUString BOOTSTRAP_ITEM_USERDIR = u"UserDataDir"_ustr;
 
 constexpr OUStringLiteral BOOTSTRAP_DEFAULT_BASEINSTALL = u"$SYSBINDIR/..";
 
-constexpr OUStringLiteral BOOTSTRAP_DIRNAME_USERDIR = u"user";
+constexpr OUString BOOTSTRAP_DIRNAME_USERDIR = u"user"_ustr;
 
 typedef char const * AsciiString;
 
diff --git a/unotools/source/config/dynamicmenuoptions.cxx 
b/unotools/source/config/dynamicmenuoptions.cxx
index 60c07baacafb..05b9c1707394 100644
--- a/unotools/source/config/dynamicmenuoptions.cxx
+++ b/unotools/source/config/dynamicmenuoptions.cxx
@@ -39,10 +39,10 @@ constexpr OUStringLiteral DYNAMICMENU_PROPERTYNAME_TITLE = 
u"Title";
 constexpr OUStringLiteral DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER = 
u"ImageIdentifier";
 constexpr OUStringLiteral DYNAMICMENU_PROPERTYNAME_TARGETNAME = u"TargetName";
 
-constexpr OUStringLiteral PATHDELIMITER = u"/";
+constexpr OUString PATHDELIMITER = u"/"_ustr;
 
-constexpr OUStringLiteral SETNODE_NEWMENU = u"New";
-constexpr OUStringLiteral SETNODE_WIZARDMENU = u"Wizard";
+constexpr OUString SETNODE_NEWMENU = u"New"_ustr;
+constexpr OUString SETNODE_WIZARDMENU = u"Wizard"_ustr;
 
 #define PROPERTYNAME_URL
DYNAMICMENU_PROPERTYNAME_URL
 #define PROPERTYNAME_TITLE  
DYNAMICMENU_PROPERTYNAME_TITLE
diff --git a/unotools/source/config/eventcfg.cxx 
b/unotools/source/config/eventcfg.cxx
index 085482f7e28f..62f854c003c5 100644
--- a/unotools/source/config/eventcfg.cxx
+++ b/unotools/source/config/eventcfg.cxx
@@ -240,11 +240,11 @@ void GlobalEventConfig_Impl::replaceByName( const 
OUString& aName, const Any& aE
 css::uno::Sequence < css::beans::PropertyValue > 
GlobalEventConfig_Impl::getByName( const OUString& aName )
 {
 static constexpr OUStringLiteral sEventType = u"EventType";
-static constexpr OUStringLiteral sScript = u"Script";
+static constexpr OUString sScript = u"Script"_ustr;
 Sequence< beans::PropertyValue > props(2);
 auto pProps = props.getArray();
 pProps[0].Name = sEventType;
-pProps[0].Value <<= OUString(sScript);
+pProps[0].Value <<= sScript;
 pProps[1].Name = sScript;
 EventBindingHash::const_iterator it = m_eventBindingHash.find( aName );
 if( it != m_eventBindingHash.end() )
diff --git a/unotools/source/config/historyoptions.cxx 
b/unotools/source/config/historyoptions.cxx
index 8361aa6bc358..52d2292c7932 100644
--- a/unotools/source/config/historyoptions.cxx
+++ b/unotools/source/config/historyoptions.cxx
@@ -35,15 +35,15 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
 
 namespace {
-constexpr OUStringLiteral s_sItemList = u"ItemList";
-constexpr OUStringLiteral s_sOrderList = u"OrderList";
-constexpr OUStringLiteral s_sHistoryItemRef = u"HistoryItemRef";
-constexpr OUStringLiteral s_sFilter = u"Filter";
-constexpr OUStringLiteral s_sTitle = u"Title";
-constexpr OUStringLiteral 

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

2023-08-09 Thread Noel Grandin (via logerrit)
 unotools/source/streaming/streamwrap.cxx |4 ++--
 unotools/source/ucbhelper/tempfile.cxx   |2 +-
 unotools/source/ucbhelper/xtempfile.cxx  |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 9a1de2cfdf2ac4d43d465556390025b427ddb688
Author: Noel Grandin 
AuthorDate: Wed Aug 9 14:39:58 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 9 20:04:57 2023 +0200

use sal_uInt64 when dealing with stream position

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

diff --git a/unotools/source/streaming/streamwrap.cxx 
b/unotools/source/streaming/streamwrap.cxx
index 2f8a86981194..beb909f36bee 100644
--- a/unotools/source/streaming/streamwrap.cxx
+++ b/unotools/source/streaming/streamwrap.cxx
@@ -185,7 +185,7 @@ sal_Int64 SAL_CALL 
OSeekableInputStreamWrapper::getPosition(  )
 std::scoped_lock aGuard( m_aMutex );
 checkConnected();
 
-sal_uInt32 nPos = m_pSvStream->Tell();
+sal_uInt64 nPos = m_pSvStream->Tell();
 checkError();
 return static_cast(nPos);
 }
@@ -264,7 +264,7 @@ void SAL_CALL OSeekableOutputStreamWrapper::seek( sal_Int64 
_nLocation )
 
 sal_Int64 SAL_CALL OSeekableOutputStreamWrapper::getPosition(  )
 {
-sal_uInt32 nPos = rStream.Tell();
+sal_uInt64 nPos = rStream.Tell();
 checkError();
 return static_cast(nPos);
 }
diff --git a/unotools/source/ucbhelper/tempfile.cxx 
b/unotools/source/ucbhelper/tempfile.cxx
index 4c6749226d77..992ff8814d7f 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -760,7 +760,7 @@ sal_Int64 SAL_CALL TempFileFastService::getPosition()
 std::unique_lock aGuard( maMutex );
 checkConnected();
 
-sal_uInt32 nPos = mpStream->Tell();
+sal_uInt64 nPos = mpStream->Tell();
 checkError();
 return static_cast(nPos);
 }
diff --git a/unotools/source/ucbhelper/xtempfile.cxx 
b/unotools/source/ucbhelper/xtempfile.cxx
index 8c1da6c98504..5e0cf5cbdb22 100644
--- a/unotools/source/ucbhelper/xtempfile.cxx
+++ b/unotools/source/ucbhelper/xtempfile.cxx
@@ -271,7 +271,7 @@ sal_Int64 SAL_CALL OTempFileService::getPosition(  )
 std::unique_lock aGuard( maMutex );
 checkConnected();
 
-sal_uInt32 nPos = mpStream->Tell();
+sal_uInt64 nPos = mpStream->Tell();
 checkError();
 return static_cast(nPos);
 }


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

2023-07-17 Thread Stephan Bergmann (via logerrit)
 unotools/source/misc/fontdefs.cxx |  479 --
 1 file changed, 157 insertions(+), 322 deletions(-)

New commits:
commit 182641750c7e5c968cbbc1fcb2e6b7ce60723c97
Author: Stephan Bergmann 
AuthorDate: Fri Jul 7 22:01:30 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Jul 17 08:17:10 2023 +0200

Simplify some UTF-16 string literals

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

diff --git a/unotools/source/misc/fontdefs.cxx 
b/unotools/source/misc/fontdefs.cxx
index 829e4a62c7ea..1b14ae3f728e 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -26,173 +26,6 @@
 #include 
 #include 
 
-sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0 };
-sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0 };
-sal_Unicode const aGungsuh[] = { 0xAD81, 0xC11C, 0 };
-sal_Unicode const aGungsuhChe[] = { 0xAD81, 0xC11C, 0xCCB4, 0 };
-sal_Unicode const aGulim[] = { 0xAD74, 0xB9BC, 0 };
-sal_Unicode const aGulimChe[] = { 0xAD74, 0xB9BC, 0xCCB4, 0 };
-sal_Unicode const aDotum[] = { 0xB3CB, 0xC6C0, 0 };
-sal_Unicode const aDotumChe[] = { 0xB3CB, 0xC6C0, 0xCCB4, 0 };
-sal_Unicode const aSimSun[] = { 0x5B8B, 0x4F53, 0 };
-sal_Unicode const aNSimSun[] = { 0x65B0, 0x5B8B, 0x4F53, 0 };
-sal_Unicode const aSimHei[] = { 0x9ED1, 0x4F53, 0 };
-sal_Unicode const aSimKai[] = { 0x6977, 0x4F53, 0 };
-sal_Unicode const azycjkSun[] = { 0x4E2D, 0x6613, 0x5B8B, 0x4F53, 0 };
-sal_Unicode const azycjkHei[] = { 0x4E2D, 0x6613, 0x9ED1, 0x4F53, 0 };
-sal_Unicode const azycjkKai[] = { 0x4E2D, 0x6613, 0x6977, 0x4F53, 0 };
-sal_Unicode const aFZHei[] = { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0 };
-sal_Unicode const aFZKai[] = { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0 };
-sal_Unicode const aFZSongYI[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4E00, 0 };
-sal_Unicode const aFZShuSong[] = { 0x65B9, 0x6B63, 0x4E66, 0x5B8B, 0 };
-sal_Unicode const aFZFangSong[] = { 0x65B9, 0x6B63, 0x4EFF, 0x5B8B, 0 };
-// Attention: this fonts includes the wrong encoding vector - so we double the 
names with correct and wrong encoding
-// First one is the GB-Encoding (we think the correct one), second is the big5 
encoded name
-sal_Unicode const aMHei1[] = { 'm', 0x7B80, 0x9ED1, 0 };
-sal_Unicode const aMHei2[] = { 'm', 0x6F60, 0x7AAA, 0 };
-sal_Unicode const aMKai1[] = { 'm', 0x7B80, 0x6977, 0x566C, 0 };
-sal_Unicode const aMKai2[] = { 'm', 0x6F60, 0x7FF1, 0x628E, 0 };
-sal_Unicode const aMSong1[] = { 'm', 0x7B80, 0x5B8B, 0 };
-sal_Unicode const aMSong2[] = { 'm', 0x6F60, 0x51BC, 0 };
-sal_Unicode const aCFangSong1[] = { 'm', 0x7B80, 0x592B, 0x5B8B, 0 };
-sal_Unicode const aCFangSong2[] = { 'm', 0x6F60, 0x6E98, 0x51BC, 0 };
-sal_Unicode const aMingLiU[] = { 0x7D30, 0x660E, 0x9AD4, 0 };
-sal_Unicode const aPMingLiU[] = { 0x65B0, 0x7D30, 0x660E, 0x9AD4, 0 };
-sal_Unicode const aHei[] = { 0x6865, 0 };
-sal_Unicode const aKai[] = { 0x6B61, 0 };
-sal_Unicode const aMing[] = { 0x6D69, 0x6E67, 0 };
-sal_Unicode const aMSGothic[] = { 'm','s',   0x30B4, 0x30B7, 0x30C3, 
0x30AF, 0 };
-sal_Unicode const aMSPGothic[] = { 'm','s','p',  0x30B4, 0x30B7, 0x30C3, 
0x30AF, 0 };
-sal_Unicode const aMSMincho[] = { 'm', 's',  0x660E, 0x671D, 0 };
-sal_Unicode const aMSPMincho[] = { 'm','s','p',  0x660E, 0x671D, 0 };
-sal_Unicode const aMSYaHei[] = { 0x5FAE, 0x8F6F, 0x96C5, 0x9ED1, 0 };
-sal_Unicode const aMSJhengHei[] = { 0x5FAE, 0x8EDF, 0x6B63, 0x9ED1, 0x9AD4, 0 
};
-sal_Unicode const aMeiryo[]= { 0x30e1, 0x30a4, 0x30ea, 0x30aa, 0 };
-sal_Unicode const aHGMinchoL[] = { 'h','g',  0x660E, 0x671D, 'l', 0 };
-sal_Unicode const aHGGothicB[] = { 'h','g',  0x30B4, 0x30B7, 0x30C3, 
0x30AF, 'b', 0 };
-sal_Unicode const aHGPMinchoL[] = { 'h','g','p', 0x660E, 0x671D, 'l', 0 };
-sal_Unicode const aHGPGothicB[] = { 'h','g','p', 0x30B4, 0x30B7, 0x30C3, 
0x30AF, 'b', 0 };
-sal_Unicode const aHGMinchoLSun[] = { 'h','g',   0x660E, 0x671D, 'l', 's', 
'u', 'n', 0 };
-sal_Unicode const aHGPMinchoLSun[] = { 'h','g','p', 0x660E, 0x671D, 'l', 's', 
'u', 'n', 0 };
-sal_Unicode const aHGGothicBSun[] = { 'h', 'g', 0x30B4, 0x30B7, 0x30C3, 
0x30AF, 'b', 's', 'u', 'n', 0 };
-sal_Unicode const aHGPGothicBSun[] = { 'h', 'g', 'p', 0x30B4, 0x30B7, 0x30C3, 
0x30AF, 'b', 's', 'u', 'n', 0 };
-sal_Unicode const aHGHeiseiMin1[] = { 'h', 'g', 0x5E73, 0x6210, 0x660E, 
0x671D, 0x4F53, 0 };
-sal_Unicode const aHGHeiseiMin2[] = { 'h', 'g', 0x5E73, 0x6210, 0x660E, 
0x671D, 0x4F53, 'w', '3', 'x', '1', '2', 0 };
-sal_Unicode const aIPAMincho[] =  { 'i', 'p', 'a', 0x660E, 0x671D, 0 };
-sal_Unicode const aIPAPMincho[] = { 'i', 'p', 'a', 'p', 0x660E, 0x671D, 0 };
-sal_Unicode const aIPAGothic[] =  { 'i', 'p', 'a',  0x30B4, 0x30B7, 0x30C3, 
0x30AF, 0 };
-sal_Unicode const aIPAPGothic[] =  { 'i', 'p', 'a', 'p', 0x30B4, 0x30B7, 
0x30C3, 0x30AF, 0 };
-sal_Unicode const aIPAUIGothic[] =  { 'i', 'p', 'a', 'u', 'i', 0x30B4, 

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

2023-07-10 Thread Stephan Bergmann (via logerrit)
 unotools/source/misc/fontdefs.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit a2589c4972b476937994b7ef546de22f89da134c
Author: Stephan Bergmann 
AuthorDate: Fri Jul 7 21:39:34 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Jul 10 14:00:11 2023 +0200

Remove duplicated entry

...that had been duplicated by c2fb518a6889fa9beac2d7e512ce3dcbf06c6d85 
"update
Japanese font order list", apparently by accident

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

diff --git a/unotools/source/misc/fontdefs.cxx 
b/unotools/source/misc/fontdefs.cxx
index b1cca8fe6469..829e4a62c7ea 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -442,7 +442,6 @@ OUString GetEnglishSearchFontName(std::u16string_view 
rInName)
 {aHiraginoKakuGothicProN, "hiraginokakugothicpron"},
 {aHiraginoMaruGothicPro, "hiraginomarugothicpro"},
 {aHiraginoMaruGothicProN, "hiraginomarugothicpron"},
-{aHiraginoMaruGothicProN, "hiraginomarugothicpron"},
 {aYuGothic, "yugothic"},
 {aYuGothicTai, "yugothictai"},
 {aYuMincho, "yumincho"},


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

2023-06-08 Thread Andreas Heinisch (via logerrit)
 unotools/source/config/historyoptions.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 1b368909b09cd62494239faaea09bb500dc9f19d
Author: Andreas Heinisch 
AuthorDate: Tue Jun 6 23:22:37 2023 +0200
Commit: Andreas Heinisch 
CommitDate: Thu Jun 8 15:05:33 2023 +0200

tdf#38742 - Start Center: odb files messes up pinned documents

Opening an odb file will mess up the pinned documents in the start center. 
To fix this issue, newly appended items will be moved to their correct position 
after their creation in the history vector.

Change-Id: I991ae3ae1018198e054eba3477bb948d7df85b44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152689
Tested-by: Andreas Heinisch 
Reviewed-by: Andreas Heinisch 

diff --git a/unotools/source/config/historyoptions.cxx 
b/unotools/source/config/historyoptions.cxx
index 7578bd190d47..0b9e4d717b83 100644
--- a/unotools/source/config/historyoptions.cxx
+++ b/unotools/source/config/historyoptions.cxx
@@ -273,7 +273,13 @@ void AppendItem(EHistoryType eHistory, const OUString& 
sURL, const OUString& sFi
 if (oIsPinned)
 {
 xSet->setPropertyValue(s_sPinned, uno::Any(*oIsPinned));
+if (*oIsPinned)
+PrependItem(xCfg, xOrderList, sURL);
+else
+MoveItemToUnpinned(xCfg, xOrderList, xItemList, sURL);
 }
+else
+MoveItemToUnpinned(xCfg, xOrderList, xItemList, sURL);
 
 ::comphelper::ConfigurationHelper::flush(xCfg);
 }


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

2023-03-13 Thread Noel Grandin (via logerrit)
 unotools/source/config/itemholder1.hxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit 143c48f3c3dd172c635e4535a0b0da741721f375
Author: Noel Grandin 
AuthorDate: Mon Mar 13 09:06:30 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Mar 13 08:39:10 2023 +

remove leftover #undef

from back when some code did
define css com::sun::star

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

diff --git a/unotools/source/config/itemholder1.hxx 
b/unotools/source/config/itemholder1.hxx
index 8e61bb55185b..b8a6504fd3e0 100644
--- a/unotools/source/config/itemholder1.hxx
+++ b/unotools/source/config/itemholder1.hxx
@@ -53,8 +53,4 @@ class ItemHolder1 : public ::cppu::WeakImplHelper< 
css::lang::XEventListener >
 static void impl_newItem(TItemInfo& rItem);
 };
 
-// namespaces
-
-#undef css
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: unotools/source writerfilter/source xmloff/source

2023-02-16 Thread Gabor Kelemen (via logerrit)
 unotools/source/config/cmdoptions.cxx|1 
 unotools/source/config/compatibility.cxx |1 
 unotools/source/config/eventcfg.cxx  |1 
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |1 
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |9 +--
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx|5 -
 writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx   |1 
 writerfilter/source/ooxml/OOXMLPropertySet.cxx   |   39 +++
 xmloff/source/draw/animationexport.cxx   |1 
 xmloff/source/draw/animationimport.cxx   |1 
 xmloff/source/draw/animexp.cxx   |3 -
 xmloff/source/draw/animimp.cxx   |1 
 xmloff/source/draw/descriptionimp.cxx|1 
 xmloff/source/draw/eventimp.cxx  |1 
 xmloff/source/draw/layerimp.cxx  |1 
 xmloff/source/draw/shapeimport.cxx   |   13 ++---
 xmloff/source/draw/ximpshow.cxx  |1 
 xmloff/source/style/impastpl.cxx |   30 +--
 xmloff/source/style/xmlaustp.cxx |   14 ++---
 xmloff/source/style/xmlexppr.cxx |   19 +++
 xmloff/source/style/xmlimppr.cxx |   23 
 xmloff/source/style/xmlprcon.cxx |3 -
 xmloff/source/style/xmlprmap.cxx |4 -
 xmloff/source/text/XMLIndexTemplateContext.cxx   |1 
 xmloff/source/text/XMLSectionExport.cxx  |1 
 xmloff/source/text/txtflde.cxx   |   17 +++---
 xmloff/source/text/txtimp.cxx|5 -
 xmloff/source/text/txtparae.cxx  |   23 
 xmloff/source/text/txtsecte.cxx  |   11 +---
 xmloff/source/text/txtstyli.cxx  |1 
 30 files changed, 100 insertions(+), 133 deletions(-)

New commits:
commit 857b74041aa339e56ee8b2a05a910172753ed783
Author: Gabor Kelemen 
AuthorDate: Wed Feb 15 01:18:28 2023 +0100
Commit: Gabor Kelemen 
CommitDate: Thu Feb 16 08:14:39 2023 +

Drop 'using namespace ::std' in dirs [u-x]*

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

diff --git a/unotools/source/config/cmdoptions.cxx 
b/unotools/source/config/cmdoptions.cxx
index 1408f22c2480..397e07718bef 100644
--- a/unotools/source/config/cmdoptions.cxx
+++ b/unotools/source/config/cmdoptions.cxx
@@ -33,7 +33,6 @@
 #include 
 #include 
 
-using namespace ::std;
 using namespace ::utl;
 using namespace ::osl;
 using namespace ::com::sun::star::uno;
diff --git a/unotools/source/config/compatibility.cxx 
b/unotools/source/config/compatibility.cxx
index eed01cce1c8b..400666ff34bc 100644
--- a/unotools/source/config/compatibility.cxx
+++ b/unotools/source/config/compatibility.cxx
@@ -32,7 +32,6 @@
 
 #include 
 
-using namespace ::std;
 using namespace ::utl;
 using namespace ::osl;
 using namespace ::com::sun::star::uno;
diff --git a/unotools/source/config/eventcfg.cxx 
b/unotools/source/config/eventcfg.cxx
index a92618a81f56..085482f7e28f 100644
--- a/unotools/source/config/eventcfg.cxx
+++ b/unotools/source/config/eventcfg.cxx
@@ -36,7 +36,6 @@
 #include 
 #include 
 
-using namespace ::std;
 using namespace ::utl;
 using namespace ::osl;
 using namespace ::com::sun::star::uno;
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 042cc142c71d..ef210f57bcfe 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -61,7 +61,6 @@
 namespace writerfilter::dmapper {
 
 using namespace ::com::sun::star;
-using namespace ::std;
 
 #define DEF_BORDER_DIST 190  //0,19cm
 #define CNF_FIRST_ROW   0x800
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 004f34971b6a..2c802d3ce2a9 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -36,7 +36,6 @@
 namespace writerfilter::dmapper {
 
 using namespace ::com::sun::star;
-using namespace ::std;
 
 DomainMapperTableManager::DomainMapperTableManager() :
 m_nRow(0),
@@ -108,7 +107,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
 {
 #ifdef DBG_UTIL
 TagLogger::getInstance().startElement("tablemanager.sprm");
-string sSprm = rSprm.toString();
+std::string sSprm = rSprm.toString();
 TagLogger::getInstance().chars(sSprm);
 TagLogger::getInstance().endElement();
 #endif
@@ -441,8 +440,8 @@ void 

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

2022-12-16 Thread Đoàn Trần Công Danh (via logerrit)
 unotools/source/i18n/resmgr.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 23dcd4339428e4080029ec5ae658e75f01e79a62
Author: Đoàn Trần Công Danh 
AuthorDate: Sun Nov 27 18:59:24 2022 +0700
Commit: Caolán McNamara 
CommitDate: Fri Dec 16 15:41:30 2022 +

i18n: fix build with Boost 1.81.0

Boost.Locale since 1.81.0 switch to enum classes for facet type [1].
Switch our resource manager accordingly.

1: 
https://github.com/boostorg/locale/commit/e5ed439ea39a4de915e9fb939cca95cae7d9d8d1

Change-Id: Ief215363ceb79b2019606b20a7cde55c8df6a042
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143343
Reviewed-by: Heiko Becker 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index ddedf5b9e8a2..3a7116350062 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -127,8 +127,13 @@ namespace Translate
 if (aFind != aCache.end())
 return aFind->second;
 boost::locale::generator gen;
+#if BOOST_VERSION < 108100
 gen.characters(boost::locale::char_facet);
 gen.categories(boost::locale::message_facet | 
boost::locale::information_facet);
+#else
+gen.characters(boost::locale::char_facet_t::char_f);
+gen.categories(boost::locale::category_t::message | 
boost::locale::category_t::information);
+#endif
 #if defined(ANDROID)
 OString sPath(OString(lo_get_app_data_dir()) + "/program/resource");
 #else


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

2022-11-01 Thread Stephan Bergmann (via logerrit)
 unotools/source/ucbhelper/tempfile.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit f312256a93b282e041a45c9dfef836220f996432
Author: Stephan Bergmann 
AuthorDate: Tue Nov 1 08:34:50 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Nov 1 12:19:13 2022 +0100

-Werror,-Wunused-variable (clang-cl)

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

diff --git a/unotools/source/ucbhelper/tempfile.cxx 
b/unotools/source/ucbhelper/tempfile.cxx
index efeb872b5d6d..2cf7a94ec5ed 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -422,7 +422,9 @@ void TempFileFast::CloseStream()
 {
 if (mxStream)
 {
+#if !defined _WIN32
 OUString aName = mxStream->GetFileName();
+#endif
 mxStream.reset();
 #ifdef _WIN32
 // On Windows, the file is opened with FILE_FLAG_DELETE_ON_CLOSE, so 
it will delete as soon as the handle closes.


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

2022-10-22 Thread Noel Grandin (via logerrit)
 unotools/source/ucbhelper/tempfile.cxx |   31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

New commits:
commit 9fd78b7421b5acefc8d0bde7cc103a045d79bd04
Author: Noel Grandin 
AuthorDate: Sat Oct 22 09:28:16 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Oct 22 10:34:21 2022 +0200

tdf#133767 speed up temp file creation

Use a GUID so we can avoid needing to check if the filename
already exists.
Shaves 2% off the export time.

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

diff --git a/unotools/source/ucbhelper/tempfile.cxx 
b/unotools/source/ucbhelper/tempfile.cxx
index f55c421a0291..61ef2d247c01 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #ifdef UNX
@@ -350,6 +351,34 @@ static OUString CreateTempName_Impl( const OUString* 
pParent, bool bKeep, bool b
false, false);
 }
 
+static OUString CreateTempNameFast()
+{
+OUString aEyeCatcher = "lu";
+#ifdef UNX
+#ifdef DBG_UTIL
+const char* eye = getenv("LO_TESTNAME");
+if(eye)
+{
+aEyeCatcher = OUString(eye, strlen(eye), RTL_TEXTENCODING_ASCII_US);
+}
+#else
+static const pid_t pid = getpid();
+static const OUString aPidString = OUString::number(pid);
+aEyeCatcher += aPidString;
+#endif
+#elif defined(_WIN32)
+static const int pid = _getpid();
+static const OUString aPidString = OUString::number(pid);
+aEyeCatcher += aPidString;
+#endif
+
+OUString aName = ConstructTempDir_Impl( /*pParent*/nullptr, 
/*bCreateParentDirs*/false ) + aEyeCatcher;
+
+tools::Guid aGuid(tools::Guid::Generate);
+
+return aName + aGuid.getOUString() + ".tmp" ;
+}
+
 OUString CreateTempName()
 {
 OUString aName(CreateTempName_Impl( nullptr, false ));
@@ -379,7 +408,7 @@ SvStream* TempFileFast::GetStream( StreamMode eMode )
 {
 if (!mxStream)
 {
-OUString aName = CreateTempName_Impl( /*pParent*/nullptr, 
/*bKeep*/true, /*bDirectory*/false );
+OUString aName = CreateTempNameFast();
 mxStream.reset(new SvFileStream(aName, eMode | StreamMode::TEMPORARY));
 }
 return mxStream.get();


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

2022-10-21 Thread Noel Grandin (via logerrit)
 unotools/source/ucbhelper/ucblockbytes.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 09dfee8a1cf7698a637f647f48750cf8d5722b7c
Author: Noel Grandin 
AuthorDate: Fri Oct 21 13:38:47 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Oct 21 20:48:43 2022 +0200

tdf#133767 use more TempFileFastService

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

diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx 
b/unotools/source/ucbhelper/ucblockbytes.cxx
index ad116eff294f..7231e0b46579 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -59,6 +59,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -1017,11 +1018,11 @@ bool UcbLockBytes::setInputStream( const 
Reference ,
 if( !m_xSeekable.is() && rxInputStream.is() )
 {
 Reference < XComponentContext > xContext = 
::comphelper::getProcessComponentContext();
-Reference< XOutputStream > rxTempOut( 
css::io::TempFile::create(xContext), UNO_QUERY_THROW );
+rtl::Reference< utl::TempFileFastService > rxTempOut( new 
utl::TempFileFastService );
 
 ::comphelper::OStorageHelper::CopyInputToOutput( 
rxInputStream, rxTempOut );
-m_xInputStream.set( rxTempOut, UNO_QUERY );
-m_xSeekable.set( rxTempOut, UNO_QUERY );
+m_xInputStream.set( rxTempOut );
+m_xSeekable.set( rxTempOut );
 }
 }
 


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

2022-10-19 Thread Caolán McNamara (via logerrit)
 unotools/source/ucbhelper/tempfile.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit c33607813ad0c4de69d20b98ba6146f319443d66
Author: Caolán McNamara 
AuthorDate: Wed Oct 19 10:24:27 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Oct 19 13:09:35 2022 +0200

crashtesting: temp files accumulating over time

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

diff --git a/unotools/source/ucbhelper/tempfile.cxx 
b/unotools/source/ucbhelper/tempfile.cxx
index af58473b9b87..406f08130dbd 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -368,6 +368,7 @@ TempFileFast::TempFileFast(TempFileFast && other) noexcept :
 
 TempFileFast::~TempFileFast()
 {
+CloseStream();
 }
 
 SvStream* TempFileFast::GetStream( StreamMode eMode )
@@ -382,7 +383,13 @@ SvStream* TempFileFast::GetStream( StreamMode eMode )
 
 void TempFileFast::CloseStream()
 {
-mxStream.reset();
+if (mxStream)
+{
+OUString aName = mxStream->GetFileName();
+mxStream.reset();
+if (!aName.isEmpty() && 
(osl::FileBase::getFileURLFromSystemPath(aName, aName) == 
osl::FileBase::E_None))
+File::remove(aName);
+}
 }
 
 OUString CreateTempURL( const OUString* pParent, bool bDirectory )


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

2022-09-22 Thread Caolán McNamara (via logerrit)
 unotools/source/config/configpaths.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit a64204cc26745e7652cb71ee2ed39a9ae00b09cd
Author: Caolán McNamara 
AuthorDate: Thu Sep 22 09:10:26 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 22 14:22:31 2022 +0200

cid#1515531 Out-of-bounds access

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

diff --git a/unotools/source/config/configpaths.cxx 
b/unotools/source/config/configpaths.cxx
index 70043a60fbd9..4e5002238d93 100644
--- a/unotools/source/config/configpaths.cxx
+++ b/unotools/source/config/configpaths.cxx
@@ -97,7 +97,8 @@ bool splitLastFromConfigurationPath(std::u16string_view 
_sInPath,
 nEnd = nPos;
 nPos = _sInPath.find(chQuote,nEnd);
 nStart = nPos + 1;
---nPos; // nPos = rInPath.lastIndexOf('[',nPos);
+if (nPos != std::u16string_view::npos)
+--nPos; // nPos = rInPath.lastIndexOf('[',nPos);
 }
 else // allow [xxx]
 {


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

2022-09-22 Thread Caolán McNamara (via logerrit)
 unotools/source/config/configpaths.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 022289b2f028efba55f679cb2664092f0ffbc20a
Author: Caolán McNamara 
AuthorDate: Thu Sep 22 09:03:22 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 22 14:22:18 2022 +0200

this originally checked for > 0

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

diff --git a/unotools/source/config/configpaths.cxx 
b/unotools/source/config/configpaths.cxx
index d3813f31fcf5..70043a60fbd9 100644
--- a/unotools/source/config/configpaths.cxx
+++ b/unotools/source/config/configpaths.cxx
@@ -81,14 +81,14 @@ bool splitLastFromConfigurationPath(std::u16string_view 
_sInPath,
 size_t nPos = _sInPath.size()-1;
 
 // strip trailing slash
-if (nPos != std::u16string_view::npos && _sInPath[ nPos ] == '/')
+if (nPos != std::u16string_view::npos && nPos > 0 && _sInPath[ nPos ] == 
'/')
 {
 OSL_FAIL("Invalid config path: trailing '/' is not allowed");
 --nPos;
 }
 
 // check for predicate ['xxx'] or ["yyy"]
-if (nPos != std::u16string_view::npos && _sInPath[ nPos ] == ']')
+if (nPos != std::u16string_view::npos && nPos > 0 && _sInPath[ nPos ] == 
']')
 {
 sal_Unicode chQuote = _sInPath[--nPos];
 


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

2022-09-14 Thread Caolán McNamara (via logerrit)
 unotools/source/ucbhelper/tempfile.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3076912419ddea4e1910a26e7c024cef4405dc5c
Author: Caolán McNamara 
AuthorDate: Wed Sep 14 12:27:19 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Sep 14 16:30:19 2022 +0200

crashtesting: SvMemoryStream::PutData assert

crashtesting logs contain a pile of SvMemoryStream::PutData assert
failures with the last ~90 documents

some experimentation suggests that the fallback path in
TempFile::GetStream is getting taken to use a SvMemoryStream
if there was no filename.

presumably there is no filename because there is no inodes left
in /tmp (see. https://gerrit.libreoffice.org/c/core/+/139881 to
remove left over OSL_PIPE when killed) or some other similar problem.

But the SvMemoryStream ctor used gives a Stream which cannot be written
to because it's given an empty buffer to use and isn't allowed to resize
it.

this went wrong at:

commit 7f8f277b94704a289fbbd1b836e4e5d66311580d
Date:   Wed Jan 7 09:28:42 2015 +0200

fdo#84938: convert STREAM_ #defines to 'enum class'

with

- pStream = new SvMemoryStream( eMode );
+ pStream = new SvMemoryStream( NULL, 0, eMode );

which selected ctor
a) SvMemoryStream(void* pBuf, std::size_t nSize, StreamMode eMode);
Previously eMode was just a sal_uInt16 typedef and this gave a fairly
arbitrary but useable nInitSize to select the other ctor of
b) SvMemoryStream(std::size_t nInitSize=512, std::size_t nResize=64);

Using eMode as nInitSize was bogus and worked by chance, that was
introduced with:

commit 160f790791d6e839919f0d0f9277cb047fe020ae
Date:   Mon Oct 4 19:30:08 2004 +

INTEGRATION: CWS mav09 (1.14.114); FILE MERGED
2004/07/08 08:29:38 mav 1.14.114.3: RESYNC: (1.15-1.17); FILE MERGED
2004/04/29 16:50:04 mav 1.14.114.2: RESYNC: (1.14-1.15); FILE MERGED
2004/04/29 11:03:41 mba 1.14.114.1: #i27773#: no SvFileStream please

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

diff --git a/unotools/source/ucbhelper/tempfile.cxx 
b/unotools/source/ucbhelper/tempfile.cxx
index 83a523a2bd9b..faca685d2676 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -429,7 +429,7 @@ SvStream* TempFile::GetStream( StreamMode eMode )
 if (!aName.isEmpty())
 pStream.reset(new SvFileStream(aName, eMode | 
StreamMode::TEMPORARY));
 else
-pStream.reset(new SvMemoryStream(nullptr, 0, eMode));
+pStream.reset(new SvMemoryStream);
 }
 
 return pStream.get();


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

2022-09-13 Thread Eike Rathke (via logerrit)
 unotools/source/i18n/charclass.cxx |   19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

New commits:
commit c0d09eb46665a0b2ab86f263cc95662f406d83d2
Author: Eike Rathke 
AuthorDate: Tue Sep 13 11:04:20 2022 +0200
Commit: Eike Rathke 
CommitDate: Tue Sep 13 12:37:12 2022 +0200

Empty string has no characters of any type

Change-Id: Id7244032d52360d2b0ea57fba023dff162a29d95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139831
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/unotools/source/i18n/charclass.cxx 
b/unotools/source/i18n/charclass.cxx
index 4573687c4d29..be3a9f4f0ee0 100644
--- a/unotools/source/i18n/charclass.cxx
+++ b/unotools/source/i18n/charclass.cxx
@@ -132,6 +132,9 @@ bool CharClass::isLetter( const OUString& rStr, sal_Int32 
nPos ) const
 
 bool CharClass::isLetter( const OUString& rStr ) const
 {
+if (rStr.isEmpty())
+return false;
+
 try
 {
 sal_Int32 nPos = 0;
@@ -170,6 +173,9 @@ bool CharClass::isDigit( const OUString& rStr, sal_Int32 
nPos ) const
 
 bool CharClass::isNumeric( const OUString& rStr ) const
 {
+if (rStr.isEmpty())
+return false;
+
 try
 {
 sal_Int32 nPos = 0;
@@ -226,6 +232,9 @@ bool CharClass::isLetterNumeric( const OUString& rStr, 
sal_Int32 nPos ) const
 
 bool CharClass::isLetterNumeric( const OUString& rStr ) const
 {
+if (rStr.isEmpty())
+return false;
+
 try
 {
 sal_Int32 nPos = 0;
@@ -264,10 +273,16 @@ bool CharClass::isUpper( const OUString& rStr, sal_Int32 
nPos ) const
 
 bool CharClass::isUpper( const OUString& rStr, sal_Int32 nPos, sal_Int32 
nCount ) const
 {
+if (rStr.isEmpty())
+return false;
+
+assert(nPos >= 0 && nPos < rStr.getLength() && nCount > 0);
+if (nPos < 0 || nPos >= rStr.getLength() || nCount == 0)
+return false;
+
 try
 {
-assert(nPos >= 0 && nCount >= 0);
-sal_Int32 nLen = std::min( nPos + nCount, rStr.getLength());
+const sal_Int32 nLen = std::min( nPos + nCount, rStr.getLength());
 while (nPos < nLen)
 {
 if (!isUpper( rStr, nPos))


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

2022-08-31 Thread Tor Lillqvist (via logerrit)
 unotools/source/misc/fontcvt.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit 0885d13cea917e9187adfe6190e60f4ce6039d2a
Author: Tor Lillqvist 
AuthorDate: Wed Aug 31 11:14:58 2022 +0300
Commit: Tor Lillqvist 
CommitDate: Wed Aug 31 12:00:02 2022 +0200

Remove comment that has been outdated since 2001

The "empty comments" the comment referred to were removed in
24f7917d9dc493ba35b504172f1ea3cfcd4d1486.

Change-Id: I32b37224bbe02892af1a1d8c8898e40c005110da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139080
Tested-by: Tor Lillqvist 
Reviewed-by: Tor Lillqvist 

diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx
index 15ea8f2c1ad0..02796e7d3ca2 100644
--- a/unotools/source/misc/fontcvt.cxx
+++ b/unotools/source/misc/fontcvt.cxx
@@ -35,9 +35,6 @@
 //various holes in OpenSymbol which were filled by StarSymbol, i.e.
 //destination mapping points which are empty in OpenSymbol
 
-// note: the character mappings that are only approximations
-//   are marked (with an empty comment)
-
 const sal_Unicode aStarBatsTab[224] =
 {
 // F020


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

2022-06-12 Thread Caolán McNamara (via logerrit)
 unotools/source/misc/fontdefs.cxx |   43 +-
 1 file changed, 20 insertions(+), 23 deletions(-)

New commits:
commit 90d4b93c5a7e25498dce949ac6fd2e33d53b74af
Author: Caolán McNamara 
AuthorDate: Sun Jun 12 13:01:04 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jun 12 18:31:47 2022 +0200

crashtesting: forum-mso-de-92960 GetEnglishSearchFontName varying results

depending on if it's called once, or twice on the input string.

The first converts from Full-Width Characters to equivalent lower ASCII
range with non letters retained. And then the second iteration would
convert to lower case ASCII with non letters filtered out. Presumably
the intention is the Full-Width case should get directly to the same
results as multiple calls.

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

diff --git a/unotools/source/misc/fontdefs.cxx 
b/unotools/source/misc/fontdefs.cxx
index 44147ffd0927..49f0d09c65cb 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -227,20 +227,24 @@ OUString StripScriptFromName(const OUString& _aName)
 }
 
 //return true if the character is stripped from the string
-static bool toOnlyLowerAscii(sal_Unicode c, OUStringBuffer , sal_Int32 
nIndex, sal_Int32& rLen)
+static bool toOnlyLowerAsciiOrStrip(sal_Unicode c, OUStringBuffer , 
sal_Int32 nIndex, sal_Int32& rLen)
 {
-// To Lowercase-Ascii
-if ( (c >= 'A') && (c <= 'Z') )
+// not lowercase Ascii
+if (c < 'a' || c > 'z')
 {
-c += 'a' - 'A';
-rName[nIndex] = c;
-}
-else if( ((c < '0') || (c > '9')) && (c != ';') && (c != '(') && (c != 
')') ) // not 0-9, semicolon, or brackets
-{
-// Remove white spaces and special characters
-rName.remove(nIndex, 1);
-rLen--;
-return true;
+// To Lowercase-Ascii
+if ( (c >= 'A') && (c <= 'Z') )
+{
+c += 'a' - 'A';
+rName[nIndex] = c;
+}
+else if( ((c < '0') || (c > '9')) && (c != ';') && (c != '(') && (c != 
')') ) // not 0-9, semicolon, or brackets
+{
+// Remove white spaces and special characters
+rName.remove(nIndex, 1);
+rLen--;
+return true;
+}
 }
 return false;
 }
@@ -273,12 +277,9 @@ OUString GetEnglishSearchFontName(std::u16string_view 
rInName)
 if ( (c >= 0xFF00) && (c <= 0xFF5E) )
 {
 c -= 0xFF00-0x0020;
-// Upper to Lower
-if ( (c >= 'A') && (c <= 'Z') )
-c += 'a' - 'A';
-
 rName[ i ] = c;
-
+if (toOnlyLowerAsciiOrStrip(c, rName, i, nLen))
+   continue;
 }
 else
 {
@@ -286,12 +287,8 @@ OUString GetEnglishSearchFontName(std::u16string_view 
rInName)
 bNeedTranslation = true;
 }
 }
-// not lowercase Ascii
-else if ( (c < 'a') || (c > 'z') )
-{
-if (toOnlyLowerAscii(c, rName, i, nLen))
-   continue;
-}
+else if (toOnlyLowerAsciiOrStrip(c, rName, i, nLen))
+continue;
 
 i++;
 }


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

2022-06-12 Thread Caolán McNamara (via logerrit)
 unotools/source/misc/fontdefs.cxx |   34 +-
 1 file changed, 21 insertions(+), 13 deletions(-)

New commits:
commit 55eeffe768c6a80c97ee4f2a58fb467872ddeb1d
Author: Caolán McNamara 
AuthorDate: Sun Jun 12 10:34:43 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jun 12 18:31:22 2022 +0200

split out the code that extracts a lower-ascii version of a fontname

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

diff --git a/unotools/source/misc/fontdefs.cxx 
b/unotools/source/misc/fontdefs.cxx
index 568110315f33..44147ffd0927 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -226,6 +226,25 @@ OUString StripScriptFromName(const OUString& _aName)
 return aName;
 }
 
+//return true if the character is stripped from the string
+static bool toOnlyLowerAscii(sal_Unicode c, OUStringBuffer , sal_Int32 
nIndex, sal_Int32& rLen)
+{
+// To Lowercase-Ascii
+if ( (c >= 'A') && (c <= 'Z') )
+{
+c += 'a' - 'A';
+rName[nIndex] = c;
+}
+else if( ((c < '0') || (c > '9')) && (c != ';') && (c != '(') && (c != 
')') ) // not 0-9, semicolon, or brackets
+{
+// Remove white spaces and special characters
+rName.remove(nIndex, 1);
+rLen--;
+return true;
+}
+return false;
+}
+
 OUString GetEnglishSearchFontName(std::u16string_view rInName)
 {
 OUStringBuffer rName(rInName);
@@ -270,19 +289,8 @@ OUString GetEnglishSearchFontName(std::u16string_view 
rInName)
 // not lowercase Ascii
 else if ( (c < 'a') || (c > 'z') )
 {
-// To Lowercase-Ascii
-if ( (c >= 'A') && (c <= 'Z') )
-{
-c += 'a' - 'A';
-rName[ i ] = c;
-}
-else if( ((c < '0') || (c > '9')) && (c != ';') && (c != '(') && 
(c != ')') ) // not 0-9, semicolon, or brackets
-{
-// Remove white spaces and special characters
-rName.remove(i,1);
-nLen--;
-continue;
-}
+if (toOnlyLowerAscii(c, rName, i, nLen))
+   continue;
 }
 
 i++;


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

2022-06-03 Thread Noel Grandin (via logerrit)
 unotools/source/config/useroptions.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit a3d4f7e8fb714aa987c542c8d6c8822a41818701
Author: Noel Grandin 
AuthorDate: Fri Jun 3 21:42:56 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Jun 3 23:03:07 2022 +0200

tdf#146988 Opening at cursor position doesn't work in large documents

regression from
commit 07021596acb3d104ba129d371b1ae0b79f67a6a4 (HEAD)
Date:   Sat Jun 12 18:57:51 2021 +0200
tdf#142242 Forename imported with trailing space

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

diff --git a/unotools/source/config/useroptions.cxx 
b/unotools/source/config/useroptions.cxx
index 61273bfbe9fb..fb8b24d9f05c 100644
--- a/unotools/source/config/useroptions.cxx
+++ b/unotools/source/config/useroptions.cxx
@@ -221,7 +221,7 @@ OUString SvtUserOptions::Impl::GetFullName () const
 sFullName += o3tl::trim(GetToken(UserOptToken::FathersName));
 if (!sFullName.isEmpty())
 sFullName += " ";
-sFullName += GetToken(UserOptToken::LastName);
+sFullName += o3tl::trim(GetToken(UserOptToken::LastName));
 }
 else
 {
@@ -230,14 +230,14 @@ OUString SvtUserOptions::Impl::GetFullName () const
 sFullName = GetToken(UserOptToken::LastName).trim();
 if (!sFullName.isEmpty())
 sFullName += " ";
-sFullName += GetToken(UserOptToken::FirstName);
+sFullName += o3tl::trim(GetToken(UserOptToken::FirstName));
 }
 else
 {
 sFullName = GetToken(UserOptToken::FirstName).trim();
 if (!sFullName.isEmpty())
 sFullName += " ";
-sFullName += GetToken(UserOptToken::LastName);
+sFullName += o3tl::trim(GetToken(UserOptToken::LastName));
 }
 }
 sFullName = sFullName.trim();


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

2022-06-03 Thread Stephan Bergmann (via logerrit)
 unotools/source/misc/datetime.cxx |   35 +++
 1 file changed, 19 insertions(+), 16 deletions(-)

New commits:
commit 95573221d0597951a63fb73b1bd343d2ab5aeee0
Author: Stephan Bergmann 
AuthorDate: Fri Jun 3 09:35:05 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 3 13:22:33 2022 +0200

Fix type of impl_getISO8601TimeToken etc. string index parameters

...after 6fc3dfd3f1b5cb13101299df42444f2ff0493846 "use more string_view"

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

diff --git a/unotools/source/misc/datetime.cxx 
b/unotools/source/misc/datetime.cxx
index db7216ffa268..c620307a9629 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 namespace
@@ -100,15 +101,15 @@ namespace
 //   o_strInt:output; integer part of token
 //   o_bFraction: output; was there a fractional part?
 //   o_strFrac:   output; fractional part of token
-bool impl_getISO8601TimeToken(std::u16string_view i_str, sal_Int32 , 
OUString , bool , OUString )
+bool impl_getISO8601TimeToken(std::u16string_view i_str, std::size_t 
, OUString , bool , OUString )
 {
 bFraction = false;
 // all tokens are of length 2
-const sal_Int32 nEndPos = nPos + 2;
+const std::size_t nEndPos = nPos + 2;
 const sal_Unicode c0 = '0';
 const sal_Unicode c9 = '9';
 const sal_Unicode sep = ':';
-for (;nPos < nEndPos && nPos < static_cast(i_str.size()); 
++nPos)
+for (;nPos < nEndPos && nPos < i_str.size(); ++nPos)
 {
 const sal_Unicode c = i_str[nPos];
 if (c == sep)
@@ -117,13 +118,15 @@ namespace
 return false;
 resInt += OUStringChar(c);
 }
-if (nPos == static_cast(i_str.size()) || i_str[nPos] == sep)
+if (nPos == 0)
+return false;
+if (nPos == i_str.size() || i_str[nPos] == sep)
 return true;
 if (i_str[nPos] == ',' || i_str[nPos] == '.')
 {
 bFraction = true;
 ++nPos;
-for (; nPos < static_cast(i_str.size()); ++nPos)
+for (; nPos < i_str.size(); ++nPos)
 {
 const sal_Unicode c = i_str[nPos];
 if (c == 'Z' || c == '+' || c == '-')
@@ -138,7 +141,7 @@ namespace
 return false;
 resFrac += OUStringChar(c);
 }
-OSL_ENSURE(nPos == static_cast(i_str.size()), 
"impl_getISO8601TimeToken internal error; expected to be at end of string");
+OSL_ENSURE(nPos == i_str.size(), "impl_getISO8601TimeToken 
internal error; expected to be at end of string");
 return true;
 }
 if (i_str[nPos] == 'Z' || i_str[nPos] == '+' || i_str[nPos] == '-')
@@ -149,12 +152,12 @@ namespace
 else
 return false;
 }
-bool getISO8601TimeToken(std::u16string_view i_str, sal_Int32 _index, 
OUString _strInt, bool _bFraction, OUString _strFrac)
+bool getISO8601TimeToken(std::u16string_view i_str, std::size_t _index, 
OUString _strInt, bool _bFraction, OUString _strFrac)
 {
 OUString resInt;
 OUString resFrac;
 bool bFraction = false;
-sal_Int32 index = io_index;
+std::size_t index = io_index;
 if(!impl_getISO8601TimeToken(i_str, index, resInt, bFraction, resFrac))
 return false;
 else
@@ -166,7 +169,7 @@ namespace
 return true;
 }
 }
-bool getISO8601TimeZoneToken(std::u16string_view i_str, sal_Int32 
_index, OUString _strInt)
+bool getISO8601TimeZoneToken(std::u16string_view i_str, std::size_t 
_index, OUString _strInt)
 {
 const sal_Unicode c0 = '0';
 const sal_Unicode c9 = '9';
@@ -181,7 +184,7 @@ namespace
 {
 ++io_index;
 o_strInt.clear();
-for (; io_index < static_cast(i_str.size()); ++io_index)
+for (; io_index < i_str.size(); ++io_index)
 {
 const sal_Unicode c = i_str[io_index];
 if ((c < c0 || c > c9) && c != sep)
@@ -375,7 +378,7 @@ bool ISO8601parseTime(std::u16string_view aTimeStr, 
css::util::Time& rTime)
 sal_Int32 nSec = 0;
 sal_Int32 nNanoSec = 0;
 
-sal_Int32 n = 0;
+std::size_t n = 0;
 OUString tokInt;
 OUString tokFrac;
 OUString tokTz;
@@ -385,7 +388,7 @@ bool ISO8601parseTime(std::u16string_view aTimeStr, 
css::util::Time& rTime)
 if (!bSuccess)
 return false;
 
-if ( bFrac && n < static_cast(aTimeStr.size()))
+if ( bFrac && n < aTimeStr.size())
 {
 // is it junk or the timezone?
 bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz);
@@ 

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

2022-05-30 Thread Noel Grandin (via logerrit)
 unotools/source/misc/syslocale.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 353dbd9afe8a373d8b2c7e3982b5110d224b2d9f
Author: Noel Grandin 
AuthorDate: Mon May 30 15:27:04 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon May 30 19:17:23 2022 +0200

no need to allocate LocaleDataWrapper separately

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

diff --git a/unotools/source/misc/syslocale.cxx 
b/unotools/source/misc/syslocale.cxx
index 954e7e94caf8..a1325958a0d4 100644
--- a/unotools/source/misc/syslocale.cxx
+++ b/unotools/source/misc/syslocale.cxx
@@ -60,7 +60,7 @@ class SvtSysLocale_Impl : public utl::ConfigurationListener
 {
 public:
 SvtSysLocaleOptionsaSysLocaleOptions;
-std::unique_ptr pLocaleData;
+std::optional   moLocaleData;
 std::optional   moCharClass;
 
 SvtSysLocale_Impl();
@@ -75,9 +75,9 @@ private:
 
 SvtSysLocale_Impl::SvtSysLocale_Impl()
 {
-pLocaleData.reset(new LocaleDataWrapper(
+moLocaleData.emplace(
 aSysLocaleOptions.GetRealLanguageTag(),
-getDateAcceptancePatternsConfig() ));
+getDateAcceptancePatternsConfig() );
 
 // listen for further changes
 aSysLocaleOptions.AddListener( this );
@@ -108,7 +108,7 @@ void SvtSysLocale_Impl::ConfigurationChanged( 
utl::ConfigurationBroadcaster*, Co
 {
 moCharClass.emplace( rLanguageTag );
 }
-pLocaleData.reset(new LocaleDataWrapper(rLanguageTag, 
getDateAcceptancePatternsConfig()));
+moLocaleData.emplace(rLanguageTag, getDateAcceptancePatternsConfig());
 }
 
 std::vector SvtSysLocale_Impl::getDateAcceptancePatternsConfig() 
const
@@ -145,7 +145,7 @@ SvtSysLocale::~SvtSysLocale()
 
 const LocaleDataWrapper& SvtSysLocale::GetLocaleData() const
 {
-return *(pImpl->pLocaleData);
+return *(pImpl->moLocaleData);
 }
 
 const CharClass& SvtSysLocale::GetCharClass() const


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

2022-05-23 Thread Noel Grandin (via logerrit)
 unotools/source/config/eventcfg.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9c046328596e21ce26ed59e215ba2ba5202361e2
Author: Noel Grandin 
AuthorDate: Mon May 23 11:04:38 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon May 23 15:26:12 2022 +0200

cache ref to GlobalEventConfig

so we avoid repeated allocation

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

diff --git a/unotools/source/config/eventcfg.cxx 
b/unotools/source/config/eventcfg.cxx
index 8cd883e0a0be..a92618a81f56 100644
--- a/unotools/source/config/eventcfg.cxx
+++ b/unotools/source/config/eventcfg.cxx
@@ -374,7 +374,7 @@ OUString GlobalEventConfig::GetEventName( GlobalEventId 
nIndex )
 {
 if (utl::ConfigManager::IsFuzzing())
 return OUString();
-rtl::Reference createImpl(new GlobalEventConfig);
+static rtl::Reference createImpl(new GlobalEventConfig);
 return GlobalEventConfig::m_pImpl->GetEventName( nIndex );
 }
 


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

2022-05-18 Thread Noel Grandin (via logerrit)
 unotools/source/ucbhelper/tempfile.cxx |   11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 4743a32b4f991c57e4b8a66adf035b1808ca793a
Author: Noel Grandin 
AuthorDate: Wed May 18 12:27:59 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed May 18 18:01:19 2022 +0200

only need to create the folder for temp files once

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

diff --git a/unotools/source/ucbhelper/tempfile.cxx 
b/unotools/source/ucbhelper/tempfile.cxx
index e912c609337b..83a523a2bd9b 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -142,19 +142,18 @@ static OUString ConstructTempDir_Impl( const OUString* 
pParent, bool bCreatePare
 
 if ( aName.isEmpty() )
 {
-OUString _Impl = gTempNameBase_Impl;
-if (rTempNameBase_Impl.isEmpty())
+if (gTempNameBase_Impl.isEmpty())
 {
 OUString ustrTempDirURL;
 ::osl::FileBase::RC rc = ::osl::File::getTempDirURL(
 ustrTempDirURL );
 if (rc == ::osl::FileBase::E_None)
-rTempNameBase_Impl = ustrTempDirURL;
+gTempNameBase_Impl = ustrTempDirURL;
+ensuredir( aName );
 }
 // if no parent or invalid parent : use default directory
-DBG_ASSERT( !rTempNameBase_Impl.isEmpty(), "No TempDir!" );
-aName = rTempNameBase_Impl;
-ensuredir( aName );
+DBG_ASSERT( !gTempNameBase_Impl.isEmpty(), "No TempDir!" );
+aName = gTempNameBase_Impl;
 }
 
 // Make sure that directory ends with a separator


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

2022-05-15 Thread Noel Grandin (via logerrit)
 unotools/source/config/docinfohelper.cxx |  118 ---
 1 file changed, 61 insertions(+), 57 deletions(-)

New commits:
commit c5340bdf444ae74f3778a2cf9f90d5db6c9ef153
Author: Noel Grandin 
AuthorDate: Sun May 15 13:02:18 2022 +0200
Commit: Noel Grandin 
CommitDate: Sun May 15 21:40:17 2022 +0200

cache string in DocInfoHelper::GetGeneratorString

since it doesn't change

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

diff --git a/unotools/source/config/docinfohelper.cxx 
b/unotools/source/config/docinfohelper.cxx
index 735f0ac2d56e..6b36fb21b7e3 100644
--- a/unotools/source/config/docinfohelper.cxx
+++ b/unotools/source/config/docinfohelper.cxx
@@ -31,74 +31,78 @@ namespace utl
 
 OUString DocInfoHelper::GetGeneratorString()
 {
-OUString aResultOverride = 
officecfg::Office::Common::Save::Document::GeneratorOverride::get();
-if( !aResultOverride.isEmpty())
-return aResultOverride;
-
-OUStringBuffer aResult(128);
-
-// First product: branded name + version
-// version is _$
+static const OUString sGenerator = []()
+{
+OUString aResultOverride = 
officecfg::Office::Common::Save::Document::GeneratorOverride::get();
+if( !aResultOverride.isEmpty())
+return aResultOverride;
 
-// plain product name
-OUString aValue( utl::ConfigManager::getProductName() );
-if ( !aValue.isEmpty() )
-{
-aResult.append( aValue.replace( ' ', '_' ) );
-aResult.append( '/' );
+OUStringBuffer aResult(128);
 
-aValue = utl::ConfigManager::getProductVersion();
-if ( !aValue.isEmpty() )
-{
-aResult.append( aValue.replace( ' ', '_' ) );
+// First product: branded name + version
+// version is _$
 
-aValue = utl::ConfigManager::getProductExtension();
+// plain product name
+OUString aValue( utl::ConfigManager::getProductName() );
 if ( !aValue.isEmpty() )
 {
 aResult.append( aValue.replace( ' ', '_' ) );
-}
-}
+aResult.append( '/' );
 
-OUString os( "$_OS" );
-OUString arch( "$_ARCH" );
-::rtl::Bootstrap::expandMacros(os);
-::rtl::Bootstrap::expandMacros(arch);
-aResult.append( '$' );
-aResult.append( os );
-aResult.append( '_' );
-aResult.append( arch );
-aResult.append( ' ' );
-}
+aValue = utl::ConfigManager::getProductVersion();
+if ( !aValue.isEmpty() )
+{
+aResult.append( aValue.replace( ' ', '_' ) );
 
-// second product: LibreOffice_project/
-// build_information has '(' and '[' encoded as '$', ')' and ']' ignored
-// and ':' replaced by '-'
-{
-aResult.append( "LibreOffice_project/" );
-OUString aBuildId( Bootstrap::getBuildIdData( OUString() ) );
-for( sal_Int32 i=0; i < aBuildId.getLength(); i++ )
-{
-sal_Unicode c = aBuildId[i];
-switch( c )
-{
-case '(':
-case '[':
+aValue = utl::ConfigManager::getProductExtension();
+if ( !aValue.isEmpty() )
+{
+aResult.append( aValue.replace( ' ', '_' ) );
+}
+}
+
+OUString os( "$_OS" );
+OUString arch( "$_ARCH" );
+::rtl::Bootstrap::expandMacros(os);
+::rtl::Bootstrap::expandMacros(arch);
 aResult.append( '$' );
-break;
-case ')':
-case ']':
-break;
-case ':':
-aResult.append( '-' );
-break;
-default:
-aResult.append( c );
-break;
+aResult.append( os );
+aResult.append( '_' );
+aResult.append( arch );
+aResult.append( ' ' );
+}
+
+// second product: LibreOffice_project/
+// build_information has '(' and '[' encoded as '$', ')' and ']' 
ignored
+// and ':' replaced by '-'
+{
+aResult.append( "LibreOffice_project/" );
+OUString aBuildId( Bootstrap::getBuildIdData( OUString() ) );
+for( sal_Int32 i=0; i < aBuildId.getLength(); i++ )
+{
+sal_Unicode c = aBuildId[i];
+switch( c )
+{
+case '(':
+case '[':
+aResult.append( '$' );
+break;
+case ')':
+case ']':
+  

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

2022-05-15 Thread Noel Grandin (via logerrit)
 unotools/source/config/lingucfg.cxx |   46 
 1 file changed, 21 insertions(+), 25 deletions(-)

New commits:
commit 7e2d26ef0ed47bf01d7396aa7c749062f9bdde98
Author: Noel Grandin 
AuthorDate: Mon May 9 18:18:47 2022 +0200
Commit: Noel Grandin 
CommitDate: Sun May 15 08:20:49 2022 +0200

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

and fix SvtLinguConfigItem::GetOptions so that it only
accesses state while holding the lock.

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

diff --git a/unotools/source/config/lingucfg.cxx 
b/unotools/source/config/lingucfg.cxx
index 882a3ead73e1..a38fb51b61b7 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -26,7 +26,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -38,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "itemholder1.hxx"
 
@@ -47,9 +47,9 @@ constexpr OUStringLiteral FILE_PROTOCOL = u"file:///";
 
 namespace
 {
-osl::Mutex& theSvtLinguConfigItemMutex()
+std::mutex& theSvtLinguConfigItemMutex()
 {
-static osl::Mutex SINGLETON;
+static std::mutex SINGLETON;
 return SINGLETON;
 }
 }
@@ -183,7 +183,7 @@ public:
 boolSetProperty( sal_Int32 nPropertyHandle,
  const css::uno::Any  );
 
-const SvtLinguOptions& GetOptions() const;
+void GetOptions( SvtLinguOptions& ) const;
 
 boolIsReadOnly( std::u16string_view rPropertyName ) const;
 boolIsReadOnly( sal_Int32 nPropertyHandle ) const;
@@ -202,7 +202,10 @@ SvtLinguConfigItem::SvtLinguConfigItem() :
 
 void SvtLinguConfigItem::Notify( const uno::Sequence< OUString > 
 )
 {
-LoadOptions( rPropertyNames );
+{
+std::unique_lock aGuard(theSvtLinguConfigItemMutex());
+LoadOptions( rPropertyNames );
+}
 NotifyListeners(ConfigurationHints::NONE);
 }
 
@@ -322,15 +325,13 @@ bool SvtLinguConfigItem::GetHdlByName(
 
 uno::Any SvtLinguConfigItem::GetProperty( std::u16string_view rPropertyName ) 
const
 {
-osl::MutexGuard aGuard(theSvtLinguConfigItemMutex());
-
 sal_Int32 nHdl;
 return GetHdlByName( nHdl, rPropertyName ) ? GetProperty( nHdl ) : 
uno::Any();
 }
 
 uno::Any SvtLinguConfigItem::GetProperty( sal_Int32 nPropertyHandle ) const
 {
-osl::MutexGuard aGuard(theSvtLinguConfigItemMutex());
+std::unique_lock aGuard(theSvtLinguConfigItemMutex());
 
 uno::Any aRes;
 
@@ -412,8 +413,6 @@ uno::Any SvtLinguConfigItem::GetProperty( sal_Int32 
nPropertyHandle ) const
 
 bool SvtLinguConfigItem::SetProperty( std::u16string_view rPropertyName, const 
uno::Any  )
 {
-osl::MutexGuard aGuard(theSvtLinguConfigItemMutex());
-
 bool bSucc = false;
 sal_Int32 nHdl;
 if (GetHdlByName( nHdl, rPropertyName ))
@@ -423,7 +422,7 @@ bool SvtLinguConfigItem::SetProperty( std::u16string_view 
rPropertyName, const u
 
 bool SvtLinguConfigItem::SetProperty( sal_Int32 nPropertyHandle, const 
uno::Any  )
 {
-osl::MutexGuard aGuard(theSvtLinguConfigItemMutex());
+std::unique_lock aGuard(theSvtLinguConfigItemMutex());
 
 bool bSucc = false;
 if (!rValue.hasValue())
@@ -560,16 +559,14 @@ bool SvtLinguConfigItem::SetProperty( sal_Int32 
nPropertyHandle, const uno::Any
 return bSucc;
 }
 
-const SvtLinguOptions& SvtLinguConfigItem::GetOptions() const
+void SvtLinguConfigItem::GetOptions(SvtLinguOptions ) const
 {
-osl::MutexGuard aGuard(theSvtLinguConfigItemMutex());
-return aOpt;
+std::unique_lock aGuard(theSvtLinguConfigItemMutex());
+rOptions = aOpt;
 }
 
 void SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > 
 )
 {
-osl::MutexGuard aGuard(theSvtLinguConfigItemMutex());
-
 bool bRes = false;
 
 const OUString *pProperyNames = rProperyNames.getConstArray();
@@ -687,7 +684,7 @@ bool SvtLinguConfigItem::SaveOptions( const uno::Sequence< 
OUString > 
 if (!IsModified())
 return true;
 
-osl::MutexGuard aGuard(theSvtLinguConfigItemMutex());
+std::unique_lock aGuard(theSvtLinguConfigItemMutex());
 
 bool bRet = false;
 
@@ -749,8 +746,6 @@ bool SvtLinguConfigItem::SaveOptions( const uno::Sequence< 
OUString > 
 
 bool SvtLinguConfigItem::IsReadOnly( std::u16string_view rPropertyName ) const
 {
-osl::MutexGuard aGuard(theSvtLinguConfigItemMutex());
-
 bool bReadOnly = false;
 sal_Int32 nHdl;
 if (GetHdlByName( nHdl, rPropertyName ))
@@ -760,7 +755,7 @@ bool SvtLinguConfigItem::IsReadOnly( std::u16string_view 
rPropertyName ) const
 
 bool SvtLinguConfigItem::IsReadOnly( sal_Int32 nPropertyHandle ) const
 {
-osl::MutexGuard aGuard(theSvtLinguConfigItemMutex());
+std::unique_lock aGuard(theSvtLinguConfigItemMutex());
 
 bool bReadOnly = false;
 
@@ -811,17 +806,17 @@ constexpr OUStringLiteral 

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

2022-05-13 Thread Mike Kaganski (via logerrit)
 unotools/source/config/useroptions.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2d93fd2631b4f8ceca1068c1779963424ff90e80
Author: Mike Kaganski 
AuthorDate: Fri May 13 20:51:28 2022 +0100
Commit: Mike Kaganski 
CommitDate: Fri May 13 22:42:09 2022 +0200

std::mutex->std::recursive_mutex in SvtUserOptions

Since commit ac511d90cdf9d28eb8809c30be9fa08b42ea0bd3
  Author Noel Grandin 
  Date   Thu Dec 23 19:42:19 2021 +0200
osl::Mutex->std::mutex in SvtUserOptions

non-recursive std::mutex is used. However, it looks like recursive
locking is possible here, as shows the debugging that I made
during the work on https://gerrit.libreoffice.org/c/core/+/134251.
The call stack looks like this:

  utllo.dll!SvtUserOptions::GetToken(UserOptToken nToken) Line 318
  utllo.dll!SvtUserOptions::GetLastName() Line 294
  
sclo.dll!ScChangeTrack::ConfigurationChanged(utl::ConfigurationBroadcaster * 
__formal, ConfigurationHints __formal) Line 2166
  
utllo.dll!utl::ConfigurationBroadcaster::NotifyListeners(ConfigurationHints 
nHint) Line 85
  
utllo.dll!utl::detail::Options::ConfigurationChanged(utl::ConfigurationBroadcaster
 * __formal, ConfigurationHints nHint) Line 112
  
utllo.dll!utl::ConfigurationBroadcaster::NotifyListeners(ConfigurationHints 
nHint) Line 85
  utllo.dll!SvtUserOptions::Impl::Notify() Line 251
  utllo.dll!SvtUserOptions::ChangeListener::changesOccurred(const 
com::sun::star::util::ChangesEvent & rEvent) Line 116
  configmgrlo.dll!configmgr::Broadcaster::send() Line 168
  configmgrlo.dll!configmgr::Access::setPropertyValue(const rtl::OUString & 
aPropertyName, const com::sun::star::uno::Any & aValue) Line 714
  utllo.dll!SvtUserOptions::Impl::SetValue_Impl(UserOptToken 
nToken, const rtl::OUString & sToken) Line 183
  utllo.dll!SvtUserOptions::Impl::SetToken(UserOptToken nToken, const 
rtl::OUString & sToken) Line 200
  utllo.dll!SvtUserOptions::SetToken(UserOptToken nToken, const 
rtl::OUString & rNewToken) Line 325
  
test_sc_subsequent_export_test.dll!ScExportTest::testTrackChangesSimpleXLSX() 
Line 3072
  ...

So getting the token may happen during notification of the listeners
after setting the token, in the same thread. So let's use recursive
mutex.

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

diff --git a/unotools/source/config/useroptions.cxx 
b/unotools/source/config/useroptions.cxx
index 86a42e84bae2..61273bfbe9fb 100644
--- a/unotools/source/config/useroptions.cxx
+++ b/unotools/source/config/useroptions.cxx
@@ -259,9 +259,9 @@ bool SvtUserOptions::Impl::IsTokenReadonly (UserOptToken 
nToken) const
 beans::PropertyAttribute::READONLY);
 }
 
-static std::mutex& GetInitMutex()
+static std::recursive_mutex& GetInitMutex()
 {
-static std::mutex gMutex;
+static std::recursive_mutex gMutex;
 return gMutex;
 }
 


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

2022-05-04 Thread Aurimas Fišeras (via logerrit)
 unotools/source/i18n/resmgr.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 405ab5c3307948bfcf12670d7ac6df0b86fb8832
Author: Aurimas Fišeras 
AuthorDate: Wed May 4 14:03:39 2022 +0300
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed May 4 16:06:41 2022 +0200

Fix typo in cbc34f69ec6363cd234ad2b1dfe09bfb531238db

Signed-off-by: Aurimas Fišeras 
Change-Id: Iee5c7aec7817bc7af5f45d192165fe30301788d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133823
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Adolfo Jayme Barrientos 

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index faa35ffe5c9e..641fa61be6dc 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -23,7 +23,7 @@
 // workdir/UnpackedTarball/boost/boost/locale/format.hpp using 
"std::auto_ptr d;", but must
 // come very early here in case  is already (indirectly) included 
earlier:
 #include 
-#if HAVE_LIBPP
+#if HAVE_LIBCPP
 #define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
 #elif defined _MSC_VER
 #define _HAS_AUTO_PTR_ETC 1


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

2022-04-26 Thread Stephan Bergmann (via logerrit)
 unotools/source/misc/fontcvt.cxx |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit fa7e4ddb61f79f2c1fd540a1445fd0045175a56d
Author: Stephan Bergmann 
AuthorDate: Tue Apr 26 14:44:57 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Apr 26 16:17:52 2022 +0200

Pick better variable types

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

diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx
index 736632f86c75..15ea8f2c1ad0 100644
--- a/unotools/source/misc/fontcvt.cxx
+++ b/unotools/source/misc/fontcvt.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -1355,7 +1356,7 @@ const ConvertChar* ConvertChar::GetRecodeData( 
std::u16string_view rOrgFontName,
 if( aMapName == "starsymbol"
  || aMapName == "opensymbol" )
 {
-for( int i = 0; i < int(SAL_N_ELEMENTS(aStarSymbolRecodeTable)); ++i)
+for( std::size_t i = 0; i < SAL_N_ELEMENTS(aStarSymbolRecodeTable); 
++i)
 {
 const RecodeTable& r = aStarSymbolRecodeTable[i];
 if( aOrgName.equalsAscii( r.pOrgName ) )
@@ -1370,7 +1371,7 @@ const ConvertChar* ConvertChar::GetRecodeData( 
std::u16string_view rOrgFontName,
 //adobe-symbol to unicode conversion in rtl instead
 else if( aMapName == "applesymbol" )
 {
-for( int i = 0; i < int(SAL_N_ELEMENTS(aAppleSymbolRecodeTable)); ++i)
+for( std::size_t i = 0; i < SAL_N_ELEMENTS(aAppleSymbolRecodeTable); 
++i)
 {
 const RecodeTable& r = aAppleSymbolRecodeTable[i];
 if( aOrgName.equalsAscii( r.pOrgName ) )
@@ -1399,8 +1400,8 @@ FontToSubsFontConverter CreateFontToSubsFontConverter( 
std::u16string_view rOrgN
 
 if ( nFlags == FontToSubsFontFlags::IMPORT )
 {
-const int nEntries = 2; // only StarMath+StarBats
-for( int i = 0; i < nEntries; ++i )
+const std::size_t nEntries = 2; // only StarMath+StarBats
+for( std::size_t i = 0; i < nEntries; ++i )
 {
 const RecodeTable& r = aStarSymbolRecodeTable[i];
 if( aName.equalsAscii( r.pOrgName ) )


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

2022-02-06 Thread Stephan Bergmann (via logerrit)
 unotools/source/i18n/localedatawrapper.cxx |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit e15c04f16fa28aa70de7de1e10d57fd03ab0b2d4
Author: Stephan Bergmann 
AuthorDate: Sun Feb 6 11:48:56 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Sun Feb 6 15:09:23 2022 +0100

Avoid signed-integer-overflow

...as seen during e.g. UITest_calc_tests9 now,

> unotools/source/i18n/localedatawrapper.cxx:1017:17: runtime error: signed 
integer overflow: -9223372036854775808 * -1 cannot be represented in type 'long'
>  #0 in LocaleDataWrapper::ImplAddFormatNum(rtl::OUStringBuffer&, long, 
unsigned short, bool, bool) const at 
unotools/source/i18n/localedatawrapper.cxx:1017:17
>  #1 in LocaleDataWrapper::getNum(long, unsigned short, bool, bool) const 
at unotools/source/i18n/localedatawrapper.cxx:1217:5
>  #2 in weld::MetricSpinButton::format_number(long) const at 
vcl/source/window/builder.cxx:306:32
>  #3 in weld::MetricSpinButton::update_width_chars() at 
vcl/source/window/builder.cxx:259:61
>  #4 in weld::MetricSpinButton::set_range(long, long, FieldUnit) at 
include/vcl/weld.hxx:1991:9
>  #5 in weld::MetricSpinButton::set_min(long, FieldUnit) at 
include/vcl/weld.hxx:2005:9

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

diff --git a/unotools/source/i18n/localedatawrapper.cxx 
b/unotools/source/i18n/localedatawrapper.cxx
index 42b8027b3239..96ad86d4b76a 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
 #include 
 #include 
 
@@ -1012,14 +1013,21 @@ void LocaleDataWrapper::ImplAddFormatNum( 
OUStringBuffer& rBuf,
 sal_uInt16  nNumLen;
 
 // negative number
+sal_uInt64 abs;
 if ( nNumber < 0 )
 {
-nNumber *= -1;
+// Avoid overflow, map -2^63 -> 2^63 explicitly:
+abs = nNumber == std::numeric_limits::min()
+? static_cast(std::numeric_limits::min()) : 
nNumber * -1;
 rBuf.append('-');
 }
+else
+{
+abs = nNumber;
+}
 
 // convert number
-ImplAddUNum( aNumBuf, static_cast(nNumber) );
+ImplAddUNum( aNumBuf, abs );
 nNumLen = static_cast(aNumBuf.getLength());
 
 if ( nNumLen <= nDecimals )


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

2021-12-25 Thread Noel Grandin (via logerrit)
 unotools/source/config/pathoptions.cxx |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit f5ba1d0aa5850d5c2a2e267c89ad60885144ae28
Author: Noel Grandin 
AuthorDate: Thu Dec 23 19:39:49 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Dec 25 09:28:23 2021 +0100

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

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

diff --git a/unotools/source/config/pathoptions.cxx 
b/unotools/source/config/pathoptions.cxx
index e7793d07321c..27ddbed79c24 100644
--- a/unotools/source/config/pathoptions.cxx
+++ b/unotools/source/config/pathoptions.cxx
@@ -434,9 +434,9 @@ SvtPathOptions_Impl::SvtPathOptions_Impl()
 
 namespace
 {
-::osl::Mutex& lclMutex()
+std::mutex& lclMutex()
 {
-static ::osl::Mutex SINGLETON;
+static std::mutex SINGLETON;
 return SINGLETON;
 }
 }
@@ -444,12 +444,13 @@ namespace
 SvtPathOptions::SvtPathOptions()
 {
 // Global access, must be guarded (multithreading)
-::osl::MutexGuard aGuard( lclMutex() );
+std::unique_lock aGuard( lclMutex() );
 pImpl = g_pOptions.lock();
 if ( !pImpl )
 {
 pImpl = std::make_shared();
 g_pOptions = pImpl;
+aGuard.unlock(); // because holdConfigItem will call this constructor
 ItemHolder1::holdConfigItem(EItem::PathOptions);
 }
 }
@@ -457,7 +458,7 @@ SvtPathOptions::SvtPathOptions()
 SvtPathOptions::~SvtPathOptions()
 {
 // Global access, must be guarded (multithreading)
-::osl::MutexGuard aGuard( lclMutex() );
+std::unique_lock aGuard( lclMutex() );
 
 pImpl.reset();
 }


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

2021-12-24 Thread Noel Grandin (via logerrit)
 unotools/source/config/moduleoptions.cxx |   25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

New commits:
commit fd4acfaca9fc012313f03f46e927add6feb6a553
Author: Noel Grandin 
AuthorDate: Thu Dec 23 19:37:42 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Dec 24 20:19:22 2021 +0100

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

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

diff --git a/unotools/source/config/moduleoptions.cxx 
b/unotools/source/config/moduleoptions.cxx
index 324736359b6e..967191c06e1f 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -762,9 +762,9 @@ namespace {
 //global
 std::weak_ptr g_pModuleOptions;
 
-osl::Mutex& impl_GetOwnStaticMutex()
+std::mutex& impl_GetOwnStaticMutex()
 {
-static osl::Mutex s_Mutex;
+static std::mutex s_Mutex;
 return s_Mutex;
 }
 }
@@ -785,13 +785,14 @@ SvtModuleOptions::SvtModuleOptions()
 return;
 
 // take the mutex, so we don't accidentally create more than one
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+std::unique_lock aGuard( impl_GetOwnStaticMutex() );
 
 m_pImpl = g_pModuleOptions.lock();
 if( !m_pImpl )
 {
 m_pImpl = std::make_shared();
 g_pModuleOptions = m_pImpl;
+aGuard.unlock(); // because holdConfigItem will call this constructor
 ItemHolder1::holdConfigItem(EItem::ModuleOptions);
 }
 }
@@ -823,32 +824,32 @@ const OUString & SvtModuleOptions::GetFactoryName( 
EFactory eFactory ) const
 
 OUString SvtModuleOptions::GetFactoryStandardTemplate( EFactory eFactory ) 
const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+std::unique_lock aGuard( impl_GetOwnStaticMutex() );
 return m_pImpl->GetFactoryStandardTemplate( eFactory );
 }
 
 OUString SvtModuleOptions::GetFactoryEmptyDocumentURL( EFactory eFactory ) 
const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+std::unique_lock aGuard( impl_GetOwnStaticMutex() );
 return SvtModuleOptions_Impl::GetFactoryEmptyDocumentURL( eFactory );
 }
 
 OUString SvtModuleOptions::GetFactoryDefaultFilter( EFactory eFactory ) const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+std::unique_lock aGuard( impl_GetOwnStaticMutex() );
 return m_pImpl->GetFactoryDefaultFilter( eFactory );
 }
 
 bool SvtModuleOptions::IsDefaultFilterReadonly( EFactory eFactory   ) const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+std::unique_lock aGuard( impl_GetOwnStaticMutex() );
 m_pImpl->MakeReadonlyStatesAvailable();
 return m_pImpl->IsDefaultFilterReadonly( eFactory );
 }
 
 sal_Int32 SvtModuleOptions::GetFactoryIcon( EFactory eFactory ) const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+std::unique_lock aGuard( impl_GetOwnStaticMutex() );
 return m_pImpl->GetFactoryIcon( eFactory );
 }
 
@@ -862,14 +863,14 @@ bool SvtModuleOptions::ClassifyFactoryByName( 
std::u16string_view sName,
 void SvtModuleOptions::SetFactoryStandardTemplate(   EFactory 
eFactory   ,
const OUString& sTemplate  )
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+std::unique_lock aGuard( impl_GetOwnStaticMutex() );
 m_pImpl->SetFactoryStandardTemplate( eFactory, sTemplate );
 }
 
 void SvtModuleOptions::SetFactoryDefaultFilter(   EFactory 
eFactory,
 const OUString& sFilter )
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+std::unique_lock aGuard( impl_GetOwnStaticMutex() );
 m_pImpl->SetFactoryDefaultFilter( eFactory, sFilter );
 }
 
@@ -899,7 +900,7 @@ bool SvtModuleOptions::IsDraw() const
 
 bool SvtModuleOptions::IsWriter() const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+std::unique_lock aGuard( impl_GetOwnStaticMutex() );
 return m_pImpl->IsModuleInstalled( EModule::WRITER );
 }
 
@@ -1086,7 +1087,7 @@ SvtModuleOptions::EFactory 
SvtModuleOptions::ClassifyFactoryByModel(const css::u
 
 css::uno::Sequence < OUString > SvtModuleOptions::GetAllServiceNames()
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+std::unique_lock aGuard( impl_GetOwnStaticMutex() );
 return m_pImpl->GetAllServiceNames();
 }
 


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

2021-12-24 Thread Noel Grandin (via logerrit)
 unotools/source/config/pathoptions.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit d94db4056a49fc4fee73173e1ef1c943f8ecc21f
Author: Noel Grandin 
AuthorDate: Thu Dec 23 19:39:05 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Dec 24 19:45:55 2021 +0100

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

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

diff --git a/unotools/source/config/pathoptions.cxx 
b/unotools/source/config/pathoptions.cxx
index 60335e00dfb9..e7793d07321c 100644
--- a/unotools/source/config/pathoptions.cxx
+++ b/unotools/source/config/pathoptions.cxx
@@ -82,7 +82,7 @@ class SvtPathOptions_Impl
 VarNameSet  m_aSystemPathVarNames;
 
 OUStringm_aEmptyString;
-mutable ::osl::Mutexm_aMutex;
+mutable std::mutex  m_aMutex;
 
 public:
 SvtPathOptions_Impl();
@@ -210,7 +210,7 @@ const VarNameAttribute aVarNameAttribute[] =
 
 const OUString& SvtPathOptions_Impl::GetPath( SvtPathOptions::Paths ePath )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 try
 {
@@ -263,7 +263,7 @@ const OUString& SvtPathOptions_Impl::GetPath( 
SvtPathOptions::Paths ePath )
 
 void SvtPathOptions_Impl::SetPath( SvtPathOptions::Paths ePath, const 
OUString& rNewPath )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 OUStringaResult;
 OUStringaNewValue;


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

2021-12-24 Thread Noel Grandin (via logerrit)
 unotools/source/ucbhelper/ucblockbytes.cxx|   56 +-
 unotools/source/ucbhelper/ucblockbytes.hxx|   16 +++
 unotools/source/ucbhelper/ucbstreamhelper.cxx |4 -
 3 files changed, 38 insertions(+), 38 deletions(-)

New commits:
commit 166e2a09052b8adb0525cc3a50b8b7cac0bbe6f1
Author: Noel Grandin 
AuthorDate: Thu Dec 23 19:56:21 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Dec 24 12:45:37 2021 +0100

rename some methods on UcbLockBytes

The Impl suffix means internal methods, but these are part
of the public API of the class

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

diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx 
b/unotools/source/ucbhelper/ucblockbytes.cxx
index da0118a6d60d..2d716f571586 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -88,13 +88,13 @@ public:
 virtual void SAL_CALL   removeListener ( const Reference 
&/*rxListener*/) override {}
 virtual void SAL_CALL   start() override {}
 virtual void SAL_CALL   terminate() override
-{ m_xLockBytes->terminate_Impl(); }
+{ m_xLockBytes->terminate(); }
 
 // XActiveDataSink.
 virtual void SAL_CALL   setInputStream ( const Reference 
) override
-{ m_xLockBytes->setInputStream_Impl 
(rxInputStream); }
+{ m_xLockBytes->setInputStream(rxInputStream); }
 virtual Reference SAL_CALL getInputStream() override
-{ return m_xLockBytes->getInputStream_Impl(); }
+{ return m_xLockBytes->getInputStream(); }
 };
 
 /**
@@ -115,11 +115,11 @@ public:
 virtual void SAL_CALL   removeListener ( const Reference 
&/*rxListener*/) override {}
 virtual void SAL_CALL   start() override {}
 virtual void SAL_CALL   terminate() override
-{ m_xLockBytes->terminate_Impl(); }
+{ m_xLockBytes->terminate(); }
 
 // XActiveDataStreamer
 virtual void SAL_CALL   setStream( const Reference< XStream >& aStream ) 
override
-{ m_xStream = aStream; 
m_xLockBytes->setStream_Impl( aStream ); }
+{ m_xStream = aStream; m_xLockBytes->setStream( 
aStream ); }
 virtual Reference< XStream > SAL_CALL getStream() override
 { return m_xStream; }
 };
@@ -170,7 +170,7 @@ void SAL_CALL 
UcbPropertiesChangeListener_Impl::propertiesChange ( const Sequenc
 {
 if (rPropChangeEvent.PropertyName == "DocumentHeader")
 {
-m_xLockBytes->SetStreamValid_Impl();
+m_xLockBytes->SetStreamValid();
 }
 }
 }
@@ -655,7 +655,7 @@ static bool UCBOpenContentSync(
 
 if ( !aScheme.equalsIgnoreAsciiCase( "http" ) &&
  !aScheme.equalsIgnoreAsciiCase( "https" ) )
-xLockBytes->SetStreamValid_Impl();
+xLockBytes->SetStreamValid();
 
 Reference< XPropertiesChangeListener > xListener;
 Reference< XPropertiesChangeNotifier > xProps(xContent,UNO_QUERY);
@@ -861,7 +861,7 @@ static bool UCBOpenContentSync_(
 // http protocol must be handled in a special way: during the opening 
process the input stream may change
 // only the last inputstream after notifying the document headers is valid
 if ( !aScheme.equalsIgnoreAsciiCase("http") )
-xLockBytes->SetStreamValid_Impl();
+xLockBytes->SetStreamValid();
 
 Reference< XPropertiesChangeListener > xListener = new 
UcbPropertiesChangeListener_Impl( xLockBytes );
 Reference< XPropertiesChangeNotifier > xProps ( xContent, UNO_QUERY );
@@ -979,23 +979,23 @@ Reference < XInputStream > UcbLockBytes::getInputStream()
 return m_xInputStream;
 }
 
-void UcbLockBytes::setStream_Impl( const Reference& aStream )
+void UcbLockBytes::setStream( const Reference& aStream )
 {
 osl::MutexGuard aGuard( m_aMutex );
 if ( aStream.is() )
 {
 m_xOutputStream = aStream->getOutputStream();
-setInputStream_Impl( aStream->getInputStream(), false );
+setInputStream( aStream->getInputStream(), false );
 m_xSeekable.set( aStream, UNO_QUERY );
 }
 else
 {
 m_xOutputStream.clear();
-setInputStream_Impl( Reference < XInputStream >() );
+setInputStream( Reference < XInputStream >() );
 }
 }
 
-bool UcbLockBytes::setInputStream_Impl( const Reference 
, bool bSetXSeekable )
+bool UcbLockBytes::setInputStream( const Reference 
, bool bSetXSeekable )
 {
 bool bRet = false;
 
@@ -1034,14 +1034,14 @@ bool UcbLockBytes::setInputStream_Impl( const 
Reference 
 return bRet;
 }
 
-void UcbLockBytes::SetStreamValid_Impl()
+void UcbLockBytes::SetStreamValid()
 {
 m_bStreamValid = true;
 if ( 

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

2021-11-18 Thread Noel Grandin (via logerrit)
 unotools/source/config/bootstrap.cxx|   11 ++---
 unotools/source/config/cmdoptions.cxx   |9 +--
 unotools/source/config/configmgr.cxx|8 +--
 unotools/source/config/fontcfg.cxx  |   24 +++--
 unotools/source/config/lingucfg.cxx |   32 ++--
 unotools/source/config/moduleoptions.cxx|1 
 unotools/source/config/pathoptions.cxx  |   14 
 unotools/source/config/syslocaleoptions.cxx |   10 +++-
 unotools/source/i18n/textsearch.cxx |1 
 unotools/source/ucbhelper/tempfile.cxx  |2 -
 10 files changed, 47 insertions(+), 65 deletions(-)

New commits:
commit f7a8c3cc4dc9a316b39e8680a2af330d8f8ba296
Author: Noel Grandin 
AuthorDate: Thu Nov 18 20:24:57 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Nov 19 07:33:34 2021 +0100

rtl::Static->thread-safe static in unotools

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

diff --git a/unotools/source/config/bootstrap.cxx 
b/unotools/source/config/bootstrap.cxx
index 51d3625e4af0..09c52157024b 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -32,7 +32,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 // #define this to true, if remembering defaults is not supported properly
@@ -112,12 +111,16 @@ private: // implementation
 
 namespace
 {
-class theImpl : public rtl::Static {};
+Bootstrap::Impl& theImpl()
+{
+static Bootstrap::Impl SINGLETON;
+return SINGLETON;
+}
 }
 
 const Bootstrap::Impl& Bootstrap::data()
 {
-return theImpl::get();
+return theImpl();
 }
 
 bool Bootstrap::getProcessWorkingDir(OUString )
@@ -146,7 +149,7 @@ bool Bootstrap::getProcessWorkingDir(OUString )
 
 void Bootstrap::reloadData()
 {
-theImpl::get().initialize();
+theImpl().initialize();
 }
 
 // helper
diff --git a/unotools/source/config/cmdoptions.cxx 
b/unotools/source/config/cmdoptions.cxx
index b61e49840390..d9e061224a4a 100644
--- a/unotools/source/config/cmdoptions.cxx
+++ b/unotools/source/config/cmdoptions.cxx
@@ -27,7 +27,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "itemholder1.hxx"
 
@@ -340,16 +339,12 @@ void SvtCommandOptions::EstablishFrameCallback(const 
css::uno::Reference< css::f
 m_pImpl->EstablishFrameCallback(xFrame);
 }
 
-namespace
-{
-class theCommandOptionsMutex : public rtl::Static{};
-}
-
 //  private method
 
 Mutex& SvtCommandOptions::GetOwnStaticMutex()
 {
-return theCommandOptionsMutex::get();
+static osl::Mutex theCommandOptionsMutex;
+return theCommandOptionsMutex;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/config/configmgr.cxx 
b/unotools/source/config/configmgr.cxx
index 84ab42cc795d..5b109788d2cd 100644
--- a/unotools/source/config/configmgr.cxx
+++ b/unotools/source/config/configmgr.cxx
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -67,10 +66,6 @@ getConfigurationProvider() {
 return css::configuration::theDefaultProvider::get( 
comphelper::getProcessComponentContext() );
 }
 
-struct theConfigManager:
-public rtl::Static< utl::ConfigManager, theConfigManager >
-{};
-
 }
 
 OUString utl::ConfigManager::getAboutBoxProductVersion() {
@@ -114,7 +109,8 @@ void utl::ConfigManager::storeConfigItems() {
 }
 
 utl::ConfigManager & utl::ConfigManager::getConfigManager() {
-return theConfigManager::get();
+static utl::ConfigManager theConfigManager;
+return theConfigManager;
 }
 
 css::uno::Reference< css::container::XHierarchicalNameAccess >
diff --git a/unotools/source/config/fontcfg.cxx 
b/unotools/source/config/fontcfg.cxx
index cfa6705a41c6..ef94981d7746 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -31,7 +31,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -83,18 +82,10 @@ static const char* getKeyType( DefaultFontType nKeyType )
 }
 }
 
-namespace
-{
-class theDefaultFontConfiguration
-: public rtl::Static
-{
-};
-}
-
 DefaultFontConfiguration& DefaultFontConfiguration::get()
 {
-return theDefaultFontConfiguration::get();
+static DefaultFontConfiguration theDefaultFontConfiguration;
+return theDefaultFontConfiguration;
 }
 
 DefaultFontConfiguration::DefaultFontConfiguration()
@@ -297,17 +288,10 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( 
const LanguageTag& rLan
  *  FontSubstConfigItem::get
  */
 
-namespace
-{
-class theFontSubstConfiguration
-: public rtl::Static
-{
-};
-}
-
 FontSubstConfiguration& FontSubstConfiguration::get()
 {
-return theFontSubstConfiguration::get();
+static FontSubstConfiguration theFontSubstConfiguration;
+return theFontSubstConfiguration;
 }
 

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

2021-10-31 Thread Mike Kaganski (via logerrit)
 unotools/source/config/compatibility.cxx  |8 ---
 unotools/source/config/configitem.cxx |   29 +-
 unotools/source/config/configmgr.cxx  |   12 --
 unotools/source/config/dynamicmenuoptions.cxx |9 
 unotools/source/config/eventcfg.cxx   |   22 ++-
 unotools/source/config/lingucfg.cxx   |3 --
 unotools/source/config/moduleoptions.cxx  |   11 +
 unotools/source/config/optionsdlg.cxx |9 ++--
 unotools/source/config/securityoptions.cxx|   24 +++--
 unotools/source/i18n/localedatawrapper.cxx|   14 ++--
 unotools/source/misc/ZipPackageHelper.cxx |   13 ---
 11 files changed, 81 insertions(+), 73 deletions(-)

New commits:
commit 1be268f3ec7661be232b8f5dc18546d1410dfd52
Author: Mike Kaganski 
AuthorDate: Fri Oct 29 10:22:09 2021 +0300
Commit: Mike Kaganski 
CommitDate: Mon Nov 1 05:25:36 2021 +0100

Prepare for removal of non-const operator[] from Sequence in unotools

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

diff --git a/unotools/source/config/compatibility.cxx 
b/unotools/source/config/compatibility.cxx
index 9c11393d0408..46d50889f6bc 100644
--- a/unotools/source/config/compatibility.cxx
+++ b/unotools/source/config/compatibility.cxx
@@ -250,6 +250,7 @@ void SvtCompatibilityOptions_Impl::ImplCommit()
 ClearNodeSet( SETNODE_ALLFILEFORMATS );
 
 Sequence< PropertyValue > lPropertyValues( 
SvtCompatibilityEntry::getElementCount() - 1 );
+auto lPropertyValuesRange = asNonConstRange(lPropertyValues);
 sal_uInt32 nNewCount = m_aOptions.size();
 for ( sal_uInt32 nItem = 0; nItem < nNewCount; ++nItem )
 {
@@ -258,8 +259,8 @@ void SvtCompatibilityOptions_Impl::ImplCommit()
 
 for ( int i = static_cast(SvtCompatibilityEntry::Index::Module); 
i < static_cast(SvtCompatibilityEntry::Index::INVALID); ++i )
 {
-lPropertyValues[ i - 1 ].Name  = sNode + 
SvtCompatibilityEntry::getName( SvtCompatibilityEntry::Index(i) );
-lPropertyValues[ i - 1 ].Value = aItem.getValue( 
SvtCompatibilityEntry::Index(i) );
+lPropertyValuesRange[ i - 1 ].Name  = sNode + 
SvtCompatibilityEntry::getName( SvtCompatibilityEntry::Index(i) );
+lPropertyValuesRange[ i - 1 ].Value = aItem.getValue( 
SvtCompatibilityEntry::Index(i) );
 }
 
 SetSetProperties( SETNODE_ALLFILEFORMATS, lPropertyValues );
@@ -273,6 +274,7 @@ Sequence< OUString > 
SvtCompatibilityOptions_Impl::impl_GetPropertyNames( Sequen
 
 // expand list to result list ...
 Sequence< OUString > lProperties( rItems.getLength() * ( 
SvtCompatibilityEntry::getElementCount() - 1 ) );
+auto lPropertiesRange = asNonConstRange(lProperties);
 
 sal_Int32 nDestStep= 0;
 // Copy entries to destination and expand every item with 2 supported sub 
properties.
@@ -281,7 +283,7 @@ Sequence< OUString > 
SvtCompatibilityOptions_Impl::impl_GetPropertyNames( Sequen
 OUString sFixPath = SETNODE_ALLFILEFORMATS PATHDELIMITER + rItem + 
PATHDELIMITER;
 for ( int i = static_cast(SvtCompatibilityEntry::Index::Module); 
i < static_cast(SvtCompatibilityEntry::Index::INVALID); ++i )
 {
-lProperties[ nDestStep ] = sFixPath + 
SvtCompatibilityEntry::getName( SvtCompatibilityEntry::Index(i) );
+lPropertiesRange[ nDestStep ] = sFixPath + 
SvtCompatibilityEntry::getName( SvtCompatibilityEntry::Index(i) );
 nDestStep++;
 }
 }
diff --git a/unotools/source/config/configitem.cxx 
b/unotools/source/config/configitem.cxx
index 37a5cd4d8cb0..dd8c567e639f 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -193,6 +193,7 @@ void ConfigItem::impl_packLocalizedProperties(  const   
Sequence< OUString >&
 //  The result list we pack into the return any. We never change size 
of lists!
 nSourceSize = lInNames.getLength();
 lOutValues.realloc( nSourceSize );
+auto plOutValues = lOutValues.getArray();
 
 // Algorithm:
 // Copy all names and values from in to out lists.
@@ -213,22 +214,23 @@ void ConfigItem::impl_packLocalizedProperties(  const   
Sequence< OUString >&
 lPropertyNames  =   xSetAccess->getElementNames();
 nPropertiesSize =   lPropertyNames.getLength();
 lProperties.realloc( nPropertiesSize );
+auto plProperties = lProperties.getArray();
 
 for( nPropertyCounter=0; nPropertyCountergetByName( lPropertyNames[nPropertyCounter] ) 
>>= sLocaleValue;
-lProperties[nPropertyCounter].Value <<= sLocaleValue;
+plProperties[nPropertyCounter].Value <<= sLocaleValue;
 }
 
-

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

2021-09-22 Thread Stephan Bergmann (via logerrit)
 unotools/source/config/dynamicmenuoptions.cxx |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 8d65f68f98950efe7cb117d7ad228bab79ad0ddb
Author: Stephan Bergmann 
AuthorDate: Wed Sep 22 17:15:46 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Sep 22 18:54:52 2021 +0200

Extend loplugin:stringviewparam to starts/endsWith: unotools

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

diff --git a/unotools/source/config/dynamicmenuoptions.cxx 
b/unotools/source/config/dynamicmenuoptions.cxx
index 14ce7bb87aa5..38138797f149 100644
--- a/unotools/source/config/dynamicmenuoptions.cxx
+++ b/unotools/source/config/dynamicmenuoptions.cxx
@@ -19,6 +19,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -30,6 +31,7 @@
 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
@@ -51,7 +53,7 @@ constexpr OUStringLiteral SETNODE_WIZARDMENU = u"Wizard";
 
 #define PROPERTYCOUNT   4
 
-constexpr OUStringLiteral PATHPREFIX_SETUP = u"m";
+constexpr std::u16string_view PATHPREFIX_SETUP = u"m";
 
 namespace
 {
@@ -300,10 +302,10 @@ static void lcl_SortAndExpandPropertyNames( const 
Sequence< OUString >& lSource
 };
 struct SelectByPrefix
 {
-bool operator() ( const OUString& s ) const
+bool operator() ( std::u16string_view s ) const
 {
 // Prefer setup written entries by check first letter of given 
string. It must be a "s".
-return s.startsWith( PATHPREFIX_SETUP );
+return o3tl::starts_with( s, PATHPREFIX_SETUP );
 }
 };
 


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

2021-09-17 Thread Caolán McNamara (via logerrit)
 unotools/source/misc/syslocale.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 55adeb1c3fbcf32c7c44a3f0c310b56298f551f9
Author: Caolán McNamara 
AuthorDate: Fri Sep 17 10:35:23 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Sep 17 13:03:22 2021 +0200

need optional header

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

diff --git a/unotools/source/misc/syslocale.cxx 
b/unotools/source/misc/syslocale.cxx
index b55e1316cabe..f6fd3c18a45b 100644
--- a/unotools/source/misc/syslocale.cxx
+++ b/unotools/source/misc/syslocale.cxx
@@ -31,8 +31,9 @@
 #include 
 #include 
 
-#include 
 #include 
+#include 
+#include 
 
 using namespace osl;
 using namespace com::sun::star;


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

2021-09-12 Thread Caolán McNamara (via logerrit)
 unotools/source/i18n/resmgr.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 38afbf56f0783d7442e63b58ffae9cf111c04edf
Author: Caolán McNamara 
AuthorDate: Sun Sep 12 17:14:01 2021 +0100
Commit: Caolán McNamara 
CommitDate: Sun Sep 12 20:30:53 2021 +0200

ofz: workaround more

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

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index 0d0a62d64b76..ede78900725b 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -126,7 +126,7 @@ namespace Translate
 if (aFind != aCache.end())
 return aFind->second;
 #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
-std::locale aRet(sIdentifier.getStr());
+std::locale aRet;
 aCache[sUnique] = aRet;
 return aRet;
 #else


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

2021-09-12 Thread Caolán McNamara (via logerrit)
 unotools/source/i18n/resmgr.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit cdf7352136f987f44e480777d302dfce9cbe3759
Author: Caolán McNamara 
AuthorDate: Sun Sep 12 11:51:37 2021 +0100
Commit: Caolán McNamara 
CommitDate: Sun Sep 12 17:40:23 2021 +0200

ofz: workaround memory sanitizer failure by skipping boost::locale

which seems to have started since...


https://github.com/google/oss-fuzz/commit/a2be91d3f10c54f20ae651375683ae4605543a63

e.g.

==3509==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0xa990506 in ~basic_string 
/usr/local/bin/../include/c++/v1/string:2267:9
#1 0xa990506 in ~pair 
/usr/local/bin/../include/c++/v1/__utility/pair.h:39:29
#2 0xa990506 in 
std::__1::allocator, std::__1::allocator >, 
boost::shared_ptr > 
>::destroy(std::__1::pair, std::__1::allocator >, 
boost::shared_ptr >*) 
/usr/local/bin/../include/c++/v1/__memory/allocator.h:156:15
#3 0xa9899a5 in destroy >, void> 
/usr/local/bin/../include/c++/v1/__memory/allocator_traits.h:309:13
#4 0xa9899a5 in __destruct_at_end 
/usr/local/bin/../include/c++/v1/vector:450:9
#5 0xa9899a5 in clear /usr/local/bin/../include/c++/v1/vector:374:29
#6 0xa9899a5 in ~__vector_base 
/usr/local/bin/../include/c++/v1/vector:487:9
#7 0xa9899a5 in ~vector /usr/local/bin/../include/c++/v1/vector:579:5
#8 0xa9899a5 in ~impl 
workdir/UnpackedTarball/boost/libs/locale/src/shared/localization_backend.cpp:34:45
#9 0xa9899a5 in ~hold_ptr 
workdir/UnpackedTarball/boost/boost/locale/hold_ptr.hpp:36:13
#10 0xa9899a5 in 
boost::locale::localization_backend_manager::~localization_backend_manager() 
workdir/UnpackedTarball/boost/libs/locale/src/shared/localization_backend.cpp:168:9
#11 0x579edc in init 
workdir/UnpackedTarball/boost/libs/locale/src/shared/localization_backend.cpp:263:17
#12 0x579edc in __cxx_global_var_init 
workdir/UnpackedTarball/boost/libs/locale/src/shared/localization_backend.cpp:264:15
#13 0x579edc in _GLOBAL__sub_I_localization_backend.cpp 
workdir/UnpackedTarball/boost/libs/locale/src/shared/localization_backend.cpp
#14 0xbe861ac in __libc_csu_init (/tmp/not-out/psdfuzzer+0xbe861ac)
#15 0x7f1bcadc003f in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x2703f)
#16 0x57c40d in _start (/tmp/not-out/psdfuzzer+0x57c40d)

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

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index 62991153f01c..0d0a62d64b76 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -125,6 +125,11 @@ namespace Translate
 auto aFind = aCache.find(sUnique);
 if (aFind != aCache.end())
 return aFind->second;
+#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
+std::locale aRet(sIdentifier.getStr());
+aCache[sUnique] = aRet;
+return aRet;
+#else
 boost::locale::generator gen;
 gen.characters(boost::locale::char_facet);
 gen.categories(boost::locale::message_facet | 
boost::locale::information_facet);
@@ -196,10 +201,14 @@ namespace Translate
 
 aCache[sUnique] = aRet;
 return aRet;
+#endif
 }
 
 OUString get(TranslateId sContextAndId, const std::locale )
 {
+#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
+return createFromUtf8(sContextAndId.mpId, strlen(sContextAndId.mpId));
+#else
 assert(!strchr(sContextAndId.mpId, '\004') && "should be using nget, 
not get");
 
 //if it's a key id locale, generate it here
@@ -221,10 +230,15 @@ namespace Translate
 result = result.replaceAll(OUString::fromUtf8("\xC3\x9F"), 
"ss");
 }
 return result;
+#endif
 }
 
 OUString nget(TranslateNId aContextSingularPlural, int n, const 
std::locale )
 {
+#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
+const char* pForm = n == 0 ? aContextSingularPlural.mpSingular : 
aContextSingularPlural.mpPlural;
+return createFromUtf8(pForm, strlen(pForm));
+#else
 //if it's a key id locale, generate it here
 if (std::use_facet(loc).language() == "qtz")
 {
@@ -244,6 +258,7 @@ namespace Translate
 result = result.replaceAll(OUString::fromUtf8("\xC3\x9F"), 
"ss");
 }
 return result;
+#endif
 }
 
 static ResHookProc pImplResHookProc = nullptr;


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

2021-09-01 Thread Mike Kaganski (via logerrit)
 unotools/source/ucbhelper/localfilehelper.cxx |   52 +-
 1 file changed, 3 insertions(+), 49 deletions(-)

New commits:
commit 86576cef2c77c8dc78e374aadaadf018610ed6f4
Author: Mike Kaganski 
AuthorDate: Wed Sep 1 15:50:42 2021 +0200
Commit: Mike Kaganski 
CommitDate: Wed Sep 1 20:26:48 2021 +0200

Simplify utl::removeTree

Implement it using comphelper::DirectoryHelper::deleteDirRecursively

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

diff --git a/unotools/source/ucbhelper/localfilehelper.cxx 
b/unotools/source/ucbhelper/localfilehelper.cxx
index 19de32703b37..bdabd5f0ac69 100644
--- a/unotools/source/ucbhelper/localfilehelper.cxx
+++ b/unotools/source/ucbhelper/localfilehelper.cxx
@@ -20,12 +20,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -83,54 +83,8 @@ css::uno::Sequence < OUString > 
LocalFileHelper::GetFolderContents( const OUStri
 }
 
 void removeTree(OUString const & url) {
-osl::Directory dir(url);
-osl::FileBase::RC rc = dir.open();
-switch (rc) {
-case osl::FileBase::E_None:
-break;
-case osl::FileBase::E_NOENT:
-return; //TODO: SAL_WARN if recursive
-default:
-SAL_WARN("desktop.app", "cannot open directory " << dir.getURL() << ": 
" << +rc);
-return;
-}
-for (;;) {
-osl::DirectoryItem i;
-rc = dir.getNextItem(i, SAL_MAX_UINT32);
-if (rc == osl::FileBase::E_NOENT) {
-break;
-}
-if (rc != osl::FileBase::E_None) {
-SAL_WARN( "desktop.app", "cannot iterate directory " << 
dir.getURL() << ": " << +rc);
-break;
-}
-osl::FileStatus stat(
-osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileName |
-osl_FileStatus_Mask_FileURL);
-rc = i.getFileStatus(stat);
-if (rc != osl::FileBase::E_None) {
-SAL_WARN( "desktop.app", "cannot stat in directory " << 
dir.getURL() << ": " << +rc);
-continue;
-}
-if (stat.getFileType() == osl::FileStatus::Directory) { //TODO: 
symlinks
-removeTree(stat.getFileURL());
-} else {
-rc = osl::File::remove(stat.getFileURL());
-SAL_WARN_IF(
-rc != osl::FileBase::E_None, "desktop.app",
-"cannot remove file " << stat.getFileURL() << ": " << +rc);
-}
-}
-if (dir.isOpen()) {
-rc = dir.close();
-SAL_WARN_IF(
-rc != osl::FileBase::E_None, "desktop.app",
-"cannot close directory " << dir.getURL() << ": " << +rc);
-}
-rc = osl::Directory::remove(url);
-SAL_WARN_IF(
-rc != osl::FileBase::E_None, "desktop.app",
-"cannot remove directory " << url << ": " << +rc);
+const bool bError = comphelper::DirectoryHelper::deleteDirRecursively(url);
+SAL_WARN_IF(bError, "desktop.app", "error removing directory " << url);
 }
 
 }


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

2021-09-01 Thread Mike Kaganski (via logerrit)
 unotools/source/ucbhelper/tempfile.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 71a8f5db9dd79ce1e023c22286a57856c4b7b3fc
Author: Mike Kaganski 
AuthorDate: Wed Sep 1 15:20:10 2021 +0200
Commit: Mike Kaganski 
CommitDate: Wed Sep 1 18:52:43 2021 +0200

Simplify dtor logic

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

diff --git a/unotools/source/ucbhelper/tempfile.cxx 
b/unotools/source/ucbhelper/tempfile.cxx
index bf41c00e2428..b53a56c60c02 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -385,12 +385,12 @@ TempFile::TempFile(TempFile && other) noexcept :
 
 TempFile::~TempFile()
 {
-// if we're going to delete this file, no point in flushing it when closing
-if (pStream && bKillingFileEnabled && !aName.isEmpty())
-static_cast(pStream.get())->SetDontFlushOnClose(true);
-pStream.reset();
 if ( bKillingFileEnabled )
 {
+// if we're going to delete this file, no point in flushing it when 
closing
+if (pStream && !aName.isEmpty())
+
static_cast(pStream.get())->SetDontFlushOnClose(true);
+pStream.reset();
 if ( bIsDirectory )
 {
 comphelper::DirectoryHelper::deleteDirRecursively(aName);


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

2021-08-18 Thread Caolán McNamara (via logerrit)
 unotools/source/config/securityoptions.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 2da60bb46a93a8d68111e1f18b31e8e6ddc6cc2c
Author: Caolán McNamara 
AuthorDate: Wed Aug 18 10:26:08 2021 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 18 22:32:18 2021 +0200

ofz#36713 Indirect-leak

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

diff --git a/unotools/source/config/securityoptions.cxx 
b/unotools/source/config/securityoptions.cxx
index cec3642fa37a..cd41f92a0eac 100644
--- a/unotools/source/config/securityoptions.cxx
+++ b/unotools/source/config/securityoptions.cxx
@@ -263,6 +263,8 @@ void SetTrustedAuthors( const std::vector< Certificate >& 
rAuthors )
 
 bool IsOptionSet( EOption eOption )
 {
+if (utl::ConfigManager::IsFuzzing())
+return false;
 boolbSet = false;
 switch(eOption)
 {


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

2021-07-31 Thread Noel Grandin (via logerrit)
 unotools/source/config/itemholder1.cxx |5 ++---
 unotools/source/config/itemholder1.hxx |5 +++--
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit d088493a47654e7f6239e8743bd8b2382754212a
Author: Noel Grandin 
AuthorDate: Fri Jul 30 15:04:50 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 31 10:02:31 2021 +0200

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

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

diff --git a/unotools/source/config/itemholder1.cxx 
b/unotools/source/config/itemholder1.cxx
index f56e88cb0b2f..7870e63ae888 100644
--- a/unotools/source/config/itemholder1.cxx
+++ b/unotools/source/config/itemholder1.cxx
@@ -43,7 +43,6 @@
 #include 
 
 ItemHolder1::ItemHolder1()
-: ItemHolderMutexBase()
 {
 try
 {
@@ -87,7 +86,7 @@ void SAL_CALL ItemHolder1::disposing(const 
css::lang::EventObject&)
 
 void ItemHolder1::impl_addItem(EItem eItem)
 {
-osl::MutexGuard aLock(m_aLock);
+std::lock_guard aLock(m_aLock);
 
 for ( auto const & rInfo : m_lItems )
 {
@@ -106,7 +105,7 @@ void ItemHolder1::impl_releaseAllItems()
 {
 std::vector< TItemInfo > items;
 {
-::osl::MutexGuard aLock(m_aLock);
+std::lock_guard aLock(m_aLock);
 items.swap(m_lItems);
 }
 
diff --git a/unotools/source/config/itemholder1.hxx 
b/unotools/source/config/itemholder1.hxx
index 8762938e968d..8e61bb55185b 100644
--- a/unotools/source/config/itemholder1.hxx
+++ b/unotools/source/config/itemholder1.hxx
@@ -22,14 +22,15 @@
 #include 
 #include 
 #include 
+#include 
 
-class ItemHolder1 : private ItemHolderMutexBase
-  , public  ::cppu::WeakImplHelper< css::lang::XEventListener >
+class ItemHolder1 : public ::cppu::WeakImplHelper< css::lang::XEventListener >
 {
 
 // member
 private:
 
+std::mutex m_aLock;
 std::vector m_lItems;
 
 // c++ interface


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

2021-07-19 Thread Noel Grandin (via logerrit)
 unotools/source/i18n/resmgr.cxx |   43 ++--
 1 file changed, 33 insertions(+), 10 deletions(-)

New commits:
commit 7712eb23bc97090fdd655a36dfca0019d43799e6
Author: Noel Grandin 
AuthorDate: Sun Jul 18 10:07:57 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 19 08:54:40 2021 +0200

tdf#143409: fix Translation is not applied in some UI

regression from
commit 0771ac00acc8730f77db76b901724f1513a32723
Author: Noel Grandin 
Date:   Tue Jun 15 21:12:25 2021 +0200
use string_view in the Translate API
Because I mixed string_view with C-style null-terminated
strings.

We are using string_view.data() to pass stuff to boost,
but of course, doing that loses the fact that the string data
has associated length, as it finds the length by looking for
a terminating NULL.

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

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index cdca420e2636..d35282025c4e 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -48,6 +48,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -199,27 +200,49 @@ namespace Translate
 
 OUString get(std::string_view sContextAndId, const std::locale )
 {
-std::string_view sContext;
-std::string_view sId;
-const char *p = strchr(sContextAndId.data(), '\004');
-if (!p)
-sId = sContextAndId;
+constexpr int BUFLEN = 128;
+// this function is performance-sensitive, so we allocate string data 
on stack
+std::array sStackBuffer;
+std::unique_ptr xHeapBuffer;
+char* pBuffer;
+if (sContextAndId.size() < BUFLEN - 1)
+pBuffer = sStackBuffer.data();
 else
 {
-sContext = std::string_view(sContextAndId.data(), p - 
sContextAndId.data());
-sId = sContextAndId.substr(p - sContextAndId.data() + 1);
-assert(!strchr(sId.data(), '\004') && "should be using nget, not 
get");
+xHeapBuffer = std::make_unique(sContextAndId.size()+1);
+pBuffer = xHeapBuffer.get();
+}
+
+const char* pContext;
+const char* pId;
+auto idx = sContextAndId.find('\004');
+memcpy(pBuffer, sContextAndId.data(), sContextAndId.size());
+if (idx == std::string_view::npos)
+{
+pBuffer[sContextAndId.size()] = 0;
+// point pContext at the null byte so it is an empty string
+pContext = pBuffer + sContextAndId.size();
+pId = pBuffer;
+}
+else
+{
+// stick a null byte in the middle to split it into two 
null-terminated strings
+pBuffer[idx] = 0;
+pBuffer[sContextAndId.size()] = 0;
+pContext = pBuffer;
+pId = pBuffer + idx + 1;
+assert(!strchr(pId, '\004') && "should be using nget, not get");
 }
 
 //if it's a key id locale, generate it here
 if (std::use_facet(loc).language() == "qtz")
 {
 OString sKeyId(genKeyId(OString(sContextAndId).replace('\004', 
'|')));
-return OUString::fromUtf8(sKeyId) + u"\u2016" + 
createFromUtf8(sId.data(), sId.size());
+return OUString::fromUtf8(sKeyId) + u"\u2016" + 
createFromUtf8(pId, strlen(pId));
 }
 
 //otherwise translate it
-const std::string ret = boost::locale::pgettext(sContext.data(), 
sId.data(), loc);
+const std::string ret = boost::locale::pgettext(pContext, pId, loc);
 OUString result(ExpandVariables(createFromUtf8(ret.data(), 
ret.size(;
 
 if (comphelper::LibreOfficeKit::isActive())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-18 Thread Noel Grandin (via logerrit)
 unotools/source/i18n/textsearch.cxx |   22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

New commits:
commit 5db3a12dffd6edc96474a470728c1b89e129ca36
Author: Noel Grandin 
AuthorDate: Sat Jul 17 19:02:30 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Jul 18 09:06:07 2021 +0200

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

and drop an rtl::Static

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

diff --git a/unotools/source/i18n/textsearch.cxx 
b/unotools/source/i18n/textsearch.cxx
index aae6cc573634..38c089f7c835 100644
--- a/unotools/source/i18n/textsearch.cxx
+++ b/unotools/source/i18n/textsearch.cxx
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star::util;
 using namespace ::com::sun::star::uno;
@@ -93,30 +94,27 @@ namespace
 {
 struct CachedTextSearch
 {
-::osl::Mutex mutex;
+std::mutex mutex;
 i18nutil::SearchOptions2 Options;
 css::uno::Reference< css::util::XTextSearch2 > xTextSearch;
 };
-
-struct theCachedTextSearch
-: public rtl::Static< CachedTextSearch, theCachedTextSearch > {};
 }
 
 Reference TextSearch::getXTextSearch( const 
i18nutil::SearchOptions2& rPara )
 {
-CachedTextSearch  = theCachedTextSearch::get();
+static CachedTextSearch theCachedTextSearch;
 
-osl::MutexGuard aGuard(rCache.mutex);
+std::lock_guard aGuard(theCachedTextSearch.mutex);
 
-if ( lcl_Equals(rCache.Options, rPara) )
-return rCache.xTextSearch;
+if ( lcl_Equals(theCachedTextSearch.Options, rPara) )
+return theCachedTextSearch.xTextSearch;
 
 Reference< XComponentContext > xContext = 
::comphelper::getProcessComponentContext();
-rCache.xTextSearch.set( ::TextSearch2::create(xContext) );
-rCache.xTextSearch->setOptions2( rPara.toUnoSearchOptions2() );
-rCache.Options = rPara;
+theCachedTextSearch.xTextSearch.set( ::TextSearch2::create(xContext) );
+theCachedTextSearch.xTextSearch->setOptions2( rPara.toUnoSearchOptions2() 
);
+theCachedTextSearch.Options = rPara;
 
-return rCache.xTextSearch;
+return theCachedTextSearch.xTextSearch;
 }
 
 TextSearch::TextSearch(const SearchParam & rParam, LanguageType eLang )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-18 Thread Noel Grandin (via logerrit)
 unotools/source/ucbhelper/ucblockbytes.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5060c0c8b9070c3093bf036de31c551ceb109ca7
Author: Noel Grandin 
AuthorDate: Sat Jul 17 18:57:37 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Jul 18 09:05:41 2021 +0200

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

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

diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx 
b/unotools/source/ucbhelper/ucblockbytes.cxx
index 4ed6dec1a236..1afa874d49f8 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -308,14 +308,14 @@ public:
 
 virtual Reference SAL_CALL getStream () override
 {
-osl::MutexGuard aGuard(m_aMutex);
+std::lock_guard aGuard(m_aMutex);
 return m_xStream;
 }
 
 private:
 Moderator& m_aModerator;
 
-osl::Mutex m_aMutex;
+std::mutex m_aMutex;
 Reference m_xStream;
 };
 
@@ -376,7 +376,7 @@ ModeratorsActiveDataStreamer::setStream (
 )
 {
 m_aModerator.setStream(rxStream);
-osl::MutexGuard aGuard(m_aMutex);
+std::lock_guard aGuard(m_aMutex);
 m_xStream = rxStream;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-17 Thread Noel Grandin (via logerrit)
 unotools/source/ucbhelper/ucblockbytes.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 2f8635fc919906fe8238fa5ef9e77cfe2f23df83
Author: Noel Grandin 
AuthorDate: Sat Jul 17 18:56:54 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 17 22:16:55 2021 +0200

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

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

diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx 
b/unotools/source/ucbhelper/ucblockbytes.cxx
index d3e090cae679..4ed6dec1a236 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -57,6 +57,7 @@
 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::io;
@@ -333,13 +334,13 @@ public:
 
 virtual Reference SAL_CALL getInputStream() override
 {
-osl::MutexGuard aGuard(m_aMutex);
+std::lock_guard aGuard(m_aMutex);
 return m_xStream;
 }
 
 private:
 Moderator& m_aModerator;
-osl::Mutex m_aMutex;
+std::mutex m_aMutex;
 Reference m_xStream;
 };
 
@@ -357,7 +358,7 @@ ModeratorsActiveDataSink::setInputStream (
 )
 {
 m_aModerator.setInputStream(rxInputStream);
-osl::MutexGuard aGuard(m_aMutex);
+std::lock_guard aGuard(m_aMutex);
 m_xStream = rxInputStream;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-16 Thread Eike Rathke (via logerrit)
 unotools/source/i18n/calendarwrapper.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 75b789a8f542e729e9e5e21031b7baf452a8c174
Author: Eike Rathke 
AuthorDate: Fri Jul 16 15:43:00 2021 +0200
Commit: Eike Rathke 
CommitDate: Fri Jul 16 16:41:32 2021 +0200

Output proper language tag instead of Language+Country concatenation

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

diff --git a/unotools/source/i18n/calendarwrapper.cxx 
b/unotools/source/i18n/calendarwrapper.cxx
index 7f0cc753a2c5..fd5d166fdcf9 100644
--- a/unotools/source/i18n/calendarwrapper.cxx
+++ b/unotools/source/i18n/calendarwrapper.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -62,7 +63,7 @@ void CalendarWrapper::loadCalendar( const OUString& 
rUniqueID, const css::lang::
 catch (const Exception&)
 {
 TOOLS_WARN_EXCEPTION( "unotools.i18n", "loadCalendar: "
-<< rUniqueID << "   Locale: " << rLocale.Language << "_" << 
rLocale.Country );
+<< rUniqueID << "   Locale: " << 
LanguageTag::convertToBcp47(rLocale) );
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-12 Thread Jun NOGATA (via logerrit)
 unotools/source/config/fontcfg.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 42e8317446bfbf545252b2143a2433bb1f620410
Author: Jun NOGATA 
AuthorDate: Fri Jun 4 21:17:55 2021 +0900
Commit: Noel Grandin 
CommitDate: Mon Jul 12 11:04:49 2021 +0200

add Japanese font fallback.

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

diff --git a/unotools/source/config/fontcfg.cxx 
b/unotools/source/config/fontcfg.cxx
index 7f6d68e8a40f..9c26795e2611 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -246,6 +246,7 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( 
const LanguageTag& rLan
 #define FALLBACKFONT_UI_SANS_ARABIC "Tahoma;Traditional Arabic;Simplified 
Arabic;Lucidasans;Lucida Sans;Supplement;Andale Sans UI;clearlyU;Interface 
User;Arial Unicode MS;Lucida Sans Unicode;WarpSans;Geneva;MS Sans 
Serif;Helv;Dialog;Albany;Lucida;Helvetica;Charcoal;Chicago;Arial;Helmet;Interface
 System;Sans Serif"
 #define FALLBACKFONT_UI_SANS_THAI "OONaksit;Tahoma;Lucidasans;Arial 
Unicode MS"
 #define FALLBACKFONT_UI_SANS_KOREAN "Noto Sans KR;Noto Sans CJK KR;Noto 
Serif KR;Noto Serif CJK KR;Source Han Sans 
KR;NanumGothic;NanumBarunGothic;NanumBarunGothic YetHangul;KoPubWorld 
Dotum;Malgun Gothic;Apple SD Gothic 
Neo;Dotum;DotumChe;Gulim;GulimChe;Batang;BatangChe;Apple Gothic;UnDotum;Baekmuk 
Gulim;Arial Unicode MS;Lucida Sans Unicode;gnu-unifont;Andale Sans UI"
+#define FALLBACKFONT_UI_SANS_JAPANESE "Noto Sans CJK JP;Noto Sans 
JP;Source Han Sans;Source Han Sans JP;Yu Gothic UI;Yu Gothic;YuGothic;Hiragino 
Sans;Hiragino Kaku Gothic ProN;Hiragino Kaku Gothic Pro;Hiragino Kaku Gothic 
StdN;Meiryo UI;Meiryo;IPAexGothic;IPAPGothic;IPAGothic;MS UI Gothic;MS 
PGothic;MS Gothic;Osaka;Unifont;gnu-unifont;Arial Unicode MS;Interface System"
 #define FALLBACKFONT_UI_SANS_CHINSIM "Andale Sans UI;Arial Unicode 
MS;ZYSong18030;AR PL SungtiL GB;AR PL KaitiM GB;SimSun;Lucida Sans 
Unicode;Fangsong;Hei;Song;Kai;Ming;gnu-unifont;Interface User;"
 #define FALLBACKFONT_UI_SANS_CHINTRD "Andale Sans UI;Arial Unicode MS;AR 
PL Mingti2L Big5;AR PL KaitiM Big5;Kai;PMingLiU;MingLiU;Ming;Lucida Sans 
Unicode;gnu-unifont;Interface User;"
 
@@ -264,6 +265,10 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( 
const LanguageTag& rLan
 {
 return FALLBACKFONT_UI_SANS_KOREAN;
 }
+else if ( aLanguage == "ja" )
+{
+return FALLBACKFONT_UI_SANS_JAPANESE;
+}
 else if( aLanguage == "cs" ||
  aLanguage == "hu" ||
  aLanguage == "pl" ||
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-10 Thread Sergey Fukanchik (via logerrit)
 unotools/source/config/moduleoptions.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 41c01e48f695dd41ef2f39e83b22ca7b9dbab658
Author: Sergey Fukanchik 
AuthorDate: Mon Jun 7 12:46:01 2021 -0400
Commit: Ilmari Lauhakangas 
CommitDate: Sat Jul 10 12:33:52 2021 +0200

tdf#142702 Handle STARTMODULE in SvtModuleOptions::GetFactoryShortName

Change-Id: I06064eb3ff3e77cd0fcc6e211c6baf07adcc3096
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116794
Reviewed-by: Ilmari Lauhakangas 
Tested-by: Ilmari Lauhakangas 

diff --git a/unotools/source/config/moduleoptions.cxx 
b/unotools/source/config/moduleoptions.cxx
index e9d9e84a8c06..118d43056da5 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -468,6 +468,8 @@ OUString 
SvtModuleOptions::GetFactoryShortName(SvtModuleOptions::EFactory eFacto
break;
 case SvtModuleOptions::EFactory::DATABASE :  sShortName = "sdatabase";
break;
+case SvtModuleOptions::EFactory::STARTMODULE :  sShortName = 
"startmodule";
+   break;
 default:
 OSL_FAIL( "unknown factory" );
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-13 Thread Noel Grandin (via logerrit)
 unotools/source/config/useroptions.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 07021596acb3d104ba129d371b1ae0b79f67a6a4
Author: Noel Grandin 
AuthorDate: Sat Jun 12 18:57:51 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Jun 13 13:18:59 2021 +0200

tdf#142242 Forename imported with trailing space

Fix the case where there is only a name, and no surname.

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

diff --git a/unotools/source/config/useroptions.cxx 
b/unotools/source/config/useroptions.cxx
index 66f354ef5ae5..bf877b790392 100644
--- a/unotools/source/config/useroptions.cxx
+++ b/unotools/source/config/useroptions.cxx
@@ -222,7 +222,7 @@ OUString SvtUserOptions::Impl::GetFullName () const
 sFullName += GetToken(UserOptToken::FathersName).trim();
 if (!sFullName.isEmpty())
 sFullName += " ";
-sFullName += GetToken(UserOptToken::LastName).trim();
+sFullName += GetToken(UserOptToken::LastName);
 }
 else
 {
@@ -231,16 +231,17 @@ OUString SvtUserOptions::Impl::GetFullName () const
 sFullName = GetToken(UserOptToken::LastName).trim();
 if (!sFullName.isEmpty())
 sFullName += " ";
-sFullName += GetToken(UserOptToken::FirstName).trim();
+sFullName += GetToken(UserOptToken::FirstName);
 }
 else
 {
 sFullName = GetToken(UserOptToken::FirstName).trim();
 if (!sFullName.isEmpty())
 sFullName += " ";
-sFullName += GetToken(UserOptToken::LastName).trim();
+sFullName += GetToken(UserOptToken::LastName);
 }
 }
+sFullName = sFullName.trim();
 
 return sFullName;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-11 Thread Julien Nabet (via logerrit)
 unotools/source/config/fltrcfg.cxx |   19 +++
 unotools/source/i18n/calendarwrapper.cxx   |   10 +-
 unotools/source/i18n/localedatawrapper.cxx |   10 +-
 unotools/source/misc/ZipPackageHelper.cxx  |5 +
 unotools/source/ucbhelper/ucbhelper.cxx|5 +
 unotools/source/ucbhelper/ucblockbytes.cxx |4 +---
 6 files changed, 16 insertions(+), 37 deletions(-)

New commits:
commit 39b8ce7081888b5d5e73ba0b49396b09ca7f3b61
Author: Julien Nabet 
AuthorDate: Fri Jun 11 12:30:29 2021 +0200
Commit: Julien Nabet 
CommitDate: Fri Jun 11 14:58:09 2021 +0200

Simplify Sequences initializations (unotools)

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

diff --git a/unotools/source/config/fltrcfg.cxx 
b/unotools/source/config/fltrcfg.cxx
index c68ac827ee79..323cfe0c38ed 100644
--- a/unotools/source/config/fltrcfg.cxx
+++ b/unotools/source/config/fltrcfg.cxx
@@ -120,12 +120,7 @@ void SvtAppFilterOptions_Impl::Notify( const Sequence< 
OUString >&  )
 
 voidSvtAppFilterOptions_Impl::Load()
 {
-Sequence aNames(2);
-OUString* pNames = aNames.getArray();
-pNames[0] = "Load";
-pNames[1] = "Save";
-
-Sequence aValues = GetProperties(aNames);
+Sequence aValues = GetProperties({ "Load", "Save" });
 const Any* pValues = aValues.getConstArray();
 
 if(pValues[0].hasValue())
@@ -165,11 +160,7 @@ void SvtWriterFilterOptions_Impl::ImplCommit()
 {
 SvtAppFilterOptions_Impl::ImplCommit();
 
-Sequence aNames { "Executable" };
-Sequence aValues(1);
-aValues[0] <<= bLoadExecutable;
-
-PutProperties(aNames, aValues);
+PutProperties({ "Executable" }, { Any(bLoadExecutable) });
 }
 
 void SvtWriterFilterOptions_Impl::Load()
@@ -215,11 +206,7 @@ void SvtCalcFilterOptions_Impl::ImplCommit()
 {
 SvtAppFilterOptions_Impl::ImplCommit();
 
-Sequence aNames { "Executable" };
-Sequence aValues(1);
-aValues[0] <<= bLoadExecutable;
-
-PutProperties(aNames, aValues);
+PutProperties({ "Executable" }, { Any(bLoadExecutable) });
 }
 
 void SvtCalcFilterOptions_Impl::Load()
diff --git a/unotools/source/i18n/calendarwrapper.cxx 
b/unotools/source/i18n/calendarwrapper.cxx
index 5f4a1669bccf..7f0cc753a2c5 100644
--- a/unotools/source/i18n/calendarwrapper.cxx
+++ b/unotools/source/i18n/calendarwrapper.cxx
@@ -78,7 +78,7 @@ css::uno::Sequence< OUString > 
CalendarWrapper::getAllCalendars( const css::lang
 TOOLS_WARN_EXCEPTION( "unotools.i18n", "getAllCalendars" );
 }
 
-return css::uno::Sequence< OUString > (0);
+return {};
 }
 
 OUString CalendarWrapper::getUniqueID() const
@@ -247,7 +247,7 @@ css::uno::Sequence< css::i18n::CalendarItem2 > 
CalendarWrapper::getMonths() cons
 {
 TOOLS_WARN_EXCEPTION( "unotools.i18n", "getMonths" );
 }
-return css::uno::Sequence< css::i18n::CalendarItem2 > (0);
+return {};
 }
 
 css::uno::Sequence< css::i18n::CalendarItem2 > CalendarWrapper::getDays() const
@@ -261,7 +261,7 @@ css::uno::Sequence< css::i18n::CalendarItem2 > 
CalendarWrapper::getDays() const
 {
 TOOLS_WARN_EXCEPTION( "unotools.i18n", "getDays" );
 }
-return css::uno::Sequence< css::i18n::CalendarItem2 > (0);
+return {};
 }
 
 OUString CalendarWrapper::getDisplayName( sal_Int16 nCalendarDisplayIndex, 
sal_Int16 nIdx, sal_Int16 nNameType ) const
@@ -321,7 +321,7 @@ css::uno::Sequence< css::i18n::CalendarItem2 > 
CalendarWrapper::getGenitiveMonth
 {
 TOOLS_WARN_EXCEPTION( "unotools.i18n", "getGenitiveMonths" );
 }
-return css::uno::Sequence< css::i18n::CalendarItem2 > (0);
+return {};
 }
 
 css::uno::Sequence< css::i18n::CalendarItem2 > 
CalendarWrapper::getPartitiveMonths() const
@@ -335,7 +335,7 @@ css::uno::Sequence< css::i18n::CalendarItem2 > 
CalendarWrapper::getPartitiveMont
 {
 TOOLS_WARN_EXCEPTION( "unotools.i18n", "getPartitiveMonths" );
 }
-return css::uno::Sequence< css::i18n::CalendarItem2 > (0);
+return {};
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotools/source/i18n/localedatawrapper.cxx 
b/unotools/source/i18n/localedatawrapper.cxx
index 39e01f563392..2bb6769c51ed 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -169,7 +169,7 @@ void LocaleDataWrapper::loadData()
 catch (const Exception&)
 {
 TOOLS_WARN_EXCEPTION( "unotools.i18n", "getDateAcceptancePatterns" );
-aDateAcceptancePatterns = css::uno::Sequence< OUString >(0);
+aDateAcceptancePatterns = {};
 }
 
 
@@ -182,7 +182,7 @@ void LocaleDataWrapper::loadData()
 catch ( const Exception& )
 {
 TOOLS_WARN_EXCEPTION( "unotools.i18n", "getReservedWord" );
-aReservedWordSeq = css::uno::Sequence< OUString >(0);
+aReservedWordSeq = {};
 }
 for (int 

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

2021-05-10 Thread Noel Grandin (via logerrit)
 unotools/source/config/moduleoptions.cxx |   36 ---
 1 file changed, 19 insertions(+), 17 deletions(-)

New commits:
commit e368cc61fa715e98fbc448c5b0edc781915f8385
Author: Noel Grandin 
AuthorDate: Mon May 10 19:08:08 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon May 10 20:20:28 2021 +0200

reduce cost of locking in SvtModuleOptions

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

diff --git a/unotools/source/config/moduleoptions.cxx 
b/unotools/source/config/moduleoptions.cxx
index ea3db01585c2..e9d9e84a8c06 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -779,23 +779,25 @@ osl::Mutex& impl_GetOwnStaticMutex()
 
*//*-*/
 SvtModuleOptions::SvtModuleOptions()
 {
-// Global access, must be guarded (multithreading!)
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
-
+// no need to take the mutex yet, shared_ptr/weak_ptr are thread-safe
 m_pImpl = g_pModuleOptions.lock();
 if( !m_pImpl )
 {
-m_pImpl = std::make_shared();
-g_pModuleOptions = m_pImpl;
-ItemHolder1::holdConfigItem(EItem::ModuleOptions);
+// take the mutex, so we don't accidentally create more than one
+::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+
+m_pImpl = g_pModuleOptions.lock();
+if( !m_pImpl )
+{
+m_pImpl = std::make_shared();
+g_pModuleOptions = m_pImpl;
+ItemHolder1::holdConfigItem(EItem::ModuleOptions);
+}
 }
 }
 
 SvtModuleOptions::~SvtModuleOptions()
 {
-// Global access, must be guarded (multithreading!)
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
-
 m_pImpl.reset();
 }
 
@@ -809,13 +811,13 @@ SvtModuleOptions::~SvtModuleOptions()
 
*//*-*/
 bool SvtModuleOptions::IsModuleInstalled( EModule eModule ) const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+// doesn't need mutex, never modified
 return m_pImpl->IsModuleInstalled( eModule );
 }
 
 OUString SvtModuleOptions::GetFactoryName( EFactory eFactory ) const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+// doesn't need mutex, never modified
 return m_pImpl->GetFactoryName( eFactory );
 }
 
@@ -873,25 +875,25 @@ void SvtModuleOptions::SetFactoryDefaultFilter(   
EFactory eFactory,
 
 bool SvtModuleOptions::IsMath() const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+// doesn't need mutex, never modified
 return m_pImpl->IsModuleInstalled( EModule::MATH );
 }
 
 bool SvtModuleOptions::IsChart() const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+// doesn't need mutex, never modified
 return m_pImpl->IsModuleInstalled( EModule::CHART );
 }
 
 bool SvtModuleOptions::IsCalc() const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+// doesn't need mutex, never modified
 return m_pImpl->IsModuleInstalled( EModule::CALC );
 }
 
 bool SvtModuleOptions::IsDraw() const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+// doesn't need mutex, never modified
 return m_pImpl->IsModuleInstalled( EModule::DRAW );
 }
 
@@ -903,13 +905,13 @@ bool SvtModuleOptions::IsWriter() const
 
 bool SvtModuleOptions::IsImpress() const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+// doesn't need mutex, never modified
 return m_pImpl->IsModuleInstalled( EModule::IMPRESS );
 }
 
 bool SvtModuleOptions::IsDataBase() const
 {
-::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
+// doesn't need mutex, never modified
 return m_pImpl->IsModuleInstalled( EModule::DATABASE );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unotools/source unotools/util

2021-03-23 Thread Noel Grandin (via logerrit)
 unotools/source/misc/ServiceDocumenter.cxx |   20 +---
 unotools/util/utl.component|3 ++-
 2 files changed, 3 insertions(+), 20 deletions(-)

New commits:
commit f4d195fdda834cb51912f97a72d3f7b8c72420ef
Author: Noel Grandin 
AuthorDate: Mon Mar 22 13:41:53 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Mar 23 09:08:03 2021 +0100

use single-use attribute for ServiceDocumenter

instead of rtl::Instance, which means it will get
cleaned up when UNO shuts down

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

diff --git a/unotools/source/misc/ServiceDocumenter.cxx 
b/unotools/source/misc/ServiceDocumenter.cxx
index 39d4ba2907e4..695272641080 100644
--- a/unotools/source/misc/ServiceDocumenter.cxx
+++ b/unotools/source/misc/ServiceDocumenter.cxx
@@ -82,27 +82,9 @@ css::uno::Sequence< OUString > 
unotools::misc::ServiceDocumenter::getSupportedSe
 }
 
 
-namespace {
-
-struct Instance {
-explicit Instance(
-css::uno::Reference const & context):
-instance(new unotools::misc::ServiceDocumenter(context))
-{}
-
-rtl::Reference instance;
-};
-
-struct Singleton:
-public rtl::StaticWithArg<
-Instance, css::uno::Reference, Singleton>
-{};
-
-}
-
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 unotools_ServiceDocument_get_implementation(
 css::uno::XComponentContext* context , css::uno::Sequence 
const&)
 {
-return cppu::acquire(Singleton::get(context).instance.get());
+return cppu::acquire(new unotools::misc::ServiceDocumenter(context));
 }
diff --git a/unotools/util/utl.component b/unotools/util/utl.component
index effef2146729..cd31d1c3e3cc 100644
--- a/unotools/util/utl.component
+++ b/unotools/util/utl.component
@@ -24,7 +24,8 @@
 
   
   
+constructor="unotools_ServiceDocument_get_implementation"
+single-instance="true">
 
   
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-03-01 Thread Stephan Bergmann (via logerrit)
 unotools/source/ucbhelper/ucblockbytes.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 2977dc5846b557bb9c7dc33ac92921f7b4096763
Author: Stephan Bergmann 
AuthorDate: Mon Mar 1 12:11:19 2021 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Mar 1 15:45:12 2021 +0100

At least warn about the missing osl::Thread::join with a TODO comment

(as is already done in other such cases, too).  This apparently randomly hit
e.g.  now,

> Program terminated with signal 11, Segmentation fault.
>
> Thread 2 (Thread 0x2b2d9ec16600 (LWP 23008)):
[...]
> #72 0x2b2d9edff4d2 in configmgr::Components::~Components() 
(this=0x2b2d9ef26e58 

 const&)::singleton>) at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/configmgr/source/components.cxx:641
> #73 0x2b2d854cdce9 in __run_exit_handlers () at /lib64/libc.so.6
> #74 0x2b2d854cdd37 in  () at /lib64/libc.so.6
> #75 0x2b2d854b655c in __libc_start_main () at /lib64/libc.so.6
> #76 0x004007a9 in _start ()
>
> Thread 1 (Thread 0x2b2db04a5700 (LWP 24092)):
> #0  0x2b2d8672a36b in pthread_rwlock_wrlock () at 
/lib64/libpthread.so.0
> #1  0x2b2db00d97d5 in CRYPTO_THREAD_write_lock (lock=0x0) at 
crypto/threads_pthread.c:78
> #2  0x2b2db00a9b69 in RAND_get_rand_method () at 
crypto/rand/rand_lib.c:847
> #3  0x2b2db00aa30d in RAND_status () at crypto/rand/rand_lib.c:956
> #4  0x2b2daff92b9d in seed_ssl_prng () at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/UnpackedTarball/neon/src/ne_socket.c:265
> #5  0x2b2daff929c9 in ne_sock_connect_ssl (sock=0x29845a0, 
ctx=0x34e6150, userdata=0x1e224e0) at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/UnpackedTarball/neon/src/ne_socket.c:1800
> #6  0x2b2daff9ac02 in ne__negotiate_ssl (sess=0x1e224e0) at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/UnpackedTarball/neon/src/ne_openssl.c:717
> #7  0x2b2daff8de68 in open_connection (sess=0x1e224e0) at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/UnpackedTarball/neon/src/ne_request.c:1716
> #8  0x2b2daff8cfd6 in send_request (req=0x351d930, request=0x2ea4460) 
at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/UnpackedTarball/neon/src/ne_request.c:1021
> #9  0x2b2daff8c698 in ne_begin_request (req=0x351d930) at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/UnpackedTarball/neon/src/ne_request.c:1255
> #10 0x2b2daff8db25 in ne_request_dispatch (req=0x351d930) at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/UnpackedTarball/neon/src/ne_request.c:1466
> #11 0x2b2dafe4921b in webdav_ucp::NeonSession::OPTIONS(rtl::OUString 
const&, webdav_ucp::DAVOptions&, webdav_ucp::DAVRequestEnvironment const&) 
(this=0x34e6390, inPath="/api/Icons.json", rOptions=..., rEnv=...) at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/ucb/source/ucp/webdav-neon/NeonSession.cxx:879
> #12 0x2b2dafe11bbc in 
webdav_ucp::DAVResourceAccess::OPTIONS(webdav_ucp::DAVOptions&, 
com::sun::star::uno::Reference 
const&) (this=0x34e7880, rOptions=..., xEnv=uno::Reference to (utl::(anonymous 
namespace)::UcbTaskEnvironment *) 0x34e8908) at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx:187
> #13 0x2b2dafe9fc28 in 
webdav_ucp::Content::getResourceOptions(com::sun::star::uno::Reference
 const&, webdav_ucp::DAVOptions&, 
std::unique_ptr > const&, bool*) 
(this=0x34e8970, xEnv=uno::Reference to (utl::(anonymous 
namespace)::UcbTaskEnvironment *) 0x34e8908, rDAVOptions=..., rResAccess=..., 
networkAccessAllowed=0x0) at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/ucb/source/ucp/webdav-neon/webdavcontent.cxx:3928
> #14 0x2b2dafe90664 in 
webdav_ucp::Content::open(com::sun::star::ucb::OpenCommandArgument3 const&, 
com::sun::star::uno::Reference 
const&) (this=0x34e8970, rArg=..., xEnv=uno::Reference to (utl::(anonymous 
namespace)::UcbTaskEnvironment *) 0x34e8908) at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/ucb/source/ucp/webdav-neon/webdavcontent.cxx:2225
> #15 0x2b2dafe87e0d in 
webdav_ucp::Content::execute(com::sun::star::ucb::Command const&, int, 
com::sun::star::uno::Reference 
const&) (this=0x34e8970, aCommand=..., Environment=uno::Reference to 
(utl::(anonymous namespace)::UcbTaskEnvironment *) 0x34e8908) at 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/ucb/source/ucp/webdav-neon/webdavcontent.cxx:553
> #16 0x2b2dafe997c1 in non-virtual thunk to 

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

2021-01-01 Thread Mike Kaganski (via logerrit)
 unotools/source/i18n/resmgr.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 02eaea1f93b516e35d4583158f87bfdd2640
Author: Mike Kaganski 
AuthorDate: Mon Dec 28 19:12:03 2020 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jan 1 17:24:32 2021 +0100

tdf#119367: use Unicode paths on Windows in unotools

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

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index a1d74ec1b7cd..ef5b83cf06bc 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -134,7 +134,14 @@ namespace Translate
 rtl::Bootstrap::expandMacros(uri);
 OUString path;
 osl::File::getSystemPathFromFileURL(uri, path);
-OString sPath(OUStringToOString(path, osl_getThreadTextEncoding()));
+#if defined _WIN32
+// add_messages_path is documented to treat path string in the 
*created* locale's encoding
+// on Windows; creating an UTF-8 encoding, we're lucky to have Unicode 
path support here.
+constexpr rtl_TextEncoding eEncoding = RTL_TEXTENCODING_UTF8;
+#else
+const rtl_TextEncoding eEncoding = osl_getThreadTextEncoding();
+#endif
+OString sPath(OUStringToOString(path, eEncoding));
 #endif
 gen.add_messages_path(sPath.getStr());
 #if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-09-25 Thread Andrea Gelmini (via logerrit)
 unotools/source/misc/fontcvt.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 094e84bcebd2fb0669e6bfccd0c589e719cbf517
Author: Andrea Gelmini 
AuthorDate: Thu Sep 24 13:02:12 2020 +0200
Commit: Andrea Gelmini 
CommitDate: Fri Sep 25 08:27:00 2020 +0200

Fix typo in code

It passed "make check" on Linux

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

diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx
index 9ea6444363d9..b4bd2c45c852 100644
--- a/unotools/source/misc/fontcvt.cxx
+++ b/unotools/source/misc/fontcvt.cxx
@@ -1180,7 +1180,7 @@ StarSymbolToMSMultiFontImpl::StarSymbolToMSMultiFontImpl()
 }
 
 //In order of preference
-static const ExtendedConvertTable aAgressiveTable[] =
+static const ExtendedConvertTable aAggressiveTable[] =
 {
 ExtendedConvertTable(Symbol, aSymbolExtraTab2,
 sizeof(aSymbolExtraTab2)),
@@ -1193,11 +1193,11 @@ 
StarSymbolToMSMultiFontImpl::StarSymbolToMSMultiFontImpl()
 };
 
  //Allow extra conversions that are not perfect, but "good enough"
-nEntries = SAL_N_ELEMENTS(aAgressiveTable);
+nEntries = SAL_N_ELEMENTS(aAggressiveTable);
 
 for (i = 0; i < nEntries; ++i)
 {
-const ExtendedConvertTable& r = aAgressiveTable[i];
+const ExtendedConvertTable& r = aAggressiveTable[i];
 SymbolEntry aEntry;
 aEntry.eFont = r.meFont;
 for (int j = r.mnSize / sizeof(r.mpTable[0]) - 1; j >=0; --j)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-09-05 Thread Stephan Bergmann (via logerrit)
 unotools/source/misc/fontdefs.cxx |  470 ++
 1 file changed, 228 insertions(+), 242 deletions(-)

New commits:
commit 085e8ebd769b430fbd7ac0614f292697d4b36103
Author: Stephan Bergmann 
AuthorDate: Sat Sep 5 21:22:21 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Sep 5 22:52:01 2020 +0200

Simplify creation of the FontNameDictionary

Some of the key sal_Unicode arrays contained embedded NUL characters, for 
which
everything after the first NUL was ignored.  But from the corresponding 
comment,
it looks like those sal_Unicode arrays were presumably meant to contain 
multiple
keys that should all map to the same "English name," which I have added now.
(The original history of this source file beyond
942dbe34b9a1400c926a81f88e849d248b58ed55 "#i103496#: move some 
fontsubstitution
stuff from vcl to unotools to get xmloff vcl free" appears to be lost,
unfortunately.  Another comment had already wondered why keys were 
terminated by
double NULs, where the second NUL maybe was originally meant to terminate 
that
sequence of individual keys all stored in a single sal_Unicode array.)

There was also another

  // TODO: check if all dictionary entries are already normalized?

in the construction of the FontNameDictionary aDictionary, of which I'm not 
sure
what it should mean exactly, and whether I should have left it in.

(This change is a prerequisite for making the OUString ctor taking a raw 
pointer
explicit.)

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

diff --git a/unotools/source/misc/fontdefs.cxx 
b/unotools/source/misc/fontdefs.cxx
index 6b8804d9e8c8..9effac2e839a 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -22,56 +22,49 @@
 #include 
 #include 
 
-namespace {
-
-struct ImplLocalizedFontName
-{
-const char* mpEnglishName;
-const sal_Unicode*  mpLocalizedNames;
-};
-
-}
-
-// TODO: where did the 0,0 delimiters come from? A single 0 should suffice...
-sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0, 0 };
-sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0, 0 };
-sal_Unicode const aGungsuh[] = { 0xAD81, 0xC11C, 0, 0 };
-sal_Unicode const aGungsuhChe[] = { 0xAD81, 0xC11C, 0xCCB4, 0, 0 };
-sal_Unicode const aGulim[] = { 0xAD74, 0xB9BC, 0, 0 };
-sal_Unicode const aGulimChe[] = { 0xAD74, 0xB9BC, 0xCCB4, 0, 0 };
-sal_Unicode const aDotum[] = { 0xB3CB, 0xC6C0, 0, 0 };
-sal_Unicode const aDotumChe[] = { 0xB3CB, 0xC6C0, 0xCCB4, 0, 0 };
-sal_Unicode const aSimSun[] = { 0x5B8B, 0x4F53, 0, 0 };
-sal_Unicode const aNSimSun[] = { 0x65B0, 0x5B8B, 0x4F53, 0, 0 };
-sal_Unicode const aSimHei[] = { 0x9ED1, 0x4F53, 0, 0 };
-sal_Unicode const aSimKai[] = { 0x6977, 0x4F53, 0, 0 };
-sal_Unicode const azycjkSun[] = { 0x4E2D, 0x6613, 0x5B8B, 0x4F53, 0, 0 };
-sal_Unicode const azycjkHei[] = { 0x4E2D, 0x6613, 0x9ED1, 0x4F53, 0, 0 };
-sal_Unicode const azycjkKai[] = { 0x4E2D, 0x6613, 0x6977, 0x4F53, 0, 0 };
-sal_Unicode const aFZHei[] = { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 };
-sal_Unicode const aFZKai[] = { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 };
-sal_Unicode const aFZSongYI[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4E00, 0, 0 };
-sal_Unicode const aFZShuSong[] = { 0x65B9, 0x6B63, 0x4E66, 0x5B8B, 0, 0 };
-sal_Unicode const aFZFangSong[] = { 0x65B9, 0x6B63, 0x4EFF, 0x5B8B, 0, 0 };
+sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0 };
+sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0 };
+sal_Unicode const aGungsuh[] = { 0xAD81, 0xC11C, 0 };
+sal_Unicode const aGungsuhChe[] = { 0xAD81, 0xC11C, 0xCCB4, 0 };
+sal_Unicode const aGulim[] = { 0xAD74, 0xB9BC, 0 };
+sal_Unicode const aGulimChe[] = { 0xAD74, 0xB9BC, 0xCCB4, 0 };
+sal_Unicode const aDotum[] = { 0xB3CB, 0xC6C0, 0 };
+sal_Unicode const aDotumChe[] = { 0xB3CB, 0xC6C0, 0xCCB4, 0 };
+sal_Unicode const aSimSun[] = { 0x5B8B, 0x4F53, 0 };
+sal_Unicode const aNSimSun[] = { 0x65B0, 0x5B8B, 0x4F53, 0 };
+sal_Unicode const aSimHei[] = { 0x9ED1, 0x4F53, 0 };
+sal_Unicode const aSimKai[] = { 0x6977, 0x4F53, 0 };
+sal_Unicode const azycjkSun[] = { 0x4E2D, 0x6613, 0x5B8B, 0x4F53, 0 };
+sal_Unicode const azycjkHei[] = { 0x4E2D, 0x6613, 0x9ED1, 0x4F53, 0 };
+sal_Unicode const azycjkKai[] = { 0x4E2D, 0x6613, 0x6977, 0x4F53, 0 };
+sal_Unicode const aFZHei[] = { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0 };
+sal_Unicode const aFZKai[] = { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0 };
+sal_Unicode const aFZSongYI[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4E00, 0 };
+sal_Unicode const aFZShuSong[] = { 0x65B9, 0x6B63, 0x4E66, 0x5B8B, 0 };
+sal_Unicode const aFZFangSong[] = { 0x65B9, 0x6B63, 0x4EFF, 0x5B8B, 0 };
 // Attention: this fonts includes the wrong encoding vector - so we double the 
names with correct and wrong encoding
 // First one is the GB-Encoding (we think the correct 

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

2020-08-19 Thread Stephan Bergmann (via logerrit)
 unotools/source/config/bootstrap.cxx |   28 ++--
 1 file changed, 10 insertions(+), 18 deletions(-)

New commits:
commit 3a5a81e74308c03b2cf774cccb78f3a102d5be72
Author: Stephan Bergmann 
AuthorDate: Wed Aug 19 15:22:34 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Aug 19 17:25:31 2020 +0200

Fold Bootstrap::Impl::getVersionValue into its single use

...thereby fixing that it returns _sDefault instead of an empty string when
"version.ini (versionrc) doesn't exist"

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

diff --git a/unotools/source/config/bootstrap.cxx 
b/unotools/source/config/bootstrap.cxx
index 24a5752d3fc1..eccf92f696ad 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -99,7 +99,6 @@ public: // construction and initialization
 
 // access helper
 OUString getBootstrapValue(OUString const& _sName, OUString const& 
_sDefault) const;
-static bool getVersionValue(OUString const& _sName, OUString& _rValue, 
OUString const& _sDefault);
 
 const OUString& getImplName() const { return m_aImplName; }
 
@@ -543,9 +542,17 @@ OUString Bootstrap::getProductKey(OUString const& 
_sDefault)
 
 OUString Bootstrap::getBuildIdData(OUString const& _sDefault)
 {
+// try to open version.ini (versionrc)
+OUString uri;
+rtl::Bootstrap::get( "BRAND_BASE_DIR", uri);
+rtl::Bootstrap aData( uri + "/" LIBO_ETC_FOLDER "/" 
SAL_CONFIGFILE("version") );
+if ( aData.getHandle() == nullptr )
+// version.ini (versionrc) doesn't exist
+return _sDefault;
+
+// read value
 OUString sBuildId;
-// read buildid from version.ini (versionrc)
-utl::Bootstrap::Impl::getVersionValue( BOOTSTRAP_ITEM_BUILDID, sBuildId, 
_sDefault );
+aData.getFrom(BOOTSTRAP_ITEM_BUILDID,sBuildId,_sDefault);
 return sBuildId;
 }
 
@@ -703,21 +710,6 @@ OUString Bootstrap::Impl::getBootstrapValue(OUString 
const& _sName, OUString con
 return sResult;
 }
 
-bool Bootstrap::Impl::getVersionValue(OUString const& _sName, OUString& 
_rValue, OUString const& _sDefault)
-{
-// try to open version.ini (versionrc)
-OUString uri;
-rtl::Bootstrap::get( "BRAND_BASE_DIR", uri);
-rtl::Bootstrap aData( uri + "/" LIBO_ETC_FOLDER "/" 
SAL_CONFIGFILE("version") );
-if ( aData.getHandle() == nullptr )
-// version.ini (versionrc) doesn't exist
-return false;
-
-// read value
-aData.getFrom(_sName,_rValue,_sDefault);
-return true;
-}
-
 } // namespace utl
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-19 Thread Stephan Bergmann (via logerrit)
 unotools/source/config/bootstrap.cxx |   11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

New commits:
commit d23e3f51c22ee36833afe5cde91b2e30adef1fe5
Author: Stephan Bergmann 
AuthorDate: Tue Aug 18 22:48:33 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Aug 19 09:37:23 2020 +0200

Drop fallback to read buildid from boostrap ini file

f9e6d8d7c33a308f6f1c15929dd839de2abae3b5 "INTEGRATION: CWS nativefixer18:
fix: #124825# read build id from version.ini" from 2005 had left the 
previous
code to read from the bootsrap ini file as a fallback, presumably intended 
for
some (short) transition period.

(Plus loplugin:elidestringvar fallout.  And fix the comment, which appears 
to
have been non-matching right from the start.)

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

diff --git a/unotools/source/config/bootstrap.cxx 
b/unotools/source/config/bootstrap.cxx
index 2aaecdd2fb86..a912ac3eb330 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -552,16 +552,9 @@ OUString Bootstrap::getBuildVersion(OUString const& 
_sDefault)
 
 OUString Bootstrap::getBuildIdData(OUString const& _sDefault)
 {
-OUString const csBuildIdItem(BOOTSTRAP_ITEM_BUILDID);
-
 OUString sBuildId;
-// read buildid from version.ini (versionrc), if it doesn't exist or 
buildid is empty
-if ( !utl::Bootstrap::Impl::getVersionValue( csBuildIdItem, sBuildId, 
_sDefault )
-|| sBuildId.isEmpty() )
-{
- // read buildid from bootstrap.ini (bootstraprc)
-sBuildId = data().getBootstrapValue( csBuildIdItem, _sDefault );
-}
+// read buildid from version.ini (versionrc)
+utl::Bootstrap::Impl::getVersionValue( BOOTSTRAP_ITEM_BUILDID, sBuildId, 
_sDefault );
 return sBuildId;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-04 Thread Noel Grandin (via logerrit)
 unotools/source/config/configitem.cxx|   22 +--
 unotools/source/config/defaultoptions.cxx|  130 +++
 unotools/source/config/fontcfg.cxx   |  124 +++---
 unotools/source/config/pathoptions.cxx   |   62 +--
 unotools/source/config/securityoptions.cxx   |   74 ++---
 unotools/source/i18n/localedatawrapper.cxx   |   50 -
 unotools/source/i18n/readwritemutexguard.cxx |   36 +++---
 unotools/source/i18n/textsearch.cxx  |  150 +--
 unotools/source/misc/mediadescriptor.cxx |   32 ++---
 unotools/source/ucbhelper/ucblockbytes.cxx   |   22 +--
 10 files changed, 351 insertions(+), 351 deletions(-)

New commits:
commit f3ff488fd4fb56f178ffbb7b3880dfafdd9d8e9c
Author: Noel Grandin 
AuthorDate: Tue Aug 4 21:29:47 2020 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 5 05:02:29 2020 +0200

loplugin:flatten in unotools

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

diff --git a/unotools/source/config/configitem.cxx 
b/unotools/source/config/configitem.cxx
index a6785079723a..60ded67dc837 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -537,19 +537,19 @@ bool ConfigItem::EnableNotification(const Sequence< 
OUString >& rNames,
 void ConfigItem::RemoveChangesListener()
 {
 Reference xHierarchyAccess = GetTree();
-if(xHierarchyAccess.is())
+if(!xHierarchyAccess.is())
+return;
+
+Reference xChgNot(xHierarchyAccess, UNO_QUERY);
+if(xChgNot.is() && xChangeLstnr.is())
 {
-Reference xChgNot(xHierarchyAccess, UNO_QUERY);
-if(xChgNot.is() && xChangeLstnr.is())
+try
+{
+xChgNot->removeChangesListener( xChangeLstnr );
+xChangeLstnr = nullptr;
+}
+catch (const Exception&)
 {
-try
-{
-xChgNot->removeChangesListener( xChangeLstnr );
-xChangeLstnr = nullptr;
-}
-catch (const Exception&)
-{
-}
 }
 }
 }
diff --git a/unotools/source/config/defaultoptions.cxx 
b/unotools/source/config/defaultoptions.cxx
index de7c5a4b4dfd..72a3cc8ba090 100644
--- a/unotools/source/config/defaultoptions.cxx
+++ b/unotools/source/config/defaultoptions.cxx
@@ -233,89 +233,89 @@ SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : 
ConfigItem( "Office.Common/Pa
 EnableNotification( aNames );
 const Any* pValues = aValues.getConstArray();
 DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties 
failed" );
-if ( aValues.getLength() == aNames.getLength() )
-{
-SvtPathOptions aPathOpt;
-OUString aTempStr;
-OUStringBuffer aFullPathBuf;
+if ( aValues.getLength() != aNames.getLength() )
+return;
+
+SvtPathOptions aPathOpt;
+OUString aTempStr;
+OUStringBuffer aFullPathBuf;
 
-for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
+for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
+{
+if ( pValues[nProp].hasValue() )
 {
-if ( pValues[nProp].hasValue() )
+switch ( pValues[nProp].getValueTypeClass() )
 {
-switch ( pValues[nProp].getValueTypeClass() )
+case css::uno::TypeClass_STRING :
 {
-case css::uno::TypeClass_STRING :
+// multi paths
+if ( pValues[nProp] >>= aTempStr )
+aFullPathBuf = aPathOpt.SubstituteVariable( aTempStr );
+else
 {
-// multi paths
-if ( pValues[nProp] >>= aTempStr )
-aFullPathBuf = aPathOpt.SubstituteVariable( 
aTempStr );
-else
-{
-SAL_WARN( "unotools.config", "any operator >>= 
failed" );
-}
-break;
+SAL_WARN( "unotools.config", "any operator >>= failed" 
);
 }
+break;
+}
 
-case css::uno::TypeClass_SEQUENCE :
+case css::uno::TypeClass_SEQUENCE :
+{
+// single paths
+aFullPathBuf.setLength(0);
+Sequence < OUString > aList;
+if ( pValues[nProp] >>= aList )
 {
-// single paths
-aFullPathBuf.setLength(0);
-Sequence < OUString > aList;
-if ( pValues[nProp] >>= aList )
+sal_Int32 nCount = aList.getLength();
+for ( sal_Int32 

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

2020-07-02 Thread Stephan Bergmann (via logerrit)
 unotools/source/config/bootstrap.cxx   |6 
 unotools/source/config/defaultoptions.cxx  |2 
 unotools/source/config/fontcfg.cxx |   18 -
 unotools/source/config/historyoptions.cxx  |   10 -
 unotools/source/config/lingucfg.cxx|4 
 unotools/source/config/pathoptions.cxx |4 
 unotools/source/i18n/localedatawrapper.cxx |4 
 unotools/source/misc/fontcvt.cxx   |   24 +-
 unotools/source/misc/fontdefs.cxx  |  280 ++---
 9 files changed, 176 insertions(+), 176 deletions(-)

New commits:
commit a7f74d5de2083ae89425502790442b7ee8a71301
Author: Stephan Bergmann 
AuthorDate: Thu Jul 2 10:47:52 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jul 2 16:31:41 2020 +0200

Upcoming improved loplugin:staticanonymous -> redundantstatic: unotools

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

diff --git a/unotools/source/config/bootstrap.cxx 
b/unotools/source/config/bootstrap.cxx
index 5228fb466682..2aaecdd2fb86 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -405,9 +405,9 @@ static Bootstrap::PathStatus 
implGetVersionFile(rtl::Bootstrap const & _rData, B
 
 // Error reporting
 
-static char const IS_MISSING[] = "is missing";
-static char const IS_INVALID[] = "is corrupt";
-static char const PERIOD[] = ". ";
+char const IS_MISSING[] = "is missing";
+char const IS_INVALID[] = "is corrupt";
+char const PERIOD[] = ". ";
 
 static void addFileError(OUStringBuffer& _rBuf, OUString const& _aPath, 
AsciiString _sWhat)
 {
diff --git a/unotools/source/config/defaultoptions.cxx 
b/unotools/source/config/defaultoptions.cxx
index 80a597abcdbf..de7c5a4b4dfd 100644
--- a/unotools/source/config/defaultoptions.cxx
+++ b/unotools/source/config/defaultoptions.cxx
@@ -120,7 +120,7 @@ struct PathToDefaultMapping_Impl
 
 }
 
-static PathToDefaultMapping_Impl const PathMap_Impl[] =
+PathToDefaultMapping_Impl const PathMap_Impl[] =
 {
 { SvtPathOptions::PATH_ADDIN,   
_Impl::m_aAddinPath },
 { SvtPathOptions::PATH_AUTOCORRECT, 
_Impl::m_aAutoCorrectPath },
diff --git a/unotools/source/config/fontcfg.cxx 
b/unotools/source/config/fontcfg.cxx
index 8cc694bbb59c..9025562f89c0 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -368,7 +368,7 @@ FontSubstConfiguration::~FontSubstConfiguration()
  *  FontSubstConfigItem::getMapName
  */
 
-static const char* const aImplKillLeadingList[] =
+const char* const aImplKillLeadingList[] =
 {
 "microsoft",
 "monotype",
@@ -391,7 +391,7 @@ static const char* const aImplKillLeadingList[] =
 nullptr
 };
 
-static const char* const aImplKillTrailingList[] =
+const char* const aImplKillTrailingList[] =
 {
 "microsoft",
 "monotype",
@@ -441,7 +441,7 @@ static const char* const aImplKillTrailingList[] =
 nullptr
 };
 
-static const char* const aImplKillTrailingWithExceptionsList[] =
+const char* const aImplKillTrailingWithExceptionsList[] =
 {
 "ce", "monospace", "oldface", nullptr,
 "ps", "caps", nullptr,
@@ -458,7 +458,7 @@ struct ImplFontAttrWeightSearchData
 
 }
 
-static ImplFontAttrWeightSearchData const aImplWeightAttrSearchList[] =
+ImplFontAttrWeightSearchData const aImplWeightAttrSearchList[] =
 {
 // the attribute names are ordered by "first match wins"
 // e.g. "semilight" should wins over "semi"
@@ -488,7 +488,7 @@ struct ImplFontAttrWidthSearchData
 
 }
 
-static ImplFontAttrWidthSearchData const aImplWidthAttrSearchList[] =
+ImplFontAttrWidthSearchData const aImplWidthAttrSearchList[] =
 {
 {   "narrow",   WIDTH_CONDENSED },
 {   "semicondensed",WIDTH_SEMI_CONDENSED },
@@ -513,7 +513,7 @@ struct ImplFontAttrTypeSearchData
 
 }
 
-static ImplFontAttrTypeSearchData const aImplTypeAttrSearchList[] =
+ImplFontAttrTypeSearchData const aImplTypeAttrSearchList[] =
 {
 {   "monotype", ImplFontAttrs::None },
 {   "linotype", ImplFontAttrs::None },
@@ -758,7 +758,7 @@ struct StrictStringSort
 
 // The entries in this table must match the bits in the ImplFontAttrs enum.
 
-static const char* const pAttribNames[] =
+const char* const pAttribNames[] =
 {
 "default",
 "standard",
@@ -804,7 +804,7 @@ struct enum_convert
 
 }
 
-static const enum_convert pWeightNames[] =
+const enum_convert pWeightNames[] =
 {
 { "normal", WEIGHT_NORMAL },
 { "medium", WEIGHT_MEDIUM },
@@ -822,7 +822,7 @@ static const enum_convert pWeightNames[] =
 { "ultralight", WEIGHT_ULTRALIGHT }
 };
 
-static const enum_convert pWidthNames[] =
+const enum_convert pWidthNames[] =
 {
 { "normal", WIDTH_NORMAL },
 { "condensed", WIDTH_CONDENSED },
diff --git a/unotools/source/config/historyoptions.cxx 
b/unotools/source/config/historyoptions.cxx
index 986e39898d6c..d200aa833982 100644
--- 

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

2020-06-05 Thread Stephan Bergmann (via logerrit)
 unotools/source/config/bootstrap.cxx |   28 +++-
 1 file changed, 7 insertions(+), 21 deletions(-)

New commits:
commit fd6f0ad3d522a1ab37e6b4659346d4a73db178f8
Author: Stephan Bergmann 
AuthorDate: Fri Jun 5 12:56:05 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 5 15:11:25 2020 +0200

Upcoming loplugin:elidestringvar: unotools

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

diff --git a/unotools/source/config/bootstrap.cxx 
b/unotools/source/config/bootstrap.cxx
index 459d8e518945..5228fb466682 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -532,27 +532,21 @@ static Bootstrap::FailureCode 
describeError(OUStringBuffer& _rBuf, Bootstrap::Im
 
 OUString Bootstrap::getProductKey()
 {
-OUString const csProductKeyItem(BOOTSTRAP_ITEM_PRODUCT_KEY);
-
 OUString const sDefaultProductKey = getExecutableBaseName();
 
-return data().getBootstrapValue( csProductKeyItem, sDefaultProductKey );
+return data().getBootstrapValue( BOOTSTRAP_ITEM_PRODUCT_KEY, 
sDefaultProductKey );
 }
 
 OUString Bootstrap::getProductKey(OUString const& _sDefault)
 {
-OUString const csProductKeyItem(BOOTSTRAP_ITEM_PRODUCT_KEY);
-
-return data().getBootstrapValue( csProductKeyItem, _sDefault );
+return data().getBootstrapValue( BOOTSTRAP_ITEM_PRODUCT_KEY, _sDefault );
 }
 
 OUString Bootstrap::getBuildVersion(OUString const& _sDefault)
 {
-OUString const csBuildVersionItem(BOOTSTRAP_ITEM_BUILDVERSION);
-
 OUString sBuildVersion;
 // read BuildVersion from version.ini (versionrc)
-utl::Bootstrap::Impl::getVersionValue( csBuildVersionItem, sBuildVersion, 
_sDefault );
+utl::Bootstrap::Impl::getVersionValue( BOOTSTRAP_ITEM_BUILDVERSION, 
sBuildVersion, _sDefault );
 return sBuildVersion;
 }
 
@@ -599,8 +593,7 @@ Bootstrap::PathStatus Bootstrap::locateUserData(OUString& 
_rURL)
 }
 else
 {
-OUString const csUserDir(BOOTSTRAP_DIRNAME_USERDIR);
-return getDerivedPath(_rURL, data().aUserInstall_ ,csUserDir, aData, 
csUserDirItem);
+return getDerivedPath(_rURL, data().aUserInstall_ 
,BOOTSTRAP_DIRNAME_USERDIR, aData, csUserDirItem);
 }
 }
 
@@ -643,10 +636,7 @@ Bootstrap::Status 
Bootstrap::checkBootstrapStatus(OUString& _rDiagnosticMessage,
 
 bool Bootstrap::Impl::initBaseInstallationData(rtl::Bootstrap const & _rData)
 {
-OUString const csBaseInstallItem( BOOTSTRAP_ITEM_BASEINSTALLATION );
-OUString const csBaseInstallDefault( BOOTSTRAP_DEFAULT_BASEINSTALL );
-
-_rData.getFrom(csBaseInstallItem, aBaseInstall_.path, 
csBaseInstallDefault);
+_rData.getFrom(BOOTSTRAP_ITEM_BASEINSTALLATION, aBaseInstall_.path, 
BOOTSTRAP_DEFAULT_BASEINSTALL);
 
 bool bResult = (PATH_EXISTS == updateStatus(aBaseInstall_));
 
@@ -657,9 +647,7 @@ bool 
Bootstrap::Impl::initBaseInstallationData(rtl::Bootstrap const & _rData)
 
 bool Bootstrap::Impl::initUserInstallationData(rtl::Bootstrap const & _rData)
 {
-OUString const csUserInstallItem( BOOTSTRAP_ITEM_USERINSTALLATION );
-
-if (_rData.getFrom(csUserInstallItem, aUserInstall_.path))
+if (_rData.getFrom(BOOTSTRAP_ITEM_USERINSTALLATION, aUserInstall_.path))
 {
 updateStatus(aUserInstall_);
 }
@@ -674,9 +662,7 @@ bool 
Bootstrap::Impl::initUserInstallationData(rtl::Bootstrap const & _rData)
 // look for $BASEINSTALLATION/user only if default UserDir setting is 
used
 if (! _rData.getFrom(csUserDirItem, sDummy))
 {
-OUString const csUserDir(BOOTSTRAP_DIRNAME_USERDIR);
-
-if ( PATH_EXISTS == getDerivedPath(sDummy, aBaseInstall_, 
csUserDir, _rData, csUserDirItem) )
+if ( PATH_EXISTS == getDerivedPath(sDummy, aBaseInstall_, 
BOOTSTRAP_DIRNAME_USERDIR, _rData, csUserDirItem) )
 aUserInstall_ = aBaseInstall_;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-06-01 Thread Caolán McNamara (via logerrit)
 unotools/source/misc/mediadescriptor.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 31db2a1c9e1597e7ab7d9b3505b99e2b08a53d9d
Author: Caolán McNamara 
AuthorDate: Mon Jun 1 10:34:46 2020 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jun 1 19:47:49 2020 +0200

ofz#22822 use TOOLS_WARN_EXCEPTION

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

diff --git a/unotools/source/misc/mediadescriptor.cxx 
b/unotools/source/misc/mediadescriptor.cxx
index 7f8f4e3c3785..e522b54ee83f 100644
--- a/unotools/source/misc/mediadescriptor.cxx
+++ b/unotools/source/misc/mediadescriptor.cxx
@@ -526,7 +526,7 @@ bool MediaDescriptor::impl_addInputStream( bool bLockFile )
 }
 catch(const css::uno::Exception&)
 {
-DBG_UNHANDLED_EXCEPTION("unotools.misc", "invalid MediaDescriptor 
detected");
+TOOLS_WARN_EXCEPTION("unotools.misc", "invalid MediaDescriptor 
detected");
 return false;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-04-21 Thread Tor Lillqvist (via logerrit)
 unotools/source/ucbhelper/tempfile.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 3855d070f1b05dcc6b7ec197f5111e99ad201d38
Author: Tor Lillqvist 
AuthorDate: Tue Apr 21 19:04:48 2020 +0300
Commit: Tor Lillqvist 
CommitDate: Tue Apr 21 19:07:12 2020 +0300

Fix warning when compiling for iOS: unused parameter 'bCreateParentDirs'

Change-Id: I3d27837ea49ad964a40f53083d90f2a287bae8a0

diff --git a/unotools/source/ucbhelper/tempfile.cxx 
b/unotools/source/ucbhelper/tempfile.cxx
index d6580755c9c9..d8f406b7ae05 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -138,6 +138,7 @@ static OUString ConstructTempDir_Impl( const OUString* 
pParent, bool bCreatePare
 }
 #else
 (void) pParent;
+(void) bCreateParentDirs;
 #endif
 
 if ( aName.isEmpty() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-03-18 Thread Caolán McNamara (via logerrit)
 unotools/source/i18n/resmgr.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 49d1325ecbcbad32abd4cc55d946a720f99801f4
Author: Caolán McNamara 
AuthorDate: Tue Mar 17 20:14:17 2020 +
Commit: Caolán McNamara 
CommitDate: Wed Mar 18 12:40:43 2020 +0100

tdf#131069 always produce utf-8 from gettext

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

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index df5283d71292..a1d74ec1b7cd 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -138,7 +138,10 @@ namespace Translate
 #endif
 gen.add_messages_path(sPath.getStr());
 #if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID
+// allow gettext to find these .mo files e.g. so gtk dialogs can use 
them
 bindtextdomain(pPrefixName, sPath.getStr());
+// tdf#131069 gtk, and anything sane, always wants utf-8 strings as 
output
+bind_textdomain_codeset(pPrefixName, "UTF-8");
 #endif
 gen.add_messages_domain(pPrefixName);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-27 Thread AlanTang (via logerrit)
 unotools/source/ucbhelper/xtempfile.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit da7617641b5d955610ae25bda65fa10c4ca1b7c3
Author: AlanTang 
AuthorDate: Tue Feb 25 17:39:29 2020 +0800
Commit: Michael Stahl 
CommitDate: Thu Feb 27 11:04:30 2020 +0100

tdf#42982 added description on RuntimeException for unotools

Change-Id: I528d0bd7408ab9761de2d6fe8e60a5a521dda4dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89414
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/unotools/source/ucbhelper/xtempfile.cxx 
b/unotools/source/ucbhelper/xtempfile.cxx
index 0bd03b6b052f..fe47394d96fa 100644
--- a/unotools/source/ucbhelper/xtempfile.cxx
+++ b/unotools/source/ucbhelper/xtempfile.cxx
@@ -65,7 +65,7 @@ sal_Bool SAL_CALL OTempFileService::getRemoveFile()
 if ( !mpTempFile )
 {
 // the stream is already disconnected
-throw css::uno::RuntimeException();
+throw css::uno::RuntimeException("Not connected to a file.");
 }
 
 return mbRemoveFile;
@@ -77,7 +77,7 @@ void SAL_CALL OTempFileService::setRemoveFile( sal_Bool 
_removefile )
 if ( !mpTempFile )
 {
 // the stream is already disconnected
-throw css::uno::RuntimeException();
+throw css::uno::RuntimeException("Not connected to a file.");
 }
 
 mbRemoveFile = _removefile;
@@ -89,7 +89,7 @@ OUString SAL_CALL OTempFileService::getUri()
 
 if ( !mpTempFile )
 {
-throw css::uno::RuntimeException();
+throw css::uno::RuntimeException("Not connected to a file.");
 }
 
 return mpTempFile->GetURL();
@@ -101,7 +101,7 @@ OUString SAL_CALL OTempFileService::getResourceName()
 
 if ( !mpTempFile )
 {
-throw css::uno::RuntimeException();
+throw css::uno::RuntimeException("Not connected to a file.");
 }
 
 return mpTempFile->GetFileName();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-01 Thread Jan Holesovsky (via logerrit)
 unotools/source/i18n/resmgr.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit beb758215b898dcb2605c4d5bebbd736aa1e493d
Author: Jan Holesovsky 
AuthorDate: Wed Dec 18 23:07:11 2019 +0100
Commit: Michael Meeks 
CommitDate: Wed Jan 1 23:43:24 2020 +0100

android: Use correct path for the .mo resource files.

They are read by boost::locale, so we cannot have them as normal assets,
instead we have to have them in asset's 'unpack', so that they are
unpacked to the filesystem and can be read as normal files.

Change-Id: I5e902ee4b5294d1f693f51993b8bc2069f1c835a
Reviewed-on: https://gerrit.libreoffice.org/85442
Reviewed-by: Michael Meeks 
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85458
Tested-by: Michael Meeks 

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index 4e899aa9ea26..df5283d71292 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -51,6 +51,10 @@
 #include 
 #include 
 
+#ifdef ANDROID
+#include 
+#endif
+
 #if defined(_WIN32) && defined(DBG_UTIL)
 #include 
 #include 
@@ -123,11 +127,15 @@ namespace Translate
 boost::locale::generator gen;
 gen.characters(boost::locale::char_facet);
 gen.categories(boost::locale::message_facet | 
boost::locale::information_facet);
+#if defined(ANDROID)
+OString sPath(OString(lo_get_app_data_dir()) + "/program/resource");
+#else
 OUString uri("$BRAND_BASE_DIR/$BRAND_SHARE_RESOURCE_SUBDIR/");
 rtl::Bootstrap::expandMacros(uri);
 OUString path;
 osl::File::getSystemPathFromFileURL(uri, path);
 OString sPath(OUStringToOString(path, osl_getThreadTextEncoding()));
+#endif
 gen.add_messages_path(sPath.getStr());
 #if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID
 bindtextdomain(pPrefixName, sPath.getStr());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-08-08 Thread Stephan Bergmann (via logerrit)
 unotools/source/misc/ServiceDocumenter.cxx |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 303551ba27e069c26e930fa932637395ab57e6e2
Author: Stephan Bergmann 
AuthorDate: Wed Aug 7 16:16:21 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Aug 8 08:44:23 2019 +0200

Mark some SystemShellExecute::execute calls as URIS_ONLY

...as they are obviously meant to display remote HTML content in a browser.

Code can be triggered with a Basic snippet like

  doc = 
CreateUnoService("com.sun.star.comp.unotools.misc.ServiceDocumenter")
  doc.showInterfaceDocs(doc)

Change-Id: I4c3192bd5f6cf9bf772f57e80d99eaab78e7e9ed
Reviewed-on: https://gerrit.libreoffice.org/77114
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/unotools/source/misc/ServiceDocumenter.cxx 
b/unotools/source/misc/ServiceDocumenter.cxx
index a9ede33b4ffe..b29848e5b25e 100644
--- a/unotools/source/misc/ServiceDocumenter.cxx
+++ b/unotools/source/misc/ServiceDocumenter.cxx
@@ -9,6 +9,7 @@
 #include "ServiceDocumenter.hxx"
 #include 
 #include 
+#include 
 #include 
 using namespace com::sun::star;
 using uno::Reference;
@@ -21,7 +22,9 @@ void unotools::misc::ServiceDocumenter::showCoreDocs(const 
ReferencegetServiceManager());
 Reference 
xShell(xMSF->createInstanceWithContext("com.sun.star.system.SystemShellExecute",
 m_xContext), uno::UNO_QUERY);
-xShell->execute(m_sCoreBaseUrl + xService->getImplementationName() + 
".html", "", 0);
+xShell->execute(
+m_sCoreBaseUrl + xService->getImplementationName() + ".html", "",
+css::system::SystemShellExecuteFlags::URIS_ONLY);
 }
 
 void unotools::misc::ServiceDocumenter::showInterfaceDocs(const 
Reference& xTypeProvider)
@@ -36,7 +39,9 @@ void 
unotools::misc::ServiceDocumenter::showInterfaceDocs(const Referenceexecute(m_sServiceBaseUrl + "/interface" + sUrl + ".html", "", 
0);
+xShell->execute(
+m_sServiceBaseUrl + "/interface" + sUrl + ".html", "",
+css::system::SystemShellExecuteFlags::URIS_ONLY);
 }
 }
 
@@ -52,7 +57,9 @@ void unotools::misc::ServiceDocumenter::showServiceDocs(const 
Referenceexecute(m_sServiceBaseUrl + "/service" + sUrl + ".html", "", 
0);
+xShell->execute(
+m_sServiceBaseUrl + "/service" + sUrl + ".html", "",
+css::system::SystemShellExecuteFlags::URIS_ONLY);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-07-29 Thread Andrea Gelmini (via logerrit)
 unotools/source/config/configitem.cxx  |2 +-
 unotools/source/config/confignode.cxx  |2 +-
 unotools/source/config/moduleoptions.cxx   |   10 +-
 unotools/source/config/pathoptions.cxx |4 ++--
 unotools/source/misc/fontcvt.cxx   |4 ++--
 vbahelper/source/msforms/vbacontrol.cxx|4 ++--
 vbahelper/source/vbahelper/vbashape.cxx|2 +-
 vbahelper/source/vbahelper/vbatextframe.cxx|2 +-
 winaccessibility/source/UAccCOM/MAccessible.cxx|2 +-
 winaccessibility/source/UAccCOM/MAccessible.h  |4 ++--
 winaccessibility/source/service/AccDialogEventListener.cxx |2 +-
 winaccessibility/source/service/AccFrameEventListener.cxx  |2 +-
 winaccessibility/source/service/AccWindowEventListener.cxx |2 +-
 13 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit c87cf4e76f0cf032a37078fe185adc9b1ca14e06
Author: Andrea Gelmini 
AuthorDate: Mon Jul 29 09:31:26 2019 +0200
Commit: Julien Nabet 
CommitDate: Mon Jul 29 11:15:42 2019 +0200

Fix typos

Change-Id: Iec31617554fae0f6c5a3d795a917ce9096d84405
Reviewed-on: https://gerrit.libreoffice.org/76521
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/unotools/source/config/configitem.cxx 
b/unotools/source/config/configitem.cxx
index 13928a4891fe..ac801fc8df60 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -434,7 +434,7 @@ bool ConfigItem::PutProperties( const Sequence< OUString >& 
rNames,
 if(( m_nMode & ConfigItemMode::AllLocales ) == 
ConfigItemMode::AllLocales )
 {
 // If ConfigItem works in "ALL_LOCALES"-mode ... we must support a 
Sequence< PropertyValue >
-// as value of an localized configuration entry!
+// as value of a localized configuration entry!
 // How we can do that?
 // We must split all PropertyValues to "Sequence< OUString >" AND 
"Sequence< Any >"!
 impl_unpackLocalizedProperties( rNames, rValues, lNames, lValues );
diff --git a/unotools/source/config/confignode.cxx 
b/unotools/source/config/confignode.cxx
index bb5760ccfbbd..286cbb671215 100644
--- a/unotools/source/config/confignode.cxx
+++ b/unotools/source/config/confignode.cxx
@@ -377,7 +377,7 @@ namespace utl
 bResult = true;
 }
 
-// check if the name refers to a indirect descendant
+// check if the name refers to an indirect descendant
 else if (m_xHierarchyAccess.is() && 
m_xHierarchyAccess->hasByHierarchicalName(_rPath))
 {
 OSL_ASSERT(!_rPath.isEmpty());
diff --git a/unotools/source/config/moduleoptions.cxx 
b/unotools/source/config/moduleoptions.cxx
index b877c0b90d27..0b4e86f8dad8 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -40,10 +40,10 @@
 
/*-
 @descr  These values are used to define necessary keys from our 
configuration management to support
 all functionality of these implementation.
-It's a fast way to make changes if some keys change his 
name or location!
+It's a fast way to make changes if some keys change its 
name or location!
 
 Property handle are necessary to specify right position in 
return list of configuration
-for asked values. We ask it with a list of properties to 
get his values. The returned list
+for asked values. We ask it with a list of properties to 
get its values. The returned list
 has the same order like our given name list!
 e.g.:
 NAMELIST[ PROPERTYHANDLE_xxx ] => VALUELIST[ 
PROPERTYHANDLE_xxx ]
@@ -359,7 +359,7 @@ void SvtModuleOptions_Impl::ImplCommit()
 }
 // Resize commit list to real size.
 // If nothing to do - suppress calling of configuration ...
-// It could be to expensive :-)
+// It could be too expensive :-)
 if( nRealCount > 0 )
 {
 lCommitProperties.realloc( nRealCount );
@@ -572,7 +572,7 @@ css::uno::Sequence< OUString > 
SvtModuleOptions_Impl::impl_ExpandSetNames( const
 
 
/*-
 @short  helper to classify given factory by name
-@descr  Every factory has his own long and short name. So we can match 
right enum value for internal using.
+@descr  Every factory has its own long and short name. So we can match 
right enum value for internal using.
 
 @attention  We change in/out 

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

2019-07-11 Thread Tamás Zolnai (via logerrit)
 unotools/source/config/configitem.cxx |   20 
 1 file changed, 12 insertions(+), 8 deletions(-)

New commits:
commit 4e257f0f8b62138ead3913f43350b7012799bcaa
Author: Tamás Zolnai 
AuthorDate: Wed Jul 3 14:51:35 2019 +0200
Commit: Tamás Zolnai 
CommitDate: Thu Jul 11 17:59:08 2019 +0200

ConfigItem: use getTree also inside the RemoveChangesListener() method

This is the only method which accesses the m_xHierarchyAccess member
directly (except getTree() method). All other methods are using
getTree() to access it.
This direct member usage might be a problem when the code is run in
fuzzing mode or the constructor is called with ReleaseTree mode.

Change-Id: I7b5b91e63ac81d76028a098296fa306f154de53d
Reviewed-on: https://gerrit.libreoffice.org/75042
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai 

diff --git a/unotools/source/config/configitem.cxx 
b/unotools/source/config/configitem.cxx
index 4af2eb3bc977..36cc9b68ed6a 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -532,16 +532,20 @@ bool ConfigItem::EnableNotification(const Sequence< 
OUString >& rNames,
 
 void ConfigItem::RemoveChangesListener()
 {
-Reference xChgNot(m_xHierarchyAccess, UNO_QUERY);
-if(xChgNot.is() && xChangeLstnr.is())
+Reference xHierarchyAccess = GetTree();
+if(xHierarchyAccess.is())
 {
-try
-{
-xChgNot->removeChangesListener( xChangeLstnr );
-xChangeLstnr = nullptr;
-}
-catch (const Exception&)
+Reference xChgNot(xHierarchyAccess, UNO_QUERY);
+if(xChgNot.is() && xChangeLstnr.is())
 {
+try
+{
+xChgNot->removeChangesListener( xChangeLstnr );
+xChangeLstnr = nullptr;
+}
+catch (const Exception&)
+{
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-06-28 Thread Arkadiy Illarionov (via logerrit)
 unotools/source/config/cmdoptions.cxx |8 -
 unotools/source/config/compatibility.cxx  |   10 -
 unotools/source/config/configitem.cxx |  125 +++---
 unotools/source/config/confignode.cxx |5 
 unotools/source/config/dynamicmenuoptions.cxx |3 
 unotools/source/config/eventcfg.cxx   |   17 +-
 unotools/source/config/fontcfg.cxx|   25 +---
 unotools/source/config/historyoptions.cxx |9 -
 unotools/source/config/lingucfg.cxx   |   21 +--
 unotools/source/config/moduleoptions.cxx  |   54 +++--
 unotools/source/config/optionsdlg.cxx |   14 --
 unotools/source/config/pathoptions.cxx|3 
 unotools/source/config/securityoptions.cxx|   24 +---
 unotools/source/config/viewoptions.cxx|   21 +--
 unotools/source/i18n/localedatawrapper.cxx|   90 +--
 unotools/source/ucbhelper/progresshandlerwrap.cxx |8 -
 unotools/source/ucbhelper/ucbhelper.cxx   |8 -
 unotools/source/ucbhelper/ucblockbytes.cxx|9 -
 18 files changed, 172 insertions(+), 282 deletions(-)

New commits:
commit 1e084caf573255a93ce86053d584976f317074df
Author: Arkadiy Illarionov 
AuthorDate: Thu Jun 27 23:29:01 2019 +0300
Commit: Arkadiy Illarionov 
CommitDate: Fri Jun 28 17:33:40 2019 +0200

Simplify Sequence iterations in unotools

Use range-based loops or replace with STL functions

Change-Id: I220c5cd5dcc19fc35e1ad729ae69246f4a79ce2d
Reviewed-on: https://gerrit.libreoffice.org/74825
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov 

diff --git a/unotools/source/config/cmdoptions.cxx 
b/unotools/source/config/cmdoptions.cxx
index 2c8f18e76aea..56b61ad2704a 100644
--- a/unotools/source/config/cmdoptions.cxx
+++ b/unotools/source/config/cmdoptions.cxx
@@ -277,11 +277,9 @@ Sequence< OUString > 
SvtCommandOptions_Impl::impl_GetPropertyNames()
 Sequence< OUString > lDisabledItems  = GetNodeNames( SETNODE_DISABLED, 
utl::ConfigNameFormat::LocalPath );
 
 // Expand all keys
-for (sal_Int32 i=0; i OUString {
+return SETNODE_DISABLED PATHDELIMITER + rItem + PATHDELIMITER 
PROPERTYNAME_CMD; });
 
 // Return result.
 return lDisabledItems;
diff --git a/unotools/source/config/compatibility.cxx 
b/unotools/source/config/compatibility.cxx
index a1523d3aae41..f0d211de6957 100644
--- a/unotools/source/config/compatibility.cxx
+++ b/unotools/source/config/compatibility.cxx
@@ -159,7 +159,6 @@ 
SvtCompatibilityOptions_Impl::SvtCompatibilityOptions_Impl() : ConfigItem( ROOTN
 // See impl_GetPropertyNames() for further information.
 Sequence< OUString > lNodes;
 Sequence< OUString > lNames  = impl_GetPropertyNames( lNodes );
-sal_uInt32   nCount  = lNodes.getLength();
 Sequence< Any >  lValues = GetProperties( lNames );
 
 // Safe impossible cases.
@@ -171,11 +170,11 @@ 
SvtCompatibilityOptions_Impl::SvtCompatibilityOptions_Impl() : ConfigItem( ROOTN
 // 4 subkeys for every item!
 bool bDefaultFound = false;
 sal_Int32 nDestStep= 0;
-for ( sal_uInt32 nItem = 0; nItem < nCount; ++nItem )
+for ( const auto& rNode : lNodes )
 {
 SvtCompatibilityEntry aItem;
 
-aItem.setValue( SvtCompatibilityEntry::Index::Name, lNodes[ 
nItem ] );
+aItem.setValue( SvtCompatibilityEntry::Index::Name, rNode );
 
 for ( int i = static_cast(SvtCompatibilityEntry::Index::Module); 
i < static_cast(SvtCompatibilityEntry::Index::INVALID); ++i )
 {
@@ -292,14 +291,13 @@ Sequence< OUString > 
SvtCompatibilityOptions_Impl::impl_GetPropertyNames( Sequen
 // expand list to result list ...
 Sequence< OUString > lProperties( rItems.getLength() * ( 
SvtCompatibilityEntry::getElementCount() - 1 ) );
 
-sal_Int32 nSourceCount = rItems.getLength();
 sal_Int32 nDestStep= 0;
 // Copy entries to destination and expand every item with 2 supported sub 
properties.
-for ( sal_Int32 nSourceStep = 0; nSourceStep < nSourceCount; ++nSourceStep 
)
+for ( const auto& rItem : rItems )
 {
 OUString sFixPath = SETNODE_ALLFILEFORMATS;
 sFixPath += PATHDELIMITER;
-sFixPath += rItems[ nSourceStep ];
+sFixPath += rItem;
 sFixPath += PATHDELIMITER;
 for ( int i = static_cast(SvtCompatibilityEntry::Index::Module); 
i < static_cast(SvtCompatibilityEntry::Index::INVALID); ++i )
 {
diff --git a/unotools/source/config/configitem.cxx 
b/unotools/source/config/configitem.cxx
index 6f5e99940703..4af2eb3bc977 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -98,34 +99,21 @@ ConfigChangeListener_Impl::ConfigChangeListener_Impl(
 {
 }
 
-static bool lcl_Find(
-const OUString& rTemp,
-

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

2019-06-24 Thread Arkadiy Illarionov (via logerrit)
 unotools/source/accessibility/accessiblestatesethelper.cxx |   12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

New commits:
commit 78e2faad8487bea76bd36004a9acc2491b7a72d8
Author: Arkadiy Illarionov 
AuthorDate: Sun Jun 23 19:24:40 2019 +0300
Commit: Noel Grandin 
CommitDate: Mon Jun 24 09:05:40 2019 +0200

Fix AccessibleStateSetHelper::containsAll

Check if all states of the given state set are members
of this object's state set.
Previously it checked only last state.

Change-Id: I79ffe54a5783aa1c3574bd099d2ea4bdc49a5c2d
Reviewed-on: https://gerrit.libreoffice.org/74608
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unotools/source/accessibility/accessiblestatesethelper.cxx 
b/unotools/source/accessibility/accessiblestatesethelper.cxx
index fc867063c82d..9a180a4677ad 100644
--- a/unotools/source/accessibility/accessiblestatesethelper.cxx
+++ b/unotools/source/accessibility/accessiblestatesethelper.cxx
@@ -188,16 +188,8 @@ sal_Bool SAL_CALL AccessibleStateSetHelper::containsAll
 (const uno::Sequence& rStateSet)
 {
 osl::MutexGuard aGuard (maMutex);
-sal_Int32 nCount(rStateSet.getLength());
-const sal_Int16* pStates = rStateSet.getConstArray();
-sal_Int32 i = 0;
-bool bFound(true);
-while (i < nCount)
-{
-bFound = mpHelperImpl->Contains(pStates[i]);
-i++;
-}
-return bFound;
+return std::all_of(rStateSet.begin(), rStateSet.end(),
+[this](const sal_Int16 nState) { return 
mpHelperImpl->Contains(nState); });
 }
 
 uno::Sequence SAL_CALL AccessibleStateSetHelper::getStates()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-05-23 Thread Stephan Bergmann (via logerrit)
 unotools/source/config/configmgr.cxx |   52 ++-
 1 file changed, 10 insertions(+), 42 deletions(-)

New commits:
commit c2950d74b1a641ae45171143b5ea2b8acd4b0169
Author: Stephan Bergmann 
AuthorDate: Thu May 23 13:44:10 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Thu May 23 17:20:32 2019 +0200

Make utl::ConfigManager::get* use direct C++ config access internally

But some of those functions' names may be more telling than their 
configuration
property counterparts, so there may be merit in keeping those trivial 
wrapper
functions around.

Change-Id: Ibbf4965fcefd58649920fad964b4a8d2108deaca
Reviewed-on: https://gerrit.libreoffice.org/72836
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/unotools/source/config/configmgr.cxx 
b/unotools/source/config/configmgr.cxx
index 05b1e5874643..610246295d55 100644
--- a/unotools/source/config/configmgr.cxx
+++ b/unotools/source/config/configmgr.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -66,21 +67,6 @@ getConfigurationProvider() {
 return css::configuration::theDefaultProvider::get( 
comphelper::getProcessComponentContext() );
 }
 
-OUString getConfigurationString(OUString const & module, OUString const & path)
-{
-css::uno::Sequence< css::uno::Any > args(1);
-args[0] <<= css::beans::NamedValue(
-"nodepath",
-css::uno::makeAny(module));
-return
-css::uno::Reference< css::container::XHierarchicalNameAccess >(
-getConfigurationProvider()->createInstanceWithArguments(
-"com.sun.star.configuration.ConfigurationAccess",
-args),
-css::uno::UNO_QUERY_THROW)->
-getByHierarchicalName(path).get< OUString >();
-}
-
 struct theConfigManager:
 public rtl::Static< utl::ConfigManager, theConfigManager >
 {};
@@ -88,57 +74,39 @@ struct theConfigManager:
 }
 
 OUString utl::ConfigManager::getAboutBoxProductVersion() {
-return getConfigurationString(
-"/org.openoffice.Setup",
-"Product/ooSetupVersionAboutBox");
+return officecfg::Setup::Product::ooSetupVersionAboutBox::get();
 }
 
 OUString utl::ConfigManager::getAboutBoxProductVersionSuffix() {
-return getConfigurationString(
-"/org.openoffice.Setup",
-"Product/ooSetupVersionAboutBoxSuffix");
+return officecfg::Setup::Product::ooSetupVersionAboutBoxSuffix::get();
 }
 
 OUString utl::ConfigManager::getDefaultCurrency() {
-return getConfigurationString(
-"/org.openoffice.Setup",
-"L10N/ooSetupCurrency");
+return officecfg::Setup::L10N::ooSetupCurrency::get();
 }
 
 OUString utl::ConfigManager::getUILocale() {
-return getConfigurationString(
-"/org.openoffice.Setup",
-"L10N/ooLocale");
+return officecfg::Setup::L10N::ooLocale::get();
 }
 
 OUString utl::ConfigManager::getWorkLocale() {
-return getConfigurationString(
-"/org.openoffice.Setup",
-"L10N/ooSetupSystemLocale");
+return officecfg::Setup::L10N::ooSetupSystemLocale::get();
 }
 
 OUString utl::ConfigManager::getProductExtension() {
-return getConfigurationString(
-"/org.openoffice.Setup",
-"Product/ooSetupExtension");
+return officecfg::Setup::Product::ooSetupExtension::get();
 }
 
 OUString utl::ConfigManager::getProductName() {
-return getConfigurationString(
-"/org.openoffice.Setup",
-"Product/ooName");
+return officecfg::Setup::Product::ooName::get();
 }
 
 OUString utl::ConfigManager::getProductVersion() {
-return getConfigurationString(
-"/org.openoffice.Setup",
-"Product/ooSetupVersion");
+return officecfg::Setup::Product::ooSetupVersion::get();
 }
 
 OUString utl::ConfigManager::getVendor() {
-return getConfigurationString(
-"/org.openoffice.Setup",
-"Product/ooVendor");
+return officecfg::Setup::Product::ooVendor::get();
 }
 
 void utl::ConfigManager::storeConfigItems() {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-02-21 Thread Libreoffice Gerrit user
 unotools/source/config/defaultoptions.cxx  |3 -
 unotools/source/config/moduleoptions.cxx   |   15 -
 unotools/source/ucbhelper/ucblockbytes.cxx |   45 +
 unotools/source/ucbhelper/ucblockbytes.hxx |7 
 4 files changed, 3 insertions(+), 67 deletions(-)

New commits:
commit 10134a2f8b604c934676e9e622d8123862a0b941
Author: Noel Grandin 
AuthorDate: Thu Feb 21 16:00:28 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Feb 22 07:39:19 2019 +0100

loplugin:unusedfields in unotools

Change-Id: Icbf95150f7f7e5cf73e7709487f0543f9c01c2ce
Reviewed-on: https://gerrit.libreoffice.org/68160
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unotools/source/config/defaultoptions.cxx 
b/unotools/source/config/defaultoptions.cxx
index a530e06eb628..7c9b4a38c0e4 100644
--- a/unotools/source/config/defaultoptions.cxx
+++ b/unotools/source/config/defaultoptions.cxx
@@ -91,7 +91,6 @@ public:
 OUString m_aUserConfigPath;
 OUString m_aWorkPath;
 OUString m_aClassificationPath;
-OUString m_aUserDictionaryPath;
 
 SvtDefaultOptions_Impl();
 virtual ~SvtDefaultOptions_Impl() override;
@@ -309,7 +308,7 @@ SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : 
ConfigItem( "Office.Common/Pa
 case DEFAULTPATH_USERCONFIG:   m_aUserConfigPath = 
aFullPath;break;
 case DEFAULTPATH_WORK: m_aWorkPath = 
aFullPath;  break;
 case DEFAULTPATH_CLASSIFICATION:   m_aClassificationPath = 
aFullPath;break;
-case DEFAULTPATH_USERDICTIONARY:   m_aUserDictionaryPath = 
aFullPath;break;
+case DEFAULTPATH_USERDICTIONARY:   break;
 
 default:
 SAL_WARN( "unotools.config", "invalid index to load a 
default path" );
diff --git a/unotools/source/config/moduleoptions.cxx 
b/unotools/source/config/moduleoptions.cxx
index 7bfcede60714..85cea00c93aa 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -105,10 +105,7 @@ struct FactoryInfo
 {
 bInstalled  = false;
 sFactory.clear();
-sShortName.clear();
 sTemplateFile.clear();
-sWindowAttributes.clear();
-sEmptyDocumentURL.clear();
 sDefaultFilter.clear();
 nIcon   = 0;
 bChangedTemplateFile= false;
@@ -173,9 +170,6 @@ struct FactoryInfo
 // But if you wish to set it without that... you must initialize it!
 void initInstalled()   { 
bInstalled= true; }
 void initFactory  ( const OUString& sNewFactory  ) { 
sFactory  = sNewFactory; }
-void initShortName( const OUString& sNewShortName) { 
sShortName= sNewShortName; }
-void initWindowAttributes ( const OUString& sNewWindowAttributes ) { 
sWindowAttributes = sNewWindowAttributes; }
-void initEmptyDocumentURL ( const OUString& sNewEmptyDocumentURL ) { 
sEmptyDocumentURL = sNewEmptyDocumentURL; }
 void initDefaultFilter( const OUString& sNewDefaultFilter) { 
sDefaultFilter= sNewDefaultFilter; }
 void setDefaultFilterReadonly( const bool bVal){bDefaultFilterReadonly 
= bVal;}
 void initIcon ( sal_Int32  nNewIcon
 ) { nIcon = nNewIcon; }
@@ -222,10 +216,7 @@ struct FactoryInfo
 
 bool bInstalled;
 OUString sFactory;
-OUString sShortName;
 OUString sTemplateFile;
-OUString sWindowAttributes;
-OUString sEmptyDocumentURL;
 OUString sDefaultFilter;
 sal_Int32nIcon;
 
@@ -727,14 +718,8 @@ void SvtModuleOptions_Impl::impl_Read( const 
css::uno::Sequence< OUString >& lFa
 pInfo->initInstalled();
 pInfo->initFactory  ( sFactoryName );
 
-if (lValues[nPropertyStart+PROPERTYHANDLE_SHORTNAME] >>= sTemp)
-pInfo->initShortName( sTemp );
 if (lValues[nPropertyStart+PROPERTYHANDLE_TEMPLATEFILE] >>= sTemp)
 pInfo->initTemplateFile( sTemp );
-if (lValues[nPropertyStart+PROPERTYHANDLE_WINDOWATTRIBUTES] >>= 
sTemp)
-pInfo->initWindowAttributes( sTemp );
-if (lValues[nPropertyStart+PROPERTYHANDLE_EMPTYDOCUMENTURL] >>= 
sTemp)
-pInfo->initEmptyDocumentURL( sTemp );
 if (lValues[nPropertyStart+PROPERTYHANDLE_DEFAULTFILTER   ] >>= 
sTemp)
 pInfo->initDefaultFilter( sTemp );
 if (lValues[nPropertyStart+PROPERTYHANDLE_ICON] >>= nTemp)
diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx 
b/unotools/source/ucbhelper/ucblockbytes.cxx
index 

[Libreoffice-commits] core.git: unotools/source unoxml/source uui/source vbahelper/source

2019-02-10 Thread Libreoffice Gerrit user
 unotools/source/config/configitem.cxx   |2 -
 unotools/source/config/lingucfg.cxx |   23 +
 unotools/source/config/saveopt.cxx  |4 +--
 unotools/source/config/viewoptions.cxx  |4 +--
 unotools/source/i18n/charclass.cxx  |2 -
 unotools/source/ucbhelper/ucblockbytes.cxx  |4 +--
 unoxml/source/dom/document.cxx  |2 -
 unoxml/source/dom/entity.cxx|2 -
 unoxml/source/dom/entityreference.cxx   |2 -
 unoxml/source/dom/node.cxx  |2 -
 unoxml/source/dom/notation.cxx  |2 -
 unoxml/source/dom/saxbuilder.cxx|6 ++--
 uui/source/fltdlg.cxx   |2 -
 uui/source/iahndl-ssl.cxx   |2 -
 vbahelper/source/msforms/service.cxx|6 ++--
 vbahelper/source/msforms/vbacontrol.cxx |   14 +-
 vbahelper/source/msforms/vbalistbox.cxx |2 -
 vbahelper/source/msforms/vbatogglebutton.cxx|4 +--
 vbahelper/source/vbahelper/vbadocumentsbase.cxx |4 +--
 vbahelper/source/vbahelper/vbafontbase.cxx  |2 -
 vbahelper/source/vbahelper/vbahelper.cxx|   32 
 vbahelper/source/vbahelper/vbashaperange.cxx|2 -
 22 files changed, 63 insertions(+), 62 deletions(-)

New commits:
commit 71a61ab2d8b650ebe0655cebd7233959a5a3811e
Author: Noel Grandin 
AuthorDate: Sun Feb 10 12:29:15 2019 +0200
Commit: Noel Grandin 
CommitDate: Mon Feb 11 07:01:05 2019 +0100

loplugin:indentation in unotools..vbahelper

Change-Id: I76de5678dd21f207e9e9c2a0c446f2c0b9be974e
Reviewed-on: https://gerrit.libreoffice.org/67609
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unotools/source/config/configitem.cxx 
b/unotools/source/config/configitem.cxx
index b9aec85c5a2a..fd4fd3dc0fcb 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -302,7 +302,7 @@ void ConfigItem::impl_unpackLocalizedProperties(const   
Sequence< OUString >
 
 for( nPropertyCounter=0; nPropertyCounter 
 { rOpt.bROIsAutoReplaceUniqueEntries = pROStates[i]; rVal 
>>= rOpt.bIsAutoReplaceUniqueEntries;  } break;
 
 case UPH_IS_DIRECTION_TO_SIMPLIFIED :
-{ rOpt.bROIsDirectionToSimplified = pROStates[i];
-if( ! (rVal >>= rOpt.bIsDirectionToSimplified) )
+{
+rOpt.bROIsDirectionToSimplified = pROStates[i];
+if( ! (rVal >>= rOpt.bIsDirectionToSimplified) )
+{
+//default is locale dependent:
+if 
(MsLangId::isTraditionalChinese(rOpt.nDefaultLanguage_CJK))
 {
-//default is locale dependent:
-if 
(MsLangId::isTraditionalChinese(rOpt.nDefaultLanguage_CJK))
-{
-rOpt.bIsDirectionToSimplified = false;
-}
-else
-{
-rOpt.bIsDirectionToSimplified = true;
-}
+rOpt.bIsDirectionToSimplified = false;
 }
+else
+{
+rOpt.bIsDirectionToSimplified = true;
+}
+}
 } break;
 case UPH_IS_USE_CHARACTER_VARIANTS :
 { rOpt.bROIsUseCharacterVariants = pROStates[i]; rVal >>= 
rOpt.bIsUseCharacterVariants;  } break;
diff --git a/unotools/source/config/saveopt.cxx 
b/unotools/source/config/saveopt.cxx
index 19a39049e6bc..6ef1403d020f 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -744,8 +744,8 @@ SvtSaveOptions::SvtSaveOptions()
 pOptions.reset(new SvtLoadSaveOptions_Impl);
 pOptions->pSaveOpt.reset(new SvtSaveOptions_Impl);
 pOptions->pLoadOpt.reset( new SvtLoadOptions_Impl);
-   }
-   ++nRefCount;
+}
+++nRefCount;
 pImp = pOptions.get();
 }
 
diff --git a/unotools/source/config/viewoptions.cxx 
b/unotools/source/config/viewoptions.cxx
index 3eb5584a6dcd..25d8d21f7ecf 100644
--- a/unotools/source/config/viewoptions.cxx
+++ b/unotools/source/config/viewoptions.cxx
@@ -358,8 +358,8 @@ void SvtViewOptionsBase_Impl::SetUserData( const OUString&
 if (xUserData.is())
 {
 const css::beans::NamedValue* pData = lData.getConstArray();
-  sal_Int32   c = lData.getLength();
-  sal_Int32   i = 0;
+sal_Int32   c

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

2019-01-27 Thread Libreoffice Gerrit user
 unotools/source/misc/datetime.cxx |   38 --
 1 file changed, 16 insertions(+), 22 deletions(-)

New commits:
commit 3c2cd4829229a312e79cfba3971b954bd605681c
Author: Matteo Casalin 
AuthorDate: Sat Jan 26 00:44:26 2019 +0100
Commit: Matteo Casalin 
CommitDate: Sun Jan 27 23:10:13 2019 +0100

Bail out early

Change-Id: I7851f4952ca2c863d92fd14fa19005ed35634033
Reviewed-on: https://gerrit.libreoffice.org/66941
Tested-by: Jenkins
Reviewed-by: Matteo Casalin 

diff --git a/unotools/source/misc/datetime.cxx 
b/unotools/source/misc/datetime.cxx
index 7a843db7a34a..7ebfd543c681 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -349,35 +349,29 @@ bool ISO8601parseDateTime(const OUString , 
css::util::DateTime& rDateTim
 bool ISO8601parseDate(const OUString , css::util::Date& rDate)
 {
 const sal_Int32 nDateTokens {comphelper::string::getTokenCount(aDateStr, 
'-')};
-bool bSuccess = true;
+
+if (nDateTokens<1 || nDateTokens>3)
+return false;
 
 sal_Int32 nYear= 1899;
 sal_Int32 nMonth   = 12;
 sal_Int32 nDay = 30;
 
-if ( nDateTokens > 3 || aDateStr.isEmpty() )
-bSuccess = false;
-else
-{
-sal_Int32 n = 0;
-if ( !convertNumber32( nYear, aDateStr.getToken( 0, '-', n ), 0,  
) )
-bSuccess = false;
-if ( nDateTokens >= 2 )
-if ( !convertNumber32( nMonth, aDateStr.getToken( 0, '-', n ), 0, 
12 ) )
-bSuccess = false;
-if ( nDateTokens >= 3 )
-if ( !convertNumber32( nDay, aDateStr.getToken( 0, '-', n ), 0, 31 
) )
-bSuccess = false;
-}
+sal_Int32 nIdx {0};
+if ( !convertNumber32( nYear, aDateStr.getToken( 0, '-', nIdx ), 0,  ) 
)
+return false;
+if ( nDateTokens >= 2 )
+if ( !convertNumber32( nMonth, aDateStr.getToken( 0, '-', nIdx ), 0, 
12 ) )
+return false;
+if ( nDateTokens >= 3 )
+if ( !convertNumber32( nDay, aDateStr.getToken( 0, '-', nIdx ), 0, 31 
) )
+return false;
 
-if (bSuccess)
-{
-rDate.Year = static_cast(nYear);
-rDate.Month = static_cast(nMonth);
-rDate.Day = static_cast(nDay);
-}
+rDate.Year = static_cast(nYear);
+rDate.Month = static_cast(nMonth);
+rDate.Day = static_cast(nDay);
 
-return bSuccess;
+return true;
 }
 
 /** convert ISO8601 Time String to util::Time */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-27 Thread Libreoffice Gerrit user
 unotools/source/misc/datetime.cxx |   10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

New commits:
commit d423829d662ddf1974ce6aca07dfa9d551333406
Author: Matteo Casalin 
AuthorDate: Sat Jan 26 00:40:01 2019 +0100
Commit: Matteo Casalin 
CommitDate: Sun Jan 27 16:14:45 2019 +0100

Use getTokenCount instead of custom code

Change-Id: I645854f4e0d5d57f8507a13e29dbb920e9f1ab85
Reviewed-on: https://gerrit.libreoffice.org/66940
Tested-by: Jenkins
Reviewed-by: Matteo Casalin 

diff --git a/unotools/source/misc/datetime.cxx 
b/unotools/source/misc/datetime.cxx
index 08b1f8f5032b..7a843db7a34a 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 namespace
@@ -347,20 +348,13 @@ bool ISO8601parseDateTime(const OUString , 
css::util::DateTime& rDateTim
 //  year, week date, ordinal date
 bool ISO8601parseDate(const OUString , css::util::Date& rDate)
 {
+const sal_Int32 nDateTokens {comphelper::string::getTokenCount(aDateStr, 
'-')};
 bool bSuccess = true;
 
 sal_Int32 nYear= 1899;
 sal_Int32 nMonth   = 12;
 sal_Int32 nDay = 30;
 
-const sal_Unicode* pStr = aDateStr.getStr();
-sal_Int32 nDateTokens = 1;
-while ( *pStr )
-{
-if ( *pStr == '-' )
-nDateTokens++;
-pStr++;
-}
 if ( nDateTokens > 3 || aDateStr.isEmpty() )
 bSuccess = false;
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-10 Thread Libreoffice Gerrit user
 unotools/source/i18n/resmgr.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2aa92391daf6bf2ee3c2a332786f592a3d84c771
Author: Stephan Bergmann 
AuthorDate: Thu Jan 10 09:07:57 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Jan 10 16:10:03 2019 +0100

__cplusplus >= 201703L is always true now for _MSC_VER

...since 50cb96346ad54bcdb172acf11b4befe540e2b152 "Use correct __cplusplus 
value
with MSVC"

Change-Id: Ic107a8eff42b6e3961a787d1310cf4df78c26d49
Reviewed-on: https://gerrit.libreoffice.org/66064
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index d2a59c727cf7..654d3c2fae19 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -23,7 +23,7 @@
 #include 
 #if HAVE_LIBCXX
 #define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
-#elif defined _MSC_VER && __cplusplus >= 201703L
+#elif defined _MSC_VER
 #define _HAS_AUTO_PTR_ETC 1
 #endif
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-01-04 Thread Libreoffice Gerrit user
 unotools/source/config/eventcfg.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b29f6e605210477ab9e13f0dad76d83023b360f2
Author: Stephan Bergmann 
AuthorDate: Thu Jan 3 16:44:53 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Jan 4 09:45:39 2019 +0100

Add apparently missing ! to GlobalEventConfig_Impl::hasElements

...which had been like that ever since the code's introduction in
026f5ef5eee4bc75dafbdc00216808daf5acce7e "INTEGRATION: CWS docking1"

Change-Id: I2d5ae3a03aaf75a0f8df40c641f7233c6b19630e
Reviewed-on: https://gerrit.libreoffice.org/65848
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/unotools/source/config/eventcfg.cxx 
b/unotools/source/config/eventcfg.cxx
index ca2e1dac0082..8c0b62781b6f 100644
--- a/unotools/source/config/eventcfg.cxx
+++ b/unotools/source/config/eventcfg.cxx
@@ -293,7 +293,7 @@ Type const & GlobalEventConfig_Impl::getElementType(  )
 
 bool GlobalEventConfig_Impl::hasElements() const
 {
-return m_eventBindingHash.empty();
+return !m_eventBindingHash.empty();
 }
 
 // and now the wrapper
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-13 Thread Libreoffice Gerrit user
 unotools/source/i18n/resmgr.cxx |   22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

New commits:
commit b75ee1b35c72214d7c0dea98eda87ec9531cb768
Author: Tor Lillqvist 
AuthorDate: Fri Nov 16 00:54:14 2018 +0200
Commit: Tor Lillqvist 
CommitDate: Thu Dec 13 15:17:53 2018 +0100

Swiss Standard German: replace 'ß' in German translation with 'ss'

Although there as such is nothing LibreOfficeKit-specific here, do it
conditionally only when being used from a LibreOfficeKit client to
avoid bike-shedding.

Change-Id: I2af12394648ddad352f24c71581be0f9bf5e3d70
Reviewed-on: https://gerrit.libreoffice.org/63447
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index be66f9445816..d2a59c727cf7 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -40,6 +40,7 @@
 #   include 
 #endif
 
+#include 
 #include 
 #include 
 #include 
@@ -218,7 +219,16 @@ namespace Translate
 
 //otherwise translate it
 const std::string ret = boost::locale::pgettext(sContext.getStr(), 
pId, loc);
-return ExpandVariables(createFromUtf8(ret.data(), ret.size()));
+OUString result(ExpandVariables(createFromUtf8(ret.data(), 
ret.size(;
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+// If it is de-CH, change sharp s to double s.
+if (std::use_facet(loc).country() == "CH" &&
+std::use_facet(loc).language() == "de")
+result = result.replaceAll(OUString::fromUtf8("\xC3\x9F"), 
"ss");
+}
+return result;
 }
 
 OUString nget(const char* pContextAndIds, int n, const std::locale )
@@ -243,7 +253,15 @@ namespace Translate
 
 //otherwise translate it
 const std::string ret = 
boost::locale::npgettext(aContextIdId[0].getStr(), aContextIdId[1].getStr(), 
aContextIdId[2].getStr(), n, loc);
-return ExpandVariables(createFromUtf8(ret.data(), ret.size()));
+OUString result(ExpandVariables(createFromUtf8(ret.data(), 
ret.size(;
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+if (std::use_facet(loc).country() == "CH" &&
+std::use_facet(loc).language() == "de")
+result = result.replaceAll(OUString::fromUtf8("\xC3\x9F"), 
"ss");
+}
+return result;
 }
 
 static ResHookProc pImplResHookProc = nullptr;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-07 Thread Libreoffice Gerrit user
 unotools/source/i18n/resmgr.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3d79f0ff9eedec74a131796016add94f4a1be02d
Author: Stephan Bergmann 
AuthorDate: Fri Dec 7 09:07:02 2018 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Dec 7 11:07:56 2018 +0100

Clang (and GCC) always has __cplusplus >= C++17 now

...after 665ac8f32d3aaaf7c27e8976e14fd4819edbf79b "All supported versions of
Clang and GCC support at least C++17 now".  And even if __cplusplus might 
still
be < 201703L for old versions that only support -std=c++1z and not 
-std=c++17,
this #if should probably be enabled for those too.

(MSVC will first need adding /Zc:__cplusplus before it has a correct 
__cplusplus
value.)

Change-Id: If932b293d66e704357b10836839d221634bb1a3b
Reviewed-on: https://gerrit.libreoffice.org/64751
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index 8d4fcb5eac33..be66f9445816 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -21,7 +21,7 @@
 // workdir/UnpackedTarball/boost/boost/locale/format.hpp using 
"std::auto_ptr d;", but must
 // come very early here in case  is already (indirectly) included 
earlier:
 #include 
-#if HAVE_LIBCXX && __cplusplus >= 201703L
+#if HAVE_LIBCXX
 #define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
 #elif defined _MSC_VER && __cplusplus >= 201703L
 #define _HAS_AUTO_PTR_ETC 1
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-31 Thread Libreoffice Gerrit user
 unotools/source/ucbhelper/ucblockbytes.cxx |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit a3d31cabe0157b2fc42c20cf5229777a9a593128
Author: Noel Grandin 
AuthorDate: Mon Oct 29 14:30:28 2018 +0200
Commit: Noel Grandin 
CommitDate: Wed Oct 31 07:32:49 2018 +0100

loplugin:useuniqueptr in UcbLockBytes::SetSize

Change-Id: Ie968bedac6abb8f76705e30eaaebb74fed949883
Reviewed-on: https://gerrit.libreoffice.org/62655
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx 
b/unotools/source/ucbhelper/ucblockbytes.cxx
index 04bb3225a515..011a083de4cd 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -1238,10 +1238,9 @@ ErrCode UcbLockBytes::SetSize (sal_uInt64 const nNewSize)
 if ( nSize < nNewSize )
 {
 std::size_t nDiff = nNewSize-nSize, nCount=0;
-sal_uInt8* pBuffer = new sal_uInt8[ nDiff ];
-memset(pBuffer, 0, nDiff); // initialize for enhanced security
-WriteAt( nSize, pBuffer, nDiff,  );
-delete[] pBuffer;
+std::unique_ptr pBuffer(new sal_uInt8[ nDiff ]);
+memset(pBuffer.get(), 0, nDiff); // initialize for enhanced security
+WriteAt( nSize, pBuffer.get(), nDiff,  );
 if ( nCount != nDiff )
 return ERRCODE_IO_CANTWRITE;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-23 Thread Libreoffice Gerrit user
 unotools/source/i18n/textsearch.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit e9ab8ed391d961e42e46bbaa58a6336ff65b32b4
Author: Mike Kaganski 
AuthorDate: Tue Oct 23 20:23:22 2018 +0200
Commit: Mike Kaganski 
CommitDate: Wed Oct 24 06:56:19 2018 +0200

Fix empty capture group reference

Searching for something like (foo)|(bar) and replacing with $1$2 would fail
assertion in appendCopy in include/rtl/ustrbuf.hxx, because beginIndex is
negative (-1), because one of the references is always empty (SearchResult
at TextSearch::ReplaceBackReferences() has both startOffset and startOffset
equal to -1).

In this case, we should simply return an empty string.

Change-Id: Ibf91b1d17ab21c279cfcdc31e84d0c2eae567a53
Reviewed-on: https://gerrit.libreoffice.org/62248
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/unotools/source/i18n/textsearch.cxx 
b/unotools/source/i18n/textsearch.cxx
index 5bb4dfd81a4a..12504ccf0882 100644
--- a/unotools/source/i18n/textsearch.cxx
+++ b/unotools/source/i18n/textsearch.cxx
@@ -329,7 +329,11 @@ void TextSearch::ReplaceBackReferences( OUString& 
rReplaceStr, const OUString 
 {
 sal_Int32 nSttReg = rResult.startOffset[j];
 sal_Int32 nRegLen = rResult.endOffset[j];
-if( nRegLen > nSttReg )
+if (nSttReg < 0 || nRegLen < 0) // A "not found" 
optional capture
+{
+nSttReg = nRegLen = 0; // Copy empty string
+}
+else if (nRegLen >= nSttReg)
 {
 nRegLen = nRegLen - nSttReg;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unotools/source unoxml/source uui/source vbahelper/source

2018-10-15 Thread Libreoffice Gerrit user
 unotools/source/config/compatibility.cxx   |4 +-
 unotools/source/config/dynamicmenuoptions.cxx  |   32 ++---
 unotools/source/config/eventcfg.cxx|   10 ++
 unotools/source/config/fontcfg.cxx |   13 
 unotools/source/config/options.cxx |   14 +++--
 unotools/source/misc/fontdefs.cxx  |6 +--
 unotools/source/ucbhelper/ucbhelper.cxx|   17 +++
 unoxml/source/dom/document.cxx |   17 +++
 unoxml/source/rdf/librdf_repository.cxx|6 +--
 unoxml/source/xpath/xpathapi.cxx   |   19 
 uui/source/fltdlg.cxx  |6 +--
 uui/source/iahndl.cxx  |   11 +--
 vbahelper/source/vbahelper/vbacommandbarhelper.cxx |   11 ++-
 vbahelper/source/vbahelper/vbaeventshelperbase.cxx |4 +-
 vbahelper/source/vbahelper/vbahelper.cxx   |7 +---
 15 files changed, 63 insertions(+), 114 deletions(-)

New commits:
commit 40ab4d8fda9b69b388ac674c1ee4e88084af9519
Author: Arkadiy Illarionov 
AuthorDate: Sun Oct 14 20:25:12 2018 +0300
Commit: Noel Grandin 
CommitDate: Mon Oct 15 08:00:08 2018 +0200

Simplify containers iterations in unotools, unoxml, uui, vbahelper

Use range-based loop or replace with STL functions.

Change-Id: I5a43f6fc62c81453dcef3820bb715f4da76915af
Reviewed-on: https://gerrit.libreoffice.org/61762
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unotools/source/config/compatibility.cxx 
b/unotools/source/config/compatibility.cxx
index ba5df9a01113..ce4ed63b8430 100644
--- a/unotools/source/config/compatibility.cxx
+++ b/unotools/source/config/compatibility.cxx
@@ -244,10 +244,10 @@ Sequence< Sequence< PropertyValue > > 
SvtCompatibilityOptions_Impl::GetList() co
 lProperties[i].Name = SvtCompatibilityEntry::getName( 
SvtCompatibilityEntry::Index(i) );
 
 sal_Int32 j = 0;
-for ( std::vector< SvtCompatibilityEntry >::const_iterator pItem = 
m_aOptions.begin(); pItem != m_aOptions.end(); ++pItem )
+for ( const auto& rItem : m_aOptions )
 {
 for ( int i = static_cast(SvtCompatibilityEntry::Index::Name); i 
< static_cast(SvtCompatibilityEntry::Index::INVALID); ++i )
-lProperties[i].Value = pItem->getValue( 
SvtCompatibilityEntry::Index(i) );
+lProperties[i].Value = rItem.getValue( 
SvtCompatibilityEntry::Index(i) );
 lResult[ j++ ] = lProperties;
 }
 
diff --git a/unotools/source/config/dynamicmenuoptions.cxx 
b/unotools/source/config/dynamicmenuoptions.cxx
index 871886b238d0..6c451d387dcb 100644
--- a/unotools/source/config/dynamicmenuoptions.cxx
+++ b/unotools/source/config/dynamicmenuoptions.cxx
@@ -94,8 +94,6 @@ class SvtDynMenu
 // convert internal list to external format
 // for using it on right menus really
 // Notice:   We build a property list with 4 entries and set it on 
result list then.
-//   The while-loop starts with pointer on internal member 
list lSetupEntries, change to
-//   lUserEntries then and stop after that with NULL!
 //   Separator entries will be packed in another way then 
normal entries! We define
 //   special string "sSeparator" to perform too ...
 Sequence< Sequence< PropertyValue > > GetList() const
@@ -106,20 +104,17 @@ class SvtDynMenu
 Sequence< PropertyValue > lProperties ( PROPERTYCOUNT 
);
 Sequence< Sequence< PropertyValue > > lResult ( 
nSetupCount+nUserCount );
 OUString  sSeparator  ( 
"private:separator" );
-const vector< SvtDynMenuEntry >*pList   = 

 
 lProperties[OFFSET_URL].Name = PROPERTYNAME_URL;
 lProperties[OFFSET_TITLE  ].Name = PROPERTYNAME_TITLE;
 lProperties[OFFSET_IMAGEIDENTIFIER].Name = 
PROPERTYNAME_IMAGEIDENTIFIER;
 lProperties[OFFSET_TARGETNAME ].Name = PROPERTYNAME_TARGETNAME;
 
-while( pList != nullptr )
+for( const auto& pList : {, } )
 {
-for( vector< SvtDynMenuEntry >::const_iterator pItem 
=pList->begin();
- pItem!=pList->end();
- ++pItem  )
+for( const auto& rItem : *pList )
 {
-if( pItem->sURL == sSeparator )
+if( rItem.sURL == sSeparator )
 {
 lProperties[OFFSET_URL  ].Value <<= 
sSeparator;
 lProperties[OFFSET_TITLE].Value <<= 
OUString();
@@ -128,18 +123,14 @@ class SvtDynMenu
 }
 else
 {
- 

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

2018-05-29 Thread Luboš Luňák
 unotools/source/i18n/charclass.cxx |   56 -
 1 file changed, 55 insertions(+), 1 deletion(-)

New commits:
commit a2045f94677c4407c00a3299da0936ded696cfb2
Author: Luboš Luňák 
Date:   Tue May 29 12:27:34 2018 +0200

make CharClass also mutex-protect calls to its dependent class

When calc_tests runs test_tdf53482_Range_contains_column_headings_file()
with Calc's threading enabled, it ends up calling ScInterpreter::ScProper()
from threads, which calls to CharClass. And while CharClass tries to be
thread-safe (guessing from the mutex usage), it forwards calls to i18npool's
CharacterClassificationImpl and cclass_Unicode, both of which aren't
thread-safe. Which makes thread safety of CharClass itself pointless.

Since CharClass already acquires the mutex anyway because of getMyLocale(),
just extend the duration for the entire call, which hopefully shouldn't
make that much of a difference.

Change-Id: I544b34d7e58c4a901f3b6e3a3ff52156b9e320a8
Reviewed-on: https://gerrit.libreoffice.org/54999
Reviewed-by: Michael Meeks 
Tested-by: Luboš Luňák 

diff --git a/unotools/source/i18n/charclass.cxx 
b/unotools/source/i18n/charclass.cxx
index 9e3d184b1490..4be3ad89c3b8 100644
--- a/unotools/source/i18n/charclass.cxx
+++ b/unotools/source/i18n/charclass.cxx
@@ -64,7 +64,7 @@ const LanguageTag& CharClass::getLanguageTag() const
 
 const css::lang::Locale& CharClass::getMyLocale() const
 {
-::osl::MutexGuard aGuard( aMutex );
+// Mutex locked by callers.
 return maLanguageTag.getLocale();
 }
 
@@ -113,8 +113,11 @@ bool CharClass::isAlpha( const OUString& rStr, sal_Int32 
nPos ) const
 try
 {
 if ( xCC.is() )
+{
+::osl::MutexGuard aGuard( aMutex );
 return  (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
  nCharClassAlphaType) != 0;
+}
 }
 catch ( const Exception& )
 {
@@ -132,8 +135,11 @@ bool CharClass::isLetter( const OUString& rStr, sal_Int32 
nPos ) const
 try
 {
 if ( xCC.is() )
+{
+::osl::MutexGuard aGuard( aMutex );
 return  (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
  nCharClassLetterType) != 0;
+}
 }
 catch ( const Exception& )
 {
@@ -147,7 +153,10 @@ bool CharClass::isLetter( const OUString& rStr ) const
 try
 {
 if ( xCC.is() )
+{
+::osl::MutexGuard aGuard( aMutex );
 return isLetterType( xCC->getStringType( rStr, 0, 
rStr.getLength(), getMyLocale() ) );
+}
 }
 catch ( const Exception& )
 {
@@ -165,8 +174,11 @@ bool CharClass::isDigit( const OUString& rStr, sal_Int32 
nPos ) const
 try
 {
 if ( xCC.is() )
+{
+::osl::MutexGuard aGuard( aMutex );
 return  (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
  KCharacterType::DIGIT) != 0;
+}
 }
 catch ( const Exception& )
 {
@@ -180,7 +192,10 @@ bool CharClass::isNumeric( const OUString& rStr ) const
 try
 {
 if ( xCC.is() )
+{
+::osl::MutexGuard aGuard( aMutex );
 return isNumericType( xCC->getStringType( rStr, 0, 
rStr.getLength(), getMyLocale() ) );
+}
 }
 catch ( const Exception& )
 {
@@ -198,8 +213,11 @@ bool CharClass::isAlphaNumeric( const OUString& rStr, 
sal_Int32 nPos ) const
 try
 {
 if ( xCC.is() )
+{
+::osl::MutexGuard aGuard( aMutex );
 return  (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
 (nCharClassAlphaType | KCharacterType::DIGIT)) != 0;
+}
 }
 catch ( const Exception& )
 {
@@ -217,8 +235,11 @@ bool CharClass::isLetterNumeric( const OUString& rStr, 
sal_Int32 nPos ) const
 try
 {
 if ( xCC.is() )
+{
+::osl::MutexGuard aGuard( aMutex );
 return  (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
  (nCharClassLetterType | KCharacterType::DIGIT)) != 0;
+}
 }
 catch ( const Exception& )
 {
@@ -232,7 +253,10 @@ bool CharClass::isLetterNumeric( const OUString& rStr ) 
const
 try
 {
 if ( xCC.is() )
+{
+::osl::MutexGuard aGuard( aMutex );
 return isLetterNumericType( xCC->getStringType( rStr, 0, 
rStr.getLength(), getMyLocale() ) );
+}
 }
 catch ( const Exception& )
 {
@@ -246,7 +270,10 @@ OUString CharClass::titlecase(const OUString& rStr, 
sal_Int32 nPos, sal_Int32 nC
 try
 {
 if ( xCC.is() )
+{
+::osl::MutexGuard aGuard( aMutex );
 return xCC->toTitle( rStr, nPos, nCount, getMyLocale() );
+}
 }
 catch ( const Exception& )
 {
@@ -260,7 +287,10 @@ OUString CharClass::uppercase( const OUString& rStr, 
sal_Int32 

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

2018-05-17 Thread Stephan Bergmann
 unotools/source/config/extendedsecurityoptions.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit 8da2485f2ac512e68083c793b21a90238b55c1c9
Author: Stephan Bergmann 
Date:   Thu May 17 09:21:44 2018 +0200

-Werror,-Wunused-private-field

Change-Id: Icc8c0730400c481bb6de8c605f72b51b1f37

diff --git a/unotools/source/config/extendedsecurityoptions.cxx 
b/unotools/source/config/extendedsecurityoptions.cxx
index 18cc0b9547ef..0d3a6cc61f7b 100644
--- a/unotools/source/config/extendedsecurityoptions.cxx
+++ b/unotools/source/config/extendedsecurityoptions.cxx
@@ -42,7 +42,6 @@ using namespace ::com::sun::star::uno;
 #define ROOTNODE_SECURITY   "Office.Security"
 
 #define SECURE_EXTENSIONS_SET   OUString("SecureExtensions")
-#define EXTENSION_PROPNAME  OUString("/Extension")
 
 #define PROPERTYNAME_HYPERLINKS_OPENOUString("Hyperlinks/Open")
 
@@ -87,7 +86,6 @@ class SvtExtendedSecurityOptions_Impl : public ConfigItem
 static Sequence< OUString > GetPropertyNames();
 
 OUString
m_aSecureExtensionsSetName;
-OUStringm_aExtensionPropName;
 
 SvtExtendedSecurityOptions::OpenHyperlinkMode   m_eOpenHyperlinkMode;
 };
@@ -98,7 +96,6 @@ 
SvtExtendedSecurityOptions_Impl::SvtExtendedSecurityOptions_Impl()
 // Init baseclasses first
 :   ConfigItem  ( ROOTNODE_SECURITY )
 , m_aSecureExtensionsSetName( SECURE_EXTENSIONS_SET )
-, m_aExtensionPropName( EXTENSION_PROPNAME )
 , m_eOpenHyperlinkMode(SvtExtendedSecurityOptions::OPEN_NEVER)
 // Init member then.
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-11 Thread Tor Lillqvist
 unotools/source/i18n/resmgr.cxx |   70 +++-
 1 file changed, 69 insertions(+), 1 deletion(-)

New commits:
commit 2ff121f298e64ff204621220622472fe697d599d
Author: Tor Lillqvist 
Date:   Fri May 11 01:38:58 2018 +0300

Avoid gengal hanging in an --enable-dbgutil build on Windows

With a newer C++ debug runtime (in an --enable-dbgutil build), passing
an invalid locale name causes an attempt to display an error
dialog. Which does not even show up, at least for me, but instead the
process (gengal, at least) just hangs. Which is far from ideal.

Passing a POSIX-style locale name to the std::locale constructor on
Windows is a bit odd, but apparently in the normal C++ runtime it
"just" causes an exception to be thrown, that boost catches (see the
loadable(std::string name) in boost's libs\locale\src\std\std_backend.cpp),
and then instead uses the Windows style locale name it knows how to
construct. (Why it even tries the POSIX style name on Windows I can't
understand.)

Actually it isn't just the locale name part "en_US" of a locale like
"en_US.UTF-8" that is problematic, but also the encoding part,
"UTF-8". The Microsoft C/C++ library does not support UTF-8
locales. The error message that our own report hook catches says:
"f:\dd\vctools\crt\crtw32\stdcpp\xmbtowc.c(89) : Assertion failed:
ploc->_Mbcurmax == 1 || ploc->_Mbcurmax == 2". Clearly in a UTF-8
locale (perhaps one that boost internally constructs?) the maximum
bytes per character will be more than 2.

With a debug C++ runtime, we need to avoid the error dialog, and just
ignore the error. So we install an own CRT error report hook that
ignores the error for the duration of the locale construcion.

Change-Id: Ia2ca994f03d1ce94ce7e9d7607f204c320ab8f2d
Reviewed-on: https://gerrit.libreoffice.org/54110
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index 9e0b8f02577b..f756575bc5bb 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -68,6 +68,13 @@
 #include 
 #include 
 
+#if defined(_WIN32) && defined(DBG_UTIL)
+#include 
+#include 
+#include 
+#include 
+#endif
+
 namespace
 {
 OUString createFromUtf8(const char* data, size_t size)
@@ -100,6 +107,26 @@ namespace
 }
 }
 
+#if defined(_WIN32) && defined(DBG_UTIL)
+static int IgnoringCrtReportHook(int reportType, wchar_t *message, int * /* 
returnValue */)
+{
+OUString sType;
+if (reportType == _CRT_WARN)
+sType = "WARN";
+else if (reportType == _CRT_ERROR)
+sType = "ERROR";
+else if (reportType == _CRT_ASSERT)
+sType = "ASSERT";
+else
+sType = "?(" + OUString::number(reportType) + ")";
+
+SAL_WARN("unotools.i18n", "CRT Report Hook: " << sType << ": " << 
OUString(o3tl::toU(message)));
+
+return TRUE;
+}
+#endif
+
+
 namespace Translate
 {
 std::locale Create(const sal_Char* pPrefixName, const LanguageTag& rLocale)
@@ -123,7 +150,48 @@ namespace Translate
 bindtextdomain(pPrefixName, sPath.getStr());
 #endif
 gen.add_messages_domain(pPrefixName);
+
+#if defined(_WIN32) && defined(DBG_UTIL)
+// With a newer C++ debug runtime (in an --enable-dbgutil build), 
passing an invalid locale
+// name causes an attempt to display an error dialog. Which does not 
even show up, at least
+// for me, but instead the process (gengal, at least) just hangs. 
Which is far from ideal.
+
+// Passing a POSIX-style locale name to the std::locale constructor on 
Windows is a bit odd,
+// but apparently in the normal C++ runtime it "just" causes an 
exception to be thrown, that
+// boost catches (see the loadable(std::string name) in boost's
+// libs\locale\src\std\std_backend.cpp), and then instead uses the 
Windows style locale name
+// it knows how to construct. (Why does it even try the POSIX style 
name I can't
+// understand.)
+
+// Actually it isn't just the locale name part "en_US" of a locale 
like "en_US.UTF-8" that
+// is problematic, but also the encoding part, "UTF-8". The Microsoft 
C/C++ library does not
+// support UTF-8 locales. The error message that our own report hook 
catches says:
+// "f:\dd\vctools\crt\crtw32\stdcpp\xmbtowc.c(89) : Assertion failed: 
ploc->_Mbcurmax == 1
+// || ploc->_Mbcurmax == 2". Clearly in a UTF-8 locale (perhaps one 
that boost internally
+// constructs?) the maximum bytes per character 

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

2018-03-29 Thread Stephan Bergmann
 unotools/source/ucbhelper/tempfile.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit d7a8fa7adf2b2b098a1e38cd7002c928d015b489
Author: Stephan Bergmann 
Date:   Thu Mar 29 16:39:50 2018 +0200

Remove bogus assert

...that had been added with f0215dcc9e5ba47d4b7d5b9759f1bd774942d388 
"unotools:
assert if TempFile::GetURL() fails due to missing file UCP".  But when 
SRCDIR is
a read-only tree, JunitTest_sc_unoapi_2 fails with that assert firing when
TempFile::GetURL is called from SfxMedium::CreateTempFile
(sfx2/source/doc/docfile.cxx), which in turn is prepared to handle an empty
return value from GetURL, and the test succeeds after removing the assert.  
So
it looks like that assert was not precise enough to only fire in the 
scenarios
where it was intended to fire.

Change-Id: I333e9026ee14e9d1140b1b475793a5b15ededd70
Reviewed-on: https://gerrit.libreoffice.org/52085
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

diff --git a/unotools/source/ucbhelper/tempfile.cxx 
b/unotools/source/ucbhelper/tempfile.cxx
index 25c9db2fe39d..5a2f6fc294fd 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -409,7 +409,6 @@ OUString TempFile::GetFileName() const
 
 OUString const & TempFile::GetURL() const
 {
-assert(!aName.isEmpty() && "TempFile::GetURL failed: unit test is leaking 
temp files, add the ucpfile1 component!");
 return aName;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-02 Thread Stephan Bergmann
 unotools/source/i18n/resmgr.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 01f3d84963fc6ff96c50179bdf67c6888da7bf01
Author: Stephan Bergmann 
Date:   Fri Mar 2 16:38:07 2018 +0100

Blind build fix for Android

Change-Id: Ic1ad524d533d3e27d59dacc3f1233de3e4e3e0dc

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index d27245156493..9e0b8f02577b 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -36,7 +36,7 @@
 #include 
 #include 
 #include 
-#if defined UNX && !defined MACOSX && !defined IOS
+#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID
 #   include 
 #endif
 
@@ -119,7 +119,7 @@ namespace Translate
 osl::File::getSystemPathFromFileURL(uri, path);
 OString sPath(OUStringToOString(path, osl_getThreadTextEncoding()));
 gen.add_messages_path(sPath.getStr());
-#if defined UNX && !defined MACOSX && !defined IOS
+#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID
 bindtextdomain(pPrefixName, sPath.getStr());
 #endif
 gen.add_messages_domain(pPrefixName);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-02 Thread jan Iversen
 unotools/source/i18n/resmgr.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6b8a3ab2108480a2d23ad91ef30418f8f831cf8c
Author: jan Iversen 
Date:   Fri Mar 2 12:56:48 2018 +0100

iOS, added same limitations as MACOSX

Change-Id: Ic8490fcea37221f580734e7764e90bb21c9cc28f

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index 61c681f63ff9..d27245156493 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -36,7 +36,7 @@
 #include 
 #include 
 #include 
-#if defined UNX && !defined MACOSX
+#if defined UNX && !defined MACOSX && !defined IOS
 #   include 
 #endif
 
@@ -119,7 +119,7 @@ namespace Translate
 osl::File::getSystemPathFromFileURL(uri, path);
 OString sPath(OUStringToOString(path, osl_getThreadTextEncoding()));
 gen.add_messages_path(sPath.getStr());
-#if defined UNX && !defined MACOSX
+#if defined UNX && !defined MACOSX && !defined IOS
 bindtextdomain(pPrefixName, sPath.getStr());
 #endif
 gen.add_messages_domain(pPrefixName);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-02 Thread Caolán McNamara
 unotools/source/i18n/resmgr.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 1126fcfdedc7047a8e8e4a5925c7dd2fde7a0436
Author: Caolán McNamara 
Date:   Fri Mar 2 09:10:50 2018 +

fix fuzzer build

Change-Id: I24c7e32b3dc63f3b5043e186f6af0ffa4d310198

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index 19f33a85b558..61c681f63ff9 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -36,6 +36,9 @@
 #include 
 #include 
 #include 
+#if defined UNX && !defined MACOSX
+#   include 
+#endif
 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-01 Thread Caolán McNamara
 unotools/source/i18n/resmgr.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit a32d22ee3879ef7077923d3c6598387089dbd9b2
Author: Caolán McNamara 
Date:   Thu Mar 1 14:22:33 2018 +

hook up gettext to native dialog

Change-Id: Ie5ca8882c8e4c41a8ee41379edc37c4c07e18033
Reviewed-on: https://gerrit.libreoffice.org/50581
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx
index ce5bc28f8896..19f33a85b558 100644
--- a/unotools/source/i18n/resmgr.cxx
+++ b/unotools/source/i18n/resmgr.cxx
@@ -114,7 +114,11 @@ namespace Translate
 rtl::Bootstrap::expandMacros(uri);
 OUString path;
 osl::File::getSystemPathFromFileURL(uri, path);
-gen.add_messages_path(OUStringToOString(path, 
osl_getThreadTextEncoding()).getStr());
+OString sPath(OUStringToOString(path, osl_getThreadTextEncoding()));
+gen.add_messages_path(sPath.getStr());
+#if defined UNX && !defined MACOSX
+bindtextdomain(pPrefixName, sPath.getStr());
+#endif
 gen.add_messages_domain(pPrefixName);
 std::locale aRet(gen(sIdentifier.getStr()));
 aCache[sUnique] = aRet;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unotools/source vcl/source

2018-01-08 Thread Jan Holesovsky
 unotools/source/misc/syslocale.cxx |8 
 vcl/source/app/svdata.cxx  |3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit a9e294ff5c8466bd1577ae43b0feaa002f9fd5ab
Author: Jan Holesovsky 
Date:   Fri Jan 5 15:37:29 2018 +0100

lokdialog: Few more places that need to take LOK's LanguageTag into account.

Change-Id: Ida41025c70d45f426304fabe702a3bccd6e2385d
Reviewed-on: https://gerrit.libreoffice.org/47474
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 

diff --git a/unotools/source/misc/syslocale.cxx 
b/unotools/source/misc/syslocale.cxx
index 8dd7a5824982..951ac9e3b4aa 100644
--- a/unotools/source/misc/syslocale.cxx
+++ b/unotools/source/misc/syslocale.cxx
@@ -23,12 +23,14 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+
 #include 
 
 using namespace osl;
@@ -169,11 +171,17 @@ SvtSysLocaleOptions& SvtSysLocale::GetOptions() const
 
 const LanguageTag& SvtSysLocale::GetLanguageTag() const
 {
+if (comphelper::LibreOfficeKit::isActive())
+return comphelper::LibreOfficeKit::getLanguageTag();
+
 return pImpl->aSysLocaleOptions.GetRealLanguageTag();
 }
 
 const LanguageTag& SvtSysLocale::GetUILanguageTag() const
 {
+if (comphelper::LibreOfficeKit::isActive())
+return comphelper::LibreOfficeKit::getLanguageTag();
+
 return pImpl->aSysLocaleOptions.GetRealUILanguageTag();
 }
 
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index 69a9db6d008d..8d5d329a7478 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -19,6 +19,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -165,7 +166,7 @@ vcl::Window *ImplGetDefaultContextWindow()
 const std::locale& ImplGetResLocale()
 {
 ImplSVData* pSVData = ImplGetSVData();
-if (!pSVData->mbResLocaleSet)
+if (!pSVData->mbResLocaleSet || comphelper::LibreOfficeKit::isActive())
 {
 pSVData->maResLocale = Translate::Create("vcl");
 pSVData->mbResLocaleSet = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-12-23 Thread Caolán McNamara
 unotools/source/misc/datetime.cxx |   65 ++
 1 file changed, 39 insertions(+), 26 deletions(-)

New commits:
commit 87114b364cdee276b81c21af2538c5612a1ce5d2
Author: Caolán McNamara 
Date:   Fri Dec 22 21:20:58 2017 +

ofz#4722 Integer-overflow

Change-Id: I772ff6e6758610e7fa746f5e9b308accdea8159e
Reviewed-on: https://gerrit.libreoffice.org/46997
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/unotools/source/misc/datetime.cxx 
b/unotools/source/misc/datetime.cxx
index b0c1afce82eb..789e1ad8143a 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -27,15 +27,8 @@
 
 namespace
 {
-/** convert string to number with optional min and max values */
-template 
-bool convertNumber( T& rValue,
-const OUString& rString,
-T /*nMin*/ = -1, T /*nMax*/ = -1)
+bool checkAllNumber(const OUString& rString)
 {
-bool bNeg = false;
-rValue = 0;
-
 sal_Int32 nPos = 0;
 sal_Int32 nLen = rString.getLength();
 
@@ -44,28 +37,48 @@ namespace
 nPos++;
 
 if( nPos < nLen && '-' == rString[nPos] )
-{
-bNeg = true;
 nPos++;
-}
 
 // get number
 while( nPos < nLen &&
'0' <= rString[nPos] &&
'9' >= rString[nPos] )
 {
-// TODO: check overflow!
-rValue *= 10;
-rValue += (rString[nPos] - u'0');
 nPos++;
 }
 
-if( bNeg )
-rValue *= -1;
-
 return nPos == nLen;
 }
 
+/** convert string to number with optional min and max values */
+bool convertNumber32(sal_Int32& rValue,
+ const OUString& rString,
+ sal_Int32 /*nMin*/ = -1, sal_Int32 /*nMax*/ = -1)
+{
+if (!checkAllNumber(rString))
+{
+rValue = 0;
+return false;
+}
+
+rValue = rString.toInt32();
+return true;
+}
+
+bool convertNumber64(sal_Int64& rValue,
+ const OUString& rString,
+ sal_Int64 /*nMin*/ = -1, sal_Int64 /*nMax*/ = -1)
+{
+if (!checkAllNumber(rString))
+{
+rValue = 0;
+return false;
+}
+
+rValue = rString.toInt64();
+return true;
+}
+
 // although the standard calls for fixed-length (zero-padded) tokens
 // (in their integer part), we are here liberal and allow shorter tokens
 // (when there are separators, else it is ambiguous).
@@ -319,13 +332,13 @@ bool ISO8601parseDate(const OUString , 
css::util::Date& rDate)
 else
 {
 sal_Int32 n = 0;
-if ( !convertNumber( nYear, aDateStr.getToken( 0, '-', n ), 
0,  ) )
+if ( !convertNumber32( nYear, aDateStr.getToken( 0, '-', n ), 0,  
) )
 bSuccess = false;
 if ( nDateTokens >= 2 )
-if ( !convertNumber( nMonth, aDateStr.getToken( 0, '-', 
n ), 0, 12 ) )
+if ( !convertNumber32( nMonth, aDateStr.getToken( 0, '-', n ), 0, 
12 ) )
 bSuccess = false;
 if ( nDateTokens >= 3 )
-if ( !convertNumber( nDay, aDateStr.getToken( 0, '-', n 
), 0, 31 ) )
+if ( !convertNumber32( nDay, aDateStr.getToken( 0, '-', n ), 0, 31 
) )
 bSuccess = false;
 }
 
@@ -359,12 +372,12 @@ bool ISO8601parseTime(const OUString , 
css::util::Time& rTime)
 if ( bFrac && n < aTimeStr.getLength())
 // is it junk or the timezone?
 bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz);
-if (bSuccess && (bSuccess = convertNumber( nHour, tokInt, 
0, 23 )) )
+if (bSuccess && (bSuccess = convertNumber32( nHour, tokInt, 0, 23 )) )
 {
 if (bFrac)
 {
 sal_Int64 fracNumerator;
-if ( (bSuccess = convertNumber(fracNumerator, tokFrac)) )
+if ( (bSuccess = convertNumber64(fracNumerator, tokFrac)) )
 {
 double frac = static_cast(fracNumerator) / 
pow(static_cast(10), static_cast(tokFrac.getLength()));
 // minutes
@@ -395,12 +408,12 @@ bool ISO8601parseTime(const OUString , 
css::util::Time& rTime)
 if ( bFrac && n < aTimeStr.getLength())
 // is it junk or the timezone?
 bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz);
-if (bSuccess && (bSuccess = convertNumber( nMin, tokInt, 0, 
59 )) )
+if (bSuccess && (bSuccess = convertNumber32( nMin, tokInt, 0, 59 )) )
 {
 if (bFrac)
 {
 sal_Int64 fracNumerator;
-if ( (bSuccess = convertNumber(fracNumerator, tokFrac)) 

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

2017-11-08 Thread Caolán McNamara
 unotools/source/config/fontcfg.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit a8b8841f9f52ae1f31a7c54092ab13d02957c665
Author: Caolán McNamara 
Date:   Wed Nov 8 14:30:48 2017 +

speed up fuzzers a little

Change-Id: I04b66fc32bbcd70484bf3a7eef1c5125b3636fe7
Reviewed-on: https://gerrit.libreoffice.org/44467
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/unotools/source/config/fontcfg.cxx 
b/unotools/source/config/fontcfg.cxx
index 91aa70272eff..0e4dac43ce2d 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -98,6 +99,8 @@ DefaultFontConfiguration& DefaultFontConfiguration::get()
 
 DefaultFontConfiguration::DefaultFontConfiguration()
 {
+if (utl::ConfigManager::IsAvoidConfig())
+return;
 // create configuration hierarchical access name
 try
 {
@@ -349,6 +352,8 @@ FontSubstConfiguration& FontSubstConfiguration::get()
 FontSubstConfiguration::FontSubstConfiguration() :
 maSubstHash( 300 )
 {
+if (utl::ConfigManager::IsAvoidConfig())
+return;
 try
 {
 // get service provider
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-05 Thread Mike Kaganski
 unotools/source/i18n/charclass.cxx |   72 +
 1 file changed, 18 insertions(+), 54 deletions(-)

New commits:
commit 5a963595c987880066b045fc66f4c7487b51ae85
Author: Mike Kaganski 
Date:   Mon Nov 6 07:36:41 2017 +0300

CharClass: simplify methods a little

Change-Id: I40516d82e79c0585f828e76f005af269fad75aa5
Reviewed-on: https://gerrit.libreoffice.org/44338
Reviewed-by: Noel Grandin 
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/unotools/source/i18n/charclass.cxx 
b/unotools/source/i18n/charclass.cxx
index 8cdabfcd0f9d..46926118a53b 100644
--- a/unotools/source/i18n/charclass.cxx
+++ b/unotools/source/i18n/charclass.cxx
@@ -115,14 +115,12 @@ bool CharClass::isAlpha( const OUString& rStr, sal_Int32 
nPos ) const
 if ( xCC.is() )
 return  (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
  nCharClassAlphaType) != 0;
-else
-return false;
 }
 catch ( const Exception& )
 {
 SAL_WARN( "unotools.i18n", "isAlpha: Exception caught!" );
-return false;
 }
+return false;
 }
 
 bool CharClass::isLetter( const OUString& rStr, sal_Int32 nPos ) const
@@ -136,14 +134,12 @@ bool CharClass::isLetter( const OUString& rStr, sal_Int32 
nPos ) const
 if ( xCC.is() )
 return  (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
  nCharClassLetterType) != 0;
-else
-return false;
 }
 catch ( const Exception& )
 {
 SAL_WARN( "unotools.i18n", "isLetter: Exception caught!" );
-return false;
 }
+return false;
 }
 
 bool CharClass::isLetter( const OUString& rStr ) const
@@ -152,14 +148,12 @@ bool CharClass::isLetter( const OUString& rStr ) const
 {
 if ( xCC.is() )
 return isLetterType( xCC->getStringType( rStr, 0, 
rStr.getLength(), getMyLocale() ) );
-else
-return false;
 }
 catch ( const Exception& )
 {
 SAL_WARN( "unotools.i18n", "isLetter: Exception caught!" );
-return false;
 }
+return false;
 }
 
 bool CharClass::isDigit( const OUString& rStr, sal_Int32 nPos ) const
@@ -173,14 +167,12 @@ bool CharClass::isDigit( const OUString& rStr, sal_Int32 
nPos ) const
 if ( xCC.is() )
 return  (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
  KCharacterType::DIGIT) != 0;
-else
-return false;
 }
 catch ( const Exception& )
 {
 SAL_WARN( "unotools.i18n", "isDigit: Exception caught!" );
-return false;
 }
+return false;
 }
 
 bool CharClass::isNumeric( const OUString& rStr ) const
@@ -189,14 +181,12 @@ bool CharClass::isNumeric( const OUString& rStr ) const
 {
 if ( xCC.is() )
 return isNumericType( xCC->getStringType( rStr, 0, 
rStr.getLength(), getMyLocale() ) );
-else
-return false;
 }
 catch ( const Exception& )
 {
 SAL_WARN( "unotools.i18n", "isNumeric: Exception caught!" );
-return false;
 }
+return false;
 }
 
 bool CharClass::isAlphaNumeric( const OUString& rStr, sal_Int32 nPos ) const
@@ -210,14 +200,12 @@ bool CharClass::isAlphaNumeric( const OUString& rStr, 
sal_Int32 nPos ) const
 if ( xCC.is() )
 return  (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
 (nCharClassAlphaType | KCharacterType::DIGIT)) != 0;
-else
-return false;
 }
 catch ( const Exception& )
 {
 SAL_WARN( "unotools.i18n", "isAlphaNumeric: Exception caught!" );
-return false;
 }
+return false;
 }
 
 bool CharClass::isLetterNumeric( const OUString& rStr, sal_Int32 nPos ) const
@@ -231,14 +219,12 @@ bool CharClass::isLetterNumeric( const OUString& rStr, 
sal_Int32 nPos ) const
 if ( xCC.is() )
 return  (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
  (nCharClassLetterType | KCharacterType::DIGIT)) != 0;
-else
-return false;
 }
 catch ( const Exception& )
 {
 SAL_WARN( "unotools.i18n", "isLetterNumeric: Exception caught!" );
-return false;
 }
+return false;
 }
 
 bool CharClass::isLetterNumeric( const OUString& rStr ) const
@@ -247,14 +233,12 @@ bool CharClass::isLetterNumeric( const OUString& rStr ) 
const
 {
 if ( xCC.is() )
 return isLetterNumericType( xCC->getStringType( rStr, 0, 
rStr.getLength(), getMyLocale() ) );
-else
-return false;
 }
 catch ( const Exception& )
 {
 SAL_WARN( "unotools.i18n", "isLetterNumeric: Exception caught!" );
-return false;
 }
+return false;
 }
 
 OUString CharClass::titlecase(const OUString& rStr, sal_Int32 nPos, sal_Int32 

  1   2   >