From 3c0b223b8c52bc5d63421937c6dad4f7291e2a71 Mon Sep 17 00:00:00 2001 From: QQNN-blue <76017083+QQNN-blue@users.noreply.github.com> Date: Wed, 17 Feb 2021 11:39:03 -0800 Subject: [PATCH] Change capn_write_mem return value from int to int64_t --- lib/capn-malloc.c | 8 ++++---- lib/capnp_c.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/capn-malloc.c b/lib/capn-malloc.c index 7308061..5b467dc 100644 --- a/lib/capn-malloc.c +++ b/lib/capn-malloc.c @@ -230,7 +230,7 @@ static int header_render(struct capn *c, struct capn_segment *seg, uint32_t *hea return 0; } -static int capn_write_mem_packed(struct capn *c, uint8_t *p, size_t sz) +static int64_t capn_write_mem_packed(struct capn *c, uint8_t *p, size_t sz) { struct capn_segment *seg; struct capn_ptr root; @@ -270,10 +270,10 @@ static int capn_write_mem_packed(struct capn *c, uint8_t *p, size_t sz) return -1; } - return sz - z.avail_out; + return (int64_t)(sz - z.avail_out); } -int +int64_t capn_write_mem(struct capn *c, uint8_t *p, size_t sz, int packed) { struct capn_segment *seg; @@ -310,7 +310,7 @@ capn_write_mem(struct capn *c, uint8_t *p, size_t sz, int packed) p += seg->len; } - return headersz+datasz; + return (int64_t)(headersz + datasz); } static int _write_fd(ssize_t (*write_fd)(int fd, const void *p, size_t count), int fd, void *p, size_t count) diff --git a/lib/capnp_c.h b/lib/capnp_c.h index 609826a..45566d6 100644 --- a/lib/capnp_c.h +++ b/lib/capnp_c.h @@ -282,7 +282,7 @@ int capn_init_mem(struct capn *c, const uint8_t *p, size_t sz, int packed); /* TODO */ /*int capn_write_fp(struct capn *c, FILE *f, int packed);*/ int capn_write_fd(struct capn *c, ssize_t (*write_fd)(int fd, const void *p, size_t count), int fd, int packed); -int capn_write_mem(struct capn *c, uint8_t *p, size_t sz, int packed); +int64_t capn_write_mem(struct capn *c, uint8_t *p, size_t sz, int packed); void capn_free(struct capn *c); void capn_reset_copy(struct capn *c);