|
Line
Link Here
|
| 0 |
-- a/src/core/range_map.h |
0 |
++ b/src/core/range_map.h |
|
Lines 102-117
private:
Link Here
|
| 102 |
template<typename Key, typename T, typename C, typename A> |
102 |
template<typename Key, typename T, typename C, typename A> |
| 103 |
inline typename RangeMap<Key,T,C,A>::iterator |
103 |
inline typename RangeMap<Key,T,C,A>::iterator |
| 104 |
RangeMap<Key,T,C,A>::crop_overlap(const Key& _begin, const Key& _end) { |
104 |
RangeMap<Key,T,C,A>::crop_overlap(const Key& _begin, const Key& _end) { |
| 105 |
typename RangeMap::iterator itr = upper_bound(_begin); |
105 |
typename RangeMap::iterator itr = this->upper_bound(_begin); |
| 106 |
|
106 |
|
| 107 |
while (itr != end() && key_comp()(itr->second.first, _end)) { |
107 |
while (itr != end() && key_comp()(itr->second.first, _end)) { |
| 108 |
// There's a subrange before the new begin: need new entry (new range end means new key). |
108 |
// There's a subrange before the new begin: need new entry (new range end means new key). |
| 109 |
if (key_comp()(itr->second.first, _begin)) |
109 |
if (key_comp()(itr->second.first, _begin)) |
| 110 |
insert(itr, typename RangeMap::value_type(_begin, itr->second)); |
110 |
this->insert(itr, typename RangeMap::value_type(_begin, itr->second)); |
| 111 |
|
111 |
|
| 112 |
// Old end is within our range: erase entry. |
112 |
// Old end is within our range: erase entry. |
| 113 |
if (!key_comp()(_end, itr->first)) { |
113 |
if (!key_comp()(_end, itr->first)) { |
| 114 |
erase(itr++); |
114 |
this->erase(itr++); |
| 115 |
|
115 |
|
| 116 |
// Otherwise simply set the new begin of the old range. |
116 |
// Otherwise simply set the new begin of the old range. |
| 117 |
} else { |
117 |
} else { |
|
Lines 137-143
RangeMap<Key,T,C,A>::set_merge(Key _begi
Link Here
|
| 137 |
typename RangeMap::iterator prev = itr; |
137 |
typename RangeMap::iterator prev = itr; |
| 138 |
if (!key_comp()((--prev)->first, _begin) && prev->second.second == value) { |
138 |
if (!key_comp()((--prev)->first, _begin) && prev->second.second == value) { |
| 139 |
_begin = prev->second.first; |
139 |
_begin = prev->second.first; |
| 140 |
erase(prev); |
140 |
this->erase(prev); |
| 141 |
} |
141 |
} |
| 142 |
} |
142 |
} |
| 143 |
|
143 |
|
|
Lines 148-154
RangeMap<Key,T,C,A>::set_merge(Key _begi
Link Here
|
| 148 |
} |
148 |
} |
| 149 |
|
149 |
|
| 150 |
// Otherwise, this range isn't mergeable, make new entry. |
150 |
// Otherwise, this range isn't mergeable, make new entry. |
| 151 |
return insert(itr, typename RangeMap::value_type(_end, typename RangeMap::mapped_type(_begin, value))); |
151 |
return this->insert(itr, typename RangeMap::value_type(_end, typename RangeMap::mapped_type(_begin, value))); |
| 152 |
} |
152 |
} |
| 153 |
|
153 |
|
| 154 |
template<typename Key, typename T, typename C, typename A> |
154 |
template<typename Key, typename T, typename C, typename A> |
|
Lines 163-169
RangeMap<Key,T,C,A>::set_range(const Key
Link Here
|
| 163 |
template<typename Key, typename T, typename C, typename A> |
163 |
template<typename Key, typename T, typename C, typename A> |
| 164 |
inline typename RangeMap<Key,T,C,A>::const_iterator |
164 |
inline typename RangeMap<Key,T,C,A>::const_iterator |
| 165 |
RangeMap<Key,T,C,A>::find(const Key& key) const { |
165 |
RangeMap<Key,T,C,A>::find(const Key& key) const { |
| 166 |
typename RangeMap::const_iterator itr = upper_bound(key); |
166 |
typename RangeMap::const_iterator itr = this->upper_bound(key); |
| 167 |
|
167 |
|
| 168 |
if (itr != end() && key_comp()(key, itr->second.first)) |
168 |
if (itr != end() && key_comp()(key, itr->second.first)) |
| 169 |
itr = end(); |
169 |
itr = end(); |
| 170 |
-- a/src/thread_base.cc |
170 |
++ b/src/thread_base.cc |
|
Lines 45-50
Link Here
|
| 45 |
#include <signal.h> |
45 |
#include <signal.h> |
| 46 |
#include <rak/error_number.h> |
46 |
#include <rak/error_number.h> |
| 47 |
#include <torrent/exceptions.h> |
47 |
#include <torrent/exceptions.h> |
|
|
48 |
#include <unistd.h> |
| 48 |
|
49 |
|
| 49 |
#include "globals.h" |
50 |
#include "globals.h" |
| 50 |
#include "control.h" |
51 |
#include "control.h" |