diff options
author | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2024-06-19 20:50:41 +0200 |
---|---|---|
committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2024-06-19 20:50:41 +0200 |
commit | 47984162974a8f7d9903d352567005ac569c5a87 (patch) | |
tree | ab265785ceaae0585aec80f6d5209e6289cbefd3 /src/ser.c | |
parent | 9720c7efddf2d7595c9a0b021bc5fc6327c22bcf (diff) |
client: receive and display player list
Signed-off-by: Lizzy Fleckenstein <lizzy@vlhl.dev>
Diffstat (limited to 'src/ser.c')
-rw-r--r-- | src/ser.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -28,25 +28,25 @@ void ser_str(strbuf *w, str x) void ser_u8(strbuf *w, uint8_t x) { - ser_bytes(w, &x, 1); + ser_bytes(w, &x, sizeof x); } void ser_u16(strbuf *w, uint16_t x) { x = htole16(x); - ser_bytes(w, &x, 2); + ser_bytes(w, &x, sizeof x); } void ser_u32(strbuf *w, uint32_t x) { x = htole32(x); - ser_bytes(w, &x, 4); + ser_bytes(w, &x, sizeof x); } void ser_u64(strbuf *w, uint64_t x) { x = htole64(x); - ser_bytes(w, &x, 8); + ser_bytes(w, &x, sizeof x); } #define SER_SIGN(N) void ser_i##N(strbuf *w, int##N##_t x) { ser_u##N(w, x); }; @@ -98,7 +98,7 @@ bool deser_u8(str *r, uint8_t *buf) bool deser_u16(str *r, uint16_t *buf) { - if (!deser_bytes(r, buf, 2)) + if (!deser_bytes(r, buf, sizeof *buf)) return false; *buf = le16toh(*buf); return true; @@ -106,7 +106,7 @@ bool deser_u16(str *r, uint16_t *buf) bool deser_u32(str *r, uint32_t *buf) { - if (!deser_bytes(r, buf, 4)) + if (!deser_bytes(r, buf, sizeof *buf)) return false; *buf = le32toh(*buf); return true; @@ -114,7 +114,7 @@ bool deser_u32(str *r, uint32_t *buf) bool deser_u64(str *r, uint64_t *buf) { - if (!deser_bytes(r, buf, 8)) + if (!deser_bytes(r, buf, sizeof *buf)) return false; *buf = le64toh(*buf); return true; |