| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 { | 37 { |
| 38 typedef Entry entry_type; | 38 typedef Entry entry_type; |
| 39 typedef HashContainerIterator<Entry> iterator; | 39 typedef HashContainerIterator<Entry> iterator; |
| 40 | 40 |
| 41 const entry_type* mPos; | 41 const entry_type* mPos; |
| 42 const entry_type* mEnd; | 42 const entry_type* mEnd; |
| 43 | 43 |
| 44 explicit HashContainerIterator(const entry_type* start, const entry_type* en
d) | 44 explicit HashContainerIterator(const entry_type* start, const entry_type* en
d) |
| 45 : mPos(start), mEnd(end) | 45 : mPos(start), mEnd(end) |
| 46 { | 46 { |
| 47 if (mPos != mEnd && mPos->is_invalid()) | 47 if (mPos != mEnd && (mPos->is_invalid() || mPos->is_deleted())) |
| 48 ++(*this); | 48 ++(*this); |
| 49 } | 49 } |
| 50 | 50 |
| 51 const entry_type& operator*() const | 51 const entry_type& operator*() const |
| 52 { | 52 { |
| 53 return *mPos; | 53 return *mPos; |
| 54 } | 54 } |
| 55 | 55 |
| 56 const entry_type* operator->() const | 56 const entry_type* operator->() const |
| 57 { | 57 { |
| 58 return mPos; | 58 return mPos; |
| 59 } | 59 } |
| 60 | 60 |
| 61 iterator& operator++() | 61 iterator& operator++() |
| 62 { | 62 { |
| 63 do { | 63 do { |
| 64 ++mPos; | 64 ++mPos; |
| 65 } while(mPos != mEnd && mPos->is_invalid()); | 65 } while(mPos != mEnd && (mPos->is_invalid() || mPos->is_deleted())); |
| 66 return *this; | 66 return *this; |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool operator==(const iterator& it) const | 69 bool operator==(const iterator& it) const |
| 70 { | 70 { |
| 71 return mPos == it.mPos; | 71 return mPos == it.mPos; |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool operator!=(const iterator& it) const | 74 bool operator!=(const iterator& it) const |
| 75 { | 75 { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 89 { | 89 { |
| 90 } | 90 } |
| 91 | 91 |
| 92 const entry_type* operator->() const | 92 const entry_type* operator->() const |
| 93 { | 93 { |
| 94 return mEntry; | 94 return mEntry; |
| 95 } | 95 } |
| 96 | 96 |
| 97 operator bool() const | 97 operator bool() const |
| 98 { | 98 { |
| 99 return !mEntry->is_invalid(); | 99 return !(mEntry->is_invalid() || mEntry->is_deleted()); |
| 100 } | 100 } |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 template<typename Entry> | 103 template<typename Entry> |
| 104 class HashContainer | 104 class HashContainer |
| 105 { | 105 { |
| 106 public: | 106 public: |
| 107 typedef Entry entry_type; | 107 typedef Entry entry_type; |
| 108 typedef typename Entry::key_type_cref key_type_cref; | 108 typedef typename Entry::key_type_cref key_type_cref; |
| 109 typedef typename entry_type::size_type size_type; | 109 typedef typename entry_type::size_type size_type; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 { | 338 { |
| 339 return super::find(key); | 339 return super::find(key); |
| 340 } | 340 } |
| 341 | 341 |
| 342 reference find(key_type_cref key) | 342 reference find(key_type_cref key) |
| 343 { | 343 { |
| 344 return reference(this, key, super::find_bucket(key)); | 344 return reference(this, key, super::find_bucket(key)); |
| 345 } | 345 } |
| 346 }; | 346 }; |
| 347 | 347 |
| 348 ABP_NS_END | 348 ABP_NS_END |
| OLD | NEW |