Apply -Wsign-compare and fix the errors 17/264617/3
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 27 Sep 2021 08:31:56 +0000 (17:31 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 28 Sep 2021 01:32:59 +0000 (10:32 +0900)
It is added to comply with VD build configuration.

[Version] 0.2.105
[Issue Type] Improvement

Change-Id: Ia863063842cd95f23c6db3b320923ae182ef6945
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
CMakeLists.txt
packaging/capi-media-webrtc.spec
src/webrtc_display.c
src/webrtc_source.c
test/webrtc_test.c

index aafc9e0a2c44c03eabf7c1d5cd05a8534cb41324..13f59b7caaccb4f842c802d816d4bde86492ed73 100644 (file)
@@ -27,7 +27,7 @@ FOREACH(flag ${${fw_name}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Wshadow -Werror")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Wshadow -Wsign-compare -Werror")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
 IF("${ARCH}" STREQUAL "arm")
index 0e259486c32e1c558aa2620c25204862ed2abe0e..cfe6abb83c5a2178edbe4a22653db8b27ee8cd75 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.2.104
+Version:    0.2.105
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index af531b01c6dd5b5b51ce16a2e3e2074462793817..36165974b3f7072d396eb2686b7293ca53669791 100644 (file)
@@ -309,7 +309,7 @@ static bool __swcodec_set_stride_elevation(video_decoded_data_info_s *info)
                int ret = TBM_SURFACE_ERROR_NONE;
                tbm_surface_h ts;
                tbm_surface_info_s ts_info;
-               int i;
+               unsigned int i;
 
                ts = tbm_surface_create(info->width, info->height, TBM_FORMAT_YUV420);
                ret = tbm_surface_get_info(ts, &ts_info);
@@ -533,8 +533,8 @@ static tbm_surface_h __get_tbm_surface(video_decoded_data_info_s *info)
        tbm_surface_h ts;
        tbm_surface_info_s ts_info;
        uint32_t bo_format;
-       int i;
-       int bo_num = 1; /* always 1 for none zerocopy format */
+       unsigned int i;
+       unsigned int bo_num = 1; /* always 1 for none zerocopy format */
 
        RET_VAL_IF(info == NULL, NULL, "info is NULL");
 
index dd0876c48a092b47a6d5c10ad71c25cd6c5e0731..b9a4efacf2764ae2784761bf72d4772d29a661f0 100644 (file)
@@ -2452,7 +2452,7 @@ int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_
        GstWebRTCRTPTransceiver *trans;
        GArray *transceivers;
        int mline;
-       int i;
+       guint i;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(direction > WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV, WEBRTC_ERROR_INVALID_PARAMETER, "invalid direction");
@@ -2474,7 +2474,7 @@ int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_
        g_signal_emit_by_name(webrtc->gst.webrtcbin, "get-transceivers", &transceivers);
        for (i = 0; i < transceivers->len; i++) {
                trans = g_array_index(transceivers, GstWebRTCRTPTransceiver *, i);
-               if (trans->mline == mline) {
+               if ((int)trans->mline == mline) {
                        trans->direction = __direction_info[direction].gst;
                        LOG_DEBUG("Set direction to transceiver[%p, index:%d, mline:%u, direction:%s]",
                                trans, i, trans->mline, __direction_info[direction].str);
@@ -2498,7 +2498,7 @@ int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_
        GstWebRTCRTPTransceiver *trans;
        GArray *transceivers;
        int mline;
-       int i;
+       guint i;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL");
@@ -2520,7 +2520,7 @@ int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_
        g_signal_emit_by_name(webrtc->gst.webrtcbin, "get-transceivers", &transceivers);
        for (i = 0; i < transceivers->len; i++) {
                trans = g_array_index(transceivers, GstWebRTCRTPTransceiver *, i);
-               if (trans->mline == mline) {
+               if ((int)trans->mline == mline) {
                        ret = __convert_direction(trans->direction, direction);
                        if (ret == WEBRTC_ERROR_NONE)
                                LOG_DEBUG("found transceiver[%p, index:%d, mline:%u, mid:%s, direction:%s]",
@@ -2753,7 +2753,7 @@ static gboolean __check_format_is_not_set_cb(gpointer key, gpointer value, gpoin
 {
        webrtc_gst_slot_s *source = value;
 
-       if (source->type == GPOINTER_TO_UINT(user_data)) {
+       if (source->type == GPOINTER_TO_INT(user_data)) {
                LOG_INFO("found media packet source[%p, id:%u, media_format:%p]", source, source->id, source->media_format);
                if (!source->media_format)
                        return TRUE;
@@ -2767,7 +2767,7 @@ bool _check_if_format_is_set_to_packet_sources(webrtc_s *webrtc)
 
        RET_VAL_IF(webrtc == NULL, false, "webrtc is NULL");
 
-       source = g_hash_table_find(webrtc->gst.source_slots, __check_format_is_not_set_cb, GUINT_TO_POINTER(WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET));
+       source = g_hash_table_find(webrtc->gst.source_slots, __check_format_is_not_set_cb, GINT_TO_POINTER(WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET));
        if (source) {
                LOG_ERROR("media format is not set to the media packet source[%u]", source->id);
                return false;
@@ -2846,7 +2846,7 @@ static gboolean __check_path_is_not_set_cb(gpointer key, gpointer value, gpointe
        webrtc_gst_slot_s *source = value;
        gchar *location = NULL;
 
-       if (source->type == GPOINTER_TO_UINT(user_data)) {
+       if (source->type == GPOINTER_TO_INT(user_data)) {
                LOG_INFO("found file source[%p, id:%u]", source, source->id);
                g_object_get(G_OBJECT(gst_bin_get_by_name(source->bin, DEFAULT_NAME_FILE_SRC)), "location", &location, NULL);
 
@@ -2865,7 +2865,7 @@ bool _check_if_path_is_set_to_file_sources(webrtc_s *webrtc)
 
        RET_VAL_IF(webrtc == NULL, false, "webrtc is NULL");
 
-       source = g_hash_table_find(webrtc->gst.source_slots, __check_path_is_not_set_cb, GUINT_TO_POINTER(WEBRTC_MEDIA_SOURCE_TYPE_FILE));
+       source = g_hash_table_find(webrtc->gst.source_slots, __check_path_is_not_set_cb, GINT_TO_POINTER(WEBRTC_MEDIA_SOURCE_TYPE_FILE));
        if (source) {
                LOG_ERROR("media path is not set to the file source[%u]", source->id);
                return false;
@@ -2904,7 +2904,7 @@ static int __fill_gst_buffer_mapped_data_from_packet(GstBuffer *buffer, media_pa
 
        if (gst_buffer_map(buffer, &buff_info, GST_MAP_READWRITE)) {
                if (has_tbm_surface) {
-                       int i;
+                       unsigned int i;
                        guint8 *ptr = buff_info.data;
                        for (i = 0; i < ts_info.num_planes; i++) {
                                LOG_DEBUG("plane[%d][ptr:%p size:%u]", i, ts_info.planes[i].ptr, ts_info.planes[i].size);
index da8fa28461ab17b90f9c76215f93fc4030959893..36d6df2bab8a3d191e911a003f16e56b12f6508c 100644 (file)
@@ -948,7 +948,7 @@ static int __copy_string_arr(gchar *dest_arr, char *string)
        len = strlen(string);
 
        src_size = g_strlcpy(dest_arr, string, MAX_STRING_LEN);
-       if (src_size != len) {
+       if ((int)src_size != len) {
                g_print("failed to g_strlcpy()\n");
                return -1;
        }
@@ -1402,7 +1402,7 @@ static void __data_channel_message_cb(webrtc_data_channel_h channel, webrtc_data
                webrtc_bytes_data_h *data = message;
                const char *data_p;
                unsigned long size;
-               int i = 0;
+               unsigned long i = 0;
 
                webrtc_get_data(data, &data_p, &size);
                g_print("bytes message[%p, size:%lu]\n", data_p, size);
@@ -2362,7 +2362,7 @@ static media_packet_h __make_media_packet(media_packet_source_s *packet_source,
 
        if (gst_buffer_map(buffer, &buff_info, GST_MAP_READ)) {
                if (has_tbm_surface) {
-                       int i;
+                       unsigned int i;
                        guint8 *ptr = buff_info.data;
                        for (i = 0; i < ts_info.num_planes; i++) {
                                g_print("plane[%d][ptr:%p size:%u]\n", i, ts_info.planes[i].ptr, ts_info.planes[i].size);
@@ -3276,7 +3276,7 @@ static void __handle_room_related_message(connection_s *conn, const gchar *text)
 {
        gchar **tokens = NULL;
        guint len;
-       int i;
+       guint i;
 
        RET_IF(!conn, "conn is NULL");
        RET_IF(!text, "text is NULL");