fix: remove floating-point arguments in msgpack
[deliverable/lttng-modules.git] / src / lib / msgpack / msgpack.c
index 0803bc657646b49f4dcbc7c3ffad244a0ec33a44..b4d9beec279839ecde9aff98462ef36da5bc8a97 100644 (file)
@@ -55,6 +55,7 @@
 #include <linux/bug.h>
 #include <linux/string.h>
 #include <linux/types.h>
+#include <asm/byteorder.h>
 
 #include <lttng/msgpack.h>
 
@@ -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)
 {
This page took 0.0264760000000001 seconds and 5 git commands to generate.