summaryrefslogtreecommitdiff
path: root/src/ser.c
diff options
context:
space:
mode:
authorLizzy Fleckenstein <lizzy@vlhl.dev>2024-06-19 20:50:41 +0200
committerLizzy Fleckenstein <lizzy@vlhl.dev>2024-06-19 20:50:41 +0200
commit47984162974a8f7d9903d352567005ac569c5a87 (patch)
treeab265785ceaae0585aec80f6d5209e6289cbefd3 /src/ser.c
parent9720c7efddf2d7595c9a0b021bc5fc6327c22bcf (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.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ser.c b/src/ser.c
index 7a40da0..b394627 100644
--- a/src/ser.c
+++ b/src/ser.c
@@ -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;