Commit Graph

20112 Commits

Author SHA1 Message Date
Philip Withnall
c8692fffe0 Merge branch 'fix-warnings-glib' into 'master'
Fix warnings glib

See merge request GNOME/glib!680
2019-03-19 11:02:38 +00:00
Philip Withnall
10278fd808 Merge branch 'meson' into 'master'
meson: do a build-time check for strlcpy before attempting runtime check

See merge request GNOME/glib!724
2019-03-19 10:57:58 +00:00
Philip Withnall
114921ccd9 Merge branch 'dbus-address-tests' into 'master'
Improve gdbus-address parsing tests

See merge request GNOME/glib!730
2019-03-19 10:53:44 +00:00
Philip Withnall
fcbfa0c65f Merge branch 'enotsock' into 'master'
GIO: Convert ENOTSOCK to G_IO_ERROR_INVALID_ARGUMENT

Closes #1728

See merge request GNOME/glib!731
2019-03-19 09:03:13 +00:00
Emmanuel Fleury
fad04d2e18 Fixing signedness warning in glib/gslice.c
In file included from glib/glibconfig.h:9,
                 from glib/gslice.c:20:
glib/gslice.c: In function ‘magazine_cache_trim’:
glib/gmacros.h:354:25: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
 #define ABS(a)    (((a) < 0) ? -(a) : (a))
                         ^
glib/gslice.c:643:10: note: in expansion of macro ‘ABS’
   while (ABS (stamp - magazine_chain_uint_stamp (current)) >= allocator->config.working_set_msecs)
          ^~~
2019-03-17 19:05:35 +01:00
Emmanuel Fleury
e9f57495c6 Fix various signedness warnings in glib/ghash.c
To conform to a better signedness schema, this patch change
GHashTable.size field from gint to gsize (and change accordingly the
tests with it).
2019-03-17 19:05:35 +01:00
Emmanuel Fleury
a7aac03ead Fixing various warnings in glib/gvariant-parser.c
glib/gvariant-parser.c: In function ‘number_get_value’:
glib/gvariant-parser.c:1924:46: error: operand of ?: changes signedness from ‘int’ to ‘guint64’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Werror=sign-compare]
       return g_variant_new_int16 (negative ? -((gint16) abs_val) : abs_val);
                                             ^~~~~~~~~~~~~~~~~~~
glib/gvariant-parser.c:1934:46: error: operand of ?: changes signedness from ‘int’ to ‘guint64’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Werror=sign-compare]
       return g_variant_new_int32 (negative ? -((gint32) abs_val) : abs_val);
                                              ^~~~~~~~~~~~~~~~~~~
glib/gvariant-parser.c:1944:46: error: operand of ?: changes signedness from ‘long int’ to ‘guint64’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Werror=sign-compare]
       return g_variant_new_int64 (negative ? -((gint64) abs_val) : abs_val);
                                                  ^~~~~~~~~~~~~~~~~~~
glib/gvariant-parser.c:1954:47: error: operand of ?: changes signedness from ‘int’ to ‘guint64’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Werror=sign-compare]
       return g_variant_new_handle (negative ? -((gint32) abs_val) : abs_val);
                                                   ^~~~~~~~~~~~~~~~~~~
glib/gvariant-parser.c: In function ‘g_variant_parse_error_print_context’:
glib/gvariant-parser.c:2785:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
       if (point >= strlen (source_str))
                 ^~
2019-03-17 19:05:35 +01:00
Emmanuel Fleury
357c3db942 Fixing various warning in glib/gvarianttypeinfo.c
glib/gvarianttypeinfo.c:115:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'b' */ { fixed_aligned(1) },   /* boolean */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:117:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'd' */ { fixed_aligned(8) },   /* double */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:120:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'g' */ { unaligned        },   /* signature string */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:121:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'h' */ { fixed_aligned(4) },   /* file handle (int32) */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:122:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'i' */ { fixed_aligned(4) },   /* int32 */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:127:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'n' */ { fixed_aligned(2) },   /* int16 */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:128:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'o' */ { unaligned        },   /* object path string */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:130:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'q' */ { fixed_aligned(2) },   /* uint16 */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:132:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 's' */ { unaligned        },   /* string */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:133:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 't' */ { fixed_aligned(8) },   /* uint64 */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:134:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'u' */ { fixed_aligned(4) },   /* uint32 */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:135:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'v' */ { aligned(8)       },   /* variant */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:137:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'x' */ { fixed_aligned(8) },   /* int64 */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c:138:13: error: missing initializer for field ‘container_class’ of ‘GVariantTypeInfo’ {aka ‘const struct _GVariantTypeInfo’} [-Werror=missing-field-initializers]
   /* 'y' */ { fixed_aligned(1) },   /* byte */
             ^
glib/gvarianttypeinfo.c:69:10: note: ‘container_class’ declared here
   guchar container_class;
          ^~~~~~~~~~~~~~~
glib/gvarianttypeinfo.c: In function ‘tuple_info_free’:
glib/gvarianttypeinfo.c:368:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   for (i = 0; i < tuple_info->n_members; i++)
                 ^
glib/gvarianttypeinfo.c: In function ‘tuple_set_base_info’:
glib/gvarianttypeinfo.c:641:16: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’ [-Werror=sign-compare]
       if (m->i == -1 && m->type_info->fixed_size)
                ^~
2019-03-17 19:05:34 +01:00
Emmanuel Fleury
3f3a7472b3 Fixing signedness in glib/gvariant.c
glib/gvariant.c: In function ‘g_variant_new_strv’:
glib/gvariant.c:1563:17: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’} [-Werror=sign-compare]
   for (i = 0; i < length; i++)
                 ^
glib/gvariant.c: In function ‘g_variant_new_objv’:
glib/gvariant.c:1699:17: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’} [-Werror=sign-compare]
   for (i = 0; i < length; i++)
                 ^
glib/gvariant.c: In function ‘g_variant_new_bytestring_array’:
glib/gvariant.c:1939:17: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’} [-Werror=sign-compare]
   for (i = 0; i < length; i++)
                 ^
2019-03-17 19:05:34 +01:00
Emmanuel Fleury
9023483d36 Fixing signedness in glib/gvariant-core.c
glib/gvariant-core.c: In function ‘g_variant_ensure_size’:
glib/gvariant-core.c:339:19: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘long int’ [-Werror=sign-compare]
   if (value->size == (gssize) -1)
                   ^~
2019-03-17 19:05:34 +01:00
Emmanuel Fleury
b673ac48cc Fixing missing initializer in glib/giounix.c
^~~
glib/giounix.c:111:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} [-Werror=missing-field-initializers]
 };
 ^
In file included from glib/giochannel.h:33,
                 from glib/glib.h:54,
                 from glib/gprintf.h:21,
                 from glib/gstdio.h:22,
                 from glib/giounix.c:43:
glib/gmain.h:262:19: note: ‘closure_callback’ declared here
   GSourceFunc     closure_callback;
                   ^~~~~~~~~~~~~~~~
2019-03-17 19:05:34 +01:00
Emmanuel Fleury
5dd02cc6f5 Fixing signedness in glib/gthread-posix.c
In file included from glib/glibconfig.h:9,
                 from glib/gtypes.h:32,
                 from glib/gatomic.h:27,
                 from glib/gthread.h:32,
                 from glib/gthread-posix.c:42:
glib/gthread-posix.c: In function ‘g_system_thread_new’:
glib/gmacros.h:348:26: error: comparison of integer expressions of different signedness: ‘long int’ and ‘gulong’ {aka ‘long unsigned int’} [-Werror=sign-compare]
 #define MAX(a, b)  (((a) > (b)) ? (a) : (b))
                          ^
glib/gthread-posix.c:1169:22: note: in expansion of macro ‘MAX’
         stack_size = MAX (min_stack_size, stack_size);
                      ^~~
glib/gmacros.h:348:35: error: operand of ?: changes signedness from ‘long int’ to ‘gulong’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Werror=sign-compare]
 #define MAX(a, b)  (((a) > (b)) ? (a) : (b))
                                   ^~~
glib/gthread-posix.c:1169:22: note: in expansion of macro ‘MAX’
         stack_size = MAX (min_stack_size, stack_size);
                      ^~~
2019-03-17 19:05:34 +01:00
Emmanuel Fleury
c3d0440aa2 Fixing signedness in glib/gtester.c
glib/gtester.c: In function ‘main’:
glib/gtester.c:705:19: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
   for (ui = 1; ui < argc; ui++)
                   ^
2019-03-17 19:05:34 +01:00
Emmanuel Fleury
125a1e1f30 Fixing missing initializer in glib-unix.c
glib/glib-unix.c:314:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} [-Werror=missing-field-initializers]
 };
 ^
In file included from glib/giochannel.h:33,
                 from glib/glib.h:54,
                 from glib/glib-unix.h:33,
                 from glib/glib-unix.c:29:
glib/gmain.h:262:19: note: ‘closure_callback’ declared here
   GSourceFunc     closure_callback;
                   ^~~~~~~~~~~~~~~~
2019-03-17 19:05:34 +01:00
Emmanuel Fleury
165a922a95 Fixing various warnings in glib/gstring.c
In file included from glib/glibconfig.h:9,
                 from glib/gtypes.h:32,
                 from glib/gstring.h:32,
                 from glib/gstring.c:37:
glib/gstring.c: In function ‘g_string_insert_len’:
glib/gstring.c:441:31: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
     g_return_val_if_fail (pos <= string->len, string);
                               ^~
glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
glib/gstring.c:441:5: note: in expansion of macro ‘g_return_val_if_fail’
     g_return_val_if_fail (pos <= string->len, string);
     ^~~~~~~~~~~~~~~~~~~~
glib/gstring.c:458:15: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
       if (pos < string->len)
               ^
glib/gstring.c:462:18: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’} [-Werror=sign-compare]
       if (offset < pos)
                  ^
In file included from glib/glibconfig.h:9,
                 from glib/gtypes.h:32,
                 from glib/gstring.h:32,
                 from glib/gstring.c:37:
glib/gmacros.h:351:26: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘long unsigned int’ [-Werror=sign-compare]
 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                          ^
glib/gstring.c:464:22: note: in expansion of macro ‘MIN’
           precount = MIN (len, pos - offset);
                      ^~~
glib/gmacros.h:351:35: error: operand of ?: changes signedness from ‘gssize’ {aka ‘long int’} to ‘long unsigned int’ due to unsignedness of other operand [-Werror=sign-compare]
 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                                   ^~~
glib/gstring.c:464:22: note: in expansion of macro ‘MIN’
           precount = MIN (len, pos - offset);
                      ^~~
glib/gstring.c:469:15: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
       if (len > precount)
               ^
glib/gstring.c:481:15: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
       if (pos < string->len)
               ^
In file included from glib/glibconfig.h:9,
                 from glib/gtypes.h:32,
                 from glib/gstring.h:32,
                 from glib/gstring.c:37:
glib/gstring.c: In function ‘g_string_insert_c’:
glib/gstring.c:782:31: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
     g_return_val_if_fail (pos <= string->len, string);
                               ^~
glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
glib/gstring.c:782:5: note: in expansion of macro ‘g_return_val_if_fail’
     g_return_val_if_fail (pos <= string->len, string);
     ^~~~~~~~~~~~~~~~~~~~
glib/gstring.c:785:11: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   if (pos < string->len)
           ^
In file included from glib/glibconfig.h:9,
                 from glib/gtypes.h:32,
                 from glib/gstring.h:32,
                 from glib/gstring.c:37:
glib/gstring.c: In function ‘g_string_insert_unichar’:
glib/gstring.c:857:31: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
     g_return_val_if_fail (pos <= string->len, string);
                               ^~
glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
glib/gstring.c:857:5: note: in expansion of macro ‘g_return_val_if_fail’
     g_return_val_if_fail (pos <= string->len, string);
     ^~~~~~~~~~~~~~~~~~~~
glib/gstring.c:860:11: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   if (pos < string->len)
           ^
In file included from glib/glibconfig.h:9,
                 from glib/gtypes.h:32,
                 from glib/gstring.h:32,
                 from glib/gstring.c:37:
glib/gstring.c: In function ‘g_string_erase’:
glib/gstring.c:969:29: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   g_return_val_if_fail (pos <= string->len, string);
                             ^~
glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
glib/gstring.c:969:3: note: in expansion of macro ‘g_return_val_if_fail’
   g_return_val_if_fail (pos <= string->len, string);
   ^~~~~~~~~~~~~~~~~~~~
glib/gstring.c:975:39: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
       g_return_val_if_fail (pos + len <= string->len, string);
                                       ^~
glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
glib/gstring.c:975:7: note: in expansion of macro ‘g_return_val_if_fail’
       g_return_val_if_fail (pos + len <= string->len, string);
       ^~~~~~~~~~~~~~~~~~~~
glib/gstring.c:977:21: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
       if (pos + len < string->len)
                     ^
2019-03-17 19:05:34 +01:00
Emmanuel Fleury
9f44506d28 Fixing various warnings in glib/gtimezone.c
glib/gtimezone.c: In function ‘g_time_zone_unref’:
glib/gtimezone.c:241:29: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
           for (idx = 0; idx < tz->t_info->len; idx++)
                             ^
In file included from glib/glibconfig.h:9,
                 from glib/gtypes.h:32,
                 from glib/gtimezone.h:27,
                 from glib/gtimezone.c:24:
glib/gtimezone.c: In function ‘init_zone_from_iana_info’:
glib/gtimezone.c:578:34: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
       g_assert (trans.info_index < gtz->t_info->len);
                                  ^
glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
glib/gtimezone.c:578:7: note: in expansion of macro ‘g_assert’
       g_assert (trans.info_index < gtz->t_info->len);
       ^~~~~~~~
glib/gtimezone.c: In function ‘find_relative_date’:
glib/gtimezone.c:859:22: error: comparison of integer expressions of different signedness: ‘GDateWeekday’ {aka ‘enum <anonymous>’} and ‘gint’ {aka ‘int’} [-Werror=sign-compare]
       if (first_wday > wday)
                      ^
glib/gtimezone.c: In function ‘init_zone_from_rules’:
glib/gtimezone.c:938:19: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
   for (ri = 0; ri < rules_num - 1; ri++)
                   ^
glib/gtimezone.c:958:19: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
   for (ri = 0; ri < rules_num - 1; ri++)
                   ^
glib/gtimezone.c: In function ‘g_time_zone_adjust_time’:
glib/gtimezone.c:1792:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
   for (i = 0; i <= intervals; i++)
                 ^~
glib/gtimezone.c:1825:39: error: comparison of integer expressions of different signedness: ‘gboolean’ {aka ‘int’} and ‘GTimeType’ {aka ‘enum <anonymous>’} [-Werror=sign-compare]
       else if (interval_isdst (tz, i) != type)
                                       ^~
glib/gtimezone.c:1832:22: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
           else if (i < intervals &&
                      ^
glib/gtimezone.c: In function ‘g_time_zone_find_interval’:
glib/gtimezone.c:1881:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
   for (i = 0; i <= intervals; i++)
                 ^~
glib/gtimezone.c:1900:35: error: comparison of integer expressions of different signedness: ‘gboolean’ {aka ‘int’} and ‘GTimeType’ {aka ‘enum <anonymous>’} [-Werror=sign-compare]
   else if (interval_isdst (tz, i) != type)
                                   ^~
glib/gtimezone.c:1905:18: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
       else if (i < intervals && time_ >= interval_local_start (tz, i + 1))
                  ^
2019-03-17 19:05:34 +01:00
Emmanuel Fleury
99d32c2802 Fixing signedness in glib/gtestutils.c
glib/gtestutils.c: In function ‘g_test_build_filename_va’:
glib/gtestutils.c:3865:49: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ [-Werror=sign-compare]
   for (num_path_segments = 2; num_path_segments < G_N_ELEMENTS (pathv); num_path_segments++)
                                                 ^
2019-03-17 19:05:34 +01:00
Emmanuel Fleury
179dbbde14 Fixing signedness in glib/gthreadpool.c
glib/gthreadpool.c: In function ‘g_thread_pool_wait_for_new_pool’:
glib/gthreadpool.c:157:46: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
       if (g_atomic_int_get (&unused_threads) >= local_max_unused_threads)
                                              ^~
glib/gthreadpool.c: In function ‘g_thread_pool_wakeup_and_stop_all’:
glib/gthreadpool.c:836:17: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’} [-Werror=sign-compare]
   for (i = 0; i < pool->num_threads; i++)
                 ^
2019-03-17 19:05:24 +01:00
Руслан Ижбулатов
5df0337f52 GIO: Convert ENOTSOCK to G_IO_ERROR_INVALID_ARGUMENT
instead of using a generic G_IO_ERROR_FAILED error code.
This is in line with what W32 part of the code is doing with WSAENOTSOCK.

This fix will break two tests in libsoup, which were written following
the implementation and thus expect G_IO_ERROR_FAILED when attempting to
do stuff with no-longer-valid socket descriptors.
2019-03-16 15:58:16 +00:00
Emmanuele Bassi
e5ba5845a1 Revert "headers: Add various missing G_DISABLE_DEPRECATED guards"
This reverts commit 80fcb1bc26.

G_DISABLE_DEPRECATED should never be used by anybody, least of all by
GLib. We have deprecation annotations for the compiler, these days, and
they are much better suited than a macro that makes symbols appear and
disappear. The fact that gtk-doc doesn't understand the deprecation
annotations is a limitation of gtk-doc, and it's gtk-doc that ought to be
fixed.

Commit 80fcb1bc broke GStreamer, which disables old API that was
deprecated before the introduction of the deprecation annotations, but
still uses newly deprecated one, and relies on the deprecation
annotations to do their thing. It also broke libsoup, as it uses
GValueArray in its own API.
2019-03-16 11:30:13 +00:00
Emmanuel Fleury
592d4369d4 Fixing signedness problem in glib/gstrfuncs.c
glib/gstrfuncs.c: In function ‘g_strstr_len’:
glib/gstrfuncs.c:2709:24: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
       if (haystack_len < needle_len)
                        ^
2019-03-15 21:30:22 +01:00
Emmanuel Fleury
81a4698c45 Fixing various warnings in glib/gmain.c
glib/gmain.c:480:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} [-Werror=missing-field-initializers]
 };
 ^
In file included from glib/giochannel.h:33,
                 from glib/glib.h:54,
                 from glib/glib-unix.h:33,
                 from glib/gmain.c:50:
glib/gmain.h:262:19: note: ‘closure_callback’ declared here
   GSourceFunc     closure_callback;
                   ^~~~~~~~~~~~~~~~
glib/gmain.c:491:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} [-Werror=missing-field-initializers]
 };
 ^
In file included from glib/giochannel.h:33,
                 from glib/glib.h:54,
                 from glib/glib-unix.h:33,
                 from glib/gmain.c:50:
glib/gmain.h:262:19: note: ‘closure_callback’ declared here
   GSourceFunc     closure_callback;
                   ^~~~~~~~~~~~~~~~
glib/gmain.c:499:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} [-Werror=missing-field-initializers]
 };
 ^
In file included from glib/giochannel.h:33,
                 from glib/glib.h:54,
                 from glib/glib-unix.h:33,
                 from glib/gmain.c:50:
glib/gmain.h:262:19: note: ‘closure_callback’ declared here
   GSourceFunc     closure_callback;
                   ^~~~~~~~~~~~~~~~
glib/gmain.c:507:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} [-Werror=missing-field-initializers]
 };
 ^
In file included from glib/giochannel.h:33,
                 from glib/glib.h:54,
                 from glib/glib-unix.h:33,
                 from glib/gmain.c:50:
glib/gmain.h:262:19: note: ‘closure_callback’ declared here
   GSourceFunc     closure_callback;
                   ^~~~~~~~~~~~~~~~
glib/gmain.c: In function ‘g_source_set_callback_indirect’:
glib/gmain.c:1615:68: error: suggest braces around empty body in an ‘if’ statement [-Werror=empty-body]
                                               callback_funcs->get));
                                                                    ^
2019-03-15 21:30:22 +01:00
Emmanuel Fleury
9eb4fcdede Fixing missing initializer for field in gscanner.c
glib/gscanner.c:344:1: error: missing initializer for field ‘padding_dummy’ of ‘GScannerConfig’ {aka ‘const struct _GScannerConfig’} [-Werror=missing-field-initializers]
 };
 ^
In file included from glib/gscanner.c:40:
glib/gscanner.h:166:10: note: ‘padding_dummy’ declared here
   guint  padding_dummy;
          ^~~~~~~~~~~~~
2019-03-15 21:30:22 +01:00
Emmanuel Fleury
aef59ca7c8 Fixing signedness in glib/goptions.c
glib/goption.c: In function ‘context_has_h_entry’:
glib/goption.c:785:21: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’} [-Werror=sign-compare]
       for (i = 0; i < context->main_group->n_entries; i++)
                     ^
glib/goption.c:797:21: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’} [-Werror=sign-compare]
       for (i = 0; i < group->n_entries; i++)
                     ^
2019-03-15 21:30:22 +01:00
Emmanuel Fleury
4eed83a0ff Fixing signedness in glib/gmarkup.c
In file included from glib/glibconfig.h:9,
                 from ../glib.git/glib/gtypes.h:32,
                 from ../glib.git/glib/gquark.h:32,
                 from ../glib.git/glib/gerror.h:28,
                 from ../glib.git/glib/gmarkup.h:28,
                 from ../glib.git/glib/gmarkup.c:28:
../glib.git/glib/gmarkup.c: In function ‘unescape_gstring_inplace’:
../glib.git/glib/gmarkup.c:789:30: error: comparison of integer expressions of different signedness: ‘long int’ and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   g_assert (to - string->str <= string->len);
                              ^~
../glib.git/glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
../glib.git/glib/gmarkup.c:789:3: note: in expansion of macro ‘g_assert’
   g_assert (to - string->str <= string->len);
   ^~~~~~~~
../glib.git/glib/gmarkup.c:790:24: error: comparison of integer expressions of different signedness: ‘long int’ and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   if (to - string->str != string->len)
                        ^~
../glib.git/glib/gmarkup.c: In function ‘g_markup_parse_boolean’:
../glib.git/glib/gmarkup.c:2634:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
   for (i = 0; i < G_N_ELEMENTS (falses); i++)
                 ^
../glib.git/glib/gmarkup.c:2645:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
   for (i = 0; i < G_N_ELEMENTS (trues); i++)
                 ^
2019-03-15 21:30:22 +01:00
Emmanuel Fleury
f58702ebbf Fixing signedness in glib/gquark.c
glib/gquark.c: In function ‘g_quark_to_string’:
glib/gquark.c:268:13: error: comparison of integer expressions of different signedness: ‘GQuark’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’} [-Werror=sign-compare]
   if (quark < seq_id)
             ^
2019-03-15 21:30:22 +01:00
Emmanuel Fleury
d7ddf66938 Fixing signedness in glib/gprimes.c
glib/gprimes.c: In function ‘g_spaced_primes_closest’:
glib/gprimes.c:91:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ [-Werror=sign-compare]
   for (i = 0; i < G_N_ELEMENTS (g_primes); i++)
                 ^
2019-03-15 21:30:22 +01:00
Emmanuel Fleury
8eae303da0 Fix signedness in glib/gmappedfile.c
glib/gmappedfile.c: In function ‘mapped_file_new_from_fd’:
glib/gmappedfile.c:153:18: error: comparison of integer expressions of different signedness: ‘__off_t’ {aka ‘long int’} and ‘long unsigned int’ [-Werror=sign-compare]
   if (st.st_size > G_MAXSIZE)
                  ^
2019-03-15 21:30:22 +01:00
Emmanuel Fleury
2f9e6e977a Fixing signedness in glib/giochannel.c
In file included from glib/glibconfig.h:9,
                 from glib/gtypes.h:32,
                 from glib/gquark.h:32,
                 from glib/gerror.h:28,
                 from glib/gconvert.h:32,
                 from glib/giochannel.h:32,
                 from glib/giochannel.c:37:
glib/giochannel.c: In function ‘g_io_channel_write_chars’:
glib/gmacros.h:351:26: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’} [-Werror=sign-compare]
 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                          ^
glib/giochannel.c:2285:31: note: in expansion of macro ‘MIN’
           gssize write_this = MIN (space_in_buf, count - wrote_bytes);
                               ^~~
glib/gmacros.h:351:41: error: operand of ?: changes signedness from ‘gssize’ {aka ‘long int’} to ‘gsize’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Werror=sign-compare]
 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                                         ^~~
glib/giochannel.c:2285:31: note: in expansion of macro ‘MIN’
           gssize write_this = MIN (space_in_buf, count - wrote_bytes);
                               ^~~
glib/giochannel.c:2415:41: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
                         g_assert (count == from_buf_len - from_buf_old_len);
                                         ^~
glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
glib/giochannel.c:2415:25: note: in expansion of macro ‘g_assert’
                         g_assert (count == from_buf_len - from_buf_old_len);
                         ^~~~~~~~
2019-03-15 21:30:03 +01:00
Emmanuel Fleury
0fea1a4775 Silenting unused parameter warnings due to deprecated code 2019-03-15 20:53:46 +01:00
Philip Withnall
631beb0404 tests: Improve test coverage of D-Bus tcp transport addresses
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 14:36:57 +00:00
Philip Withnall
f9fb7e8765 tests: Add test for unsupported unparseable D-Bus addresses
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 14:36:57 +00:00
Philip Withnall
3cd30c59e9 tests: Compile the test_unix_address() test unconditionally
Just skip the test if the unix transport isn’t supported. This means we
get better compilation coverage, and more explicit TAP output saying
that the test is being skipped on unsupported platforms.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 14:36:57 +00:00
Philip Withnall
264617cfb5 tests: Improve test coverage of D-Bus nonce-tcp transport addresses
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 14:36:57 +00:00
Philip Withnall
88d03facb9 tests: Improve test coverage of D-Bus unix transport addresses
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 14:36:56 +00:00
Philip Withnall
e0561cfdc5 tests: Split out D-Bus address parsing tests
Rather than having them in the unix-transport specific tests.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 14:36:56 +00:00
Philip Withnall
685d605832 tests: Always check an address is valid before checking it’s supported
This gets us extra test coverage for free.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 14:22:15 +00:00
Philip Withnall
e458b0168e gdbusaddress: Clean up memory management in _g_dbus_address_parse_entry()
This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 14:20:54 +00:00
Philip Withnall
131ba66160 gdbusaddress: Require that transport names and keys are non-empty
The specification doesn’t explicitly say this, but it doesn’t say
otherwise, and it would be pretty weird to have an empty transport name
or key.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 14:20:16 +00:00
Philip Withnall
8966b0f8b1 gdbusaddress: Remove some always-true branches
g_strsplit() can never return NULL.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 14:19:55 +00:00
Philip Withnall
7f9e76d2bc gdbusaddress: Simplify address validation in is_valid_unix()
No need for the `meaningless` label and some unreachable if-branches.
This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 14:18:55 +00:00
Philip Withnall
132c6ba0cf tests: Use g_assert_*() instead of g_assert() in gdbus-addresses test
g_assert_*() give better failure messages, and don’t get compiled out
with G_DISABLE_ASSERT.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 13:46:29 +00:00
Philip Withnall
fd42994015 Merge branch 'issue-249' into 'master'
tests: Check that cancelling g_file_replace don't overwrite existing file

See merge request GNOME/glib!493
2019-03-15 13:26:45 +00:00
Tomasz Miąsko
2f290b3a5f tests: Check that cancelling g_file_replace don't overwrite existing file 2019-03-15 14:03:50 +01:00
Philip Withnall
c561870359 Merge branch 'pattern-coalesce' into 'master'
gvariant-parser: Fix pattern coalesce of M and *

See merge request GNOME/glib!694
2019-03-15 12:31:03 +00:00
Sebastian Dröge
c29bc822c2 Merge branch 'socket-client-connect-gerror-leak' into 'master'
GSocketClient - Free last error if a connection attempt fails and on retry the...

See merge request GNOME/glib!718
2019-03-15 11:46:57 +00:00
Sebastian Dröge
c3cfbd26da Merge branch 'docs-fixes' into 'master'
Various minor documentation fixes

See merge request GNOME/glib!716
2019-03-15 11:46:22 +00:00
Philip Withnall
ba09fa8500 gvaluearray: Mark the whole of GValueArray as deprecated
This is not new; all of its methods have been deprecated for a long
time. Make the deprecation more obvious, however, by marking the whole
section as deprecated.

Note that GArray can’t *quite* do everything that GValueArray could.
See #1069 for work to fix this. This documentation block can be updated
again once that’s fixed.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 11:09:36 +00:00
Philip Withnall
76b32508d2 gdatetime: Unmark an unrelated comment as a documentation comment
This was confusing gtk-doc.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 11:09:32 +00:00
Philip Withnall
e440249bd3 docs: Move some documentation comments from docs.c to their symbols
It would be nice if docs.c eventually went away — it’s more maintainable
for documentation comments to be next to the definition of the symbols
they document.

Move a few from docs.c, based on what I’ve been modifying recently.

The documentation comments are unchanged apart from fixing an argument
name for G_ALIGNOF.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-03-15 11:09:32 +00:00