X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Flib%2Fmsgpack%2Fmsgpack.c;h=b4d9beec279839ecde9aff98462ef36da5bc8a97;hb=562376193c44ad44a9243cd880d5e424f0c25b04;hp=0803bc657646b49f4dcbc7c3ffad244a0ec33a44;hpb=7ab8c61663d23386a58fb2f36ab8e22d1c0b1efd;p=lttng-modules.git diff --git a/src/lib/msgpack/msgpack.c b/src/lib/msgpack/msgpack.c index 0803bc65..b4d9beec 100644 --- a/src/lib/msgpack/msgpack.c +++ b/src/lib/msgpack/msgpack.c @@ -55,6 +55,7 @@ #include #include #include +#include #include @@ -143,20 +144,6 @@ static inline int lttng_msgpack_append_u64( return lttng_msgpack_append_buffer(writer, (uint8_t *) &value, sizeof(value)); } -static inline int lttng_msgpack_append_f64( - struct lttng_msgpack_writer *writer, double value) -{ - - union { - double d; - uint64_t u; - } u; - - u.d = value; - - return lttng_msgpack_append_u64(writer, u.u); -} - static inline int lttng_msgpack_append_i8( struct lttng_msgpack_writer *writer, int8_t value) { @@ -181,23 +168,6 @@ static inline int lttng_msgpack_append_i64( return lttng_msgpack_append_u64(writer, (uint64_t) value); } -static inline int lttng_msgpack_encode_f64( - struct lttng_msgpack_writer *writer, double value) -{ - int ret; - - ret = lttng_msgpack_append_u8(writer, MSGPACK_FLOAT64_ID); - if (ret) - goto end; - - ret = lttng_msgpack_append_f64(writer, value); - if (ret) - goto end; - -end: - return ret; -} - static inline int lttng_msgpack_encode_fixmap( struct lttng_msgpack_writer *writer, uint8_t count) { @@ -316,7 +286,7 @@ int lttng_msgpack_begin_map(struct lttng_msgpack_writer *writer, size_t count) { int ret; - if (count < 0 || count >= (1 << 16)) { + if (count >= (1 << 16)) { ret = -1; goto end; } @@ -343,7 +313,7 @@ int lttng_msgpack_begin_array( { int ret; - if (count < 0 || count >= (1 << 16)) { + if (count >= (1 << 16)) { ret = -1; goto end; } @@ -370,7 +340,8 @@ int lttng_msgpack_write_str(struct lttng_msgpack_writer *writer, { int ret; size_t length = strlen(str); - if (length < 0 || length >= (1 << 16)) { + + if (length >= (1 << 16)) { ret = -1; goto end; } @@ -492,11 +463,6 @@ end: return ret; } -int lttng_msgpack_write_double(struct lttng_msgpack_writer *writer, double value) -{ - return lttng_msgpack_encode_f64(writer, value); -} - void lttng_msgpack_writer_init(struct lttng_msgpack_writer *writer, uint8_t *buffer, size_t size) {