From: Mathieu Desnoyers Date: Wed, 20 Mar 2013 19:44:55 +0000 (-0400) Subject: Fix clang warnings X-Git-Tag: v2.2.0-rc1~45 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7f2348b85735a6284d2ada79d9c7cd2e96f45bbf;p=lttng-ust.git Fix clang warnings Signed-off-by: Mathieu Desnoyers --- diff --git a/include/ust-comm.h b/include/ust-comm.h index ba800900..133426e5 100644 --- a/include/ust-comm.h +++ b/include/ust-comm.h @@ -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 { diff --git a/liblttng-ust-comm/lttng-ust-comm.c b/liblttng-ust-comm/lttng-ust-comm.c index 3a60ba1a..fd48a515 100644 --- a/liblttng-ust-comm/lttng-ust-comm.c +++ b/liblttng-ust-comm/lttng-ust-comm.c @@ -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; } diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index 760e0403..4056221d 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -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; }