Codechange: Replaced SmallVector::Find() with std::find()

This commit is contained in:
Henry Wilson
2019-02-20 19:27:10 +00:00
committed by PeterN
parent e0c58bf5ee
commit 2bc2de9034
9 changed files with 41 additions and 37 deletions

View File

@@ -136,7 +136,7 @@ static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // Wi
memcpy(&address, &ifo[j].iiAddress.Address, sizeof(sockaddr));
((sockaddr_in*)&address)->sin_addr.s_addr = ifo[j].iiAddress.AddressIn.sin_addr.s_addr | ~ifo[j].iiNetmask.AddressIn.sin_addr.s_addr;
NetworkAddress addr(address, sizeof(sockaddr));
if (std::none_of(broadcast->begin(), broadcast->end(), [&addr](NetworkAddress const& elem) -> bool { return elem == addr; })) *broadcast->Append() = addr;
if (std::none_of(broadcast->begin(), broadcast->end(), [&addr](NetworkAddress const& elem) -> bool { return elem == addr; })) broadcast->push_back(addr);
}
free(ifo);

View File

@@ -435,12 +435,8 @@ class NetworkContentListWindow : public Window, ContentCallback {
{
if (!this->content.Sort()) return;
for (ConstContentIterator iter = this->content.Begin(); iter != this->content.End(); iter++) {
if (*iter == this->selected) {
this->list_pos = iter - this->content.Begin();
break;
}
}
int idx = find_index(this->content, this->selected);
if (idx >= 0) this->list_pos = idx;
}
/** Filter content by tags/name */
@@ -478,11 +474,10 @@ class NetworkContentListWindow : public Window, ContentCallback {
if (!changed) return;
/* update list position */
for (ConstContentIterator iter = this->content.Begin(); iter != this->content.End(); iter++) {
if (*iter == this->selected) {
this->list_pos = iter - this->content.Begin();
return;
}
int idx = find_index(this->content, this->selected);
if (idx >= 0) {
this->list_pos = idx;
return;
}
/* previously selected item not in list anymore */