core.git: svl/source

2024-09-06 Thread Mike Kaganski (via logerrit)
 svl/source/items/itempool.cxx |   10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

New commits:
commit 2c7358f5d2618c3f13b94752808d7073bf80cde5
Author: Mike Kaganski 
AuthorDate: Fri Sep 6 07:26:53 2024 +0200
Commit: Mike Kaganski 
CommitDate: Fri Sep 6 09:36:43 2024 +0200

Deduplicate some code

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

diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index 8471e2050d19..ea9166c37618 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -898,15 +898,7 @@ void SfxItemPool::GetItemSurrogatesForItem(ItemSurrogates& 
rTarget, SfxItemType
 void SfxItemPool::GetItemSurrogatesForItem(ItemSurrogates& rTarget, const 
SfxPoolItem& rItem) const
 {
 assert(rItem.isNameOrIndex() && "ITEM: only Items derived from NameOrIndex 
supported for this mechanism (!)");
-rTarget.clear();
-const registeredNameOrIndex& 
rRegistered(GetMasterPool()->maRegisteredNameOrIndex);
-registeredNameOrIndex::const_iterator 
aHit(rRegistered.find(rItem.ItemType()));
-if (aHit != rRegistered.end())
-{
-rTarget.reserve(aHit->second.size());
-for (const auto& entry : aHit->second)
-rTarget.push_back(entry.first);
-}
+GetItemSurrogatesForItem(rTarget, rItem.ItemType());
 }
 
 void SfxItemPool::GetItemSurrogates(ItemSurrogates& rTarget, sal_uInt16 
nWhich) const


core.git: svl/source

2024-09-04 Thread Eloi Montañés (via logerrit)
 svl/source/crypto/cryptosign.cxx |  153 +++
 1 file changed, 78 insertions(+), 75 deletions(-)

New commits:
commit 16a9df36380a24380d4eee77bee3c36223661907
Author: Eloi Montañés 
AuthorDate: Thu Aug 1 20:41:13 2024 +0200
Commit: Michael Stahl 
CommitDate: Wed Sep 4 10:46:25 2024 +0200

Fix signature hash on NSS backend

When using the NSS backend, the SignedAttributes were added after the hash
computation for the timestamp request, altering the final signature and
rendering the timestamp unverifiable.
This patch changes the order in which the attributes are added and uses a 
copy
of the signer for the hash computation in order to generate a correct hash.

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

diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index 52f4e4e021b2..7b410b38b32d 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -988,6 +988,81 @@ bool Signing::Sign(OStringBuffer& rCMSHexBuffer)
 
 OString pass(OUStringToOString( m_aSignPassword, RTL_TEXTENCODING_UTF8 ));
 
+// Add the signing certificate as a signed attribute.
+ESSCertIDv2* aCertIDs[2];
+ESSCertIDv2 aCertID;
+// Write ESSCertIDv2.hashAlgorithm.
+aCertID.hashAlgorithm.algorithm.data = nullptr;
+aCertID.hashAlgorithm.parameters.data = nullptr;
+SECOID_SetAlgorithmID(nullptr, &aCertID.hashAlgorithm, SEC_OID_SHA256, 
nullptr);
+comphelper::ScopeGuard aAlgoGuard(
+[&aCertID] () { SECOID_DestroyAlgorithmID(&aCertID.hashAlgorithm, 
false); } );
+// Write ESSCertIDv2.certHash.
+SECItem aCertHashItem;
+auto pDerEncoded = reinterpret_cast(aDerEncoded.getArray());
+std::vector aCertHashResult = 
comphelper::Hash::calculateHash(pDerEncoded, aDerEncoded.getLength(), 
comphelper::HashType::SHA256);
+aCertHashItem.type = siBuffer;
+aCertHashItem.data = aCertHashResult.data();
+aCertHashItem.len = aCertHashResult.size();
+aCertID.certHash = aCertHashItem;
+// Write ESSCertIDv2.issuerSerial.
+IssuerSerial aSerial;
+GeneralName aName;
+aName.name = cert->issuer;
+aSerial.issuer.names = aName;
+aSerial.serialNumber = cert->serialNumber;
+aCertID.issuerSerial = aSerial;
+// Write SigningCertificateV2.certs.
+aCertIDs[0] = &aCertID;
+aCertIDs[1] = nullptr;
+SigningCertificateV2 aCertificate;
+aCertificate.certs = &aCertIDs[0];
+SECItem* pEncodedCertificate = SEC_ASN1EncodeItem(nullptr, nullptr, 
&aCertificate, SigningCertificateV2Template);
+if (!pEncodedCertificate)
+{
+SAL_WARN("svl.crypto", "SEC_ASN1EncodeItem() failed");
+return false;
+}
+
+NSSCMSAttribute aAttribute;
+SECItem aAttributeValues[2];
+SECItem* pAttributeValues[2];
+pAttributeValues[0] = aAttributeValues;
+pAttributeValues[1] = nullptr;
+aAttributeValues[0] = *pEncodedCertificate;
+aAttributeValues[1].type = siBuffer;
+aAttributeValues[1].data = nullptr;
+aAttributeValues[1].len = 0;
+aAttribute.values = pAttributeValues;
+
+SECOidData aOidData;
+aOidData.oid.data = nullptr;
+/*
+ * id-aa-signingCertificateV2 OBJECT IDENTIFIER ::=
+ * { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
+ *   smime(16) id-aa(2) 47 }
+ */
+if (my_SEC_StringToOID(&aOidData.oid, "1.2.840.113549.1.9.16.2.47", 0) != 
SECSuccess)
+{
+SAL_WARN("svl.crypto", "my_SEC_StringToOID() failed");
+return false;
+}
+comphelper::ScopeGuard aGuard(
+[&aOidData] () { SECITEM_FreeItem(&aOidData.oid, false); } );
+aOidData.offset = SEC_OID_UNKNOWN;
+aOidData.desc = "id-aa-signingCertificateV2";
+aOidData.mechanism = CKM_SHA_1;
+aOidData.supportedExtension = UNSUPPORTED_CERT_EXTENSION;
+aAttribute.typeTag = &aOidData;
+aAttribute.type = aOidData.oid;
+aAttribute.encoded = PR_TRUE;
+
+if (my_NSS_CMSSignerInfo_AddAuthAttr(cms_signer, &aAttribute) != 
SECSuccess)
+{
+SAL_WARN("svl.crypto", "my_NSS_CMSSignerInfo_AddAuthAttr() failed");
+return false;
+}
+
 TimeStampReq src;
 OStringBuffer response_buffer;
 TimeStampResp response;
@@ -999,6 +1074,7 @@ bool Signing::Sign(OStringBuffer& rCMSHexBuffer)
 valuesp[1] = nullptr;
 SECOidData typetag;
 
+//NOTE: All signed/authenticated attributes are to be added before the 
following hash computation
 if( !m_aSignTSA.isEmpty() )
 {
 // Create another CMS message with the same contents as cms_msg, 
because it doesn't seem
@@ -1013,6 +1089,8 @@ bool Signing::Sign(OStringBuffer& rCMSHexBuffer)
 return false;
 }
 
+PORT_Memcpy(ts_cms_signer, cms_signer, sizeof(NSSCMSSignerInfo));
+
 SECItem ts_cms_output;
 ts_cms_ou

core.git: svl/source

2024-08-31 Thread Caolán McNamara (via logerrit)
 svl/source/numbers/zforscan.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 25209dbefbb21fcaa9bc00e7ad8ad064cea92e39
Author: Caolán McNamara 
AuthorDate: Thu Aug 22 13:51:03 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sat Aug 31 21:41:08 2024 +0200

cid#1607947 silence Overflowed array index write

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

diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 08f6a8591ef5..272fb10ba4e8 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -1660,10 +1660,13 @@ bool ImpSvNumberformatScan::InsertSymbol( sal_uInt16 & 
nPos, svt::NfSymbolType e
 return false;
 }
 ++nStringsCnt;
-for (size_t i = nStringsCnt; i > nPos; --i)
+sal_uInt16 i = nStringsCnt;
+while (i > nPos)
 {
-nTypeArray[i] = nTypeArray[i-1];
-sStrArray[i] = sStrArray[i-1];
+sal_uInt16 nexti = o3tl::sanitizing_dec(i);
+nTypeArray[i] = nTypeArray[nexti];
+sStrArray[i] = sStrArray[nexti];
+i = nexti;
 }
 }
 ++nResultStringsCnt;


core.git: svl/source

2024-08-16 Thread Caolán McNamara (via logerrit)
 svl/source/misc/inethist.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 898594dc5d90087b6c711551ed698802c99571f2
Author: Caolán McNamara 
AuthorDate: Mon Aug 12 12:40:23 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 16 09:30:08 2024 +0200

cid#1608509 silence Overflowed array index read

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

diff --git a/svl/source/misc/inethist.cxx b/svl/source/misc/inethist.cxx
index dc25d6b0b5a9..12e0b66365cd 100644
--- a/svl/source/misc/inethist.cxx
+++ b/svl/source/misc/inethist.cxx
@@ -181,7 +181,7 @@ sal_uInt16 INetURLHistory_Impl::find (sal_uInt32 nHash) 
const
 
 while ((l < r) && (r < c))
 {
-sal_uInt16 m = (l + r) / 2;
+sal_uInt16 m = ((l + r) / 2) & 0x;
 if (m_pHash[m] == nHash)
 return m;
 


core.git: svl/source

2024-08-12 Thread Mike Kaganski (via logerrit)
 svl/source/misc/sharedstring.cxx |   15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

New commits:
commit a23662fa4a2093c4d7798b8537ef0303b28e83c3
Author: Mike Kaganski 
AuthorDate: Mon Aug 12 13:46:05 2024 +0200
Commit: Mike Kaganski 
CommitDate: Mon Aug 12 17:50:05 2024 +0200

Simplify a bit

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

diff --git a/svl/source/misc/sharedstring.cxx b/svl/source/misc/sharedstring.cxx
index 499136da972f..4edf6dc1039a 100644
--- a/svl/source/misc/sharedstring.cxx
+++ b/svl/source/misc/sharedstring.cxx
@@ -51,18 +51,13 @@ bool SharedString::operator== ( const SharedString& r ) 
const
 if (mpData == r.mpData)
 return true;
 
-if (mpData)
-{
-if (!r.mpData)
-return false;
-
-if (mpData->length != r.mpData->length)
-return false;
+if (!mpData || !r.mpData)
+return false;
 
-return rtl_ustr_reverseCompare_WithLength(mpData->buffer, 
mpData->length, r.mpData->buffer, r.mpData->length) == 0;
-}
+if (mpData->length != r.mpData->length)
+return false;
 
-return !r.mpData;
+return rtl_ustr_reverseCompare_WithLength(mpData->buffer, mpData->length, 
r.mpData->buffer, r.mpData->length) == 0;
 }
 
 }


core.git: svl/source

2024-07-29 Thread Oliver Specht (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 44d129870795da2e370ad5f2f8abc95c5c6873aa
Author: Oliver Specht 
AuthorDate: Thu Jul 25 14:17:06 2024 +0200
Commit: Oliver Specht 
CommitDate: Mon Jul 29 13:30:23 2024 +0200

Use NDEBUG to show/hide m_bDeleted

"#ifndef NDEBUG" is now always used to hide/show member m_bDeleted

Change-Id: I10f5111cd36e13b8101d2a69ed9268bee622344a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171012
Tested-by: Jenkins
Reviewed-by: Oliver Specht 

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 8c7e772a1efd..e580653acb4e 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -166,7 +166,7 @@ SfxPoolItemHolder::~SfxPoolItemHolder()
 getPool().unregisterPoolItemHolder(*this);
 if (nullptr != m_pItem)
 implCleanupItemEntry(m_pItem);
-#ifdef DBG_UTIL
+#ifndef NDEBUG
 m_bDeleted = true;
 #endif
 }


core.git: svl/source

2024-07-21 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforfind.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit d6030b66f1cfb4b7cf9fc98996bb4674ea495377
Author: Eike Rathke 
AuthorDate: Thu Jul 18 17:51:17 2024 +0200
Commit: Eike Rathke 
CommitDate: Sun Jul 21 13:22:30 2024 +0200

Pull today DateTime out of loop

It's unnecessary to obtain system time twice or thrice and also prevents
different today values when looping over midnight.

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index f4b6e50451b8..9e3a7bc277a7 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1805,9 +1805,10 @@ bool ImpSvNumberInputScan::GetDateRef( double& fDays, 
sal_uInt16& nCounter )
 
 const LocaleDataWrapper* pLoc = mrCurrentLanguageData.GetLocaleData();
 CalendarWrapper* pCal = mrCurrentLanguageData.GetCalendar();
+const DateTime aToday{ DateTime( Date( Date::SYSTEM))};
 for ( int nTryOrder = 1; nTryOrder <= nFormatOrder; nTryOrder++ )
 {
-pCal->setGregorianDateTime( DateTime( Date( Date::SYSTEM ) ) ); // 
today
+pCal->setGregorianDateTime( aToday); // today
 OUString aOrgCalendar; // empty => not changed yet
 DateOrder DateFmt;
 bool bFormatTurn;
@@ -2063,7 +2064,7 @@ input for the following reasons:
 {
 if ( !bHadExact && nExactDateOrder )
 {
-pCal->setGregorianDateTime( DateTime( Date( 
Date::SYSTEM ) ) ); // reset today
+pCal->setGregorianDateTime( aToday); // reset today
 }
 switch (DateFmt)
 {


core.git: svl/source

2024-07-20 Thread Patrick Luby (via logerrit)
 svl/source/items/IndexedStyleSheets.cxx |   15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 926ed71244c20d5a96d0f20b7c4edfb9e645a667
Author: Patrick Luby 
AuthorDate: Thu Jul 18 21:38:01 2024 -0400
Commit: Patrick Luby 
CommitDate: Sat Jul 20 13:01:36 2024 +0200

tdf#161729 clear style sheets in same order as they were added

std::vector::clear() appears to delete elements in the
reverse order added. In the case of tdf#161729, a style
sheet's SfxItemSet can have a parent SfxItemSet and that
parent is the SfxItemSet for a style sheet added later.

Deleting from the end of the vector deletes a style sheet
and its SfxItemSet. If the now deleted SfxItemSet is a
parent SfxItemSet of a style sheet that was added earlier,
the style sheet added earlier will now have an SfxItemSet
with its parent set to an already deleted pointer. And so
a crash will occur when that earlier style sheet is deleted.
rxStyleSheet.clear();

Change-Id: I8ce7023fce8b01432cb3c9288a8f83e7a2f0f2d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170707
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
Reviewed-by: Noel Grandin 

diff --git a/svl/source/items/IndexedStyleSheets.cxx 
b/svl/source/items/IndexedStyleSheets.cxx
index 0db2f201f35f..5d2ddf8299f9 100644
--- a/svl/source/items/IndexedStyleSheets.cxx
+++ b/svl/source/items/IndexedStyleSheets.cxx
@@ -183,8 +183,21 @@ sal_Int32 IndexedStyleSheets::FindStyleSheetPosition(const 
SfxStyleSheetBase& st
 void
 IndexedStyleSheets::Clear(StyleSheetDisposer& disposer)
 {
-for (const auto& rxStyleSheet : mStyleSheets) {
+for (auto& rxStyleSheet : mStyleSheets) {
 disposer.Dispose(rxStyleSheet);
+
+// tdf#161729 clear style sheets in same order as they were added
+// std::vector::clear() appears to delete elements in the
+// reverse order added. In the case of tdf#161729, a style
+// sheet's SfxItemSet can have a parent SfxItemSet and that
+// parent is the SfxItemSet for a style sheet added later.
+// Deleting from the end of the vector deletes a style sheet
+// and its SfxItemSet. If the now deleted SfxItemSet is a
+// parent SfxItemSet of a style sheet that was added earlier,
+// the style sheet added earlier will now have an SfxItemSet
+// with its parent set to an already deleted pointer. And so
+// a crash will occur when that earlier style sheet is deleted.
+rxStyleSheet.clear();
 }
 mStyleSheets.clear();
 mPositionsByName.clear();


core.git: svl/source

2024-07-19 Thread Caolán McNamara (via logerrit)
 svl/source/fsstor/fsstorage.cxx |   19 +--
 svl/source/fsstor/fsstorage.hxx |5 +
 2 files changed, 18 insertions(+), 6 deletions(-)

New commits:
commit ca84e561a0d0bce89258671ab32bcf5fb5a4ca29
Author: Caolán McNamara 
AuthorDate: Fri Jul 19 09:52:37 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jul 19 13:14:25 2024 +0200

cid#1608321 Double lock

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

diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index 95f498b71ce2..a3be4b3f3e80 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -648,12 +648,11 @@ void SAL_CALL FSStorage::renameElement( const OUString& 
aElementName, const OUSt
 }
 }
 
-void SAL_CALL FSStorage::copyElementTo( const OUString& aElementName,
-const uno::Reference< embed::XStorage 
>& xDest,
-const OUString& aNewName )
+void FSStorage::copyElementToImpl(std::unique_lock& /*rGuard*/,
+  std::u16string_view aElementName,
+  const uno::Reference< embed::XStorage >& 
xDest,
+  const OUString& aNewName )
 {
-std::unique_lock aGuard( m_aMutex );
-
 if ( !xDest.is() )
 throw uno::RuntimeException();
 
@@ -719,12 +718,20 @@ void SAL_CALL FSStorage::copyElementTo( const OUString& 
aElementName,
 }
 }
 
+void SAL_CALL FSStorage::copyElementTo( const OUString& aElementName,
+const uno::Reference< embed::XStorage 
>& xDest,
+const OUString& aNewName )
+{
+std::unique_lock aGuard( m_aMutex );
+copyElementToImpl(aGuard, aElementName, xDest, aNewName);
+}
+
 void SAL_CALL FSStorage::moveElementTo( const OUString& aElementName,
 const uno::Reference< embed::XStorage 
>& xDest,
 const OUString& aNewName )
 {
 std::unique_lock aGuard( m_aMutex );
-copyElementTo( aElementName, xDest, aNewName );
+copyElementToImpl(aGuard, aElementName, xDest, aNewName);
 
 INetURLObject aOwnURL( m_aURL );
 aOwnURL.Append( aElementName );
diff --git a/svl/source/fsstor/fsstorage.hxx b/svl/source/fsstor/fsstorage.hxx
index 6b02a9a61b83..8b86ed9b1458 100644
--- a/svl/source/fsstor/fsstorage.hxx
+++ b/svl/source/fsstor/fsstorage.hxx
@@ -179,6 +179,11 @@ private:
 css::uno::Reference< css::io::XStream > openStreamElementImpl(
 std::unique_lock& rGuard,
 std::u16string_view aStreamName, sal_Int32 nOpenMode );
+void copyElementToImpl(std::unique_lock& rGuard,
+std::u16string_view ElementName,
+const css::uno::Reference< css::embed::XStorage >& xDest,
+const OUString& rNewName);
+
 void disposeImpl(std::unique_lock& rGuard);
 };
 


core.git: svl/source

2024-06-18 Thread Andrea Gelmini (via logerrit)
 svl/source/numbers/numfmuno.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 382b4e0a08257efdffa972f832598d28430042d7
Author: Andrea Gelmini 
AuthorDate: Tue Jun 18 22:45:51 2024 +0200
Commit: Julien Nabet 
CommitDate: Wed Jun 19 08:34:21 2024 +0200

Fix typo

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

diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index cf763d9249f5..840187eca4ee 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -425,7 +425,7 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::queryKey( const 
OUString& aFormat,
 // casing. The only clean way is to just use PutEntry() and ignore the
 // duplicate case, which clients can't because the API doesn't provide
 // the information.
-// Try just another possibilty here, without any guarantee.
+// Try just another possibility here, without any guarantee.
 
 // Use only ASCII upper, because keywords are only those.
 // Do not transliterate any quoted literals.


core.git: svl/source

2024-06-12 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8eaea7ee848a68094532522e5f634105cfc42998
Author: Andrea Gelmini 
AuthorDate: Wed Jun 12 16:00:46 2024 +0200
Commit: Julien Nabet 
CommitDate: Wed Jun 12 16:53:43 2024 +0200

Fix typo

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 334fe60e2a70..47831c009b85 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1552,7 +1552,7 @@ void SfxItemSet::MergeItem_Impl(sal_uInt16 nWhich, const 
SfxPoolItem *pFnd2, boo
 }
 else if (IsInvalidItem(pFnd2))
 {
-// 2nd Item is invaid (dontcare)
+// 2nd Item is invalid (dontcare)
 if (!bIgnoreDefaults || *pFnd1 != 
GetPool()->GetUserOrPoolDefaultItem(nWhich))
 {
 // Decision table: set, dontcare, doesn't matter, sal_False


core.git: svl/source

2024-04-28 Thread Szymon Kłos (via logerrit)
 svl/source/numbers/zforlist.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 0a5026b3675154ee216dd87ba46dfe533744eb05
Author: Szymon Kłos 
AuthorDate: Fri Apr 26 12:36:14 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Apr 29 07:58:52 2024 +0200

lok: save correct number format in multi-lang session

Number formats can have different keywords in different
languages: D - Day(EN), T - Tag(DE).
This can cause problem when we use format which will not
be recognized by current number formatter, then we put
unknown keyword as string in quotes. As the result we get
for example: formatCode=""TT."mm".""

The problem exists especially in multi-language setup in LOK
when we use non-English languages:
1. open xlsx using FR
2. join with DE
3. modify number formats in both
4. leave spreadsheet with both so it will be saved
Result: after we open it again we have some keywords as
strings, user has to apply new number format to see the
real value

Signed-off-by: Szymon Kłos 
Change-Id: Ice04d890b38cd2d08d06f41fc7b3cc55f64fadbe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166711
Reviewed-by: Tomaž Vajngerl 
Tested-by: Jenkins

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 54576eb1c230..2d26b1251f3e 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -990,6 +991,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( 
sal_uInt32 nKey, const NfKe
 }
 else
 {
+bool bIsLOK = comphelper::LibreOfficeKit::isActive();
 bool bSystemLanguage = false;
 LanguageType nLang = pEntry->GetLanguage();
 if (nLang == LANGUAGE_SYSTEM)
@@ -997,7 +999,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( 
sal_uInt32 nKey, const NfKe
 bSystemLanguage = true;
 nLang = SvtSysLocale().GetLanguageTag().getLanguageType();
 }
-if (nLang != LANGUAGE_ENGLISH_US)
+if (!bIsLOK && nLang != LANGUAGE_ENGLISH_US)
 {
 sal_Int32 nCheckPos;
 SvNumFormatType nType = SvNumFormatType::DEFINED;


core.git: svl/source

2024-04-14 Thread Caolán McNamara (via logerrit)
 svl/source/items/itemset.cxx |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 7f2283c2986ff94766cc1d2c076fb34a2c88a31a
Author: Caolán McNamara 
AuthorDate: Sat Apr 13 20:42:16 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sun Apr 14 12:34:35 2024 +0200

Related: tdf#160056 1 entry is more common than no entries

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 3be339623ebc..5e361f8ad0b1 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -2292,11 +2292,8 @@ static void isMiss()
 
 sal_uInt16 WhichRangesContainer::getOffsetFromWhich(sal_uInt16 nWhich) const
 {
-if (empty())
-return INVALID_WHICHPAIR_OFFSET;
-
 // special case for single entry - happens often e.g. UI stuff
-if (1 == m_size)
+if (m_size == 1)
 {
 if( m_pairs->first <= nWhich && nWhich <= m_pairs->second )
 return nWhich - m_pairs->first;
@@ -2305,6 +2302,9 @@ sal_uInt16 
WhichRangesContainer::getOffsetFromWhich(sal_uInt16 nWhich) const
 return INVALID_WHICHPAIR_OFFSET;
 }
 
+if (m_size == 0)
+return INVALID_WHICHPAIR_OFFSET;
+
 // check if nWhich is inside last successfully used WhichPair
 if (INVALID_WHICHPAIR_OFFSET != m_aLastWhichPairOffset
 && m_aLastWhichPairFirst <= nWhich
@@ -2350,12 +2350,8 @@ sal_uInt16 
WhichRangesContainer::getOffsetFromWhich(sal_uInt16 nWhich) const
 
 sal_uInt16 WhichRangesContainer::getWhichFromOffset(sal_uInt16 nOffset) const
 {
-// check for empty, if yes, return null which is an invalid WhichID
-if (empty())
-return 0;
-
 // special case for single entry - happens often e.g. UI stuff
-if (1 == m_size)
+if (m_size == 1)
 {
 if (nOffset <= m_pairs->second - m_pairs->first)
 return m_pairs->first + nOffset;
@@ -2364,6 +2360,10 @@ sal_uInt16 
WhichRangesContainer::getWhichFromOffset(sal_uInt16 nOffset) const
 return 0;
 }
 
+// check for empty, if yes, return null which is an invalid WhichID
+if (m_size == 0)
+return 0;
+
 // check if nWhich is inside last successfully used WhichPair
 if (INVALID_WHICHPAIR_OFFSET != m_aLastWhichPairOffset)
 {


core.git: svl/source

2024-03-31 Thread Caolán McNamara (via logerrit)
 svl/source/numbers/zforlist.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit f558872f9184d35c6ef21823645e0297165b2ca5
Author: Caolán McNamara 
AuthorDate: Sat Mar 30 22:08:13 2024 +
Commit: Caolán McNamara 
CommitDate: Sun Mar 31 18:03:46 2024 +0200

crashtesting: crash seen with multiple threads calling GetTheCurrencyTable

seen with soffice --convert-to xlsx forum-mso-en4-207468.xls

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

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 5939e93bd67a..02e48b8468cc 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -3988,6 +3988,7 @@ SvNFEngine::Accessor 
SvNFEngine::GetRWPolicy(SvNFFormatData& rFormatData)
 
 SvNFEngine::Accessor SvNFEngine::GetROPolicy(const SvNFFormatData& 
rFormatData, SvNFFormatData::DefaultFormatKeysMap& rFormatCache)
 {
+SvNumberFormatter::GetTheCurrencyTable(); // create this now so threads 
don't attempt to create it simultaneously
 return
 {
 std::bind(SvNFEngine::GetCLOffsetRO, std::ref(rFormatData), 
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3),


core.git: svl/source

2024-03-25 Thread Caolán McNamara (via logerrit)
 svl/source/numbers/zforscan.hxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 4aeb21ab684aa2de44cb294f7d73491a405ee166
Author: Caolán McNamara 
AuthorDate: Sun Mar 24 20:48:35 2024 +
Commit: Caolán McNamara 
CommitDate: Mon Mar 25 09:38:01 2024 +0100

drop unused method

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

diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx
index 41136c5e5b0b..2613fe02abc3 100644
--- a/svl/source/numbers/zforscan.hxx
+++ b/svl/source/numbers/zforscan.hxx
@@ -66,7 +66,6 @@ public:
 
 const CharClass& GetChrCls() const  { return 
*mrCurrentLanguageData.GetCharClass(); }
 const LocaleDataWrapper& GetLoc() const { return 
*mrCurrentLanguageData.GetLocaleData(); }
-CalendarWrapper& GetCal() const { return 
*mrCurrentLanguageData.GetCalendar(); }
 
 const NfKeywordTable & GetKeywords() const
 {


core.git: svl/source

2024-03-15 Thread Caolán McNamara (via logerrit)
 svl/source/numbers/zforlist.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit ee5b9597605176af0c80f9ea28caac9ba7980254
Author: Caolán McNamara 
AuthorDate: Thu Mar 14 21:14:33 2024 +
Commit: Caolán McNamara 
CommitDate: Fri Mar 15 15:48:09 2024 +0100

Related: tdf#160056 IniLnge is immutable

no lock needed here

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

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 24ecfed891f5..206a0c090d2f 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1286,8 +1286,7 @@ bool SvNumberFormatter::IsNumberFormat(const OUString& 
sString,
 
 LanguageType SvNumberFormatter::GetLanguage() const
 {
-::osl::MutexGuard aGuard( GetInstanceMutex() );
-return IniLnge;
+return IniLnge; // immutable
 }
 
 // static


core.git: svl/source

2024-02-29 Thread Caolán McNamara (via logerrit)
 svl/source/numbers/zforlist.cxx |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 8f7cb2b7474d877af61ab00f6635aec5cefa3d78
Author: Caolán McNamara 
AuthorDate: Thu Feb 29 12:52:22 2024 +
Commit: Caolán McNamara 
CommitDate: Thu Feb 29 16:43:47 2024 +0100

use member init list

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

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index f3a721442858..bdc431efcbdf 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -278,10 +278,11 @@ SvNumberFormatter::SvNumberFormatter( const Reference< 
XComponentContext >& rxCo
 , IniLnge(eLang != LANGUAGE_DONTKNOW ? eLang : UNKNOWN_SUBSTITUTE)
 , ActLnge(IniLnge)
 , maLanguageTag(IniLnge)
+, MaxCLOffset(0)
+, nDefaultSystemCurrencyFormat(NUMBERFORMAT_ENTRY_NOT_FOUND)
+, eEvalDateFormat(NF_EVALDATEFORMAT_INTL)
+, bNoZero(false)
 {
-eEvalDateFormat = NF_EVALDATEFORMAT_INTL;
-nDefaultSystemCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
-
 xCharClass.changeLocale( m_xContext, maLanguageTag );
 xLocaleData.init( m_xContext, maLanguageTag );
 xCalendar.init( m_xContext, maLanguageTag.getLocale() );
@@ -297,11 +298,7 @@ SvNumberFormatter::SvNumberFormatter( const Reference< 
XComponentContext >& rxCo
 
 pStringScanner.reset( new ImpSvNumberInputScan( this ) );
 pFormatScanner.reset( new ImpSvNumberformatScan( this ) );
-pFormatTable = nullptr;
-MaxCLOffset = 0;
 ImpGenerateFormats( 0, false ); // 0 .. 999 for initialized language 
formats
-pMergeTable = nullptr;
-bNoZero = false;
 
 ::osl::MutexGuard aGuard( GetGlobalMutex() );
 GetFormatterRegistry().Insert( this );


core.git: svl/source

2024-02-24 Thread Julien Nabet (via logerrit)
 svl/source/items/srchitem.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit dd5710a8dd4e05059ac248243d950e28d830905d
Author: Julien Nabet 
AuthorDate: Sat Feb 24 09:40:14 2024 +0100
Commit: Julien Nabet 
CommitDate: Sat Feb 24 11:23:20 2024 +0100

tdf#159862: set SearchWildcard to false changes SearchRegularExpression 
value

Like this since 2016 with 3a0abd3019ec3ca29b8f1378cdb32ebf741e6306
add SvxSearchItem::GetWildcard() SetWildcard()

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

diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx
index 1300bf744afa..6aa7c36ddca2 100644
--- a/svl/source/items/srchitem.cxx
+++ b/svl/source/items/srchitem.cxx
@@ -364,7 +364,7 @@ void SvxSearchItem::SetWildcard( bool bVal )
 {
 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::WILDCARD;
 }
-else if ( SearchAlgorithms2::REGEXP == m_aSearchOpt.AlgorithmType2 )
+else if ( SearchAlgorithms2::WILDCARD == m_aSearchOpt.AlgorithmType2 )
 {
 m_aSearchOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE;
 }


core.git: svl/source

2024-02-16 Thread Armin Le Grand (allotropia) (via logerrit)
 svl/source/items/itemset.cxx |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 3c3270c3527ce5bb7653727bc7749e4d58ba64cc
Author: Armin Le Grand (allotropia) 
AuthorDate: Thu Feb 15 19:14:42 2024 +0100
Commit: Armin Le Grand 
CommitDate: Fri Feb 16 17:05:59 2024 +0100

ITEM: Better test for DynamicDefaultItems

Change-Id: Ie18f18655e4ee9ca70580b540678003a12b0465d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163458
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 05ba5672a02c..56cde0aec56c 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -499,13 +499,6 @@ SfxPoolItem const* implCreateItemEntry(SfxItemPool& rPool, 
SfxPoolItem const* pS
 // static default Items can just be used without RefCounting
 return pSource;
 
-if (pSource->isDynamicDefault()
-&& pSource->isSetItem()
-&& static_cast(pSource)->GetItemSet().GetPool() == 
&rPool)
-// only use without RefCounting when SfxSetItem and the Pool is 
correct.
-// all other cases just clone (as before)
-return pSource;
-
 if (0 == pSource->Which())
 {
 // There should be no Items with 0 == WhichID, but there are some
@@ -516,6 +509,14 @@ SfxPoolItem const* implCreateItemEntry(SfxItemPool& rPool, 
SfxPoolItem const* pS
 return pSource->Clone();
 }
 
+if (pSource->isDynamicDefault() && 
rPool.GetPoolDefaultItem(pSource->Which()) == pSource)
+// dynamic defaults are not allowed to 'leave' the Pool they are
+// defined for. We can check by comparing the PoolDefault (the
+// PoolDefaultItem) to pSource by ptr compare (instance). When
+// same Item we can use without RefCount. Else it will be cloned
+// below the standard way.
+return pSource;
+
 #ifdef DBG_UTIL
 // remember WhichID due to being able to assert Clone() error(s)
 const sal_uInt16 nWhich(pSource->Which());


core.git: svl/source

2024-01-27 Thread Noel Grandin (via logerrit)
 svl/source/crypto/cryptosign.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit d2d8f8bf82558d9aa548fb9f13bed410e0baf79b
Author: Noel Grandin 
AuthorDate: Fri Jan 26 12:22:36 2024 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 27 17:44:36 2024 +0100

tdf#159381 TimeStamp(RFC3161) create problem by asn1 format error.

DER rules say that BOOLEAN values are either FALSE (0x00)
or TRUE (0xff)

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

diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index a234afccbc27..3fe6ae90ab34 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -1037,6 +1037,7 @@ bool Signing::Sign(OStringBuffer& rCMSHexBuffer)
 ts_digest.len = aTsHashResult.size();
 
 unsigned char cOne = 1;
+unsigned char cTRUE = 0xff; // under DER rules true is 0xff, false is 
0x00
 src.version.type = siUnsignedInteger;
 src.version.data = &cOne;
 src.version.len = sizeof(cOne);
@@ -1056,8 +1057,8 @@ bool Signing::Sign(OStringBuffer& rCMSHexBuffer)
 src.nonce.len = sizeof(nNonce);
 
 src.certReq.type = siUnsignedInteger;
-src.certReq.data = &cOne;
-src.certReq.len = sizeof(cOne);
+src.certReq.data = &cTRUE;
+src.certReq.len = sizeof(cTRUE);
 
 src.extensions = nullptr;
 


core.git: svl/source

2024-01-25 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1c6d885b7503dd489e6f37132a42db3fbee9c3b8
Author: Andrea Gelmini 
AuthorDate: Thu Jan 25 13:09:36 2024 +0100
Commit: Julien Nabet 
CommitDate: Thu Jan 25 14:16:43 2024 +0100

Fix typo

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index b02a74f53577..1c591f73c60e 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -337,7 +337,7 @@ SfxItemSet::SfxItemSet(SfxItemPool& pool, 
WhichRangesContainer wids)
 // In that case, if the Item is shareable, the new mechanism
 // will kick in: It will start sharing the Item globally,
 // but not immediately: After a defined amount of allowed
-// non-shared ocurrences (look for NUMBER_OF_UNSHARED_INSTANCES)
+// non-shared occurrences (look for NUMBER_OF_UNSHARED_INSTANCES)
 // an instance of the default ItemInstanceManager, a
 // DefaultItemInstanceManager, will be incarnated and used.
 // NOTE: Mixing shared/unshared instances is not a problem (we


core.git: svl/source

2024-01-25 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9fd57de12001cc7b96022c1ec79881d2fcd9b241
Author: Andrea Gelmini 
AuthorDate: Thu Jan 25 13:09:13 2024 +0100
Commit: Julien Nabet 
CommitDate: Thu Jan 25 14:16:01 2024 +0100

Fix typo

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 5760003fbac4..b02a74f53577 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -428,7 +428,7 @@ public:
 }
 
 // here the countdown is zero and there is not yet a 
ItemInstanceManager
-// incarnated. Do so, regsiter and return it
+// incarnated. Do so, register and return it
 assert(nullptr == aHit->second.second);
 DefaultItemInstanceManager* pNew(new 
DefaultItemInstanceManager(aHash));
 aHit->second.second = pNew;


core.git: svl/source

2024-01-25 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 20f72a37309baab11c08f6504f4129ddf6cb8c56
Author: Andrea Gelmini 
AuthorDate: Thu Jan 25 13:08:52 2024 +0100
Commit: Julien Nabet 
CommitDate: Thu Jan 25 14:15:27 2024 +0100

Fix typo

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 54d6c3abbc28..5760003fbac4 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -342,7 +342,7 @@ SfxItemSet::SfxItemSet(SfxItemPool& pool, 
WhichRangesContainer wids)
 // DefaultItemInstanceManager, will be incarnated and used.
 // NOTE: Mixing shared/unshared instances is not a problem (we
 // might even implement a kind of 're-hash' when this kicks in,
-// but is not really needded).
+// but is not really needed).
 // (2) Overload getItemInstanceManager for SfxPoolItem in a class
 // derived from SfxPoolItem and...
 // (2a) Return a static incarnation of DefaultItemInstanceManager to


core.git: svl/source

2024-01-25 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6181be0fca677d1c83e0eccd8be31a0e8cc36ad5
Author: Andrea Gelmini 
AuthorDate: Thu Jan 25 13:08:02 2024 +0100
Commit: Julien Nabet 
CommitDate: Thu Jan 25 14:14:13 2024 +0100

Fix typo

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 1fa7276e9052..54d6c3abbc28 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -327,7 +327,7 @@ SfxItemSet::SfxItemSet(SfxItemPool& pool, 
WhichRangesContainer wids)
 // Class that implements global Item sharing. It uses rtti to
 // associate every Item-derivation with a possible incarnation
 // of a DefaultItemInstanceManager. This is the default, it will
-// give direct implementatioons at the Items that overload
+// give direct implementations at the Items that overload
 // getItemInstanceManager() preference. These are expected to
 // return static instances of a derived implementation of a
 // ItemInstanceManager.


core.git: svl/source

2024-01-25 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e40a864d34a9ed7b80fffb4f11837f9e8f2211e6
Author: Andrea Gelmini 
AuthorDate: Thu Jan 25 13:07:38 2024 +0100
Commit: Julien Nabet 
CommitDate: Thu Jan 25 14:13:53 2024 +0100

Fix typo

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 69a140011ec8..1fa7276e9052 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -411,7 +411,7 @@ public:
 return pNew;
 }
 
-// start countown from NUMBER_OF_UNSHARED_INSTANCES until zero is 
reached
+// start countdown from NUMBER_OF_UNSHARED_INSTANCES until zero is 
reached
 maManagerPerType.insert({aHash, 
std::make_pair(NUMBER_OF_UNSHARED_INSTANCES, nullptr)});
 return nullptr;
 }


core.git: svl/source

2024-01-25 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3db7d3ad5360ac5af903ab0c14e130b95440739f
Author: Andrea Gelmini 
AuthorDate: Thu Jan 25 13:07:14 2024 +0100
Commit: Julien Nabet 
CommitDate: Thu Jan 25 14:13:29 2024 +0100

Fix typo

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index d62f54766698..69a140011ec8 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -329,7 +329,7 @@ SfxItemSet::SfxItemSet(SfxItemPool& pool, 
WhichRangesContainer wids)
 // of a DefaultItemInstanceManager. This is the default, it will
 // give direct implementatioons at the Items that overload
 // getItemInstanceManager() preference. These are expected to
-// return static instances of aderived implementation of a
+// return static instances of a derived implementation of a
 // ItemInstanceManager.
 // All in all there are now the following possibilities to support
 // this for individual Item derivations:


core.git: svl/source

2024-01-24 Thread Caolán McNamara (via logerrit)
 svl/source/items/itemset.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit b840110ffc1c30ba9dd242efd6692d5ae16bbda3
Author: Caolán McNamara 
AuthorDate: Tue Jan 23 21:07:07 2024 +
Commit: Noel Grandin 
CommitDate: Wed Jan 24 09:27:42 2024 +0100

add #include unordered_map

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 5eec0a7a9391..df46011dc2d9 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 


core.git: svl/source

2024-01-20 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 103ad4fc70848443ba95fcb352569b35ccc38070
Author: Andrea Gelmini 
AuthorDate: Sat Jan 20 11:26:57 2024 +0100
Commit: Taichi Haradaguchi <20001...@ymail.ne.jp>
CommitDate: Sat Jan 20 12:47:11 2024 +0100

Fix typo

Change-Id: I26d745efecc29fe28e32dfc6b6a2ebe3c3bfd2e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162329
Tested-by: Jenkins
Reviewed-by: Taichi Haradaguchi  <20001...@ymail.ne.jp>

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 6ac8a60d782b..37566b41e01a 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -127,7 +127,7 @@ const SfxPoolItemHolder& SfxPoolItemHolder::operator=(const 
SfxPoolItemHolder& r
 if (this == &rHolder || *this == rHolder)
 return *this;
 
-// avoid unneccessary unregister/register actions
+// avoid unnecessary unregister/register actions
 const bool bWasRegistered(nullptr != m_pItem && 
getPool().NeedsSurrogateSupport(m_pItem->Which()));
 const bool bWillBeRegistered(nullptr != rHolder.m_pItem && 
rHolder.getPool().NeedsSurrogateSupport(rHolder.m_pItem->Which()));
 


core.git: svl/source

2024-01-10 Thread Kira Tubo (via logerrit)
 svl/source/numbers/numfmuno.cxx |2 +-
 svl/source/numbers/numfmuno.hxx |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 9d7d93bab83f7a421da6c2a3c3d68f54de93ab2b
Author: Kira Tubo 
AuthorDate: Mon Jan 8 20:55:36 2024 -0800
Commit: Ilmari Lauhakangas 
CommitDate: Wed Jan 10 19:05:36 2024 +0100

tdf#114441 Convert sal_uLong to sal_Int32

Update sal_uLong to sal_Int32 for nKey variable. Signed 32 bit variables
have been used for similar variables within numfmuno.cxx and
numfmuno.hxx

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

diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 58094faa54e7..0c68ea5db8a8 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -639,7 +639,7 @@ uno::Sequence SAL_CALL 
SvNumberFormatsObj::getSupportedServiceNames()
 return { "com.sun.star.util.NumberFormats" };
 }
 
-SvNumberFormatObj::SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, 
sal_uLong nK, ::comphelper::SharedMutex _aMutex )
+SvNumberFormatObj::SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, 
sal_Int32 nK, ::comphelper::SharedMutex _aMutex )
 :m_xSupplier( &rParent )
 ,nKey( nK )
 ,m_aMutex(std::move( _aMutex ))
diff --git a/svl/source/numbers/numfmuno.hxx b/svl/source/numbers/numfmuno.hxx
index f88c2e6429af..8e9593d51a64 100644
--- a/svl/source/numbers/numfmuno.hxx
+++ b/svl/source/numbers/numfmuno.hxx
@@ -136,11 +136,11 @@ class SvNumberFormatObj : public cppu::WeakImplHelper<
 private:
 rtl::Reference
 m_xSupplier;
-sal_uLong   nKey;
+sal_Int32   nKey;
 mutable ::comphelper::SharedMutex   m_aMutex;
 
 public:
-SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, sal_uLong nK, 
::comphelper::SharedMutex _aMutex );
+SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, sal_Int32 nK, 
::comphelper::SharedMutex _aMutex );
 virtual ~SvNumberFormatObj() override;
 
 // XPropertySet


core.git: svl/source

2023-12-31 Thread Julien Nabet (via logerrit)
 svl/source/items/itempool.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 21a6641da521e47d12be91afc55eae5836a24e5c
Author: Julien Nabet 
AuthorDate: Sun Dec 31 12:26:36 2023 +0100
Commit: Julien Nabet 
CommitDate: Sun Dec 31 16:29:10 2023 +0100

Replace "size() != 0 with !empty()" (svl)

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

diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index 2b60edf14091..e697a5e9a1f2 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -579,7 +579,7 @@ void SfxItemPool::SetSecondaryPool( SfxItemPool *pPool )
 
 for (sal_uInt16 a(0); a < pImpl->mpSecondary->GetSize_Impl(); 
a++, ppSet++)
 {
-if (nullptr != *ppSet && (*ppSet)->size() != 0)
+if (nullptr != *ppSet && !(*ppSet)->empty())
 {
 SAL_WARN("svl.items", "old secondary pool: " << 
pImpl->mpSecondary->pImpl->aName
 << " of pool: " << pImpl->aName << " 
must be empty.");


core.git: svl/source

2023-12-23 Thread Caolán McNamara (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b803b3a7a1eda1b9862112f399c0a8b988c1f930
Author: Caolán McNamara 
AuthorDate: Sat Dec 23 13:52:09 2023 +
Commit: Caolán McNamara 
CommitDate: Sat Dec 23 15:51:39 2023 +0100

cid#1559884 Uninitialized scalar variable

etc, since:

commit e9e3576ada06d53de12efed041fb309fe5388e01
Date:   Thu Dec 21 22:49:27 2023 +0100

svl: fix build with --enable-debug

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 4a1c6351c7f3..4cadfa6b596e 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -61,7 +61,7 @@ static bool g_bItemClassicMode(getenv("ITEM_CLASSIC_MODE"));
 SfxPoolItemHolder::SfxPoolItemHolder()
 : m_pPool(nullptr)
 , m_pItem(nullptr)
-#ifdef DBG_UTIL
+#ifndef NDEBUG
 , m_bDeleted(false)
 #endif
 {


core.git: svl/source

2023-12-21 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 216548a091c270bdc3048369991aebd82463cf34
Author: Andrea Gelmini 
AuthorDate: Thu Dec 21 23:18:13 2023 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Dec 21 23:34:12 2023 +0100

Fix typo

Change-Id: I61077392776c6bc28410c29586fd8de85347b936
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161143
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Adolfo Jayme Barrientos 

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 12b97ba39d91..4a1c6351c7f3 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -55,7 +55,7 @@ static bool g_bItemClassicMode(getenv("ITEM_CLASSIC_MODE"));
 // I thought about this constructor a while, but when there is no
 // Item we need no cleanup at destruction (what we would need the
 // Pool for), so it is OK and makes default construction easier
-// when no Pool is needed. The other constructors guanantee that
+// when no Pool is needed. The other constructors guarantee that
 // there *cannot* be a state with Item set and Pool not set. IF
 // you change this class, ALWAYS ensure that this can not happen (!)
 SfxPoolItemHolder::SfxPoolItemHolder()


core.git: svl/source

2023-12-10 Thread Sarper Akdemir (via logerrit)
 svl/source/misc/PasswordHelper.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 9bc8918cf00b99f6c4a8f1e3f082e5583a4cd02c
Author: Sarper Akdemir 
AuthorDate: Tue Dec 5 18:50:29 2023 +0300
Commit: Sarper Akdemir 
CommitDate: Sun Dec 10 10:13:31 2023 +0100

add explainer for the reasoning of fMaxPassStrengthEntropyBits

also fixes the typo in the fMaxPassStrengthEntropyBits variable name.

Change-Id: I7c9cfcea7253a3e07428c83008b0c072033f33c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160425
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/svl/source/misc/PasswordHelper.cxx 
b/svl/source/misc/PasswordHelper.cxx
index cfae72f64937..c98a26eff4af 100644
--- a/svl/source/misc/PasswordHelper.cxx
+++ b/svl/source/misc/PasswordHelper.cxx
@@ -136,10 +136,13 @@ bool SvPasswordHelper::CompareHashPassword(const 
uno::Sequence& rOldPa
 
 double SvPasswordHelper::GetPasswordStrengthPercentage(const char* pPassword)
 {
-// Entropy bits corresponding to 100% password strength
-static constexpr double fMaxPassStrengthEntorpyBits = 112.0;
+// Entropy bits ≥ 112 are mapped to 100% password strength.
+// 112 was picked since according to the linked below KeePass help page, it
+// corresponds to a strong password:
+// 

+static constexpr double fMaxPassStrengthEntropyBits = 112.0;
 return std::min(100.0,
-ZxcvbnMatch(pPassword, nullptr, nullptr) * 100.0 / 
fMaxPassStrengthEntorpyBits);
+ZxcvbnMatch(pPassword, nullptr, nullptr) * 100.0 / 
fMaxPassStrengthEntropyBits);
 }
 
 double SvPasswordHelper::GetPasswordStrengthPercentage(const OUString& 
aPassword)


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

2023-11-23 Thread Julien Nabet (via logerrit)
 svl/source/svdde/ddesvr.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit cb753911e3df1531e8b77027fa34e952566052eb
Author: Julien Nabet 
AuthorDate: Thu Nov 23 10:04:27 2023 +0100
Commit: Julien Nabet 
CommitDate: Thu Nov 23 14:40:35 2023 +0100

c++20: use std::erase(_if) instead of std::remove(_if)+erase (svl 2)

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

diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx
index 1ce98b554a6e..327fb9a8f5d3 100644
--- a/svl/source/svdde/ddesvr.cxx
+++ b/svl/source/svdde/ddesvr.cxx
@@ -392,7 +392,7 @@ DdeService::~DdeService()
 DdeInstData* pInst = ImpGetInstData();
 assert(pInst);
 if ( pInst->pServicesSvr )
-pInst->pServicesSvr->erase(std::remove(pInst->pServicesSvr->begin(), 
pInst->pServicesSvr->end(), this), pInst->pServicesSvr->end());
+std::erase(*pInst->pServicesSvr, this);
 
 delete pSysTopic;
 delete pName;
@@ -608,8 +608,7 @@ DdeItem::DdeItem( const DdeItem& r)
 DdeItem::~DdeItem()
 {
 if( pMyTopic )
-pMyTopic->aItems.erase(std::remove(pMyTopic->aItems.begin(),
-   pMyTopic->aItems.end(),this));
+std::erase(pMyTopic->aItems, this);
 delete pName;
 delete pImpData;
 }


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

2023-11-23 Thread Julien Nabet (via logerrit)
 svl/source/filepicker/pickerhistory.cxx |5 +
 svl/source/notify/broadcast.cxx |4 +---
 svl/source/svdde/ddecli.cxx |3 +--
 3 files changed, 3 insertions(+), 9 deletions(-)

New commits:
commit 693735e4d39b92d7a16e855cfd9d99d9d150ea75
Author: Julien Nabet 
AuthorDate: Sun Nov 19 20:51:08 2023 +0100
Commit: Julien Nabet 
CommitDate: Thu Nov 23 09:05:16 2023 +0100

c++20: use std::erase(_if) instead of std::remove(_if)+erase (svl)

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

diff --git a/svl/source/filepicker/pickerhistory.cxx 
b/svl/source/filepicker/pickerhistory.cxx
index 525ac66940a8..4f1584760743 100644
--- a/svl/source/filepicker/pickerhistory.cxx
+++ b/svl/source/filepicker/pickerhistory.cxx
@@ -50,10 +50,7 @@ namespace svt
 return;
 
 // first, check which of the objects we hold in s_aHistory can be 
removed
-_rHistory.erase(std::remove_if(_rHistory.begin(),
-  _rHistory.end(),
-  [](const css::uno::WeakReference< XInterface > & 
x) { return !x.get().is(); }),
-_rHistory.end());
+std::erase_if(_rHistory, [](const css::uno::WeakReference< 
XInterface > & x) { return !x.get().is(); });
 
 // then push_back the picker
 _rHistory.emplace_back( _rxPicker );
diff --git a/svl/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx
index c13cfa3b736e..6b323a669329 100644
--- a/svl/source/notify/broadcast.cxx
+++ b/svl/source/notify/broadcast.cxx
@@ -87,9 +87,7 @@ void SvtBroadcaster::Normalize() const
 // clear empty slots first, because then we often have to do very little 
sorting
 if (mnEmptySlots)
 {
-maListeners.erase(
-std::remove_if(maListeners.begin(), maListeners.end(), [] 
(SvtListener* p) { return isDeletedPtr(p); }),
-maListeners.end());
+std::erase_if(maListeners, [] (SvtListener* p) { return 
isDeletedPtr(p); });
 mnEmptySlots = 0;
 }
 
diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx
index 852d7db9e2e5..7ad4c1e097b3 100644
--- a/svl/source/svdde/ddecli.cxx
+++ b/svl/source/svdde/ddecli.cxx
@@ -256,8 +256,7 @@ DdeTransaction::~DdeTransaction()
 }
 
 delete pName;
-rDde.aTransactions.erase(std::remove(rDde.aTransactions.begin(),
- rDde.aTransactions.end(),this));
+std::erase(rDde.aTransactions,this);
 }
 
 void DdeTransaction::Execute()


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

2023-11-21 Thread Armin Le Grand (allotropia) (via logerrit)
 svl/source/items/itempool.cxx|2 
 svx/source/dialog/framelinkarray.cxx |  206 +--
 2 files changed, 103 insertions(+), 105 deletions(-)

New commits:
commit f7df46c917533d3ce3528d52f49629fe9f51e67b
Author: Armin Le Grand (allotropia) 
AuthorDate: Tue Nov 21 19:57:25 2023 +0100
Commit: Noel Grandin 
CommitDate: Wed Nov 22 07:41:15 2023 +0100

Work with what we have in ArrayImpl: pointers

That allows to not create a local copy on the heap before
being able to check if a change is really necessary

Also added mfOrientation to Cell::operator==, it was missing. Maybe
with C++20 we should more use the default generated op== (or op<=>)
that may turn out to be more safe. For class Cell at least all members
(and sub-members of Style) are simple and simple comparable.

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

diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index f119bc85304f..c2c37c1200fb 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -40,8 +40,6 @@ static size_t nRemainingDirectlyPooledSfxPoolItemCount(0);
 size_t getAllDirectlyPooledSfxPoolItemCount() { return 
nAllDirectlyPooledSfxPoolItemCount; }
 size_t getRemainingDirectlyPooledSfxPoolItemCount() { return 
nRemainingDirectlyPooledSfxPoolItemCount; }
 #endif
-// NOTE: Only needed for one Item in SC, see note in itemset.cxx
-static bool g_bItemClassicMode(getenv("ITEM_CLASSIC_MODE"));
 
 // WhichIDs that need to set _bNeedsPoolRegistration in SfxItemInfo
 // to true to allow a register of all items of that type/with that WhichID
diff --git a/svx/source/dialog/framelinkarray.cxx 
b/svx/source/dialog/framelinkarray.cxx
index afe6a2d7dd51..65e8c8342dfe 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -226,6 +226,7 @@ bool Cell::operator==(const Cell& rOther) const
 && mnAddTop == rOther.mnAddTop
 && mnAddBottom == rOther.mnAddBottom
 && meRotMode == rOther.meRotMode
+&& mfOrientation == rOther.mfOrientation
 && mbOverlapX == rOther.mbOverlapX
 && mbOverlapY == rOther.mbOverlapY;
 }
@@ -280,7 +281,7 @@ struct ArrayImpl
 sal_Int32   GetIndex( sal_Int32 nCol, sal_Int32 nRow ) const
 { return nRow * mnWidth + nCol; }
 
-const Cell& GetCell( sal_Int32 nCol, sal_Int32 nRow ) const;
+const Cell* GetCell( sal_Int32 nCol, sal_Int32 nRow ) const;
 voidPutCell( sal_Int32 nCol, sal_Int32 nRow, const Cell& );
 
 sal_Int32  GetMergedFirstCol( sal_Int32 nCol, sal_Int32 nRow ) 
const;
@@ -288,8 +289,8 @@ struct ArrayImpl
 sal_Int32  GetMergedLastCol( sal_Int32 nCol, sal_Int32 nRow ) 
const;
 sal_Int32  GetMergedLastRow( sal_Int32 nCol, sal_Int32 nRow ) 
const;
 
-const Cell& GetMergedOriginCell( sal_Int32 nCol, sal_Int32 nRow ) 
const;
-const Cell& GetMergedLastCell( sal_Int32 nCol, sal_Int32 nRow ) 
const;
+const Cell* GetMergedOriginCell( sal_Int32 nCol, sal_Int32 nRow ) 
const;
+const Cell* GetMergedLastCell( sal_Int32 nCol, sal_Int32 nRow ) 
const;
 
 boolIsMergedOverlappedLeft( sal_Int32 nCol, sal_Int32 nRow 
) const;
 boolIsMergedOverlappedRight( sal_Int32 nCol, sal_Int32 
nRow ) const;
@@ -367,9 +368,9 @@ Cell* ArrayImpl::createOrFind(const Cell& rCell)
 return pRetval;
 }
 
-const Cell& ArrayImpl::GetCell( sal_Int32 nCol, sal_Int32 nRow ) const
+const Cell* ArrayImpl::GetCell( sal_Int32 nCol, sal_Int32 nRow ) const
 {
-return IsValidPos( nCol, nRow ) ? *maCells[ GetIndex( nCol, nRow ) ] : 
OBJ_CELL_NONE;
+return IsValidPos( nCol, nRow ) ? maCells[ GetIndex( nCol, nRow ) ] : 
&OBJ_CELL_NONE;
 }
 
 void ArrayImpl::PutCell( sal_Int32 nCol, sal_Int32 nRow, const Cell & rCell )
@@ -381,61 +382,61 @@ void ArrayImpl::PutCell( sal_Int32 nCol, sal_Int32 nRow, 
const Cell & rCell )
 sal_Int32 ArrayImpl::GetMergedFirstCol( sal_Int32 nCol, sal_Int32 nRow ) const
 {
 sal_Int32 nFirstCol = nCol;
-while( (nFirstCol > 0) && GetCell( nFirstCol, nRow ).mbOverlapX ) 
--nFirstCol;
+while( (nFirstCol > 0) && GetCell( nFirstCol, nRow )->mbOverlapX ) 
--nFirstCol;
 return nFirstCol;
 }
 
 sal_Int32 ArrayImpl::GetMergedFirstRow( sal_Int32 nCol, sal_Int32 nRow ) const
 {
 sal_Int32 nFirstRow = nRow;
-while( (nFirstRow > 0) && GetCell( nCol, nFirstRow ).mbOverlapY ) 
--nFirstRow;
+while( (nFirstRow > 0) && GetCell( nCol, nFirstRow )->mbOverlapY ) 
--nFirstRow;
 return nFirstRow;
 }
 
 sal_Int32 ArrayImpl::GetMergedLastCol( sal_Int32 nCol, sal_Int32 nRow ) const
 {
 sal_Int32 nLastCol = nCol + 1;
-while( (nLastCol < mnWidth) && GetCell( nLastCol, nRow ).mbOv

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

2023-11-14 Thread Caolán McNamara (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f0481649c526e2ad934482487c2dc7fae49c8031
Author: Caolán McNamara 
AuthorDate: Tue Nov 14 11:21:15 2023 +
Commit: Caolán McNamara 
CommitDate: Tue Nov 14 14:15:35 2023 +0100

cid#1550044 make it more clear that null is returned here

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 802a3255b95d..8c024ae6a768 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -133,7 +133,7 @@ SfxPoolItem const* implCreateItemEntry(SfxItemPool& rPool, 
SfxPoolItem const* pS
 if (nullptr == pSource)
 // SfxItemState::UNKNOWN aka current default (nullptr)
 // just use/return nullptr
-return pSource;
+return nullptr;
 
 if (IsInvalidItem(pSource))
 // SfxItemState::DONTCARE aka invalid item


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

2023-11-08 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f15a5638fb08c331efeaa3237eff16504cb61ac8
Author: Andrea Gelmini 
AuthorDate: Wed Nov 8 22:57:00 2023 +0100
Commit: Julien Nabet 
CommitDate: Thu Nov 9 08:20:10 2023 +0100

Fix typo

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 605dee720ae5..802a3255b95d 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -205,7 +205,7 @@ SfxPoolItem const* implCreateItemEntry(SfxItemPool& rPool, 
SfxPoolItem const* pS
 const sal_uInt16 nIndex(pTargetPool->GetIndex_Impl(nWhich));
 
 // the Item itself is shareable when it already is used somewhere
-// which is equlivalent to be referenced already. IsPooledItem also
+// which is equivalent to be referenced already. IsPooledItem also
 // checked for SFX_ITEMS_MAXREF, that is not needed here. Use a
 // fake 'while' loop and 'break' to make this better readable
 


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

2023-11-08 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 40f71a944e3094d6670c2103e576ac369257606a
Author: Andrea Gelmini 
AuthorDate: Wed Nov 8 22:57:17 2023 +0100
Commit: Julien Nabet 
CommitDate: Thu Nov 9 08:18:35 2023 +0100

Fix typo

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index c3faecabb6f1..605dee720ae5 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -169,7 +169,7 @@ SfxPoolItem const* implCreateItemEntry(SfxItemPool& rPool, 
SfxPoolItem const* pS
 {
 // SlotItems were always cloned in original (even when 
bPassingOwnership),
 // so do that here, too (but without bPassingOwnership).
-// They do not need to be registerd at pool (actually impossible, pools
+// They do not need to be registered at pool (actually impossible, 
pools
 // do not have entries for SlotItems) so handle here early
 if (!bPassingOwnership)
 pSource = pSource->Clone(rPool.GetMasterPool());


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

2023-11-08 Thread Stephan Bergmann (via logerrit)
 svl/source/items/poolitem.cxx |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 79ac262c926ea2845a5ed50d7abe5e9572fbdfc6
Author: Stephan Bergmann 
AuthorDate: Wed Nov 8 11:02:33 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 8 22:50:10 2023 +0100

Avoid initialization-order-fiasco in DBG_UTIL code

...as reported by  during 
e.g.
Gallery_backgrounds, when initializing the global variable

> const Cell OBJ_CELL_NONE;

at svx/source/dialog/framelinkarray.cxx:281,

> ==519895==ERROR: AddressSanitizer: initialization-order-fiasco on address 
0x7fb3dc3e5570 at pc 0x7fb3daee1c56 bp 0x7ffe54584480 sp 0x7ffe54584478
> READ of size 8 at 0x7fb3dc3e5570 thread T0
> #0 0x7fb3daee1c55 in std::_Hashtable, std::__detail::_Identity, 
std::equal_to, std::hash, 
std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, 
std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits >::bucket_count() const 
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/hashtable.h:673:16
> #1 0x7fb3daee1648 in std::__cxx1998::unordered_set, std::equal_to, 
std::allocator >::bucket_count() const 
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unordered_set.h:755:21
> #2 0x7fb3daeb1088 in std::__debug::unordered_set, std::equal_to, 
std::allocator >::insert(SfxPoolItem const*&&) 
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/debug/unordered_set:369:35
> #3 0x7fb3db01987c in SfxPoolItem::SfxPoolItem(unsigned short) 
/svl/source/items/poolitem.cxx:506:28
> #4 0x7fb3cb2fddb4 in svx::frame::(anonymous namespace)::Cell::Cell() 
/svx/source/dialog/framelinkarray.cxx:204:5
> #5 0x7fb3cafa3b6f in __cxx_global_var_init.1 
/svx/source/dialog/framelinkarray.cxx:281:12
> #6 0x7fb3cafa3ba9 in _GLOBAL__sub_I_framelinkarray.cxx 
/svx/source/dialog/framelinkarray.cxx
> #7 0x7fb3e6821f19 in call_init.part.0 
/usr/src/debug/glibc-2.28-225.el8_8.6.x86_64/elf/dl-init.c:72:3
> #8 0x7fb3e6822019 in call_init 
/usr/src/debug/glibc-2.28-225.el8_8.6.x86_64/elf/dl-init.c:118:11
> #9 0x7fb3e6822019 in _dl_init 
/usr/src/debug/glibc-2.28-225.el8_8.6.x86_64/elf/dl-init.c:119:5
> #10 0x7fb3e6836cb9  (/lib64/ld-linux-x86-64.so.2+0x1dcb9)
>
> 0x7fb3dc3e5570 is located 48 bytes inside of global variable 
'incarnatedSfxPoolItems' defined in 
'/home/tdf/lode/jenkins/workspace/lo_ubsan/svl/source/items/poolitem.cxx:473:47'
 (0x7fb3dc3e5540) of size 96
>   registered at:
> #0 0x43c078 in __asan_register_globals.part.0 
/home/tdf/lode/packages/llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_globals.cpp:360:3
> #1 0x7fb3db01e7cb in asan.module_ctor 
(/instdir/program/libsvllo.so+0xb3c7cb)

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

diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index 94ce9ceb2965..49990079367c 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -470,11 +470,16 @@ static size_t nAllocatedSfxPoolItemCount(0);
 static size_t nUsedSfxPoolItemCount(0);
 size_t getAllocatedSfxPoolItemCount() { return nAllocatedSfxPoolItemCount; }
 size_t getUsedSfxPoolItemCount() { return nUsedSfxPoolItemCount; }
-static std::unordered_set incarnatedSfxPoolItems;
+static std::unordered_set& incarnatedSfxPoolItems()
+{
+// Deferred instantiation to avoid initialization-order-fiasco:
+static std::unordered_set items;
+return items;
+}
 void listAllocatedSfxPoolItems()
 {
 SAL_INFO("svl.items", "ITEM: List of still allocated SfxPoolItems:");
-for (const auto& rCandidate : incarnatedSfxPoolItems)
+for (const auto& rCandidate : incarnatedSfxPoolItems())
 {
 SAL_INFO("svl.items", "  ITEM: WhichID: " << rCandidate->Which() << "  
SerialNumber: "
   << 
rCandidate->getSerialNumber()
@@ -503,7 +508,7 @@ SfxPoolItem::SfxPoolItem(sal_uInt16 const nWhich)
 #ifdef DBG_UTIL
 nAllocatedSfxPoolItemCount++;
 nUsedSfxPoolItemCount++;
-incarnatedSfxPoolItems.insert(this);
+incarnatedSfxPoolItems().insert(this);
 #endif
 assert(nWhich <= SHRT_MAX);
 }
@@ -512,7 +517,7 @@ SfxPoolItem::~SfxPoolItem()
 {
 #ifdef DBG_UTIL
 nAllocatedSfxPoolItemCount--;
-incarnatedSfxPoolItems.erase(this);
+incarnatedSfxPoolItems().erase(this);
 m_bDeleted = true;
 #endif
 assert((m_nRefCount == 0 || m_nRefCount > SFX_ITEMS_MAXREF) && "destroying 
item in use");


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

2023-09-09 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 76ac48081838a5ae4e1e2a38b4b7ae621201f9d4
Author: Andrea Gelmini 
AuthorDate: Fri Sep 8 21:33:08 2023 +0200
Commit: Julien Nabet 
CommitDate: Sat Sep 9 10:17:11 2023 +0200

Fix typo

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 344c0b88f5b9..7be410c2bd78 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1233,7 +1233,7 @@ void SfxItemSet::InvalidateItem_ForOffset(sal_uInt16 
nOffset)
 {
 // entry is set
 if (IsInvalidItem(*aFoundOne))
-// already inivalid item, done
+// already invalid item, done
 return;
 
 // cleanup entry


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

2023-09-09 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5589f0de0f3b1e8fafc3fe21015c5292147d308d
Author: Andrea Gelmini 
AuthorDate: Fri Sep 8 21:31:33 2023 +0200
Commit: Julien Nabet 
CommitDate: Sat Sep 9 10:16:48 2023 +0200

Fix typo

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index f8e11582a431..344c0b88f5b9 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -727,13 +727,13 @@ void SfxItemSet::RecreateRanges_Impl(const 
WhichRangesContainer& rNewRanges)
 nNewCount++;
 }
 
-// reset entry, since it got transfered it should not be 
cleaned-up
+// reset entry, since it got transferred it should not be 
cleaned-up
 *aSourceEntry = nullptr;
 }
 }
 }
 
-// free old items: only necessary when not all Items were transfered
+// free old items: only necessary when not all Items were transferred
 if (nNewCount != Count())
 {
 ClearAllItemsImpl();


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

2023-09-09 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9389551e435818da9fb19dbb13786ffc7761651c
Author: Andrea Gelmini 
AuthorDate: Fri Sep 8 21:32:46 2023 +0200
Commit: Julien Nabet 
CommitDate: Sat Sep 9 10:15:39 2023 +0200

Fix typo

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index da3d55274d1f..f8e11582a431 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -432,7 +432,7 @@ const SfxPoolItem* SfxItemSet::PutImpl(const SfxPoolItem& 
rItem, sal_uInt16 nWhi
 sal_uInt16 nOffset(INVALID_WHICHPAIR_OFFSET);
 
 #ifdef _WIN32
-// Win build *insists* for initialzation, triggers warning C4701:
+// Win build *insists* for initialization, triggers warning C4701:
 // "potentially uninitialized local variable 'aEntry' used" for
 // lines below. This is not the case here, but I know of no way
 // to silence the warning in another way


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

2023-09-09 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 545e649e03b3f994757a7f5ca0671eae2d2b9643
Author: Andrea Gelmini 
AuthorDate: Fri Sep 8 21:35:09 2023 +0200
Commit: Julien Nabet 
CommitDate: Sat Sep 9 10:15:13 2023 +0200

Fix typo

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 4037461b82f6..da3d55274d1f 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -569,7 +569,7 @@ void SfxItemSet::PutExtended
 SfxItemStateeDefaultAs  // What will happen to the Default 
Items
 )
 {
-// don't "optimize" with "if( rSource.Count()" because of dont-care + 
defaults
+// don't "optimize" with "if( rSource.Count()" because of dontcare + 
defaults
 const_iterator aSource(rSource.begin());
 const bool bSamePool(GetPool() == rSource.GetPool());
 


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

2023-09-07 Thread Julien Nabet (via logerrit)
 svl/source/items/macitem.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 1806691c91b45b3ee5a52efc585930c41c705127
Author: Julien Nabet 
AuthorDate: Thu Sep 7 11:15:03 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 7 13:47:54 2023 +0200

tdf#141123: impossible to replace an event after it has been set

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

diff --git a/svl/source/items/macitem.cxx b/svl/source/items/macitem.cxx
index 4dae21dd4fc9..0b242c7cffa8 100644
--- a/svl/source/items/macitem.cxx
+++ b/svl/source/items/macitem.cxx
@@ -233,6 +233,10 @@ bool SvxMacroItem::GetPresentation
 
 void SvxMacroItem::SetMacro( SvMacroItemId nEvent, const SvxMacro& rMacro )
 {
+// tdf#141123: emplace doesn't replace the element in the map if already 
exists
+// see https://en.cppreference.com/w/cpp/container/map/emplace
+// so first erase the macro if there's one for this event
+aMacroTable.Erase(nEvent);
 aMacroTable.Insert( nEvent, rMacro);
 }
 


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

2023-08-11 Thread Noel Grandin (via logerrit)
 svl/source/notify/SfxBroadcaster.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit ab4de498475930ba829a23262f82e32df36f1ea2
Author: Noel Grandin 
AuthorDate: Fri Aug 11 14:23:34 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 11 17:42:53 2023 +0200

fix SfxBroadcaster::ForAllListeners

regression from
commit 7c66fc45239d2589e90fd694d54b3ff826b1bd15
Author: Noel Grandin 
Date:   Thu Jun 1 14:22:57 2023 +0200
use internal iterator for SfxBroadcaster

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

diff --git a/svl/source/notify/SfxBroadcaster.cxx 
b/svl/source/notify/SfxBroadcaster.cxx
index e9b0e1e1a552..419c535f56dc 100644
--- a/svl/source/notify/SfxBroadcaster.cxx
+++ b/svl/source/notify/SfxBroadcaster.cxx
@@ -137,7 +137,8 @@ void 
SfxBroadcaster::ForAllListeners(std::function f) const
 {
 SfxListener* const pListener = m_Listeners[i];
 if (pListener)
-f(pListener);
+if (f(pListener))
+break;
 }
 }
 


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

2023-08-07 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itemset.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 616c1da0cc8b345e13bec14b4794e7bab7e1d046
Author: Andrea Gelmini 
AuthorDate: Mon Aug 7 19:47:29 2023 +0200
Commit: Julien Nabet 
CommitDate: Mon Aug 7 23:38:03 2023 +0200

Fix typos

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index bfc8f74b2010..8529efbbef03 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -351,7 +351,7 @@ SfxItemState SfxItemSet::GetItemState_ForWhichID( 
SfxItemState eState, sal_uInt1
 
 SfxItemState SfxItemSet::GetItemState_ForOffset( sal_uInt16 nOffset, const 
SfxPoolItem **ppItem) const
 {
-// check and assert fr iinvaliid offset. The caller is responsible for
+// check and assert from invalid offset. The caller is responsible for
 // ensuring a valid offset (see callers, all checked & safe)
 assert(nOffset < TotalCount());
 SfxPoolItem const** pFoundOne = m_ppItems + nOffset;
@@ -1520,7 +1520,7 @@ sal_uInt16 
WhichRangesContainer::getOffsetFromWhich(sal_uInt16 nWhich) const
 return INVALID_WHICHPAIR_OFFSET;
 }
 
-// check if nWhich is inside last sucessfully used WhichPair
+// check if nWhich is inside last successfully used WhichPair
 if (INVALID_WHICHPAIR_OFFSET != m_aLastWhichPairOffset
 && m_aLastWhichPairFirst <= nWhich
 && nWhich <= m_aLastWhichPairSecond)
@@ -1579,7 +1579,7 @@ sal_uInt16 
WhichRangesContainer::getWhichFromOffset(sal_uInt16 nOffset) const
 return 0;
 }
 
-// check if nWhich is inside last sucessfully used WhichPair
+// check if nWhich is inside last successfully used WhichPair
 if (INVALID_WHICHPAIR_OFFSET != m_aLastWhichPairOffset)
 {
 // only try if we are beyond or at m_aLastWhichPairOffset to
@@ -1604,7 +1604,7 @@ sal_uInt16 
WhichRangesContainer::getWhichFromOffset(sal_uInt16 nOffset) const
 
 // Iterate over WhichPairs in WhichRangesContainer
 // Do not update buffered last hit (m_aLastWhichPair*), these calls
-// are potetially more rare than getOffsetFromWhich calls. Still,
+// are potentially more rare than getOffsetFromWhich calls. Still,
 // it could also be done here
 for( auto const & pPtr : *this )
 {


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

2023-07-17 Thread Mike Kaganski (via logerrit)
 svl/source/items/slstitm.cxx |   40 +---
 1 file changed, 9 insertions(+), 31 deletions(-)

New commits:
commit 5c97c320338da4bb33ea3cf2479079923d8723e3
Author: Mike Kaganski 
AuthorDate: Mon Jul 17 19:29:22 2023 +0200
Commit: Mike Kaganski 
CommitDate: Mon Jul 17 20:27:07 2023 +0200

Simplify a bit

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

diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx
index bf0e37684ba7..02784446ca52 100644
--- a/svl/source/items/slstitm.cxx
+++ b/svl/source/items/slstitm.cxx
@@ -41,8 +41,7 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, const 
std::vectorCount() */ )
 {
-mpList = std::make_shared>();
-*mpList = *pList;
+mpList = std::make_shared>(*pList);
 }
 }
 
@@ -97,26 +96,10 @@ void SfxStringListItem::SetString( const OUString& rStr )
 {
 mpList = std::make_shared>();
 
-sal_Int32 nStart = 0;
 OUString aStr(convertLineEnd(rStr, LINEEND_CR));
-for (;;)
-{
-const sal_Int32 nDelimPos = aStr.indexOf( '\r', nStart );
-if ( nDelimPos < 0 )
-{
-if (nStartpush_back(aStr.copy(nStart));
-}
-break;
-}
-
-mpList->push_back(aStr.copy(nStart, nDelimPos-nStart));
-
-// skip both inserted string and delimiter
-nStart = nDelimPos + 1 ;
-}
+// put last string only if not empty
+for (sal_Int32 nStart = 0; nStart >= 0 && nStart < aStr.getLength();)
+mpList->push_back(aStr.getToken(0, '\r', nStart));
 }
 
 
@@ -133,19 +116,17 @@ OUString SfxStringListItem::GetString()
 if (iter == end)
 break;
 
-aStr.append("\r");
+aStr.append(SAL_NEWLINE_STRING);
 }
 }
-return convertLineEnd(aStr.makeStringAndClear(), GetSystemLineEnd());
+return aStr.makeStringAndClear();
 }
 
 
 void SfxStringListItem::SetStringList( const css::uno::Sequence< OUString >& 
rList )
 {
-mpList = std::make_shared>();
-
-// String belongs to the list
-comphelper::sequenceToContainer(*mpList, rList);
+mpList = std::make_shared>(
+comphelper::sequenceToContainer>(rList));
 }
 
 void SfxStringListItem::GetStringList( css::uno::Sequence< OUString >& rList ) 
const
@@ -175,11 +156,8 @@ bool SfxStringListItem::PutValue( const css::uno::Any& 
rVal, sal_uInt8 )
 // virtual
 bool SfxStringListItem::QueryValue( css::uno::Any& rVal, sal_uInt8 ) const
 {
-// GetString() is not const!!!
-SfxStringListItem* pThis = const_cast< SfxStringListItem * >( this );
-
 css::uno::Sequence< OUString > aStringList;
-pThis->GetStringList( aStringList );
+GetStringList( aStringList );
 rVal <<= aStringList;
 return true;
 }


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

2023-06-28 Thread Mike Kaganski (via logerrit)
 svl/source/items/srchitem.cxx |  252 ++
 1 file changed, 110 insertions(+), 142 deletions(-)

New commits:
commit dbd0f224cfaf669ccfcbf300ccc0c11c904ec037
Author: Mike Kaganski 
AuthorDate: Wed Jun 28 12:08:16 2023 +0300
Commit: Mike Kaganski 
CommitDate: Wed Jun 28 12:43:01 2023 +0200

Simplify SvxSearchItem::PutValue a bit

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

diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx
index d3b2fad7c216..e8447dbb209c 100644
--- a/svl/source/items/srchitem.cxx
+++ b/svl/source/items/srchitem.cxx
@@ -31,6 +31,8 @@
 #include 
 #include 
 
+#include 
+
 using namespace utl;
 using namespace com::sun::star;
 using namespace com::sun::star::beans;
@@ -489,191 +491,157 @@ bool SvxSearchItem::QueryValue( css::uno::Any& rVal, 
sal_uInt8 nMemberId ) const
 bool SvxSearchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
 {
 nMemberId &= ~CONVERT_TWIPS;
-bool bRet = false;
-sal_Int32 nInt = 0;
+auto ExtractNumericAny = [](const css::uno::Any& a, auto& target)
+{
+sal_Int32 nInt;
+if (!(a >>= nInt))
+return false;
+target = static_cast>(nInt);
+return true;
+};
 switch ( nMemberId )
 {
 case 0 :
 {
 Sequence< PropertyValue > aSeq;
-if ( ( rVal >>= aSeq ) && ( aSeq.getLength() == SRCH_PARAMS ) )
+if (!(rVal >>= aSeq) || aSeq.getLength() != SRCH_PARAMS)
+break;
+std::unordered_set aConvertedParams;
+for (const auto& rProp : aSeq)
 {
-sal_Int16 nConvertedCount( 0 );
-for ( const auto& rProp : std::as_const(aSeq) )
+if (rProp.Name == SRCH_PARA_OPTIONS)
 {
-if ( rProp.Name == SRCH_PARA_OPTIONS )
-{
-css::util::SearchOptions2 nTmpSearchOpt2;
-if ( rProp.Value >>= nTmpSearchOpt2 )
-{
-m_aSearchOpt = nTmpSearchOpt2;
-++nConvertedCount;
-}
-}
-else if ( rProp.Name == SRCH_PARA_FAMILY )
-{
-sal_uInt16 nTemp( 0 );
-if ( rProp.Value >>= nTemp )
-{
-m_eFamily = SfxStyleFamily( nTemp );
-++nConvertedCount;
-}
-}
-else if ( rProp.Name == SRCH_PARA_COMMAND )
-{
-sal_uInt16 nTmp;
-if ( rProp.Value >>= nTmp )
-{
-m_nCommand = static_cast(nTmp);
-++nConvertedCount;
-}
-}
-else if ( rProp.Name == SRCH_PARA_CELLTYPE )
+if (css::util::SearchOptions2 nTmpSearchOpt2; rProp.Value 
>>= nTmpSearchOpt2)
 {
-sal_uInt16 nTmp;
-if ( rProp.Value >>= nTmp )
-{
-m_nCellType = static_cast(nTmp);
-++nConvertedCount;
-}
-}
-else if ( rProp.Name == SRCH_PARA_APPFLAG )
-{
-sal_uInt16 nTmp;
-if ( rProp.Value >>= nTmp )
-{
-m_nAppFlag = static_cast(nTmp);
-++nConvertedCount;
-}
-}
-else if ( rProp.Name == SRCH_PARA_ROWDIR )
-{
-if ( rProp.Value >>= m_bRowDirection )
-++nConvertedCount;
-}
-else if ( rProp.Name == SRCH_PARA_ALLTABLES )
-{
-if ( rProp.Value >>= m_bAllTables )
-++nConvertedCount;
-}
-else if ( rProp.Name == SRCH_PARA_SEARCHFILTERED )
-{
-if ( rProp.Value >>= m_bSearchFiltered )
-++nConvertedCount;
-}
-else if ( rProp.Name == SRCH_PARA_SEARCHFORMATTED )
-{
-if ( rProp.Value >>= m_bSearchFormatted )
-++nConvertedCount;
-}
-else if ( rProp.Name == SRCH_PARA_BACKWARD )
-{
-if ( rProp.Value 

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

2023-06-21 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforfind.cxx |2 +-
 svl/source/numbers/zformat.cxx  |   10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 02fc35d879dda6e9c48c89fbb09fe1c618d6673b
Author: Eike Rathke 
AuthorDate: Wed Jun 21 10:57:52 2023 +0200
Commit: Eike Rathke 
CommitDate: Wed Jun 21 13:15:16 2023 +0200

svl: Use DateTime::Sub() instead of operator-()

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index da993232e677..b99f32c1e5b2 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -2265,7 +2265,7 @@ input for the following reasons:
 
 if ( res && pCal->isValid() )
 {
-double fDiff = DateTime(*moNullDate) - pCal->getEpochStart();
+double fDiff = DateTime::Sub( DateTime(*moNullDate), 
pCal->getEpochStart());
 fDays = ::rtl::math::approxFloor( pCal->getLocalDateTime() );
 fDays -= fDiff;
 nTryOrder = nFormatOrder; // break for
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 5128c5cca118..62bd7957d635 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -3228,7 +3228,7 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber,
 case NF_KEY_AMPM:   // AM/PM
 if ( !bCalendarSet )
 {
-double fDiff = DateTime(rScan.GetNullDate()) - 
GetCal().getEpochStart();
+double fDiff = DateTime::Sub( DateTime(rScan.GetNullDate()), 
GetCal().getEpochStart());
 fDiff += fNumberOrig;
 GetCal().setLocalDateTime( fDiff );
 bCalendarSet = true;
@@ -3688,13 +3688,13 @@ static bool lcl_getValidDate( const DateTime& 
rNullDate, const DateTime& rEpochS
 static const DateTime aCE( Date(1,1,1));
 static const DateTime aMin( Date(1,1, SAL_MIN_INT16));
 static const DateTime aMax( Date(31,12, SAL_MAX_INT16), 
tools::Time(23,59,59, tools::Time::nanoSecPerSec - 1));
-static const double fMin = aMin - aCE;
-static const double fMax = aMax - aCE;
+static const double fMin = DateTime::Sub( aMin, aCE);
+static const double fMax = DateTime::Sub( aMax, aCE);
 // Value must be representable in our tools::Date proleptic Gregorian
 // calendar as well.
-const double fOff = (rNullDate - aCE) + fNumber;
+const double fOff = DateTime::Sub( rNullDate, aCE) + fNumber;
 // Add diff between epochs to serial date number.
-const double fDiff = rNullDate - rEpochStart;
+const double fDiff = DateTime::Sub( rNullDate, rEpochStart);
 fNumber += fDiff;
 return fMin <= fOff && fOff <= fMax;
 }


[Libreoffice-commits] core.git: svl/source sw/source

2023-06-10 Thread Caolán McNamara (via logerrit)
 svl/source/config/ctloptions.cxx |3 +++
 sw/source/core/text/inftxt.cxx   |5 ++---
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 8bcdda7e18148a7f4e15bbec0bd0550355b7bd8d
Author: Caolán McNamara 
AuthorDate: Sat Jun 10 17:01:49 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sat Jun 10 22:25:24 2023 +0200

ofz#59696 Abrt

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

diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx
index eb636e0b4009..07c9c67fd654 100644
--- a/svl/source/config/ctloptions.cxx
+++ b/svl/source/config/ctloptions.cxx
@@ -21,6 +21,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -430,6 +431,8 @@ void SvtCTLOptions::SetCTLTextNumerals( 
SvtCTLOptions::TextNumerals _eNumerals )
 
 SvtCTLOptions::TextNumerals SvtCTLOptions::GetCTLTextNumerals()
 {
+if (utl::ConfigManager::IsFuzzing())
+return SvtCTLOptions::NUMERALS_ARABIC;
 return 
static_cast(officecfg::Office::Common::I18N::CTL::CTLTextNumerals::get());
 }
 
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index f67f4e580292..715780f65269 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -19,7 +19,6 @@
 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -1634,8 +1633,8 @@ void SwTextFormatInfo::CtorInitTextFormatInfo( 
OutputDevice* pRenderContext, SwT
 m_nLineNetHeight = 0;
 SetLineStart(TextFrameIndex(0));
 
-SvtCTLOptions::TextNumerals const nTextNumerals = 
!utl::ConfigManager::IsFuzzing() ?
-SvtCTLOptions::GetCTLTextNumerals() : 
SvtCTLOptions::NUMERALS_ARABIC;
+SvtCTLOptions::TextNumerals const nTextNumerals(
+SvtCTLOptions::GetCTLTextNumerals());
 // cannot cache for NUMERALS_CONTEXT because we need to know the string
 // for the whole paragraph now
 if (nTextNumerals != SvtCTLOptions::NUMERALS_CONTEXT)


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

2023-06-01 Thread Miklos Vajna (via logerrit)
 svl/source/items/cenumitm.cxx |2 +-
 svl/source/items/poolitem.cxx |1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit b64cd9c8e0498b8aecc49eba873d2a3fd3065a6a
Author: Miklos Vajna 
AuthorDate: Thu Jun 1 10:51:27 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Jun 1 14:07:07 2023 +0200

sw doc model xml dump: show address of SfxBoolItems

I want to know when a relevant keep-with-next pool item is read, but
there are many of them, so seeing the pointer address is helpful.

Change-Id: I5ff7654430a41eaea6c7b0cf722e34256cdd4d3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152480
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx
index 5b3c57ed2272..713e1608efd8 100644
--- a/svl/source/items/cenumitm.cxx
+++ b/svl/source/items/cenumitm.cxx
@@ -108,8 +108,8 @@ bool SfxBoolItem::GetPresentation(SfxItemPresentation,
 void SfxBoolItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SfxBoolItem"));
-(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), 
BAD_CAST(OString::number(Which()).getStr()));
 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), 
BAD_CAST(GetValueTextByVal(m_bValue).toUtf8().getStr()));
+SfxPoolItem::dumpAsXml(pWriter);
 (void)xmlTextWriterEndElement(pWriter);
 }
 
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index c09b635696d9..9869d9d4fa08 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -535,6 +535,7 @@ bool SfxPoolItem::GetPresentation(
 void SfxPoolItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SfxPoolItem"));
+(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"),
   
BAD_CAST(OString::number(Which()).getStr()));
 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("typeName"),


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

2023-03-14 Thread Andreas Heinisch (via logerrit)
 svl/source/numbers/zforfind.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 34510e6e57e58fb27071564f546bbd420404e66d
Author: Andreas Heinisch 
AuthorDate: Tue Mar 7 16:02:22 2023 +0100
Commit: Eike Rathke 
CommitDate: Tue Mar 14 20:39:33 2023 +

tdf#117037 - Support Unicode minus (0x2212) in the number scanner

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index de5aacf69d2b..da993232e677 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -906,6 +906,7 @@ inline bool ImpSvNumberInputScan::GetTime100SecSep( 
std::u16string_view rString,
  * Read a sign including brackets
  * '+'   =>  1
  * '-'   => -1
+ * u'−'   => -1
  *  '('   => -1, bNegCheck = 1
  * else =>  0
  */
@@ -921,6 +922,8 @@ int ImpSvNumberInputScan::GetSign( std::u16string_view 
rString, sal_Int32& nPos
 bNegCheck = true;
 [[fallthrough]];
 case '-':
+// tdf#117037 - unicode minus (0x2212)
+case u'−':
 nPos++;
 return -1;
 default:


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

2023-03-14 Thread Miklos Vajna (via logerrit)
 svl/source/crypto/cryptosign.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 599722cf77310429a9b9bd2a348486a08b60de0d
Author: Miklos Vajna 
AuthorDate: Mon Mar 13 20:04:17 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Mar 14 07:11:13 2023 +

svl: fix CppunitTest_desktop_lib's DesktopLOKTest::testSignDocument_PEM_PDF

The problem was that this test passed when the entire suite was running,
but not as an individual test.

Digging deeper, this didn't pass in isolation because the test loads a
private key into memory (which is not in the NSS DB) and since commit
5592ee094ca9f09bfcc16537d931518d4e6b2231 (svl: fix
testSignDocument_PEM_PDF with "dbm:" NSS DB, 2022-04-28) we delete that
in-memory key as a workaround for the NSS dbm -> sqlite transition.

Fix the problem by not deleting the in-memory private key in the LOK
case: this makes the test (operating in a stateless mode, with in-memory
keys) pass again and keeps the desktop signing (working with the NSS DB)
working.

I noticed this test failure as a local test update of libxmlsec to 1.3
RC started to fail here even when the whole suite was running, but looks
like this was working by accident before anyway, and the fix doesn't
hurt for libxmlsec 1.2, either.

Change-Id: Id365ddc5c5d04d538609f444c0e3c4ab4b32a6fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148817
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index 1d6337845569..e68ccb8aafda 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -640,7 +641,11 @@ NSSCMSMessage *CreateCMSMessage(const PRTime* time,
 // if it works, and fallback if it doesn't.
 if (SECKEYPrivateKey * pPrivateKey = PK11_FindKeyByAnyCert(cert, nullptr))
 {
-SECKEY_DestroyPrivateKey(pPrivateKey);
+if (!comphelper::LibreOfficeKit::isActive())
+{
+// pPrivateKey only exists in the memory in the LOK case, don't 
delete it.
+SECKEY_DestroyPrivateKey(pPrivateKey);
+}
 *cms_signer = NSS_CMSSignerInfo_Create(result, cert, SEC_OID_SHA256);
 }
 else


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

2023-02-17 Thread Noel Grandin (via logerrit)
 svl/source/passwordcontainer/passwordcontainer.cxx |   51 -
 svl/source/passwordcontainer/passwordcontainer.hxx |6 ++
 2 files changed, 35 insertions(+), 22 deletions(-)

New commits:
commit 49dd32a88d90097a1c50dc64dc42dc35645780b8
Author: Noel Grandin 
AuthorDate: Fri Feb 17 11:28:17 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Feb 17 16:03:40 2023 +

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

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

diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx 
b/svl/source/passwordcontainer/passwordcontainer.cxx
index 7f9cf4944ae7..365f952aa553 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -376,7 +376,7 @@ void StorageItem::ImplCommit()
 PasswordContainer::PasswordContainer( const Reference& 
rxContext )
 {
 // m_pStorageFile->Notify() can be called
-::osl::MutexGuard aGuard( mMutex );
+std::unique_lock aGuard( mMutex );
 
 mComponent.set( rxContext->getServiceManager(), UNO_QUERY );
 mComponent->addEventListener( this );
@@ -389,7 +389,7 @@ PasswordContainer::PasswordContainer( const 
Reference& rxCont
 
 PasswordContainer::~PasswordContainer()
 {
-::osl::MutexGuard aGuard( mMutex );
+std::unique_lock aGuard( mMutex );
 
 m_xStorageFile.reset();
 
@@ -402,7 +402,7 @@ PasswordContainer::~PasswordContainer()
 
 void SAL_CALL PasswordContainer::disposing( const EventObject& )
 {
-::osl::MutexGuard aGuard( mMutex );
+std::unique_lock aGuard( mMutex );
 
 m_xStorageFile.reset();
 
@@ -637,7 +637,7 @@ Sequence< UserRecord > 
PasswordContainer::CopyToUserRecordSequence( const std::v
 
 void SAL_CALL PasswordContainer::add( const OUString& Url, const OUString& 
UserName, const Sequence< OUString >& Passwords, const Reference< 
XInteractionHandler >& aHandler )
 {
-::osl::MutexGuard aGuard( mMutex );
+std::unique_lock aGuard( mMutex );
 
 PrivateAdd( Url, UserName, Passwords, MEMORY_RECORD, aHandler );
 }
@@ -645,7 +645,7 @@ void SAL_CALL PasswordContainer::add( const OUString& Url, 
const OUString& UserN
 
 void SAL_CALL PasswordContainer::addPersistent( const OUString& Url, const 
OUString& UserName, const Sequence< OUString >& Passwords, const Reference< 
XInteractionHandler >& aHandler  )
 {
-::osl::MutexGuard aGuard( mMutex );
+std::unique_lock aGuard( mMutex );
 
 PrivateAdd( Url, UserName, Passwords, PERSISTENT_RECORD, aHandler );
 }
@@ -766,7 +766,7 @@ UrlRecord PasswordContainer::find(
 bool bName, // only needed to support empty user names
 const Reference< XInteractionHandler >& aHandler  )
 {
-::osl::MutexGuard aGuard( mMutex );
+std::unique_lock aGuard( mMutex );
 
 if( !m_aContainer.empty() && !aURL.isEmpty() )
 {
@@ -922,7 +922,7 @@ OUString const & PasswordContainer::GetMasterPassword( 
const Reference< XInterac
 
 void SAL_CALL PasswordContainer::remove( const OUString& aURL, const OUString& 
aName )
 {
-::osl::MutexGuard aGuard( mMutex );
+std::unique_lock aGuard( mMutex );
 
 OUString aUrl( aURL );
 if( m_aContainer.empty() )
@@ -962,7 +962,7 @@ void SAL_CALL PasswordContainer::remove( const OUString& 
aURL, const OUString& a
 
 void SAL_CALL PasswordContainer::removePersistent( const OUString& aURL, const 
OUString& aName )
 {
-::osl::MutexGuard aGuard( mMutex );
+std::unique_lock aGuard( mMutex );
 
 OUString aUrl( aURL );
 if( m_aContainer.empty() )
@@ -1007,8 +1007,12 @@ void SAL_CALL PasswordContainer::removePersistent( const 
OUString& aURL, const O
 
 void SAL_CALL PasswordContainer::removeAllPersistent()
 {
-::osl::MutexGuard aGuard( mMutex );
+std::unique_lock aGuard(mMutex);
+removeAllPersistent(aGuard);
+}
 
+void PasswordContainer::removeAllPersistent(std::unique_lock& 
/*rGuard*/)
+{
 if( m_xStorageFile )
 m_xStorageFile->clear();
 
@@ -1046,7 +1050,7 @@ Sequence< UrlRecord > SAL_CALL 
PasswordContainer::getAllPersistent( const Refere
 {
 Sequence< UrlRecord > aResult;
 
-::osl::MutexGuard aGuard( mMutex );
+std::unique_lock aGuard( mMutex );
 for( const auto& rEntry : m_aContainer )
 {
 Sequence< UserRecord > aUsers;
@@ -1075,7 +1079,7 @@ sal_Bool SAL_CALL 
PasswordContainer::authorizateWithMasterPassword( const uno::R
 bool bResult = false;
 OUString aEncodedMP, aEncodedMPIV;
 uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler;
-::osl::MutexGuard aGuard( mMutex );
+std::unique_lock aGuard( mMutex );
 
 // the method should fail if there is no master password
 if( m_xStorageFile && m_xStorageFile->useStorage() && 
m_xStorageFile->getEncodedMasterPassword( aEncodedMP, aEncodedMPIV ) )
@@ -1133,7 +1137,7 @@ sal_Bool SAL_CALL 
PasswordContainer::changeMasterPassword( cons

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

2023-02-15 Thread Noel Grandin (via logerrit)
 svl/source/fsstor/fsstorage.cxx |   88 ++--
 svl/source/fsstor/fsstorage.hxx |   17 +--
 2 files changed, 63 insertions(+), 42 deletions(-)

New commits:
commit a38f13e364f9416a1a6d1163eba431eb1c6d5908
Author: Noel Grandin 
AuthorDate: Wed Feb 15 18:47:57 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Feb 16 07:23:57 2023 +

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

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

diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index 68e82feb0121..65e243d7ddad 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -75,10 +75,10 @@ FSStorage::FSStorage( const ::ucbhelper::Content& aContent,
 
 FSStorage::~FSStorage()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 osl_atomic_increment(&m_refCount); // to call dispose
 try {
-dispose();
+disposeImpl(aGuard);
 }
 catch( uno::RuntimeException& )
 {}
@@ -103,7 +103,7 @@ bool FSStorage::MakeFolderNoUI( std::u16string_view rFolder 
)
 
 ucbhelper::Content& FSStorage::GetContent()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 return m_aContent;
 }
 
@@ -244,14 +244,14 @@ uno::Sequence< sal_Int8 > SAL_CALL 
FSStorage::getImplementationId()
 
 void SAL_CALL FSStorage::copyToStorage( const uno::Reference< embed::XStorage 
>& xDest )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( !xDest.is() || xDest == uno::Reference< uno::XInterface >( 
static_cast< OWeakObject*> ( this ), uno::UNO_QUERY ) )
 throw lang::IllegalArgumentException(); // TODO:
 
 try
 {
-CopyContentToStorage_Impl( GetContent(), xDest );
+CopyContentToStorage_Impl( m_aContent, xDest );
 }
 catch( embed::InvalidStorageException& )
 {
@@ -285,8 +285,14 @@ void SAL_CALL FSStorage::copyToStorage( const 
uno::Reference< embed::XStorage >&
 uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement(
 const OUString& aStreamName, sal_Int32 nOpenMode )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
+return openStreamElementImpl(aGuard, aStreamName, nOpenMode);
+}
 
+uno::Reference< io::XStream > FSStorage::openStreamElementImpl(
+std::unique_lock& /*rGuard*/,
+std::u16string_view aStreamName, sal_Int32 nOpenMode )
+{
 // TODO/LATER: may need possibility to create folder if it was removed, 
since the folder can not be locked
 INetURLObject aFileURL( m_aURL );
 aFileURL.Append( aStreamName );
@@ -383,8 +389,14 @@ uno::Reference< io::XStream > SAL_CALL 
FSStorage::openEncryptedStreamElement(
 uno::Reference< embed::XStorage > SAL_CALL FSStorage::openStorageElement(
 const OUString& aStorName, sal_Int32 nStorageMode )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
+return openStorageElementImpl(aGuard, aStorName, nStorageMode);
+}
 
+uno::Reference< embed::XStorage > FSStorage::openStorageElementImpl(
+std::unique_lock& /*rGuard*/,
+std::u16string_view aStorName, sal_Int32 nStorageMode )
+{
 if ( ( nStorageMode & embed::ElementModes::WRITE )
   && !( m_nMode & embed::ElementModes::WRITE ) )
   throw io::IOException(); // TODO: error handling
@@ -460,7 +472,7 @@ uno::Reference< embed::XStorage > SAL_CALL 
FSStorage::openStorageElement(
 
 uno::Reference< io::XStream > SAL_CALL FSStorage::cloneStreamElement( const 
OUString& aStreamName )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 // TODO/LATER: may need possibility to create folder if it was removed, 
since the folder can not be locked
 INetURLObject aFileURL( m_aURL );
@@ -532,7 +544,7 @@ void SAL_CALL FSStorage::copyStorageElementLastCommitTo(
 const OUString& aStorName,
 const uno::Reference< embed::XStorage >& xTargetStorage )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 uno::Reference< embed::XStorage > xSourceStor( openStorageElement( 
aStorName, embed::ElementModes::READ ),
 uno::UNO_SET_THROW );
@@ -541,7 +553,7 @@ void SAL_CALL FSStorage::copyStorageElementLastCommitTo(
 
 sal_Bool SAL_CALL FSStorage::isStreamElement( const OUString& aElementName )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 INetURLObject aURL( m_aURL );
 aURL.Append( aElementName );
@@ -551,7 +563,7 @@ sal_Bool SAL_CALL FSStorage::isStreamElement( const 
OUString& aElementName )
 
 sal_Bool SAL_CALL FSStorage::isStorageElement( const OUString& aElementName )
 {
-::osl::MutexGuard aGuard( m

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

2022-12-18 Thread Caolán McNamara (via logerrit)
 svl/source/numbers/zforlist.cxx  |5 -
 xmloff/source/style/xmlnumfe.cxx |3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 68809ffde7d50a5f47afa5a1235025513762df8c
Author: Caolán McNamara 
AuthorDate: Fri Dec 16 11:29:56 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Dec 18 10:41:30 2022 +

crashtesting: assert seen with forum-mso-en4-747641.xlsx with LCID F6E0B

see on export to ods

input .xlsx contains a LCID of F6E0B



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

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index c43e124bbadd..cee75fc9265e 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -3991,7 +3991,10 @@ const NfCurrencyEntry* 
SvNumberFormatter::GetCurrencyEntry( bool & bFoundBank,
 }
 else
 {
-eExtLang = LanguageType((nExtLang < 0) ? -nExtLang : nExtLang);
+if (nExtLang < 0)
+nExtLang = -nExtLang;
+SAL_WARN_IF(nExtLang > 0x, "svl.numbers", "Out of range Lang 
Id: " << nExtLang << " from input string: " << OUString(rExtension));
+eExtLang = LanguageType(nExtLang & 0x);
 }
 }
 else
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index a2938b1d998d..01367fe12e55 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -362,7 +362,8 @@ void SvXMLNumFmtExport::WriteCurrencyElement_Impl( const 
OUString& rString,
 sal_Int32 nLang = o3tl::toInt32(rExt, 16);
 if ( nLang < 0 )
 nLang = -nLang;
-AddLanguageAttr_Impl( LanguageType(nLang) );  // adds to 
pAttrList
+SAL_WARN_IF(nLang > 0x, "xmloff.style", "Out of range Lang Id: " 
<< nLang << " from input string: " << OUString(rExt));
+AddLanguageAttr_Impl( LanguageType(nLang & 0x) );  // adds 
to pAttrList
 }
 
 SvXMLElementExport aElem( rExport,


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

2022-12-13 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforlist.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 0517ef1669dba0e055b8ef3cf09a4b40378e476f
Author: Eike Rathke 
AuthorDate: Wed Dec 14 01:08:25 2022 +0100
Commit: Eike Rathke 
CommitDate: Wed Dec 14 01:09:43 2022 +

It's unnecessary to obtain what's not being used

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

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index eb360c5b0ad6..c43e124bbadd 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1718,12 +1718,15 @@ void SvNumberFormatter::GetInputLineString(const 
double& fOutNumber,
 bPrecChanged = true;
 }
 
-sal_uInt32 nKey = GetEditFormat( fOutNumber, nRealKey, eType, pFormat,
- bForceSystemLocale ? LANGUAGE_SYSTEM : 
LANGUAGE_DONTKNOW);
 // if bFiltering true keep the nRealKey format
-if ( nKey != nRealKey && !bFiltering )
+if (!bFiltering)
 {
-pFormat = GetFormatEntry( nKey );
+sal_uInt32 nKey = GetEditFormat( fOutNumber, nRealKey, eType, pFormat,
+ bForceSystemLocale ? LANGUAGE_SYSTEM 
: LANGUAGE_DONTKNOW);
+if (nKey != nRealKey)
+{
+pFormat = GetFormatEntry( nKey );
+}
 }
 assert(pFormat);
 if (pFormat)


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

2022-12-13 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforlist.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit d5986b163276008d2a15a10f7de529d924b60d2f
Author: Eike Rathke 
AuthorDate: Tue Dec 13 21:46:23 2022 +0100
Commit: Eike Rathke 
CommitDate: Tue Dec 13 22:14:20 2022 +

crashtesting: (assert) fix treatment of "#FMT" input line value

For "#FMT" test the original format type for not being NUMBER, the current
format type may be different from finding an edit format.

This constellation did not matter until

commit 4fd1333ba4bb4f2311e9098291154772bd310429
CommitDate: Thu Mar 25 15:00:31 2021 +0100

tdf#140968 tdf#140978 XLSX import: fix lost rounded filters

introduced the bFiltering parameter in which case the edit format is not
used (and bFiltering is also set when collecting the filter entries for
.xls export). In fact the logic should be changed such that obtaining
the edit format isn't even executed in that case. For now just fix the
"#FMT" case to be backported.

Also, the bool return of
SvNumberformat::GetOutputString(double,OUString&,Color**) does not indicate
success or failure, but whether the "star" asterisk spreading was inserted 
or
not. Contrary to 
SvNumberformat::GetOutputString(double,sal_uInt16,OUString&)
... cough.

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

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index cfbce503941a..eb360c5b0ad6 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1700,6 +1700,7 @@ void SvNumberFormatter::GetInputLineString(const double& 
fOutNumber,
  * numbers so wouldn't be a safe bet. */
 eType = pFormat->GetNumForInfoScannedType(0);
 }
+const SvNumFormatType eTypeOrig = eType;
 
 sal_uInt16 nOldPrec = pFormatScanner->GetStandardPrec();
 bool bPrecChanged = false;
@@ -1732,13 +1733,13 @@ void SvNumberFormatter::GetInputLineString(const 
double& fOutNumber,
 ChangeStandardPrec(INPUTSTRING_PRECISION);
 bPrecChanged = true;
 }
-const bool bOk = pFormat->GetOutputString(fOutNumber, sOutString, 
&pColor);
+pFormat->GetOutputString(fOutNumber, sOutString, &pColor);
 
 // The #FMT error string must not be used for input as it would lead to
 // data loss. This can happen for at least date(+time). Fall back to a
 // last resort of plain number in the locale the formatter was
 // constructed with.
-if (!bOk && eType != SvNumFormatType::NUMBER && sOutString == 
ImpSvNumberformatScan::sErrStr)
+if (eTypeOrig != SvNumFormatType::NUMBER && sOutString == 
ImpSvNumberformatScan::sErrStr)
 {
 pFormat = GetFormatEntry(ZF_STANDARD);
 assert(pFormat);


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

2022-11-25 Thread Noel Grandin (via logerrit)
 svl/source/items/itempool.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit fc6aa9e49973c845915754caf765ff57e5b0cd59
Author: Noel Grandin 
AuthorDate: Thu Nov 24 13:08:26 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Nov 25 10:53:05 2022 +0100

fix assert

finger trouble in
commit c757117afb398277a46e79ba22066c5bbf2c9f72
tdf#81765 slow loading of .ods with >1000 of conditional formats
Spotted by sberg.

Turns out my original idea idea with the assert was too restrictive,
so make the check a little smarter.

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

diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index 601e90aee862..3cef59683ad7 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -722,7 +722,10 @@ const SfxPoolItem& SfxItemPool::PutImpl( const 
SfxPoolItem& rItem, sal_uInt16 nW
 SfxPoolItem* pNewItem;
 if (bPassingOwnership)
 {
-assert(!dynamic_cast(&rItem) && "can't pass 
ownership of SfxItem, they need to be cloned to the master pool");
+#ifndef NDEBUG
+if (auto pSetItem = dynamic_cast(&rItem))
+assert(pSetItem->GetItemSet().GetPool() == pImpl->mpMaster && 
"can't pass ownership of SfxSetItem, unless they have been cloned to the master 
pool");
+#endif
 pNewItem = const_cast(&rItem);
 }
 else


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

2022-11-22 Thread Stephan Bergmann (via logerrit)
 svl/source/items/sitem.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7a82ea5c79adee70eddf74ac53347544766a91b0
Author: Stephan Bergmann 
AuthorDate: Tue Nov 22 11:29:30 2022 +0100
Commit: Noel Grandin 
CommitDate: Tue Nov 22 18:52:42 2022 +0100

Fix presumed typo

...introduced in 6cb400f41df0dd108cdb4b4d3ec6656844814147 "store the 
SfxItemSet
inside SfxSetItem by value".  It appears to make more sense here to check 
that
an SfxItemSet is not an SfxAllItemSet, than to check that an SfxSetItem is 
not
an SfxAllItemSet.

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

diff --git a/svl/source/items/sitem.cxx b/svl/source/items/sitem.cxx
index db738a2e4b37..a34b9ebff532 100644
--- a/svl/source/items/sitem.cxx
+++ b/svl/source/items/sitem.cxx
@@ -44,7 +44,7 @@ SfxSetItem::SfxSetItem( const SfxSetItem& rCopy, SfxItemPool 
*pPool ) :
 SfxPoolItem(rCopy),
 maSet(rCopy.maSet.CloneAsValue(true, pPool))
 {
-assert(!dynamic_cast(&rCopy) && "cannot handle 
SfxAllItemSet here");
+assert(!dynamic_cast(&rCopy.maSet) && "cannot handle 
SfxAllItemSet here");
 }
 
 


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

2022-11-05 Thread Stephan Bergmann (via logerrit)
 svl/source/misc/lockfilecommon.cxx |5 ++---
 svl/source/numbers/zformat.cxx |4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 3eee720ce275d7fad195ac6bfa44dd596eb87b64
Author: Stephan Bergmann 
AuthorDate: Sat Nov 5 16:03:27 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Sat Nov 5 19:19:06 2022 +0100

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

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

diff --git a/svl/source/misc/lockfilecommon.cxx 
b/svl/source/misc/lockfilecommon.cxx
index 0a867c5dd261..bcf568b70aa6 100644
--- a/svl/source/misc/lockfilecommon.cxx
+++ b/svl/source/misc/lockfilecommon.cxx
@@ -18,8 +18,6 @@
  */
 
 
-#include 
-
 #include 
 #include 
 
@@ -28,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -210,7 +209,7 @@ OUString LockFileCommon::GetCurrentLocalTime()
 {
 char pDateTime[sizeof("65535.65535.-32768 65535:65535")];
 // reserve enough space for hypothetical max length
-sprintf( pDateTime, "%02" SAL_PRIuUINT32 ".%02" SAL_PRIuUINT32 
".%4" SAL_PRIdINT32 " %02" SAL_PRIuUINT32 ":%02" SAL_PRIuUINT32, 
sal_uInt32(aDateTime.Day), sal_uInt32(aDateTime.Month), 
sal_Int32(aDateTime.Year), sal_uInt32(aDateTime.Hours), 
sal_uInt32(aDateTime.Minutes) );
+o3tl::sprintf( pDateTime, "%02" SAL_PRIuUINT32 ".%02" 
SAL_PRIuUINT32 ".%4" SAL_PRIdINT32 " %02" SAL_PRIuUINT32 ":%02" SAL_PRIuUINT32, 
sal_uInt32(aDateTime.Day), sal_uInt32(aDateTime.Month), 
sal_Int32(aDateTime.Year), sal_uInt32(aDateTime.Hours), 
sal_uInt32(aDateTime.Minutes) );
 aTime = OUString::createFromAscii( pDateTime );
 }
 }
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index dfe5f16096e2..b675ed7cca99 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -17,9 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -2942,7 +2942,7 @@ bool SvNumberformat::ImpGetFractionOutput(double fNumber,
 else
 {
 char aBuf[100];
-sprintf( aBuf, "%.f", fNum ); // simple rounded integer (#100211# - 
checked)
+o3tl::sprintf( aBuf, "%.f", fNum ); // simple rounded integer
 sStr.appendAscii( aBuf );
 impTransliterate(sStr, NumFor[nIx].GetNatNum());
 }


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

2022-11-04 Thread László Németh (via logerrit)
 svl/source/numbers/zformat.cxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 21c6547302580c3fd77b85fda68bb0239b8c560a
Author: László Németh 
AuthorDate: Fri Nov 4 10:10:00 2022 +0100
Commit: László Németh 
CommitDate: Fri Nov 4 14:29:19 2022 +0100

tdf#115007 svl: clean-up "add NatNum12 number format list items"

As suggested by Eike Rathke:

– call getCurrBankSymbol() via rLoc();

- remove CCC support with NatNum12:

"This old CCC automatic format code never was used with
NatNum12 and shouldn't be introduced, it also isn't
offered in the number format dialog if a legacy document
doesn't already use it."

Follow-up to commit 2a1d2d42af7f365330479f4032ddfdd9eeba7c1d
"tdf#115007 add NatNum12 number format list items, fix title case".

Change-Id: Ia298d62221b1ce220724bdd7cfe627913ee1afc0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142269
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 54f3ce6276d2..dfe5f16096e2 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -966,10 +966,7 @@ SvNumberformat::SvNumberformat(OUString& rString,
 sParams = "cardinal"; // default NatNum12 
format is "cardinal"
 else if (sParams.indexOf("CURRENCY") >= 0)
 sParams = sParams.replaceAll("CURRENCY",
-
GetFormatter().GetLocaleData()->getCurrBankSymbol());
-// compatible (old) currency format
-else if (sParams.indexOf("CCC") >= 0)
-sParams = sParams.replaceAll("CCC", 
rScan.GetCurAbbrev());
+rLoc().getCurrBankSymbol());
 NumFor[nIndex].SetNatNumParams(sParams);
 sStr += " " + sParams;
 }


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

2022-10-31 Thread Noel Grandin (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 92cd851c924486829aa7592ee41a62d2d97b755d
Author: Noel Grandin 
AuthorDate: Mon Oct 31 08:04:19 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Oct 31 09:22:36 2022 +0100

tdf#126788 only call TotalCount() if we need the result

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 4894e85a6a06..655956f2d1cc 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -157,9 +157,9 @@ SfxItemSet::~SfxItemSet()
 {
 if (!m_pWhichRanges.empty()) // might be nullptr if we have been moved-from
 {
-sal_uInt16 nCount = TotalCount();
 if( Count() )
 {
+sal_uInt16 nCount = TotalCount();
 SfxPoolItem const** ppFnd = m_ppItems;
 for( sal_uInt16 nCnt = nCount; nCnt; --nCnt, ++ppFnd )
 if( *ppFnd && !IsInvalidItem(*ppFnd) )


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

2022-10-24 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zformat.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit c3247f0380b4ffe90672a0442687593531c5774b
Author: Eike Rathke 
AuthorDate: Mon Oct 24 17:06:09 2022 +0200
Commit: Eike Rathke 
CommitDate: Mon Oct 24 20:28:50 2022 +0200

Use constexpr kTimeSignificantRound for all occurrences

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

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index b3a547c28d3f..4aa5543ed5d3 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -62,6 +62,8 @@ const double EXP_ABS_UPPER_BOUND = 1.0E15;  // use 
exponential notation above th
 // also sal/rtl/math.cxx
 // doubleToString()
 
+constexpr sal_Int32 kTimeSignificantRound = 7;  // Round (date+)time at 7 
decimals
+// (+5 of 86400 == 12 
significant digits).
 } // namespace
 
 const double D_MAX_U_INT32 = double(0x);  // 4294967295.0
@@ -3069,10 +3071,10 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber,
 bool bInputLine;
 sal_Int32 nCntPost;
 if ( rScan.GetStandardPrec() == SvNumberFormatter::INPUTSTRING_PRECISION &&
- 0 < rInfo.nCntPost && rInfo.nCntPost < 7 )
-{   // round at 7 decimals (+5 of 86400 == 12 significant digits)
+ 0 < rInfo.nCntPost && rInfo.nCntPost < kTimeSignificantRound )
+{
 bInputLine = true;
-nCntPost = 7;
+nCntPost = kTimeSignificantRound;
 }
 else
 {
@@ -3954,20 +3956,18 @@ bool SvNumberformat::ImpGetDateTimeOutput(double 
fNumber,
 const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
 bool bInputLine;
 sal_Int32 nCntPost, nFirstRounding;
-// Round at 7 decimals (+5 of 86400 == 12 significant digits).
-constexpr sal_Int32 kSignificantRound = 7;
 if ( rScan.GetStandardPrec() == SvNumberFormatter::INPUTSTRING_PRECISION &&
- 0 < rInfo.nCntPost && rInfo.nCntPost < kSignificantRound )
+ 0 < rInfo.nCntPost && rInfo.nCntPost < kTimeSignificantRound )
 {
 bInputLine = true;
-nCntPost = nFirstRounding = kSignificantRound;
+nCntPost = nFirstRounding = kTimeSignificantRound;
 }
 else
 {
 bInputLine = false;
 nCntPost = rInfo.nCntPost;
 // For clock format (not []) do not round up to seconds and thus days.
-nFirstRounding = (rInfo.bThousand ? nCntPost : kSignificantRound);
+nFirstRounding = (rInfo.bThousand ? nCntPost : kTimeSignificantRound);
 }
 double fTime = (fNumber - floor( fNumber )) * 86400.0;
 fTime = ::rtl::math::round( fTime, int(nFirstRounding) );


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

2022-10-24 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zformat.cxx |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 5ce6de864380f1eabbd78656ff6cc31920c534d2
Author: Eike Rathke 
AuthorDate: Mon Oct 24 14:56:55 2022 +0200
Commit: Eike Rathke 
CommitDate: Mon Oct 24 17:07:18 2022 +0200

Related: tdf#136615 Do not round a DateTime clock format into the next day

=TEXT(44858+86399.99/86400;"-mm-dd hh:mm:ss")
gave  2022-10-25 00:00:00  instead of  2022-10-24 23:59:59
whereas
=TEXT(44858+86399.99/86400;"-mm-dd hh:mm:ss.000")
correctly results in  2022-10-24 23:59:59.990

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

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 39883619f4d0..b3a547c28d3f 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -3953,21 +3953,24 @@ bool SvNumberformat::ImpGetDateTimeOutput(double 
fNumber,
 
 const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
 bool bInputLine;
-sal_Int32 nCntPost;
+sal_Int32 nCntPost, nFirstRounding;
+// Round at 7 decimals (+5 of 86400 == 12 significant digits).
+constexpr sal_Int32 kSignificantRound = 7;
 if ( rScan.GetStandardPrec() == SvNumberFormatter::INPUTSTRING_PRECISION &&
- 0 < rInfo.nCntPost && rInfo.nCntPost < 7 )
+ 0 < rInfo.nCntPost && rInfo.nCntPost < kSignificantRound )
 {
-// round at 7 decimals (+5 of 86400 == 12 significant digits)
 bInputLine = true;
-nCntPost = 7;
+nCntPost = nFirstRounding = kSignificantRound;
 }
 else
 {
 bInputLine = false;
 nCntPost = rInfo.nCntPost;
+// For clock format (not []) do not round up to seconds and thus days.
+nFirstRounding = (rInfo.bThousand ? nCntPost : kSignificantRound);
 }
 double fTime = (fNumber - floor( fNumber )) * 86400.0;
-fTime = ::rtl::math::round( fTime, int(nCntPost) );
+fTime = ::rtl::math::round( fTime, int(nFirstRounding) );
 if (fTime >= 86400.0)
 {
 // result of fNumber==x.9... rounded up, use correct date/time


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

2022-10-23 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforfind.cxx |   14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit cf429e79367775a03c2ca89ed57d3de88bd2c6dc
Author: Eike Rathke 
AuthorDate: Sun Oct 23 18:06:43 2022 +0200
Commit: Eike Rathke 
CommitDate: Sun Oct 23 18:58:25 2022 +0200

Resolves: tdf#147817 ignore date acceptance pattern with numeric ambiguity

i.e. if it matches numeric with decimal separator; may had been
added as user-defined pattern to configuration or resulted from
locale merge of default locale and format's locale.

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 56c929e44407..029b2b556d0f 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1357,10 +1357,22 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( 
sal_uInt16 nStartPatternAt )
 
 for (sal_Int32 nPattern=0; nPattern < sDateAcceptancePatterns.getLength(); 
++nPattern)
 {
+const OUString& rPat = sDateAcceptancePatterns[nPattern];
+if (rPat.getLength() == 3)
+{
+// Ignore a pattern that would match numeric input with decimal
+// separator. It may had been read from configuration or resulted
+// from the locales' patterns concatenation above.
+if (rPat[1] == 
pFormatter->GetLocaleData()->getNumDecimalSep().toChar()
+ || rPat[1] == 
pFormatter->GetLocaleData()->getNumDecimalSepAlt().toChar())
+{
+SAL_WARN("svl.numbers", "ignoring date acceptance pattern with 
decimal separator ambiguity: " << rPat);
+continue;   // for, next pattern
+}
+}
 sal_uInt16 nNext = nDatePatternStart;
 nDatePatternNumbers = 0;
 bool bOk = true;
-const OUString& rPat = sDateAcceptancePatterns[nPattern];
 sal_Int32 nPat = 0;
 for ( ; nPat < rPat.getLength() && bOk && nNext < nStringsCnt; ++nPat, 
++nNext)
 {


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

2022-10-21 Thread Noel Grandin (via logerrit)
 svl/source/fsstor/fsstorage.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit db8f0528eb71252b4af9c3f7ec213ea7fb29591a
Author: Noel Grandin 
AuthorDate: Fri Oct 21 18:48:27 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Oct 22 08:28:33 2022 +0200

use more TempFileFastService in svl

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

diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index 8d2da219d7be..68e82feb0121 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -48,6 +48,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "fsstorage.hxx"
@@ -472,13 +473,10 @@ uno::Reference< io::XStream > SAL_CALL 
FSStorage::cloneStreamElement( const OUSt
 ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( 
INetURLObject::DecodeMechanism::NONE ), xDummyEnv, 
comphelper::getProcessComponentContext() );
 uno::Reference< io::XInputStream > xInStream = 
aResultContent.openStream();
 
-xTempResult = io::TempFile::create(m_xContext);
+xTempResult = new utl::TempFileFastService;
 uno::Reference < io::XOutputStream > xTempOut = 
xTempResult->getOutputStream();
 uno::Reference < io::XInputStream > xTempIn = 
xTempResult->getInputStream();
 
-if ( !xTempOut.is() || !xTempIn.is() )
-throw io::IOException();
-
 ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOut );
 xTempOut->closeOutput();
 }


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

2022-10-08 Thread Mike Kaganski (via logerrit)
 svl/source/svdde/ddesvr.cxx |  129 +++-
 1 file changed, 44 insertions(+), 85 deletions(-)

New commits:
commit 07211eda0c90d54d8993febd2af4d9811249a063
Author: Mike Kaganski 
AuthorDate: Sat Oct 8 14:12:36 2022 +0300
Commit: Mike Kaganski 
CommitDate: Sat Oct 8 15:09:09 2022 +0200

Simplify this code a bit

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

diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx
index cff09ed68650..1ce98b554a6e 100644
--- a/svl/source/svdde/ddesvr.cxx
+++ b/svl/source/svdde/ddesvr.cxx
@@ -49,13 +49,6 @@ HDDEDATA CALLBACK DdeInternal::SvrCallback(
 UINT nCode, UINT nCbType, HCONV hConv, HSZ hText1, HSZ hText2,
 HDDEDATA hData, ULONG_PTR, ULONG_PTR )
 {
-DdeServices&rAll = DdeService::GetServices();
-DdeService* pService;
-DdeTopic*   pTopic;
-DdeItem*pItem;
-DdeData*pData;
-Conversation*   pC;
-
 DdeInstData* pInst = ImpGetInstData();
 assert(pInst);
 
@@ -63,98 +56,62 @@ HDDEDATA CALLBACK DdeInternal::SvrCallback(
 {
 case XTYP_WILDCONNECT:
 {
-int nTopics = 0;
+std::vector aPairs;
 
-WCHAR chTopicBuf[250];
+WCHAR chTopicBuf[256];
 if( hText1 )
 DdeQueryStringW( pInst->hDdeInstSvr, hText1, chTopicBuf,
 SAL_N_ELEMENTS(chTopicBuf), CP_WINUNICODE );
 
-for (auto& rpService : rAll)
+for (auto& pService : DdeService::GetServices())
 {
-pService = rpService;
-if ( !hText2 || ( *pService->pName == hText2 ) )
-{
-OUString sTopics( pService->Topics() );
-if (!sTopics.isEmpty())
-{
-if( hText1 )
-{
-sal_Int32 n = 0;
-while( -1 != n )
-{
-OUString s( sTopics.getToken( 0, '\t', n ));
-if( s == o3tl::toU(chTopicBuf) )
-++nTopics;
-}
-}
-else
-nTopics += 
comphelper::string::getTokenCount(sTopics, '\t');
-}
-}
-}
+if (hText2 && !(*pService->pName == hText2))
+continue;
 
-if( !nTopics )
-return nullptr;
-
-auto pPairs = std::make_unique(nTopics + 1);
+OUString sTopics(pService->Topics().replaceAll("\n", 
"").replaceAll("\r", ""));
+if (sTopics.isEmpty())
+continue;
 
-HSZPAIR* q = pPairs.get();
-for (auto& rpService : rAll)
-{
-pService = rpService;
-if ( !hText2 || (*pService->pName == hText2 ) )
+for (sal_Int32 n = 0; -1 != n;)
 {
-OUString sTopics( pService->Topics() );
-sal_Int32 n = 0;
-while( -1 != n )
+OUString s(sTopics.getToken(0, '\t', n));
+if (hText1 && s != o3tl::toU(chTopicBuf))
+continue;
+
+DdeString aDStr(pInst->hDdeInstSvr, s);
+if (auto pTopic = FindTopic(*pService, aDStr.getHSZ()))
 {
-OUString s( sTopics.getToken( 0, '\t', n ));
-s = s.replaceAll("\n", "").replaceAll("\r", "");
-if( !hText1 || s == o3tl::toU(chTopicBuf) )
-{
-DdeString aDStr( pInst->hDdeInstSvr, s );
-pTopic = FindTopic( *pService, aDStr.getHSZ() );
-if( pTopic )
-{
-q->hszSvc   = pService->pName->getHSZ();
-q->hszTopic = pTopic->pName->getHSZ();
-q++;
-}
-}
+auto& pair = aPairs.emplace_back();
+pair.hszSvc = pService->pName->getHSZ();
+pair.hszTopic = pTopic->pName->getHSZ();
 }
 }
 }
 
-q->hszSvc   = nullptr;
-q->hszTopic = nullptr;
+if (aPairs.empty())
+return nullptr;
+aPairs.emplace_back(); // trailing zero
+
 HDDEDATA h = DdeCreateDataHandle(
 pInst->hDdeInstSvr,
-reinterp

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

2022-10-03 Thread Arnaud Versini (via logerrit)
 svl/source/notify/broadcast.cxx |   12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

New commits:
commit 4ab8efd367dc09203a77983e5dcd3d6e9bfa7ddd
Author: Arnaud Versini 
AuthorDate: Tue Sep 27 16:29:23 2022 +0200
Commit: Eike Rathke 
CommitDate: Mon Oct 3 17:49:26 2022 +0200

svl : use uintptr_t instead of sal_uInt32 or sal_uInt64

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

diff --git a/svl/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx
index 042d1dacaae3..c13cfa3b736e 100644
--- a/svl/source/notify/broadcast.cxx
+++ b/svl/source/notify/broadcast.cxx
@@ -49,20 +49,12 @@ static bool isDeletedPtr(SvtListener* p)
 /** mark deleted entries by toggling the last bit,which is effectively 
unused, since the struct we point
  * to is at least 16-bit aligned. This allows the binary search to 
continue working even when we have
  * deleted entries */
-#if SAL_TYPES_SIZEOFPOINTER == 4
-return (reinterpret_cast(p) & 0x01) == 0x01;
-#else
-return (reinterpret_cast(p) & 0x01) == 0x01;
-#endif
+return (reinterpret_cast(p) & 0x01) == 0x01;
 }
 
 static void markDeletedPtr(SvtListener*& rp)
 {
-#if SAL_TYPES_SIZEOFPOINTER == 4
-reinterpret_cast(rp) |= 0x01;
-#else
-reinterpret_cast(rp) |= 0x01;
-#endif
+reinterpret_cast(rp) |= 0x01;
 }
 
 static void sortListeners(std::vector& listeners, size_t 
firstUnsorted)


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

2022-09-27 Thread Mike Kaganski (via logerrit)
 svl/source/misc/sharedstring.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 093143c5754ea1f8ec5e886468e124547ec5e21a
Author: Mike Kaganski 
AuthorDate: Tue Sep 27 11:12:29 2022 +0300
Commit: Mike Kaganski 
CommitDate: Tue Sep 27 11:21:37 2022 +0200

Reduce number of static objects a bit

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

diff --git a/svl/source/misc/sharedstring.cxx b/svl/source/misc/sharedstring.cxx
index 71f3354eca51..499136da972f 100644
--- a/svl/source/misc/sharedstring.cxx
+++ b/svl/source/misc/sharedstring.cxx
@@ -11,15 +11,15 @@
 
 namespace svl {
 
-/** ref-counting traffic associated with SharedString temporaries can be 
significant, so use a singleton here, so we can return a const& from 
getEmptyString */
-static OUString EMPTY(u"");
-const SharedString EMPTY_SHARED_STRING(EMPTY.pData, EMPTY.pData);
-const OUString SharedString::EMPTY_STRING {};
+const OUString SharedString::EMPTY_STRING;
 
 const SharedString & SharedString::getEmptyString()
 {
+// ref-counting traffic associated with SharedString temporaries can be 
significant,
+// so use a singleton here, so we can return a const& from getEmptyString.
 // unicode string array for empty string is globally shared in OUString.
 // Let's take advantage of that.
+static const SharedString EMPTY_SHARED_STRING(EMPTY_STRING.pData, 
EMPTY_STRING.pData);
 return EMPTY_SHARED_STRING;
 }
 


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

2022-09-26 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforfind.cxx |   16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 0d3dd0aa54ad792f91d0905f3d46c13df3512d89
Author: Eike Rathke 
AuthorDate: Mon Sep 26 22:52:02 2022 +0200
Commit: Eike Rathke 
CommitDate: Tue Sep 27 00:33:39 2022 +0200

Prevent erroneous fraction detection of not yet accepted date

May had happened if the locale's date separator is not '/' but a
preset format uses it (for example DD/MM/) and the locale's
date acceptance patterns do not contain D/M/Y so the first '/' did
not already lead to a possible date before a match against the
format is to be tried.

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index a30bbf600ef6..56c929e44407 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -2633,15 +2633,17 @@ bool ImpSvNumberInputScan::ScanMidString( const 
OUString& rString, sal_uInt16 nS
 if (SkipChar('/', rString, nPos))   // fraction?
 {
 if ( eScannedType != SvNumFormatType::UNDEFINED &&  // already another 
type
- eScannedType != SvNumFormatType::DATE)   // except date
+ eScannedType != SvNumFormatType::DATE) // except date
 {
-return MatchedReturn(); // => jan/31/1994
+return MatchedReturn(); // => jan/31/1994
 }
-else if (eScannedType != SvNumFormatType::DATE &&// analyzed no 
date until now
- ( eSetType == SvNumFormatType::FRACTION ||  // and preset was 
fraction
-   (nNumericsCnt == 3 && // or 3 numbers
-(nStringPos == 3 ||  // and 3rd string 
particle
- (nStringPos == 4 && nSign)  // or 4th  if signed
+else if (eScannedType != SvNumFormatType::DATE &&   // analyzed no 
date until now
+ (eSetType == SvNumFormatType::FRACTION ||  // and preset was 
fraction
+  (nNumericsCnt == 3 && // or 3 numbers
+   (nStringPos == 3 ||  // and 4th string 
particle
+(nStringPos == 4 && nSign)) &&  // or 5th if signed
+   sStrArray[nStringPos-2].indexOf('/') == -1)))  // and not 
23/11/1999
+  // that was 
not accepted as date yet
 {
 SkipBlanks(rString, nPos);
 if (nPos == rString.getLength())


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

2022-09-21 Thread Stephan Bergmann (via logerrit)
 svl/source/misc/inettype.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit c1ee70dba2c8da567feeeb276fddf5f726863a81
Author: Stephan Bergmann 
AuthorDate: Wed Sep 21 15:06:30 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Sep 21 16:18:07 2022 +0200

Use the more "natural" string_view o3tl::getToken variant here

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

diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx
index ca2528c3c242..d75e856ae880 100644
--- a/svl/source/misc/inettype.cxx
+++ b/svl/source/misc/inettype.cxx
@@ -311,8 +311,8 @@ INetContentType 
INetContentTypes::GetContentType4Extension(OUString const & rExt
 INetContentType INetContentTypes::GetContentTypeFromURL(std::u16string_view 
rURL)
 {
 INetContentType eTypeID = CONTENT_TYPE_UNKNOWN;
-sal_Int32 nIdx{ 0 };
-OUString aToken( o3tl::getToken(rURL, 0, ':', nIdx) );
+std::size_t nIdx{ 0 };
+OUString aToken( o3tl::getToken(rURL, u':', nIdx) );
 if (!aToken.isEmpty())
 {
 if (aToken.equalsIgnoreAsciiCase(INETTYPE_URL_PROT_FILE))
@@ -342,13 +342,13 @@ INetContentType 
INetContentTypes::GetContentTypeFromURL(std::u16string_view rURL
 eTypeID = CONTENT_TYPE_TEXT_HTML;
 else if (aToken.equalsIgnoreAsciiCase(INETTYPE_URL_PROT_PRIVATE))
 {
-aToken = o3tl::getToken(rURL, 0, '/', nIdx);
+aToken = o3tl::getToken(rURL, u'/', nIdx);
 if (aToken == "factory")
 {
-aToken = o3tl::getToken(rURL, 0, '/', nIdx);
+aToken = o3tl::getToken(rURL, u'/', nIdx);
 if (aToken == "swriter")
 {
-aToken = o3tl::getToken(rURL, 0, '/', nIdx);
+aToken = o3tl::getToken(rURL, u'/', nIdx);
 eTypeID = aToken == "web" ?
   CONTENT_TYPE_APP_VND_WRITER_WEB :
   aToken == "GlobalDocument" ?
@@ -379,7 +379,7 @@ INetContentType 
INetContentTypes::GetContentTypeFromURL(std::u16string_view rURL
 eTypeID = CONTENT_TYPE_APP_MACRO;
 else if (aToken.equalsIgnoreAsciiCase(INETTYPE_URL_PROT_DATA))
 {
-aToken = o3tl::getToken(rURL, 0, ',', nIdx);
+aToken = o3tl::getToken(rURL, u',', nIdx);
 eTypeID = GetContentType(aToken);
 }
 }


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

2022-08-03 Thread Noel Grandin (via logerrit)
 svl/source/items/itempool.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4c927cc34e05c331c1cebf6885256f31becfb89d
Author: Noel Grandin 
AuthorDate: Wed Aug 3 14:38:29 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 3 16:11:04 2022 +0200

improve assert message

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

diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index 781d591eaff3..601e90aee862 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -317,7 +317,7 @@ void SfxItemPool::SetDefaults( std::vector* 
pDefaults )
 for ( sal_uInt16 n = 0; n <= pImpl->mnEnd - pImpl->mnStart; ++n )
 {
 assert(  ((*pImpl->mpStaticDefaults)[n]->Which() == n + 
pImpl->mnStart)
-&& "static defaults not sorted" );
+&& "items ids in pool-ranges and in static-defaults do 
not match" );
 (*pImpl->mpStaticDefaults)[n]->SetKind(SfxItemKind::StaticDefault);
 DBG_ASSERT( pImpl->maPoolItemArrays[n].empty(), "defaults with 
setitems with items?!" );
 }


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

2022-07-25 Thread Mike Kaganski (via logerrit)
 svl/source/undo/undo.cxx |   26 ++
 1 file changed, 10 insertions(+), 16 deletions(-)

New commits:
commit ab12ae777b8213f2a3a8ed9a744adb82a1f75e32
Author: Mike Kaganski 
AuthorDate: Mon Jul 25 10:26:51 2022 +0300
Commit: Mike Kaganski 
CommitDate: Mon Jul 25 12:13:26 2022 +0200

A bit of RAII

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

diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 2424a9141a78..1b2c2e8b71b6 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -263,14 +263,15 @@ namespace svl::undo::impl
 
 ~UndoManagerGuard();
 
-void clear()
+struct ResetGuard {
+ResetGuard(osl::ResettableMutexGuard& r) : rGuard(r) {}
+~ResetGuard() { rGuard.reset(); }
+osl::ResettableMutexGuard& rGuard;
+};
+ResetGuard clear()
 {
 m_aGuard.clear();
-}
-
-void reset()
-{
-m_aGuard.reset();
+return ResetGuard(m_aGuard);
 }
 
 void cancelNotifications()
@@ -706,17 +707,14 @@ bool SfxUndoManager::ImplUndo( SfxUndoContext* 
i_contextOrNull )
 {
 // clear the guard/mutex before calling into the SfxUndoAction - this 
can be an extension-implemented UNO component
 // nowadays ...
-aGuard.clear();
+auto aResetGuard(aGuard.clear());
 if ( i_contextOrNull != nullptr )
 pAction->UndoWithContext( *i_contextOrNull );
 else
 pAction->Undo();
-aGuard.reset();
 }
 catch( ... )
 {
-aGuard.reset();
-
 // in theory, somebody might have tampered with all of *m_xData while 
the mutex was unlocked. So, see if
 // we still find pAction in our current Undo array
 size_t nCurAction = 0;
@@ -818,17 +816,14 @@ bool SfxUndoManager::ImplRedo( SfxUndoContext* 
i_contextOrNull )
 {
 // clear the guard/mutex before calling into the SfxUndoAction - this 
can be an extension-implemented UNO component
 // nowadays ...
-aGuard.clear();
+auto aResetGuard(aGuard.clear());
 if ( i_contextOrNull != nullptr )
 pAction->RedoWithContext( *i_contextOrNull );
 else
 pAction->Redo();
-aGuard.reset();
 }
 catch( ... )
 {
-aGuard.reset();
-
 // in theory, somebody might have tampered with all of *m_xData while 
the mutex was unlocked. So, see if
 // we still find pAction in our current Undo array
 size_t nCurAction = 0;
@@ -875,10 +870,9 @@ bool SfxUndoManager::Repeat( SfxRepeatTarget &rTarget )
 if ( !m_xData->pActUndoArray->maUndoActions.empty() )
 {
 SfxUndoAction* pAction = 
m_xData->pActUndoArray->maUndoActions.back().pAction.get();
-aGuard.clear();
+auto aResetGuard(aGuard.clear());
 if ( pAction->CanRepeat( rTarget ) )
 pAction->Repeat( rTarget );
-aGuard.reset(); // allow clearing in guard dtor
 return true;
 }
 


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

2022-07-14 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforfind.cxx |   46 ++--
 svl/source/numbers/zforfind.hxx |3 +-
 2 files changed, 37 insertions(+), 12 deletions(-)

New commits:
commit 5b0ac00fe7db535286c081dacbd066ed6edf6813
Author: Eike Rathke 
AuthorDate: Thu Jul 14 15:43:26 2022 +0200
Commit: Eike Rathke 
CommitDate: Thu Jul 14 20:18:03 2022 +0200

Accept 'Y D MMM' date input for locales with LongDateOrder::YDM

There currently is only lv-LV.

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index d0ce846b25a7..aa6029b0f271 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -2123,7 +2123,17 @@ input for the following reasons:
 }
 break;
 }
-default:// else, e.g. month at the end (94 10 Jan)
+case 3: // month at the end (94 10 Jan)
+if (pLoc->getLongDateOrder() != LongDateOrder::YDM)
+res = false;
+else
+{
+pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 
ImplGetDay(1) );
+pCal->setValue( CalendarFieldIndex::MONTH, 
std::abs(nMonth)-1 );
+pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
+}
+break;
+default:
 res = false;
 break;
 }   // switch (nMonthPos)
@@ -2215,7 +2225,18 @@ input for the following reasons:
 }
 break;
 }
-default:// else, e.g. month at the end (94 10 Jan 8:23)
+case 3:// month at the end (94 10 Jan 8:23)
+nCounter = 2;
+if (pLoc->getLongDateOrder() != LongDateOrder::YDM)
+res = false;
+else
+{
+pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 
ImplGetDay(1) );
+pCal->setValue( CalendarFieldIndex::MONTH, 
std::abs(nMonth)-1 );
+pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
+}
+break;
+default:
 nCounter = 2;
 res = false;
 break;
@@ -2524,7 +2545,7 @@ bool ImpSvNumberInputScan::ScanStartString( const 
OUString& rString )
  * All gone => true
  * else => false
  */
-bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, sal_uInt16 
nStringPos )
+bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, sal_uInt16 
nStringPos, sal_uInt16 nCurNumCount )
 {
 sal_Int32 nPos = 0;
 SvNumFormatType eOldScannedType = eScannedType;
@@ -2722,7 +2743,7 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& 
rString, sal_uInt16 nS
 }
 
 const sal_Int32 nMonthStart = nPos;
-short nTempMonth = GetMonth(rString, nPos); // month in the middle (10 
Jan 94)
+short nTempMonth = GetMonth(rString, nPos); // month in the middle (10 
Jan 94) or at the end (94 10 Jan)
 if (nTempMonth)
 {
 if (nMonth != 0)// month dup
@@ -2738,7 +2759,10 @@ bool ImpSvNumberInputScan::ScanMidString( const 
OUString& rString, sal_uInt16 nS
 {
 eScannedType = SvNumFormatType::DATE;   // !!! it IS a date
 nMonth = nTempMonth;
-nMonthPos = 2;  // month in the middle
+if (nCurNumCount <= 1)
+nMonthPos = 2;  // month in the middle
+else
+nMonthPos = 3;  // month at the end
 if ( nMonth < 0 )
 {
 SkipChar( '.', rString, nPos ); // abbreviated
@@ -3439,7 +3463,7 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const 
OUString& rString,/
 i++;// i=1
 }
 GetNextNumber(i,j); // i=1,2
-if ( !ScanMidString( sStrArray[i], i ) )
+if ( !ScanMidString( sStrArray[i], i, j ) )
 {
 return false;
 }
@@ -3477,7 +3501,7 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const 
OUString& rString,/
 }
 }
 GetNextNumber(i,j); // i=1,2
-if ( !ScanMidString( sStrArray[i], i ) )
+if ( !ScanMidString( sStrArray[i], i, j ) )
 {
 return false;
 }
@@ -3487,7 +3511,7 @@ bool ImpSvNumberInputScan::IsNumberFormatMain( const 
OUString& rString,/
 return false;
 }
 GetNextNumber(i,j); // i=3,4
-if ( !ScanMidString( sStrArray[i], i ) )
+if ( !ScanMi

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

2022-07-14 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforfind.cxx |   20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

New commits:
commit ff1c5fedc96456a6be12e7e4fd2109ef5beb45c7
Author: Eike Rathke 
AuthorDate: Thu Jul 14 13:55:15 2022 +0200
Commit: Eike Rathke 
CommitDate: Thu Jul 14 16:31:41 2022 +0200

Let 'MMM D Y H:M' input follow the same date rule as 'MMM D Y'

... and not only accept for DateOrder::MDY.

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 081b3079a2bf..d0ce846b25a7 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -2175,19 +2175,25 @@ input for the following reasons:
 break;
 }
 case 1: // month at the beginning (Jan 01 01 8:23)
+{
 nCounter = 2;
-switch (DateFmt)
+// The input is valid as MDY in almost any
+// constellation, there is no date order (M)YD except if
+// set in a format applied.
+pCal->setValue( CalendarFieldIndex::MONTH, std::abs(nMonth)-1 
);
+sal_uInt32 nExactDateOrder = (bFormatTurn ? 
mpFormat->GetExactDateOrder() : 0);
+if nExactDateOrder >> 8) & 0xff) == 'Y') && 
((nExactDateOrder & 0xff) == 'D'))
+{
+pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 
ImplGetDay(1) );
+pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
+}
+else
 {
-case DateOrder::MDY:
 pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 
ImplGetDay(0) );
-pCal->setValue( CalendarFieldIndex::MONTH, 
std::abs(nMonth)-1 );
 pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
-break;
-default:
-res = false;
-break;
 }
 break;
+}
 case 2: // month in the middle (10 Jan 94 8:23)
 {
 nCounter = 2;


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

2022-07-13 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforfind.cxx |   63 +++-
 svl/source/numbers/zforfind.hxx |7 
 2 files changed, 63 insertions(+), 7 deletions(-)

New commits:
commit d818c341206895a6dda1c19fc8b32f04b5b7c520
Author: Eike Rathke 
AuthorDate: Wed Jul 13 14:54:55 2022 +0200
Commit: Eike Rathke 
CommitDate: Wed Jul 13 17:46:58 2022 +0200

Resolves: tdf#149950 Handle LongDateOrder vs DateOrder for middle month name

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index ac9fe7a9851a..081b3079a2bf 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1704,6 +1704,52 @@ DateOrder ImpSvNumberInputScan::GetDateOrder( bool 
bFromFormatIfNoPattern )
 return pFormatter->GetLocaleData()->getDateOrder();
 }
 
+LongDateOrder ImpSvNumberInputScan::GetMiddleMonthLongDateOrder( bool 
bFormatTurn,
+ const 
LocaleDataWrapper* pLoc,
+ DateOrder 
eDateOrder )
+{
+if (MayBeMonthDate())
+return (nMayBeMonthDate == 2) ? LongDateOrder::DMY : 
LongDateOrder::YMD;
+
+LongDateOrder eLDO;
+const sal_uInt32 nExactDateOrder = (bFormatTurn ? 
mpFormat->GetExactDateOrder() : 0);
+if (!nExactDateOrder)
+eLDO = pLoc->getLongDateOrder();
+else if nExactDateOrder >> 16) & 0xff) == 'Y') && ((nExactDateOrder & 
0xff) == 'D'))
+eLDO = LongDateOrder::YMD;
+else if nExactDateOrder >> 16) & 0xff) == 'D') && ((nExactDateOrder & 
0xff) == 'Y'))
+eLDO = LongDateOrder::DMY;
+else
+eLDO = pLoc->getLongDateOrder();
+if (eLDO != LongDateOrder::YMD && eLDO != LongDateOrder::DMY)
+{
+switch (eDateOrder)
+{
+case DateOrder::YMD:
+eLDO = LongDateOrder::YMD;
+break;
+case DateOrder::DMY:
+eLDO = LongDateOrder::DMY;
+break;
+default:
+;   // nothing, not a date
+}
+}
+else if (eLDO == LongDateOrder::DMY && eDateOrder == DateOrder::YMD)
+{
+// Check possible order and maybe switch.
+if (!ImplGetDay(0) && ImplGetDay(1))
+eLDO = LongDateOrder::YMD;
+}
+else if (eLDO == LongDateOrder::YMD && eDateOrder == DateOrder::DMY)
+{
+// Check possible order and maybe switch.
+if (!ImplGetDay(1) && ImplGetDay(0))
+eLDO = LongDateOrder::DMY;
+}
+return eLDO;
+}
+
 bool ImpSvNumberInputScan::GetDateRef( double& fDays, sal_uInt16& nCounter )
 {
 using namespace ::com::sun::star::i18n;
@@ -2060,14 +2106,14 @@ input for the following reasons:
 case 2: // month in the middle (10 Jan 94)
 {
 pCal->setValue( CalendarFieldIndex::MONTH, std::abs(nMonth)-1 
);
-DateOrder eDF = (MayBeMonthDate() ? (nMayBeMonthDate == 2 ? 
DateOrder::DMY : DateOrder::YMD) : DateFmt);
-switch (eDF)
+const LongDateOrder eLDO = GetMiddleMonthLongDateOrder( 
bFormatTurn, pLoc, DateFmt);
+switch (eLDO)
 {
-case DateOrder::DMY:
+case LongDateOrder::DMY:
 pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 
ImplGetDay(0) );
 pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
 break;
-case DateOrder::YMD:
+case LongDateOrder::YMD:
 pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 
ImplGetDay(1) );
 pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
 break;
@@ -2143,15 +2189,17 @@ input for the following reasons:
 }
 break;
 case 2: // month in the middle (10 Jan 94 8:23)
+{
 nCounter = 2;
 pCal->setValue( CalendarFieldIndex::MONTH, std::abs(nMonth)-1 
);
-switch (DateFmt)
+const LongDateOrder eLDO = GetMiddleMonthLongDateOrder( 
bFormatTurn, pLoc, DateFmt);
+switch (eLDO)
 {
-case DateOrder::DMY:
+case LongDateOrder::DMY:
 pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 
ImplGetDay(0) );
 pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
 break;
-case DateOrder::YMD:
+case LongDateOrder::YMD:
 pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 
ImplGetDay(1) );
 pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
 b

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

2022-07-04 Thread Noel Grandin (via logerrit)
 svl/source/items/style.cxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 6b9c51aee8a42e597efe78257ab051bf108c0128
Author: Noel Grandin 
AuthorDate: Fri Jul 1 12:28:19 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 4 19:24:50 2022 +0200

dodgy use of dynamic_cast on an UNO object

rather just stick to using getFromUnoTunnel

ever since
commit 5420fbd0d722754e4e01e48d661f0ee082caef56
Date:   Wed Mar 12 12:09:03 2008 +
INTEGRATION: CWS impresstables2 (1.16.30); FILE MERGED
2008/

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

diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 0179635f7493..dfa2ada7e88c 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -886,10 +886,7 @@ SfxUnoStyleSheet::SfxUnoStyleSheet( const OUString& 
_rName, const SfxStyleSheetB
 
 SfxUnoStyleSheet* SfxUnoStyleSheet::getUnoStyleSheet( const 
css::uno::Reference< css::style::XStyle >& xStyle )
 {
-SfxUnoStyleSheet* pRet = dynamic_cast< SfxUnoStyleSheet* >( xStyle.get() );
-if( !pRet )
-pRet = comphelper::getFromUnoTunnel(xStyle);
-return pRet;
+return comphelper::getFromUnoTunnel(xStyle);
 }
 
 /**


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

2022-07-01 Thread Noel Grandin (via logerrit)
 svl/source/notify/SfxBroadcaster.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 46869037d0fee5601815f3e8ff12764564ae3489
Author: Noel Grandin 
AuthorDate: Wed Jun 29 20:50:11 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 1 09:46:25 2022 +0200

small optimisation

in a very hot spot

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

diff --git a/svl/source/notify/SfxBroadcaster.cxx 
b/svl/source/notify/SfxBroadcaster.cxx
index dbd1ab3a7191..ae1be1475c91 100644
--- a/svl/source/notify/SfxBroadcaster.cxx
+++ b/svl/source/notify/SfxBroadcaster.cxx
@@ -32,7 +32,8 @@
 void SfxBroadcaster::Broadcast(const SfxHint& rHint)
 {
 // notify all registered listeners exactly once
-for (size_t i = 0; i < m_Listeners.size(); ++i)
+size_t nSize = m_Listeners.size();
+for (size_t i = 0; i < nSize; ++i)
 {
 SfxListener* const pListener = m_Listeners[i];
 if (pListener)


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

2022-06-30 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforscan.cxx |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit db00c13579a94dd256a01e76ef230cde342f30db
Author: Eike Rathke 
AuthorDate: Fri Jul 1 00:03:10 2022 +0200
Commit: Eike Rathke 
CommitDate: Fri Jul 1 02:01:34 2022 +0200

ChangeNullDate: assert valid date after normalization if it wasn't before

... and abort if not. Also take over only valid values.

This might pop up more crashtest import failures that would need
fixes similar to commit 7ca3eca66888a1fa1b7bd59d79bb8f4c96bd7460.

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

diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index a5f25637678a..10ff6a591b35 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -519,14 +519,18 @@ void ImpSvNumberformatScan::SetDependentKeywords()
 
 void ImpSvNumberformatScan::ChangeNullDate(sal_uInt16 nDay, sal_uInt16 nMonth, 
sal_Int16 nYear)
 {
-maNullDate = Date(nDay, nMonth, nYear);
-if (!maNullDate.IsValidDate())
+Date aDate(nDay, nMonth, nYear);
+if (!aDate.IsValidDate())
 {
-maNullDate.Normalize();
+aDate.Normalize();
 SAL_WARN("svl.numbers","ImpSvNumberformatScan::ChangeNullDate - not 
valid"
 " d: " << nDay << " m: " << nMonth << " y: " << nYear << " 
normalized to"
-" d: " << maNullDate.GetDay() << " m: " << 
maNullDate.GetMonth() << " y: " << maNullDate.GetYear());
+" d: " << aDate.GetDay() << " m: " << aDate.GetMonth() << " y: 
" << aDate.GetYear());
+// Slap the caller if really bad, like year 0.
+assert(aDate.IsValidDate());
 }
+if (aDate.IsValidDate())
+maNullDate = aDate;
 }
 
 void ImpSvNumberformatScan::ChangeStandardPrec(sal_uInt16 nPrec)


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

2022-06-29 Thread Noel Grandin (via logerrit)
 svl/source/items/itemset.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit c71e26b4cf6181791acff4017f661edb3523c70e
Author: Noel Grandin 
AuthorDate: Wed Jun 29 10:06:04 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Jun 29 13:03:40 2022 +0200

elide unnecessary copy in SfxItemSet constructor

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 50af12fee107..93721dd756f2 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -97,8 +97,14 @@ SfxItemSet::SfxItemSet(SfxItemPool& pool, const 
WhichRangesContainer& wids)
 }
 
 SfxItemSet::SfxItemSet(SfxItemPool& pool, WhichRangesContainer&& wids)
-: SfxItemSet(pool, wids, svl::detail::CountRanges(wids))
+: m_pPool(&pool), m_pParent(nullptr),
+m_ppItems(new SfxPoolItem const *[svl::detail::CountRanges(wids)]{}),
+m_pWhichRanges(std::move(wids)),
+m_nCount(0),
+m_bItemsFixed(false)
 {
+assert(svl::detail::CountRanges(m_pWhichRanges) != 0);
+assert(svl::detail::validRanges2(m_pWhichRanges));
 }
 
 SfxItemSet::SfxItemSet( const SfxItemSet& rASet )


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

2022-06-29 Thread Noel Grandin (via logerrit)
 svl/source/items/itemset.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit ff6fc9927241afe4dc95580bf6bb987fe62a191d
Author: Noel Grandin 
AuthorDate: Wed Jun 29 10:36:30 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Jun 29 11:53:21 2022 +0200

tdf#117539 Assert after cut and paste operation of a chart stick

inline the call to the other constructor, and remove the
assert(size() != 0)
it appears to be valid to have a size of zero here

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 982cbc837898..50af12fee107 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -45,8 +45,13 @@
  * Don't create ItemSets with full range before FreezeIdRanges()!
  */
 SfxItemSet::SfxItemSet(SfxItemPool& rPool)
-: SfxItemSet(rPool, rPool.GetFrozenIdRanges())
+: m_pPool(&rPool), m_pParent(nullptr),
+m_ppItems(new SfxPoolItem const 
*[svl::detail::CountRanges(rPool.GetFrozenIdRanges())]{}),
+m_pWhichRanges(rPool.GetFrozenIdRanges()),
+m_nCount(0),
+m_bItemsFixed(false)
 {
+assert(svl::detail::validRanges2(m_pWhichRanges));
 }
 
 SfxItemSet::SfxItemSet( SfxItemPool& rPool, SfxAllItemSetFlag )


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

2022-06-20 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforlist.cxx |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 36cf12d449c892e6bbacb7da5f4b008f7762232b
Author: Eike Rathke 
AuthorDate: Mon Jun 20 17:13:53 2022 +0200
Commit: Eike Rathke 
CommitDate: Mon Jun 20 19:15:14 2022 +0200

Resolves: tdf#147265 Return correct default if currency format is duplicate

For the default currency format
SvNumberFormatter::GetCurrencyFormatStrings() returned always the
last added position, regardless whether that format was added or
not, which it isn't if the format code is a duplicate. Let
addToCurrencyFormatsList() return the position of the existing
format if the duplicate was rejected and use that for default.

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

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index c1d45cc9bd60..0c1e28661fb8 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -4290,12 +4290,16 @@ void SvNumberFormatter::ImpInitCurrencyTable()
 }
 
 
-static void addToCurrencyFormatsList( NfWSStringsDtor& rStrArr, const 
OUString& rFormat )
+static std::ptrdiff_t addToCurrencyFormatsList( NfWSStringsDtor& rStrArr, 
const OUString& rFormat )
 {
 // Prevent duplicates even over subsequent calls of
 // GetCurrencyFormatStrings() with the same vector.
-if (std::find( rStrArr.begin(), rStrArr.end(), rFormat) == rStrArr.end())
-rStrArr.push_back( rFormat);
+NfWSStringsDtor::const_iterator it( std::find( rStrArr.begin(), 
rStrArr.end(), rFormat));
+if (it != rStrArr.end())
+return it - rStrArr.begin();
+
+rStrArr.push_back( rFormat);
+return rStrArr.size() - 1;
 }
 
 
@@ -4324,9 +4328,7 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( 
NfWSStringsDtor& rStrArr
  + ";"
  + aRed
  + aNegativeBank;
-addToCurrencyFormatsList( rStrArr, format2);
-
-nDefault = rStrArr.size() - 1;
+nDefault = addToCurrencyFormatsList( rStrArr, format2);
 }
 else
 {
@@ -4379,8 +4381,7 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( 
NfWSStringsDtor& rStrArr
 {
 addToCurrencyFormatsList( rStrArr, format3);
 }
-addToCurrencyFormatsList( rStrArr, format4);
-nDefault = rStrArr.size() - 1;
+nDefault = addToCurrencyFormatsList( rStrArr, format4);
 if (rCurr.GetDigits())
 {
 addToCurrencyFormatsList( rStrArr, format5);


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

2022-06-16 Thread Eike Rathke (via logerrit)
 svl/source/numbers/numfmuno.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit a4fa06be4f8cd4d2584a6f3e4c5bd02786e591ad
Author: Eike Rathke 
AuthorDate: Wed Jun 15 12:23:11 2022 +0200
Commit: Eike Rathke 
CommitDate: Thu Jun 16 11:21:46 2022 +0200

Related: tdf#149325 tdf#52602 SvNumberFormatsObj::addNew accept differing

... resulting format code of an existing format as not attempting
to add a duplicate. It makes no sense to insist on strictness if
the client can't know the rules..

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

diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 4e1ffed5b21f..8743ab578b4b 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -485,6 +485,14 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNew( const 
OUString& aFormat,
 {
 throw util::MalformedNumberFormatException(); // Invalid Format
 }
+else if (aFormStr != aFormat)
+{
+// The format exists but with a different format code string, and if it
+// was only uppercase vs lowercase keywords; but also syntax extensions
+// are possible like resulting embedded LCIDs and what not the client
+// doesn't know about. Silently accept instead of throwing an error.
+nRet = nKey;
+}
 else
 throw uno::RuntimeException(); // Other error (e.g. already added)
 


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

2022-06-15 Thread Mike Kaganski (via logerrit)
 svl/source/numbers/numfmuno.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit eeb6f0740903a7e78156cf755cc442383ace77d9
Author: Mike Kaganski 
AuthorDate: Wed Jun 15 11:13:23 2022 +0200
Commit: Mike Kaganski 
CommitDate: Wed Jun 15 14:29:48 2022 +0200

Use rtl::isAsceeLowerCase/rtl::toAsciiUpperCase

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

diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 4c3d4abda553..4e1ffed5b21f 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -449,8 +450,8 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::queryKey( const 
OUString& aFormat,
 }
 else if (*p == '"')
 bQuoted = true;
-else if ('a' <= *p && *p <= 'z')
-*p -= 0x20; // upper
+else if (rtl::isAsciiLowerCase(*p))
+*p = rtl::toAsciiUpperCase(*p);
 else if (*p == '\\')
 ++p;// skip escaped next char
 // Theoretically that should cater for UTF-32 with


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

2022-06-15 Thread Eike Rathke (via logerrit)
 svl/source/numbers/numfmuno.cxx |   51 ++--
 1 file changed, 49 insertions(+), 2 deletions(-)

New commits:
commit 8661d5579bd19a9e294ddff64bbe817b537dbd46
Author: Eike Rathke 
AuthorDate: Tue Jun 14 17:21:18 2022 +0200
Commit: Eike Rathke 
CommitDate: Wed Jun 15 11:03:53 2022 +0200

Resolves: tdf#149325 tdf#52602 SvNumberFormatsObj::queryKey try also 
uppercase

... keywords; that should catch most lower case queries. If there
are still remaining mismatches then either implement the bScan
thing, or enhance addNew() to not fail on case-different format
codes. That could be hit for the `General` keyword, for example.

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

diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 98ead86e432d..4c3d4abda553 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -411,8 +411,55 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::queryKey( const 
OUString& aFormat,
 {
 //! FIXME: Something still needs to happen here ...
 }
-sal_Int32 nRet = pFormatter->GetEntryKey( aFormat, eLang );
-return nRet;
+sal_uInt32 nRet = pFormatter->GetEntryKey( aFormat, eLang );
+if (nRet == NUMBERFORMAT_ENTRY_NOT_FOUND)
+{
+// This seems to be a workaround for what maybe the bScan option was
+// intended for? Tokenize the format code?
+
+// The format string based search is vague and fuzzy, as it is case
+// sensitive, but the format string is only half way cased, the
+// keywords (except the "General" keyword) are uppercased and literals
+// of course are not. Clients using this queryKey() and if not
+// successful addNew() may still fail if the result of PutEntry() is
+// false because the format actually existed, just with a different
+// casing. The only clean way is to just use PutEntry() and ignore the
+// duplicate case, which clients can't because the API doesn't provide
+// the information.
+// Try just another possibilty here, without any guarantee.
+
+// Use only ASCII upper, because keywords are only those.
+// Do not transliterate any quoted literals.
+const sal_Int32 nLen = aFormat.getLength();
+OUStringBuffer aBuf(0);
+sal_Unicode* p = aBuf.appendUninitialized( nLen + 1);
+memcpy( p, aFormat.getStr(), (nLen + 1) * sizeof(sal_Unicode));   // 
including 0-char
+aBuf.setLength( nLen);
+assert(p == aBuf.getStr());
+sal_Unicode const * const pStop = p + aBuf.getLength();
+bool bQuoted = false;
+for ( ; p < pStop; ++p)
+{
+if (bQuoted)
+{
+// Format codes don't have embedded doubled quotes, i.e. "a""b"
+// is two literals displayed as `ab`.
+if (*p == '"')
+bQuoted = false;
+}
+else if (*p == '"')
+bQuoted = true;
+else if ('a' <= *p && *p <= 'z')
+*p -= 0x20; // upper
+else if (*p == '\\')
+++p;// skip escaped next char
+// Theoretically that should cater for UTF-32 with
+// iterateCodePoints(), but such character would not match any
+// of [a-z\"] in its UTF-16 units.
+}
+nRet = pFormatter->GetEntryKey( aBuf, eLang );
+}
+return static_cast(nRet);
 }
 
 sal_Int32 SAL_CALL SvNumberFormatsObj::addNew( const OUString& aFormat,


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

2022-05-28 Thread Noel Grandin (via logerrit)
 svl/source/items/itemset.cxx |   29 +++--
 1 file changed, 11 insertions(+), 18 deletions(-)

New commits:
commit 1cfa3f8694d4b585549e6dae7396d408184106cb
Author: Noel Grandin 
AuthorDate: Sat May 28 17:05:03 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat May 28 19:31:20 2022 +0200

simplify SfxItemSet::Differentiate and SfxItemSet::Intersect

using SfxWhichIter instead of SfxItemIter

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 842bc2d16623..e0e1ee8823a3 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -887,17 +887,14 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet )
 }
 else
 {
-SfxItemIter aIter( *this );
-const SfxPoolItem* pItem = aIter.GetCurItem();
-do
+SfxWhichIter aIter( *this );
+sal_uInt16 nWhich = aIter.FirstWhich();
+while ( nWhich )
 {
-sal_uInt16 nWhich = IsInvalidItem( pItem )
-? GetWhichByPos( aIter.GetCurPos() )
-: pItem->Which();
 if( SfxItemState::UNKNOWN == rSet.GetItemState( nWhich, false ) )
-ClearItem( nWhich );// Delete
-pItem = aIter.NextItem();
-} while (pItem);
+ClearItem( nWhich ); // Delete
+nWhich = aIter.NextWhich();
+}
 }
 }
 
@@ -936,18 +933,14 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet )
 }
 else
 {
-SfxItemIter aIter( *this );
-const SfxPoolItem* pItem = aIter.GetCurItem();
-do
+SfxWhichIter aIter( *this );
+sal_uInt16 nWhich = aIter.FirstWhich();
+while ( nWhich )
 {
-sal_uInt16 nWhich = IsInvalidItem( pItem )
-? GetWhichByPos( aIter.GetCurPos() )
-: pItem->Which();
 if( SfxItemState::SET == rSet.GetItemState( nWhich, false ) )
 ClearItem( nWhich ); // Delete
-pItem = aIter.NextItem();
-} while (pItem);
-
+nWhich = aIter.NextWhich();
+}
 }
 }
 


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

2022-05-26 Thread Noel Grandin (via logerrit)
 svl/source/items/itemset.cxx |   25 -
 1 file changed, 20 insertions(+), 5 deletions(-)

New commits:
commit 7f6fbed9f195078ed63760f1206a328f38571ba8
Author: Noel Grandin 
AuthorDate: Thu May 26 12:47:29 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu May 26 15:43:56 2022 +0200

ofz#24932-1 walk ItemSets together in SfxItemSet::Set

shaves 20% off the time of
./instdir/program/soffice.bin --calc --convert-to pdf
~/Downloads/ofz24932-1.rtf

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 7953cd922363..2d90ab16eac7 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -707,14 +707,29 @@ bool SfxItemSet::Set
 ClearItem();
 if ( bDeep )
 {
-SfxWhichIter aIter(*this);
-sal_uInt16 nWhich = aIter.FirstWhich();
-while ( nWhich )
+SfxWhichIter aIter1(*this);
+SfxWhichIter aIter2(rSet);
+sal_uInt16 nWhich1 = aIter1.FirstWhich();
+sal_uInt16 nWhich2 = aIter2.FirstWhich();
+for (;;)
 {
+if (!nWhich1 || !nWhich2)
+break;
+if (nWhich1 > nWhich2)
+{
+nWhich2 = aIter2.NextWhich();
+continue;
+}
+if (nWhich1 < nWhich2)
+{
+nWhich1 = aIter1.NextWhich();
+continue;
+}
 const SfxPoolItem* pItem;
-if( SfxItemState::SET == rSet.GetItemState( nWhich, true, &pItem ) 
)
+if( SfxItemState::SET == rSet.GetItemState( nWhich1, true, &pItem 
) )
 bRet |= nullptr != Put( *pItem, pItem->Which() );
-nWhich = aIter.NextWhich();
+nWhich1 = aIter1.NextWhich();
+nWhich2 = aIter2.NextWhich();
 }
 }
 else


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

2022-05-23 Thread Michael Stahl (via logerrit)
 svl/source/misc/sharedstringpool.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 694db7d3e7be0caf81dd52dba1a865db206ac145
Author: Michael Stahl 
AuthorDate: Sun May 22 12:26:48 2022 +0200
Commit: Michael Stahl 
CommitDate: Mon May 23 10:40:54 2022 +0200

svl: spurious GCC12 -Werror=maybe-uninitialized

In file included from svl/source/misc/sharedstringpool.cxx:11:
In constructor ‘svl::SharedString::SharedString(rtl_uString*, 
rtl_uString*)’,
inlined from ‘svl::SharedString svl::SharedStringPool::intern(const 
rtl::OUString&)’ at svl/source/misc/sharedstringpool.cxx:129:51:
include/svl/sharedstring.hxx:56:20: error: ‘pResultUpper’ may be used 
uninitialized [-Werror=maybe-uninitialized]
   56 | mpData(pData), mpDataIgnoreCase(pDataIgnoreCase)
  |^
svl/source/misc/sharedstringpool.cxx: In member function ‘svl::SharedString 
svl::SharedStringPool::intern(const rtl::OUString&)’:
svl/source/misc/sharedstringpool.cxx:93:33: note: ‘pResultUpper’ was 
declared here
   93 | rtl_uString *pResultLower, *pResultUpper;
  | ^~~~

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

diff --git a/svl/source/misc/sharedstringpool.cxx 
b/svl/source/misc/sharedstringpool.cxx
index a37c36b641d7..4f891d3677d1 100644
--- a/svl/source/misc/sharedstringpool.cxx
+++ b/svl/source/misc/sharedstringpool.cxx
@@ -90,7 +90,7 @@ SharedString SharedStringPool::intern(const OUString& rStr)
 {
 auto& rMap = mpImpl->maStrMap;
 
-rtl_uString *pResultLower, *pResultUpper;
+rtl_uString *pResultLower = {}, *pResultUpper = {}; // bogus GCC 12 
-Werror=maybe-uninitialized
 if (rMap.find_fn(rStr.pData, [&](const Mapped& rMapped) {
 pResultLower = rMapped.first.pData;
 pResultUpper = rMapped.second.pData;


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

2022-05-07 Thread Caolán McNamara (via logerrit)
 svl/source/crypto/cryptosign.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6a5ebe0766e221b4b900a8c968faac7ec6e0b9e1
Author: Caolán McNamara 
AuthorDate: Sat May 7 10:30:59 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sat May 7 21:23:59 2022 +0200

cid#1504313 Uninitialized pointer read

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

diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index 1e284506de01..1d6337845569 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -971,8 +971,8 @@ bool Signing::Sign(OStringBuffer& rCMSHexBuffer)
 digest.len = aHashResult.size();
 
 PRTime now = PR_Now();
-NSSCMSSignedData *cms_sd;
-NSSCMSSignerInfo *cms_signer;
+NSSCMSSignedData *cms_sd(nullptr);
+NSSCMSSignerInfo *cms_signer(nullptr);
 NSSCMSMessage *cms_msg = CreateCMSMessage(nullptr, &cms_sd, &cms_signer, 
cert, &digest);
 if (!cms_msg)
 return false;


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

2022-05-06 Thread Michael Stahl (via logerrit)
 svl/source/passwordcontainer/passwordcontainer.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit bbb8617ece6d946957c2eb96287081029bce530f
Author: Michael Stahl 
AuthorDate: Fri May 6 12:21:50 2022 +0200
Commit: Michael Stahl 
CommitDate: Fri May 6 15:24:25 2022 +0200

svl: fix crash if user cancels/closes master password dialog

(regression from d7ba5614d90381d68f880ca7e7c5ef8bbb1b1c43)

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

diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx 
b/svl/source/passwordcontainer/passwordcontainer.cxx
index 9dd1b7eb7ebb..0abddc2d6b13 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -1104,8 +1104,10 @@ sal_Bool SAL_CALL 
PasswordContainer::authorizateWithMasterPassword( const uno::R
 do {
 aPass = RequestPasswordFromUser( aRMode, xTmpHandler );
 
-if (m_xStorageFile->getStorageVersion() == 0)
+if (!aPass.isEmpty() && 
m_xStorageFile->getStorageVersion() == 0)
+{
 aPass = ReencodeAsOldHash(aPass);
+}
 
 bResult = ( !aPass.isEmpty() && aPass == m_aMasterPassword 
);
 aRMode = PasswordRequestMode_PASSWORD_REENTER; // further 
questions with error notification


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

2022-04-29 Thread Michael Stahl (via logerrit)
 svl/source/crypto/cryptosign.cxx |   27 ++-
 1 file changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 5592ee094ca9f09bfcc16537d931518d4e6b2231
Author: Michael Stahl 
AuthorDate: Thu Apr 28 16:31:51 2022 +0200
Commit: Michael Stahl 
CommitDate: Fri Apr 29 13:06:31 2022 +0200

svl: fix testSignDocument_PEM_PDF with "dbm:" NSS DB

CentOS 7 system NSS defaults to legacy "dbm:" DB.

  test_desktop_lib.cxx:2943:Assertion
  Test name: DesktopLOKTest::testSignDocument_PEM_PDF
  assertion failed
  - Expression: bResult

NSS_CMSSignerInfo_Sign() (called from NSS_CMSEncoder_Finish())
internally calls PK11_FindKeyByAnyCert() and that fails likely for same
reasons as documented in previous commit.

The workaround here is a bit more involved, it turns out there's another
path with NSSCMSSignerID_SubjectKeyID where the caller can pass in a
SECKEYPrivateKey, let's try to do that as a fallback if a manual call to
find the key fails.

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

diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index ff8120ede34a..1e284506de01 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -33,6 +33,8 @@
 #if USE_CRYPTO_NSS
 // NSS headers for PDF signing
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -634,7 +636,30 @@ NSSCMSMessage *CreateCMSMessage(const PRTime* time,
 return nullptr;
 }
 
-*cms_signer = NSS_CMSSignerInfo_Create(result, cert, SEC_OID_SHA256);
+// workaround: with legacy "dbm:", NSS can't find the private key - try out
+// if it works, and fallback if it doesn't.
+if (SECKEYPrivateKey * pPrivateKey = PK11_FindKeyByAnyCert(cert, nullptr))
+{
+SECKEY_DestroyPrivateKey(pPrivateKey);
+*cms_signer = NSS_CMSSignerInfo_Create(result, cert, SEC_OID_SHA256);
+}
+else
+{
+pPrivateKey = PK11_FindKeyByDERCert(cert->slot, cert, nullptr);
+SECKEYPublicKey *const pPublicKey = CERT_ExtractPublicKey(cert);
+if (pPublicKey && pPrivateKey)
+{
+*cms_signer = NSS_CMSSignerInfo_CreateWithSubjKeyID(result, 
&cert->subjectKeyID, pPublicKey, pPrivateKey, SEC_OID_SHA256);
+SECKEY_DestroyPrivateKey(pPrivateKey);
+SECKEY_DestroyPublicKey(pPublicKey);
+if (*cms_signer)
+{
+// this is required in NSS_CMSSignerInfo_IncludeCerts()
+// (and NSS_CMSSignerInfo_GetSigningCertificate() doesn't work)
+(**cms_signer).cert = CERT_DupCertificate(cert);
+}
+}
+}
 if (!*cms_signer)
 {
 SAL_WARN("svl.crypto", "NSS_CMSSignerInfo_Create failed");


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

2022-04-27 Thread Noel Grandin (via logerrit)
 svl/source/numbers/zforfind.cxx |   14 +++---
 svl/source/numbers/zforfind.hxx |2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 3791aff7ba4481cc4a357b7223440bf785469bb3
Author: Noel Grandin 
AuthorDate: Tue Apr 26 17:57:07 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Apr 27 14:01:47 2022 +0200

use string_view in ImpSvNumberInputScan::StringToDouble

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 52bf1a9d1131..ac9fe7a9851a 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -152,13 +152,13 @@ static void TransformInput( SvNumberFormatter const * 
pFormatter, OUString& rStr
  * Only simple unsigned floating point values without any error detection,
  * decimal separator has to be '.'
  */
-double ImpSvNumberInputScan::StringToDouble( const OUString& rStr, bool 
bForceFraction )
+double ImpSvNumberInputScan::StringToDouble( std::u16string_view aStr, bool 
bForceFraction )
 {
 std::unique_ptr bufInHeap;
 constexpr int bufOnStackSize = 256;
 char bufOnStack[bufOnStackSize];
 char* buf = bufOnStack;
-const sal_Int32 bufsize = rStr.getLength() + (bForceFraction ? 2 : 1);
+const sal_Int32 bufsize = aStr.size() + (bForceFraction ? 2 : 1);
 if (bufsize > bufOnStackSize)
 {
 bufInHeap = std::make_unique(bufsize);
@@ -167,9 +167,9 @@ double ImpSvNumberInputScan::StringToDouble( const 
OUString& rStr, bool bForceFr
 char* p = buf;
 if (bForceFraction)
 *p++ = '.';
-for (sal_Int32 nPos = 0; nPos < rStr.getLength(); ++nPos)
+for (size_t nPos = 0; nPos < aStr.size(); ++nPos)
 {
-sal_Unicode c = rStr[nPos];
+sal_Unicode c = aStr[nPos];
 if (c == '.' || (c >= '0' && c <= '9'))
 *p++ = static_cast(c);
 else
@@ -4046,7 +4046,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const 
OUString& rString, // s
 
 if (eScannedType != SvNumFormatType::SCIENTIFIC)
 {
-fOutNumber = StringToDouble(sResString.makeStringAndClear());
+fOutNumber = StringToDouble(sResString);
 }
 else
 {   // append exponent
@@ -4106,7 +4106,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const 
OUString& rString, // s
 {
 sResString = sStrArray[nNums[0]];
 sResString.append(sStrArray[nNums[1]]); // integer part
-fOutNumber = 
StringToDouble(sResString.makeStringAndClear());
+fOutNumber = StringToDouble(sResString);
 }
 else
 {
@@ -4133,7 +4133,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const 
OUString& rString, // s
 sResString.append(sStrArray[nNums[k]]);
 }
 }
-fOutNumber = StringToDouble(sResString.makeStringAndClear());
+fOutNumber = StringToDouble(sResString);
 
 if (k == nNumericsCnt-2)
 {
diff --git a/svl/source/numbers/zforfind.hxx b/svl/source/numbers/zforfind.hxx
index 472cf156ddf9..9c1e9e967ff6 100644
--- a/svl/source/numbers/zforfind.hxx
+++ b/svl/source/numbers/zforfind.hxx
@@ -193,7 +193,7 @@ private:
 // decimal separator has to be '.'
 // If bForceFraction==true the string is taken to be the fractional part
 // of 0.1234 without the leading 0. (thus being just "1234").
-static double StringToDouble( const OUString& rStr,
+static double StringToDouble( std::u16string_view aStr,
   bool bForceFraction = false );
 
 // Next number/string symbol


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

2022-04-10 Thread Andrea Gelmini (via logerrit)
 svl/source/numbers/zformat.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 35bf17d758e67c939b8abcc5355e674030e135ac
Author: Andrea Gelmini 
AuthorDate: Sat Apr 9 23:04:36 2022 +0200
Commit: Julien Nabet 
CommitDate: Sun Apr 10 18:16:13 2022 +0200

Removed duplicated include

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

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index eb0020669cd6..5dd32843d0dd 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -22,7 +22,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 


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

2022-04-08 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforfind.cxx |   23 +++
 1 file changed, 23 insertions(+)

New commits:
commit 7a16002ede5fd31ae8f3358136ad49de40465ac1
Author: Eike Rathke 
AuthorDate: Fri Apr 8 21:46:47 2022 +0200
Commit: Eike Rathke 
CommitDate: Sat Apr 9 02:23:54 2022 +0200

Resolves: tdf#148052 accept a ". Month " name for matching DMY format

... even if the locale doesn't define such DM order or
LongDateDaySeparator.

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 438eacabc893..b0207a4df2be 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -2604,6 +2604,29 @@ bool ImpSvNumberInputScan::ScanMidString( const 
OUString& rString, sal_uInt16 nS
 SkipBlanks(rString, nPos);
 bDate = SkipString( rDate, rString, nPos);  // 10.  10-  10/
 }
+if (!bDate && nStringPos == 1 && mpFormat && (mpFormat->GetType() & 
SvNumFormatType::DATE))
+{
+// If a DMY format was given and a mid string starts with a literal
+// ". " dot+space and could contain a following month name and ends
+// with a space or LongDateMonthSeparator, like it's scanned in
+// `14". AUG "18`, then it may be a date as well. Regardless whether
+// defined such by the locale or not.
+// This *could* check for presence of ". "MMM or ". " in the actual
+// format code for further restriction to match only if present, but..
+
+const sal_uInt32 nExactDateOrder = mpFormat->GetExactDateOrder();
+// Exactly DMY.
+if (((nExactDateOrder & 0xff) == 'Y') && (((nExactDateOrder >> 8) & 
0xff) == 'M')
+&& (((nExactDateOrder >> 16) & 0xff) == 'D'))
+{
+const sal_Int32 nTmpPos = nPos;
+if (SkipChar('.', rString, nPos) && SkipBlanks(rString, nPos) && 
nPos + 2 < rString.getLength()
+&& (rString.endsWith(" ") || rString.endsWith( 
pLoc->getLongDateMonthSep(
+bDate = true;
+else
+nPos = nTmpPos;
+}
+}
 if (bDate || ((MayBeIso8601() || MayBeMonthDate()) &&// 1999-12-31  
31-Dec-1999
   SkipChar( '-', rString, nPos)))
 {


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

2022-02-18 Thread Noel Grandin (via logerrit)
 svl/source/items/itemset.cxx |   29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

New commits:
commit aa85b303cde517e187a7c3404f9b63f0a0752bf3
Author: Noel Grandin 
AuthorDate: Fri Feb 18 11:54:37 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Feb 18 12:15:43 2022 +0100

avoid an allocation in WhichRangesContainer::MergeRange

speeds up loading a large chart by 5%

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index bfaf0a60e169..7953cd922363 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1478,46 +1478,53 @@ WhichRangesContainer 
WhichRangesContainer::MergeRange(sal_uInt16 nFrom,
 
 // create vector of ranges (sal_uInt16 pairs of lower and upper bound)
 const size_t nOldCount = size();
-std::vector aRangesTable;
-aRangesTable.reserve(nOldCount);
+// Allocate one item more than we already have.
+// In the worst case scenario we waste a little bit
+// of memory, but we avoid another allocation, which is more important.
+std::unique_ptr aRangesTable(new WhichPair[nOldCount+1]);
+int aRangesTableSize = 0;
 bool bAdded = false;
 for (const auto& rPair : *this)
 {
 if (!bAdded && rPair.first >= nFrom)
 { // insert new range, keep ranges sorted
-aRangesTable.push_back({ nFrom, nTo });
+aRangesTable[aRangesTableSize++] = { nFrom, nTo };
 bAdded = true;
 }
 // insert current range
-aRangesTable.emplace_back(rPair);
+aRangesTable[aRangesTableSize++] = rPair;
 }
 if (!bAdded)
-aRangesTable.push_back({ nFrom, nTo });
+aRangesTable[aRangesTableSize++] = { nFrom, nTo };
 
 // true if ranges overlap or adjoin, false if ranges are separate
 auto needMerge = [](WhichPair lhs, WhichPair rhs) {
 return (lhs.first - 1) <= rhs.second && (rhs.first - 1) <= lhs.second;
 };
 
-auto it = aRangesTable.begin();
-// we got at least one range
+auto it = aRangesTable.get();
+auto endIt = aRangesTable.get() + aRangesTableSize;
+// we have at least one range at this point
 for (;;)
 {
 auto itNext = std::next(it);
-if (itNext == aRangesTable.end())
+if (itNext == endIt)
 break;
-// check neighbouring ranges, find first range which overlaps or 
adjoins a previous range
+// check if neighbouring ranges overlap or adjoin
 if (needMerge(*it, *itNext))
 {
 // lower bounds are sorted, implies: it->first = min(it[0].first, 
it[1].first)
 it->second = std::max(it->second, itNext->second);
-aRangesTable.erase(itNext);
+// remove next element
+std::move(std::next(itNext), endIt, itNext);
+--aRangesTableSize;
+endIt = aRangesTable.get() + aRangesTableSize;
 }
 else
 ++it;
 }
 
-return WhichRangesContainer(aRangesTable.data(), aRangesTable.size());
+return WhichRangesContainer(std::move(aRangesTable), aRangesTableSize);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2022-02-06 Thread Mike Kaganski (via logerrit)
 svl/source/numbers/zforfind.cxx |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 049bc1e7d7ca44767dc826fdda161e01306bf17b
Author: Mike Kaganski 
AuthorDate: Sun Feb 6 16:43:59 2022 +0100
Commit: Mike Kaganski 
CommitDate: Sun Feb 6 19:32:52 2022 +0100

No need to call makeStringAndClear to pass a string view

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 330921242a01..438eacabc893 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1432,11 +1432,10 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( 
sal_uInt16 nStartPatternAt )
 // Expand again in case of pattern "M. D. " and
 // input "M. D.  ", maybe fetched far, but...
 padToLength(aBuf, rPat.getLength() - nPat, ' ');
-OUString aStr = aBuf.makeStringAndClear();
-bOk = (rPat.indexOf( aStr, nPat) == nPat);
+bOk = (rPat.indexOf( aBuf, nPat) == nPat);
 if (bOk)
 {
-nPat += aStr.getLength() - 1;
+nPat += aBuf.getLength() - 1;
 }
 }
 }
@@ -1551,7 +1550,7 @@ bool ImpSvNumberInputScan::SkipDatePatternSeparator( 
sal_uInt16 nParticle, sal_I
 OUStringBuffer aBuf(sStrArray[nNext]);
 aBuf.stripEnd();
 padToLength(aBuf, rPat.getLength() - nPat, ' ');
-bOk = (rPat.indexOf( aBuf.makeStringAndClear(), nPat) == 
nPat);
+bOk = (rPat.indexOf(aBuf, nPat) == nPat);
 }
 if (bOk)
 {


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

2021-11-28 Thread Noel Grandin (via logerrit)
 svl/source/fsstor/fsstorage.cxx |2 +-
 svl/source/fsstor/fsstorage.hxx |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 786edb0fd0588147c58b3fbad1d936f0b2a26c6e
Author: Noel Grandin 
AuthorDate: Sun Nov 28 13:17:30 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Nov 28 18:11:10 2021 +0100

use more OInterfaceContainerHelper3 in svl

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

diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index 91e2e4c49ba2..9056b782d3b3 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -887,7 +887,7 @@ void SAL_CALL FSStorage::addEventListener(
 ::osl::MutexGuard aGuard( m_aMutex );
 
 if ( !m_pListenersContainer )
-m_pListenersContainer.reset(new 
::comphelper::OInterfaceContainerHelper2( m_aMutex ));
+m_pListenersContainer.reset(new 
::comphelper::OInterfaceContainerHelper3( m_aMutex 
));
 
 m_pListenersContainer->addInterface( xListener );
 }
diff --git a/svl/source/fsstor/fsstorage.hxx b/svl/source/fsstor/fsstorage.hxx
index 800d7d577489..2b0b7bc78c44 100644
--- a/svl/source/fsstor/fsstorage.hxx
+++ b/svl/source/fsstor/fsstorage.hxx
@@ -27,7 +27,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -42,7 +42,7 @@ class FSStorage : public css::lang::XTypeProvider
 OUString  m_aURL;
 ::ucbhelper::Content m_aContent;
 sal_Int32 m_nMode;
-std::unique_ptr<::comphelper::OInterfaceContainerHelper2> 
m_pListenersContainer; // list of listeners
+
std::unique_ptr<::comphelper::OInterfaceContainerHelper3>
 m_pListenersContainer; // list of listeners
 css::uno::Reference< css::uno::XComponentContext > m_xContext;
 
 public:


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

2021-11-18 Thread Michael Stahl (via logerrit)
 svl/source/passwordcontainer/passwordcontainer.component |1 +
 1 file changed, 1 insertion(+)

New commits:
commit dd43c74ee5778109f860e18419fc37fd9ab1c7dd
Author: Michael Stahl 
AuthorDate: Thu Nov 18 17:53:46 2021 +0100
Commit: Michael Stahl 
CommitDate: Thu Nov 18 21:12:59 2021 +0100

tdf#140086 svl: restore PasswordContainer to single-instance

(regression from 7256ff08bc46840bb85fa255ace6541dca91329e)

Change-Id: Ib640dea001fc787279761ca72bbc3db46d0102c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125485
Reviewed-by: Noel Grandin 
Reviewed-by: Michael Stahl 
Tested-by: Jenkins

diff --git a/svl/source/passwordcontainer/passwordcontainer.component 
b/svl/source/passwordcontainer/passwordcontainer.component
index e928461fa96b..109f45c5021c 100644
--- a/svl/source/passwordcontainer/passwordcontainer.component
+++ b/svl/source/passwordcontainer/passwordcontainer.component
@@ -20,6 +20,7 @@
 http://openoffice.org/2010/uno-components";>
   
 
   


  1   2   3   4   5   >