Commit Graph

23605 Commits

Author SHA1 Message Date
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
Pawan Chitrakar
a78b7ebb20 Update Nepali translation
(cherry picked from commit e9587a480a)
2021-04-15 22:04:02 +00:00
Sebastian Dröge
1afb4c0b96 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2047
2021-04-15 09:22:17 +00:00
Emmanuel Fleury
fd926b1ea7 Fix missing initializer in gio/tests/gdbus-example-peer.c
gio/tests/gdbus-example-peer.c:120:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  120 | };
      | ^
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
1c084ca717 Fix missing initializer warning in gio/tests/gdbus-example-export.c
gio/tests/gdbus-example-export.c:229:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  229 | };
      | ^
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
4d52358fe2 Fix signedness warning in gio/tests/gsettings.c
gio/tests/gsettings.c: In function ‘strv_set_equal’:
gio/tests/gsettings.c:2268:41: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
 2268 |     res = g_strv_length ((gchar**)strv) == count;
      |                                         ^~
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
83a9ba7790 Fix missing initializer warning in gio/tests/gdbus-testserver.c
gio/tests/gdbus-testserver.c:806:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  806 | };
      | ^
In file included from gio/gio.h:53,
                 from gio/tests/gdbus-testserver.c:1:
gdbusconnection.h:395:12: note: ‘padding’ declared here
  395 |   gpointer padding[8];
      |            ^~~~~~~
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
5133acdaff Fix multiple signedness warnings in gio/tests/gdbus-testserver.c
gio/tests/gdbus-testserver.c: In function ‘handle_method_call’:
gio/tests/gdbus-testserver.c:334:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  334 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:343:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  343 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:352:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  352 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:361:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  361 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:370:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  370 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:379:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  379 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:388:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  388 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:397:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  397 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:406:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  406 |         for (i = 0; i < n_elts; i++)
      |                       ^
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
c3c1f6c4b9 Fix signedness warning in gio/tests/mimeapps.c
gio/tests/mimeapps.c: In function ‘strv_equal’:
gio/tests/mimeapps.c:31:32: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
   31 |     res = g_strv_length (strv) == count;
      |                                ^~
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
e7aec308e9 Fix signedness warning in gio/tests/proxy-test.c
gio/tests/proxy-test.c: In function ‘do_echo_test’:
gio/tests/proxy-test.c:855:25: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  855 |   for (total = 0; total < nwrote; total += nread)
      |                         ^
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
8608eccf9a Fix signedness warning in gio/tests/file.c
gio/tests/file.c: In function ‘written_cb’:
gio/tests/file.c:358:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘size_t’ {aka ‘long unsigned int’}
  358 |   if (data->pos < strlen (data->data))
      |                 ^
2021-04-15 10:19:29 +02:00