[Libreoffice-commits] core.git: cppuhelper/source
Julien Nabet (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 18 05:13:46 UTC 2019
cppuhelper/source/propshlp.cxx | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
New commits:
commit 3148b506a5a8d333deac35ab59016c3ce420d26c
Author: Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sun Jun 16 21:46:29 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 18 07:12:47 2019 +0200
Resort pProperties when really needed (cppuhelper)
so not when pProperties[i-1].Name == pProperties[i].Name
and call getConstArray() only if there have been a sort
Found when testing tdf#125941 when editing table:
$8 = uno::Sequence of length 29 = {
{Name = "AutoIncrementCreation", Handle = 49, Type = uno::Type "string", Attributes = 0},
{Name = "CatalogName", Handle = 30, Type = uno::Type "string", Attributes = 0},
{Name = "CatalogName", Handle = 30, Type = uno::Type "string", Attributes = 0},
{Name = "DefaultValue", Handle = 20, Type = uno::Type "string", Attributes = 0},
{Name = "DefaultValue", Handle = 20, Type = uno::Type "string", Attributes = 0},
{Name = "Description", Handle = 19, Type = uno::Type "string", Attributes = 0},
{Name = "Description", Handle = 19, Type = uno::Type "string", Attributes = 0},
...
Change-Id: I645f7d24d552222cf520e346f4505f5a14979a30
Reviewed-on: https://gerrit.libreoffice.org/74124
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx
index d5f0da890bb7..51f336999050 100644
--- a/cppuhelper/source/propshlp.cxx
+++ b/cppuhelper/source/propshlp.cxx
@@ -977,7 +977,7 @@ void OPropertyArrayHelper::init( sal_Bool bSorted )
for( i = 1; i < nElements; i++ )
{
- if( pProperties[i-1].Name >= pProperties[i].Name )
+ if( pProperties[i-1].Name > pProperties[i].Name )
{
if (bSorted) {
OSL_FAIL( "Property array is not sorted" );
@@ -985,11 +985,10 @@ void OPropertyArrayHelper::init( sal_Bool bSorted )
// not sorted
qsort( aInfos.getArray(), nElements, sizeof( Property ),
compare_Property_Impl );
+ pProperties = aInfos.getConstArray();
break;
}
}
- // may be that the array is resorted
- pProperties = aInfos.getConstArray();
for( i = 0; i < nElements; i++ )
if( pProperties[i].Handle != i )
return;
More information about the Libreoffice-commits
mailing list