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


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

2021-11-15 Thread Miklos Vajna (via logerrit)
 svl/source/undo/undo.cxx |   16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 2a8506c2f20f18c948fb4dc5beb42b1010ad6999
Author: Miklos Vajna 
AuthorDate: Mon Nov 15 09:41:23 2021 +0100
Commit: Miklos Vajna 
CommitDate: Mon Nov 15 11:39:56 2021 +0100

svl: use std::rotate() in SfxUndoManager::ImplUndo()

Instead of manually moving out, moving a range and then moving in.

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

diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index e820a3cbb9d1..773d17313cea 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -689,15 +689,13 @@ bool SfxUndoManager::ImplUndo( SfxUndoContext* 
i_contextOrNull )
 size_t nOffset = i_contextOrNull->GetUndoOffset();
 if (nCurrent >= nOffset + 1)
 {
-// Move out the action we want to execute.
-MarkedUndoAction aAction
-= std::move(m_xData->pActUndoArray->maUndoActions[nCurrent - 1 
- nOffset]);
-// Move the actions after aAction down by one.
-std::move(m_xData->pActUndoArray->maUndoActions.data() + nCurrent 
- nOffset,
-  m_xData->pActUndoArray->maUndoActions.data() + nCurrent,
-  m_xData->pActUndoArray->maUndoActions.data() + nCurrent 
- nOffset - 1);
-// Move aAction to the top.
-m_xData->pActUndoArray->maUndoActions[nCurrent - 1] = 
std::move(aAction);
+// Move the action we want to execute to the top of the undo stack.
+// data() + nCurrent - nOffset - 1 is the start, data() + nCurrent 
- nOffset is what we
+// want to move to the top, maUndoActions.data() + nCurrent is 
past the end/top of the
+// undo stack.
+std::rotate(m_xData->pActUndoArray->maUndoActions.data() + 
nCurrent - nOffset - 1,
+m_xData->pActUndoArray->maUndoActions.data() + 
nCurrent - nOffset,
+m_xData->pActUndoArray->maUndoActions.data() + 
nCurrent);
 }
 }
 


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

2021-11-12 Thread Miklos Vajna (via logerrit)
 svl/source/undo/undo.cxx   |   18 ++--
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   52 +
 sw/source/core/inc/UndoManager.hxx |4 -
 sw/source/core/undo/docundo.cxx|   26 +---
 sw/source/uibase/shells/basesh.cxx |5 +-
 5 files changed, 90 insertions(+), 15 deletions(-)

New commits:
commit 39f231360013e944a8713248359662b9f282d902
Author: Miklos Vajna 
AuthorDate: Fri Nov 12 08:39:35 2021 +0100
Commit: Miklos Vajna 
CommitDate: Fri Nov 12 12:46:22 2021 +0100

sw, out of order undo: allow multiple actions from other views

Previously we assumed that the action to be executed is always exactly
the top of the undo stack minus 1 element.

Extend this, so that in case an other view appends two or more elements
to the undo stack, we still find our undo action. Obviously only do this
if all those undo actions are independent from us.

This requires replacing the swap in svl/ with a move-out + move a range
down + move in construct.

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

diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index f84d2cda185a..e820a3cbb9d1 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -683,13 +683,21 @@ bool SfxUndoManager::ImplUndo( SfxUndoContext* 
i_contextOrNull )
 return false;
 }
 
-if (i_contextOrNull && i_contextOrNull->GetUndoOffset() == 1)
+if (i_contextOrNull && i_contextOrNull->GetUndoOffset() > 0)
 {
-if (m_xData->pActUndoArray->nCurUndoAction >= 2)
+size_t nCurrent = m_xData->pActUndoArray->nCurUndoAction;
+size_t nOffset = i_contextOrNull->GetUndoOffset();
+if (nCurrent >= nOffset + 1)
 {
-std::swap(
-
m_xData->pActUndoArray->maUndoActions[m_xData->pActUndoArray->nCurUndoAction - 
1],
-
m_xData->pActUndoArray->maUndoActions[m_xData->pActUndoArray->nCurUndoAction - 
2]);
+// Move out the action we want to execute.
+MarkedUndoAction aAction
+= std::move(m_xData->pActUndoArray->maUndoActions[nCurrent - 1 
- nOffset]);
+// Move the actions after aAction down by one.
+std::move(m_xData->pActUndoArray->maUndoActions.data() + nCurrent 
- nOffset,
+  m_xData->pActUndoArray->maUndoActions.data() + nCurrent,
+  m_xData->pActUndoArray->maUndoActions.data() + nCurrent 
- nOffset - 1);
+// Move aAction to the top.
+m_xData->pActUndoArray->maUndoActions[nCurrent - 1] = 
std::move(aAction);
 }
 }
 
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 4f0c7e3c5c7b..46a4eab3ac98 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -110,6 +110,7 @@ public:
 void testUndoLimiting();
 void testUndoReordering();
 void testUndoReorderingRedo();
+void testUndoReorderingMulti();
 void testUndoShapeLimiting();
 void testUndoDispatch();
 void testUndoRepairDispatch();
@@ -193,6 +194,7 @@ public:
 CPPUNIT_TEST(testUndoLimiting);
 CPPUNIT_TEST(testUndoReordering);
 CPPUNIT_TEST(testUndoReorderingRedo);
+CPPUNIT_TEST(testUndoReorderingMulti);
 CPPUNIT_TEST(testUndoShapeLimiting);
 CPPUNIT_TEST(testUndoDispatch);
 CPPUNIT_TEST(testUndoRepairDispatch);
@@ -1408,6 +1410,56 @@ void SwTiledRenderingTest::testUndoReorderingRedo()
 SfxViewShell::Current()->setLibreOfficeKitViewCallback(nullptr);
 }
 
+void SwTiledRenderingTest::testUndoReorderingMulti()
+{
+// Create two views and a document of 2 paragraphs.
+SwXTextDocument* pXTextDocument = createDoc();
+SwWrtShell* pWrtShell1 = pXTextDocument->GetDocShell()->GetWrtShell();
+int nView1 = SfxLokHelper::getView();
+int nView2 = SfxLokHelper::createView();
+
pXTextDocument->initializeForTiledRendering(uno::Sequence());
+SwWrtShell* pWrtShell2 = pXTextDocument->GetDocShell()->GetWrtShell();
+pWrtShell2->SplitNode();
+SfxLokHelper::setView(nView1);
+pWrtShell1->SttEndDoc(/*bStt=*/true);
+SwTextNode* pTextNode1 = pWrtShell1->GetCursor()->GetNode().GetTextNode();
+// View 1 types into the first paragraph.
+pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'a', 0);
+pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'a', 0);
+Scheduler::ProcessEventsToIdle();
+SfxLokHelper::setView(nView2);
+pWrtShell2->SttEndDoc(/*bStt=*/false);
+SwTextNode* pTextNode2 = pWrtShell2->GetCursor()->GetNode().GetTextNode();
+// View 2 types into the second paragraph, twice.
+pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0);
+pXTextDocument->p

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

2021-11-07 Thread Eike Rathke (via logerrit)
 svl/source/config/languageoptions.cxx |2 +-
 svtools/source/misc/langtab.cxx   |   13 +++--
 2 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 0f3c19ee61ec371aa32d9f51c3555d3ea8ae9eeb
Author: Eike Rathke 
AuthorDate: Sun Nov 7 19:00:41 2021 +0100
Commit: Eike Rathke 
CommitDate: Sun Nov 7 20:11:57 2021 +0100

Resolves: tdf#145386 Use "Default" for LANGUAGE_PROCESS_OR_USER_DEFAULT

There's no, specifically not in Writer, handling of the LCID
0x0400 LANGUAGE_PROCESS_OR_USER_DEFAULT language/locale concept
other than the number formatter mapping it to LANGUAGE_SYSTEM.

Use the LANGUAGE_SYSTEM "Default" string in UI (status bar, status
menu, language list) but keep the LCID, and don't append the
resolved locale string as it is also displayed both in the Font
Western and CJK listboxes.

This ends up as two list entries, like
* Default - English (UK)first entry
* Default   last entry
of which the second would be selected.

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

diff --git a/svl/source/config/languageoptions.cxx 
b/svl/source/config/languageoptions.cxx
index e04abe80f4da..2e7550b98758 100644
--- a/svl/source/config/languageoptions.cxx
+++ b/svl/source/config/languageoptions.cxx
@@ -48,7 +48,7 @@ SvtScriptType GetScriptTypeOfLanguage( LanguageType nLang )
 {
 if( LANGUAGE_DONTKNOW == nLang )
 nLang = LANGUAGE_ENGLISH_US;
-else if( LANGUAGE_SYSTEM == nLang  )
+else if (LANGUAGE_SYSTEM == nLang || LANGUAGE_PROCESS_OR_USER_DEFAULT == 
nLang)
 nLang = SvtSysLocale().GetLanguageTag().getLanguageType();
 
 sal_Int16 nScriptType = MsLangId::getScriptType( nLang );
diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx
index 9981cf6862b3..00e676d149ef 100644
--- a/svtools/source/misc/langtab.cxx
+++ b/svtools/source/misc/langtab.cxx
@@ -225,23 +225,24 @@ bool SvtLanguageTable::HasLanguageType( const 
LanguageType eType )
 
 OUString SvtLanguageTableImpl::GetString( const LanguageType eType ) const
 {
-LanguageType eLang = MsLangId::getReplacementForObsoleteLanguage( eType );
-sal_uInt32 nPos = FindIndex(eLang);
+const LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( 
eType);
+const sal_uInt32 nPos = (eType == LANGUAGE_PROCESS_OR_USER_DEFAULT ?
+FindIndex(LANGUAGE_SYSTEM) : FindIndex( nLang));
 
 if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < GetEntryCount() )
 return m_aStrings[nPos].first;
 
 // Obtain from ICU, or a geeky but usable-in-a-pinch lang-tag.
-OUString sLangTag( lcl_getDescription( LanguageTag(eType)));
+OUString sLangTag( lcl_getDescription( LanguageTag(nLang)));
 SAL_WARN("svtools.misc", "Language: 0x"
-<< std::hex << eType
+<< std::hex << nLang
 << " with unknown name, so returning lang-tag of: "
 << sLangTag);
 
 // And add it to the table if it is an on-the-fly-id, which it usually is,
 // so it is available in all subsequent language boxes.
-if (LanguageTag::isOnTheFlyID( eType))
-const_cast(this)->AddItem( sLangTag, eType);
+if (LanguageTag::isOnTheFlyID( nLang))
+const_cast(this)->AddItem( sLangTag, nLang);
 
 return sLangTag;
 }


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

2021-10-31 Thread Mike Kaganski (via logerrit)
 svl/source/crypto/cryptosign.cxx   |8 ++-
 svl/source/fsstor/fsstorage.cxx|2 
 svl/source/items/imageitm.cxx  |   10 +---
 svl/source/items/slstitm.cxx   |3 -
 svl/source/items/srchitem.cxx  |   48 +---
 svl/source/misc/msodocumentlockfile.cxx|   25 +-
 svl/source/misc/ownlist.cxx|9 ++-
 svl/source/misc/sharecontrolfile.cxx   |3 -
 svl/source/numbers/supservs.cxx|5 --
 svl/source/numbers/zforlist.cxx|   49 +
 svl/source/passwordcontainer/passwordcontainer.cxx |   32 ++---
 svl/source/passwordcontainer/syscreds.cxx  |   12 ++---
 12 files changed, 95 insertions(+), 111 deletions(-)

New commits:
commit 2d43223403aca309a051275159fdde2a084a8e51
Author: Mike Kaganski 
AuthorDate: Fri Oct 29 10:10:33 2021 +0300
Commit: Mike Kaganski 
CommitDate: Sun Oct 31 11:49:22 2021 +0100

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

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

diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index 25ac21b695c4..06080d221364 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -9,6 +9,7 @@
 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -1998,8 +1999,9 @@ bool Signing::Verify(const std::vector& 
aData,
 else
 {
 uno::Sequence aDerCert(pCertificate->derCert.len);
+auto aDerCertRange = asNonConstRange(aDerCert);
 for (size_t i = 0; i < pCertificate->derCert.len; ++i)
-aDerCert[i] = pCertificate->derCert.data[i];
+aDerCertRange[i] = pCertificate->derCert.data[i];
 OUStringBuffer aBuffer;
 comphelper::Base64::encode(aBuffer, aDerCert);
 SignatureInformation::X509Data temp;
@@ -2184,8 +2186,8 @@ bool Signing::Verify(const std::vector& 
aData,
 {
 // Write rInformation.ouX509Certificate.
 uno::Sequence aDerCert(pSignerCertContext->cbCertEncoded);
-for (size_t i = 0; i < pSignerCertContext->cbCertEncoded; ++i)
-aDerCert[i] = pSignerCertContext->pbCertEncoded[i];
+std::copy_n(pSignerCertContext->pbCertEncoded, 
pSignerCertContext->cbCertEncoded,
+aDerCert.getArray());
 OUStringBuffer aBuffer;
 comphelper::Base64::encode(aBuffer, aDerCert);
 SignatureInformation::X509Data temp;
diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index 5f4d5e2541bf..91e2e4c49ba2 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -794,7 +794,7 @@ uno::Sequence< OUString > SAL_CALL 
FSStorage::getElementNames()
 {
 OUString aName( xRow->getString( 1 ) );
 aResult.realloc( ++nSize );
-aResult[nSize-1] = aName;
+aResult.getArray()[nSize-1] = aName;
 }
 }
 }
diff --git a/svl/source/items/imageitm.cxx b/svl/source/items/imageitm.cxx
index 2c2a88600cc9..cba4b7103b82 100644
--- a/svl/source/items/imageitm.cxx
+++ b/svl/source/items/imageitm.cxx
@@ -54,12 +54,10 @@ bool SfxImageItem::operator==( const SfxPoolItem& rItem ) 
const
 
 bool SfxImageItem::QueryValue( css::uno::Any& rVal, sal_uInt8 ) const
 {
-css::uno::Sequence< css::uno::Any > aSeq( 4 );
-aSeq[0] <<= GetValue();
-aSeq[1] <<= sal_Int16(mnAngle);
-aSeq[2] <<= mbMirrored;
-aSeq[3] <<= maURL;
-
+css::uno::Sequence< css::uno::Any > aSeq{ css::uno::Any(GetValue()),
+  
css::uno::Any(sal_Int16(mnAngle)),
+  css::uno::Any(mbMirrored),
+  css::uno::Any(maURL) };
 rVal <<= aSeq;
 return true;
 }
diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx
index 54af346254d6..bf0e37684ba7 100644
--- a/svl/source/items/slstitm.cxx
+++ b/svl/source/items/slstitm.cxx
@@ -153,8 +153,9 @@ void SfxStringListItem::GetStringList( css::uno::Sequence< 
OUString >& rList ) c
 size_t nCount = mpList->size();
 
 rList.realloc( nCount );
+auto pList = rList.getArray();
 for( size_t i=0; i < nCount; i++ )
-rList[i] = (*mpList)[i];
+pList[i] = (*mpList)[i];
 }
 
 // virtual
diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx
index fb2c0e83047c..24a46e28bd0b 100644
--- a/svl/source/items/srchitem.cxx
+++ b/svl/source/items/srchitem.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -402,33 +403,26 @@ bool SvxSearchItem::QueryValue( css::uno::Any& rVal, 
sal_uInt8 nMemberId ) const
 {
   

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

2021-10-25 Thread Eike Rathke (via logerrit)
 svl/source/numbers/numfmuno.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9c364847d6eae7f486f60823090cbc39fc0b1016
Author: Eike Rathke 
AuthorDate: Mon Oct 25 11:48:20 2021 +0200
Commit: Eike Rathke 
CommitDate: Mon Oct 25 14:46:35 2021 +0200

Restore behaviour SvNumberFormatterServiceObj keep LANGUAGE_SYSTEM 
unresolved

Semantics were temporarily changed with

commit bba6a4ed92a0feb288a9dedd648d623bee02a3ce
CommitDate: Mon Oct 25 11:18:31 2021 +0200

Get rid of fuzziness in 
MsLangId::Conversion::convertIsoNamesToLanguage()

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

diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 416de9297179..84812f9c5eef 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -97,7 +97,7 @@ static const SfxItemPropertyMapEntry* 
lcl_GetNumberSettingsPropertyMap()
 
 static LanguageType lcl_GetLanguage( const lang::Locale& rLocale )
 {
-LanguageType eRet = LanguageTag( 
rLocale).makeFallback().getLanguageType(false);
+LanguageType eRet = LanguageTag::convertToLanguageTypeWithFallback( 
rLocale, false);
 if ( eRet == LANGUAGE_NONE )
 eRet = LANGUAGE_SYSTEM; //! or throw an exception?
 


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

2021-10-16 Thread Julien Nabet (via logerrit)
 svl/source/fsstor/ostreamcontainer.cxx |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 68314bdba8d91a7e30c0c061fd3e31847c6a8187
Author: Julien Nabet 
AuthorDate: Sat Oct 16 13:43:41 2021 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 16 20:58:09 2021 +0200

Simplify vector initialization in svl

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

diff --git a/svl/source/fsstor/ostreamcontainer.cxx 
b/svl/source/fsstor/ostreamcontainer.cxx
index 99b8afb1e9c0..bfa6962ee9c4 100644
--- a/svl/source/fsstor/ostreamcontainer.cxx
+++ b/svl/source/fsstor/ostreamcontainer.cxx
@@ -141,9 +141,11 @@ uno::Sequence< uno::Type > SAL_CALL 
OFSStreamContainer::getTypes()
 
 if ( !m_aTypes.hasElements() )
 {
-std::vector tmp;
-tmp.push_back(cppu::UnoType::get());
-tmp.push_back(cppu::UnoType::get());
+std::vector tmp
+{
+cppu::UnoType::get(),
+cppu::UnoType::get()
+};
 
 if ( m_xSeekable.is() )
 tmp.push_back(cppu::UnoType::get());


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

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

New commits:
commit 17915ab5202a4d7456e9bc031c3f6a72bc861844
Author: Noel Grandin 
AuthorDate: Tue Oct 5 08:12:58 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 5 15:18:16 2021 +0200

fix ubsan alloc-dealloc-mismatch

after
commit 503ab1ca9ae11978d9717557546c01ff598aaf88
Author: Noel Grandin 
Date:   Sat Oct 2 16:28:56 2021 +0200
Use placement new to avoid one of the allocation calls...

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index bd63de62f586..3b47719dbf04 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1267,7 +1267,7 @@ std::unique_ptr SfxItemSet::Clone(bool 
bItems, SfxItemPool *pToPool
 // Use placement new to avoid one of the allocation calls when 
constructing a new SfxItemSet.
 // This is effectively a run-time equivalent of the SfxItemSetFixed 
template.
 const int cnt = TotalCount();
-char* p = new char[sizeof(SfxItemSet) + (sizeof(const SfxPoolItem*) * 
cnt)];
+char* p = static_cast(::operator new(sizeof(SfxItemSet) + 
(sizeof(const SfxPoolItem*) * cnt)));
 SfxItemSet* pNewItemSet = reinterpret_cast(p);
 const SfxPoolItem** ppNewItems = reinterpret_cast(p 
+ sizeof(SfxItemSet));
 if (pToPool && pToPool != m_pPool)


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

2021-09-28 Thread Roman Kuznetsov (via logerrit)
 svl/source/misc/gridprinter.cxx |   16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

New commits:
commit aeb056fb2feab4dfc5a5c4928b54fa21756d824b
Author: Roman Kuznetsov 
AuthorDate: Mon Sep 27 18:29:59 2021 +0200
Commit: Roman Kuznetsov 
CommitDate: Tue Sep 28 10:43:14 2021 +0200

drop 'using namespace std' here

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

diff --git a/svl/source/misc/gridprinter.cxx b/svl/source/misc/gridprinter.cxx
index ae910e4f0cf7..070ed08b3eb9 100644
--- a/svl/source/misc/gridprinter.cxx
+++ b/svl/source/misc/gridprinter.cxx
@@ -17,8 +17,6 @@
 
 #include 
 
-using namespace std;
-
 namespace svl {
 
 // String ID
@@ -79,10 +77,10 @@ void GridPrinter::print( const char* pHeader ) const
 return;
 
 if (pHeader)
-cout << pHeader << endl;
+std::cout << pHeader << std::endl;
 
 MatrixImplType::size_pair_type ns = mpImpl->maMatrix.size();
-vector aColWidths(ns.column, 0);
+std::vector aColWidths(ns.column, 0);
 
 // Calculate column widths first.
 for (size_t row = 0; row < ns.row; ++row)
@@ -109,10 +107,10 @@ void GridPrinter::print( const char* pHeader ) const
 OUString aSep = aBuf.makeStringAndClear();
 
 // Now print to stdout.
-cout << aSep << endl;
+std::cout << aSep << std::endl;
 for (size_t row = 0; row < ns.row; ++row)
 {
-cout << "| ";
+std::cout << "| ";
 for (size_t col = 0; col < ns.column; ++col)
 {
 OUString aStr = mpImpl->maMatrix.get_string(row, col);
@@ -120,10 +118,10 @@ void GridPrinter::print( const char* pHeader ) const
 aBuf.append(aStr);
 for (size_t i = 0; i < nPadding; ++i)
 aBuf.append(u' ');
-cout << aBuf.makeStringAndClear() << " | ";
+std::cout << aBuf.makeStringAndClear() << " | ";
 }
-cout << endl;
-cout << aSep << endl;
+std::cout << std::endl;
+std::cout << aSep << std::endl;
 }
 }
 


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

2021-09-23 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforlist.cxx |   81 +++-
 1 file changed, 40 insertions(+), 41 deletions(-)

New commits:
commit f7d0c6b42a0a5ec98876006cd5048589219be741
Author: Eike Rathke 
AuthorDate: Thu Sep 23 19:19:31 2021 +0200
Commit: Eike Rathke 
CommitDate: Thu Sep 23 20:28:42 2021 +0200

Sort ZF_STANDARD_NEWEXTENDED_DATE_... into ZF_STANDARD_DATE category

The legacy of binary file format compatible internal indices is
gone so categories can as well be enlargened. It doesn't really
matter, just a "nicer to see" sequence.

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

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 721c71ce8b0a..755dda187b9b 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -68,26 +68,25 @@ using namespace ::std;
 #define ZF_STANDARD_PERCENT 10
 #define ZF_STANDARD_CURRENCY20
 #define ZF_STANDARD_DATE30
-#define ZF_STANDARD_TIME40
+#define ZF_STANDARD_TIME60
 #define ZF_STANDARD_DURATION(ZF_STANDARD_TIME + 4)
-#define ZF_STANDARD_DATETIME50
-#define ZF_STANDARD_SCIENTIFIC  60
-#define ZF_STANDARD_FRACTION65
-
-// Additional builtin formats not fitting into the first 10 of a category (TLOT
-// = The Legacy Of Templin; unfortunately TLOT intended only 10 builtin formats
-// per category, more would overwrite the next category):
-#define ZF_STANDARD_NEWEXTENDED_DATE_SYS_DMMM 75
-#define ZF_STANDARD_NEWEXTENDED_DATE_SYS_D 76
-#define ZF_STANDARD_NEWEXTENDED_DATE_SYS_NNDMMMYY 77
-#define ZF_STANDARD_NEWEXTENDED_DATE_SYS_NND 78
-#define ZF_STANDARD_NEWEXTENDED_DATE_SYS_D 79
-#define ZF_STANDARD_NEWEXTENDED_DATE_DIN_DMMM 80
-#define ZF_STANDARD_NEWEXTENDED_DATE_DIN_D 81
-#define ZF_STANDARD_NEWEXTENDED_DATE_DIN_MMDD 82
-#define ZF_STANDARD_NEWEXTENDED_DATE_DIN_YYMMDD 83
-#define ZF_STANDARD_NEWEXTENDED_DATE_DIN_MMDD 84
-#define ZF_STANDARD_NEWEXTENDED_DATE_WW 85
+#define ZF_STANDARD_DATETIME70
+#define ZF_STANDARD_SCIENTIFIC  80
+#define ZF_STANDARD_FRACTION85
+
+// Additional builtin formats, historically not fitting into the first 10 of a
+// category. Make sure it doesn't spill over to the next category.
+#define ZF_STANDARD_DATE_SYS_DMMM   (ZF_STANDARD_DATE + 10)
+#define ZF_STANDARD_DATE_SYS_D  (ZF_STANDARD_DATE + 11)
+#define ZF_STANDARD_DATE_SYS_NNDMMMYY   (ZF_STANDARD_DATE + 12)
+#define ZF_STANDARD_DATE_SYS_NND(ZF_STANDARD_DATE + 13)
+#define ZF_STANDARD_DATE_SYS_D  (ZF_STANDARD_DATE + 14)
+#define ZF_STANDARD_DATE_DIN_DMMM   (ZF_STANDARD_DATE + 15)
+#define ZF_STANDARD_DATE_DIN_D  (ZF_STANDARD_DATE + 16)
+#define ZF_STANDARD_DATE_DIN_MMDD   (ZF_STANDARD_DATE + 17)
+#define ZF_STANDARD_DATE_DIN_YYMMDD (ZF_STANDARD_DATE + 18)
+#define ZF_STANDARD_DATE_DIN_MMDD   (ZF_STANDARD_DATE + 19)
+#define ZF_STANDARD_DATE_WW (ZF_STANDARD_DATE + 20)
 
 #define ZF_STANDARD_LOGICAL SV_MAX_COUNT_STANDARD_FORMATS-1 //  99
 #define ZF_STANDARD_TEXTSV_MAX_COUNT_STANDARD_FORMATS   // 100
@@ -133,22 +132,22 @@ sal_uInt32 const indexTable[NF_INDEX_TABLE_ENTRIES] = {
 ZF_STANDARD_DATE + 7, // NF_DATE_SYS_DDMMYY
 ZF_STANDARD_DATE + 6, // NF_DATE_SYS_DDMM
 ZF_STANDARD_DATE + 9, // NF_DATE_SYS_DMMMYY
-ZF_STANDARD_NEWEXTENDED_DATE_SYS_DMMM, // NF_DATE_SYS_DMMM
-ZF_STANDARD_NEWEXTENDED_DATE_DIN_DMMM, // NF_DATE_DIN_DMMM
-ZF_STANDARD_NEWEXTENDED_DATE_SYS_D, // NF_DATE_SYS_D
-ZF_STANDARD_NEWEXTENDED_DATE_DIN_D, // NF_DATE_DIN_D
-ZF_STANDARD_NEWEXTENDED_DATE_SYS_NNDMMMYY, // NF_DATE_SYS_NNDMMMYY
+ZF_STANDARD_DATE_SYS_DMMM, // NF_DATE_SYS_DMMM
+ZF_STANDARD_DATE_DIN_DMMM, // NF_DATE_DIN_DMMM
+ZF_STANDARD_DATE_SYS_D, // NF_DATE_SYS_D
+ZF_STANDARD_DATE_DIN_D, // NF_DATE_DIN_D
+ZF_STANDARD_DATE_SYS_NNDMMMYY, // NF_DATE_SYS_NNDMMMYY
 ZF_STANDARD_DATE + 1, // NF_DATE_DEF_NNDDMMMYY
-ZF_STANDARD_NEWEXTENDED_DATE_SYS_NND, // NF_DATE_SYS_NND
-ZF_STANDARD_NEWEXTENDED_DATE_SYS_D, // 
NF_DATE_SYS_D
-ZF_STANDARD_NEWEXTENDED_DATE_DIN_MMDD, // NF_DATE_DIN_MMDD
-ZF_STANDARD_NEWEXTENDED_DATE_DIN_YYMMDD, // NF_DATE_DIN_YYMMDD
-ZF_STANDARD_NEWEXTENDED_DATE_DIN_MMDD, // NF_DATE_DIN_MMDD
+ZF_STANDARD_DATE_SYS_NND, // NF_DATE_SYS_NND
+ZF_STANDARD_DATE_SYS_D, // NF_DATE_SYS_D
+ZF_STANDARD_DATE_DIN_MMDD, // NF_DATE_DIN_MMDD
+ZF_STANDARD_DATE_DIN_YYMMDD, // NF_DATE_DIN_YYMMDD
+ZF_STANDARD_DATE_DIN_MMDD, // NF_DATE_DIN_MMDD
 ZF_STANDARD_DATE + 2, // NF_DATE_SYS_MMYY
 ZF_STA

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

2021-09-23 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforlist.cxx |   20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit c8d66a4d53acf1b0c0de45335015b72ee72cd0fd
Author: Eike Rathke 
AuthorDate: Thu Sep 23 16:23:47 2021 +0200
Commit: Eike Rathke 
CommitDate: Thu Sep 23 17:17:02 2021 +0200

Reorder the internal ZF_STANDARD_DATETIME offsets to a more logical sequence

These once were to be strictly kept for the binary file format but
nowadays only serve as a position / key index offset within the
numberformat map.

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

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index ae6710ee18f1..721c71ce8b0a 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -160,7 +160,7 @@ sal_uInt32 const indexTable[NF_INDEX_TABLE_ENTRIES] = {
 ZF_STANDARD_DATETIME + 1, // NF_DATETIME_SYS_DDMM_HHMMSS
 ZF_STANDARD_LOGICAL, // NF_BOOLEAN
 ZF_STANDARD_TEXT, // NF_TEXT
-ZF_STANDARD_DATETIME + 4, // NF_DATETIME_SYS_DDMM_HHMM
+ZF_STANDARD_DATETIME + 2, // NF_DATETIME_SYS_DDMM_HHMM
 ZF_STANDARD_FRACTION + 2, // NF_FRACTION_3D
 ZF_STANDARD_FRACTION + 3, // NF_FRACTION_2
 ZF_STANDARD_FRACTION + 4, // NF_FRACTION_4
@@ -168,10 +168,10 @@ sal_uInt32 const indexTable[NF_INDEX_TABLE_ENTRIES] = {
 ZF_STANDARD_FRACTION + 6, // NF_FRACTION_16
 ZF_STANDARD_FRACTION + 7, // NF_FRACTION_10
 ZF_STANDARD_FRACTION + 8, // NF_FRACTION_100
-ZF_STANDARD_DATETIME + 2, // NF_DATETIME_ISO_MMDD_HHMMSS
-ZF_STANDARD_DATETIME + 6, // NF_DATETIME_ISO_MMDD_HHMMSS000
-ZF_STANDARD_DATETIME + 3, // NF_DATETIME_ISO_MMDDTHHMMSS
-ZF_STANDARD_DATETIME + 5  // NF_DATETIME_ISO_MMDDTHHMMSS000
+ZF_STANDARD_DATETIME + 3, // NF_DATETIME_ISO_MMDD_HHMMSS
+ZF_STANDARD_DATETIME + 4, // NF_DATETIME_ISO_MMDD_HHMMSS000
+ZF_STANDARD_DATETIME + 5, // NF_DATETIME_ISO_MMDDTHHMMSS
+ZF_STANDARD_DATETIME + 6  // NF_DATETIME_ISO_MMDDTHHMMSS000
 };
 
 /**
@@ -2875,7 +2875,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 
CLOffset, bool bNoAdditio
 // DD.MM. HH:MM   System
 nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATETIME_SYS_DDMM_HHMM );
 ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + ZF_STANDARD_DATETIME+4 /* 
NF_DATETIME_SYS_DDMM_HHMM */ );
+ CLOffset + ZF_STANDARD_DATETIME+2 /* 
NF_DATETIME_SYS_DDMM_HHMM */ );
 
 const NfKeywordTable & rKeyword = pFormatScanner->GetKeywords();
 i18n::NumberFormatCode aSingleFormatCode;
@@ -2890,7 +2890,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 
CLOffset, bool bNoAdditio
 rKeyword[NF_KEY_MMI] + ":" +
 rKeyword[NF_KEY_SS];
 SvNumberformat* pFormat = ImpInsertFormat( aSingleFormatCode,
- CLOffset + ZF_STANDARD_DATETIME+2 /* 
NF_DATETIME_ISO_MMDD_HHMMSS */ );
+ CLOffset + ZF_STANDARD_DATETIME+3 /* 
NF_DATETIME_ISO_MMDD_HHMMSS */ );
 assert(pFormat);
 
 // -MM-DD HH:MM:SS,000   ISO (with blank instead of 'T') and
@@ -2904,7 +2904,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 
CLOffset, bool bNoAdditio
 rKeyword[NF_KEY_SS] + GetLocaleData()->getTime100SecSep() +
 "000";
 pFormat = ImpInsertFormat( aSingleFormatCode,
- CLOffset + ZF_STANDARD_DATETIME+6 /* 
NF_DATETIME_ISO_MMDD_HHMMSS000 */ );
+ CLOffset + ZF_STANDARD_DATETIME+4 /* 
NF_DATETIME_ISO_MMDD_HHMMSS000 */ );
 assert(pFormat);
 
 // -MM-DD"T"HH:MM:SS   ISO
@@ -2916,7 +2916,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 
CLOffset, bool bNoAdditio
 rKeyword[NF_KEY_MMI] + ":" +
 rKeyword[NF_KEY_SS];
 pFormat = ImpInsertFormat( aSingleFormatCode,
- CLOffset + ZF_STANDARD_DATETIME+3 /* 
NF_DATETIME_ISO_MMDDTHHMMSS */ );
+ CLOffset + ZF_STANDARD_DATETIME+5 /* 
NF_DATETIME_ISO_MMDDTHHMMSS */ );
 assert(pFormat);
 pFormat->SetComment("ISO 8601");// not to be localized
 
@@ -2930,7 +2930,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 
CLOffset, bool bNoAdditio
 rKeyword[NF_KEY_SS] + (GetLocaleData()->getTime100SecSep() == "." ? 
"." : ",") +
 "000";
 pFormat = ImpInsertFormat( aSingleFormatCode,
- CLOffset + ZF_STANDARD_DATETIME+5 /* 
NF_DATETIME_ISO_MMDDTHHMMSS000 */ );
+ CLOffset + ZF_STANDARD_DATETIME+6 /* 
NF_DATETIME_ISO_MMDDTHHMMSS000 */ );
 assert(pFormat);
 pFormat->SetComment("ISO 8601");// not to be localized
 


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

2021-09-21 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zformat.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e430d82ec56f34fb5ae45a50eb12cd03c7e40ba3
Author: Eike Rathke 
AuthorDate: Tue Sep 21 17:09:28 2021 +0200
Commit: Eike Rathke 
CommitDate: Tue Sep 21 18:46:32 2021 +0200

SvNumberformat: preserve error position if already set

ImpSvNumberformatScan::ScanType() may already return an error
position in which case FinalScan() is not executed but
nResultStringsCnt is set only there and otherwise 0, so after
ScanFormat() force a different error position only if both are 0.

This in the dialog positions the error selection correctly instead
of after the first character.

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

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 22a377a6cc69..0f618e75ca02 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1112,7 +1112,7 @@ SvNumberformat::SvNumberformat(OUString& rString,
 }
 sal_Int32 nStrPos = pSc->ScanFormat( sStr);
 sal_uInt16 nCnt = pSc->GetResultStringsCnt();
-if (nCnt == 0)  // error
+if (nCnt == 0 && nStrPos == 0)  // error
 {
 nStrPos = 1;
 }


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

2021-09-13 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforfind.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 366b5878015b8cd75ceb7f2db00d286dafa365bd
Author: Eike Rathke 
AuthorDate: Mon Sep 13 12:02:41 2021 +0200
Commit: Eike Rathke 
CommitDate: Mon Sep 13 16:25:22 2021 +0200

Check string bounds

Doesn't occur in practice because all date acceptance patterns
start with a YMD character, enforced by the dialog, but just in case..

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 9d3c3baec899..330921242a01 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1476,7 +1476,7 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( 
sal_uInt16 nStartPatternAt )
 {
 ++nPos;
 c = rPat[--nPatCheck];
-} while (c != 'Y' && c != 'M' && c != 'D');
+} while (c != 'Y' && c != 'M' && c != 'D' && 
nPatCheck > 0);
 }
 }
 }


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

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

New commits:
commit eb0b4ab2d3b86d77ee0edb652d4486343e5b3b1f
Author: Eike Rathke 
AuthorDate: Mon Sep 13 11:42:39 2021 +0200
Commit: Eike Rathke 
CommitDate: Mon Sep 13 13:57:19 2021 +0200

Resolves: tdf#116184 Check that there is no trailing number behind a match

... without being separated by a blank so the match is rejected if
it doesn't possibly form a date+time input and input can be
accepted as decimal fraction.

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 121b9bd406f6..9d3c3baec899 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1487,8 +1487,9 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( 
sal_uInt16 nStartPatternAt )
 if (!IsNum[nCheck])
 {
 // Trailing (or separating if time follows) blanks are ok.
-SkipBlanks( sStrArray[nCheck], nPos);
-if (nPos == sStrArray[nCheck].getLength())
+// No blank and a following number is not.
+const bool bBlanks = SkipBlanks( sStrArray[nCheck], nPos);
+if (nPos == sStrArray[nCheck].getLength() && (bBlanks || 
!IsNum[nNext]))
 {
 nAcceptedDatePattern = nPattern;
 return true;


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

2021-09-09 Thread Noel Grandin (via logerrit)
 svl/source/misc/sharedstringpool.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 89b8e97bf325a92f49756fe903b322653cd88266
Author: Noel Grandin 
AuthorDate: Thu Sep 9 10:17:33 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 9 11:16:49 2021 +0200

workaround -Wshadow in libcuckoo

that triggers with
gcc (Ubuntu 10.3.0-1ubuntu1~20.10) 10.3.0

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

diff --git a/svl/source/misc/sharedstringpool.cxx 
b/svl/source/misc/sharedstringpool.cxx
index bf1f5554b957..7abe3ea77507 100644
--- a/svl/source/misc/sharedstringpool.cxx
+++ b/svl/source/misc/sharedstringpool.cxx
@@ -15,6 +15,10 @@
 #include 
 #include 
 
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#endif
 #if defined __clang__
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wunused-parameter"
@@ -30,6 +34,9 @@
 #if defined __clang__
 #pragma clang diagnostic pop
 #endif
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
 
 namespace svl
 {


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

2021-09-03 Thread Noel Grandin (via logerrit)
 svl/source/items/style.cxx  |1 -
 svl/source/items/stylepool.cxx  |   10 +++---
 svl/source/numbers/numfmuno.cxx |1 -
 svl/source/undo/undo.cxx|2 --
 4 files changed, 3 insertions(+), 11 deletions(-)

New commits:
commit 58364e04cc4c5451af2086bdb01145ec89da2b8e
Author: Noel Grandin 
AuthorDate: Fri Sep 3 08:32:59 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 3 09:56:59 2021 +0200

clang-tidy:readability-redundant-member-init

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

diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 2e54c9f53439..791a625a7219 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -104,7 +104,6 @@ SfxStyleSheetBase::SfxStyleSheetBase( const OUString& 
rName, SfxStyleSheetBasePo
 : m_pPool( p )
 , nFamily( eFam )
 , aName( rName )
-, aParent()
 , aFollow( rName )
 , pSet( nullptr )
 , nMask(mask)
diff --git a/svl/source/items/stylepool.cxx b/svl/source/items/stylepool.cxx
index c241e61e85a1..b74d0cb94729 100644
--- a/svl/source/items/stylepool.cxx
+++ b/svl/source/items/stylepool.cxx
@@ -46,15 +46,11 @@ namespace {
 public:
 // #i86923#
 Node() // root node Ctor
-: mChildren(),
-  maItemSet(),
-  mpUpper( nullptr ),
+: mpUpper( nullptr ),
   mbIsItemIgnorable( false )
 {}
 Node( const SfxPoolItem& rItem, Node* pParent, const bool bIgnorable ) 
// child node Ctor
-: mChildren(),
-  maItemSet(),
-  mpItem( rItem.Clone() ),
+: mpItem( rItem.Clone() ),
   mpUpper( pParent ),
   mbIsItemIgnorable( bIgnorable )
 {}
@@ -353,7 +349,7 @@ private:
 public:
 // #i86923#
 explicit StylePoolImpl( SfxItemSet const * pIgnorableItems )
-: maRoot(),
+:
 #ifdef DEBUG
   mnCount(0),
 #endif
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index ffb139870cdb..8792597f54ff 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -105,7 +105,6 @@ static LanguageType lcl_GetLanguage( const lang::Locale& 
rLocale )
 }
 
 SvNumberFormatterServiceObj::SvNumberFormatterServiceObj()
-:m_aMutex()
 {
 }
 
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 2cc2890a9f93..630bb9deea5b 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -215,7 +215,6 @@ namespace svl::undo::impl
 explicit NotifyUndoListener( UndoListenerVoidMethod 
i_notificationMethod )
 :m_notificationMethod( i_notificationMethod )
 ,m_altNotificationMethod( nullptr )
-,m_sActionComment()
 {
 }
 
@@ -258,7 +257,6 @@ namespace svl::undo::impl
 explicit UndoManagerGuard( SfxUndoManager_Data& i_managerData )
 :m_rManagerData( i_managerData )
 ,m_aGuard( i_managerData.aMutex )
-,m_notifiers()
 {
 }
 


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

2021-08-23 Thread Noel Grandin (via logerrit)
 svl/source/fsstor/ostreamcontainer.cxx |  102 -
 svl/source/fsstor/ostreamcontainer.hxx |8 +-
 2 files changed, 54 insertions(+), 56 deletions(-)

New commits:
commit a19d84ca25827d1fbe0ab9b276eeff843546ec87
Author: Noel Grandin 
AuthorDate: Sun Aug 22 18:47:35 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 24 08:39:19 2021 +0200

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

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

diff --git a/svl/source/fsstor/ostreamcontainer.cxx 
b/svl/source/fsstor/ostreamcontainer.cxx
index e5ec14fd9388..99b8afb1e9c0 100644
--- a/svl/source/fsstor/ostreamcontainer.cxx
+++ b/svl/source/fsstor/ostreamcontainer.cxx
@@ -137,7 +137,7 @@ uno::Sequence< uno::Type > SAL_CALL 
OFSStreamContainer::getTypes()
 {
 if ( !m_aTypes.hasElements() )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( !m_aTypes.hasElements() )
 {
@@ -170,7 +170,7 @@ uno::Sequence< sal_Int8 > SAL_CALL 
OFSStreamContainer::getImplementationId()
 // XStream
 uno::Reference< io::XInputStream > SAL_CALL 
OFSStreamContainer::getInputStream()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -186,7 +186,7 @@ uno::Reference< io::XInputStream > SAL_CALL 
OFSStreamContainer::getInputStream()
 
 uno::Reference< io::XOutputStream > SAL_CALL 
OFSStreamContainer::getOutputStream()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -203,7 +203,7 @@ uno::Reference< io::XOutputStream > SAL_CALL 
OFSStreamContainer::getOutputStream
 // XComponent
 void SAL_CALL OFSStreamContainer::dispose()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -223,44 +223,37 @@ void SAL_CALL OFSStreamContainer::dispose()
 m_bOutputClosed = true;
 }
 
-if ( m_pListenersContainer )
-{
-lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) 
);
-m_pListenersContainer->disposeAndClear( aSource );
-}
-
+lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) );
+m_aListenersContainer.disposeAndClear( aGuard, aSource );
+aGuard.lock();
 m_bDisposed = true;
 }
 
 void SAL_CALL OFSStreamContainer::addEventListener( const uno::Reference< 
lang::XEventListener >& xListener )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
 
-if ( !m_pListenersContainer )
-m_pListenersContainer.reset(new 
::comphelper::OInterfaceContainerHelper2( m_aMutex ));
-
-m_pListenersContainer->addInterface( xListener );
+m_aListenersContainer.addInterface( xListener );
 }
 
 void SAL_CALL OFSStreamContainer::removeEventListener( const uno::Reference< 
lang::XEventListener >& xListener )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
 
-if ( m_pListenersContainer )
-m_pListenersContainer->removeInterface( xListener );
+m_aListenersContainer.removeInterface( xListener );
 }
 
 
 // XSeekable
 void SAL_CALL OFSStreamContainer::seek( sal_Int64 location )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -273,7 +266,7 @@ void SAL_CALL OFSStreamContainer::seek( sal_Int64 location )
 
 sal_Int64 SAL_CALL OFSStreamContainer::getPosition()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -286,7 +279,7 @@ sal_Int64 SAL_CALL OFSStreamContainer::getPosition()
 
 sal_Int64 SAL_CALL OFSStreamContainer::getLength()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -301,7 +294,7 @@ sal_Int64 SAL_CALL OFSStreamContainer::getLength()
 // XInputStream
 sal_Int32 SAL_CALL OFSStreamContainer::readBytes( uno::Sequence< sal_Int8 >& 
aData, sal_Int32 nBytesToRead )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -314,7 +307,7 @@ sal_Int32 SAL_CALL OFSStreamContainer::readBytes( 
uno::Sequence< sal_Int8 >& aDa
 
 sal_Int32 SAL_CALL OFSStreamContainer::readSomeBytes( uno::Sequence< sal_Int8 
>& aData, sal_Int32 nMaxBytesToRead )
 {
-::osl::MutexGuard aGuard( m_aMute

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

2021-08-23 Thread Noel Grandin (via logerrit)
 svl/source/fsstor/oinputstreamcontainer.cxx |   53 
 svl/source/fsstor/oinputstreamcontainer.hxx |8 ++--
 2 files changed, 28 insertions(+), 33 deletions(-)

New commits:
commit f111a887a08295d56cdc1f20bc980bedbe17c67d
Author: Noel Grandin 
AuthorDate: Sun Aug 22 18:42:20 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 24 08:39:03 2021 +0200

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

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

diff --git a/svl/source/fsstor/oinputstreamcontainer.cxx 
b/svl/source/fsstor/oinputstreamcontainer.cxx
index d473911a1419..1339096dce9f 100644
--- a/svl/source/fsstor/oinputstreamcontainer.cxx
+++ b/svl/source/fsstor/oinputstreamcontainer.cxx
@@ -92,7 +92,7 @@ void SAL_CALL OFSInputStreamContainer::release()
 
 sal_Int32 SAL_CALL OFSInputStreamContainer::readBytes( uno::Sequence< sal_Int8 
>& aData, sal_Int32 nBytesToRead )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -105,7 +105,7 @@ sal_Int32 SAL_CALL OFSInputStreamContainer::readBytes( 
uno::Sequence< sal_Int8 >
 
 sal_Int32 SAL_CALL OFSInputStreamContainer::readSomeBytes( uno::Sequence< 
sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -118,7 +118,7 @@ sal_Int32 SAL_CALL OFSInputStreamContainer::readSomeBytes( 
uno::Sequence< sal_In
 
 void SAL_CALL OFSInputStreamContainer::skipBytes( sal_Int32 nBytesToSkip )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -131,7 +131,7 @@ void SAL_CALL OFSInputStreamContainer::skipBytes( sal_Int32 
nBytesToSkip )
 
 sal_Int32 SAL_CALL OFSInputStreamContainer::available(  )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -144,20 +144,21 @@ sal_Int32 SAL_CALL OFSInputStreamContainer::available(  )
 
 void SAL_CALL OFSInputStreamContainer::closeInput(  )
 {
-::osl::MutexGuard aGuard( m_aMutex );
-
-if ( m_bDisposed )
-throw lang::DisposedException();
+{
+std::scoped_lock aGuard( m_aMutex );
 
-if ( !m_xInputStream.is() )
-throw uno::RuntimeException();
+if ( m_bDisposed )
+throw lang::DisposedException();
 
+if ( !m_xInputStream.is() )
+throw uno::RuntimeException();
+}
 dispose();
 }
 
 uno::Reference< io::XInputStream > SAL_CALL 
OFSInputStreamContainer::getInputStream()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -170,7 +171,7 @@ uno::Reference< io::XInputStream > SAL_CALL 
OFSInputStreamContainer::getInputStr
 
 uno::Reference< io::XOutputStream > SAL_CALL 
OFSInputStreamContainer::getOutputStream()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -180,7 +181,7 @@ uno::Reference< io::XOutputStream > SAL_CALL 
OFSInputStreamContainer::getOutputS
 
 void SAL_CALL OFSInputStreamContainer::seek( sal_Int64 location )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -193,7 +194,7 @@ void SAL_CALL OFSInputStreamContainer::seek( sal_Int64 
location )
 
 sal_Int64 SAL_CALL OFSInputStreamContainer::getPosition()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -206,7 +207,7 @@ sal_Int64 SAL_CALL OFSInputStreamContainer::getPosition()
 
 sal_Int64 SAL_CALL OFSInputStreamContainer::getLength()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::scoped_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -219,7 +220,7 @@ sal_Int64 SAL_CALL OFSInputStreamContainer::getLength()
 
 void SAL_CALL OFSInputStreamContainer::dispose(  )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bDisposed )
 throw lang::DisposedException();
@@ -229,37 +230,31 @@ void SAL_CALL OFSInputStreamContainer::dispose(  )
 
 m_xInputStream->closeInput();
 
-if ( m_pListenersContainer )
-{
-lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) 
);
-m_pListenersContainer->disposeAndClear( aSource );
-}
+lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) );
+m_

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

2021-08-20 Thread Caolán McNamara (via logerrit)
 svl/source/numbers/zforlist.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5dc9d944f1d1b65660a5a2c347f29b99bf72
Author: Caolán McNamara 
AuthorDate: Thu Aug 19 21:32:48 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 20 10:30:36 2021 +0200

msan: MemorySanitizer: use-of-uninitialized-value

nCheckPos is always set to something, but for nCheckPos != 0 nType might
be left uninitialized, so test nCheckPos == 0 before nType

seen in ooo76602-1.slk and ooo10703-1.html with 
distro-configs/LibreOfficeOssFuzz.conf

==623515==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x59600b4 in SvNumberFormatter::PutandConvertEntry(rtl::OUString&, 
int&, SvNumFormatType&, unsigned int&, o3tl::strong_int, o3tl::strong_int, bool, 
bool) svl/source/numbers/zforlist.cxx:658:72
#1 0x8c7f72 in ScImportExport::Sylk2Doc(SvStream&) 
sc/source/ui/docshell/impex.cxx:2130:48
#2 0x8bcb26 in ScImportExport::ImportStream(SvStream&, rtl::OUString 
const&, SotClipboardFormatId) sc/source/ui/docshell/impex.cxx:392:13
#3 0x650f4b in TestImportSLK sc/source/ui/docshell/docsh.cxx:3360:19
#4 0x6055a7 in LLVMFuzzerTestOneInput vcl/workben/slkfuzzer.cxx:87:11
#5 0x555b53 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, 
unsigned long) (/out/slkfuzzer+0x555b53)
#6 0x541622 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, 
unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:323:6
#7 0x54722e in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned 
char const*, unsigned long)) (/out/slkfuzzer+0x54722e)
#8 0x56fa82 in main 
/src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
#9 0x7fbd8b65ebf6 in __libc_start_main 
(/lib/x86_64-linux-gnu/libc.so.6+0x21bf6)
#10 0x51cc49 in _start (/out/slkfuzzer+0x51cc49)

  Uninitialized value was created by an allocation of 'nType' in the stack 
frame of function '_ZN14ScImportExport8Sylk2DocER8SvStream'
#0 0x8c27c0 in ScImportExport::Sylk2Doc(SvStream&) 
sc/source/ui/docshell/impex.cxx:1837

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

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 0d7c2d36eba1..6ef3dddcd016 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -652,7 +652,7 @@ bool SvNumberFormatter::PutandConvertEntry(OUString& 
rString,
 bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge, 
bReplaceBooleanEquivalent);
 pFormatScanner->SetConvertMode(false);
 
-if (bReplaceBooleanEquivalent && nType == SvNumFormatType::DEFINED && 
nCheckPos == 0
+if (bReplaceBooleanEquivalent && nCheckPos == 0 && nType == 
SvNumFormatType::DEFINED
 && nKey != NUMBERFORMAT_ENTRY_NOT_FOUND)
 {
 // The boolean string formats are always "user defined" without any


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

2021-08-08 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zformat.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5e69c5fbdb44cd782080e7f4d9ad89dc48b2d1b1
Author: Eike Rathke 
AuthorDate: Sun Aug 8 15:42:19 2021 +0200
Commit: Eike Rathke 
CommitDate: Sun Aug 8 16:44:25 2021 +0200

Year without leading 0 if era code is also used

 GG or GG 
shall display 1 BC not 0001 BC, or AD 1 not AD 0001

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

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 6cedc976c74c..6b68e79f1517 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -3835,7 +3835,7 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber,
 sBuff.append('-');
 }
 aStr = rCal.getDisplayString( CalendarDisplayCode::LONG_YEAR, 
nNatNum );
-if (aStr.getLength() < 4)
+if (aStr.getLength() < 4 && !lcl_hasEra(NumFor[nIx]))
 {
 using namespace comphelper::string;
 // Ensure that year consists of at least 4 digits, so it
@@ -4200,7 +4200,7 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber,
 sBuff.append('-');
 }
 aYear = rCal.getDisplayString( CalendarDisplayCode::LONG_YEAR, 
nNatNum );
-if (aYear.getLength() < 4)
+if (aYear.getLength() < 4 && !lcl_hasEra(NumFor[nIx]))
 {
 using namespace comphelper::string;
 // Ensure that year consists of at least 4 digits, so it


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

2021-08-02 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforfind.cxx |   16 
 1 file changed, 16 insertions(+)

New commits:
commit 4961dbaecc9e5cac57d99d2ea9d265a90daa4a8b
Author: Eike Rathke 
AuthorDate: Mon Aug 2 22:11:29 2021 +0200
Commit: Eike Rathke 
CommitDate: Tue Aug 3 01:11:11 2021 +0200

Resolves: tdf#143664 {de-*} accept "Mär" and "Mrz" for March

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 8b01debbb1d4..121b9bd406f6 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -649,9 +649,25 @@ short ImpSvNumberInputScan::GetMonth( const OUString& 
rString, sal_Int32& nPos )
 res = sal::static_int_cast< short >(-(i+1)); // negative
 break;  // for
 }
+else if (i == 2 && pFormatter->GetLanguageTag().getLanguage() == 
"de")
+{
+if (pUpperAbbrevMonthText[i] == u"M\u00C4R" && 
StringContainsWord( "MRZ", rString, nPos))
+{   // Accept MRZ for MÄR
+nPos = nPos + 3;
+res = sal::static_int_cast< short >(-(i+1)); // negative
+break;  // for
+}
+else if (pUpperAbbrevMonthText[i] == "MRZ" && 
StringContainsWord( u"M\u00C4R", rString, nPos))
+{   // And vice versa, accept MÄR for MRZ
+nPos = nPos + 3;
+res = sal::static_int_cast< short >(-(i+1)); // negative
+break;  // for
+}
+}
 else if (i == 8)
 {
 // This assumes the weirdness is applicable to all locales.
+// It is the case for at least en-* and de-* locales.
 if (pUpperAbbrevMonthText[i] == "SEPT" && StringContainsWord( 
"SEP", rString, nPos))
 {   // #102136# The correct English form of month September 
abbreviated is
 // SEPT, but almost every data contains SEP instead.


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

2021-08-02 Thread Noel Grandin (via logerrit)
 svl/source/undo/undo.cxx |   47 +++
 1 file changed, 23 insertions(+), 24 deletions(-)

New commits:
commit c4ff09fc8c55af1f5fadb452eef16b15be8e202a
Author: Noel Grandin 
AuthorDate: Mon Aug 2 18:56:06 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Aug 2 21:18:26 2021 +0200

flatten SfxUndoManager_Data a little

no need to allocate the SfxUndoArray separately

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

diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index ee9af634a4ba..2cc2890a9f93 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -155,8 +155,7 @@ typedef ::std::vector< SfxUndoListener* >   UndoListeners;
 struct SfxUndoManager_Data
 {
 ::osl::MutexaMutex;
-std::unique_ptr
-pUndoArray;
+SfxUndoArraymaUndoArray;
 SfxUndoArray*   pActUndoArray;
 
 sal_Int32   mnMarks;
@@ -169,7 +168,7 @@ struct SfxUndoManager_Data
 UndoListeners   aListeners;
 
 explicit SfxUndoManager_Data( size_t i_nMaxUndoActionCount )
-:pUndoArray( new SfxUndoArray( i_nMaxUndoActionCount ) )
+:maUndoArray( i_nMaxUndoActionCount )
 ,pActUndoArray( nullptr )
 ,mnMarks( 0 )
 ,mnEmptyMark(MARK_INVALID)
@@ -178,7 +177,7 @@ struct SfxUndoManager_Data
 ,mbClearUntilTopLevel( false )
 ,mbEmptyActions( true )
 {
-pActUndoArray = pUndoArray.get();
+pActUndoArray = &maUndoArray;
 }
 
 // Copy assignment is forbidden and not implemented.
@@ -512,7 +511,7 @@ void SfxUndoManager::ImplClearUndo( UndoManagerGuard& 
i_guard )
 
 void SfxUndoManager::ImplClearRedo( UndoManagerGuard& i_guard, bool const 
i_currentLevel )
 {
-SfxUndoArray* pUndoArray = ( i_currentLevel == 
SfxUndoManager::CurrentLevel ) ? m_xData->pActUndoArray : 
m_xData->pUndoArray.get();
+SfxUndoArray* pUndoArray = ( i_currentLevel == 
SfxUndoManager::CurrentLevel ) ? m_xData->pActUndoArray : &m_xData->maUndoArray;
 
 // clearance
 while ( pUndoArray->maUndoActions.size() > pUndoArray->nCurUndoAction )
@@ -554,7 +553,7 @@ bool SfxUndoManager::ImplAddUndoAction_NoNotify( 
std::unique_ptr
 ImplClearRedo( i_guard, SfxUndoManager::CurrentLevel );
 
 // respect max number
-if( m_xData->pActUndoArray == m_xData->pUndoArray.get() )
+if( m_xData->pActUndoArray == &m_xData->maUndoArray )
 {
 while(m_xData->pActUndoArray->maUndoActions.size() >= 
m_xData->pActUndoArray->nMaxUndoActions)
 {
@@ -596,7 +595,7 @@ void SfxUndoManager::AddUndoAction( 
std::unique_ptr pAction, bool
 size_t SfxUndoManager::GetUndoActionCount( bool const i_currentLevel ) const
 {
 UndoManagerGuard aGuard( *m_xData );
-const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : 
m_xData->pUndoArray.get();
+const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : 
&m_xData->maUndoArray;
 return pUndoArray->nCurUndoAction;
 }
 
@@ -606,7 +605,7 @@ OUString SfxUndoManager::GetUndoActionComment( size_t nNo, 
bool const i_currentL
 UndoManagerGuard aGuard( *m_xData );
 
 OUString sComment;
-const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : 
m_xData->pUndoArray.get();
+const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : 
&m_xData->maUndoArray;
 assert(nNo < pUndoArray->nCurUndoAction);
 if( nNo < pUndoArray->nCurUndoAction )
 sComment = pUndoArray->maUndoActions[ pUndoArray->nCurUndoAction - 1 - 
nNo ].pAction->GetComment();
@@ -735,7 +734,7 @@ size_t SfxUndoManager::GetRedoActionCount( bool const 
i_currentLevel ) const
 
 size_t SfxUndoManager::ImplGetRedoActionCount_Lock( bool const i_currentLevel 
) const
 {
-const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : 
m_xData->pUndoArray.get();
+const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : 
&m_xData->maUndoArray;
 return pUndoArray->maUndoActions.size() - pUndoArray->nCurUndoAction;
 }
 
@@ -757,7 +756,7 @@ OUString SfxUndoManager::GetRedoActionComment( size_t nNo, 
bool const i_currentL
 {
 OUString sComment;
 UndoManagerGuard aGuard( *m_xData );
-const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : 
m_xData->pUndoArray.get();
+const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : 
&m_xData->maUndoArray;
 if ( (pUndoArray->nCurUndoAction + nNo) < pUndoArray->maUndoActions.size() 
)
 {
 sComment = pUndoArray->maUndoActions[ pUndoArray->nCurUndoAction + nNo 
].pAction->GetComment();
@@ -911,7 +910,7 @@ void SfxUndoManager::EnterListAction( const OUString& 
rComment,
 if( !ImplIsUndoEnabled_Lock() )
 return;
 
-if ( !m_xData->pUndoArray->nMaxUndoActions )
+if ( !m_xD

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

2021-07-23 Thread Noel Grandin (via logerrit)
 svl/source/passwordcontainer/passwordcontainer.cxx |  114 -
 svl/source/passwordcontainer/passwordcontainer.hxx |  140 ++---
 2 files changed, 127 insertions(+), 127 deletions(-)

New commits:
commit 590f67e0c746aacca30a80da8de1956dbc0d8768
Author: Noel Grandin 
AuthorDate: Thu Jul 22 21:43:37 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 23 12:36:15 2021 +0200

expand out contractions in PasswordContainer

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

diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx 
b/svl/source/passwordcontainer/passwordcontainer.cxx
index c27deb52a420..749f4c226a60 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -178,9 +178,9 @@ static ::rtl::ByteSequence getBufFromAsciiLine( const 
OUString& line )
 }
 
 
-PassMap StorageItem::getInfo()
+PasswordMap StorageItem::getInfo()
 {
-PassMap aResult;
+PasswordMap aResult;
 
 Sequence< OUString > aNodeNames = ConfigItem::GetNodeNames( "Store" );
 sal_Int32 aNodeCount = aNodeNames.getLength();
@@ -210,13 +210,13 @@ PassMap StorageItem::getInfo()
 OUString aEPasswd;
 aPropertyValues[aNodeInd] >>= aEPasswd;
 
-PassMap::iterator aIter = aResult.find( aUrl );
+PasswordMap::iterator aIter = aResult.find( aUrl );
 if( aIter != aResult.end() )
 aIter->second.emplace_back( aName, aEPasswd );
 else
 {
-NamePassRecord aNewRecord( aName, aEPasswd );
-std::vector< NamePassRecord > listToAdd( 1, aNewRecord );
+NamePasswordRecord aNewRecord( aName, aEPasswd );
+std::vector< NamePasswordRecord > listToAdd( 1, aNewRecord );
 
 aResult.insert( PairUrlRecord( aUrl, listToAdd ) );
 }
@@ -255,7 +255,7 @@ bool StorageItem::useStorage()
 }
 
 
-bool StorageItem::getEncodedMP( OUString& aResult )
+bool StorageItem::getEncodedMasterPassword( OUString& aResult )
 {
 if( hasEncoded )
 {
@@ -284,7 +284,7 @@ bool StorageItem::getEncodedMP( OUString& aResult )
 }
 
 
-void StorageItem::setEncodedMP( const OUString& aEncoded, bool bAcceptEmpty )
+void StorageItem::setEncodedMasterPassword( const OUString& aEncoded, bool 
bAcceptEmpty )
 {
 bool bHasMaster = ( !aEncoded.isEmpty() || bAcceptEmpty );
 
@@ -310,7 +310,7 @@ void StorageItem::clear()
 }
 
 
-void StorageItem::update( const OUString& aURL, const NamePassRecord& aRecord )
+void StorageItem::update( const OUString& aURL, const NamePasswordRecord& 
aRecord )
 {
 if ( !aRecord.HasPasswords( PERSISTENT_RECORD ) )
 {
@@ -322,7 +322,7 @@ void StorageItem::update( const OUString& aURL, const 
NamePassRecord& aRecord )
 
 sendSeq[0].Name  = "Store/Passwordstorage['" + createIndex( { aURL, 
aRecord.GetUserName() } ) + "']/Password";
 
-sendSeq[0].Value <<= aRecord.GetPersPasswords();
+sendSeq[0].Value <<= aRecord.GetPersistentPasswords();
 
 ConfigItem::SetModified();
 ConfigItem::SetSetProperties( "Store", sendSeq );
@@ -510,17 +510,17 @@ OUString PasswordContainer::EncodePasswords(const 
std::vector< OUString >& lines
 throw RuntimeException("Can't encode!" );
 }
 
-void PasswordContainer::UpdateVector( const OUString& aURL, std::vector< 
NamePassRecord >& toUpdate, NamePassRecord const & aRecord, bool writeFile )
+void PasswordContainer::UpdateVector( const OUString& aURL, std::vector< 
NamePasswordRecord >& toUpdate, NamePasswordRecord const & aRecord, bool 
writeFile )
 {
 for (auto & aNPIter : toUpdate)
 if( aNPIter.GetUserName() == aRecord.GetUserName() )
 {
 if( aRecord.HasPasswords( MEMORY_RECORD ) )
-aNPIter.SetMemPasswords( aRecord.GetMemPasswords() );
+aNPIter.SetMemoryPasswords( aRecord.GetMemoryPasswords() );
 
 if( aRecord.HasPasswords( PERSISTENT_RECORD ) )
 {
-aNPIter.SetPersPasswords( aRecord.GetPersPasswords() );
+aNPIter.SetPersistentPasswords( 
aRecord.GetPersistentPasswords() );
 
 if( writeFile )
 {
@@ -543,17 +543,17 @@ void PasswordContainer::UpdateVector( const OUString& 
aURL, std::vector< NamePas
 }
 
 
-UserRecord PasswordContainer::CopyToUserRecord( const NamePassRecord& aRecord, 
bool& io_bTryToDecode, const Reference< XInteractionHandler >& aHandler )
+UserRecord PasswordContainer::CopyToUserRecord( const NamePasswordRecord& 
aRecord, bool& io_bTryToDecode, const Reference< XInteractionHandler >& 
aHandler )
 {
 ::std::vector< OUString > aPasswords;
 if( aRecord.HasPasswords( MEMORY_RECORD ) )
-aPasswords = aRecord.GetMemPasswords();
+aPasswords = aRecord.GetMemoryPasswords();
 
 if( io_bTryTo

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

2021-07-23 Thread Noel Grandin (via logerrit)
 svl/source/passwordcontainer/passwordcontainer.cxx |   84 ++---
 svl/source/passwordcontainer/passwordcontainer.hxx |3 
 2 files changed, 44 insertions(+), 43 deletions(-)

New commits:
commit 19d01fae16f4f7b46c168b983960547f4dd2c2aa
Author: Noel Grandin 
AuthorDate: Thu Jul 22 21:30:03 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 23 09:54:56 2021 +0200

no need to allocate the StorageItem separately

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

diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx 
b/svl/source/passwordcontainer/passwordcontainer.cxx
index 1181144ead22..c27deb52a420 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -351,9 +351,9 @@ PasswordContainer::PasswordContainer( const 
Reference& rxCont
 mComponent.set( rxContext->getServiceManager(), UNO_QUERY );
 mComponent->addEventListener( this );
 
-m_pStorageFile.reset( new StorageItem( this, "Office.Common/Passwords" ) );
-if( m_pStorageFile->useStorage() )
-m_aContainer = m_pStorageFile->getInfo();
+m_xStorageFile.emplace( this, "Office.Common/Passwords" );
+if( m_xStorageFile->useStorage() )
+m_aContainer = m_xStorageFile->getInfo();
 }
 
 
@@ -361,7 +361,7 @@ PasswordContainer::~PasswordContainer()
 {
 ::osl::MutexGuard aGuard( mMutex );
 
-m_pStorageFile.reset();
+m_xStorageFile.reset();
 
 if( mComponent.is() )
 {
@@ -374,7 +374,7 @@ void SAL_CALL PasswordContainer::disposing( const 
EventObject& )
 {
 ::osl::MutexGuard aGuard( mMutex );
 
-m_pStorageFile.reset();
+m_xStorageFile.reset();
 
 if( mComponent.is() )
 {
@@ -525,7 +525,7 @@ void PasswordContainer::UpdateVector( const OUString& aURL, 
std::vector< NamePas
 if( writeFile )
 {
 // the password must be already encoded
-m_pStorageFile->update( aURL, aRecord ); // change 
existing ( aURL, aName ) record in the configfile
+m_xStorageFile->update( aURL, aRecord ); // change 
existing ( aURL, aName ) record in the configfile
 }
 }
 
@@ -536,7 +536,7 @@ void PasswordContainer::UpdateVector( const OUString& aURL, 
std::vector< NamePas
 if( aRecord.HasPasswords( PERSISTENT_RECORD ) && writeFile )
 {
 // the password must be already encoded
-m_pStorageFile->update( aURL, aRecord ); // add new aName to the 
existing url
+m_xStorageFile->update( aURL, aRecord ); // add new aName to the 
existing url
 }
 
 toUpdate.insert( toUpdate.begin(), aRecord );
@@ -628,8 +628,8 @@ void PasswordContainer::PrivateAdd( const OUString& Url, 
const OUString& UserNam
 std::vector< NamePassRecord > listToAdd( 1, aRecord );
 m_aContainer.insert( PairUrlRecord( Url, listToAdd ) );
 
-if( Mode == PERSISTENT_RECORD && m_pStorageFile && 
m_pStorageFile->useStorage() )
-m_pStorageFile->update( Url, aRecord );
+if( Mode == PERSISTENT_RECORD && m_xStorageFile && 
m_xStorageFile->useStorage() )
+m_xStorageFile->update( Url, aRecord );
 
 }
 
@@ -778,7 +778,7 @@ OUString PasswordContainer::RequestPasswordFromUser( 
PasswordRequestMode aRMode,
 OUString const & PasswordContainer::GetMasterPassword( const Reference< 
XInteractionHandler >& aHandler )
 {
 PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_ENTER;
-if( !m_pStorageFile || !m_pStorageFile->useStorage() )
+if( !m_xStorageFile || !m_xStorageFile->useStorage() )
 throw NoMasterException("Password storing is not active!", Reference< 
XInterface >(), aRMode );
 
 if( m_aMasterPasswd.isEmpty() && aHandler.is() )
@@ -786,7 +786,7 @@ OUString const & PasswordContainer::GetMasterPassword( 
const Reference< XInterac
 OUString aEncodedMP;
 bool bDefaultPassword = false;
 
-if( !m_pStorageFile->getEncodedMP( aEncodedMP ) )
+if( !m_xStorageFile->getEncodedMP( aEncodedMP ) )
 aRMode = PasswordRequestMode_PASSWORD_CREATE;
 else if ( aEncodedMP.isEmpty() )
 {
@@ -808,7 +808,7 @@ OUString const & PasswordContainer::GetMasterPassword( 
const Reference< XInterac
 m_aMasterPasswd = aPass;
 std::vector< OUString > aMaster( 1, m_aMasterPasswd );
 
-m_pStorageFile->setEncodedMP( EncodePasswords( 
aMaster, m_aMasterPasswd ) );
+m_xStorageFile->setEncodedMP( EncodePasswords( 
aMaster, m_aMasterPasswd ) );
 }
 else
 {
@@ -862,8 +862,8 @@ void SAL_CALL PasswordContainer::remove( const OUString& 
aURL, const OUString& a
 
 if (aNPIter != aIter->second.end())
 {
-if( aNPIter->HasPasswords( PERSISTENT_RECO

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

2021-07-22 Thread Noel Grandin (via logerrit)
 svl/source/config/languageoptions.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit da340c48ecd67e1b97546842dae013306caa6ace
Author: Noel Grandin 
AuthorDate: Thu Jul 22 21:51:11 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 23 08:54:54 2021 +0200

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

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

diff --git a/svl/source/config/languageoptions.cxx 
b/svl/source/config/languageoptions.cxx
index f00812b30b8d..4f3f7671eda7 100644
--- a/svl/source/config/languageoptions.cxx
+++ b/svl/source/config/languageoptions.cxx
@@ -23,12 +23,12 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #ifdef _WIN32
 #if !defined WIN32_LEAN_AND_MEAN
@@ -40,12 +40,12 @@
 using namespace ::com::sun::star;
 // global
 
-namespace { struct ALMutex : public rtl::Static< ::osl::Mutex, ALMutex > {}; }
+namespace { struct ALMutex : public rtl::Static< std::mutex, ALMutex > {}; }
 
 SvtLanguageOptions::SvtLanguageOptions( bool _bDontLoad )
 {
 // Global access, must be guarded (multithreading)
-::osl::MutexGuard aGuard( ALMutex::get() );
+std::lock_guard aGuard( ALMutex::get() );
 
 m_pCJKOptions.reset(new SvtCJKOptions( _bDontLoad ));
 m_pCTLOptions.reset(new SvtCTLOptions( _bDontLoad ));
@@ -55,7 +55,7 @@ SvtLanguageOptions::SvtLanguageOptions( bool _bDontLoad )
 SvtLanguageOptions::~SvtLanguageOptions()
 {
 // Global access, must be guarded (multithreading)
-::osl::MutexGuard aGuard( ALMutex::get() );
+std::lock_guard aGuard( ALMutex::get() );
 
 m_pCTLOptions->RemoveListener(this);
 m_pCJKOptions->RemoveListener(this);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-21 Thread Noel Grandin (via logerrit)
 svl/source/items/itemset.cxx |8 
 1 file changed, 8 deletions(-)

New commits:
commit 6fcb7ca818ebf819008cac55f08fe0e6c310d8cc
Author: Noel Grandin 
AuthorDate: Wed Jul 21 09:42:51 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 21 14:56:35 2021 +0200

remove obsolete comments

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 70ec5d1c825f..d48bc568797a 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -63,10 +63,6 @@ SfxItemSet::SfxItemSet(
 m_pPool(&pool), m_pParent(nullptr),
 m_pItems(new SfxPoolItem const *[items]{}),
 m_pWhichRanges(wids),
-// cannot overflow, assuming std::size_t is no smaller than sal_uInt16,
-// as wids.size() must be substantially smaller than
-// std::numeric_limits::max() by construction in
-// SfxItemSet::create
 m_nCount(0)
 {
 assert(wids.size() != 0);
@@ -80,10 +76,6 @@ SfxItemSet::SfxItemSet(
 m_pPool(&pool), m_pParent(nullptr),
 m_pItems(new SfxPoolItem const *[items]{}),
 m_pWhichRanges(std::move(wids)),
-// cannot overflow, assuming std::size_t is no smaller than sal_uInt16,
-// as wids.size() must be substantially smaller than
-// std::numeric_limits::max() by construction in
-// SfxItemSet::create
 m_nCount(0)
 {
 assert(m_pWhichRanges.size() != 0);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-20 Thread Mike Kaganski (via logerrit)
 svl/source/items/itemset.cxx |   40 
 1 file changed, 8 insertions(+), 32 deletions(-)

New commits:
commit 1738f106bd73fa2cf153905fc28b198d6f0cf211
Author: Mike Kaganski 
AuthorDate: Tue Jul 20 09:52:22 2021 +0300
Commit: Mike Kaganski 
CommitDate: Tue Jul 20 09:32:08 2021 +0200

Simplify SfxItemSet ctors and TotalCount using delegation

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 55804cdfe723..70ec5d1c825f 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -41,18 +41,12 @@
  *
  * For Sfx programmers: an SfxItemSet constructed in this way cannot
  * contain any Items with SlotIds as Which values.
+ *
+ * Don't create ItemSets with full range before FreezeIdRanges()!
  */
 SfxItemSet::SfxItemSet(SfxItemPool& rPool)
-: m_pPool( &rPool )
-, m_pParent(nullptr)
-, m_nCount(0)
+: SfxItemSet(rPool, rPool.GetFrozenIdRanges())
 {
-m_pWhichRanges = m_pPool->GetFrozenIdRanges();
-assert( !m_pWhichRanges.empty() && "don't create ItemSets with full range 
before FreezeIdRanges()" );
-assert(svl::detail::validRanges2(m_pWhichRanges));
-
-const sal_uInt16 nSize = TotalCount();
-m_pItems.reset(new const SfxPoolItem*[nSize]{});
 }
 
 SfxItemSet::SfxItemSet( SfxItemPool& rPool, SfxAllItemSetFlag )
@@ -96,27 +90,14 @@ SfxItemSet::SfxItemSet(
 assert(svl::detail::validRanges2(m_pWhichRanges));
 }
 
-SfxItemSet::SfxItemSet(
-SfxItemPool & pool, const WhichRangesContainer& wids):
-m_pPool(&pool), m_pParent(nullptr),
-m_pWhichRanges(wids),
-m_nCount(0)
+SfxItemSet::SfxItemSet(SfxItemPool& pool, const WhichRangesContainer& wids)
+: SfxItemSet(pool, wids, svl::detail::CountRanges(wids))
 {
-assert(wids.size() != 0);
-assert(svl::detail::validRanges2(m_pWhichRanges));
-std::size_t size = svl::detail::CountRanges(wids);
-m_pItems.reset( new SfxPoolItem const *[size]{} );
 }
 
-SfxItemSet::SfxItemSet(
-SfxItemPool & pool, WhichRangesContainer&& wids):
-m_pPool(&pool), m_pParent(nullptr),
-m_pWhichRanges(std::move(wids)),
-m_nCount(0)
+SfxItemSet::SfxItemSet(SfxItemPool& pool, WhichRangesContainer&& wids)
+: SfxItemSet(pool, wids, svl::detail::CountRanges(wids))
 {
-assert(svl::detail::validRanges2(m_pWhichRanges));
-std::size_t size = svl::detail::CountRanges(m_pWhichRanges);
-m_pItems.reset( new SfxPoolItem const *[size]{} );
 }
 
 SfxItemSet::SfxItemSet( const SfxItemSet& rASet )
@@ -800,12 +781,7 @@ void SfxItemSet::Changed( const SfxPoolItem&, const 
SfxPoolItem& )
 
 sal_uInt16 SfxItemSet::TotalCount() const
 {
-sal_uInt16 nRet = 0;
-for (auto const & pPtr : m_pWhichRanges)
-{
-nRet += ( pPtr.second - pPtr.first ) + 1;
-}
-return nRet;
+return svl::detail::CountRanges(m_pWhichRanges);
 }
 
 /**
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-17 Thread Noel Grandin (via logerrit)
 svl/source/misc/sharedstringpool.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 960ad8037275d86f15e0177f52a1d0dac25319e4
Author: Noel Grandin 
AuthorDate: Fri Jul 16 20:48:53 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 17 12:05:20 2021 +0200

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

std::mutex is slightly faster

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

diff --git a/svl/source/misc/sharedstringpool.cxx 
b/svl/source/misc/sharedstringpool.cxx
index 997648fac363..bcb53c294128 100644
--- a/svl/source/misc/sharedstringpool.cxx
+++ b/svl/source/misc/sharedstringpool.cxx
@@ -10,8 +10,8 @@
 #include 
 #include 
 #include 
-#include 
 
+#include 
 #include 
 #include 
 
@@ -54,7 +54,7 @@ sal_Int32 getRefCount(const rtl_uString* p) { return 
(p->refCount & 0x3FFF);
 
 struct SharedStringPool::Impl
 {
-mutable osl::Mutex maMutex;
+mutable std::mutex maMutex;
 // We use this map for two purposes - to store lower->upper case mappings
 // and to retrieve a shared uppercase object, so the management logic
 // is quite complex.
@@ -77,7 +77,7 @@ SharedStringPool::~SharedStringPool() {}
 SharedString SharedStringPool::intern(const OUString& rStr)
 {
 StringWithHash aStrWithHash(rStr);
-osl::MutexGuard aGuard(&mpImpl->maMutex);
+std::lock_guard aGuard(mpImpl->maMutex);
 
 auto[mapIt, bInserted] = mpImpl->maStrMap.emplace(aStrWithHash, rStr);
 if (!bInserted)
@@ -112,7 +112,7 @@ SharedString SharedStringPool::intern(const OUString& rStr)
 
 void SharedStringPool::purge()
 {
-osl::MutexGuard aGuard(&mpImpl->maMutex);
+std::lock_guard aGuard(mpImpl->maMutex);
 
 // Because we can have an uppercase entry mapped to itself,
 // and then a bunch of lowercase entries mapped to that same
@@ -163,13 +163,13 @@ void SharedStringPool::purge()
 
 size_t SharedStringPool::getCount() const
 {
-osl::MutexGuard aGuard(&mpImpl->maMutex);
+std::lock_guard aGuard(mpImpl->maMutex);
 return mpImpl->maStrMap.size();
 }
 
 size_t SharedStringPool::getCountIgnoreCase() const
 {
-osl::MutexGuard aGuard(&mpImpl->maMutex);
+std::lock_guard aGuard(mpImpl->maMutex);
 // this is only called from unit tests, so no need to be efficient
 std::unordered_set aUpperSet;
 for (auto const& pair : mpImpl->maStrMap)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-16 Thread Noel Grandin (via logerrit)
 svl/source/items/itemset.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 892bc8a15a09081b3de0afb9420abb5c2d110ea4
Author: Noel Grandin 
AuthorDate: Fri Jul 16 12:07:40 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 16 16:04:05 2021 +0200

-Werror=class-memaccess

gcc doesn't like memcpy here

error: ‘void* memcpy(void*, const void*, size_t)’ writing to an object
of type ‘struct std::pair’ with
no trivial copy-assignment; use copy-assignment or copy-initialization
instead [-Werror=class-memaccess]
 1459 | memcpy(p, other.m_pairs, m_size * sizeof(WhichPair));

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index f96d0c9c8ef1..324cf6da69f0 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1418,7 +1418,8 @@ SfxItemSet SfxAllItemSet::CloneAsValue(bool , SfxItemPool 
* ) const
 WhichRangesContainer::WhichRangesContainer( const WhichPair* wids, sal_Int32 
nSize )
 {
 auto p = new WhichPair[nSize];
-memcpy(p, wids, nSize * sizeof(WhichPair));
+for (int i=0; ihttps://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-05 Thread Andrea Gelmini (via logerrit)
 svl/source/items/itempool.cxx |1 -
 svl/source/items/itemset.cxx  |1 -
 2 files changed, 2 deletions(-)

New commits:
commit bd2f2273d83dcca43eb6b465308707efd45e7adf
Author: Andrea Gelmini 
AuthorDate: Mon Jul 5 20:03:39 2021 +0200
Commit: Andrea Gelmini 
CommitDate: Mon Jul 5 22:10:50 2021 +0200

Removed duplicated includes

Change-Id: I26af0a81f41a322239717346a47b225e2236fdbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118453
Tested-by: Jenkins
Reviewed-by: Andrea Gelmini 

diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index b23ef665c899..f4976b1b7767 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 7fb88175590d..5b986167686f 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -28,7 +28,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-05 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforfind.cxx |   19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 89a3caee73c476133af804d9a0a650e72e711d95
Author: Eike Rathke 
AuthorDate: Mon Jul 5 12:06:27 2021 +0200
Commit: Eike Rathke 
CommitDate: Mon Jul 5 13:57:51 2021 +0200

Resolves: tdf#143165 Date input must match separator, D,M,Y not part of

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 068fc73abdf4..4f5fd03ce6be 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1263,6 +1263,17 @@ static bool lcl_IsSignedYearSep( const OUString& rStr, 
const OUString& rPat, sal
 }
 
 
+/** Length of separator usually is 1 but theoretically could be anything. */
+static sal_Int32 lcl_getPatternSeparatorLength( const OUString& rPat, 
sal_Int32 nPat )
+{
+sal_Int32 nSep = nPat;
+sal_Unicode c;
+while (nSep < rPat.getLength() && (c = rPat[nSep]) != 'D' && c != 'M' && c 
!= 'Y')
+++nSep;
+return nSep - nPat;
+}
+
+
 bool ImpSvNumberInputScan::IsAcceptedDatePattern( sal_uInt16 nStartPatternAt )
 {
 if (nAcceptedDatePattern >= -1)
@@ -1383,8 +1394,11 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( 
sal_uInt16 nStartPatternAt )
 bOk = !IsNum[nNext];
 if (bOk)
 {
+const sal_Int32 nSepLen = lcl_getPatternSeparatorLength( 
rPat, nPat);
+// Non-numeric input must match separator exactly to be
+// accepted as such.
 const sal_Int32 nLen = sStrArray[nNext].getLength();
-bOk = (rPat.indexOf( sStrArray[nNext], nPat) == nPat);
+bOk = (nLen == nSepLen && rPat.indexOf( sStrArray[nNext], 
nPat) == nPat);
 if (bOk)
 {
 nPat += nLen - 1;
@@ -1503,8 +1517,9 @@ bool ImpSvNumberInputScan::SkipDatePatternSeparator( 
sal_uInt16 nParticle, sal_I
 default:
 if (nNext == nParticle)
 {
+const sal_Int32 nSepLen = lcl_getPatternSeparatorLength( rPat, 
nPat);
 const sal_Int32 nLen = sStrArray[nNext].getLength();
-bool bOk = (rPat.indexOf( sStrArray[nNext], nPat) == nPat);
+bool bOk = (nLen == nSepLen && rPat.indexOf( sStrArray[nNext], 
nPat) == nPat);
 if (!bOk)
 {
 bOk = lcl_IsSignedYearSep( sStrArray[nNext], rPat, nPat);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-25 Thread Mike Kaganski (via logerrit)
 svl/source/numbers/zformat.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 9430eef53b89bce2e43258d5c4533d655fa80453
Author: Mike Kaganski 
AuthorDate: Thu Jun 24 07:48:47 2021 +0200
Commit: Mike Kaganski 
CommitDate: Fri Jun 25 13:03:36 2021 +0200

tdf#143032: Check if the literal is empty

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

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 19ee2134df35..9395299afd16 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -3291,7 +3291,8 @@ sal_Int32 SvNumberformat::ImpUseMonthCase( int & 
io_nState, const ImpSvNumFor& r
 case NF_KEY_M:
 if ((i < nCount-1 &&
  rInfo.nTypeArray[i+1] == NF_SYMBOLTYPE_STRING &&
- // Literal following, not space nor comma.
+ // Literal following, not empty, space nor comma.
+ !rInfo.sStrArray[i+1].isEmpty() &&
  rInfo.sStrArray[i+1][0] != ' ' && rInfo.sStrArray[i+1][0] 
!= ',') ||
 (i > 0 && rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_STRING &&
  ((nLen = rInfo.sStrArray[i-1].getLength()) > 0) &&
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-06-13 Thread Mike Kaganski (via logerrit)
 svl/source/items/itemset.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f7c7e4c63f5479de66d2fbed9db34972a5bd05aa
Author: Mike Kaganski 
AuthorDate: Sun Jun 13 17:53:39 2021 +0200
Commit: Mike Kaganski 
CommitDate: Sun Jun 13 19:06:57 2021 +0200

Avoid [-Werror=redundant-move] in GCC 9.3.0

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 9ae951ab5936..538a2a47a4e2 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1771,7 +1771,7 @@ std::unique_ptr SfxAllItemSet::Clone(bool 
bItems, SfxItemPool *pToPo
 std::unique_ptr pNewSet(new SfxAllItemSet( *pToPool ));
 if ( bItems )
 pNewSet->Set( *this );
-return std::move(pNewSet);
+return pNewSet;
 }
 else
 return std::unique_ptr(bItems ? new SfxAllItemSet(*this) : 
new SfxAllItemSet(*m_pPool));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

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

New commits:
commit 01de216daf6dda0fb809bfa1919fcd13e6953ee9
Author: Mike Kaganski 
AuthorDate: Sat Jun 12 01:16:36 2021 +0200
Commit: Mike Kaganski 
CommitDate: Sat Jun 12 12:39:12 2021 +0200

Current baseline Clang 5.0.2 is able to upcast std::unique_ptr

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

diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index b234543a28f4..9ae951ab5936 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1771,7 +1771,7 @@ std::unique_ptr SfxAllItemSet::Clone(bool 
bItems, SfxItemPool *pToPo
 std::unique_ptr pNewSet(new SfxAllItemSet( *pToPool ));
 if ( bItems )
 pNewSet->Set( *this );
-return std::unique_ptr(pNewSet.release()); // clang3.8 
does not seem to be able to upcast std::unique_ptr
+return std::move(pNewSet);
 }
 else
 return std::unique_ptr(bItems ? new SfxAllItemSet(*this) : 
new SfxAllItemSet(*m_pPool));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   3   4   5   >