(svn r15998) -Codechange: some coding style updates

This commit is contained in:
rubidium 2009-04-09 01:16:15 +00:00
parent c08c4224be
commit ebe0f9e7f7
2 changed files with 9 additions and 14 deletions

View File

@ -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);

View File

@ -102,10 +102,8 @@ NetworkGameList *NetworkGameListAddItem(NetworkAddress address)
* @param remove pointer to the item to be removed */
void NetworkGameListRemoveItem(NetworkGameList *remove)
{
NetworkGameList *item, *prev_item;
prev_item = NULL;
for (item = _network_game_list; item != NULL; item = item->next) {
NetworkGameList *prev_item = NULL;
for (NetworkGameList *item = _network_game_list; item != NULL; item = item->next) {
if (remove == item) {
if (prev_item == NULL) {
_network_game_list = remove->next;
@ -127,7 +125,7 @@ void NetworkGameListRemoveItem(NetworkGameList *remove)
}
enum {
MAX_GAME_LIST_REQUERY_COUNT = 5, ///< How often do we requery in number of times per server?
MAX_GAME_LIST_REQUERY_COUNT = 10, ///< How often do we requery in number of times per server?
REQUERY_EVERY_X_GAMELOOPS = 60, ///< How often do we requery in time?
REFRESH_GAMEINFO_X_REQUERIES = 50, ///< Refresh the game info itself after REFRESH_GAMEINFO_X_REQUERIES * REQUERY_EVERY_X_GAMELOOPS game loops
};