From 7c06aa16b82c39811624f818d3204b83d6047470 Mon Sep 17 00:00:00 2001 From: dhewg Date: Fri, 6 Jul 2012 00:43:50 +0200 Subject: [PATCH] Fix warnings in win_net.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit warning: variable ‘err’ set but not used [-Wunused-but-set-variable] warning: unused variable ‘len’ [-Wunused-variable] warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long long unsigned int’ [-Wformat] --- neo/sys/win32/win_net.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/neo/sys/win32/win_net.cpp b/neo/sys/win32/win_net.cpp index 2c4d8a63..d1a1f542 100644 --- a/neo/sys/win32/win_net.cpp +++ b/neo/sys/win32/win_net.cpp @@ -314,7 +314,6 @@ NET_OpenSocks */ void NET_OpenSocks( int port ) { struct sockaddr_in address; - int err; struct hostent *h; int len; bool rfc1929; @@ -325,14 +324,12 @@ void NET_OpenSocks( int port ) { common->Printf( "Opening connection to SOCKS server.\n" ); if ( ( socks_socket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ) == INVALID_SOCKET ) { - err = WSAGetLastError(); common->Printf( "WARNING: NET_OpenSocks: socket: %s\n", NET_ErrorString() ); return; } h = gethostbyname( net_socksServer.GetString() ); if ( h == NULL ) { - err = WSAGetLastError(); common->Printf( "WARNING: NET_OpenSocks: gethostbyname: %s\n", NET_ErrorString() ); return; } @@ -345,7 +342,6 @@ void NET_OpenSocks( int port ) { address.sin_port = htons( (short)net_socksPort.GetInteger() ); if ( connect( socks_socket, (struct sockaddr *)&address, sizeof( address ) ) == SOCKET_ERROR ) { - err = WSAGetLastError(); common->Printf( "NET_OpenSocks: connect: %s\n", NET_ErrorString() ); return; } @@ -373,7 +369,6 @@ void NET_OpenSocks( int port ) { buf[2] = 2; // method #2 - method id #02: username/password } if ( send( socks_socket, (const char *)buf, len, 0 ) == SOCKET_ERROR ) { - err = WSAGetLastError(); common->Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() ); return; } @@ -381,7 +376,6 @@ void NET_OpenSocks( int port ) { // get the response len = recv( socks_socket, (char *)buf, 64, 0 ); if ( len == SOCKET_ERROR ) { - err = WSAGetLastError(); common->Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() ); return; } @@ -420,7 +414,6 @@ void NET_OpenSocks( int port ) { // send it if ( send( socks_socket, (const char *)buf, 3 + ulen + plen, 0 ) == SOCKET_ERROR ) { - err = WSAGetLastError(); common->Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() ); return; } @@ -428,7 +421,6 @@ void NET_OpenSocks( int port ) { // get the response len = recv( socks_socket, (char *)buf, 64, 0 ); if ( len == SOCKET_ERROR ) { - err = WSAGetLastError(); common->Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() ); return; } @@ -450,7 +442,6 @@ void NET_OpenSocks( int port ) { *(int *)&buf[4] = INADDR_ANY; *(short *)&buf[8] = htons( (short)port ); // port if ( send( socks_socket, (const char *)buf, 10, 0 ) == SOCKET_ERROR ) { - err = WSAGetLastError(); common->Printf( "NET_OpenSocks: send: %s\n", NET_ErrorString() ); return; } @@ -458,7 +449,6 @@ void NET_OpenSocks( int port ) { // get the response len = recv( socks_socket, (char *)buf, 64, 0 ); if( len == SOCKET_ERROR ) { - err = WSAGetLastError(); common->Printf( "NET_OpenSocks: recv: %s\n", NET_ErrorString() ); return; } @@ -657,7 +647,7 @@ void Sys_InitNetworking( void ) { pAdapterInfo = (IP_ADAPTER_INFO *)malloc( sizeof( IP_ADAPTER_INFO ) ); if( !pAdapterInfo ) { - common->FatalError( "Sys_InitNetworking: Couldn't malloc( %d )", sizeof( IP_ADAPTER_INFO ) ); + common->FatalError( "Sys_InitNetworking: Couldn't malloc( %u )", (unsigned int)sizeof( IP_ADAPTER_INFO ) ); } ulOutBufLen = sizeof( IP_ADAPTER_INFO ); @@ -892,8 +882,6 @@ InitForPort ================== */ bool idPort::InitForPort( int portNumber ) { - int len = sizeof( struct sockaddr_in ); - netSocket = NET_IPSocket( net_ip.GetString(), portNumber, &bound_to ); if ( netSocket <= 0 ) { netSocket = 0;