diff options
Diffstat (limited to 'msgpack.c')
-rw-r--r-- | msgpack.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -184,8 +184,21 @@ int msgpack_read_map (msgpack_t *pack, size_t *length); int msgpack_read_array2 (const msgpack_t *pack, struct mp_array *m); int msgpack_read_map2 (const msgpack_t *pack, struct mp_map *m); +#define CHECK_WRITE_ARGS(type, pack, m) \ + do { \ + if(!(pack) || !(pack)->bin || (pack)->size == 0) \ + return ERROR((type), MSGPACK_ERROR_INVALID_PACK); \ + if((pack)->bin[0] == 0xc) \ + return ERROR2((type), MSGPACK_ERROR_WRONG_TYPE, MSGPACK_NIL); \ + if(!(m)) \ + return ERROR((type), MSGPACK_ERROR_INVALID_ARGUMENT); \ + } while(0) + +int msgpack_write_int (msgpack_t *pack, const union mp_int *m, int subtype) + ;// { + +// } -int msgpack_write_int (msgpack_t *pack, const union mp_int *m, int subtype); int msgpack_write_bool (msgpack_t *pack, const int *m); int msgpack_write_float (msgpack_t *pack, const union mp_float *m, int subtype); |