Fix cppcheck 'unsignedLessThanZero' warnings 59/253359/1
authorNishant Chaprana <n.chaprana@samsung.com>
Tue, 9 Feb 2021 06:51:57 +0000 (12:21 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Tue, 9 Feb 2021 06:51:57 +0000 (12:21 +0530)
Change-Id: Ifcbc0adac0e8f086a94e40c0feebd6ed03ed9d1c
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
src/network_dbus.c
test/wifi_manager_test.c
tool/wifi_mgr_public_vsie.c

index 5c0bfbe..9184881 100755 (executable)
@@ -1186,7 +1186,7 @@ int _net_dbus_set_agent_passphrase_and_connect(network_info_s *network_info,
 
        net_err_e Error = NET_ERR_NONE;
 
-       if (NULL == passphrase || strlen(passphrase) <= 0 || NULL == profilename) {
+       if (NULL == passphrase || strlen(passphrase) == 0 || NULL == profilename) {
                WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
                return NET_ERR_INVALID_PARAM; //LCOV_EXCL_LINE
        }
@@ -1213,7 +1213,7 @@ static int _net_dbus_set_agent_fields_and_connect(network_info_s *network_info,
        GVariantBuilder *builder;
 
        /* If OPEN network, passphrase can be NULL */
-       if (NULL == ssid || strlen(ssid) <= 0 || NULL == profilename) {
+       if (NULL == ssid || strlen(ssid) == 0 || NULL == profilename) {
                WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
                return NET_ERR_INVALID_PARAM; //LCOV_EXCL_LINE
        }
@@ -1305,7 +1305,7 @@ int _net_dbus_set_agent_wps_pin_and_connect(network_info_s *network_info,
 
        net_err_e Error = NET_ERR_NONE;
 
-       if (NULL == wps_pin || strlen(wps_pin) <= 0) {
+       if (NULL == wps_pin || strlen(wps_pin) == 0) {
                WIFI_LOG(WIFI_ERROR, "Invalid param ");
                return NET_ERR_INVALID_PARAM;
        }
index 06607b1..26a3420 100755 (executable)
@@ -3115,7 +3115,7 @@ int test_wifi_manager_add_vsie(void)
        if (scanf(" %100ms", &vsie) < 1)
                return -1;
 
-       if (strlen(vsie) <= 0)
+       if (strlen(vsie) == 0)
                printf("invalid vsie !!\n");
        else
                printf("vsie: [%s]\n", vsie);
@@ -3170,7 +3170,7 @@ int test_wifi_manager_remove_vsie(void)
        if (scanf(" %100ms", &vsie) < 1)
                return -1;
 
-       if (strlen(vsie) <= 0)
+       if (strlen(vsie) == 0)
                printf("invalid vsie !!\n");
        else
                printf("vsie: [%s]\n", vsie);
index c6be989..804ba05 100755 (executable)
@@ -44,7 +44,7 @@ static int _test_public_vsie_add(MManager *mm, struct menu_data *menu)
                return WIFI_MANAGER_ERROR_INVALID_PARAMETER;
        }
 
-       if (strlen(g_vsie) <= 0) {
+       if (strlen(g_vsie) == 0) {
                msg("Invalid parameter " LOG_RED "[VSIE data]" LOG_END);
                return WIFI_MANAGER_ERROR_INVALID_PARAMETER;
        }
@@ -105,7 +105,7 @@ static int _test_public_vsie_remove(MManager *mm, struct menu_data *menu)
                return WIFI_MANAGER_ERROR_INVALID_PARAMETER;
        }
 
-       if (strlen(g_vsie) <= 0) {
+       if (strlen(g_vsie) == 0) {
                msg("Invalid parameter " LOG_RED "[VSIE data]" LOG_END);
                return WIFI_MANAGER_ERROR_INVALID_PARAMETER;
        }