mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-19 04:29:09 +00:00
Codechange: replace x.size() == 0 with x.empty()
This commit is contained in:
@@ -203,7 +203,7 @@ void TCPConnecter::OnResolved(addrinfo *ai)
|
||||
}
|
||||
|
||||
if (_debug_net_level >= 6) {
|
||||
if (this->addresses.size() == 0) {
|
||||
if (this->addresses.empty()) {
|
||||
Debug(net, 6, "{} did not resolve", this->connection_string);
|
||||
} else {
|
||||
Debug(net, 6, "{} resolved in:", this->connection_string);
|
||||
|
@@ -142,7 +142,7 @@ public:
|
||||
*/
|
||||
static bool Listen(uint16_t port)
|
||||
{
|
||||
assert(sockets.size() == 0);
|
||||
assert(sockets.empty());
|
||||
|
||||
NetworkAddressList addresses;
|
||||
GetBindAddresses(&addresses, port);
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
address.Listen(SOCK_STREAM, &sockets);
|
||||
}
|
||||
|
||||
if (sockets.size() == 0) {
|
||||
if (sockets.empty()) {
|
||||
Debug(net, 0, "Could not start network: could not create listening socket");
|
||||
ShowNetworkError(STR_NETWORK_ERROR_SERVER_START);
|
||||
return false;
|
||||
|
@@ -73,7 +73,7 @@ void NetworkUDPSocketHandler::CloseSocket()
|
||||
*/
|
||||
void NetworkUDPSocketHandler::SendPacket(Packet *p, NetworkAddress *recv, bool all, bool broadcast)
|
||||
{
|
||||
if (this->sockets.size() == 0) this->Listen();
|
||||
if (this->sockets.empty()) this->Listen();
|
||||
|
||||
for (auto &s : this->sockets) {
|
||||
/* Make a local copy because if we resolve it we cannot
|
||||
|
@@ -703,7 +703,7 @@ void GetBindAddresses(NetworkAddressList *addresses, uint16_t port)
|
||||
}
|
||||
|
||||
/* No address, so bind to everything. */
|
||||
if (addresses->size() == 0) {
|
||||
if (addresses->empty()) {
|
||||
addresses->emplace_back("", port);
|
||||
}
|
||||
}
|
||||
|
@@ -899,7 +899,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
if (this->content.size() == 0) {
|
||||
if (this->content.empty()) {
|
||||
if (this->UpdateFilterState()) {
|
||||
this->content.ForceRebuild();
|
||||
this->InvalidateData();
|
||||
|
Reference in New Issue
Block a user