diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2011-09-14 14:15:48 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2011-09-15 14:32:37 -0700 |
commit | 1c15e85d062b8bf2d83a2c28652de652ca915694 (patch) | |
tree | fc9ce283b7848d3778cfd8e05d2727768231d5f2 /src/inventory.h | |
parent | 74594b897097b6dc61b7525b4389e15be5771dad (diff) | |
download | mana-1c15e85d062b8bf2d83a2c28652de652ca915694.tar.gz mana-1c15e85d062b8bf2d83a2c28652de652ca915694.tar.bz2 mana-1c15e85d062b8bf2d83a2c28652de652ca915694.tar.xz mana-1c15e85d062b8bf2d83a2c28652de652ca915694.zip |
Improve handling of packet lengths.
* Use a symbol, VAR, instead of -1 for variable-length packets.
* Also change it's value to 1, so the length can be properly unsigned.
Note: A packet can't actually have length 1, since packet ID is 2 bytes.
* Use correct type (uint16_t) for packet id and length in more places.
* Avoid reading beyond the length of the array.
* Immediately parse variable length packets with length 4 (i.e. no body)
instead of waiting for another byte to arrive first.
Reviewed-by: Thorbjørn Lindeijer <thorbjorn@lindeijer.nl>
Diffstat (limited to 'src/inventory.h')
0 files changed, 0 insertions, 0 deletions