Merge pull request #47 from QQNN-blue/change_capn_write_mem_return_val_type

Change capn_write_mem return value from int to int64_t
This commit is contained in:
Jason Heeris 2021-05-10 22:19:28 +08:00 committed by GitHub
commit 0650ccbf17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -230,7 +230,7 @@ static int header_render(struct capn *c, struct capn_segment *seg, uint32_t *hea
return 0; 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_segment *seg;
struct capn_ptr root; 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 -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) capn_write_mem(struct capn *c, uint8_t *p, size_t sz, int packed)
{ {
struct capn_segment *seg; 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; 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) static int _write_fd(ssize_t (*write_fd)(int fd, const void *p, size_t count), int fd, void *p, size_t count)

View file

@ -290,7 +290,7 @@ int capn_size(struct capn *c);
/* TODO */ /* TODO */
/*int capn_write_fp(struct capn *c, FILE *f, int packed);*/ /*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_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_free(struct capn *c);
void capn_reset_copy(struct capn *c); void capn_reset_copy(struct capn *c);