Commit Graph

6882 Commits

Author SHA1 Message Date
Emmanuel Fleury
2174bcf000 Fix signedness warning in gio/gmenu.c:g_menu_insert_item()
gio/gmenu.c: In function ‘g_menu_insert_item’:
gio/gmenu.c:165:32: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  165 |   if (position < 0 || position > menu->items->len)
      |                                ^
2021-02-08 11:00:33 +01:00
Emmanuel Fleury
f598a93332 Fix signedness warning in gio/glocalfileinfo.c:get_access_rights()
gio/glocalfileinfo.c: In function ‘get_access_rights’:
gio/glocalfileinfo.c:932:9: error: comparison of integer expressions of different signedness: ‘uid_t’ {aka ‘unsigned int’} and ‘int’
  932 |     uid == parent_info->owner ||
      |         ^~
2021-02-08 11:00:25 +01:00
Emmanuel Fleury
4260193cff Fix signedness warning in gio/glocalfileinfo.c:read_link()
gio/glocalfileinfo.c: In function ‘read_link’:
gio/glocalfileinfo.c:188:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  188 |       if (read_size < size)
      |                     ^
2021-02-08 10:31:58 +01:00
Philip Withnall
20cfc75d14 Merge branch '2319-memdup' into 'master'
Add g_memdup2()

Closes #2319

See merge request GNOME/glib!1926
2021-02-04 17:12:36 +00:00
Philip Withnall
a8b204ff9d gtlspassword: Forbid very long TLS passwords
The public API `g_tls_password_set_value_full()` (and the vfunc it
invokes) can only accept a `gssize` length. Ensure that nul-terminated
strings passed to `g_tls_password_set_value()` can’t exceed that length.
Use `g_memdup2()` to avoid an overflow if they’re longer than
`G_MAXUINT` similarly.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2319
2021-02-04 16:17:21 +00:00
Philip Withnall
a2e38fd28e gsocket: Use gsize to track native sockaddr’s size
Don’t use an `int`, that’s potentially too small. In practical terms,
this is not a problem, since no socket address is going to be that big.

By making these changes we can use `g_memdup2()` without warnings,
though. Fewer warnings is good.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2319
2021-02-04 16:17:21 +00:00
Philip Withnall
7781a9cbd2 gkeyfilesettingsbackend: Handle long keys when converting paths
Previously, the code in `convert_path()` could not handle keys longer
than `G_MAXINT`, and would overflow if that was exceeded.

Convert the code to use `gsize` and `g_memdup2()` throughout, and
change from identifying the position of the final slash in the string
using a signed offset `i`, to using a pointer to the character (and
`strrchr()`). This allows the slash to be at any position in a
`G_MAXSIZE`-long string, without sacrificing a bit of the offset for
indicating whether a slash was found.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2319
2021-02-04 16:17:21 +00:00
Philip Withnall
9acebef777 gwin32: Use gsize internally in g_wcsdup()
This allows it to handle strings up to length `G_MAXSIZE` — previously
it would overflow with such strings.

Update the several copies of it identically.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2319
2021-02-04 16:17:21 +00:00
Philip Withnall
41d5eedad4 gdatainputstream: Handle stop_chars_len internally as gsize
Previously it was handled as a `gssize`, which meant that if the
`stop_chars` string was longer than `G_MAXSSIZE` there would be an
overflow.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2319
2021-02-04 16:17:21 +00:00
Philip Withnall
81a454237d gwinhttpfile: Avoid arithmetic overflow when calculating a size
The members of `URL_COMPONENTS` (`winhttp_file->url`) are `DWORD`s, i.e.
32-bit unsigned integers. Adding to and multiplying them may cause them
to overflow the unsigned integer bounds, even if the result is passed to
`g_memdup2()` which accepts a `gsize`.

Cast the `URL_COMPONENTS` members to `gsize` first to ensure that the
arithmetic is done in terms of `gsize`s rather than unsigned integers.

Spotted by Sebastian Dröge.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2319
2021-02-04 16:17:21 +00:00
Philip Withnall
73b293fd30 gio: Use g_memdup2() instead of g_memdup() in obvious places
Convert all the call sites which use `g_memdup()`’s length argument
trivially (for example, by passing a `sizeof()`), so that they use
`g_memdup2()` instead.

In almost all of these cases the use of `g_memdup()` would not have
caused problems, but it will soon be deprecated, so best port away from
it.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2319
2021-02-04 14:13:21 +00:00
Mohammed Sadiq
a1203b3d3b gapplication: Fix a memory leak 2021-02-04 18:38:17 +05:30
Jan Kot
0b0fcfad11 Add support for Tilix and Konsole 2021-02-03 20:44:55 +01:00
Philip Withnall
018ae0982c Merge branch 'wip/gdbus-even-when-setcap' into 'master'
Resolve GDBus regressions in setcap/setgid programs

Closes #2305

See merge request GNOME/glib!1920
2021-02-03 11:28:20 +00:00
Simon McVittie
7aa0580cc5 gdbus: Use DBUS_SESSION_BUS_ADDRESS if AT_SECURE but not setuid
This is against my better judgement, but it's the least bad regression
fix I can think of. If we don't do this, at least gnome-keyring-daemon
(setcap) and msmtp (setgid) are known to regress.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2305
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=981420
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=981555
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-02-02 20:52:19 +00:00
Simon McVittie
6436d52a0a gdbus: Rename a variable to be less misleading
We're using "setuid" here as shorthand for any elevated privileges
that should make us distrust the caller: setuid, setgid, filesystem
capabilities, more obscure Linux things that set the AT_SECURE flag
(such as certain AppArmor transitions), and their equivalents on
other operating systems. This is fine if we do it consistently, but
I'm about to add a check for whether we are *literally* setuid,
which would be particularly confusing without a rename.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-02-02 20:38:41 +00:00
Sebastian Dröge
7e958fd1fe Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!1911
2021-02-02 16:11:53 +00:00
Emmanuel Fleury
ccb43b3821 Fix signedness warnings in gio/ghttpproxy.c:g_http_proxy_connect()
gio/ghttpproxy.c: In function ‘g_http_proxy_connect’:
gio/ghttpproxy.c:245:17: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘int’
  245 |       if (nread == -1)
      |                 ^~
gio/ghttpproxy.c:253:22: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  253 |       if (bytes_read == buffer_length)
      |                      ^~
2021-02-02 16:31:07 +01:00
Sebastian Dröge
e6f506a92c Merge branch 'fix/unix-stream-pollable-detection' into 'master'
gunix: Fix {Input,Output}Stream pollable detection

Closes #1180

See merge request GNOME/glib!1846
2021-02-02 10:46:52 +00:00
Simon McVittie
7c0b9c776f gdbus: Improve readability by avoiding ternary operator
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-02-02 10:25:40 +00:00
Ole André Vadla Ravnås
d7ee70c013 gunix: Fix {Input,Output}Stream pollable detection
For devices such as PTYs, where not being able to cancel a pending read
operation is problematic for many applications.

Fixes: #1180
2021-02-02 11:11:53 +01:00
Simon McVittie
f378352051 tests: Mark tests with AddressSanitizer-detected leaks
Various tests have leaks where it isn't clear whether the data is
intentionally not freed, or leaked due to a bug. If we mark these
tests as TODO, we can skip them under AddressSanitizer and get the
rest to pass, giving us a baseline from which to avoid regressions.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-02-01 11:19:59 +00:00
Simon McVittie
5685546ab1 gio: Don't run gsocketclient-slow test under sanitizers
AddressSanitizer, UndefinedBehaviourSanitizer and probably others
involve adding instrumentation into the code under test, which doesn't
go well with LD_PRELOAD modules that absolutely need to be
self-contained.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-02-01 10:44:35 +00:00
Emmanuel Fleury
2fd429046d Fix several missing initializer warnings in gio/gapplication.c:g_application_parse_command_line()
gio/gapplication.c: In function ‘g_application_parse_command_line’:
gio/gapplication.c:545:11: error: missing initializer for field ‘arg_description’ of ‘GOptionEntry’ {aka ‘struct _GOptionEntry’}
  545 |           N_("Enter GApplication service mode (use from D-Bus service files)") },
      |           ^~
gio/gapplication.c:557:11: error: missing initializer for field ‘arg_description’ of ‘GOptionEntry’ {aka ‘struct _GOptionEntry’}
  557 |           N_("Override the application’s ID") },
      |           ^~
gio/gapplication.c:569:11: error: missing initializer for field ‘arg_description’ of ‘GOptionEntry’ {aka ‘struct _GOptionEntry’}
  569 |           N_("Replace the running instance") },
      |           ^~
2021-02-01 11:14:21 +01:00
Emmanuel Fleury
0cc48ee937 Fix missing initializer warning in gio/gdbusobjectmanagerserver.c
gio/gdbusobjectmanagerserver.c:892:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  892 | };
      | ^
2021-02-01 11:14:21 +01:00
Emmanuel Fleury
68e69a4128 Fix missing initializer warning in gio/gdbusconnection.c:g_dbus_connection_register_object_with_closures()
gio/gdbusconnection.c: In function ‘g_dbus_connection_register_object_with_closures’:
gio/gdbusconnection.c:5527:5: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘struct _GDBusInterfaceVTable’}
 5527 |     };
      |     ^
2021-02-01 11:14:21 +01:00
Emmanuel Fleury
80fa64d974 Fix missing initializer warning in gio/gdelayedsettingsbackend.c:delayed_backend_path_writable_changed()
gio/gdelayedsettingsbackend.c: In function ‘delayed_backend_path_writable_changed’:
gio/gdelayedsettingsbackend.c:406:7: error: missing initializer for field ‘index’ of ‘CheckPrefixState’
  406 |       CheckPrefixState state = { path, g_new (const gchar *, n_keys) };
      |       ^~~~~~~~~~~~~~~~
2021-02-01 11:14:21 +01:00
Sebastian Dröge
abd1f4b32b Merge branch 'ricotz/for-master' into 'master'
gio: Add explicit virtual g-i annotations for undiscovered invoker relationship

See merge request GNOME/glib!1910
2021-01-31 09:56:18 +00:00
Philip Withnall
ede8900f4e Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!1891
2021-01-30 22:34:40 +00:00
Sebastian Dröge
5f6eb627ff Merge branch 'override-gio-querymodules' into 'master'
Meson: override gio-querymodules program

See merge request GNOME/glib!1909
2021-01-30 12:09:43 +00:00
Rico Tzschichholz
ce8d5e3478 gio: Add explicit virtual g-i annotations for undiscovered invoker relationship 2021-01-30 13:00:01 +01:00
Xavier Claessens
ebcca60b4d Meson: override gio-querymodules program
It is going to be used in Meson's gnome module, and if glib is built as
subproject it's better to use it.

See https://github.com/mesonbuild/meson/pull/8272.
2021-01-29 18:57:09 -05:00
Simon McVittie
5b476d0d9c socket-service test: Don't leak writev vectors
Detected by AddressSanitizer.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-29 20:26:02 +00:00
Philip Withnall
3970ddec06 Merge branch '1054-check-bash-comp-dir' into 'master'
Check the completiondir from bash-completion package config file.

Closes #1054

See merge request GNOME/glib!1896
2021-01-29 17:21:31 +00:00
Frederic Martinsons
525bbb7712 Check the completiondir from bash-completion package config file.
With bash completion version lesser than 2.10, only prefix is defined
while for greater version it is datadir.

Closes #1054

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-29 18:10:52 +01:00
Philip Withnall
9a34c35c2b Merge branch 'wip/smcv/gdbus-test-leak' into 'master'
gdbus-serialization: Don't leak string containing first serialization

See merge request GNOME/glib!1906
2021-01-29 16:31:42 +00:00
Simon McVittie
de87bcf7ff gdbus-serialization: Don't leak string containing first serialization
We format the message into a string twice, once for each byte-order,
but only return the one corresponding to the last byte-order to the
caller. This means we need to free the first one.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-28 21:39:23 +00:00
Philip Withnall
9ea75d10d4 Merge branch '344-gdbus-completion' into 'master'
[gdbus-tool] Check object path validity during completion inside print_paths

Closes #344

See merge request GNOME/glib!1897
2021-01-28 17:02:15 +00:00
Sebastian Dröge
fdc192f460 Merge branch 'fix/darwin-nosigpipe-regression' into 'master'
gsocket: Fix SO_NOSIGPIPE regression on Darwin

See merge request GNOME/glib!1894
2021-01-27 07:35:04 +00:00
Frederic Martinsons
1c7c849d34 Correct memory leaks of error in completion case.
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-26 19:42:21 +00:00
Frederic Martinsons
43c2d747a3 Check object path validity during completion inside print_paths.
Closes #344

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-26 19:42:21 +00:00
Philip Withnall
742e55b754 Merge branch 'fix/gwin32appinfo-printf-length-sub-specifier' into 'master'
gwin32appinfo: Fix printf length sub-specifier

See merge request GNOME/glib!1893
2021-01-26 17:52:10 +00:00
Philip Withnall
2d6eed3a61 Merge branch '2011-add-unit-test-watch' into 'master'
Extend dbus watching name tests with auto start flags and use of closures.

Closes #2011

See merge request GNOME/glib!1885
2021-01-25 14:35:55 +00:00
Philip Withnall
5463436fc7 Merge branch 'fix/gfile-kernel-headers-compat' into 'master'
gfile: Add Linux kernel headers compatibility kludge

See merge request GNOME/glib!1843
2021-01-25 14:25:59 +00:00
Frederic Martinsons
d890b1ce5f Extend dbus watching name tests:
- use watcher auto start flag.
  - use watch_name_on_connection_with_closures.
  - use an existing service name for auto start.

Closes #2011

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-25 15:00:12 +01:00
Francesco Tamagni
f6ce5739f8 gsocket: Fix SO_NOSIGPIPE regression on Darwin
Where the early call to g_socket_set_option() fails because of
check_socket() failing due to `inited` still being FALSE.

This brings 634b692 back into working order, by fixing the regression
introduced in 39f047e.

Co-authored-by: Ole André Vadla Ravnås <oleavr@gmail.com>
2021-01-21 21:17:24 +01:00
Ole André Vadla Ravnås
9b2ab509da gwin32appinfo: Fix printf length sub-specifier
warning: format string '%x' requires an argument of type 'unsigned int',
but variadic argument 1 has type 'gsize'.
2021-01-21 20:10:50 +01:00
Emmanuel Fleury
0c49122949 Fix signedness warning in gio/gdatainputstream.c:read_data()
gio/gdatainputstream.c: In function ‘read_data’:
gio/gdatainputstream.c:313:35: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  313 |   g_warn_if_fail (res == size);
      |                       ^~
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
579e9e49c5 Fix several warnings in gio/gapplicationimpl-dbus.c:g_application_impl_command_line()
gio/gapplicationimpl-dbus.c: In function ‘g_application_impl_command_line’:
gio/gapplicationimpl-dbus.c:772:3: error: ‘static’ is not at beginning of declaration
  772 |   const static GDBusInterfaceVTable vtable = {
      |   ^~~~~
gio/gapplicationimpl-dbus.c:774:3: error: missing initializer for field ‘get_property’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  774 |   };
      |   ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
cf5a6cfe3a Fix several warnings in gio/gapplicationimpl-dbus.c:g_application_impl_attempt_primary()
gio/gapplicationimpl-dbus.c: In function ‘g_application_impl_attempt_primary’:
gio/gapplicationimpl-dbus.c:364:3: error: ‘static’ is not at beginning of declaration
  364 |   const static GDBusInterfaceVTable vtable = {
      |   ^~~~~
gio/gapplicationimpl-dbus.c:368:3: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  368 |   };
      |   ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
7d81742339 Fix missing initializer warning in gio/gmenuexporter.c:g_dbus_connection_export_menu_model()
gio/gmenuexporter.c: In function ‘g_dbus_connection_export_menu_model’:
gio/gmenuexporter.c:787:3: error: missing initializer for field ‘get_property’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  787 |   };
      |   ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
5af79a84e3 Fix signedness warning in gio/gsocketlistener.c:g_socket_listener_close()
gio/gsocketlistener.c: In function ‘g_socket_listener_close’:
gio/gsocketlistener.c:1019:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
 1019 |   for (i = 0; i < listener->priv->sockets->len; i++)
      |                 ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
a68fbcc002 Fix signedness warning in gio/gsocketlistener.c:g_socket_listener_set_backlog()
gio/gsocketlistener.c: In function ‘g_socket_listener_set_backlog’:
gio/gsocketlistener.c:993:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  993 |   for (i = 0; i < listener->priv->sockets->len; i++)
      |                 ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
cd540a228a Fix signedness warning in gio/gsocketlistener.c:add_sources()
gio/gsocketlistener.c: In function ‘add_sources’:
gio/gsocketlistener.c:612:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  612 |   for (i = 0; i < listener->priv->sockets->len; i++)
      |                 ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
887f59ebc0 Fix missing initializer in gio/gactiongroupexporter.c:g_dbus_connection_export_action_group()
gio/gactiongroupexporter.c: In function ‘g_dbus_connection_export_action_group’:
gio/gactiongroupexporter.c:542:3: error: missing initializer for field ‘get_property’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  542 |   };
      |   ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
8236b66a5d Fix signedness warning in gio/gnetworkmonitornetlink.c:remove_network()
gio/gnetworkmonitornetlink.c: In function ‘remove_network’:
gio/gnetworkmonitornetlink.c:272:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  272 |       for (i = 0; i < nl->priv->dump_networks->len; i++)
      |                     ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
f885d80ea3 Fix missing initializer warning in gio/gtask.c
gio/gtask.c:2153:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
 2153 | };
      | ^
2021-01-21 11:59:09 +01:00
Philip Withnall
8bdd7438e5 Merge branch '968-add-gdbus-obj-path-escape' into 'master'
Add g_dbus_utils_object_path_escape and g_dbus_utils_object_path_unescape

Closes #968

See merge request GNOME/glib!1871
2021-01-20 13:23:25 +00:00
MARTINSONS Frederic
47355c358d Add g_dbus_utils_object_path_escape and g_dbus_utils_object_path_unescape
These two APIs are useful to publish an object which path content is not
controlled (e.g. dynamically built or coming from external source).

Closes #968

(Rebased and tweaked by Frederic Martinsons)

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-20 13:23:24 +00:00
Philip Withnall
b6a1fa47fe Merge branch 'settings-test-cleanups' into 'master'
Various memory leak cleanups to GSettings tests

See merge request GNOME/glib!610
2021-01-20 13:15:26 +00:00
Philip Withnall
5cafd748e3 tests: Remove incorrect unref from tls-bindings tests
`g_tls_backend_get_default()` does not return a reference to the
backend, so don’t drop one.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-20 12:51:41 +00:00
Philip Withnall
1cde07b978 gsettings: Fix a minor memory leak when getting GSettingsAction:state
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-20 12:51:41 +00:00
Philip Withnall
98274e09de tests: Free GSettingsBackend singleton at end of gsettings tests
This makes the tests a whole lot closer to being valgrind-clean, and
revealed a few legitimate memory leaks in amongst the noise caused by
keeping the singleton GSettingsBackend around for the lifetime of the
process.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2021-01-20 12:51:41 +00:00
Philip Withnall
22b924b64a giomodule: Don’t mandatorily cache GIOModule implementations
While all of the current callers of _g_io_module_get_default() want to
cache the returned GObject for the lifetime of the process, that doesn’t
necessarily have to be the case, so let callers make that decision on a
case-by-case basis.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2021-01-20 12:51:41 +00:00
Philip Withnall
86aec50c0a Merge branch 'feature/qnx-support' into 'master'
Port to QNX

See merge request GNOME/glib!1847
2021-01-20 12:28:54 +00:00
WorksButNotTested
f4ca92df2b ginetaddress: Handle systems without IPv6 support 2021-01-20 01:11:07 +01:00
s1341
9204c346d4 gsocket: Decrease msg_control buffer size for QNX 2021-01-19 23:17:30 +01:00
s1341
57768b4704 build: Link against libsocket on QNX
QNX implements `res_query()` in libsocket, not libresolv or libbind.
2021-01-19 23:17:02 +01:00
s1341
4e3b646b4f gunixmounts: Add stubs for QNX 2021-01-19 23:16:57 +01:00
Ole André Vadla Ravnås
94a8a60a7e gfile: Add Linux kernel headers compatibility kludge
So we can still run at full speed on modern kernels in cases where an
old toolchain was used to build GLib. This is often done deliberately
to allow shipping binaries that need to run on a wide range of systems.
2021-01-19 19:53:16 +01:00
Emmanuel Fleury
f412993291 Fix signedness warning in gio/gdbusdaemon.c:match_new()
gio/gdbusdaemon.c: In function ‘match_new’:
gio/gdbusdaemon.c:449:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  449 |   for (i = 0; i < elements->len; i++)
      |                 ^
2021-01-19 10:03:12 +00:00
Emmanuel Fleury
6d08c2f5ba Fix signedness warning in gio/gdbusdaemon.c:is_key()
gio/gdbusdaemon.c: In function ‘is_key’:
gio/gdbusdaemon.c:213:11: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘long int’
  213 |   if (len != key_end - key_start)
      |           ^~
2021-01-19 10:03:12 +00:00
Emmanuel Fleury
73499dcb73 Fix missing initializer warning in gio/gpollableutils.c:closure_marshal()
gio/gpollableutils.c:92:1: error: missing initializer for field ‘closure_marshal’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
   92 | };
      | ^
2021-01-19 10:03:12 +00:00
Emmanuel Fleury
f12f008699 Fix missing initializer warning in gio/gcontenttype.c:load_comment_for_mime_helper()
gio/gcontenttype.c: In function ‘load_comment_for_mime_helper’:
gio/gcontenttype.c:409:3: error: missing initializer for field ‘passthrough’ of ‘GMarkupParser’ {aka ‘struct _GMarkupParser’}
  409 |   };
      |   ^
2021-01-19 10:03:12 +00:00
Emmanuel Fleury
ae1eebb2e9 Fix signedness warning in gio/gdesktopappinfo.c:g_app_info_get_all()
gio/gdesktopappinfo.c: In function ‘g_app_info_get_all’:
gio/gdesktopappinfo.c:4597:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
 4597 |   for (i = 0; i < desktop_file_dirs->len; i++)
      |                 ^
2021-01-19 10:03:12 +00:00
Emmanuel Fleury
9567665524 Fix signedness warning in gio/gdesktopappinfo.c:g_desktop_app_info_search()
gio/gdesktopappinfo.c: In function ‘g_desktop_app_info_search’:
gio/gdesktopappinfo.c:4517:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 4517 |   for (i = 0; i < desktop_file_dirs->len; i++)
      |                 ^
2021-01-19 10:03:12 +00:00
Emmanuel Fleury
6bce33300a Fix signedness warning in gio/gdesktopappinfo.c:g_desktop_app_info_get_implementations()
gio/gdesktopappinfo.c: In function ‘g_desktop_app_info_get_implementations’:
gio/gdesktopappinfo.c:4451:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 4451 |   for (i = 0; i < desktop_file_dirs->len; i++)
      |                 ^
2021-01-19 10:03:12 +00:00
Emmanuel Fleury
554b1ff0e2 Fix several signedness warnings in gio/gdesktopappinfo.c:g_app_info_get_default_for_type()
gio/gdesktopappinfo.c: In function ‘g_app_info_get_default_for_type’:
gio/gdesktopappinfo.c:4357:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 4357 |       for (j = 0; j < desktop_file_dirs->len; j++)
      |                     ^
gio/gdesktopappinfo.c:4361:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 4361 |       for (j = 0; j < desktop_file_dirs->len; j++)
      |                     ^
gio/gdesktopappinfo.c:4365:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 4365 |       for (j = 0; j < results->len; j++)
      |                     ^
gio/gdesktopappinfo.c:4369:25: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 4369 |           for (k = 0; k < desktop_file_dirs->len; k++)
      |                         ^
2021-01-19 10:03:12 +00:00
Emmanuel Fleury
daa0e0b76b Fix signedness warnings in gio/gdesktopappinfo.c:g_desktop_app_info_get_desktop_ids_for_content_type()
gio/gdesktopappinfo.c: In function ‘g_desktop_app_info_get_desktop_ids_for_content_type’:
gio/gdesktopappinfo.c:4154:19: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 4154 |     for (j = 0; j < desktop_file_dirs->len; j++)
      |                   ^
gio/gdesktopappinfo.c:4158:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
 4158 |   for (i = 0; i < hits->len; i++)
      |                 ^
2021-01-19 10:03:12 +00:00
Emmanuel Fleury
46772fe4c3 Fix signedness warning in gio/gdesktopappinfo.c:get_list_of_mimetypes()
gio/gdesktopappinfo.c: In function ‘get_list_of_mimetypes’:
gio/gdesktopappinfo.c:4116:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 4116 |       for (i = 0; i < array->len; i++)
      |                     ^
2021-01-19 10:03:12 +00:00
Emmanuel Fleury
b6f7e4678b Another fix on g_socket_send_message()
We forgot to take into account the case where num_vectors is '-1'.
2021-01-13 13:29:52 +01:00
Emmanuel Fleury
08f73f8187 Fix signedness warning in gio/gdesktopappinfo.c:g_desktop_app_info_launch_uris_with_spawn()
gio/gdesktopappinfo.c: In function ‘g_desktop_app_info_launch_uris_with_spawn’:
gio/gdesktopappinfo.c:2804:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
 2804 |       for (i = 0; i < G_N_ELEMENTS (wrapper_argv); i++)
      |                     ^
2021-01-12 19:25:26 +01:00
Emmanuel Fleury
04a05ff016 Fix signedness warning in gio/gdesktopappinfo.c:desktop_file_dirs_lock()
gio/gdesktopappinfo.c: In function ‘desktop_file_dirs_lock’:
gio/gdesktopappinfo.c:1564:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 1564 |   for (i = 0; i < desktop_file_dirs->len; i++)
      |                 ^
2021-01-12 19:16:56 +01:00
Emmanuel Fleury
ce2446ddfd Fix signedness warning in gio/gdesktopappinfo.c:array_contains()
gio/gdesktopappinfo.c: In function ‘array_contains’:
gio/gdesktopappinfo.c:1193:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 1193 |   for (i = 0; i < array->len; i++)
      |                 ^
2021-01-12 19:16:56 +01:00
Emmanuel Fleury
5940d51167 Fix signedness warning in gio/gdesktopappinfo.c:desktop_file_dir_unindexed_setup_search()
gio/gdesktopappinfo.c: In function ‘desktop_file_dir_unindexed_setup_search’:
gio/gdesktopappinfo.c:1114:25: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
 1114 |           for (i = 0; i < G_N_ELEMENTS (desktop_key_match_category); i++)
      |                         ^
2021-01-12 19:16:56 +01:00
Emmanuel Fleury
de5e43dc95 Fix signedness warning in gio/gmemoryinputstream.c:g_memory_input_stream_seek()
gio/gmemoryinputstream.c: In function ‘g_memory_input_stream_seek’:
gio/gmemoryinputstream.c:479:32: error: comparison of integer expressions of different signedness: ‘goffset’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  479 |   if (absolute < 0 || absolute > priv->len)
      |                                ^
2021-01-12 19:16:56 +01:00
Emmanuel Fleury
1061a22af1 Fix missing initializer warning in gio/glocalfilemonitor.c:g_file_monitor_source_new()
gio/glocalfilemonitor.c: In function ‘g_file_monitor_source_new’:
gio/glocalfilemonitor.c:653:3: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
  653 |   };
      |   ^
2021-01-12 19:16:56 +01:00
Emmanuel Fleury
ffa6d9d614 Fix signedness warning in gio/gsubprocess.c:initable_init()
gio/gsubprocess.c: In function ‘initable_init’:
gio/gsubprocess.c:587:26: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  587 |     g_assert (0 < s && s < sizeof self->identifier);
      |                          ^
2021-01-12 19:16:56 +01:00
Emmanuel Fleury
a93a6a5459 Fix missing initializer warning in gio/gsubprocess.c:initable_init()
gio/gsubprocess.c: In function ‘initable_init’:
gio/gsubprocess.c:454:3: error: missing initializer for field ‘child_setup_data’ of ‘ChildData’
  454 |   ChildData child_data = { { -1, -1, -1 }, 0 };
      |   ^~~~~~~~~
2021-01-12 19:16:55 +01:00
Emmanuel Fleury
be2df3f8b2 Fix signedness warning in gio//gsocketcontrolmessage.c:g_socket_control_message_deserialize()
gio/gsocketcontrolmessage.c: In function ‘g_socket_control_message_deserialize’:
gio/gsocketcontrolmessage.c:189:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  189 |   for (i = 0; i < n_message_types; i++)
      |                 ^
2021-01-12 19:16:55 +01:00
Emmanuel Fleury
5515dda6e6 Fix signedness warning in gio/gsubprocess.c:child_setup()
gio/gsubprocess.c: In function ‘child_setup’:
gio/gsubprocess.c:271:56: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  271 |     if (child_data->fds[i] != -1 && child_data->fds[i] != i)
      |                                                        ^~
2021-01-12 19:16:55 +01:00
Michael Catanzaro
dfdab13682 Merge branch 'more_on_g_socket_send_message' into 'master'
Fixing g_socket_send_message() documentation to make it clearer

See merge request GNOME/glib!1876
2021-01-12 18:10:05 +00:00
Philip Withnall
8d78b92794 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!1823
2021-01-12 18:03:06 +00:00
Emmanuel Fleury
7e00091b60 Fixing g_socket_send_message() documentation to make it clearer 2021-01-12 18:16:50 +01:00
Emmanuel Fleury
26ec52b9a2 Fix signedness warnings in gio/gsocket.c
gio/gsocket.c: In function ‘g_socket_send_message_with_timeout’:
gio/gsocket.c:4528:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘const unsigned int’}
 4528 |         for (i = 0; i < _message->num_vectors; i++) \
      |                       ^

gio/gsocket.c: In function ‘g_socket_send_message_with_timeout’:
gio/gsocket.c:4543:19: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘const unsigned int’}
 4543 |     for (i = 0; i < _message->num_control_messages; i++) \
      |                   ^

gio/gsocket.c: In function ‘g_socket_send_messages_with_timeout’:
gio/gsocket.c:5133:19: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 5133 |     for (i = 0; i < num_messages; ++i)
      |                   ^
gio/gsocket.c:5152:33: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
 5152 |     for (num_sent = 0; num_sent < num_messages;)
      |                                 ^
2021-01-12 15:48:19 +01:00
Emmanuel Fleury
0705dbd17b Fix missing initializer warnings in gio/gsocket.c
gio/gsocket.c:3761:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
 3761 | };
      | ^
gio/gsocket.c:4071:1: error: missing initializer for field ‘closure_marshal’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
 4071 | };
      | ^
2021-01-12 15:48:19 +01:00
Emmanuel Fleury
8b4c6fcc00 Fix signedness warning in gio/gsimpleproxyresolver.c:ignore_host()
gio/gsimpleproxyresolver.c: In function ‘ignore_host’:
gio/gsimpleproxyresolver.c:271:18: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  271 |    for (i = 0; i < priv->ignore_ips->len; i++)
      |                  ^
2021-01-12 15:48:11 +01:00
Emmanuel Fleury
7197ad3c40 Fix possible integer overflow of g_socket_send_message()
The explanation of this bug has been mentioned in !1823, basically
it fixes some possible integer overflow when message buffer size
is more than G_MAXSSIZE.
2021-01-12 15:17:02 +01:00
Emmanuel Fleury
a39312b14f Fix signedness warning in gio/gpollableoutputstream.c:g_pollable_output_stream_default_writev_nonblocking()
gio/gpollableoutputstream.c: In function ‘g_pollable_output_stream_default_writev_nonblocking’:
gio/gpollableoutputstream.c:217:15: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘const long unsigned int’}
  217 |       if (res < vectors[i].size)
      |               ^
2021-01-11 20:45:27 +01:00
Emmanuel Fleury
16ee50a592 Fix signedness warning in gio/goutputstream.c:g_output_stream_real_writev()
gio/goutputstream.c: In function ‘g_output_stream_real_writev’:
gio/goutputstream.c:2347:15: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘const long unsigned int’}
 2347 |       if (res < vectors[i].size)
      |               ^
2021-01-11 20:45:27 +01:00