diff options
-rw-r--r-- | src/network/core/address.cpp | 12 | ||||
-rw-r--r-- | src/network/core/address.h | 8 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/network/core/address.cpp b/src/network/core/address.cpp index d869ceecb..54e7bc0d0 100644 --- a/src/network/core/address.cpp +++ b/src/network/core/address.cpp @@ -206,20 +206,20 @@ SOCKET NetworkAddress::Resolve(int family, int socktype, int flags, SocketList * * connect to one with exactly the same address twice. That's * ofcourse totally unneeded ;) */ if (sockets != NULL) { - NetworkAddress address(runp->ai_addr, runp->ai_addrlen); + NetworkAddress address(runp->ai_addr, (int)runp->ai_addrlen); if (sockets->Find(address) != sockets->End()) continue; } sock = func(runp); if (sock == INVALID_SOCKET) continue; if (sockets == NULL) { - this->address_length = runp->ai_addrlen; + this->address_length = (int)runp->ai_addrlen; assert(sizeof(this->address) >= runp->ai_addrlen); memcpy(&this->address, runp->ai_addr, runp->ai_addrlen); break; } - NetworkAddress addr(runp->ai_addr, runp->ai_addrlen); + NetworkAddress addr(runp->ai_addr, (int)runp->ai_addrlen); (*sockets)[addr] = sock; sock = INVALID_SOCKET; } @@ -243,7 +243,7 @@ static SOCKET ConnectLoopProc(addrinfo *runp) if (!SetNoDelay(sock)) DEBUG(net, 1, "Setting TCP_NODELAY failed"); - if (connect(sock, runp->ai_addr, runp->ai_addrlen) != 0) { + if (connect(sock, runp->ai_addr, (int)runp->ai_addrlen) != 0) { DEBUG(net, 1, "Could not connect socket: %s", strerror(errno)); closesocket(sock); return INVALID_SOCKET; @@ -270,7 +270,7 @@ SOCKET NetworkAddress::Connect() static SOCKET ListenLoopProc(addrinfo *runp) { const char *type = runp->ai_socktype == SOCK_STREAM ? "tcp" : "udp"; - const char *address = NetworkAddress(runp->ai_addr, runp->ai_addrlen).GetAddressAsString(); + const char *address = NetworkAddress(runp->ai_addr, (int)runp->ai_addrlen).GetAddressAsString(); SOCKET sock = socket(runp->ai_family, runp->ai_socktype, runp->ai_protocol); if (sock == INVALID_SOCKET) { @@ -293,7 +293,7 @@ static SOCKET ListenLoopProc(addrinfo *runp) DEBUG(net, 3, "[%s] Could not disable IPv4 over IPv6 on port %s: %s", type, address, strerror(errno)); } - if (bind(sock, runp->ai_addr, runp->ai_addrlen) != 0) { + if (bind(sock, runp->ai_addr, (int)runp->ai_addrlen) != 0) { DEBUG(net, 1, "[%s] Could not bind on port %s: %s", type, address, strerror(errno)); closesocket(sock); return INVALID_SOCKET; diff --git a/src/network/core/address.h b/src/network/core/address.h index 564d23625..212164c9d 100644 --- a/src/network/core/address.h +++ b/src/network/core/address.h @@ -24,7 +24,7 @@ typedef SmallMap<NetworkAddress, SOCKET, 4> SocketList; class NetworkAddress { private: char hostname[NETWORK_HOSTNAME_LENGTH]; ///< The hostname - size_t address_length; ///< The length of the resolved address + int address_length; ///< The length of the resolved address sockaddr_storage address; ///< The resolved address /** @@ -49,7 +49,7 @@ public: * Create a network address based on a resolved IP and port * @param address the IP address with port */ - NetworkAddress(struct sockaddr_storage &address, size_t address_length) : + NetworkAddress(struct sockaddr_storage &address, int address_length) : address_length(address_length), address(address) { @@ -60,7 +60,7 @@ public: * Create a network address based on a resolved IP and port * @param address the IP address with port */ - NetworkAddress(sockaddr *address, size_t address_length) : + NetworkAddress(sockaddr *address, int address_length) : address_length(address_length) { *this->hostname = '\0'; @@ -131,7 +131,7 @@ public: * Get the (valid) length of the address. * @return the length */ - size_t GetAddressLength() + int GetAddressLength() { /* Resolve it if we didn't do it already */ if (!this->IsResolved()) this->GetAddress(); |