Merge pull request #12 from ThirteenFish/master

lib: make buf arg const in write_fd pointer
This commit is contained in:
David Lamparter 2017-03-22 08:38:24 +01:00 committed by GitHub
commit 462f6eb9a8
2 changed files with 3 additions and 3 deletions

View file

@ -304,7 +304,7 @@ capn_write_mem(struct capn *c, uint8_t *p, size_t sz, int packed)
return headersz+datasz; return headersz+datasz;
} }
static int _write_fd(ssize_t (*write_fd)(int fd, 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)
{ {
ssize_t ret; ssize_t ret;
size_t sent = 0; size_t sent = 0;
@ -323,7 +323,7 @@ static int _write_fd(ssize_t (*write_fd)(int fd, void *p, size_t count), int fd,
return 0; return 0;
} }
int capn_write_fd(struct capn *c, ssize_t (*write_fd)(int fd, 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)
{ {
unsigned char buf[4096]; unsigned char buf[4096];
struct capn_segment *seg; struct capn_segment *seg;

View file

@ -266,7 +266,7 @@ int capn_init_mem(struct capn *c, const uint8_t *p, size_t sz, int packed);
*/ */
/* 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, 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); int 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);