summaryrefslogtreecommitdiff
path: root/lib9p/tables.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/tables.c')
-rw-r--r--lib9p/tables.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib9p/tables.c b/lib9p/tables.c
index 271b17b..86e3298 100644
--- a/lib9p/tables.c
+++ b/lib9p/tables.c
@@ -96,6 +96,7 @@ void _lib9p_unmarshal(const struct _lib9p_recv_tentry xxx_table[LIB9P_VER_NUM][0
enum lib9p_msg_type typ = net_bytes[4];
*ret_typ = typ;
struct _lib9p_recv_tentry tentry = xxx_table[ctx->version][typ/2];
+ assert(tentry.unmarshal);
tentry.unmarshal(ctx, net_bytes, ret_body);
}
@@ -124,8 +125,9 @@ bool _lib9p_marshal(const struct _lib9p_send_tentry xxx_table[LIB9P_VER_NUM][0x8
.net_copied_size = 0,
.net_copied = ret_copied,
};
-
struct _lib9p_send_tentry tentry = xxx_table[ctx->version][typ/2];
+ assert(tentry.marshal);
+
bool ret_erred = tentry.marshal(ctx, body, &ret);
if (ret_iov[ret.net_iov_cnt-1].iov_len == 0)
ret.net_iov_cnt--;
@@ -154,12 +156,12 @@ bool lib9p_Rmsg_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *bo
/* `struct lib9p_stat` helpers ************************************************/
bool lib9p_stat_validate(struct lib9p_ctx *ctx, uint32_t net_size, uint8_t *net_bytes,
- uint32_t *ret_net_size, ssize_t *ret_host_size) {
+ uint32_t *ret_net_size, size_t *ret_host_size) {
ssize_t host_size = _lib9p_stat_validate(ctx, net_size, net_bytes, ret_net_size);
if (host_size < 0)
return true;
if (ret_host_size)
- *ret_host_size = host_size;
+ *ret_host_size = (size_t)host_size;
return false;
}