size_t Protocol::dispatch(ReceiverBase &rcv, const char *buf, size_t size) const
{
PacketHeader header;
- buf = header_def.deserialize(header, buf, buf+size);
+ const char *ptr = header_def.deserialize(header, buf, buf+size);
if(header.length>size)
throw bad_packet("truncated");
const PacketDefBase &pdef = get_packet_by_id(header.type);
- const char *ptr = pdef.dispatch(rcv, buf, buf+header.length);
+ ptr = pdef.dispatch(rcv, ptr, ptr+header.length);
return ptr-buf;
}