diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2019-06-16 21:46:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-18 07:12:47 +0200 |
commit | 3148b506a5a8d333deac35ab59016c3ce420d26c (patch) | |
tree | 4e5476be118f758f582962a626fe7ba2dcdace8f /cppuhelper | |
parent | f74f7899fa2c8956fcd3a213d75fd7c84bd99bb7 (diff) |
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@collabora.co.uk>
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/propshlp.cxx | 5 |
1 files changed, 2 insertions, 3 deletions
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; |