comphelper/source/property/propertycontainerhelper.cxx |    4 ++--
 include/comphelper/propertycontainerhelper.hxx         |    6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit ad67d0c99a12a2d58d26d84122501733c8aaa2f9
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Thu Jun 2 18:42:53 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu Jun 2 21:33:17 2022 +0200

    Use more appropriate type for LocationAccess::nOwnClassVectorIndex
    
    Change-Id: Iba1709b60a27c331dcc6cf4e6f0966d94130a66c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135320
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/comphelper/source/property/propertycontainerhelper.cxx 
b/comphelper/source/property/propertycontainerhelper.cxx
index 7ff224bec741..ee81100ae617 100644
--- a/comphelper/source/property/propertycontainerhelper.cxx
+++ b/comphelper/source/property/propertycontainerhelper.cxx
@@ -270,7 +270,7 @@ bool OPropertyContainerHelper::convertFastPropertyValue(
 
             if (PropertyDescription::LocationType::HoldMyself == 
aPos->eLocated)
             {
-                OSL_ENSURE(aPos->aLocation.nOwnClassVectorIndex < 
static_cast<sal_Int32>(m_aHoldProperties.size()),
+                OSL_ENSURE(aPos->aLocation.nOwnClassVectorIndex < 
m_aHoldProperties.size(),
                     "OPropertyContainerHelper::convertFastPropertyValue: 
invalid position !");
                 auto aIter = m_aHoldProperties.begin() + 
aPos->aLocation.nOwnClassVectorIndex;
                 pPropContainer = &(*aIter);
@@ -408,7 +408,7 @@ void OPropertyContainerHelper::getFastPropertyValue(Any& 
_rValue, sal_Int32 _nHa
     switch (aPos->eLocated)
     {
         case PropertyDescription::LocationType::HoldMyself:
-            OSL_ENSURE(aPos->aLocation.nOwnClassVectorIndex < 
static_cast<sal_Int32>(m_aHoldProperties.size()),
+            OSL_ENSURE(aPos->aLocation.nOwnClassVectorIndex < 
m_aHoldProperties.size(),
                 "OPropertyContainerHelper::convertFastPropertyValue: invalid 
position !");
             _rValue = m_aHoldProperties[aPos->aLocation.nOwnClassVectorIndex];
             break;
diff --git a/include/comphelper/propertycontainerhelper.hxx 
b/include/comphelper/propertycontainerhelper.hxx
index eb213e4541ec..73a0ce513289 100644
--- a/include/comphelper/propertycontainerhelper.hxx
+++ b/include/comphelper/propertycontainerhelper.hxx
@@ -22,6 +22,8 @@
 
 #include <com/sun/star/uno/Type.hxx>
 #include <com/sun/star/beans/Property.hpp>
+#include <cstddef>
+#include <limits>
 #include <vector>
 #include <comphelper/comphelperdllapi.h>
 
@@ -44,7 +46,7 @@ struct COMPHELPER_DLLPUBLIC PropertyDescription
     union LocationAccess
     {
         void*       pDerivedClassMember;        // a pointer to a member of an 
object of a derived class
-        sal_Int32   nOwnClassVectorIndex;       // an index within 
m_aHoldProperties
+        std::size_t nOwnClassVectorIndex;       // an index within 
m_aHoldProperties
     };
 
     css::beans::Property aProperty;
@@ -55,7 +57,7 @@ struct COMPHELPER_DLLPUBLIC PropertyDescription
         :aProperty( OUString(), -1, css::uno::Type(), 0 )
         ,eLocated( LocationType::HoldMyself )
     {
-        aLocation.nOwnClassVectorIndex = -1;
+        aLocation.nOwnClassVectorIndex = 
std::numeric_limits<std::size_t>::max();
     }
 };
 

Reply via email to