diff options
author | frosch <frosch@openttd.org> | 2010-02-27 20:26:42 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-02-27 20:26:42 +0000 |
commit | 3926b6244652a039ff5eebc4119c7b6beb434ec1 (patch) | |
tree | 9e3c26e11b520b51d79c4c0b09f8fed323c45c19 /src/network | |
parent | d7698bb6dbfe5353734ee3a34a1f58933c49bfcb (diff) | |
download | openttd-3926b6244652a039ff5eebc4119c7b6beb434ec1.tar.xz |
(svn r19283) -Fix (r19256): GRFConfig is not zeroed for non-dynamic construction. GRFIdentifier is sufficient though.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/network_client.cpp | 12 | ||||
-rw-r--r-- | src/network/network_udp.cpp | 14 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index d5007ef9a..09dc66001 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -511,16 +511,16 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CHECK_NEWGRFS) /* Check all GRFs */ for (; grf_count > 0; grf_count--) { - GRFConfig c; - MY_CLIENT->Recv_GRFIdentifier(p, &c.ident); + GRFIdentifier c; + MY_CLIENT->Recv_GRFIdentifier(p, &c); /* Check whether we know this GRF */ - const GRFConfig *f = FindGRFConfig(c.ident.grfid, c.ident.md5sum); + const GRFConfig *f = FindGRFConfig(c.grfid, c.md5sum); if (f == NULL) { /* We do not know this GRF, bail out of initialization */ - char buf[sizeof(c.ident.md5sum) * 2 + 1]; - md5sumToString(buf, lastof(buf), c.ident.md5sum); - DEBUG(grf, 0, "NewGRF %08X not found; checksum %s", BSWAP32(c.ident.grfid), buf); + char buf[sizeof(c.md5sum) * 2 + 1]; + md5sumToString(buf, lastof(buf), c.md5sum); + DEBUG(grf, 0, "NewGRF %08X not found; checksum %s", BSWAP32(c.grfid), buf); ret = NETWORK_RECV_STATUS_NEWGRF_MISMATCH; } } diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp index 2f613fade..29ecebe37 100644 --- a/src/network/network_udp.cpp +++ b/src/network/network_udp.cpp @@ -177,19 +177,19 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_GET_NEWGRFS) if (num_grfs > NETWORK_MAX_GRF_COUNT) return; for (i = 0; i < num_grfs; i++) { - GRFConfig c; + GRFIdentifier c; const GRFConfig *f; - this->Recv_GRFIdentifier(p, &c.ident); + this->Recv_GRFIdentifier(p, &c); /* Find the matching GRF file */ - f = FindGRFConfig(c.ident.grfid, c.ident.md5sum); + f = FindGRFConfig(c.grfid, c.md5sum); if (f == NULL) continue; // The GRF is unknown to this server /* If the reply might exceed the size of the packet, only reply * the current list and do not send the other data. * The name could be an empty string, if so take the filename. */ - packet_len += sizeof(c.ident.grfid) + sizeof(c.ident.md5sum) + + packet_len += sizeof(c.grfid) + sizeof(c.md5sum) + min(strlen((!StrEmpty(f->name)) ? f->name : f->filename) + 1, (size_t)NETWORK_GRF_NAME_LENGTH); if (packet_len > SEND_MTU - 4) { // 4 is 3 byte header + grf count in reply break; @@ -341,9 +341,9 @@ DEF_UDP_RECEIVE_COMMAND(Client, PACKET_UDP_SERVER_NEWGRFS) for (i = 0; i < num_grfs; i++) { char *unknown_name; char name[NETWORK_GRF_NAME_LENGTH]; - GRFConfig c; + GRFIdentifier c; - this->Recv_GRFIdentifier(p, &c.ident); + this->Recv_GRFIdentifier(p, &c); p->Recv_string(name, sizeof(name)); /* An empty name is not possible under normal circumstances @@ -353,7 +353,7 @@ DEF_UDP_RECEIVE_COMMAND(Client, PACKET_UDP_SERVER_NEWGRFS) /* Finds the fake GRFConfig for the just read GRF ID and MD5sum tuple. * If it exists and not resolved yet, then name of the fake GRF is * overwritten with the name from the reply. */ - unknown_name = FindUnknownGRFName(c.ident.grfid, c.ident.md5sum, false); + unknown_name = FindUnknownGRFName(c.grfid, c.md5sum, false); if (unknown_name != NULL && strcmp(unknown_name, UNKNOWN_GRF_NAME_PLACEHOLDER) == 0) { ttd_strlcpy(unknown_name, name, NETWORK_GRF_NAME_LENGTH); } |