Commit Graph

7124 Commits

Author SHA1 Message Date
Руслан Ижбулатов
cb994350c4 GWin32Mount: Don't use SHGetFileInfoW() for mount displaynames
This function can create long delays when used on disconnected
or just weird volumes. Use IShellFolder::GetDisplayNameOf() instead.

Fixes #2096
2021-03-31 13:30:03 +00:00
Руслан Ижбулатов
d1c542254f GWin32Mount: Don't use SHGetFileInfoW() for icons
This function can cause significant delays when the mounted volume
is disconnected or just weird. Use IExtractIconW::GetIconLocation()
instead.

Theoretically, this should require COM to be initialized, but in my tests
this code worked just fine without calling CoInitializeEx().
2021-03-31 13:30:02 +00:00
Philip Withnall
4cce4b96a6 Merge branch 'ricotz/for-master' into 'master'
gtlspassword: Fix g-i annotation of return for g_tls_password_get_value

See merge request GNOME/glib!2023
2021-03-31 12:10:10 +00:00
Rico Tzschichholz
454a9c1203 gtlspassword: Fix g-i annotation of return for g_tls_password_get_value 2021-03-31 12:10:10 +00:00
Leigh Scott
762b284ecc glocalfile: Add native exfat magic number to filesystem list 2021-03-29 18:33:31 +01:00
Philip Withnall
622b31f69e Merge branch 'fixing_2281' into 'master'
Update GFileInfo to use GDateTime as timestamps

Closes #2281

See merge request GNOME/glib!2017
2021-03-29 16:47:58 +00:00
Abanoub Ghadban
1bdfc1a36b gfileinfo: Add tests for get and set {access,creation}_date_time APIs 2021-03-28 23:07:39 +02:00
Abanoub Ghadban
240cc7da97 gfileinfo: Add APIs to get and set {access,creation}_date_time 2021-03-28 23:07:39 +02:00
Руслан Ижбулатов
03b574ae66 Don't leak a handle from _g_io_win32_get_module()
This call increments the DLL refcount by default and
needs a flag to avoid that.
2021-03-25 15:20:49 +00:00
Руслан Ижбулатов
f701d6c497 GIO W32: Pin gio DLL
On Windows gio runs a thread to update appinfo at startup.
If someone unloads gio (this happens when a dynamic gio module gets
unloaded by a program that doesn't use gio itself), there doesn't seem
to be a way to detect that until gio is already gone, and as soon as
gio is gone, the thread crashes, since it tries to execute instructions
that are no longer there.

Holding an extra reference to gio DLL fixes this, but it also prevents
gio from being unloaded, and there's no "weak references" for DLLs.
So we just pin gio and acknowledge that it will never be unloaded.

Fixes #2300
Fixes #2359
2021-03-25 15:16:08 +00:00
Avinash Sonawane
5ce6ba287f docs: Replace git.gnome.org with gitlab.gnome.org urls 2021-03-24 16:18:53 +05:30
Avinash Sonawane
d6a9b954fa docs: Fix example program link 2021-03-24 10:21:38 +00:00
Frederic Martinsons
7f2fef5c26 tests: Deactivate tls-bindings test suite for windows
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>

Helps: #2297
2021-03-23 11:11:45 +00:00
Philip Chimento
27b9d2cb27 gpollableinputstream: Add missing annotation
The buffer for g_pollable_input_stream_read_nonblocking() is an out
parameter which the caller must allocate.

See https://gitlab.gnome.org/GNOME/gjs/-/issues/389
2021-03-18 20:42:05 -07:00
Philip Withnall
2fd21175e7 Merge branch '2011-add-dbus-watch-name-tests' into 'master'
Resolve "Add additional unit tests for D-Bus name watching"

Closes #2011

See merge request GNOME/glib!1904
2021-03-18 21:10:19 +00:00
Philip Withnall
bdea78295c Merge branch 'fix-data-to-c-line-endings' into 'master'
data-to-c.py: autodetect line endings

Closes #2340

See merge request GNOME/glib!1974
2021-03-18 14:00:05 +00:00
Frederic Martinsons
59e999fd0a Add two test cases which covers disconnection scenario in another thread
1) Check that schedule_call_in_idle code branch of gdbusnamewatching.c
   is working to call vanished handler in the thread which had watched the name
2) Check cancellation of vanished handler if the name is unwatched before
   vanished callback is dispatched.

Closes #2011

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-03-17 08:36:47 +01:00
Frederic Martinsons
2f5f69e969 Use OwnNameData structure when owning a name instead of WatchNameData.
The two structures share some common variable name but it's confusing.

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-03-17 08:36:47 +01:00
Frederic Martinsons
98abfc9da7 Correct memleak introduced by !1885
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-03-17 08:36:47 +01:00
Philip Withnall
c4b4fecaef glocalfileoutputstream: Tidy up error handling
After the recent reworking of this code it was possible for `g_close()`
to be called on `fd == -1`, which is invalid. It would have reported an
error, were errors not ignored. So it was harmless, but still best to
fix.

Simplify the error handling by combining both error labels and checking
the state of `fd` dynamically.

Coverity CID: #1450834

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-16 11:36:27 +00:00
Philip Withnall
d26d70d66a gbytesicon: Fix error in g_bytes_icon_new() documentation
It said that `NULL` could be returned, but actually `g_bytes_icon_new()`
can never fail.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-14 15:53:24 +00:00
Philip Withnall
39ecc25383 build: Drop gconstructor_as_data_h usage from glib-compile-schemas
The variable `gconstructor_code` (which is what’s defined by
`gconstructor_as_data_h`) is not used at all inside
`glib-compile-schemas`.

This looks like a copy/paste error from the build definition for
`glib-compile-resources` below, which does need it.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-12 12:42:17 +00:00
Emmanuele Bassi
327ea4e30d Merge branch '2327-mkenums-version-macros' into 'master'
glib-mkenums: Parse and skip deprecation/availability annotations

Closes #2327

See merge request GNOME/glib!1984
2021-03-11 14:40:57 +00:00
Philip Withnall
c92d9dc267 enums: Add missing GLIB_AVAILABLE_ENUMERATOR_IN_2_68 annotations
In the 2.68 cycle we’d added 3 new enumerator elements. Due to the
preceding commit, they can now be annotated with
`GLIB_AVAILABLE_ENUMERATOR_IN_2_68`, which will make it a bit easier for
third party projects to notice when they’re using these symbols without
having bumped their GLib dependency.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2327
2021-03-11 13:37:49 +00:00
Sebastian Dröge
db0ec9528e Merge branch '2328-file-new-empty-path' into 'master'
glocalvfs: Create a dummy file for g_file_new_for_path("")

Closes #2328

See merge request GNOME/glib!1983
2021-03-11 09:42:19 +00:00
Philip Withnall
519bdf665b Merge branch 'work-out-libutil-soname-at-build-time' into 'master'
gio/tests/{meson.build,pollable.c}: Determine libutil SONAME at build time

See merge request GNOME/glib!1977
2021-03-10 19:35:18 +00:00
Philip Withnall
d52728f994 glocalvfs: Create a dummy file for g_file_new_for_path("")
`""` is not a valid path (`stat()` on it returns `ENOENT`). Previously,
a full `GLocalFile` was being created, which ended up resolving to
`$CWD`, through path canonicalisation. That isn’t right.

Fix it by creating a `GDummyFile` instead, and adding a unit test.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2328
2021-03-10 19:10:38 +00:00
Philip Withnall
628e1c5893 gdummyfile: Return NULL from get_basename() if no path is stored
Rather than returning a URI, which definitely won’t be a valid basename.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2328
2021-03-10 19:10:04 +00:00
Iain Lane
373e46c2b2
gio/tests/{meson.build,pollable.c}: Determine libutil SONAME at build time
Calling `dlopen()` with `libutil.so` makes the installed tests depend on
having glibc's development files installed. To avoid this, we can work
out the runtime library name at build time and `dlopen` that instead.

This approach is [taken from libfprint][1], thanks to Marco Trevisan.

[1]: f401f399a8
2021-03-10 18:04:17 +00:00
Philip Withnall
57a53ec964 gioerror: Add conversion from ENXIO to G_IO_ERROR_NOT_REGULAR_FILE
`ENXIO` can be returned from `open(2)` for special files (FIFOs, device
files and domain sockets) which are not backed by anything.

This fixes the error returned by `g_file_replace()` when trying to
replace such a file, so that it now matches the documentation.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-10 17:55:51 +00:00
Philip Withnall
730015a8ed tests: Add comprehensive tests for static behaviour of g_file_replace()
These test all the functionality and combinations of flags I can think
of. They do not cover dynamic behaviour (for example, what would happen
if the source file is deleted by another process part-way through a call
to `g_file_replace()`).

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-10 17:55:51 +00:00
Philip Withnall
ac505e88c4 glocalfileoutputstream: Add a missing O_CLOEXEC flag to replace()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-10 17:55:51 +00:00
Philip Withnall
87e19535fe glocalfileoutputstream: Fix CREATE_REPLACE_DESTINATION with symlinks
The `G_FILE_CREATE_REPLACE_DESTINATION` flag is equivalent to unlinking
the destination file and re-creating it from scratch. That did
previously work, but in the process the code would call `open(O_CREAT)`
on the file. If the file was a dangling symlink, this would create the
destination file (empty). That’s not an intended side-effect, and has
security implications if the symlink is controlled by a lower-privileged
process.

Fix that by not opening the destination file if it’s a symlink, and
adjusting the rest of the code to cope with
 - the fact that `fd == -1` is not an error iff `is_symlink` is true,
 - and that `original_stat` will contain the `lstat()` results for the
   symlink now, rather than the `stat()` results for its target (again,
   iff `is_symlink` is true).

This means that the target of the dangling symlink is no longer created,
which was the bug. The symlink itself continues to be replaced (as
before) with the new file — this is the intended behaviour of
`g_file_replace()`.

The behaviour for non-symlink cases, or cases where the symlink was not
dangling, should be unchanged.

Includes a unit test.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2325
2021-03-10 17:55:51 +00:00
Philip Withnall
a5f1f1e47c glocalfileoutputstream: Factor out a flag check
This clarifies the code a little. It introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-10 16:05:55 +00:00
Philip Withnall
5f2eae1156 tests: Stop using g_test_bug_base() in file tests
Since a following commit is going to add a new test which references
Gitlab, so it’s best to move the URI bases inside the test cases.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-10 16:02:35 +00:00
Philip Withnall
d523ed4543 glocalfileoutputstream: Fix a typo in a comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-10 16:02:35 +00:00
Sebastian Dröge
0dc86cded2 Merge branch 'machine-id-test' into 'master'
Validate D-Bus machine ID after loading

See merge request GNOME/glib!1962
2021-03-09 12:49:51 +00:00
Aleksandr Mezin
19106af47f data-to-c.py: autodetect line endings
When GLib code is checked out with Windows line endings (happens on Windows),
data-to-c.py embedded that line endings into generated string literal. And
then they translated to double newlines in glib-compile-resources output.

clang-cl failed to compile such files because of empty lines in the middle of
multiline macros:

    #define G_MSVC_CTOR(_func,_sym_prefix) \

      static void _func(void); \

To fix the issue, enable 'universal newlines' mode when reading the input in
data-to-c.py - translate both '\n' and '\r\n' to '\n'.

Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2340
2021-03-01 23:59:34 +06:00
Philip Withnall
05ff2f877c gdbusprivate: Stop hard-coding path to /var/lib
This will require distributions to ensure they pass
`--localstatedir=/var` correctly to Meson, but they should be doing that
already.

See https://mesonbuild.com/Builtin-options.html#directories for details
about how Meson treats `localstatedir` differently from most other `dir`
variables.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-01 13:44:20 +00:00
Philip Withnall
daa62a35e1 gdbusprivate: Validate machine ID after loading it
It’s unlikely that the machine ID will be invalid (it’s system
configuration), but it would be helpful to not propagate invalid IDs
further, since a lot of things rely on it.

It’s not easy to test this (it requires factoring out the code so it can
be used from a test program, or allowing it to load a machine ID from a
custom path), so I haven’t added unit tests. I’ve tested manually by
overriding the loaded machine ID.

Coverity CID: #1430944

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-01 13:44:20 +00:00
Philip Withnall
ea19358039 gdbusprivate: Simplify some variable initialisations
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-01 13:44:20 +00:00
Luca Bacci
00e848fbc3
Use the right permissions for directory watching on Win32
Using FILE_GENERIC_READ | FILE_GENERIC_WRITE access rights for directory monitoring
might cause problems, as noted in https://gitlab.gnome.org/GNOME/gimp/-/issues/4594.

ReadDirectoryChanges only needs FILE_LIST_DIRECTORY, so use that.

Fixes: https://gitlab.gnome.org/GNOME/gimp/-/issues/4594
2021-03-01 11:41:12 +01:00
Chun-wei Fan
cf02c280ff gio/tests/pollable.c: Fix build on non-Linux UNIX
For non-Linux UNIX systems, the label 'close_libutil:' in
'test_pollable_unix_pty()' will have no statement that goes with that
label.  Just do a 'return' on non-Linux UNIX systems.
2021-02-27 10:53:53 +08:00
Sebastian Dröge
81c4f4de4d Merge branch 'gio/gfileinfo/g_file_info_get_size/documentation' into 'master'
Improving documentation for g_file_info_get_size, fixing #2333

Closes #2333

See merge request GNOME/glib!1964
2021-02-26 08:29:19 +00:00
Uwe Scholz
429ccbd6d3 Improved the description of g_file_info_get_content_type function 2021-02-25 21:46:59 +01:00
Simon McVittie
f443144091 Merge branch 'pollable-test-dlopen-leak' into 'master'
tests: Fix leak of dlopened module in pollable test

See merge request GNOME/glib!1936
2021-02-25 18:26:57 +00:00
Uwe Scholz
73182528fa Improving documentation for g_file_info_get_size, fixing #2333 2021-02-24 23:13:27 +01:00
Michael Catanzaro
26f6e3db9e gkeyfilesettingsbackend: check for errors when creating file monitors
File monitor creation may fail. We should check for this, rather than
ignoring it and then spewing criticals upon improperly assuming that we
have a valid GFileMonitor rather than NULL.

In practice, creating the GFileMonitors here fail when opening a large
number of tabs in Epiphany. I'm still investigating to see why, but it
doesn't matter for the purposes of this commit.
2021-02-23 16:31:26 -06:00
Sebastian Dröge
7b0ac98afe Merge branch '2332-subprocess-launcher-oops' into 'master'
gsubprocesslauncher: Don’t close target FDs in close() method

Closes #2332

See merge request GNOME/glib!1958
2021-02-20 10:07:03 +00:00
Philip Withnall
50cf90dc56 tests: Test g_subprocess_launcher_close() doesn’t close too many FDs
Expand an existing unit test to check that the target FD of a
`g_subprocess_launcher_take_fd()` call doesn’t get closed when
`g_subprocess_launcher_close()` is called. Only the source FD should be
closed by the parent process.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2332
2021-02-19 18:27:00 +00:00
Philip Withnall
55a75590d0 gsubprocesslauncher: Don’t close target FDs in close() method
This is a regression introduced in commit 67a589e505. Previously, the
source/target FD pairs were stored in `needdup_fd_assignments`, in
consecutive entries, so source FDs had even indices and target FDs had
odd indices.

I didn’t notice that the array index was being incremented by 2 when
closing FDs, when porting from the old code. So previously the code was
only closing the source FDs; after the port, it was closing source and
target FDs.

That’s incorrect, as the target FDs are just integers in the parent
process. It’s only in the child process where they are actually FDs —
and `g_subprocess_launcher_close()` is never called in the child
process.

This resulted in some strange misbehaviours in any process which used
`g_subprocess_launcher_take_fd()` with target FDs which could have
possibly aliased with other FDs in the parent process (and which weren’t
equal to their mapped source FDs).

Thanks to Olivier Fourdan for the detailed bug report.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2332
2021-02-19 18:27:00 +00:00
Philip Withnall
1e74c52a63 gsubprocesslauncher: Improve documentation formatting slightly
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-19 18:27:00 +00:00
Emmanuel Fleury
23dad977d8 Change SkipAsyncData fields to be gsize (and not gssize) 2021-02-19 18:10:30 +01:00
Sebastian Dröge
b41147dfc9 The ETag returned by various GFile functions is nullable
This was correctly annotated for proper return values but in case of out
parameters it was only annotated as (optional) and not additionally as
(nullable).
2021-02-17 10:01:36 +02:00
Philip Withnall
51e964849b Merge branch '2097-spawn-fd-rewriting' into 'master'
Resolve "GSubprocessLauncher with FD assignment can clash with g_spawn_async internal pipe"

Closes #2097

See merge request GNOME/glib!1690
2021-02-16 14:04:39 +00:00
Philip Withnall
67a589e505 gsubprocess: Use new source/target FD mapping functionality in g_spawn()
This improves performance by eliminating the use of a
`GSpawnChildSetupFunc` in the common case (since that setup code has now
moved into `g_spawn*()` itself), and enables the use of the fix to avoid
the child error reporting FD being overwritten by target FD mappings,
introduced via `g_spawn_async_with_pipes_and_fds()`.

It reworks how the source/target FD mapping is stored within
`GSubprocessLauncher` to match what `g_spawn*()` uses. The two
approaches are equivalent.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2097
2021-02-16 13:44:00 +00:00
Emmanuel Fleury
0dde9f3744 Fix signedness warning in gio/gmemoryoutputstream.c
gio/gmemoryoutputstream.c: In function ‘g_memory_output_stream_seek’:
gio/gmemoryoutputstream.c:792:44: error: comparison of integer expressions of different signedness: ‘goffset’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  792 |   if (priv->realloc_fn == NULL && absolute > priv->len)
      |                                            ^
2021-02-16 13:32:26 +01:00
Emmanuel Fleury
e939550cad Fix signedness warning in gio/gdummyfile.c
gio/gdummyfile.c: In function ‘unescape_string’:
gio/gdummyfile.c:485:32: error: comparison of integer expressions of different signedness: ‘long int’ and ‘size_t’ {aka ‘long unsigned int’}
  485 |   g_warn_if_fail (out - result <= strlen (escaped_string));
      |                                ^~
2021-02-16 13:32:26 +01:00
Emmanuel Fleury
18097c8acb Fix signedness warning in gio/gbufferedinputstream.c:g_buffered_input_stream_seek()
gio/gbufferedinputstream.c: In function ‘g_buffered_input_stream_seek’:
gio/gbufferedinputstream.c:899:18: error: comparison of integer expressions of different signedness: ‘goffset’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  899 |       if (offset <= priv->end - priv->pos && offset >= -priv->pos)
      |                  ^~
gio/gbufferedinputstream.c:899:53: error: comparison of integer expressions of different signedness: ‘goffset’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  899 |       if (offset <= priv->end - priv->pos && offset >= -priv->pos)
      |                                                     ^~
2021-02-16 13:32:26 +01:00
Emmanuel Fleury
ebb3427f22 Fix signedness warnings in gio/gapplication-tool.c
gio/gapplication-tool.c: In function ‘app_help’:
glib/gmacros.h:806:26: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘size_t’ {aka ‘long unsigned int’}
gio/gapplication-tool.c:121:26: note: in expansion of macro ‘MAX’
  121 |               maxwidth = MAX(maxwidth, strlen (_(substvars[i].var)));
      |                          ^~~
gio/gapplication-tool.c: In function ‘app_help’:
glib/gmacros.h:806:26: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘size_t’ {aka ‘long unsigned int’}
gio/gapplication-tool.c:140:20: note: in expansion of macro ‘MAX’
  140 |         maxwidth = MAX(maxwidth, strlen (topics[i].command));
      |                    ^~~
2021-02-16 13:32:26 +01:00
Emmanuel Fleury
02126e0a07 Fix missing initializer warnings in gio/gapplication-tool.c
gio/gapplication-tool.c:51:3: error: missing initializer for field ‘synopsis’ of ‘const struct help_topic’
   51 |   },
      |   ^
gio/gapplication-tool.c:54:3: error: missing initializer for field ‘synopsis’ of ‘const struct help_topic’
   54 |   },
      |   ^
2021-02-16 13:32:26 +01:00
Emmanuel Fleury
e89bd4cc15 Fix several signedness warnings in gio/gapplication-tool.c
gio/gapplication-tool.c: In function ‘app_help’:
gio/gapplication-tool.c:90:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
   90 |       for (i = 0; i < G_N_ELEMENTS (topics); i++)
      |                     ^
gio/gapplication-tool.c:117:25: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  117 |           for (i = 0; i < G_N_ELEMENTS (substvars); i++)
      |                         ^
gio/gapplication-tool.c:121:25: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  121 |           for (i = 0; i < G_N_ELEMENTS (substvars); i++)
      |                         ^
gio/gapplication-tool.c:137:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  137 |       for (i = 0; i < G_N_ELEMENTS (topics); i++)
      |                     ^
gio/gapplication-tool.c:140:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  140 |       for (i = 0; i < G_N_ELEMENTS (topics); i++)
      |                     ^
2021-02-16 13:32:25 +01:00
Emmanuel Fleury
80e2dc3a7a Fix signedness warning in gio/gdbus-tool.c
gio/gdbus-tool.c:1183:95: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’
 1183 |           if ((fd_id = g_unix_fd_list_append (fd_list, g_variant_get_handle (value), &error)) == -1)
      |                                                                                               ^~
2021-02-16 13:32:25 +01:00
Philip Withnall
8323997f3f glocalfileinputstream: Drop custom skip vfunc implementation
Since the previous commit, the generic `GInputStream` implementation of
`skip()` is now equivalent, and results in the same calls to `lseek()`.

Heavily based on an approach by Dan Winship in
https://bugzilla.gnome.org/show_bug.cgi?id=681374.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #587
2021-02-15 23:10:41 +00:00
Philip Withnall
58c6e0e5d4 ginputstream: Don’t skip off the end of resizable streams
The default implementation of `g_input_stream_skip()` can skip off the
end of resizable streams, as that’s the behaviour of `g_seekable_seek()`
for that type of stream.

This has previously been fixed for local file input streams (commit
89f9615835), and a unit test added there.
However, the fix should be more generally made in `GInputStream`.

This commit reworks an old patch by Dan Winship on
https://bugzilla.gnome.org/show_bug.cgi?id=681374, which took that
approach.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #587
2021-02-15 23:10:41 +00:00
Philip Withnall
1e21abf0c4 gtestdbus: Flush stdout and stderr before forking a monitor process
This is a workaround for the fact that forking without execing is not
easy to do correctly, and `GTestDBus` doesn’t do it correctly. However,
`GTestDBus` is de-facto deprecated and so putting any more effort in is
a waste.

This fixes an issue where a test would print duplicate output when
outputting to a fully-buffered FD, such as a pipe. This is because the
buffer is non-empty before the `fork()`, and ends up duplicated in the
parent and child processes, both of which later flush the duplicated
buffer contents.

Diagnosed and fix suggested by Simon McVittie.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2322
2021-02-15 10:33:32 +00:00
Simon McVittie
ee53840fa6 tests: Use a more realistic language code than sv_SV
Swedish as spoken in El Salvador is not listed in
/usr/share/i18n/SUPPORTED, and in any case is probably not what we meant.
A more plausible language code would be Swedish as spoken in Sweden.

Prompted by improving the Debian packaging of GLib to generate most of
the language codes mentioned in the tests, so that we can have better
test coverage.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-02-14 14:43:12 +00:00
Philip Withnall
2f91caf77e tests: Add a basic test for require-same-user D-Bus auth flag
It’s not feasible to test that the require-same-user flag can cause
authentication to fail, as that would require the build environment to
have two users available. We can, however, test that it passes when
authenticating a client and server running under the same user account.

I have manually tested that the new flag works, by running the following
as user A:
```
`$prefix/gdbus-daemon --print-env &`
gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.ListNames
```

And then running the `gdbus call` command again as user B (with the same
value for `DBUS_SESSION_BUS_ADDRESS` in the environment), which
produces:
```
Error connecting: Unexpected lack of content trying to read a line
```
(an authentication rejection)

Commenting out the use of
`G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER` from
`gdbusdaemon.c`, the `gdbus call` command succeeds for both users.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-11 16:12:40 +00:00
Philip Withnall
5d0ffe73b7 gdbusdaemon: Use require-same-user flag to avoid auth observer signal
This doesn’t change the `GDBusDaemon` behaviour, but does simplify the
code a little.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1804
2021-02-11 16:12:40 +00:00
Philip Withnall
1a6aa9a493 gdbus: Add flags to require authentication as the same user
This eliminates a common use case for the
`GDBusAuthObserver::authorize-authenticated-peer` signal, which is often
implemented incorrectly by people.

Suggested by Simon McVittie.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #1804
2021-02-11 16:12:40 +00:00
Philip Withnall
137a9bdcc2 gdbusauth: Use g_clear_object() to simplify the code a little
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-11 16:06:27 +00:00
Philip Withnall
a1db705bc2 Merge branch 'wip/gdbus-flags-from-the-future' into 'master'
gdbus: Reject attempts to set future connection or server flags

See merge request GNOME/glib!1934
2021-02-11 11:53:13 +00:00
Sebastian Dröge
90d34b3078 Merge branch 'keyfile-settings-fix-again' into 'master'
gkeyfilesettingsbackend: Fix basename handling when group is unset

See merge request GNOME/glib!1941
2021-02-11 08:00:00 +00:00
Philip Withnall
68ce7a28e1 tests: Add tests for key name handling in the keyfile backend
This tests the two recent commits.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-10 22:10:00 +00:00
Philip Withnall
a59247608f gkeyfilesettingsbackend: Disallow empty key or group names
These should never have been allowed; they will result in precondition
failures from the `GKeyFile` later on in the code.

A test will be added for this shortly.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-10 21:20:11 +00:00
Philip Withnall
9d27c57f70 gkeyfilesettingsbackend: Fix basename handling when group is unset
Fix an effective regression in commit
7781a9cbd2, which happens when
`convert_path()` is called with a `key` which contains no slashes. In
that case, the `key` is entirely the `basename`.

Prior to commit 7781a9cb, the code worked through a fluke of `i == -1`
cancelling out with the various additions in the `g_memdup()` call, and
effectively resulting in `g_strdup (key)`.

Spotted by Guido Berhoerster.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-10 21:16:39 +00:00
Emmanuel Fleury
bdcd7eca3b Fix missing initializer warning in gio/glib-compile-resources.c
gio/glib-compile-resources.c: In function ‘parse_resource_file’:
gio/glib-compile-resources.c:553:3: error: missing initializer for field ‘passthrough’ of ‘GMarkupParser’ {aka ‘struct _GMarkupParser’}
  553 |   GMarkupParser parser = { start_element, end_element, text };
      |   ^~~~~~~~~~~~~
2021-02-10 20:44:21 +01:00
Emmanuel Fleury
7c7aec9b31 Fix several signedness warnings in gio/gio-tool-tree.c
gio/gio-tool-tree.c: In function ‘do_tree’:
gio/gio-tool-tree.c:124:22: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’
  124 |        for (n = 0; n < level; n++)
      |                      ^
gio/gio-tool-tree.c:197:21: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’
  197 |       for (n = 0; n < level; n++)
      |                     ^
2021-02-10 20:43:58 +01:00
Emmanuel Fleury
a54ebd6860 Fix missing initializer warning in gio/gio-tool-monitor.c
gio/gio-tool-monitor.c:48:3: error: missing initializer for field ‘description’ of ‘GOptionEntry’ {aka ‘const struct _GOptionEntry’}
   48 |   { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &watch_default },
      |   ^
2021-02-10 20:41:16 +01:00
Emmanuel Fleury
85f2492111 Fix signedness warning in gio/gio-tool.c:attribute_flags_to_string()
gio/gio-tool.c: In function ‘attribute_flags_to_string’:
gio/gio-tool.c:171:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  171 |   for (i = 0; i < G_N_ELEMENTS (flag_descr); i++)
      |                 ^
2021-02-10 20:41:16 +01:00
Emmanuel Fleury
6b3e39fafd Fix several missing initializer warnings in gio/glib-compile-schemas.c
gio/glib-compile-schemas.c: In function ‘parse_gschema_files’:
gio/glib-compile-schemas.c:1773:3: error: missing initializer for field ‘passthrough’ of ‘GMarkupParser’ {aka ‘struct _GMarkupParser’}
 1773 |   GMarkupParser parser = { start_element, end_element, text };
      |   ^~~~~~~~~~~~~
gio/glib-compile-schemas.c: In function ‘main’:
gio/glib-compile-schemas.c:2176:5: error: missing initializer for field ‘arg_description’ of ‘GOptionEntry’ {aka ‘struct _GOptionEntry’}
 2176 |     { "allow-any-name", 0, 0, G_OPTION_ARG_NONE, &allow_any_name, N_("Do not enforce key name restrictions") },
      |     ^
2021-02-10 20:41:16 +01:00
Emmanuel Fleury
93f3831ed3 Fix several signedness warnings in gio/glib-compile-schemas.c
gio/glib-compile-schemas.c: In function ‘key_state_set_range’:
gio/glib-compile-schemas.c:376:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  376 |   for (i = 0; i < G_N_ELEMENTS (table); i++)
      |                 ^
gio/glib-compile-schemas.c: In function ‘key_state_serialise’:
gio/glib-compile-schemas.c:714:29: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  714 |               for (i = 0; i < size / sizeof (guint32); i++)
      |                             ^
2021-02-10 20:41:16 +01:00
Emmanuel Fleury
8b1959dafe Fix several signedness warnings in gio/gsettings-mapping.c
gio/gsettings-mapping.c: In function ‘g_settings_set_mapping_int’:
gio/gsettings-mapping.c:65:23: error: comparison of integer expressions of different signedness: ‘gint64’ {aka ‘long int’} and ‘long unsigned int’
   65 |       if (0 <= l && l <= G_MAXUINT64)
      |                       ^~
gio/gsettings-mapping.c: In function ‘g_settings_set_mapping_float’:
gio/gsettings-mapping.c:120:23: error: comparison of integer expressions of different signedness: ‘gint64’ {aka ‘long int’} and ‘long unsigned int’
  120 |       if (0 <= l && l <= G_MAXUINT64)
      |                       ^~
gio/gsettings-mapping.c: In function ‘g_settings_get_mapping_int’:
gio/gsettings-mapping.c:224:27: error: comparison of integer expressions of different signedness: ‘gint64’ {aka ‘long int’} and ‘long unsigned int’
  224 |       return (0 <= l && l <= G_MAXUINT64);
      |                           ^~
gio/gsettings-mapping.c: In function ‘g_settings_get_mapping_float’:
gio/gsettings-mapping.c:269:27: error: comparison of integer expressions of different signedness: ‘gint64’ {aka ‘long int’} and ‘long unsigned int’
  269 |       return (0 <= l && l <= G_MAXUINT64);
      |                           ^~
2021-02-10 20:41:16 +01:00
Emmanuel Fleury
a5e3be4a0c Adding a missing test on integer overflow within g_http_proxy_connect()
Fixes #2315
2021-02-09 18:07:20 +00:00
Philip Withnall
3e5e7aa8e9 Merge branch 'master' into 'master'
Add support for Tilix and Konsole

See merge request GNOME/glib!1923
2021-02-09 11:09:59 +00:00
Philip Withnall
57a5ed3d08 tests: Fix leak of dlopened module in pollable test
Coverity CID: #1446243

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-09 11:06:53 +00:00
Philip Withnall
652026b9d1 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!1918
2021-02-09 10:45:51 +00:00
Simon McVittie
ba25c8a770 gdbus: Reject attempts to set future connection or server flags
The GDBusConnectionFlags and GDBusServerFlags can affect how we carry
out authentication and authorization, either making it more or less
restrictive, so it's desirable to "fail closed" if a program is compiled
against a new version of GLib but run against an old version.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-02-08 13:35:16 +00:00
Simon McVittie
df4501316c tls-interaction: Add test coverage for various ways to set the password
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-02-08 10:22:48 +00:00
Simon McVittie
61bb52ec42 gtlspassword: Fix inverted assertion
The intention here was to assert that the length of the password fits
in a gssize. Passwords more than half the size of virtual memory are
probably excessive.

Fixes: a8b204ff "gtlspassword: Forbid very long TLS passwords"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-02-08 10:05:15 +00:00
Emmanuel Fleury
05c311a961 Fix several missing initializer in gio/gsettingsschema.c:parse_into_text_tables()
gio/gsettingsschema.c: In function ‘parse_into_text_tables’:
gio/gsettingsschema.c:682:3: error: missing initializer for field ‘passthrough’ of ‘GMarkupParser’ {aka ‘struct _GMarkupParser’}
  682 |   GMarkupParser parser = { start_element, end_element, text };
      |   ^~~~~~~~~~~~~
gio/gsettingsschema.c:683:3: error: missing initializer for field ‘gettext_domain’ of ‘TextTableParseInfo’ [-Werror=missing-field-initializers]
  683 |   TextTableParseInfo info = { summaries, descriptions };
      |   ^~~~~~~~~~~~~~~~~~
2021-02-08 11:00:33 +01:00
Emmanuel Fleury
7c32b1173a Fix signedness warning in gio/gmenu.c:g_menu_remove()
gio/gmenu.c: In function ‘g_menu_remove’:
gio/gmenu.c:483:47: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
  483 |   g_return_if_fail (0 <= position && position < menu->items->len);
      |                                               ^
2021-02-08 11:00:33 +01:00
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
Emmanuel Fleury
6e3d30a105 Fix signedness warnings in gio/gcredentials.c
gio/gcredentials.c: In function ‘linux_ucred_check_valid’:
gio/gcredentials.c:317:22: error: comparison of integer expressions of different signedness: ‘uid_t’ {aka ‘unsigned int’} and ‘int’
  317 |       || native->uid == -1
      |                      ^~
gio/gcredentials.c:318:22: error: comparison of integer expressions of different signedness: ‘gid_t’ {aka ‘unsigned int’} and ‘int’
  318 |       || native->gid == -1)
      |                      ^~

gio/gcredentials.c: In function ‘g_credentials_set_unix_user’:
gio/gcredentials.c:639:29: error: comparison of integer expressions of different signedness: ‘uid_t’ {aka ‘unsigned int’} and ‘int’
  639 |   g_return_val_if_fail (uid != -1, FALSE);
      |                             ^~
2021-01-11 20:45:27 +01:00
Krzesimir Nowak
a2525129a7 tests: Update the expected count in file test
We added another desktop file, so update the file count.
2021-01-09 16:00:50 +01:00
Krzesimir Nowak
cdf0a50c69 gdesktopappinfo: Fix validation of XDG_CURRENT_DESKTOP
Split out XDG_CURRENT_DESKTOP handling to a separate function and make
sure that it drops all the invalid entries properly. Earlier a bad
entry could slip through the checks by sitting just after another bad
entry, like in env being set to `invalid1!:invalid2!`, where
`invalid2!` could slip the checks.
2021-01-09 15:39:09 +01:00
Philip Withnall
46097e9b8e Merge branch 'wip/baedert/gparam' into 'master'
glocalfile: Fix an uninitialized variable

See merge request GNOME/glib!1860
2021-01-08 14:07:57 +00:00
crvi
e789e50f12 docs: update g_action_group_activate_action() remote activation semantics
Refer https://gitlab.gnome.org/GNOME/glib/-/issues/2284
2021-01-08 11:07:16 +00:00
Philip Withnall
d90d914fc5 tests: Add more debug information to gdbus-connection-slow
It occasionally fails in CI with output like:
```
196/274 glib:gio / gdbus-connection-slow        FAIL     0.54 s (killed by signal 6 SIGABRT)

--- command ---
G_TEST_BUILDDIR='/builds/pwithnall/glib/_build/gio/tests' G_TEST_SRCDIR='/builds/pwithnall/glib/gio/tests' GIO_MODULE_DIR='' /builds/pwithnall/glib/_build/gio/tests/gdbus-connection-slow
--- stdout ---
\# random seed: R02S4eb186e89e2472eedd11538b37192543
1..2
\# Start of gdbus tests
\# Start of connection tests
Bail out! GLib-GIO:ERROR:../gio/tests/gdbus-connection-slow.c:98:test_connection_flush: assertion failed (error == NULL): Child process killed by signal 11 (g-exec-error-quark, 19)
--- stderr ---
**
GLib-GIO:ERROR:../gio/tests/gdbus-connection-slow.c:98:test_connection_flush: assertion failed (error == NULL): Child process killed by signal 11 (g-exec-error-quark, 19)
cleaning up pid 12991
```

which is not very helpful. Add some more debug output to print the
stdout and stderr of the child process, to hopefully give an insight
into why it’s dying with signal 11 (sigsegv).

I can’t reproduce the sigsegv locally.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-07 17:55:21 +00:00
Philip Withnall
793f824a2e gsettingsschema: Ignore GSETTINGS_SCHEMA_DIR when running setuid
As with previous commits, this could have been used to load private data
for an unprivileged caller.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2168
2021-01-07 15:02:25 +00:00
Philip Withnall
e2b5094cdb gresource: Ignore G_RESOURCE_OVERLAYS when running as setuid
It could have been used to load private data which would not normally be
accessible to an unprivileged caller.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2168
2021-01-07 15:02:25 +00:00
Philip Withnall
45d01e5aa9 gdesktopappinfo: Validate XDG_CURRENT_DESKTOP before using it
Its components are used to build filenames, so if the value of
`XDG_CURRENT_DESKTOP` comes from an untrusted caller (as can happen in
setuid programs), using it unvalidated may be unsafe.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2168
2021-01-07 15:02:25 +00:00
Philip Withnall
dba585d020 gdbusaddress: Ignore D-Bus addresses from the environment when setuid
As with the previous commit, it’s unsafe to trust the environment when
running as setuid, as it comes from an untrusted caller. In particular,
with D-Bus, the caller could set up a fake ‘system’ bus which fed
incorrect data to this process.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2168
2021-01-07 15:02:25 +00:00
Philip Withnall
ba414ee100 giomodule: Ignore GIO_MODULE_DIR when running as setuid
Even if the modules in the given directory never get chosen to be used,
loading arbitrary code from a user-provided directory is not safe when
running as setuid, as the process’ environment comes from an untrusted
source.

Also ignore `GIO_EXTRA_MODULES`.

Spotted by Simon McVittie.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2168
2021-01-07 15:02:24 +00:00
Sebastian Dröge
65271eb93d Merge branch 'fix/default-windows-socket-udp-behavior' into 'master'
gsocket: Improve default UDP behavior on Windows

See merge request GNOME/glib!1844
2021-01-07 14:09:19 +00:00
Frederic Martinsons
16dfd2033f Annotate function parameters with G_GNUC_UNUSED when necessary
(Tweaked by Philip Withnall to reformat code with `black`)

Closes #1105

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-06 18:35:17 +00:00
Timm Bäder
c983ded09f glocalfile: Fix an uninitialized variable
Clang says:

../gio/glocalfile.c:2090:11: warning: variable 'success' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
      if (trashdir == NULL)
          ^~~~~~~~~~~~~~~~
../gio/glocalfile.c:2133:12: note: uninitialized use occurs here
      if (!success)
           ^~~~~~~
../gio/glocalfile.c:2090:7: note: remove the 'if' if its condition is always true
      if (trashdir == NULL)
      ^~~~~~~~~~~~~~~~~~~~~
../gio/glocalfile.c:2041:23: note: initialize the variable 'success' to silence this warning
      gboolean success;
                      ^
                       = 0

So just do that.
2021-01-06 17:36:32 +01:00
Sebastian Dröge
587b46fec3 Merge branch 'sophie-h-master-patch-90719' into 'master'
Add nullable annotation for g_file_get_uri_scheme

See merge request GNOME/glib!1840
2021-01-06 08:55:47 +00:00
Sophie Herold
b3740ac5b0 Add nullable annotation for g_file_get_uri_scheme 2021-01-06 08:55:47 +00:00
Sebastian Dröge
b777b4caaa Merge branch 'fix/socket-use-after-close' into 'master'
gsocket: Fix use-after-close

See merge request GNOME/glib!1845
2021-01-06 08:42:01 +00:00
Sebastian Dröge
609d1e292f Merge branch 'fix/android-system-checks' into 'master'
build: Fix Android system checks

See merge request GNOME/glib!1856
2021-01-06 08:34:52 +00:00
Ole André Vadla Ravnås
ea0c4bf045 build: Fix inconsistent Android host system checks
To match the value in the Meson reference table for "Operating system
names", and our checks elsewhere.
2021-01-06 01:12:31 +01:00
Ole André Vadla Ravnås
0ab51f8d4e gwin32: Always use unicode APIs
Instead of the legacy ANSI ones. This also means GLib behaves correctly
when built with unicode preprocessor defines.
2021-01-05 21:42:59 +01:00
Ole André Vadla Ravnås
17c53b5f16 gsocket: Don't call WSAEnumNetworkEvents if socket is closed
Makes Application Verifier happy.
2021-01-05 21:20:38 +01:00
Ole André Vadla Ravnås
d01588f37e gsocket: Don't bother updating select mask if socket is closed 2021-01-05 21:20:34 +01:00
Pascal Buhler
9cd134d9fb gsocket: Improve default UDP behavior on Windows
An ICMP port unreachable will result in a socket error, which is a
really bad default for UDP sockets.
2021-01-05 21:08:15 +01:00
Philip Withnall
01b77666bc Merge branch '2275-gio-script-local' into 'master'
completion: Declare variables as local in gio completion script

Closes #2275

See merge request GNOME/glib!1839
2021-01-05 16:27:44 +00:00
Philip Withnall
2ca4d865b2 completion: Declare variables as local in gio completion script
Most variables were, but a few were not declared as local, and hence
leaked into the calling environment every time someone tab-completed the
`gio` command.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2275
2021-01-05 16:14:16 +00:00
Sebastian Dröge
d752d3be3b Merge branch 'update-gvdb' into 'master'
Update gvdb

See merge request GNOME/glib!1834
2021-01-05 10:37:57 +00:00
Sebastian Dröge
87e8eb67c3 Merge branch '1283-trash-wording' into 'master'
glocalfile: Improve wording for error messages about trash directories

Closes #1283

See merge request GNOME/glib!1825
2021-01-04 15:07:31 +00:00
Philip Withnall
7f2af262bf glocalfile: Improve wording for error messages about trash directories
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #1283
2021-01-04 14:43:54 +00:00
Philip Withnall
9716a26ab6 Merge branch '1281-to-pixdata-docs' into 'master'
gresource: Document the `to-pixdata` option as being deprecated

Closes #1281

See merge request GNOME/glib!1826
2021-01-04 12:58:42 +00:00
Philip Withnall
0c85348efc Merge branch 'appinfo-shellany-uwplaunch' into 'master'
GWin32AppInfo: support getting info about UWP apps and launching them

Closes #1991

See merge request GNOME/glib!1772
2021-01-04 12:55:58 +00:00
Ole André Vadla Ravnås
9ac3a27f03 gsocket: Fix credentials error-handling on Apple OSes
- When querying a TCP socket, getsockopt() may succeed but the resulting
  `optlen` will be zero. This means we'd previously be reading
  uninitialized stack memory in such cases.
- After a file-descriptor has gone through FD-passing, getsockopt() may
  fail with EINVAL. At least this is the case with TCP sockets.
- While at it also use SOL_LOCAL instead of hard-coding its value.
2021-01-04 12:29:47 +00:00
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
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
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
Руслан Ижбулатов
c816d074c3 GWin32AppInfo: fix a leak 2020-12-23 01:47:01 +00:00
Руслан Ижбулатов
d33c3747dc GWin32AppInfo: invert verb comparison function
The list is sorted in ascending order, which means that to put
verbs alphabetically we need to sort ealier verbs with -1. Same for
the "open" verb and the preferred verb (if any).
2020-12-23 01:46:33 +00:00
Руслан Ижбулатов
48d96b21f9 GWin32AppInfo: enforce chosen handler on UWP apps, use URI verbs
* UWP apps that have low registry footprint might end up with chosen_handler == NULL.
Ensure that this doesn't happen.
* UWP apps don't need verbs for URIs, but we do need verbs to have a link to an app
(since handlers don't contain app fields). Work around this by adding an "open" verb
to each UWP URI handler.
* Duplicate the code that inserts extension handler verbs into the app to also insert
URI handler verbs. This allows URI-only apps to be used correctly later on (otherwise
GLib errors out, saying that the app has no verbs).
2020-12-23 01:46:11 +00:00
Руслан Ижбулатов
a2f823113c GWin32AppInfo: read UWP handler metadata (indirect strings)
Have to use of SHLoadIndirectString() from shell32.dll for this, no
way around that.
2020-12-23 01:46:10 +00:00
Руслан Ижбулатов
a2c287bf9f GWin32AppInfo: be less picky about names
Use pretty name as the result of _name(), if available. This is
more in line with what .desktop files return. Canonical name
may be completely unintelligible.
2020-12-23 01:45:20 +00:00
Руслан Ижбулатов
e7a738711b GWin32AppInfo: be more permissive about verbs in capable apps
MSDN doesn't say much on this subject, but i've seen apps in the wild
that have the "shell" subkey with verbs *either* in the root app key *or*
in the "Capabilities" subkey of the root key. Accommodate either case by trying both
(root key gets a priority, since this is how MS Address Book is registered -
assume that MS knows how to do this the right way).
2020-12-23 01:44:47 +00:00
Руслан Ижбулатов
10def41dc5 GWin32AppInfo: simplify appinfo wait condition 2020-12-23 01:44:34 +00:00
Руслан Ижбулатов
4c3a61e221 GWin32AppInfo: use g_new() instead of g_malloc() 2020-12-23 01:43:39 +00:00
Руслан Ижбулатов
f28b75e9ff GWin32AppInfo: Support launching UWP applications 2020-12-23 01:43:38 +00:00
Руслан Ижбулатов
0ea2f34723 GWin32AppInfo: more checks for UWP apps
UWP apps have no exectuables or commandlines. Check for that.
2020-12-23 01:43:38 +00:00
Руслан Ижбулатов
720b51032c GWin32AppInfo: Support getting information about UWP apps 2020-12-23 01:43:38 +00:00
Руслан Ижбулатов
e9b09911f6 gio: Add g_win32_package_parser_enum_packages()
This function enumerates all user-accessible UWP packages
and calls the user-provided callback for each package.

This can be used to make GLib aware of the UWP applications
installed in the system.

The function works by using IPackageManager/IPackage UWP interfaces
and XmlLite COM library to parse package manifests.

The function requires COM, and initializes it to a single-thread
appartment model. To ensure this doesn't break anything, either
only use it in a separate thread (COM is initialized on a per-thread
basis), or make sure that the main thread also uses the same COM
model (it's OK to initialize COM multiple times, as long as the same
model is used and as long as init/uninit calls are paired correctly).
2020-12-23 01:43:38 +00:00
Руслан Ижбулатов
2773c06bd4 gio: Add private headers with missing UWP/COM types
MinGW-w64 lacks the appropriate headers, so we have to add them
here. Note that these only have the C versions (normally these
things come in both C and C++ flavours), since that's what we use.

Also note that some of the functions that we don't use (but must
describe to maintain binary compatibility) were altered to use
IUnknown (basically, an untyped pointer) instead of the appropriate
object types, as adding these types would require other types,
which would pull even more types, forcing us to drag half of the
UWP headers in here. By replacing unused types with IUnknown we
can trim a lot of branches from the dependency graph.
2020-12-23 01:35:51 +00:00
Руслан Ижбулатов
895fc2eff2 gio: add GWin32FileSyncStream
This is a COM object that implements IStream by using a HANDLE
and WinAPI file functions to access the file (only a file; pipes
are not supported). Only supports synchronous access (this is
a feature - the APIs that read from this stream internally will
never return the COM equivalent of EWOULDBLOCK, which greatly
simplifies their use).
2020-12-23 01:35:39 +00:00
Руслан Ижбулатов
fdfa9236a2 GWin32AppInfo: Store UWP AppUserModelId for a handler
Could be used later on to launch UWP apps.

UWP apps need verbs, but we don't have any code to get UWP app
info yet.
2020-12-23 01:33:28 +00:00
Philip Withnall
b63e9889a8 gresource: Document the to-pixdata option as being deprecated
Just embed a PNG instead. gdk-pixbuf deprecated its pixdata support in
version 2.32, in 2015.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #1281
2020-12-22 18:42:05 +00:00
Philip Withnall
8cec87ff46 glocalfile: Clarify an error message slightly
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-12-22 18:22:37 +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
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