summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/core/host.cpp2
-rw-r--r--src/network/network_content_gui.cpp17
2 files changed, 7 insertions, 12 deletions
diff --git a/src/network/core/host.cpp b/src/network/core/host.cpp
index 1ea5389d4..b1ed71e92 100644
--- a/src/network/core/host.cpp
+++ b/src/network/core/host.cpp
@@ -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);
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 19c075258..b7237cadd 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -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 */