Commit Graph

7154 Commits

Author SHA1 Message Date
Ondrej Holy
757cc93520 Merge branch 'unix-mount-for-docs' into 'main'
gunixmounts: Document NULL return value for g_unix_mount_for()

See merge request GNOME/glib!2145
2021-06-15 15:29:58 +00:00
Simon McVittie
e0b6b8037d Distinguish more clearly between wait status and exit status
On Unix platforms, wait() and friends yield an integer that encodes
how the process exited. Confusingly, this is usually not the same as
the integer passed to exit() or returned from main(): conceptually it's
an integer encoding of this tagged union:

    enum { EXITED, SIGNALLED, ... } tag;
    union {
        int exit_status;         /* if EXITED */
        struct {
            int terminating_signal;
            bool core_dumped;
        } terminating_signal;    /* if SIGNALLED */
        ...
    } detail;

Meanwhile, on Windows, wait statuses and exit statuses are
interchangeable.

I find that it's clearer what is going on if we are consistent about
referring to the result of wait() as a "wait status", and the value
passed to exit() as an "exit status".

GSubprocess already gets this right: g_subprocess_get_status() returns
the wait status, while g_subprocess_get_exit_status() genuinely returns
the exit status. However, the GSpawn family of APIs has tended to
conflate the two.

Confusingly, g_spawn_check_exit_status() has always checked a wait
status, and it would not be correct to pass an exit status to it; so
let's deprecate it in favour of g_spawn_check_wait_status(), which
does the same thing that g_spawn_check_exit_status() always did.
Code that needs backwards-compatibility with older GLib can use:

    #if !GLIB_CHECK_VERSION(2, 69, 0)
    #define g_spawn_check_wait_status(x) (g_spawn_check_exit_status (x))
    #endif

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-15 14:33:14 +01:00
Simon McVittie
f2be22ca52 subprocess test: Check wait status correctly
Confusingly, g_spawn_check_exit_status() takes a wait status, not an
exit status, so passing g_subprocess_get_exit_status() to it is
incorrect (although both encodings happen to use 0 to encode success
and a nonzero value to encode failure, so in practice this probably
had the desired effect).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-15 14:32:33 +01:00
Philip Withnall
bd8d139a77 tests: Add missing wakeup calls to gdbus-names.c
Following on from the previous commit, some explicit
`g_main_context_wakeup()` calls were missing from the test code which
only uses `GMainContext`.

Add them, and also add some assertions to check that these functions are
being called in the expected thread (as the code comments say).

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-15 13:48:03 +01:00
Philip Withnall
031e5020ee Merge branch 'wip/pwithnall/local-file-monitor-deadlock' into 'main'
glocalfilemonitor: Avoid a deadlock on finalization

See merge request GNOME/glib!2155
2021-06-15 12:24:51 +00:00
Philip Withnall
8530a6a8e4 tests: Add missing wakeup calls to gdbus-names test
The tests in `gdbus-names.c` use a mixture of `GMainLoop` and iterating
a `GMainContext` directly. Some of the helper functions based around the
`OwnNameData` struct use the `loop` `GMainLoop` even when called from
tests like `watch_with_different_context()` which themselves use
`GMainContext` directly.

Thus, it’s possible for the `GMainLoop` to not be running, while the
test is iterating on `g_main_context_iteration()`. In this case,
`g_main_loop_quit()` is a no-op and will not wake up the `GMainContext`.
This causes the test to livelock in around 1 in 1200 test runs.

Fix this by adding an explicit `g_main_context_wakeup()` call after each
`g_main_loop_quit()` call. A more comprehensive fix would be to port all
the tests in this file to iterating `GMainContext` directly, and drop
all the `GMainLoop` usage, but I don’t have time for that right now.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-15 13:01:28 +01:00
Philip Withnall
838dc04c76 glocalfilemonitor: Avoid a deadlock on finalization
If `g_file_monitor_source_dispatch()` drops the last reference to its
`GLocalFileMonitor`, a deadlock will occur, because disposing the
`GLocalFileMonitor` causes synchronous disposal of the
`GFileMonitorSource`, and hence an attempt to re-lock the already-locked
mutex in the `GFileMonitorSource`.

Fix that by dropping the reference to the `GLocalFileMonitor` after
unlocking.

Diagnosed by Ting-Wei Lan. The bug was originally introduced by me in
commit 592a13b483.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-14 15:09:52 +01:00
Philip Withnall
e522768ef4 tests: Allow GResource external data tests to use llvm-objcopy
Relax the requirement for the test to only be compiled/run under gcc,
since a version of LLVM was released which supports `--add-symbol`.

`objcopy` should be overrideable to be `llvm-objcopy` by using a machine
file as per https://mesonbuild.com/Machine-files.html#binaries.

Suggested and tested by Grigory Vasilyev.

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

Fixes: #2423
2021-06-14 14:49:59 +01:00
Philip Withnall
de74a70b7e Merge branch 'try-tls-binding-tests-again' into 'main'
Revert "tests: Deactivate tls-bindings test suite for windows"

See merge request GNOME/glib!2130
2021-06-10 12:46:12 +00:00
Philip Withnall
76ecdeffd0 Merge branch '2409-application-must-be-registered' into 'main'
gapplication: Guard g_application_mark_busy()

Closes #2409

See merge request GNOME/glib!2111
2021-06-10 12:44:13 +00:00
Philip Withnall
055f7c6bc5 gdbusconnection: Fix a typo in a code comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-10 12:37:23 +01:00
Philip Withnall
ee716d9159 docs: Fix capitalisation of ‘GUID’ in a few places
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-10 12:37:11 +01:00
Philip Withnall
c794261a40 docs: Expand documentation about D-Bus GUIDs
Clarify that the terms ‘GUID’ and ‘UUID’ are used interchangeably in the
context of D-Bus, and that neither of them are an RFC 4122 UUID.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-10 12:36:25 +01:00
Ross Wollman
4d3618cbd1 tls: expose SAN details on GTlsCertificate
This changeset exposes

* `dns-names`
* `ip-addresses`

on GTlsCertificate provided by the underlying TLS Backend.

See https://gitlab.gnome.org/GNOME/glib-networking/-/merge_requests/165 for the corresponding glib-networking changes.

Relates: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2113
Relates: https://gitlab.gnome.org/GNOME/glib-networking/-/merge_requests/156/diffs
Relates: https://github.com/microsoft/playwright/issues/6759
2021-06-10 00:54:45 +00:00
Philip Withnall
0362bf5d64 gunixmounts: Document when g_unix_mount_at() returns NULL
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-09 16:01:44 +01:00
Philip Withnall
165a0baa15 gunixmounts: Document NULL return value for g_unix_mount_for()
It will return `NULL` if the path doesn’t exist.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-09 15:53:32 +01:00
Philip Withnall
9ed66b21dd Merge branch 'confusing_errors' into 'main'
gdbusconnection: removed a confusing message

Closes #793

See merge request GNOME/glib!2118
2021-06-09 12:49:04 +00:00
nitinosiris
5e2986ea2c gdbusconnection: removed a confusing message
The message `No such interface %s on object at path %s`
displayed when requested object does not exist, which was kind of
confusing.

Closes #793
2021-06-08 21:07:21 +05:30
Philip Withnall
2b4e8521e8 Merge branch 'fix/accidental-dllexport' into 'main'
gdbus, win32: Fix accidental dllexport in static builds

See merge request GNOME/glib!2139
2021-06-07 14:54:46 +00:00
Philip Withnall
6e92c2c233 Merge branch '2348-rename-master' into 'master'
Rename default development branch to main

Closes #2348

See merge request GNOME/glib!2140
2021-06-07 13:22:34 +00:00
Philip Withnall
1a43d950b4 docs: Update various external links to use HEAD instead of master
Update several links to allow the remote to use its configured default
branch name, rather than specifying `master` as the default branch name.
This will help avoid breakage if any of these projects rename their
default branch in the future.

Fix a few of the links where they were hitting redirects or had moved.

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

Helps: #2348
2021-06-07 14:03:48 +01:00
Ole André Vadla Ravnås
92c4ae1c62 gdbus, win32: Fix accidental dllexport in static builds
Should only dllexport g_win32_run_session_bus() when building a DLL.
2021-06-07 13:57:59 +02:00
Philip Withnall
4fd789c160 tests: Add missing setlocale() call to file tests
This ensures that non-ASCII characters in the test output are printed
correctly in the logs.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-07 12:44:58 +01:00
Philip Withnall
b1ebb72522 glocalfileoutputstream: Fix ETag check when replacing through a symlink
Since commit 87e19535fe, the ETag check when writing out a file through
a symlink (following the symlink) has been incorrectly using the ETag
value of the symlink, rather than the target file. This is incorrect
because the ETag should represent the file content, not its metadata or
links to it.

Fix that, and add a unit test.

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

Fixes: #2417
2021-06-07 12:44:52 +01:00
Philip Withnall
b407d46c9a Merge branch '2416-tls-certificate-fix-invalid-read' into 'master'
tests/tls-certificate: Add a unit test

Closes #2416

See merge request GNOME/glib!2136
2021-06-07 08:36:12 +00:00
Peter Bloomfield
f0a1671161 tests/tls-certificate: Add context to the new test
Add a comment to `pem_parser_no_sentinel()` to explain what it is
testing and how it works.
2021-06-05 10:14:24 -04:00
Peter Bloomfield
39f661b070 tlscertificate: Avoid possible invalid read
In various places, do not read past the end of the data.
Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2416
2021-06-04 20:46:44 -04:00
Peter Bloomfield
b9d07813d8 tests/tls-certificate: Add a unit test
Test whether g_tls_certificate_new_from_pem() can handle a
non-nul-terminated PEM.

Helps https://gitlab.gnome.org/GNOME/glib/-/issues/2416
2021-06-04 20:40:16 -04:00
Philip Withnall
205045e5c7 Merge branch 'wip/issue-1884' into 'master'
gsettings: Resolve child schemas from the parent's schema source

Closes #1884

See merge request GNOME/glib!2132
2021-06-04 12:09:24 +00:00
Christian Persch
2632ed7a69 gsettings: Resolve child schemas from the parent's schema source 2021-06-04 12:09:24 +00:00
Philip Withnall
02b298cf08 Merge branch 'mcatanzaro/tls-info' into 'master'
tls: add functions to get protocol version and ciphersuite name

See merge request GNOME/glib!2077
2021-06-04 11:14:46 +00:00
Gaël Bonithon
df500c68a4 inotify: Fix a memory leak
Fixes: #2311
2021-06-03 19:04:48 +02:00
Michael Catanzaro
bf37392045 tls: add functions to get protocol version and ciphersuite name
This adds g_tls_connection_get_protocol_version(),
g_tls_connection_get_ciphersuite_name(), and DTLS variants. This will
allow populating TLS connection information in the WebKit web inspector.

This is WIP because we found it's not quite possibly to implement
correctly with GnuTLS. See glib-networking!151.
2021-06-03 10:56:15 -05:00
Philip Withnall
e02b905b4b Revert "tests: Deactivate tls-bindings test suite for windows"
This reverts commit 7f2fef5c26.

There have been some changes to the gitlab-ci-win32-runner pre-clone
script which should be more successful at killing the remaining
processes after this test. See
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2008#note_1127126
2021-06-03 13:01:29 +01:00
Philip Withnall
04739eb4fd Merge branch '2227-gdbus-nullability' into 'master'
gdbus: Add various missing (nullable) or (not nullable) annotations

See merge request GNOME/glib!2123
2021-06-03 09:17:28 +00:00
Philip Withnall
ac8f4a0db5 gdbus: Add various missing (nullable) or (not nullable) annotations
This is the result of checking each `Returns:` line in these files. I’ve
only considered nullability and not other (potentially missing or
incorrect) annotations.

Including suggestions by Simon McVittie.

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

Helps: #2227
2021-06-03 10:02:37 +01:00
Philip Withnall
11c0b2e597 Merge branch 'pgriffis/pkcs11-password' into 'master'
gtlspassword: Add flags signifying PIN type for PKCS#11

See merge request GNOME/glib!2126
2021-06-02 10:06:06 +00:00
Michael Catanzaro
7a51163cf9 Merge branch 'feature/cert-info' into 'master'
tls: expose cert details on GTlsCertificate

See merge request GNOME/glib!2113
2021-06-01 20:25:21 +00:00
Patrick Griffis
e750f7a145 gtlspassword: Add flags signifying PIN type for PKCS#11
In a PKCS#11 operation there are multiple types of PINs possibly
needed and these flags add a way to expose them to the user.

This design exactly matches gnutls' gnutls_pin_flag_t API.
2021-06-01 14:56:56 -05:00
Ross A. Wollman
a17c28790a tls: expose cert details on GTlsCertificate
This changeset exposes

* `not-valid-before`
* `not-valid-after`
* `subject-name`
* `issuer-name`

on GTlsCertificate provided by the underlying TLS Backend.

In order to make use of these changes,
see the related [glib-networking MR][glib-networking].

This change aims to help populate more of the [`Certificate`][wk-cert]
info in the WebKit Inspector Protocol on Linux.

This changeset stems from work in Microsoft Playwright to [add more info
into its HAR capture][pw] generated from the Inspector Protocol events
and will bring feature parity across WebKit platforms.

[wk-cert]: 8afe31a018/Source/JavaScriptCore/inspector/protocol/Security.json
[pw]: https://github.com/microsoft/playwright/pull/6631
[glib-networking]: https://gitlab.gnome.org/GNOME/glib-networking/-/merge_requests/156
2021-06-01 16:24:33 +00:00
Emmanuel Fleury
aace697d7e Fix missing initializer warning in gio/tests/gdbus-exit-on-close.c
gio/tests/gdbus-exit-on-close.c:52:14: warning: missing field 'bug' initializer
      { NULL }
             ^
2021-05-27 10:16:52 +02:00
Emmanuel Fleury
652a7b7db1 Fix missing initializer warnings in gio/tests/socket.c
gio/tests/socket.c:505:36: warning: missing field 'size' initializer
    GOutputVector v[7] = { { NULL, }, };
                                   ^
gio/tests/socket.c:630:37: warning: missing field 'vectors' initializer
    GOutputMessage m[3] = { { NULL, }, };
                                    ^
gio/tests/socket.c:631:37: warning: missing field 'vectors' initializer
    GInputMessage im[3] = { { NULL, }, };
                                    ^
gio/tests/socket.c:632:36: warning: missing field 'size' initializer
    GOutputVector v[7] = { { NULL, }, };
                                   ^
gio/tests/socket.c:633:36: warning: missing field 'size' initializer
    GInputVector iv[7] = { { NULL, }, };
                                   ^
gio/tests/socket.c:871:32: warning: missing field 'vectors' initializer
    GInputMessage im = { NULL, };
                               ^
gio/tests/socket.c:872:31: warning: missing field 'size' initializer
    GInputVector iv = { NULL, };
                              ^
2021-05-27 10:16:52 +02:00
Peter Bloomfield
955307208f gapplication: Guard g_application_mark_busy()
The `GApplication` must be registered before calling
`g_application_mark_busy()`. Document that, and add a guard.

The same is true for `g_application_unmark_busy()`, but the existing
documentation and guard for `busy_count > 0` are enough.
2021-05-17 11:50:12 -04:00
Philip Withnall
f71faad46b Merge branch 'th/gdbus-doc-unsubscribe-idle' into 'master'
gdbus: document completion after idle action for g_dbus_connection_signal_unsubscribe()

See merge request GNOME/glib!2050
2021-05-17 10:49:38 +00:00
Philip Withnall
62571c71b5 Merge branch 'Docs' into 'master'
docs: Improved documentation of GNotification

Closes #2405

See merge request GNOME/glib!2102
2021-05-17 10:30:55 +00:00
Nitin Wartkar
e727a69a8b docs: Improved documentation of GNotification 2021-05-17 10:30:54 +00:00
nitinosiris
69be87dda1 docs: Improved the docs of helper getters optimization in g_file_info.c
g_file_info_get_name() gives result faster than g_file_info_get_attribute_byte_string()

Closes #310
2021-05-17 14:26:17 +05:30
Philip Withnall
87e994ef48 Merge branch '1036-dbus-proxy-docs' into 'master'
gdbusproxy: Recommend it is not used for stateless services

Closes #1036

See merge request GNOME/glib!386
2021-05-13 22:25:21 +00:00
Philip Withnall
43c28fcd5a gdbusproxy: Recommend it is not used for stateless services
For the reasons given in the new bit of documentation, GDBusProxy should
not be used for connecting to stateless D-Bus services which may be
restarted at any point.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1036
2021-05-13 22:24:26 +01:00
Philip Withnall
7e9585177d tests: Drop use of g_test_bug_base()
Include the base URI in the `g_test_bug()` calls instead. This resolves
inconsistencies between the old bug base (bugzilla.gnome.org) and the
new bug base (gitlab.gnome.org). It also has the advantage that the URI
passed to `g_test_bug()` is now clickable in the code editor, rather
than being split across two locations.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/275#note_303175

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-05-13 22:16:27 +01:00
Emmanuel Fleury
e952248dc2 Use G_OPTION_ENTRY_NULL to avoid missing initializer warnings 2021-05-13 20:16:46 +00:00
Philip Withnall
53834ee319 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings (clang)

See merge request GNOME/glib!2091
2021-05-13 12:04:42 +00:00
Philip Withnall
56ddba7c34 Merge branch 'serializ' into 'master'
docs: Standardize spelling of serializ*

Closes #2399

See merge request GNOME/glib!2096
2021-05-13 11:37:11 +00:00
Emmanuel Fleury
82fc86dcd4 Fix missing initializer warning in gio/gio-tool-info.c
gio/gio-tool-info.c:41:10: warning: missing field 'short_name' initializer
  { NULL }
         ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
8a3e184db9 Fix missing initializer warning in gio/gio-tool-copy.c
gio/gio-tool-copy.c:50:10: warning: missing field 'short_name' initializer
  { NULL }
         ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
c395e865bf Fix missing initializer warning in gio/gio-tool-cat.c
gio/gio-tool-cat.c:42:10: warning: missing field 'short_name' initializer
  { NULL }
         ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
27454ed557 Fix missing initializer warning in gio/glib-compile-schemas.c
gio/glib-compile-schemas.c:2181:12: warning: missing field 'short_name' initializer
    { NULL }
           ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
4301110174 Fix missing initializer warning in gio/tests/socket-client.c
gio/tests/socket-client.c:37:8: warning: missing field 'short_name' initializer
  {NULL}
       ^
2021-05-13 12:57:14 +02:00
Emmanuel Fleury
689b9b545f Fix missing initializer warning in gio/tests/socket-server.c
gio/tests/socket-server.c:43:8: warning: missing field 'short_name' initializer
  {NULL}
       ^
2021-05-13 12:57:14 +02:00
Geyslan G. Bem
6b867cd474 docs: Standardize spelling of serializ*
Changes serialis* to serializ*.

Fixes: #2399

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
2021-05-10 15:28:12 -03:00
Thomas Haller
b0157af9a6 gdbus: document completion after idle action for g_dbus_connection_signal_unsubscribe()
Since commit ab285899a6 ('gdbusconnection: Document main context
iteration for unsubscript'), we document when the user is guaranteed
that all resources are gone after g_dbus_connection_signal_unsubscribe().
This is not merely an implementation detail, it's something that the
user needs to be able to rely on. It is good that this is documented.

However, libnm does something different ([1]). It registers to several D-Bus
signals without providing a GDestroyNotify. After unsubscription, it schedules
another idle action with lower priority and uses that to know when
cleanup is complete. I think this is a useful alternative and should
also be guaranteed and documented to work.

Also note that this isn't just some implementation detail that currently
happens to work. GDBusConnection tightly integrates with GMainContext and it
works by scheduling idle sources with G_PRIORITY_DEFAULT priority. It needs to
schedule all events with this same priority, otherwise the ordering is not
preserved. At this point, with GDBusConnection working this way, this is no longer
something that can reasonably be any different. It's how GDBusConnection fundamentally
works, and a user must be able to rely on that. As such, this new promise isn't
something that we would want to break in the future.

Thus document it.

[1] a55c10c6cb/src/libnm-client-impl/nm-client.c (L7918)
2021-05-10 13:16:05 +02:00
Emmanuel Fleury
e3453f39dd Fix missing initializer in gio/tests/fake-service-name.c
gio/tests/fake-service-name.c:55:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
   55 | };
      | ^
2021-05-06 22:54:53 +02:00
王滋涵 Zephyr Wang
940f9b497d gcredentials.h: Fix comment typo 2021-05-06 02:42:21 +00:00
Clayton Craft
44277865da
gthreadedresolver: don't ignore flags in lookup_by_name_with_flags
This fixes a bug where the family flag was ignored in lookup_data_new,
causing the resolver to call getaddrinfo with no hints set when clearly
the family hint should have been set.
2021-04-30 23:20:02 -07:00
Philip Withnall
be57c5d14c gdtlsconnection: Fix a check for a vfunc being implemented
It was checking the wrong vfunc; likely a copy/paste error.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-04-29 13:17:05 +01:00
Emmanuel Fleury
180c1a18d9 Fix several missing initializer warnings in gio/tests/basic-application.c
gio/tests/basic-application.c: In function ‘startup’:
gio/tests/basic-application.c:57:5: error: missing initializer for field ‘padding’ of ‘GActionEntry’ {aka ‘struct _GActionEntry’}
   57 |     { "new", new_activated, NULL, NULL, NULL },
      |     ^
gio/tests/basic-application.c:58:5: error: missing initializer for field ‘padding’ of ‘GActionEntry’ {aka ‘struct _GActionEntry’}
   58 |     { "quit", quit_activated, NULL, NULL, NULL },
      |     ^
gio/tests/basic-application.c:59:5: error: missing initializer for field ‘padding’ of ‘GActionEntry’ {aka ‘struct _GActionEntry’}
   59 |     { "action1", action1_activated, NULL, NULL, NULL },
      |     ^
gio/tests/basic-application.c:60:5: error: missing initializer for field ‘padding’ of ‘GActionEntry’ {aka ‘struct _GActionEntry’}
   60 |     { "action2", action2_activated, "b", "false", change_action2 }
      |     ^
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
4a503bdbd7 Fix several missing initializer warnings in gio/tests/dbus-appinfo.c
gio/tests/dbus-appinfo.c:177:3: error: missing initializer for field ‘parameter_type’ of ‘GActionEntry’ {aka ‘const struct _GActionEntry’}
  177 |   { "frob",         test_application_frob              },
      |   ^
gio/tests/dbus-appinfo.c:178:3: error: missing initializer for field ‘parameter_type’ of ‘GActionEntry’ {aka ‘const struct _GActionEntry’}
  178 |   { "tweak",        test_application_tweak             },
      |   ^
gio/tests/dbus-appinfo.c:179:3: error: missing initializer for field ‘parameter_type’ of ‘GActionEntry’ {aka ‘const struct _GActionEntry’}
  179 |   { "twiddle",      test_application_twiddle           },
      |   ^
gio/tests/dbus-appinfo.c:180:3: error: missing initializer for field ‘parameter_type’ of ‘GActionEntry’ {aka ‘const struct _GActionEntry’}
  180 |   { "quit",         test_application_quit              }
      |   ^
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
4ad62f7fab Fix signedness warning in gio/tests/readwrite.c
gio/tests/readwrite.c: In function ‘verify_iostream’:
gio/tests/readwrite.c:77:17: error: comparison of integer expressions of different signedness: ‘gboolean’ {aka ‘int’} and ‘size_t’ {aka ‘long unsigned int’}
   77 |   g_assert (res == strlen (original_data) - 15);
      |                 ^~
2021-04-29 12:40:05 +02:00
Emmanuel Fleury
a965262004 Fix several signedness warnings in gio/tests/unix-streams.c
gio/tests/unix-streams.c: In function ‘test_write_async_wouldblock’:
gio/tests/unix-streams.c:692:17: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
  692 |   for (i = 0; i < 4 * pipe_capacity; i++)
      |                 ^
gio/tests/unix-streams.c: In function ‘test_writev_async_wouldblock’:
gio/tests/unix-streams.c:780:17: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
  780 |   for (i = 0; i < 4 * pipe_capacity; i++)
      |                 ^
2021-04-29 12:39:51 +02:00
Marco Trevisan (Treviño)
63873c0eb1 application: Unset the registered state after shutting down
An application that has been shut down is still marked as registered
even if its implementation has been already destroyed.

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

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

Added tests
2021-04-27 17:11:10 +02:00
Marco Trevisan (Treviño)
1000acade7 gdbus-tool: Actually use argv[0] basename as program name
We initialize it but never actually use.
2021-04-27 15:41:57 +02:00
Sebastian Dröge
3e2f31c858 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2048
2021-04-23 09:37:28 +00:00
Emmanuel Fleury
e642562fff Add extra documentation about the return values of g_seekable_tell() 2021-04-23 10:43:05 +02:00
Emmanuel Fleury
59acf6950c Fix missing initializer warning in gio/tests/gdbus-example-server.c
gio/tests/gdbus-example-server.c:280:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  280 | };
      | ^
2021-04-23 10:43:05 +02:00
Emmanuel Fleury
f587095cfc Fix signedness warning in gio/tests/socket-common.c
gio/tests/socket-common.c: In function ‘socket_address_from_string’:
gio/tests/socket-common.c:50:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
   50 |   for (i = 0; i < G_N_ELEMENTS (unix_socket_address_types); i++)
      |                 ^
2021-04-23 10:43:05 +02:00
Emmanuel Fleury
bac08a4b26 Fix several missing initializer warnings in gio/tests/gdbus-example-subtree.c
gio/tests/gdbus-example-subtree.c:76:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
   76 | };
      | ^
gio/tests/gdbus-example-subtree.c:190:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  190 | };
      | ^
gio/tests/gdbus-example-subtree.c:228:1: error: missing initializer for field ‘get_property’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  228 | };
      | ^
gio/tests/gdbus-example-subtree.c:325:1: error: missing initializer for field ‘padding’ of ‘GDBusSubtreeVTable’ {aka ‘const struct _GDBusSubtreeVTable’}
  325 | };
      | ^
2021-04-23 10:43:05 +02:00
Emmanuel Fleury
cb0b4b00df Fix missing initializer warning in gio/tests/gnotification-server.c
gio/tests/gnotification-server.c: In function ‘g_notification_server_bus_acquired’:
gio/tests/gnotification-server.c:224:3: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  224 |   };
      |   ^
2021-04-23 10:43:05 +02:00
Emmanuel Fleury
d255962abb Fix missing initializer warning in gio/tests/gdbus-non-socket.c
gio/tests/gdbus-non-socket.c:116:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  116 | };
      | ^
2021-04-23 10:43:05 +02:00
Emmanuel Fleury
2187406f70 Fix signedness warning in gio/tests/gdbus-proxy.c
gio/tests/gdbus-proxy.c: In function ‘strv_equal’:
gio/tests/gdbus-proxy.c:158:32: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
  158 |     res = g_strv_length (strv) == count;
      |                                ^~
2021-04-23 10:43:05 +02:00
Emmanuel Fleury
401ff06614 Fix signedness warning in gio/gkeyfilesettingsbackend.c
gio/gkeyfilesettingsbackend.c: In function ‘convert_path’:
gio/gkeyfilesettingsbackend.c:155:15: warning: comparison of integer
expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’}
and ‘gint’ {aka ‘int’}
  155 |   if (key_len < kfsb->prefix_len ||
      |               ^
2021-04-23 10:42:52 +02:00
Emmanuel Fleury
f2be8c74e5 Fix signedness warnings in gio/ginputstream.c
gio/ginputstream.c: In function ‘g_input_stream_real_skip’:
gio/ginputstream.c:431:21: warning: comparison of integer expressions of
different signedness: ‘goffset’ {aka ‘long int’} and ‘long unsigned int’
  431 |           if (start > G_MAXSIZE - count || start + count > end)
      |                     ^
gio/ginputstream.c:431:58: warning: comparison of integer expressions of
different signedness: ‘long unsigned int’ and ‘goffset’ {aka ‘long int’}
  431 |           if (start > G_MAXSIZE - count || start + count > end)
      |                                                          ^
2021-04-22 14:13:17 +02:00
Patrick Griffis
e926efe8e2 docs: Fix formatting of code block 2021-04-19 11:58:35 -05:00
Sophie Herold
98c3710522 Add nullable annotations in GUnixMountEntry 2021-04-18 18:13:08 +02:00
demotomohiro
e724e6ed04
Fix typo in g_socket_listener_accept_async()'s comment 2021-04-16 23:08:09 +09:00
Emmanuel Fleury
fd926b1ea7 Fix missing initializer in gio/tests/gdbus-example-peer.c
gio/tests/gdbus-example-peer.c:120:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  120 | };
      | ^
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
1c084ca717 Fix missing initializer warning in gio/tests/gdbus-example-export.c
gio/tests/gdbus-example-export.c:229:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  229 | };
      | ^
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
4d52358fe2 Fix signedness warning in gio/tests/gsettings.c
gio/tests/gsettings.c: In function ‘strv_set_equal’:
gio/tests/gsettings.c:2268:41: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
 2268 |     res = g_strv_length ((gchar**)strv) == count;
      |                                         ^~
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
83a9ba7790 Fix missing initializer warning in gio/tests/gdbus-testserver.c
gio/tests/gdbus-testserver.c:806:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  806 | };
      | ^
In file included from gio/gio.h:53,
                 from gio/tests/gdbus-testserver.c:1:
gdbusconnection.h:395:12: note: ‘padding’ declared here
  395 |   gpointer padding[8];
      |            ^~~~~~~
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
5133acdaff Fix multiple signedness warnings in gio/tests/gdbus-testserver.c
gio/tests/gdbus-testserver.c: In function ‘handle_method_call’:
gio/tests/gdbus-testserver.c:334:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  334 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:343:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  343 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:352:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  352 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:361:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  361 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:370:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  370 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:379:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  379 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:388:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  388 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:397:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  397 |         for (i = 0; i < n_elts; i++)
      |                       ^
gio/tests/gdbus-testserver.c:406:23: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  406 |         for (i = 0; i < n_elts; i++)
      |                       ^
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
c3c1f6c4b9 Fix signedness warning in gio/tests/mimeapps.c
gio/tests/mimeapps.c: In function ‘strv_equal’:
gio/tests/mimeapps.c:31:32: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
   31 |     res = g_strv_length (strv) == count;
      |                                ^~
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
e7aec308e9 Fix signedness warning in gio/tests/proxy-test.c
gio/tests/proxy-test.c: In function ‘do_echo_test’:
gio/tests/proxy-test.c:855:25: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  855 |   for (total = 0; total < nwrote; total += nread)
      |                         ^
2021-04-15 10:19:29 +02:00
Emmanuel Fleury
8608eccf9a Fix signedness warning in gio/tests/file.c
gio/tests/file.c: In function ‘written_cb’:
gio/tests/file.c:358:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘size_t’ {aka ‘long unsigned int’}
  358 |   if (data->pos < strlen (data->data))
      |                 ^
2021-04-15 10:19:29 +02:00
Sebastian Dröge
55d18fd3dc Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2040
2021-04-15 07:24:57 +00:00
Emmanuel Fleury
4d1f76ec50 Fix signedness warning in gio/tests/gdbus-test-codegen.c
gio/tests/gdbus-test-codegen.c: In function ‘check_object_manager’:
gio/tests/gdbus-test-codegen.c:2344:20: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’
 2344 |   if (om_signal_id != -1)
      |                    ^~
2021-04-15 00:00:22 +02:00
Emmanuel Fleury
34cd8a98c7 Fix signedness warning in gio/tests/testfilemonitor.c
gio/tests/testfilemonitor.c: In function ‘check_expected_events’:
gio/tests/testfilemonitor.c:124:39: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’}
  124 |   for (i = 0, li = 0, l = recorded; i < n_expected && l != NULL;)
      |                                       ^
2021-04-14 23:43:36 +02:00
Emmanuel Fleury
0a741d85a7 Fix signedness warning in gio/tests/socket.c
gio/tests/socket.c: In function ‘test_get_available’:
gio/tests/socket.c:1696:53: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘long unsigned int’
 1696 |           if (g_socket_get_available_bytes (server) > sizeof (data))
      |                                                     ^
2021-04-14 23:43:25 +02:00
Emmanuel Fleury
5595b65476 Fix multiple missing initializer warnings in gio/tests/gdbus-export.c
gio/tests/gdbus-export.c:130:1: error: missing initializer for field ‘properties’ of ‘GDBusInterfaceInfo’ {aka ‘const struct _GDBusInterfaceInfo’}
  130 | };
      | ^
In file included from gio/gio.h:57,
                 from gio/tests/gdbus-export.c:21:
gio/gdbusintrospection.h:156:25: note: ‘properties’ declared here
  156 |   GDBusPropertyInfo   **properties;
      |                         ^~~~~~~~~~
...
2021-04-14 23:26:15 +02:00
Emmanuel Fleury
60d2cfb6ae Fix missing initializer warning in gio/tests/gdbus-connection.c
gio/tests/gdbus-connection.c:90:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
   90 | };
      | ^
2021-04-14 23:26:15 +02:00
Philip Withnall
13ba8d82ab gtask: Clarify what counts as ‘too many tasks’ for rate limiting
However, GLib still can’t guarantee to do rate limiting, as the type of
rate limiting which is appropriate depends on what tasks are being run,
and the GTask thread pool is shared between all tasks (of many different
types) in a process space.

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

Fixes: #2368
2021-04-14 11:38:13 +01:00
Philip Withnall
f5dc0ec489 giotypes: Document refcounting of source object for GAsyncReadyCallback
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2343
2021-04-14 11:11:21 +01:00
Emmanuel Fleury
00323ac0e1 Fix several signedness warnings in gio/tests/actions.c
gio/tests/actions.c: In function ‘strv_set_equal’:
gio/tests/actions.c:177:41: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
  177 |     res = g_strv_length ((gchar**)strv) == count;
      |                                         ^~
gio/tests/actions.c: In function ‘test_parse_detailed’:
gio/tests/actions.c:473:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  473 |   for (i = 0; i < G_N_ELEMENTS (testcases); i++)
      |                 ^
2021-04-08 13:24:54 +02:00
Emmanuel Fleury
c3d558df77 Fix multiple missing initializer warnings in gio/tests/actions.c
gio/tests/actions.c: In function ‘test_entries’:
gio/tests/actions.c:375:5: error: missing initializer for field ‘parameter_type’ of ‘GActionEntry’ {aka ‘const struct _GActionEntry’}
  375 |     { "foo",    activate_foo                                     },
      |     ^
In file included from gio/gio.h:31,
                 from gio/tests/actions.c:1:
gio/gactionmap.h:63:16: note: ‘parameter_type’ declared here
   63 |   const gchar *parameter_type;
      |                ^~~~~~~~~~~~~~
...
2021-04-08 13:24:54 +02:00
Emmanuel Fleury
0710429598 Fix missing initializer warning in gio/tests/gdbus-peer-object-manager.c
gio/tests/gdbus-peer-object-manager.c: In function ‘mock_interface_get_vtable’:
gio/tests/gdbus-peer-object-manager.c:111:3: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘struct _GDBusInterfaceVTable’}
  111 |   };
      |   ^
2021-04-08 13:24:54 +02:00
Emmanuel Fleury
e3f6d4a08b Fix several missing initializer warnings in gio/tests/gdbus-peer.c
gio/tests/gdbus-peer.c:262:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  262 | };
      | ^
gio/tests/gdbus-peer.c:1263:1: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
 1263 | };
      | ^
2021-04-08 13:24:54 +02:00
Emmanuel Fleury
7c909db13a Fix multiple missing initializer warning in gio/tests/g-file.c
gio/tests/g-file.c: In function ‘test_g_file_new_for_path’:
gio/tests/g-file.c:114:7: error: missing initializer for field ‘path3’ of ‘const struct TestPathsWithOper’
  114 |       {"/", TRUE, 0, "/./"},
      |       ^
gio/tests/g-file.c:115:7: error: missing initializer for field ‘path3’ of ‘const struct TestPathsWithOper’
  115 |       {"//", TRUE, 0, "//"},
      |       ^
...
2021-04-08 13:24:54 +02:00
Sebastian Dröge
afceb250ce Merge branch 'fix-annotation' into 'master'
Fix annotation of count arguments

See merge request GNOME/glib!2033
2021-04-08 06:56:30 +00:00
Emmanuel Fleury
d936ff10e6 Fix several signedness warnings in gio/tests/network-address.c
gio/tests/network-address.c: In function ‘main’:
gio/tests/network-address.c:1194:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
 1194 |   for (i = 0; i < G_N_ELEMENTS (host_tests); i++)
      |                 ^
gio/tests/network-address.c:1201:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
 1201 |   for (i = 0; i < G_N_ELEMENTS (uri_tests); i++)
      |                 ^
gio/tests/network-address.c:1208:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
 1208 |   for (i = 0; i < G_N_ELEMENTS (address_tests); i++)
      |                 ^
gio/tests/network-address.c:1215:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
 1215 |   for (i = 0; i < G_N_ELEMENTS (address_tests); i++)
      |                 ^
2021-04-07 10:33:16 +02:00
Emmanuel Fleury
c216f2299d Fix several missing initializer warnings in gio/tests/gsubprocess.c
gio/tests/gsubprocess.c: In function ‘test_communicate_async’:
gio/tests/gsubprocess.c:774:3: error: missing initializer for field ‘running’ of ‘TestAsyncCommunicateData’
  774 |   TestAsyncCommunicateData data = { flags, 0, };
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
gio/tests/gsubprocess.c: In function ‘test_communicate_utf8_async’:
gio/tests/gsubprocess.c:1025:3: error: missing initializer for field ‘running’ of ‘TestAsyncCommunicateData’
 1025 |   TestAsyncCommunicateData data = { flags, 0, };
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
gio/tests/gsubprocess.c: In function ‘test_communicate_utf8_cancelled_async’:
gio/tests/gsubprocess.c:1058:3: error: missing initializer for field ‘running’ of ‘TestAsyncCommunicateData’
 1058 |   TestAsyncCommunicateData data = { flags, 0, };
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
gio/tests/gsubprocess.c: In function ‘test_communicate_utf8_async_invalid’:
gio/tests/gsubprocess.c:1202:3: error: missing initializer for field ‘running’ of ‘TestAsyncCommunicateData’
 1202 |   TestAsyncCommunicateData data = { flags, 0, };
      |   ^~~~~~~~~~~~~~~~~~~~~~~~
2021-04-07 10:33:16 +02:00
Emmanuel Fleury
b07fdb6e4a Fix signedness warning in gio/tests/converter-stream.c:g_expander_converter_convert()
gio/tests/converter-stream.c: In function ‘g_expander_converter_convert’:
gio/tests/converter-stream.c:128:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’}
  128 |       for (i = 0; i < block_size; i++)
      |                     ^
2021-04-07 10:33:16 +02:00
Emmanuel Fleury
56e25d81f6 Fix several signedness warnings in gio/tests/converter-stream.c:g_compressor_converter_convert()
gio/tests/converter-stream.c: In function ‘g_compressor_converter_convert’:
gio/tests/converter-stream.c:234:23: error: comparison of integer expressions of different signedness: ‘long int’ and ‘gsize’ {aka ‘long unsigned int’}
  234 |       if (in_end - in < block_size)
      |                       ^
gio/tests/converter-stream.c:244:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’}
  244 |       for (i = 0; i < block_size; i++)
      |                     ^
gio/tests/converter-stream.c:257:33: error: comparison of integer expressions of different signedness: ‘long int’ and ‘gsize’ {aka ‘long unsigned int’}
  257 |       if (v == 0 && in_end - in == block_size && (flags & G_CONVERTER_INPUT_AT_END) == 0)
      |                                 ^~
2021-04-07 10:33:16 +02:00
Emmanuel Fleury
cc1e7302f3 Fix signedness warning in gio/tests/converter-stream.c:test_expander()
gio/tests/converter-stream.c: In function ‘test_expander’:
gio/tests/converter-stream.c:356:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
  356 |   for (i = 0; i < sizeof(unexpanded_data); i++)
      |                 ^
2021-04-07 10:33:16 +02:00
Emmanuel Fleury
d2c0fd468c Fix several signedness warnings in gio/tests/converter-stream.c:test_compressor()
gio/tests/converter-stream.c: In function ‘test_compressor’:
gio/tests/converter-stream.c:445:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’}
  445 |   for (i = 0; i < expanded_size; i++)
      |                 ^
gio/tests/converter-stream.c:454:16: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’}
  454 |    g_assert (i == expanded_size -1);
      |                ^~
2021-04-07 10:33:16 +02:00
Emmanuel Fleury
29cd18b044 Fix several signedness warnings in gio/tests/converter-stream.c:test_converter_pollable()
gio/tests/converter-stream.c: In function ‘test_converter_pollable’:
gio/tests/converter-stream.c:1077:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’}
 1077 |   for (i = 0; i < expanded_size; i++)
      |                 ^
gio/tests/converter-stream.c:1086:16: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’}
 1086 |    g_assert (i == expanded_size -1);
      |                ^~
2021-04-07 10:33:16 +02:00
demotomohiro
56d5d9eda6
Fix annotation of count arguments 2021-04-07 04:13:26 +09:00
Benjamin Berg
40a46d1346 gsocks5proxy: Handle EOF when reading from a stream
The code did not handle EOF (0 byte read) correctly. This can e.g. cause
an infinite loop if an incorrect socks proxy is configured.

Add the appropriate checks and return an G_IO_ERROR_CONNECTION_CLOSED
error if EOF is encountered.
2021-04-06 17:01:03 +02:00
Philip Withnall
1059b7eae1 Merge branch 'mcatanzaro/coverity' into 'master'
Fix a handful of minor leaks found by Coverity

See merge request GNOME/glib!2027
2021-04-05 16:44:35 +00:00
Emmanuel Fleury
eafc764bb2 Fix several signedness warnings in gio/tests/converter-stream.c:main()
gio/tests/converter-stream.c: In function ‘main’:
gio/tests/converter-stream.c:1220:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
 1220 |   for (i = 0; i < G_N_ELEMENTS (compressor_tests); i++)
      |                 ^
gio/tests/converter-stream.c:1223:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
 1223 |   for (i = 0; i < G_N_ELEMENTS (truncation_tests); i++)
      |                 ^
gio/tests/converter-stream.c:1226:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
 1226 |   for (i = 0; i < G_N_ELEMENTS (charset_tests); i++)
      |                 ^
2021-04-05 12:03:51 +02:00
Emmanuel Fleury
88253f171c Fix signedness warning in gio/tests/contenttype.c
gio/tests/contenttype.c: In function ‘test_tree’:
gio/tests/contenttype.c:337:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
  337 |   for (i = 0; i < G_N_ELEMENTS (tests); i++)
      |                 ^
2021-04-05 12:03:51 +02:00
Emmanuel Fleury
8bcb2b9e76 Fix several signedness warnings in gio/tests/contexts.c
gio/tests/contexts.c: In function ‘test_context_specific_emit’:
gio/tests/contexts.c:379:21: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint32’ {aka ‘int’}
  379 |       for (i = 0; i < g_test_rand_int_range (1, 5); i++)
      |                     ^
gio/tests/contexts.c:383:55: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  383 |         while (g_atomic_int_get (&observed_values[i]) != n)
      |                                                       ^~
gio/tests/contexts.c:387:41: error: comparison of integer expressions of different signedness: ‘gint64’ {aka ‘long int’} and ‘guint64’ {aka ‘long unsigned int’}
  387 |             if (g_get_monotonic_time () > expiry)
      |                                         ^
2021-04-05 12:03:51 +02:00
Emmanuel Fleury
a7d3ecca77 Fix signedness warning in gio/gsettings-tool.c
gio/gsettings-tool.c: In function ‘gsettings_list_children’:
gio/gsettings-tool.c:199:30: error: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘gint’ {aka ‘int’}
  199 |     if (strlen (children[i]) > max)
      |                              ^
2021-04-05 12:03:51 +02:00
Emmanuel Fleury
0214d892ba Fix unecessary assert with always true assertions in gio/gresource-tool.c
gio/gresource-tool.c: In function ‘elf_foreach_resource_section’:
gio/gresource-tool.c:190:22: error: comparison of unsigned expression in ‘>= 0’ is always true
  190 |   g_assert (shstrndx >= 0);
      |                      ^~
gio/gresource-tool.c:193:19: error: comparison of unsigned expression in ‘>= 0’ is always true
  193 |   g_assert (shnum >= 0);
      |                   ^~
2021-04-05 12:03:51 +02:00
Emmanuel Fleury
1f23770bc3 Fix signedness warning in gio/gunixsocketaddress.c
gio/gunixsocketaddress.c: In function ‘g_unix_socket_address_to_native’:
gio/gunixsocketaddress.c:217:15: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’}
  217 |   if (destlen < socklen)
      |               ^
2021-04-05 12:03:51 +02:00
Emmanuel Fleury
5fec112453 Fix signedness warning in gio/giomodule.c
gio/giomodule.c: In function ‘print_help’:
glib/gmacros.h:806:26: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’}
  806 | #define MAX(a, b)  (((a) > (b)) ? (a) : (b))
      |                          ^
../glib.git/gio/giomodule.c:733:19: note: in expansion of macro ‘MAX’
  733 |           width = MAX (width, strlen (g_io_extension_get_name (extension)));
      |                   ^~~
2021-04-05 12:03:51 +02:00
Michael Catanzaro
8bfc299813 gfileenumerator: fix leak in error path
Found by Coverity.
2021-04-01 14:28:10 -05:00
Michael Catanzaro
719484a575 gdbusobjectmanagerservice: fix leak in error path
If the third g_return_val_if_fail() is hit, then we leak
orig_object_path. There is no reason we need to strdup it here.

Found by Coverity.
2021-04-01 14:28:10 -05:00
Michael Catanzaro
2b29495bcb gdbusauth: fix error leak
local_error is leaked in the G_IO_ERROR_NOT_SUPPORTED case. Found by
Coverity.
2021-04-01 14:28:10 -05:00
Michael Catanzaro
65b4bc30eb gapplication: fix arguments leak in error path
If this g_return_val_if_fail() is ever hit, then we leak arguments.
This is not very important because if your code hits
g_return_val_if_fail() you are invoking undefined behavior, a rather
more serious problem, but let's replace it with g_critical() to be
robust.

This includes a small behavior change: it returns 1 rather than 0 in
this error case.

Found by Coverity.
2021-04-01 14:27:31 -05:00
Thomas Haller
090eeabe9c gdbus: simplify error handling in g_dbus_connection_send_message_unlocked()
"goto out" is a fine pattern, especially when we are not using
cleanup attribute macros.

But in this case it was unnecessary.
2021-03-31 20:56:45 +02:00
Thomas Haller
60d4092a2c gdbus: refactor duplicate code for freeing FilterData 2021-03-31 20:56:45 +02:00
Philip Withnall
f0afc3ed53 Merge branch 'remove-shgetfileinfo' into 'master'
GWin32Mount: Remove SHGetFileInfoW()

Closes #2096

See merge request GNOME/glib!2020
2021-03-31 13:49:36 +00:00
Руслан Ижбулатов
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