diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2018-09-11 14:49:55 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2018-09-11 14:49:55 +0000 |
commit | 1f7a113a8cc0ee4ab1004dec996bdd458d96596d (patch) | |
tree | 7e2fe7ecfd11c88d93d39cb5c1582190b11d7a49 /src/VBox/Runtime/common/rest/RTCRestStringMapBase.cpp | |
parent | cff8b9fc6bb4d1fde93030e426500ec1a0d44481 (diff) | |
download | VirtualBox-svn-1f7a113a8cc0ee4ab1004dec996bdd458d96596d.tar.gz |
IPRT/rest: String map tests. A couple of bugfixes (removal, enumeration). bugref:9167
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@74197 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/Runtime/common/rest/RTCRestStringMapBase.cpp')
-rw-r--r-- | src/VBox/Runtime/common/rest/RTCRestStringMapBase.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/VBox/Runtime/common/rest/RTCRestStringMapBase.cpp b/src/VBox/Runtime/common/rest/RTCRestStringMapBase.cpp index 675d6b3f593..bed2f68cd78 100644 --- a/src/VBox/Runtime/common/rest/RTCRestStringMapBase.cpp +++ b/src/VBox/Runtime/common/rest/RTCRestStringMapBase.cpp @@ -253,24 +253,26 @@ size_t RTCRestStringMapBase::size() const } -bool RTCRestStringMapBase::constainsKey(const char *a_pszKey) const +bool RTCRestStringMapBase::containsKey(const char *a_pszKey) const { return RTStrSpaceGet((PRTSTRSPACE)&m_Map, a_pszKey) != NULL; } -bool RTCRestStringMapBase::constainsKey(RTCString const &a_rStrKey) const +bool RTCRestStringMapBase::containsKey(RTCString const &a_rStrKey) const { - return constainsKey(a_rStrKey.c_str()); + return containsKey(a_rStrKey.c_str()); } bool RTCRestStringMapBase::remove(const char *a_pszKey) { - PRTSTRSPACECORE pRemoved = RTStrSpaceRemove(&m_Map, a_pszKey); + MapEntry *pRemoved = (MapEntry *)RTStrSpaceRemove(&m_Map, a_pszKey); if (pRemoved) { - stringSpaceDestructorCallback(pRemoved, NULL); + m_cEntries--; + RTListNodeRemove(&pRemoved->ListEntry); + stringSpaceDestructorCallback(&pRemoved->Core, NULL); return true; } return false; @@ -354,6 +356,7 @@ int RTCRestStringMapBase::putWorker(const char *a_pszKey, RTCRestObjectBase *a_p pEntry->pValue = a_pValue; if (RTStrSpaceInsert(&m_Map, &pEntry->Core)) { + RTListAppend(&m_ListHead, &pEntry->ListEntry); m_cEntries++; m_fNullIndicator = false; return VINF_SUCCESS; |