Commit Graph

23565 Commits

Author SHA1 Message Date
Emmanuel Fleury
277d206d38 Fix multiple missing initializer warnings in tests/gobject/testcommon.h
tests/gobject/testmodule.c: In function ‘test_module_get_type’:
tests/gobject/testmodule.c:34:1: error: missing initializer for field ‘value_table’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
   34 | DEFINE_TYPE (TestModule, test_module,
      | ^~~~~~~~~~~

tests/gobject/defaultiface.c: In function ‘test_static_iface_get_type’:
tests/gobject/defaultiface.c:58:1: error: missing initializer for field ‘class_finalize’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
   58 | DEFINE_IFACE (TestStaticIface, test_static_iface,
      | ^~~~~~~~~~~~
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
76af9efbff Fix several missing initializer in tests/gobject/testgobject.c
tests/gobject/testgobject.c: In function ‘test_iface_get_type’:
tests/gobject/testgobject.c:53:7: error: missing initializer for field ‘class_init’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
   53 |       };
      |       ^
tests/gobject/testgobject.c: In function ‘test_object_get_type’:
tests/gobject/testgobject.c:182:7: error: missing initializer for field ‘value_table’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
  182 |       };
      |       ^
tests/gobject/testgobject.c: In function ‘derived_object_get_type’:
tests/gobject/testgobject.c:349:7: error: missing initializer for field ‘value_table’ of ‘GTypeInfo’ {aka ‘const struct _GTypeInfo’}
  349 |       };
      |       ^
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
180c1a18d9 Fix several missing initializer warnings in gio/tests/basic-application.c
gio/tests/basic-application.c: In function ‘startup’:
gio/tests/basic-application.c:57:5: error: missing initializer for field ‘padding’ of ‘GActionEntry’ {aka ‘struct _GActionEntry’}
   57 |     { "new", new_activated, NULL, NULL, NULL },
      |     ^
gio/tests/basic-application.c:58:5: error: missing initializer for field ‘padding’ of ‘GActionEntry’ {aka ‘struct _GActionEntry’}
   58 |     { "quit", quit_activated, NULL, NULL, NULL },
      |     ^
gio/tests/basic-application.c:59:5: error: missing initializer for field ‘padding’ of ‘GActionEntry’ {aka ‘struct _GActionEntry’}
   59 |     { "action1", action1_activated, NULL, NULL, NULL },
      |     ^
gio/tests/basic-application.c:60:5: error: missing initializer for field ‘padding’ of ‘GActionEntry’ {aka ‘struct _GActionEntry’}
   60 |     { "action2", action2_activated, "b", "false", change_action2 }
      |     ^
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
4a503bdbd7 Fix several missing initializer warnings in gio/tests/dbus-appinfo.c
gio/tests/dbus-appinfo.c:177:3: error: missing initializer for field ‘parameter_type’ of ‘GActionEntry’ {aka ‘const struct _GActionEntry’}
  177 |   { "frob",         test_application_frob              },
      |   ^
gio/tests/dbus-appinfo.c:178:3: error: missing initializer for field ‘parameter_type’ of ‘GActionEntry’ {aka ‘const struct _GActionEntry’}
  178 |   { "tweak",        test_application_tweak             },
      |   ^
gio/tests/dbus-appinfo.c:179:3: error: missing initializer for field ‘parameter_type’ of ‘GActionEntry’ {aka ‘const struct _GActionEntry’}
  179 |   { "twiddle",      test_application_twiddle           },
      |   ^
gio/tests/dbus-appinfo.c:180:3: error: missing initializer for field ‘parameter_type’ of ‘GActionEntry’ {aka ‘const struct _GActionEntry’}
  180 |   { "quit",         test_application_quit              }
      |   ^
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
4ad62f7fab Fix signedness warning in gio/tests/readwrite.c
gio/tests/readwrite.c: In function ‘verify_iostream’:
gio/tests/readwrite.c:77:17: error: comparison of integer expressions of different signedness: ‘gboolean’ {aka ‘int’} and ‘size_t’ {aka ‘long unsigned int’}
   77 |   g_assert (res == strlen (original_data) - 15);
      |                 ^~
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
a965262004 Fix several signedness warnings in gio/tests/unix-streams.c
gio/tests/unix-streams.c: In function ‘test_write_async_wouldblock’:
gio/tests/unix-streams.c:692:17: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
  692 |   for (i = 0; i < 4 * pipe_capacity; i++)
      |                 ^
gio/tests/unix-streams.c: In function ‘test_writev_async_wouldblock’:
gio/tests/unix-streams.c:780:17: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
  780 |   for (i = 0; i < 4 * pipe_capacity; i++)
      |                 ^
2021-04-29 12:39:51 +02:00
John McCambridge
e010624309 Update signal accumulator docs.
Reflect that a FALSE returned from the accumulator will still emit signals in the RUN_CLEANUP state.
Fixes #2352
2021-04-29 09:41:44 +01:00
Sebastian Dröge
28b18cab06 Merge branch 'fix-documentation-of-limit-in-gstringreplace' into 'master'
gstring: Cleanup documentation of g_string_replace

See merge request GNOME/glib!2071
2021-04-29 08:02:36 +00:00
Peter Bloomfield
ab62e655b3 gstring: Cleanup documentation of g_string_replace
Clean up the documentation of `g_string_replace()`'s `limit` parameter.
2021-04-27 18:55:17 -04:00
Philip Withnall
4669f91e0b Merge branch 'application-unregistered-notify' into 'master'
application: Unset the registered state after shutting down

See merge request GNOME/glib!2056
2021-04-27 15:36:03 +00:00
Marco Trevisan (Treviño)
63873c0eb1 application: Unset the registered state after shutting down
An application that has been shut down is still marked as registered
even if its implementation has been already destroyed.

This may lead to unguarded crashes when calling functions that have
assumptions for being used with registered applications.

So, when an application is registered, mark it as unregistered just
before destroying its implementation and after being shut down, so that
we follow the registration process in reversed order.

Added tests
2021-04-27 17:11:10 +02:00
Philip Withnall
78ba6c8b07 Merge branch 'gpattern-introspectable' into 'master'
gpattern: Register as Boxed type and support introspection for it

See merge request GNOME/glib!2066
2021-04-27 14:43:30 +00:00
Marco Trevisan (Treviño)
11f31d8220 tests/pattern: Add compilation and copy test for utf-8 string
While we already tested this for matching we did not when copying, so
adding an expclit test for the utf8 case.
2021-04-27 16:25:09 +02:00
Marco Trevisan (Treviño)
37323239a0 gpattern: Adjust includes to match style rules 2021-04-27 16:25:09 +02:00
Marco Trevisan (Treviño)
fbb198f968 gpattern: Move match and match_string functions into GPatternSpec
This allows introspection to properly handle them as GPatternSpec
methods, as per this deprecate g_pattern_match() and
g_pattern_match_string() functions.
2021-04-27 16:25:09 +02:00
Marco Trevisan (Treviño)
b8a9f4b436 boxed: Register GPatternSpec as boxed type 2021-04-27 16:25:09 +02:00
Marco Trevisan (Treviño)
474ece6d61 gpattern: Implement copy function
Add copy ability for pattern spec, so that it can be used as a boxed
type.
2021-04-27 16:25:09 +02:00
Philip Withnall
ad07a8e9ca Merge branch 'gdbus-tool-use-basename-fix' into 'master'
gdbus-tool: Actually use argv[0] basename as program name

See merge request GNOME/glib!2069
2021-04-27 13:59:59 +00:00
Marco Trevisan (Treviño)
1000acade7 gdbus-tool: Actually use argv[0] basename as program name
We initialize it but never actually use.
2021-04-27 15:41:57 +02:00
Sebastian Dröge
232d008ec8 Merge branch 'nacho/gmacros-master2' into 'master'
gmacros: missing check if __STDC_VERSION__ is defined

See merge request GNOME/glib!2067
2021-04-27 11:36:57 +00:00
Ignacio Casal Quinteiro
03e614e6d5 gmacros: missing check if __STDC_VERSION__ is defined
This fixes warnings when compiling on old distros like centos 7
2021-04-27 13:11:42 +02:00
Sebastian Dröge
3e2f31c858 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2048
2021-04-23 09:37:28 +00:00
Emmanuel Fleury
e642562fff Add extra documentation about the return values of g_seekable_tell() 2021-04-23 10:43:05 +02:00
Emmanuel Fleury
59acf6950c Fix missing initializer warning in gio/tests/gdbus-example-server.c
gio/tests/gdbus-example-server.c:280:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  280 | };
      | ^
2021-04-23 10:43:05 +02:00
Emmanuel Fleury
f587095cfc Fix signedness warning in gio/tests/socket-common.c
gio/tests/socket-common.c: In function ‘socket_address_from_string’:
gio/tests/socket-common.c:50:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
   50 |   for (i = 0; i < G_N_ELEMENTS (unix_socket_address_types); i++)
      |                 ^
2021-04-23 10:43:05 +02:00
Emmanuel Fleury
bac08a4b26 Fix several missing initializer warnings in gio/tests/gdbus-example-subtree.c
gio/tests/gdbus-example-subtree.c:76:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
   76 | };
      | ^
gio/tests/gdbus-example-subtree.c:190:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  190 | };
      | ^
gio/tests/gdbus-example-subtree.c:228:1: error: missing initializer for field ‘get_property’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  228 | };
      | ^
gio/tests/gdbus-example-subtree.c:325:1: error: missing initializer for field ‘padding’ of ‘GDBusSubtreeVTable’ {aka ‘const struct _GDBusSubtreeVTable’}
  325 | };
      | ^
2021-04-23 10:43:05 +02:00
Emmanuel Fleury
cb0b4b00df Fix missing initializer warning in gio/tests/gnotification-server.c
gio/tests/gnotification-server.c: In function ‘g_notification_server_bus_acquired’:
gio/tests/gnotification-server.c:224:3: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  224 |   };
      |   ^
2021-04-23 10:43:05 +02:00
Emmanuel Fleury
d255962abb Fix missing initializer warning in gio/tests/gdbus-non-socket.c
gio/tests/gdbus-non-socket.c:116:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  116 | };
      | ^
2021-04-23 10:43:05 +02:00
Emmanuel Fleury
2187406f70 Fix signedness warning in gio/tests/gdbus-proxy.c
gio/tests/gdbus-proxy.c: In function ‘strv_equal’:
gio/tests/gdbus-proxy.c:158:32: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
  158 |     res = g_strv_length (strv) == count;
      |                                ^~
2021-04-23 10:43:05 +02:00
Emmanuel Fleury
401ff06614 Fix signedness warning in gio/gkeyfilesettingsbackend.c
gio/gkeyfilesettingsbackend.c: In function ‘convert_path’:
gio/gkeyfilesettingsbackend.c:155:15: warning: comparison of integer
expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’}
and ‘gint’ {aka ‘int’}
  155 |   if (key_len < kfsb->prefix_len ||
      |               ^
2021-04-23 10:42:52 +02:00
Sebastian Dröge
0b863a4ea9 Merge branch 'filename_max' into 'master'
Improve handling of FILENAME_MAX

See merge request GNOME/glib!2055
2021-04-23 08:40:21 +00:00
Sebastian Dröge
365314b37a Merge branch 'nacho/gmacros-master' into 'master'
gmacros: check that __cplusplus or _MSC_VER is defined

Closes #2387

See merge request GNOME/glib!2061
2021-04-23 08:39:46 +00:00
Ignacio Casal Quinteiro
2c97526c00 gmacros: check that __cplusplus or _MSC_VER is defined
Otherwise it will fail to compile in old distros like Centos 7
Fixes #2387
2021-04-23 10:10:48 +02:00
Emmanuel Fleury
f2be8c74e5 Fix signedness warnings in gio/ginputstream.c
gio/ginputstream.c: In function ‘g_input_stream_real_skip’:
gio/ginputstream.c:431:21: warning: comparison of integer expressions of
different signedness: ‘goffset’ {aka ‘long int’} and ‘long unsigned int’
  431 |           if (start > G_MAXSIZE - count || start + count > end)
      |                     ^
gio/ginputstream.c:431:58: warning: comparison of integer expressions of
different signedness: ‘long unsigned int’ and ‘goffset’ {aka ‘long int’}
  431 |           if (start > G_MAXSIZE - count || start + count > end)
      |                                                          ^
2021-04-22 14:13:17 +02:00
Emmanuele Bassi
80a938a205 Merge branch 'pgriffis/doc-fix' into 'master'
docs: Fix formatting of code block

See merge request GNOME/glib!2054
2021-04-20 02:09:55 +00:00
Philip Withnall
3131a6149e gdir: Add trailing nul delimiter to FILENAME_MAX
`FILENAME_MAX` is not guaranteed to include a trailing nul delimiter, so
explicitly add one.

See
https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html:
`PATH_MAX` is explicitly defined to include a nul delimiter;
`FILENAME_MAX` is not.

See also https://twitter.com/pid_eins/status/1357008940886818822.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-04-19 19:24:08 +01:00
Philip Withnall
496135c569 dirent: Add trailing nul delimiter to FILENAME_MAX
`FILENAME_MAX` is not guaranteed to include a trailing nul delimiter, so
explicitly add one.

See
https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html:
`PATH_MAX` is explicitly defined to include a nul delimiter;
`FILENAME_MAX` is not.

See also https://twitter.com/pid_eins/status/1357008940886818822.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-04-19 19:23:10 +01:00
Philip Withnall
3c027268a4 dirent: Simplify a memset() call
Let the compiler figure out the size, rather than hard-coding it the
same as the struct definition.

This makes no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-04-19 19:22:33 +01:00
Patrick Griffis
e926efe8e2 docs: Fix formatting of code block 2021-04-19 11:58:35 -05:00
Philip Withnall
7a50c3184d Merge branch 'wip/prince781/fix-gspawn-terminal-win32' into 'master'
gspawn-win32: improve guess whether process is console process

See merge request GNOME/glib!1662
2021-04-19 10:25:07 +00:00
Princeton Ferro
30ed2ea263 improve console check in gspawn-win32
We use the return value of AllocConsole (GetCurrentProcessId ()) to
determine whether the spawning process is attached to a console.
2021-04-19 10:25:06 +00:00
Philip Withnall
d602523988 Merge branch 'g_string_replace_doc_fix' into 'master'
g_string_replace(): Fix documentation of 'limit' parameter

See merge request GNOME/glib!2052
2021-04-19 09:28:25 +00:00
Nelson Ben
225fec1329 g_string_replace(): Fix documentation of 'limit' parameter 2021-04-18 18:31:32 +00:00
Sebastian Dröge
b63f7ec70b Merge branch 'patch-2' into 'master'
Add nullable annotations in GUnixMountEntry

See merge request GNOME/glib!2051
2021-04-18 16:35:27 +00:00
Sophie Herold
98c3710522 Add nullable annotations in GUnixMountEntry 2021-04-18 18:13:08 +02:00
Philip Withnall
9e4a6dac7c Merge branch 'fix-typo' into 'master'
Fix typo in g_socket_listener_accept_async()'s comment

See merge request GNOME/glib!2049
2021-04-16 14:29:00 +00:00
demotomohiro
e724e6ed04
Fix typo in g_socket_listener_accept_async()'s comment 2021-04-16 23:08:09 +09:00
Philip Withnall
8e19113dac Merge branch 'clang-attributes' into 'master'
gmacros.h: use g_macro__has_attribute() where possible

See merge request GNOME/glib!2043
2021-04-16 12:00:12 +00:00
Aleksandr Mezin
56be1f8d82 gmacros.h: raise minimum GCC version for attribute __noreturn__
`#define G_GNUC_NORETURN __attribute__((__noreturn__))` was previously under
`#if G_GNUC_CHECK_VERSION(2, 4)`.

But `# define G_NORETURN __attribute__ ((__noreturn__))` was under
`#if G_GNUC_CHECK_VERSION(2, 8) || (0x5110 <= __SUNPRO_C)`.

Take the latter for `g_macro__has_attribute(__noreturn__)` fallback. This will
disable `G_GNUC_NORETURN` for GCC 2.4-2.7 though.
2021-04-16 14:51:41 +06:00
Aleksandr Mezin
2b9bf7b162 gmacros.h: use g_macro__has_attribute() where possible
Fall back to compiler version checks only when `__has_attribute()` is not
available.

clang-cl doesn't define `__GNU__`, but still accepts attributes. This change
gets rid of a lot of warnings when building GLib with clang-cl. For GCC and
non-cl Clang nothing should change.
2021-04-16 14:45:03 +06:00