diff options
| author | Ross Smith II <aria2spam@smithii.com> | 2009-06-02 03:18:07 +0000 |
|---|---|---|
| committer | Ross Smith II <aria2spam@smithii.com> | 2009-06-02 03:18:07 +0000 |
| commit | 2e34ea1e4285a3197b18b4e6b2b00b3b3888ab6c (patch) | |
| tree | 47a339f1f37751872fb6cfc2a9ec05f3d7bfc3d9 /src/SocketCore.cc | |
| parent | 3455fca9cacfeba18cbf42cf45d66d4c863c6da2 (diff) | |
Added (sock_t) to quiet compiler warnings in MinGW
Diffstat (limited to 'src/SocketCore.cc')
| -rw-r--r-- | src/SocketCore.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/SocketCore.cc b/src/SocketCore.cc index 12f569eb..a987d538 100644 --- a/src/SocketCore.cc +++ b/src/SocketCore.cc @@ -178,7 +178,7 @@ void SocketCore::bind(uint16_t port) struct addrinfo* rp; for(rp = res; rp; rp = rp->ai_next) { sock_t fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); - if(fd == -1) { + if(fd == (sock_t) -1) { continue; } int sockopt = 1; @@ -194,7 +194,7 @@ void SocketCore::bind(uint16_t port) break; } freeaddrinfo(res); - if(sockfd == -1) { + if(sockfd == (sock_t) -1) { throw DL_ABORT_EX(StringFormat(EX_SOCKET_BIND, "all addresses failed").str()); } } @@ -211,8 +211,8 @@ SocketCore* SocketCore::acceptConnection() const struct sockaddr_storage sockaddr; socklen_t len = sizeof(sockaddr); sock_t fd; - while((fd = accept(sockfd, reinterpret_cast<struct sockaddr*>(&sockaddr), &len)) == -1 && SOCKET_ERRNO == EINTR); - if(fd == -1) { + while((fd = accept(sockfd, reinterpret_cast<struct sockaddr*>(&sockaddr), &len)) == (sock_t) -1 && SOCKET_ERRNO == EINTR); + if(fd == (sock_t) -1) { throw DL_ABORT_EX(StringFormat(EX_SOCKET_ACCEPT, errorMsg()).str()); } return new SocketCore(fd, _sockType); @@ -260,7 +260,7 @@ void SocketCore::establishConnection(const std::string& host, uint16_t port) struct addrinfo* rp; for(rp = res; rp; rp = rp->ai_next) { sock_t fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); - if(fd == -1) { + if(fd == (sock_t) -1) { continue; } int sockopt = 1; @@ -274,7 +274,7 @@ void SocketCore::establishConnection(const std::string& host, uint16_t port) if(connect(fd, rp->ai_addr, rp->ai_addrlen) == -1 && SOCKET_ERRNO != A2_EINPROGRESS) { CLOSE(sockfd); - sockfd = -1; + sockfd = (sock_t) -1; continue; } // TODO at this point, connection may not be established and it may fail @@ -282,7 +282,7 @@ void SocketCore::establishConnection(const std::string& host, uint16_t port) break; } freeaddrinfo(res); - if(sockfd == -1) { + if(sockfd == (sock_t) -1) { throw DL_ABORT_EX(StringFormat(EX_SOCKET_CONNECT, host.c_str(), "all addresses failed").str()); } @@ -333,7 +333,7 @@ void SocketCore::closeConnection() gnutls_bye(sslSession, GNUTLS_SHUT_RDWR); } #endif // HAVE_LIBGNUTLS - if(sockfd != -1) { + if(sockfd != (sock_t) -1) { CLOSE(sockfd); sockfd = -1; } |
