diff options
author | Darkvater <darkvater@openttd.org> | 2006-04-05 20:12:54 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2006-04-05 20:12:54 +0000 |
commit | 558ecb16317bccb53e534f561c659844bcd89df5 (patch) | |
tree | abaa9d82cad817bfa08759f36874d92b93729918 | |
parent | a39f69b9bdae00cab5d28c1ece34c90d94a7fbd9 (diff) | |
download | openttd-558ecb16317bccb53e534f561c659844bcd89df5.tar.xz |
(svn r4292) - CodeChange: sprinkle some holy water on l'ugly code (braces, and pos is PacketSize not int)
-rw-r--r-- | network_data.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/network_data.c b/network_data.c index 977e08447..ce008a86a 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; |