mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
(svn r16034) -Fix: compile warnings generated by 64 bits MSVC.
This commit is contained in:
parent
4f5bd05db6
commit
b78820a361
@ -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;
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user