diff options
| author | Alexander Gavrilov | 2012-03-17 17:52:23 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-03-17 17:52:23 +0400 |
| commit | 3d80a1ee35be9dcff1e53f74e5be3581c0d42743 (patch) | |
| tree | 6a89cae5fadbb2669b6900b7f5da0e46de3b598c /library/RemoteClient.cpp | |
| parent | 368b92f81f5257eaf5bf4f11f41507a52f3d29c1 (diff) | |
| download | dfhack-3d80a1ee35be9dcff1e53f74e5be3581c0d42743.tar.gz dfhack-3d80a1ee35be9dcff1e53f74e5be3581c0d42743.tar.bz2 dfhack-3d80a1ee35be9dcff1e53f74e5be3581c0d42743.tar.xz | |
Use a more obscure serialize method to avoid recalculating byte size.
Diffstat (limited to 'library/RemoteClient.cpp')
| -rw-r--r-- | library/RemoteClient.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/library/RemoteClient.cpp b/library/RemoteClient.cpp index a66421aa..a1ac2ec9 100644 --- a/library/RemoteClient.cpp +++ b/library/RemoteClient.cpp @@ -335,8 +335,9 @@ bool sendRemoteMessage(CSimpleSocket *socket, int16_t id, const MessageLite *msg hdr->id = id; hdr->size = size; - if (!msg->SerializeToArray(data.get() + sizeof(RPCMessageHeader), size)) - return false; + uint8_t *pstart = data.get() + sizeof(RPCMessageHeader); + uint8_t *pend = msg->SerializeWithCachedSizesToArray(pstart); + assert((pend - pstart) == size); return (socket->Send(data.get(), fullsz) == fullsz); } |
