Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: compiled/Map.h

Issue 29695640: Issue 6281 - Don't return deleted entries (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Feb. 12, 2018, 11:52 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: compiled/Map.h
===================================================================
--- a/compiled/Map.h
+++ b/compiled/Map.h
@@ -39,17 +39,17 @@
typedef HashContainerIterator<Entry> iterator;
const entry_type* mPos;
const entry_type* mEnd;
explicit HashContainerIterator(const entry_type* start, const entry_type* end)
: mPos(start), mEnd(end)
{
- if (mPos != mEnd && mPos->is_invalid())
+ if (mPos != mEnd && (mPos->is_invalid() || mPos->is_deleted()))
++(*this);
}
const entry_type& operator*() const
{
return *mPos;
}
@@ -57,17 +57,17 @@
{
return mPos;
}
iterator& operator++()
{
do {
++mPos;
- } while(mPos != mEnd && mPos->is_invalid());
+ } while(mPos != mEnd && (mPos->is_invalid() || mPos->is_deleted()));
return *this;
}
bool operator==(const iterator& it) const
{
return mPos == it.mPos;
}
@@ -91,17 +91,17 @@
const entry_type* operator->() const
{
return mEntry;
}
operator bool() const
{
- return !mEntry->is_invalid();
+ return !(mEntry->is_invalid() || mEntry->is_deleted());
}
};
template<typename Entry>
class HashContainer
{
public:
typedef Entry entry_type;
@@ -340,9 +340,9 @@
}
reference find(key_type_cref key)
{
return reference(this, key, super::find_bucket(key));
}
};
-ABP_NS_END
+ABP_NS_END

Powered by Google App Engine
This is Rietveld