Commit Graph

21144 Commits

Author SHA1 Message Date
Philip Withnall
6c41e91f03 Merge branch 'wip/ernestask/g_clear_list' into 'master'
Add g_clear_list()

Closes #1943

See merge request GNOME/glib!1244
2019-11-26 10:36:52 +00:00
Benjamin Otte
276e927fd4 Revert last 4 commits
This reverts commits:
  5899c61ed2
  e994d45352
  eb20dec144
  ebec0dd359
which wer accidentally pushed to master instead of a branch
2019-11-26 00:54:15 +01:00
Benjamin Otte
5899c61ed2 value: Allow automatic transforms to/from interfaces
Use the new g_type_interface_instantiable_prerequisite() to check
compatibility for transform functions.

In particular, this allows interfaces (in my case GDK_TYPE_PAINTABLE) to
be transformed to/from any GObject type (in my case G_TYPE_OBJECT) using
the transform function registered to tranform between any 2 objects
(g_value_object_transform_value() does a type check and uses NULL if the
types don't match).

And this in turn allows be to g_object_bind_property() a gobject-typed
generic property (GtkListItem::item) to a GtkImage::paintable.
2019-11-25 20:06:49 +01:00
Benjamin Otte
e994d45352 closure: Support generic marshals for interface returns
Use the newly added g_type_interface_instantiable_prerequisite() to
allow closure return values being interfaces by looking up the
instantiable type for the interface and usings its GValue accessors.
2019-11-25 20:06:39 +01:00
Benjamin Otte
eb20dec144 gtype: Add g_type_interface_instantiable_prerequisite()
There is (at most) a single GType that is instantiable and a
prerequisite for an interface. This function returns that type.

This type is necessary in particular when dealing with GValues because a
GValue contains an instance of a type.
2019-11-25 20:06:39 +01:00
Benjamin Otte
ebec0dd359 gtype: Fix typo in API comment 2019-11-25 20:06:39 +01:00
Emmanuele Bassi
eb439076a6 Merge branch '1947-uuid-docs' into 'master'
guuid: Document that g_uuid_string_random() is not secure

Closes #1947

See merge request GNOME/glib!1246
2019-11-25 18:50:12 +00:00
Ernestas Kulik
58ba7d78fb list, slist: Add g_clear_{s,}list()
Although not quite as often-occurring, this should help with constructs
like this:

  if (list)
    {
      g_list_free_full (list, foo);
      list = NULL;
    }

Closes https://gitlab.gnome.org/GNOME/glib/issues/1943
2019-11-25 13:09:25 +01:00
Bastien Nocera
3894335dc6 tests: Don't "timeout tests" by default
Those tests seem to regularly fail because a timeout (which we're
measuring outside the function that times out) is too long, which can
happen when the system is busy.

Don't run those tests unless "thorough" tests are requested. This
disables those tests by default.

Bail out! GLib-GIO:ERROR:../gio/tests/socket.c:1167:test_timed_wait: assertion failed (poll_duration < 112000): (114254 < 112000)
Bail out! GLib-GIO:ERROR:../gio/tests/cancellable.c:167:on_mock_operation_ready: assertion failed (error == (g-io-error-quark, 19)): error is NULL
2019-11-25 12:55:18 +01:00
Philip Withnall
ae49ff0903 2.63.2
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-25 11:11:33 +00:00
Philip Withnall
b7fe4b84ee ci: Update all Debian CI runners to use v5 of the Dockerfile
This shouldn’t affect them (since it just adds the `clang-format-7`
package), but it’s good to keep everything on the same version.

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

See: #1552
2019-11-25 10:51:14 +00:00
Philip Withnall
8555aeec8d Merge branch 'wip/ci-style-check' into 'master'
CI: Code check formating in CI

Closes #1552

See merge request GNOME/glib!1237
2019-11-25 10:23:50 +00:00
Philip Withnall
812253a95f guuid: Document that g_uuid_string_random() is not secure
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1947
2019-11-25 10:10:36 +00:00
Pavlo Solntsev
e95f47c395
CI: Code check formating in CI 2019-11-21 14:03:01 -06:00
Philip Withnall
7b77439841 Merge branch 'wip/hadess/occurred' into 'master'
docs: Fix "occurred" typos in API documentation

See merge request GNOME/glib!1243
2019-11-21 12:45:45 +00:00
Philip Withnall
7c77cdf9ba Merge branch 'objcpy-version' into 'master'
Enable test about objcopy if it supports the --add-symbol parameter

Closes #1895

See merge request GNOME/glib!1236
2019-11-21 12:34:15 +00:00
Philip Withnall
6f3de72ad4 Merge branch 'th/gstrv-use-gsize' into 'master'
gstrfuncs: use gsize type internally for strv functions

See merge request GNOME/glib!1238
2019-11-21 12:33:34 +00:00
Iain Lane
50c215b14e Merge branch 'unix-mode-docs' into 'master'
gfileinfo: Clarify the documentation for G_FILE_ATTRIBUTE_UNIX_MODE

See merge request GNOME/glib!1242
2019-11-21 12:24:32 +00:00
Bastien Nocera
6fd2ea1dc6 docs: Fix "occurred" typos in API documentation 2019-11-21 13:07:08 +01:00
Philip Withnall
94e8f027bd Merge branch '1004-lldb' into 'master'
Make gbacktrace use lldb on macOS

Closes #1004

See merge request GNOME/glib!167
2019-11-21 11:54:46 +00:00
Philip Withnall
0a469dafe4 Merge branch 'wip/iainl/fix-1934' into 'master'
Revert "glocalfileinfo: Only return file mode, not type, as UNIX_MODE attribute"

Closes #1934

See merge request GNOME/glib!1241
2019-11-21 11:27:20 +00:00
Philip Withnall
f793319b17 gfileinfo: Clarify the documentation for G_FILE_ATTRIBUTE_UNIX_MODE
It’s not just the mode, it’s also the file type.

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

Helps: #1934
2019-11-21 11:24:08 +00:00
Ignacio Casal Quinteiro
5fe61e8c46 Enable test about objcopy if it supports the --add-symbol parameter
This fixes building in old systems like centos 6.

(With tweaks by Philip Withnall.)

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1895
2019-11-21 11:16:24 +00:00
Kristian Rietveld
1fbd185430 gbacktrace: on macOS support and default to LLDB
Tweaked by Philip Withnall <withnall@endlessm.com> to fix review issues.

Closes: #1004
2019-11-21 11:02:14 +00:00
Philip Withnall
9dc006cfc8 Merge branch '1940-atomic-types' into 'master'
tests: Use pointers in calls to g_atomic_pointer_compare_and_exchange()

Closes #1940

See merge request GNOME/glib!1234
2019-11-21 10:57:27 +00:00
Iain Lane
0c88825a75
test_copy_preserve_mode: Adjust for the previous revert
Now we're returning the file type again, we need to mask it out to
compare with the mode. We can also check that the statbuf said the file
is a regular file.

Related: #1934
2019-11-21 10:49:31 +00:00
Iain Lane
e330a99f7a
Revert "glocalfileinfo: Only return file mode, not type, as UNIX_MODE attribute"
This reverts commit bfdc5fc4fc.

This changes the semantics of G_FILE_ATTRIBUTE_ID_UNIX_MODE, and we've
already found one user of the previous semantics (ostree).

Closes #1934
2019-11-21 10:31:43 +00:00
Philip Withnall
a0d5b49ef7 Merge branch 'wip/hadess/gdatetime-leap-seconds' into 'master'
gdatetime: Add hack for leap seconds

Closes #1938

See merge request GNOME/glib!1233
2019-11-21 09:55:52 +00:00
Thomas Haller
c8194ee3ec gstrfuncs: use gsize type internally for strv functions
In C, the proper type for a heap allocate structure is size_t/gsize.
That means, no valid (heap allocated) pointer will ever contain more
bytes than size_t can represent.

Hence, this integer type should also be used when operating on
data like a strv array. Adjust some internal uses to use gsize
instead of gint/guint.

Note that g_strv_length() returns a value of type guint. So this
API cannot be used on string arrays longer of arbitrary size. But
that is not fixable.
2019-11-21 10:44:48 +01:00
Bastien Nocera
b4eaac5817 gdatetime: Handle leap seconds in ISO8601 dates
GDateTime doesn't handle leap seconds, so just round these down to
the previous second.

https://gitlab.gnome.org/GNOME/glib/issues/1938
2019-11-21 09:14:39 +01:00
Xavier Claessens
653d3e2c5d Merge branch 'mgl-fix-build' into 'master'
Fix build on old libc that does not define _SC_HOST_NAME_MAX

See merge request GNOME/glib!1231
2019-11-20 14:12:29 +00:00
Xavier Claessens
de79958295 Fix build on old libc that does not define _SC_HOST_NAME_MAX
Bionic (Android's libc) only added that symbol in Nov 2014, can't find
in which NDK release it got released.
2019-11-20 08:34:25 -05:00
Philip Withnall
21fce30e9a Revert "gatomic: Temporarily disable C11-style atomics on FreeBSD"
This reverts commit fd3ed5e31b.

C11-style atomics have been fixed (on FreeBSD and other platforms) in
the previous commit, “gatomic: Check argument width in
g_atomic_pointer_compare_and_exchange()”.

See !1229 and #1940.
2019-11-20 12:12:04 +00:00
Philip Withnall
75cd86f00e gatomic: Check argument width in g_atomic_pointer_compare_and_exchange()
Check that the new value is actually pointer-width, rather than (for
example) `sizeof (int)` which could happen if someone used `0` rather
than `NULL`.

Changes suggested by Simon McVittie.

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

Helps: #1940
2019-11-20 12:10:43 +00:00
Philip Withnall
844332ef31 tests: Use pointers in calls to g_atomic_pointer_compare_and_exchange()
Don’t pass integers; it’s not type-safe. The macro version of
`g_atomic_pointer_compare_and_exchange()` used to erroneously accept
integers, but they would have the wrong width on some platforms.

Changes originally investigated and suggested by Ting-Wei Lan.

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

Fixes: #1940
2019-11-20 12:10:23 +00:00
Philip Withnall
eadc17f894 Merge branch 'wip/ernestask/bz-693576-annotations' into 'master'
Make GTask more binding-friendly

See merge request GNOME/glib!1216
2019-11-20 11:17:35 +00:00
Michael Catanzaro
d3768c89ae Merge branch 'mcatanzaro/copy-session-state' into 'master'
Improve documentation for footgun function g_tls_client_connection_copy_session_state()

See merge request GNOME/glib!1039
2019-11-18 21:14:37 +00:00
Michael Catanzaro
88e7529101 Merge branch 'mcatanzaro/gtlsconnection-changes' into 'master'
Deprecate old GTlsConnection functionality even harder!

See merge request GNOME/glib!1227
2019-11-18 21:10:54 +00:00
Michael Catanzaro
fb54646899 Improve documentation of g_tls_client_connection_copy_session_state()
This function has numerous undocumented limitations. In particular, it
is not possible to ensure this function actually does anything. Document
these problems.
2019-11-18 13:55:34 -06:00
Michael Catanzaro
9d2c949b54 gtlsclientconnection: use-ssl3 is now ignored
For many years after SSL 3.0 support was removed, we used this function
to indicate that we should perform protocol version fallback to the
lowest-supported protocol version, to workaround protocol version
intolerance. Nowadays this is no longer needed, and support has been
removed from glib-networking, so update the documentation.
2019-11-18 13:52:39 -06:00
Michael Catanzaro
8f88783a7f gtlsconnection: add missing G_PARAM_DEPRECATED
The use-system-certdb function has been deprecated since 2.30 and is
just missing the deprecation flag to warn developers.
2019-11-18 13:52:39 -06:00
Michael Catanzaro
7b3824fa62 gtlsconnection: add missing deprecation annotation
GTlsConnection:rehandshake-mode has been deprecated since 2.60 using
the G_PARAM_DEPRECATED flag, but I forgot to add the right annotation to
the documentation. Oops.

The associated getter/setter functions were both deprecated properly.
2019-11-18 13:52:39 -06:00
Michael Catanzaro
79999c8723 gtlsconnection: document rehandshake-mode is no longer supported 2019-11-18 13:52:39 -06:00
Simon McVittie
4a57109b77 Merge branch '1940-bsd-atomics-failure' into 'master'
gatomic: Temporarily disable C11-style atomics on FreeBSD

See merge request GNOME/glib!1229
2019-11-15 20:23:41 +00:00
Philip Withnall
b8f4c3596c Merge branch 'mcatanzaro/gtlsconnection-confusion' into 'master'
gtlsconnection: clarify handshake() documentation

See merge request GNOME/glib!1225
2019-11-15 10:45:17 +00:00
Garrett Regier
6cac760551 task: Add return/propagate API for GValue
This is useful for bindings.

Related: https://gitlab.gnome.org/GNOME/glib/issues/668
2019-11-15 10:37:42 +00:00
Philip Withnall
fd3ed5e31b gatomic: Temporarily disable C11-style atomics on FreeBSD
They’re causing the CI to fail. While someone familiar with FreeBSD
investigates the failure, it’s easiest to disable all C11-style atomics
than add more preprocessor checks to only disable the atomics added in
!1123.

If nobody can fix the new C11-style atomics before the 2.64.0 release,
this commit should be reverted and a more comprehensive set of preprocessor
checks put in place to essentially revert !1123 for BSD only.

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

Helps: #1940
2019-11-15 10:28:21 +00:00
Philip Withnall
e825a98845 Merge branch 'fix-utf8-pointer-test' into 'master'
gunicode: Fix an UB in gutf8.c and utf8-pointer test

Closes #1917

See merge request GNOME/glib!1199
2019-11-14 18:38:03 +00:00
nightuser
b555119ca3 gunicode: Fix UB in gutf8.c and utf8-pointer test
In glib/gutf8.c there was an UB in function g_utf8_find_prev_char when
p == str. In this case we substract one from p and now p points to a
location outside of the boundary of str. It's a UB by the standard.
Since this function are meant to be fast, we don't check the boundary
conditions.

Fix glib/tests/utf8-pointer test. It failed due to the UB described
above and aggressive optimisation when -O2 and LTO are enabled. Some
compilers (e.g. GCC with major version >= 8) create an optimised version
of g_utf8_find_prev_char with the first argument fixed and stored
somewhere else (with a different pointer). It can be solved with either
marking str as volatile or creating a copy of str in memory. We choose
the second approach since it's more explicit solution.

Add additional checks to glib/tests/utf8-pointer test.

Closes #1917
2019-11-14 18:38:03 +00:00
Sebastian Dröge
4dcad56fb2 Merge branch '1750-more-atomic-intrinsics' into 'master'
gatomic: Use new __atomic_*() intrinsics for all atomic operations

Closes #1750

See merge request GNOME/glib!1123
2019-11-14 13:40:47 +00:00