X-Git-Url: http://git.tdb.fi/?p=libs%2Fnet.git;a=blobdiff_plain;f=source%2Fnet%2Fprotocol.cpp;h=f8bf4c3dd2fdd43c2d42a8f250d746ab44c545d7;hp=a152c559682541ded0234d77efa3fefad94537c2;hb=c2eeb0da9f5e5de1b8de1bc66a42709e54d504e2;hpb=e509c358e907dcd3c39968c7f2370832670537eb diff --git a/source/net/protocol.cpp b/source/net/protocol.cpp index a152c55..f8bf4c3 100644 --- a/source/net/protocol.cpp +++ b/source/net/protocol.cpp @@ -49,7 +49,7 @@ const Protocol::PacketDefBase &Protocol::get_packet_by_id(unsigned id) const return *get_item(packet_id_defs, id); } -unsigned Protocol::dispatch(ReceiverBase &rcv, const char *buf, unsigned size) const +size_t Protocol::dispatch(ReceiverBase &rcv, const char *buf, size_t size) const { PacketHeader header; buf = header_def.deserialize(header, buf, buf+size); @@ -60,7 +60,7 @@ unsigned Protocol::dispatch(ReceiverBase &rcv, const char *buf, unsigned size) c return ptr-buf; } -unsigned Protocol::get_packet_size(const char *buf, unsigned size) const +size_t Protocol::get_packet_size(const char *buf, size_t size) const { if(size<4) return 0; @@ -87,7 +87,7 @@ char *Protocol::BasicSerializer::serialize(const T &value, char *buf, char *e throw buffer_error("overflow"); const char *ptr = reinterpret_cast(&value)+sizeof(T); - for(unsigned i=0; i::deserialize(T &value, const char *buf, throw buffer_error("underflow"); char *ptr = reinterpret_cast(&value)+sizeof(T); - for(unsigned i=0; i