libnm-util, core: fix warning about signed integer overflow (-Wstrict-overflow)

gcc warns:

    make[4]: Entering directory `./NetworkManager/libnm-util'
      CC       nm-value-transforms.lo
    nm-value-transforms.c: In function '_nm_utils_convert_op_array_to_string':
    nm-value-transforms.c:121:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (i > 0)
          ^
    nm-value-transforms.c: In function '_nm_utils_convert_string_array_to_string':
    nm-value-transforms.c:121:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (i > 0)
          ^

    make[7]: Entering directory `./NetworkManager/src/settings/plugins/ifcfg-rh'
      CC       reader.lo
    reader.c: In function 'make_wired_setting':
    reader.c:3295:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (!found)
          ^
    reader.c: In function 'wireless_connection_from_ifcfg':
    reader.c:3295:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
       if (!found)
          ^

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-07-27 02:20:00 +02:00
parent f0d40201ae
commit b835111129
4 changed files with 6 additions and 4 deletions

View file

@ -114,7 +114,7 @@ static void
_string_array_to_string (const GPtrArray *strings, GValue *dest_value)
{
GString *printable;
int i;
guint i;
printable = g_string_new (NULL);
for (i = 0; strings && i < strings->len; i++) {

View file

@ -3266,7 +3266,7 @@ fill_8021x (shvarFile *ifcfg,
char *lower = NULL;
lower = g_ascii_strdown (*iter, -1);
while (eap->method && !found) {
while (eap->method) {
if (strcmp (eap->method, lower))
goto next;
@ -3287,6 +3287,7 @@ fill_8021x (shvarFile *ifcfg,
}
nm_setting_802_1x_add_eap_method (s_8021x, lower);
found = TRUE;
break;
next:
eap++;

View file

@ -1383,7 +1383,7 @@ fill_8021x (const char *ssid,
char *lower = NULL;
lower = g_ascii_strdown (*iter, -1);
while (eap->method && !found) {
while (eap->method) {
if (strcmp (eap->method, lower))
goto next;
@ -1404,6 +1404,7 @@ fill_8021x (const char *ssid,
}
nm_setting_802_1x_add_eap_method (s_8021x, lower);
found = TRUE;
break;
next:
eap++;

View file

@ -67,7 +67,7 @@ test_nm_utils_ascii_str_to_int64_do (const char *str, guint base, gint64 min,
NULL,
};
const char **ws_pre, **ws_post, **null;
int i;
guint i;
if (str == NULL || exp_errno != 0) {
test_nm_utils_ascii_str_to_int64_check (str, base, min, max, fallback, exp_errno, exp_val);