From 558ecb16317bccb53e534f561c659844bcd89df5 Mon Sep 17 00:00:00 2001 From: Darkvater Date: Wed, 5 Apr 2006 20:12:54 +0000 Subject: [PATCH] (svn r4292) - CodeChange: sprinkle some holy water on l'ugly code (braces, and pos is PacketSize not int) --- network_data.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/network_data.c b/network_data.c index 977e084475..ce008a86ab 100644 --- a/network_data.c +++ b/network_data.c @@ -270,24 +270,23 @@ uint64 NetworkRecv_uint64(NetworkClientState *cs, Packet *packet) } // Reads a string till it finds a '\0' in the stream -void NetworkRecv_string(NetworkClientState *cs, Packet *p, char* buffer, size_t size) +void NetworkRecv_string(NetworkClientState *cs, Packet *p, char *buffer, size_t size) { - int pos; + PacketSize pos; char *bufp = buffer; /* Don't allow reading from a closed socket */ - if (cs->quited) - return; + if (cs->quited) return; pos = p->pos; while (--size > 0 && pos < p->size && (*buffer++ = p->buffer[pos++]) != '\0') {} - if (size == 0 || pos == p->size) - { + + if (size == 0 || pos == p->size) { *buffer = '\0'; // If size was sooner to zero then the string in the stream // skip till the \0, so the packet can be read out correctly for the rest - while (pos < p->size && p->buffer[pos] != '\0') ++pos; - ++pos; + while (pos < p->size && p->buffer[pos] != '\0') pos++; + pos++; } p->pos = pos;