Commit Graph

23838 Commits

Author SHA1 Message Date
Philip Withnall
3029f9a05b Merge branch 'fix_more_warnings' into 'main'
Fix more warnings

See merge request GNOME/glib!2192
2021-07-21 21:07:27 +00:00
Philip Withnall
e74c955335 Merge branch 'g_mod' into 'main'
API: Add g_module_open_full()

Closes #203

See merge request GNOME/glib!2169
2021-07-21 21:07:06 +00:00
Philip Withnall
be012a8067 giomodule: Port to new g_module_open_full() API
Port all existing calls in GLib to the new API so that they can receive
more detailed error information (although none of them actually make use
of it at the moment).

This also serves to test the new API better through use.

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

Helps: #203
2021-07-21 21:54:35 +01:00
nitinosiris
ee589aaa32 API: Add g_module_open_full()
g_module_open_full() is wrapper around g_module_open() function
which returns a GError in case of failure.

Closes #203
2021-07-21 21:45:51 +01:00
Emmanuel Fleury
5e0bcbf8fe Fix signedness warning in glib/grand.c
glib/grand.c:271:17: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'long long unsigned int'
   for (i = 0; i < G_N_ELEMENTS (seed); i++)
                 ^
2021-07-21 13:49:48 +02:00
Emmanuel Fleury
28dcec03e1 Fix cast from pointer to integer of different size warnings in glib/gthread-win32.c
glib/gthread-win32.c: In function 'g_private_get_impl':
glib/gthread-win32.c:310:16: warning: cast from pointer to integer of different size
   DWORD impl = (DWORD) key->p;
                ^
glib/gthread-win32.c:315:14: warning: cast from pointer to integer of different size
       impl = (DWORD) key->p;
              ^
glib/gthread-win32.c: In function 'SetThreadName':
glib/gthread-win32.c:596:60: warning: passing argument 4 of 'RaiseException' from incompatible pointer type
    RaiseException (EXCEPTION_SET_THREAD_NAME, 0, infosize, (DWORD *) &info);
                                                            ^~~~~~~~~~~~~~~
2021-07-21 13:49:48 +02:00
Emmanuele Bassi
92540e76d7 Merge branch 'language-names-suppressions' into 'main'
glib.supp: Expand match kinds for g_get_language_names() suppressions

See merge request GNOME/glib!2193
2021-07-20 15:41:41 +00:00
Philip Withnall
a2216f8caa glib.supp: Expand match kinds for g_get_language_names() suppressions
See https://discourse.gnome.org/t/how-to-correct-read-ini-files-using-glib/6987/10

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-07-20 16:26:11 +01:00
Yuri Chornoivan
5a458f11a0 Update Ukrainian translation 2021-07-19 16:04:35 +00:00
Philip Withnall
bdbe65dd40 Merge branch 'nsec-typo' into 'main'
glocalfileinfo: Fix usec/nsec confusion with filetimes on Windows

See merge request GNOME/glib!2182
2021-07-14 10:45:47 +00:00
Philip Withnall
1c673dd078 Merge branch 'DarkTrick-main-patch-46211' into 'main'
Clarify GValue documentation

See merge request GNOME/glib!2178
2021-07-12 10:40:33 +00:00
DarkTrick
80189ca892 Clarify GValue documentation 2021-07-12 10:40:33 +00:00
Philip Withnall
8a4816f119 Merge branch 'fix-detection-of-trash-folders' into 'main'
Fix for issue "gio trash doesnt recognize existing trash directory ..."

Closes #2439

See merge request GNOME/glib!2185
2021-07-12 10:19:25 +00:00
markus
648994dba4 glocalfile: Fix the global trash dir detection
The `g_file_trash` function fails with the `Unable to find or create trash
directory` error when the global `.Trash` directory exists. This is because
the commit 7f2af262 introduced the `gboolean success` variable to signalize
the detection of the trash folder, but didn't set it in all code branches.
Since for a time this variable was not initialized the bug wasn't visible
when the trash folder existed. The bug became effective after the `success`
variable was initialized with `FALSE` by the commit c983ded0. Let's explicitly
set the `success` variable in all branches to fix the global trash dir
detection.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2439
2021-07-12 11:08:25 +01:00
Philip Withnall
cd93c350a2 Merge branch 'fix/gclosure-invoke-type-annotation' into 'main'
gclosure: Fix the invoke() return_value annotation

See merge request GNOME/glib!2181
2021-07-09 11:52:07 +00:00
Philip Withnall
b5556a2c68 gspawn: Use CLOSE_RANGE_CLOEXEC if available
It’s a new flag added to `close_range()` in kernel 5.11, which will
allow us to speed up setting `CLOEXEC` on ranges of file descriptors.

This currently happens in some situations when executing a new binary
with `GSpawn`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-07-09 12:40:47 +01:00
Philip Withnall
cfe8a0bd75 Merge branch 'main' into 'main'
correctly use 3 parameters for close_range

See merge request GNOME/glib!2180
2021-07-09 11:23:56 +00:00
Philip Withnall
7e8163b30b glocalfileinfo: Fix usec/nsec confusion with filetimes on Windows
The function which calls `SetFileTime()` works with seconds and
nanosecond, but the functions which call it are doing so with seconds
and microseconds.

Fix them so they convert to nanoseconds first.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-07-09 12:00:31 +01:00
Philip Withnall
dda45b0493 glocalfileinfo: Fix a typo in a file time utility function
The code appears to be dealing with time in units of 100ns, not 100µs,
so name the variable accordingly.

The rest of the arithmetic in that function appears consistent and
correct.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-07-09 11:52:23 +01:00
Ole André Vadla Ravnås
9c01c1ebee gclosure: Fix the invoke() return_value annotation
The return value must be initialized by the caller, as is clear from
GLib's internal callers, and e.g. dummy_closure_marshal() on the callee
side.
2021-07-09 02:43:54 +02:00
Khem Raj
b71117d894 correctly use 3 parameters for close_range
libc implementation has 3 parameter e.g.
https://www.freebsd.org/cgi/man.cgi?query=close_range&sektion=2&format=html

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2021-07-08 17:26:43 -07:00
Philip Withnall
7743dc889b Merge branch 'issue-2058' into 'main'
win32: Check and avoid using TLS index 0

Closes #2058

See merge request GNOME/glib!2148
2021-07-08 11:27:17 +00:00
Philip Withnall
05d5b404d4 Merge branch 'time' into 'main'
gio/tests/g-file-info: don't assume million-in-one events don't happen

See merge request GNOME/glib!2177
2021-07-08 10:36:26 +00:00
Ross Burton
289f8be1b3 gio/tests/g-file-info: don't assume million-in-one events don't happen
The modification time test creates a file, gets the modification time in
seconds, then gets the modification time in microseconds and assumes
that the difference between the two has to be above 0.

As rare as this may be, it can happen:

$ stat g-file-info-test-50A450 -c %y
2021-07-06 18:24:56.000000767 +0100

Change the test to simply assert that the difference not negative to
handle this case.
2021-07-06 19:32:54 +01:00
Philip Withnall
0b2f48022b 2.69.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-07-06 14:47:35 +01:00
Philip Withnall
36fe868b05 Merge branch 'thread' into 'main'
GThreadPool: Add g_thread_pool_new_full()

Closes #121

See merge request GNOME/glib!2170
2021-07-02 14:35:18 +00:00
nitinosiris
75db4883fc GThreadPool: Add g_thread_pool_new_full()
g_thread_pool_new_full() is similar to g_thread_pool_new()
but with GDestroyNotify argument.

Closes #121
2021-07-02 18:42:59 +05:30
Philip Withnall
847f3e36db Merge branch 'icecc' into 'main'
data-to-c.py: generate new-line at the end of the file

See merge request GNOME/glib!2174
2021-07-02 13:12:42 +00:00
Michael Olbrich
3b452cb164 data-to-c.py: generate new-line at the end of the file
This is necessary when building glib with icecc. Icecc splits the build
process into two parts. The file is locally preprocessed with
-fdirectives-only to resolve any includes. This adds linemarkers to the
intermediate file. Without the new-line at the end of the file this:

 #include "gconstructor_as_data.h"
 #include "glib/glib-private.h"

Is turned into this:

const char gconstructor_code[] = "...";# 1 "glib/glib-private.h"
...

The result is a compile error:

In file included from ../glib/gio/glib-compile-resources.c:45:
gio/gconstructor_as_data.h:1: error: stray '#' in program
gio/gconstructor_as_data.h:1: error: expected identifier or '(' before numeric constant
In file included from ../glib/glib/glib-private.h:22,
                 from gio/gconstructor_as_data.h:2,
                 from ../glib/gio/glib-compile-resources.c:45:
../glib/glib/gwakeup.h:27:1: error: unknown type name 'GWakeup'
../glib/glib/gwakeup.h:28:42: error: unknown type name 'GWakeup'
../glib/glib/gwakeup.h:30:42: error: unknown type name 'GWakeup'
../glib/glib/gwakeup.h:32:42: error: unknown type name 'GWakeup'
../glib/glib/gwakeup.h:33:42: error: unknown type name 'GWakeup'
In file included from gio/gconstructor_as_data.h:2,
                 from ../glib/gio/glib-compile-resources.c:45:
../glib/glib/glib-private.h:98:3: error: unknown type name 'GWakeup'
../glib/glib/glib-private.h:99:58: error: unknown type name 'GWakeup'
../glib/glib/glib-private.h💯58: error: unknown type name 'GWakeup'
../glib/glib/glib-private.h:102:58: error: unknown type name 'GWakeup'
../glib/glib/glib-private.h:103:58: error: unknown type name 'GWakeup'
In file included from gio/gconstructor_as_data.h:2,
                 from ../glib/gio/glib-compile-resources.c:45:
../glib/glib/glib-private.h:164:53: warning: file "../glib/gio/glib-compile-resources.c" linemarker ignored due to incorrect nesting

To avoid this, generate gconstructor_as_data.h with a new-line at the end
of the file.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2021-07-02 14:42:54 +02:00
Emmanuele Bassi
3b576bb0f0 Merge branch 'async-queue-nullable' into 'main'
gasyncqueue: Add missing (nullable) annotation to free function

See merge request GNOME/glib!2173
2021-07-01 16:53:53 +00:00
Philip Withnall
04e629e3fe gasyncqueue: Add missing (nullable) annotation to free function
As spotted by Nitin Wartkar in
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2170#note_1195878.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-07-01 17:35:57 +01:00
Philip Withnall
d8cda3865f Merge branch 'async-get-objects' into 'main'
gdbusobjectmanagerclient: Call GetManagedObjects async

See merge request GNOME/glib!2120
2021-06-28 16:43:13 +00:00
Guido Günther
693ca5eb01 gdbusobjectmanagerclient: Cancel GetManagedObjects on dispose
Make sure there's no async call lingering when disposing the object.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2021-06-28 17:04:17 +02:00
Guido Günther
c548ac0796 gdbusobjectmanagerclient: Call GetManagedObjects async
This helps to void deadlocks when two processes call interfaces on each
other one of them being org.freedesktop.DBus.ObjectManager.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2021-06-28 15:27:36 +02:00
Guido Günther
04a4da8065 gdbusobjectmanagerclient: Move weak ref helpers upwards
This allows it to be used in on_notify_g_name_owner() as well

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2021-06-28 15:27:36 +02:00
Philip Withnall
d4ed690120 Merge branch 'DarkTrick-main-patch-77797' into 'main'
g_value_set_string description: clarified (unified), that v_string is a copy.

See merge request GNOME/glib!2167
2021-06-23 10:01:57 +00:00
DarkTrick
1fc905efe4 g_value_set_string description: clarified (unified), that v_string is a copy. 2021-06-23 05:50:59 +00:00
Michael Catanzaro
ed49de8b0f Merge branch 'mcatanzaro/gtlscertificate-introspection' into 'main'
gtlscertificate: Add more annotations to new properties

See merge request GNOME/glib!2166
2021-06-21 16:07:42 +00:00
Michael Catanzaro
5e19ccd237 gtlscertificate: Add more annotations to new properties 2021-06-21 16:07:42 +00:00
Philip Withnall
00868f4bb0 Merge branch 'mcatanzaro/#2393' into 'main'
gtlsconnection: use a vfunc to implement get_negotiated_protocol()

Closes #2393

See merge request GNOME/glib!2076
2021-06-21 15:22:24 +00:00
Michael Catanzaro
2cd187aa5e gio: add missing Since tags in GTlsConnection/GDtlsConnection 2021-06-21 09:31:17 -05:00
Michael Catanzaro
1ea88f46ff gdtlsconnection: document get_binding_data vfunc 2021-06-21 09:28:23 -05:00
Michael Catanzaro
09a4203b38 gtlsconnection: Add doc comment for GTlsConnectionClass 2021-06-21 09:28:23 -05:00
Michael Catanzaro
5e6c2e1e2c gtlsconnection: use a vfunc to implement get_negotiated_protocol()
The current code is unsafe to use from multiple threads at once.
GIOStream functions like this are supposed to be semi-threadsafe. It's
allowed for them to be called on both a reader thread and a writer
thread at the same time. Of course, it's still tricky and dangerous,
because it's only *really* threadsafe if the handshake has finished,
and API users have no plausible way to know that because the API
does not require performing an explicit handshake operation. But that's
a glib-networking problem. We can at least avoid the most obvious
threadsafety issue here in the API layer.

Note that we'll need to implement the new vfunc in glib-networking for
this to actually work.

Fixes #2393
2021-06-21 09:28:23 -05:00
Philip Withnall
74595ab64a Merge branch 'wip/pwithnall/962-drop-embedded-pcre' into 'main'
pcre: Drop internal libpcre copy

Closes #962 and #642

See merge request GNOME/glib!2144
2021-06-21 14:07:45 +00:00
Philip Withnall
72f692eae4 gdbusnamewatching: Ensure GDestroyNotify is called in correct context
The documentation for `g_bus_watch_name()` implies that the
`GDestroyNotify` for the user data will be called in the current thread
default `GMainContext`. Currently, it could be called in any thread, as
`client_unref()` can be called in any thread.

Fix that by deferring it to an idle source if `client_unref()` finalises
the `Client` object in a different thread.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-21 14:16:36 +01:00
Philip Withnall
323c5d7e21 tests: Add some missing main context iterations to gdbus-names
These were missing from the test before the previous commit ported from
`GMainLoop` to `GMainContext`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-21 14:16:03 +01:00
Philip Withnall
32e8e4ad91 tests: Port gdbus-names test entirely to GMainContext
It makes combination exit conditions a lot easier than when using
`g_main_loop_quit()` from different callbacks.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-21 14:15:55 +01:00
Philip Withnall
4fe630db83 ci: Use default wrap mode for libpcre on cross-build platforms
Work around a bug in Meson versions < 0.50.0 where
`--wrap-mode=nodownload` would disable the use of fallback subprojects,
even if they’d already been downloaded, with the message:
```
Cross dependency libpcre found: NO (tried pkgconfig and cmake)
Cross dependency libpcre found: NO (tried pkgconfig)
Not looking for a fallback subproject for the dependency libpcre because:
Use of fallbackdependencies is disabled.
meson.build:1998:2: ERROR:  Dependency "libpcre" not found, tried pkgconfig
```

This workaround can be dropped in the near future when we bump our Meson
dependency to something less ancient. We have a self-imposed requirement
to be buildable using what’s packaged in Debian Stable, which is
currently Meson 0.49.2 — but the new Debian Stable release is coming
soon, with an updated Meson.

Using `--force-fallback-for=libpcre` would have been a more constrained
workaround, but unfortunately that argument didn’t exist in Meson 0.49.

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

Helps: #962
2021-06-21 13:29:56 +01:00
Philip Withnall
e2d1ea3b9e docs: Mention the stable/unstable support version in README.md
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-18 10:43:23 +01:00