diff options
author | Determinant <tederminant@gmail.com> | 2019-06-14 16:01:29 -0400 |
---|---|---|
committer | Determinant <tederminant@gmail.com> | 2019-06-14 16:01:29 -0400 |
commit | 6c927588f78c663fded354fd696997d09fb5d697 (patch) | |
tree | d2367b60c81471a315d8f11fd107eb39b214e38b /include/salticidae/stream.h | |
parent | 2b23bd2e6b94edca0ef27d9560aedfc4459bd74b (diff) |
handle errors in C bindings
Diffstat (limited to 'include/salticidae/stream.h')
-rw-r--r-- | include/salticidae/stream.h | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h index cf007ac..37786b2 100644 --- a/include/salticidae/stream.h +++ b/include/salticidae/stream.h @@ -505,32 +505,32 @@ datastream_t *datastream_new(); datastream_t *datastream_new_from_bytes(const uint8_t *base, size_t size); void datastream_free(const datastream_t *self); -void datastream_assign_by_copy(datastream_t *dst, const datastream_t *src); -void datastream_assign_by_move(datastream_t *dst, datastream_t *_moved_src); +bool datastream_assign_by_copy(datastream_t *dst, const datastream_t *src); +bool datastream_assign_by_move(datastream_t *dst, datastream_t *_moved_src); uint8_t *datastream_data(datastream_t *self); void datastream_clear(datastream_t *self); size_t datastream_size(const datastream_t *self); -void datastream_put_u8(datastream_t *self, uint8_t val); -void datastream_put_u16(datastream_t *self, uint16_t val); -void datastream_put_u32(datastream_t *self, uint32_t val); -void datastream_put_u64(datastream_t *self, uint64_t val); - -void datastream_put_i8(datastream_t *self, int8_t val); -void datastream_put_i16(datastream_t *self, int16_t val); -void datastream_put_i32(datastream_t *self, int32_t val); -void datastream_put_i64(datastream_t *self, int64_t val); -void datastream_put_data(datastream_t *self, const uint8_t *base, size_t size); - -uint8_t datastream_get_u8(datastream_t *self); -uint16_t datastream_get_u16(datastream_t *self); -uint32_t datastream_get_u32(datastream_t *self); -uint64_t datastream_get_u64(datastream_t *self); - -int8_t datastream_get_i8(datastream_t *self); -int16_t datastream_get_i16(datastream_t *self); -int32_t datastream_get_i32(datastream_t *self); -int64_t datastream_get_i64(datastream_t *self); +bool datastream_put_u8(datastream_t *self, uint8_t val); +bool datastream_put_u16(datastream_t *self, uint16_t val); +bool datastream_put_u32(datastream_t *self, uint32_t val); +bool datastream_put_u64(datastream_t *self, uint64_t val); + +bool datastream_put_i8(datastream_t *self, int8_t val); +bool datastream_put_i16(datastream_t *self, int16_t val); +bool datastream_put_i32(datastream_t *self, int32_t val); +bool datastream_put_i64(datastream_t *self, int64_t val); +bool datastream_put_data(datastream_t *self, const uint8_t *base, size_t size); + +uint8_t datastream_get_u8(datastream_t *self, bool *succ); +uint16_t datastream_get_u16(datastream_t *self, bool *succ); +uint32_t datastream_get_u32(datastream_t *self, bool *succ); +uint64_t datastream_get_u64(datastream_t *self, bool *succ); + +int8_t datastream_get_i8(datastream_t *self, bool *succ); +int16_t datastream_get_i16(datastream_t *self, bool *succ); +int32_t datastream_get_i32(datastream_t *self, bool *succ); +int64_t datastream_get_i64(datastream_t *self, bool *succ); const uint8_t *datastream_get_data_inplace(datastream_t *self, size_t len); uint256_t *datastream_get_hash(const datastream_t *self); |