Fix clang warnings
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 20 Mar 2013 19:44:55 +0000 (15:44 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 20 Mar 2013 19:44:55 +0000 (15:44 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/ust-comm.h
liblttng-ust-comm/lttng-ust-comm.c
liblttng-ust-ctl/ustctl.c

index ba800900e1011fc8121723f08b8b2e3a0972fae6..133426e5e5f5e9e4a75e2b895cce4800013dad31 100644 (file)
@@ -102,7 +102,7 @@ struct ustcomm_ust_msg {
 struct ustcomm_ust_reply {
        uint32_t handle;
        uint32_t cmd;
-       uint32_t ret_code;      /* enum ustcomm_return_code */
+       int32_t ret_code;       /* enum ustcomm_return_code */
        uint32_t ret_val;       /* return value */
        char padding[USTCOMM_REPLY_PADDING1];
        union {
index 3a60ba1a4be09c6e4f9f543b31f274bdbea9d0f3..fd48a515e762109acea7b31d4c7b8566f5f04f39 100644 (file)
@@ -656,6 +656,26 @@ int ustcomm_send_reg_msg(int sock,
        return 0;
 }
 
+static
+int serialize_string_encoding(enum ustctl_string_encodings *ue,
+               enum lttng_string_encodings le)
+{
+       switch (le) {
+       case lttng_encode_none:
+               *ue = ustctl_encode_none;
+               break;
+       case lttng_encode_UTF8:
+               *ue = ustctl_encode_UTF8;
+               break;
+       case lttng_encode_ASCII:
+               *ue = ustctl_encode_ASCII;
+               break;
+       default:
+               return -EINVAL;
+       }
+       return 0;
+}
+
 static
 int serialize_basic_type(enum ustctl_abstract_types *uatype,
                enum lttng_abstract_types atype,
@@ -674,14 +694,17 @@ int serialize_basic_type(enum ustctl_abstract_types *uatype,
                uit->signedness = lit->signedness;
                uit->reverse_byte_order = lit->reverse_byte_order;
                uit->base = lit->base;
-               uit->encoding = lit->encoding;
+               if (serialize_string_encoding(&uit->encoding, lit->encoding))
+                       return -EINVAL;
                uit->alignment = lit->alignment;
                *uatype = ustctl_atype_integer;
                break;
        }
        case atype_string:
        {
-               ubt->string.encoding = lbt->string.encoding;
+               if (serialize_string_encoding(&ubt->string.encoding,
+                               lbt->string.encoding))
+                       return -EINVAL;
                *uatype = ustctl_atype_string;
                break;
        }
index 760e0403c887e1c243804399e61390d9b9fb5cd2..4056221d3fe59dc8c22dcb8367045f43bc3d6bd4 100644 (file)
@@ -756,9 +756,7 @@ int ustctl_send_channel_to_ust(int sock, int session_handle,
                return ret;
        ret = ustcomm_recv_app_reply(sock, &lur, lum.handle, lum.cmd);
        if (!ret) {
-               if (lur.ret_val >= 0) {
-                       channel_data->handle = lur.ret_val;
-               }
+               channel_data->handle = lur.ret_val;
        }
        return ret;
 }
This page took 0.02745 seconds and 4 git commands to generate.