Commit Graph

20875 Commits

Author SHA1 Message Date
Philip Withnall
3251cce524 gatomic: Fix strict aliasing problems with g_atomic_pointer_{get,set}()
Casting pointer types around is a bit fiddly when you also end up
dereferencing them. Take advantage of the fact that the
`__atomic_load()` and `__atomic_store()` built-ins are polymorphic, and
use `__typeof__()` to ensure that the atomic pointer macros use the
caller-provided types internally, and hence any type mismatches are
entirely the caller’s fault rather than ours.

This also means that the `__atomic_{load,store}()` built-ins have the
right alignment and width data from the caller-provided types, in case
that’s needed.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-07 16:23:02 +01:00
Philip Withnall
81f8d02e4d glib: Various fixes to the return type of atomic functions
Various places that used atomic functions were using the wrong return
type. Fix that. This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-07 16:21:24 +01:00
Philip Withnall
4e12e7ed0d Merge branch 'th/main-context-default-no-mutex' into 'master'
gmain: use atomic operation instead of GMutex to access g_main_context_default()

See merge request GNOME/glib!1135
2019-10-07 13:22:30 +00:00
Thomas Haller
39dd2be538 gmain: use atomic operation instead of GMutex to access g_main_context_default()
I think it is wasteful to use a mutex every time the default main context
is accessed. Especially, as the default main context is used all the
time.
2019-10-07 13:22:30 +00:00
Philip Withnall
038ec3de31 Merge branch 'add_array_steal_function' into 'master'
Add g_array_steal(), g_ptr_array_steal() and g_byte_array_steal()

Closes #285

See merge request GNOME/glib!1019
2019-10-07 13:07:56 +00:00
Paolo Bonzini
7bada8394d Add g_array_steal(), g_ptr_array_steal() and g_byte_array_steal()
Closes issue #285
2019-10-07 14:38:24 +02:00
Philip Withnall
c88f106471 Merge branch 'wip/oholy/gio-completion' into 'master'
Several gio-tool bash completion fixes and improvements

See merge request GNOME/glib!1153
2019-10-07 09:23:41 +00:00
Philip Withnall
a350fa50a5 Merge branch 'winhttp-handle-null-prgname' into 'master'
gwinhttpvfs: Handle g_get_prgname() returning NULL

See merge request GNOME/glib!1152
2019-10-07 09:04:06 +00:00
Philip Withnall
419b7d00d8 Merge branch 'glib-g_ptr_array_sort_api_doc_example' 2019-10-07 09:53:01 +01:00
Lee Bigelow
52c130f888 Add full examples to g_ptr_array_sort() and g_ptr_array_sort_with_data()
With changes by Emmanuel Fleury and Philip Withnall.

Closes issue #9
2019-10-07 09:50:51 +01:00
Philip Withnall
acf55ad584 Merge branch 'solaris-build-fixes' into 'master'
Solaris build fixes

See merge request GNOME/glib!1146
2019-10-07 08:44:39 +00:00
Ondrej Holy
b3bf1e263e gio: Always include mounts in the results
Mounts are currently completed only if the prefix looks like scheme,
however, this doesn't work well if the mounts have also path component.
Let's always include them to fix this issue. The mounts are cached by the
volume monitors, so it should not significantly affect the performance.
2019-10-07 09:21:19 +02:00
Ondrej Holy
8bc52105ef gio: Complete also activation roots of volumes
Currently, "gio mount google-drive<tab>" isn't completed even though
that volume exists for google-drive://oholy@redhat.com/. Let's use
"gio mount -li" output to complete also activation roots of volumes.
2019-10-07 09:21:19 +02:00
Ondrej Holy
3a1492ec4f gio: Fix completion of URIs without hostname part
Currently, "gio list file:///h<tab>" doesn't complete "file:///home"
because the result of "dirname file:///h" is not "file:///" but "file:/",
which breaks the consequent logic. Let's subtract basename from the
path in order to workaround this issue.
2019-10-07 09:21:09 +02:00
Christoph Reiter
bf2a10211b gwinhttpvfs: Handle g_get_prgname() returning NULL
When prgname wasn't set NULL would be passed to g_utf8_to_utf16()
resulting in "g_utf8_to_utf16: assertion 'str != NULL' failed"
2019-10-06 20:05:44 +02:00
Simon McVittie
dd27d2beeb Merge branch 'patch-1' into 'master'
gio/gfile: fix parameter reference for value_p

See merge request GNOME/glib!1149
2019-10-06 13:18:44 +00:00
Simon McVittie
cb97f0e114 Merge branch 'dlech-master-patch-99473' into 'master'
gio/gfileinfo: fix parameter references

See merge request GNOME/glib!1148
2019-10-06 13:17:59 +00:00
Simon McVittie
5ac73a0972 Merge branch 'patch-2' into 'master'
gio/gfile: fix parameter references to @contents

See merge request GNOME/glib!1150
2019-10-06 13:17:17 +00:00
Simon McVittie
c46c31de91 Merge branch 'patch-3' into 'master'
gio/gfile: fix typo in doc comment

See merge request GNOME/glib!1151
2019-10-06 13:16:23 +00:00
David Lechner
4723bf5720 gio/gfile: fix typo in doc comment
This fixes a typo in g_file_has_prefix() do comments.
2019-10-06 02:01:48 +00:00
David Lechner
f71eca16d5 gio/gfile: fix parameter references to @contents
Fix a number of occurrences where the parameter reference was missing the trailing 's'
2019-10-06 01:55:40 +00:00
David Lechner
5120f92c33 gio/gfile: fix parameter reference for value_p
This fixes a parameter reference to @value_p in g_file_set_attribute()
2019-10-06 01:48:15 +00:00
David Lechner
5dee5263e8 gio/gfileinfo: fix parameter references
This fixes a couple of parameter references for @info in the doc comments.
2019-10-05 22:36:19 +00:00
Sebastian Dröge
25ed7d45d9 Merge branch 'gmodule-typo' into 'master'
gmodule: fix typo in doc comment

See merge request GNOME/glib!1147
2019-10-05 06:56:01 +00:00
David Lechner
5a57bdbc45 gmodule: fix typo in doc comment
s/opended/opened/
2019-10-05 01:45:22 +00:00
Alan Coopersmith
2b34f52b01 build: no --export-dynamic ldflags for Solaris
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-10-04 13:23:25 -07:00
Alan Coopersmith
e5e1490990 gunixmounts: Handle Solaris name of mnt_mntopts in place of mnt_opts
Fixes build failure:
../gio/gunixmounts.c: In function ‘_g_get_unix_mounts’:
../gio/gunixmounts.c:742:53: error: ‘struct mnttab’ has no member named ‘mnt_opts’; did you mean ‘mnt_mntopts’?
  742 |                                              mntent.mnt_opts,
      |                                                     ^~~~~~~~
      |                                                     mnt_mntopts

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-10-04 12:55:17 -07:00
Emmanuele Bassi
c08e7b9364 Merge branch 'switch_to_gnu99' into 'master'
Switching from C gnu89 to C gnu99 standard

See merge request GNOME/glib!1035
2019-10-04 14:51:10 +00:00
Philip Withnall
66da7beb65 2.63.0
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-04 14:55:44 +01:00
Philip Withnall
d207e19d32 Merge branch 'wip/tingping/pkcs11' into 'master'
gtlscertificate: Add pkcs11-uri property and constructor

Closes #1809

See merge request GNOME/glib!933
2019-10-03 12:12:16 +00:00
Patrick Griffis
b6d8efbebc gtlscertificate: Add support for PKCS #11 backed certificates
This adds properties to allow backends to expose PKCS #11 support.
2019-10-02 10:12:40 -07:00
Philip Withnall
0c40f3f6b9 Merge branch 'cross-installed-tests' into 'master'
Always build tests if we enabled installed-tests

See merge request GNOME/glib!1138
2019-10-02 15:54:19 +00:00
Philip Withnall
406c8b04fc Merge branch 'file-permissions-redux' into 'master'
Fix handling of G_FILE_COPY_TARGET_DEFAULT_PERMISSIONS in g_file_copy()

Closes #174

See merge request GNOME/glib!1134
2019-10-02 15:40:09 +00:00
Sebastian Dröge
9a5a5c8951 Merge branch 'exact-mtime' into 'master'
g_file_info_get_modification_date_time: Calculate in integer domain

See merge request GNOME/glib!1139
2019-10-02 08:52:40 +00:00
Simon McVittie
14609b0b25 g_file_info_get_modification_date_time: Calculate in integer domain
g_date_time_add_seconds() and g_date_time_add_full() use floating-point
seconds, which can result in the value varying slightly from what's
actually on disk. This causes intermittent test failures in
gio/tests/g-file-info.c on Debian i386, where we set a file's mtime
to be 50µs later, then read it back and sometimes find that it is only
49µs later than the previous value.

I've only seen this happen on i386, which means it might be to do with
different floating-point rounding when a value is stored in the 80-bit
legacy floating point registers rather than in double precision.

g_date_time_add() takes a GTimeSpan, which is in microseconds;
conveniently, that's exactly what we get from the GFileInfo.

Bug-Debian: https://bugs.debian.org/941547
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-02 08:30:35 +01:00
Ask Hjorth Larsen
788c01df48 Updated Danish translation 2019-10-02 05:54:08 +02:00
Simon McVittie
42d8e17795 Always build tests if we enabled installed-tests
If we're cross-compiling, the installed-tests are useful even if we
can't run them on the build machine: we can copy them to the host
machine (possibly via a distro package like Debian's libglib2.0-tests)
and run them there.

While I'm changing the build-tests condition anyway, deduplicate it.

Based on a patch by Helmut Grohne.

Bug-Debian: https://bugs.debian.org/941509
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-01 20:12:16 +01:00
Ignacio Casal Quinteiro
90bdc2ffb6 Merge branch 'gregistry-key-name-len' into 'master'
gregistrysettings: bump key name length to 2048

See merge request GNOME/glib!1137
2019-10-01 13:03:28 +00:00
Ignacio Casal Quinteiro
9239f2659f gregistrysettings: bump key name length to 128
32 is just too low for key names, specially since the registry has a limit
of 16,383 chars. Giving that, 128 is a good bump for now.
2019-10-01 14:35:43 +02:00
Philip Withnall
eb2125770d tests: Expand g_file_copy() tests to test DEFAULT_PERMS flag
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-30 14:40:55 +01:00
Philip Withnall
67772b6a70 tests: Unconditionally enable the file permissions test
Skip it on systems which don’t support it, rather than compiling it out.
That gives us more information from test runs about which tests are
being run on which architectures.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-30 14:40:55 +01:00
Philip Withnall
bfdc5fc4fc glocalfileinfo: Only return file mode, not type, as UNIX_MODE attribute
As with the previous commit, `st_mode` contains both the file type
(regular file, directory, symlink, special, etc.) and the file mode. For
`G_FILE_ATTRIBUTE_ID_UNIX_MODE`, we only want the file mode — so mask
`st_mode` with `~S_IFMT`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-30 14:40:55 +01:00
Philip Withnall
5dd5269126 glocalfileoutputstream: Only pass file mode, not type, to chmod()
chmod() technically only accepts file modes, not the file type and mode
as returned by stat(). Filter by `S_IFMT` to avoid sending the file
type (regular file, directory, symbolic link, etc.).

In practice, chmod() ignores anything except the file mode, but we might
as well comply with the specification.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-30 14:40:55 +01:00
Philip Withnall
674ba78f12 gfile: Document a few nullable vfuncs
`GFile` always checks whether these vfuncs are `NULL` before calling
them, so document that it’s safe for implementations of `GFile` to not
implement them.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-30 14:40:55 +01:00
Philip Withnall
7d2bce82e2 glocalfile: Don’t define unsupported copy vfunc
The caller assumes that an unimplemented vfunc means that copying is
unsupported (and falls back to its internal copy implementation), so
there’s no point in implementing the vfunc just to unconditionally
return `G_IO_ERROR_NOT_SUPPORTED`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-30 14:40:55 +01:00
Philip Withnall
1b7ab81c1c glocalfile: Don’t define symlink vfunc if it’s unsupported
Rather than defining a vfunc which only ever returns
`G_IO_ERROR_NOT_SUPPORTED`, just don’t define the vfunc at all. The
caller in `GFile` interprets this as symlinks not being supported — so
we get the same behaviour, but without spending a vfunc call on it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-30 14:40:55 +01:00
Philip Withnall
775014dd3b gfile: Use a more specific error message if symlinks are not supported
The string is already translated in `GLocalFile`, so this doesn’t
introduce a new translatable string.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-30 14:40:55 +01:00
Philip Withnall
2268f36769 gio-tool: Add a --default-permissions argument to gio copy
This sets the `G_FILE_COPY_DEFAULT_PERMS` flag on the operation,
creating the copied file with default permissions rather than the same
permissions as the source file.

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

Fixes: #174
2019-09-30 14:40:50 +01:00
Philip Withnall
53f6ede628 gfile: Don’t copy files as private if using default permissions
If a copy operation is started with `G_FILE_COPY_TARGET_DEFAULT_PERMS`,
don’t create the destination file as private. Instead, create it with
the process’ current umask (i.e. ‘default permissions’).

This is a partial re-work of commit d8f8f4d637, with
input from Ondrej Holy.

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

Fixes: #174
2019-09-30 14:40:43 +01:00
Philip Withnall
51d73ef5d9 gfile: Factor out flags when copying files
This introduces no functional changes; just reduces duplication in the
code a little.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-30 14:24:38 +01:00