From ebe0f9e7f7a62d6eef467180ce3fad749e7ce8b7 Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 9 Apr 2009 01:16:15 +0000 Subject: (svn r15998) -Codechange: some coding style updates --- src/network/network.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/network/network.cpp') diff --git a/src/network/network.cpp b/src/network/network.cpp index e442e46d6..59a5cf55f 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -483,9 +483,6 @@ void NetworkCloseClient(NetworkClientSocket *cs) /* For the server, to accept new clients */ static void NetworkAcceptClients(SOCKET ls) { - NetworkClientSocket *cs; - bool banned; - for (;;) { struct sockaddr_storage sin; memset(&sin, 0, sizeof(sin)); @@ -501,7 +498,7 @@ static void NetworkAcceptClients(SOCKET ls) SetNoDelay(s); // XXX error handling? /* Check if the client is banned */ - banned = false; + bool banned = false; for (char **iter = _network_ban_list.Begin(); iter != _network_ban_list.End(); iter++) { banned = address.IsInNetmask(*iter); if (banned) { @@ -518,7 +515,7 @@ static void NetworkAcceptClients(SOCKET ls) /* If this client is banned, continue with next client */ if (banned) continue; - cs = NetworkAllocClient(s); + NetworkClientSocket *cs = NetworkAllocClient(s); if (cs == NULL) { /* no more clients allowed? * Send to the client that we are full! */ @@ -817,7 +814,6 @@ void NetworkDisconnect() static bool NetworkReceive() { NetworkClientSocket *cs; - int n; fd_set read_fd, write_fd; struct timeval tv; @@ -836,9 +832,9 @@ static bool NetworkReceive() tv.tv_sec = tv.tv_usec = 0; // don't block at all. #if !defined(__MORPHOS__) && !defined(__AMIGA__) - n = select(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv); + int n = select(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv); #else - n = WaitSelect(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv, NULL); + int n = WaitSelect(FD_SETSIZE, &read_fd, &write_fd, NULL, &tv, NULL); #endif if (n == -1 && !_network_server) NetworkError(STR_NETWORK_ERR_LOSTCONNECTION); @@ -1037,8 +1033,9 @@ static void NetworkGenerateUniqueId() checksum.Append((const uint8*)coding_string, strlen(coding_string)); checksum.Finish(digest); - for (di = 0; di < 16; ++di) + for (di = 0; di < 16; ++di) { sprintf(hex_output + di * 2, "%02x", digest[di]); + } /* _network_unique_id is our id */ snprintf(_settings_client.network.network_id, sizeof(_settings_client.network.network_id), "%s", hex_output); -- cgit v1.2.3-70-g09d2