Commit Graph

22737 Commits

Author SHA1 Message Date
Philip Withnall
0d3473d3bb Merge remote-tracking branch 'gvdb/master' into update-gvdb
This is the result of `git merge gvdb/master`.
2021-01-04 11:38:54 +00:00
Philip Withnall
3d50fe28e8 Merge remote-tracking branch 'fmartinsons/1735-fix-warnings' 2021-01-04 11:32:16 +00:00
Frederic Martinsons
1b6fa560b0 Fix warnings
Related: glib#1735

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-04 10:30:56 +01:00
Sebastian Dröge
9a7ca661a3 Merge branch 'wip/baedert/gparam' into 'master'
More small GKeyFile performance improvements

See merge request GNOME/glib!1832
2021-01-04 08:46:41 +00:00
Jordi Mas
79db5272e0 Update Catalan translation 2021-01-03 22:42:31 +01:00
Timm Bäder
fe441c8ca5 giomodule: Don't allocate GHashTable for no entries
This seems to happen in 3 out of 4 cases when calling gtk_init(), so
avoid allocating the GHashTable in that case.
2020-12-31 14:58:40 +01:00
Timm Bäder
105e44beb5 gresource: Avoid work for NULL errors
Don't go through gettext if the GError** passed is NULL anyway.
2020-12-31 14:58:40 +01:00
Timm Bäder
89f12e10b6 keyfile: Only allocate group_hash if needed
A keyfile with no groups (e.g. an empty one) does not need a hash table
for the groups.
2020-12-31 14:58:37 +01:00
Timm Bäder
3ee05ef3bd keyfile: Don't allocate parse_buffer if we don't need it
When loading a GKeyFile, the sequence is usually:

keyfile = g_key_file_new();
g_key_file_load_xxx(keyfile, ...)

g_key_file_new() calls g_key_file_init(), which allocates a parse_buffer
for parsing. g_key_file_load_xxx() will then g_key_file_clear() the
keyfile and call g_key_file_init() again.

Just don't allocate a parse_buffer unless we need it for parsing.
2020-12-31 14:58:37 +01:00
Timm Bäder
03ca87586f fileutils: Avoid calling set_file_error with NULL GError**
If no pointer to a GError* has been passed to public API, there's not
need to look at translations via gettext or format an error message that
g_set_error_literal will entirely ignore in the end.
2020-12-31 14:58:37 +01:00
Timm Bäder
423bfa87d5 gparam: Remove pspec_list_remove_overridden_and_redirected()
Instead of collecting more pspecs than we need, just don't add them to
the list(s) in the first place.
2020-12-31 14:58:34 +01:00
Sebastian Dröge
2bd8626885 Merge branch 'wip/baedert/keyfile' into 'master'
keyfile: Delay calling g_get_language_names() until it's needed

See merge request GNOME/glib!1829
2020-12-30 11:51:21 +00:00
Timm Bäder
037f1ce672 keyfile: Delay calling g_get_language_names() until it's needed
The g_get_languages() call is quite costly and often unneeded.
2020-12-30 12:39:14 +01:00
Philipp Kiemle
efcbf1f137 Update German translation 2020-12-27 18:19:03 +00:00
Sebastian Dröge
7ad7f55888 Merge branch 'master' into 'master'
Windows: fix FD_READ condition flag still set on recoverable UDP socket errors.

See merge request GNOME/glib!1827
2020-12-24 09:08:40 +00:00
Marco Mastropaolo
43b13d7a1a Windows: fix FD_READ condition flag still set on recoverable UDP socket errors.
Contrary to what the WSARecvFrom seem to imply, a UDP socket is perfectly recoverable and usable after a WSAECONNRESET error (and, I assume, WSAENETRESET).
However GSocket condition has the FD_READ bit set after a UDP socket fails with WSAECONNRESET, even if no data is available on the socket anymore; this causes select calls to report the socket as readable when, in fact, it's not.

The change resets FD_READ flag on a socket upon the above error conditions; there's no 'if' to filter between datagram and stream sockets as the change should be harmless in the case of stream sockets which are, however, very unlikely to be usable after a WSAECONNRESET.
2020-12-24 09:08:40 +00:00
Jordi Mas i Hernandez
d48e22e464 Update Catalan translation 2020-12-22 12:54:44 +00:00
Sebastian Dröge
8f590df123 Merge branch 'ossfuzz-28718-date-normalization' into 'master'
gdate: Limit length of dates which can be parsed as valid

See merge request GNOME/glib!1821
2020-12-21 17:48:45 +00:00
Philip Withnall
581ae46efe Merge branch 'gsignal-allow-run-first-only-with-return-type' into 'master'
gsignal: Allow return types for RUN_FIRST-only signals too

Closes #513

See merge request GNOME/glib!1144
2020-12-21 17:40:28 +00:00
Sebastian Dröge
3581eda9a2 gsignal: Allow return types for RUN_FIRST-only signals too
Also adds a test that checks that the G_SIGNAL_RUN flags are handled
correctly and the class signal handler is called at the right times.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/513
2020-12-21 17:22:51 +00:00
Philip Withnall
17d1e876b9 Merge branch 'gsignal-accumulator-first-run' into 'master'
gsignal: Add a new GSignalFlag to mark the first run of an accumulator function

Closes #514

See merge request GNOME/glib!1143
2020-12-21 17:21:03 +00:00
Sebastian Dröge
9d1455444c gsignal: Add a new GSignalFlag to mark the first run of an accumulator function
Also add a test for signal accumulators. There was none before, and this
one now also covers the new flag.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/514
2020-12-21 17:10:19 +00:00
Philip Withnall
fec38762b3 gdate: Use string length when validating UTF-8
Makes the validation a tiny bit faster.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-21 16:50:53 +00:00
Philip Withnall
2008cb58a4 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!1822
2020-12-18 21:59:56 +00:00
Philip Withnall
15634d64bf gdate: Limit length of dates which can be parsed as valid
Realistically any date over 200 bytes long is not going to be valid, so
limit the input length so we can’t spend too long doing UTF-8 validation
or normalisation.

oss-fuzz#28718

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-18 11:38:31 +00:00
Emmanuel Fleury
e90a79139f Fix signedness warnings in gio/gcredentials.c:g_credentials_to_string()
gio/gcredentials.c: In function ‘g_credentials_to_string’:
gio/gcredentials.c:238:31: error: comparison of integer expressions of different signedness: ‘uid_t’ {aka ‘unsigned int’} and ‘int’
  238 |   if (credentials->native.uid != -1)
      |                               ^~
gio/gcredentials.c:240:31: error: comparison of integer expressions of different signedness: ‘gid_t’ {aka ‘unsigned int’} and ‘int’
  240 |   if (credentials->native.gid != -1)
      |                               ^~
2020-12-18 12:26:38 +01:00
Emmanuel Fleury
477d53b2b0 Fix signedness warning in gio/gbufferedoutputstream.c:g_buffered_output_stream_set_buffer_size()
gio/gbufferedoutputstream.c: In function ‘g_buffered_output_stream_set_buffer_size’:
glib/gmacros.h:806:26: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘goffset’ {aka ‘long int’}
  806 | #define MAX(a, b)  (((a) > (b)) ? (a) : (b))
      |                          ^
gio/gbufferedoutputstream.c:211:14: note: in expansion of macro ‘MAX’
  211 |       size = MAX (size, priv->pos);
      |              ^~~

Fix signedness warning in gio/gbufferedinputstream.c:g_buffered_input_stream_real_fill()

gio/gbufferedinputstream.c: In function ‘g_buffered_input_stream_real_fill’:
glib/gmacros.h:809:26: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}K [-Werror=sign-compare]
  809 | #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
      |                          ^
gio/gbufferedinputstream.c:664:11: note: in expansion of macro ‘MIN’
  664 |   count = MIN (count, priv->len - in_buffer);
      |           ^~~
gio/gbufferedinputstream.c:667:29: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’}
  667 |   if (priv->len - priv->end < count)
      |                             ^

Fix signedness warnings in gio/gbufferedinputstream.c:g_buffered_input_stream_real_fill_async()

gio/gbufferedinputstream.c: In function ‘g_buffered_input_stream_real_fill_async’:
glib/gmacros.h:809:26: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  809 | #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
      |                          ^
gio/gbufferedinputstream.c:1075:11: note: in expansion of macro ‘MIN’
 1075 |   count = MIN (count, priv->len - in_buffer);
      |           ^~~
gio/gbufferedinputstream.c:1078:29: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’}
 1078 |   if (priv->len - priv->end < count)
      |                             ^
2020-12-18 12:26:26 +01:00
Emmanuel Fleury
50c85523a2 Fix signedness warning in gio/gfileattribute.c:escape_byte_string()
gio/gfileattribute.c: In function ‘escape_byte_string’:
gio/gfileattribute.c:286:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’}
  286 |   for (i = 0; i < len; i++)
      |                 ^
gio/gfileattribute.c:299:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’}
  299 |       for (i = 0; i < len; i++)
      |                     ^
2020-12-18 12:26:26 +01:00
Emmanuel Fleury
c150e46bf0 Fix signedness warning in gio/gicon.c:g_icon_to_string_tokenized()
gio/gicon.c: In function ‘g_icon_to_string_tokenized’:
gio/gicon.c:165:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  165 |   for (i = 0; i < tokens->len; i++)
      |                 ^
2020-12-18 12:26:26 +01:00
Emmanuel Fleury
dd995ca54b Fix signedness warning in gio/gfileinfo.c:g_file_info_remove_attribute()
gio/gfileinfo.c: In function ‘g_file_info_remove_attribute’:
gio/gfileinfo.c:706:9: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  706 |   if (i < info->attributes->len &&
      |         ^

Fix signedness warning in gio/gfileinfo.c:g_file_info_create_value()

gio/gfileinfo.c: In function ‘g_file_info_create_value’:
gio/gfileinfo.c:1084:9: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
 1084 |   if (i < info->attributes->len &&
      |         ^

Fix signedness warning in gio/gfileinfo.c:matcher_matches_id()

gio/gfileinfo.c: In function ‘matcher_matches_id’:
gio/gfileinfo.c:2624:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
 2624 |       for (i = 0; i < matcher->sub_matchers->len; i++)
      |                     ^

Fix signedness warnings in gio/gfileinfo.c:g_file_attribute_matcher_enumerate_namespace()

gio/gfileinfo.c: In function ‘g_file_attribute_matcher_enumerate_namespace’:
gio/gfileinfo.c:2713:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
 2713 |       for (i = 0; i < matcher->sub_matchers->len; i++)
      |                     ^
gio/gfileinfo.c:2715:27: error: comparison of integer expressions of different signedness: ‘guint32’ {aka ‘unsigned int’} and ‘int’
 2715 |    if (sub_matchers[i].id == ns_id)
      |                           ^~

Fix signedness warning in gio/gfileinfo.c:g_file_attribute_matcher_enumerate_next()

gio/gfileinfo.c: In function ‘g_file_attribute_matcher_enumerate_next’:
../glib.git/gio/gfileinfo.c:2752:13: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
 2752 |       if (i < matcher->sub_matchers->len)
      |             ^
2020-12-18 12:25:54 +01:00
Sebastian Dröge
c9ac901a4e Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!1819
2020-12-17 18:47:25 +00:00
Emmanuel Fleury
dd63c0bf32 Fix signedness warning in gio/gfileinfo.c:g_file_info_list_attributes()
gio/gfileinfo.c: In function ‘g_file_info_list_attributes’:
gio/gfileinfo.c:645:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  645 |   for (i = 0; i < info->attributes->len; i++)
      |                 ^
2020-12-17 14:46:17 +01:00
Emmanuel Fleury
aface2b6b2 Fix signedness warning in gio/gfileinfo.c:g_file_info_has_namespace()
gio/gfileinfo.c: In function ‘g_file_info_has_namespace’:
gio/gfileinfo.c:610:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  610 |   for (i = 0; i < info->attributes->len; i++)
      |                 ^
2020-12-17 14:46:17 +01:00
Emmanuel Fleury
a3dd0df5d8 Fix signedness warning in gio/gfileinfo.c:g_file_info_find_value()
gio/gfileinfo.c: In function ‘g_file_info_find_value’:
gio/gfileinfo.c:543:9: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  543 |   if (i < info->attributes->len &&
      |         ^
2020-12-17 14:46:17 +01:00
Emmanuel Fleury
ece9a52d0b Fix signedness warning in gio/gfileinfo.c:g_file_info_clear_status()
gio/gfileinfo.c: In function ‘g_file_info_clear_status’:
gio/gfileinfo.c:499:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  499 |   for (i = 0; i < info->attributes->len; i++)
      |                 ^
2020-12-17 14:46:17 +01:00
Emmanuel Fleury
48d783d1d9 Fix signedness warning in gio/gfileinfo.c:g_file_info_set_attribute_mask()
gio/gfileinfo.c: In function ‘g_file_info_set_attribute_mask’:
gio/gfileinfo.c:453:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  453 |       for (i = 0; i < info->attributes->len; i++)
      |                     ^
2020-12-17 14:46:17 +01:00
Emmanuel Fleury
b82146c4b6 Fix signedness warning in gio/gfileinfo.c:g_file_info_copy_into()
gio/gfileinfo.c: In function ‘g_file_info_copy_into’:
gio/gfileinfo.c:385:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  385 |   for (i = 0; i < dest_info->attributes->len; i++)
      |                 ^
2020-12-17 14:46:16 +01:00
Sebastian Dröge
bb3f366101 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!1818
2020-12-17 13:25:26 +00:00
Emmanuel Fleury
872763dbf0 Fix signedness warning in gio/gfileinfo.c:g_file_info_finalize()
gio/gfileinfo.c: In function ‘g_file_info_finalize’:
gio/gfileinfo.c:327:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  327 |   for (i = 0; i < info->attributes->len; i++)
      |                 ^
2020-12-17 14:07:19 +01:00
Emmanuel Fleury
f606e3350e Fix signedness warning in gio/gdatainputstream.c:scan_for_chars()
gio/gdatainputstream.c: In function ‘scan_for_chars’:
gio/gdatainputstream.c:879:40: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’}
  879 |   for (i = 0; checked < available && i < peeked; i++)
      |                                        ^
2020-12-17 14:07:19 +01:00
Emmanuel Fleury
f2b8921df8 Fix signedness warning in gio/gdatainputstream.c:scan_for_newline()
gio/gdatainputstream.c: In function ‘scan_for_newline’:
gio/gdatainputstream.c:654:40: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’}
  654 |   for (i = 0; checked < available && i < peeked; i++)
      |                                        ^
2020-12-17 14:07:19 +01:00
Emmanuel Fleury
fc8062d906 Fix signedness warning in gio/gliststore.c:
gio/gliststore.c: In function ‘g_list_store_insert’:
gio/gliststore.c:272:30: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
  272 |   g_return_if_fail (position <= g_sequence_get_length (store->items));
      |                              ^~
2020-12-17 14:07:19 +01:00
Emmanuel Fleury
3c461d2396 Fix signedness warning in gio/gliststore.c:g_list_store_splice()
gio/gliststore.c: In function ‘g_list_store_splice’:
gio/gliststore.c:482:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  482 |       for (i = 0; i < n_additions; i++)
      |                     ^
2020-12-17 14:07:19 +01:00
Sebastian Dröge
114b1ecd98 Merge branch 'fuzzing-key-file-flags' into 'master'
fuzzing: Add more parsing flags to the GKeyFile test

See merge request GNOME/glib!1817
2020-12-17 12:55:20 +00:00
Philip Withnall
0c83f05be8 fuzzing: Add more parsing flags to the GKeyFile test
To increase the coverage.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-17 12:42:54 +00:00
Sebastian Dröge
b108072d9e Merge branch 'fuzzing-uri-flags' into 'master'
fuzzing: Add more GUriFlags to the URI parsing test

See merge request GNOME/glib!1816
2020-12-17 12:13:56 +00:00
Philip Withnall
486a2cadbb fuzzing: Add more GUriFlags to the URI parsing test
Widen the amount of test coverage.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-17 12:03:18 +00:00
Sebastian Dröge
6723633fd7 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!1815
2020-12-17 08:53:08 +00:00
Emmanuel Fleury
9025969df6 Fix missing initializer warning in gio/gcancellable.c
gio/gcancellable.c:773:1: error: missing initializer for field ‘closure_marshal’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
  773 | };
      | ^
In file included from glib/giochannel.h:33,
                 from glib/glib.h:54,
                 from gio/gcancellable.c:22:
glib/gmain.h:277:23: note: ‘closure_marshal’ declared here
  277 |   GSourceDummyMarshal closure_marshal; /* Really is of type GClosureMarshal */
      |                       ^~~~~~~~~~~~~~~
2020-12-16 23:59:25 +01:00
Emmanuel Fleury
058dda1b63 Fix missing initializer warning in gio/gcontextspecificgroup.c:g_context_specific_source_new()
gio/gcontextspecificgroup.c: In function ‘g_context_specific_source_new’:
gio/gcontextspecificgroup.c:77:3: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
   77 |   };
      |   ^
In file included from glib/giochannel.h:33,
                 from glib/glib.h:54,
                 from gobject/gbinding.h:28,
                 from glib/glib-object.h:22,
                 from gio/gcontextspecificgroup.h:23,
                 from gio/gcontextspecificgroup.c:22:
glib/gmain.h:276:19: note: ‘closure_callback’ declared here
  276 |   GSourceFunc     closure_callback;
      |                   ^~~~~~~~~~~~~~~~
2020-12-16 23:59:25 +01:00