diff --git a/winaccessibility/inc/ResIDGenerator.hxx b/winaccessibility/inc/ResIDGenerator.hxx index 19e06c9b88ad..400f58a2e620 100644 --- a/winaccessibility/inc/ResIDGenerator.hxx +++ b/winaccessibility/inc/ResIDGenerator.hxx @@ -19,20 +19,22 @@ #pragma once -#define PRIMARY_RESID 0x00000001 #include //ResID i.e. MSAA child ID, //this class is responsible for generating a child ID +// +// In IAccessible2, negative child IDs are commonly used to +// indicate unique resource IDs. class ResIDGenerator { private: - long max; + long m_nMin; std::deque subList; public: - ResIDGenerator(long maxNum = PRIMARY_RESID) - : max(maxNum) + ResIDGenerator() + : m_nMin(-1) { } ~ResIDGenerator(); diff --git a/winaccessibility/source/service/ResIDGenerator.cxx b/winaccessibility/source/service/ResIDGenerator.cxx index 6c88a12a402c..7498380300c7 100644 --- a/winaccessibility/source/service/ResIDGenerator.cxx +++ b/winaccessibility/source/service/ResIDGenerator.cxx @@ -25,7 +25,7 @@ ResIDGenerator::~ResIDGenerator() {} /** * SubList stores those IDs that were ever generated and deleted, the method - * return the ID from subList first if subList is not empty,else return ++max. + * return the ID from subList first if subList is not empty, else return m_nMin--. * Add the obsolete IDs by calling SetSub method * * @param @@ -39,8 +39,8 @@ long ResIDGenerator::GenerateNewResID() subList.pop_front(); return nRes; } - assert(max < LONG_MAX); - return -(++max); + assert(m_nMin > LONG_MIN); + return m_nMin--; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */