Commit Graph

19479 Commits

Author SHA1 Message Date
Emmanuele Bassi
927de4433e Port GHashTable to gatomicrefcount
Use the newly added API for reference counting instead of rolling our
own.
2018-06-11 14:59:39 +01:00
Emmanuele Bassi
e67e4cb849 Port GBytes to gatomicrefcount
Use the newly added API for reference counting instead of rolling our
own.
2018-06-11 14:59:39 +01:00
Emmanuele Bassi
439ee4822e Port GArray and friends to gatomicrefcount
Use the newly added API for reference counting instead of rolling our
own.
2018-06-11 14:59:39 +01:00
Emmanuele Bassi
09e2247d3f Add tests for refcount types
Test that the API behaves as expected, especially when we get to
saturation.

Additionally, check that both the function and the macro versions of the
API behave identically.
2018-06-11 14:59:39 +01:00
Emmanuele Bassi
827c208cbf Use macros for refcount types API
If we're using GCC we can use __extension__ to inline the grefcount and
gatomicrefcount API, and avoid the function call.

These macros are only enabled if G_DISABLE_CHECKS is defined, as they
remove critical warnings when the reference counters achieve saturation.
2018-06-11 14:59:39 +01:00
Emmanuele Bassi
9e5a53d576 Add reference counting types
We have a common pattern for reference counting in GLib, but we always
implement it with ad hoc code. This is a good chance at trying to
standardise the implementation and make it public, so that other code
using GLib can take advantage of shared behaviour and semantics.

Instead of simply taking an integer variable, we should create type
aliases, to immediately distinguish the reference counting semantics of
the code; we can handle mixing atomic reference counting with a
non-atomic type (and vice versa) by using differently signed values for
the atomic and non-atomic cases.

The gatomicrefcount type is modelled on the Linux kernel refcount_t
type; the grefcount type is added to let single-threaded code bases to
avoid paying the price of atomic memory barriers on reference counting
operations.
2018-06-11 14:59:39 +01:00
Philip Withnall
8bbc38b497 Merge branch '878-timezone-transitions' into 'master'
Resolve "glib uses wrong timezone transition with zoneinfo 2014c"

Closes #878

See merge request GNOME/glib!94
2018-06-11 13:48:47 +00:00
Xavier Claessens
73b229ab3a Merge branch 'wip/jehan/android-master-v3' into 'master'
Wip/jehan/android master v3

See merge request GNOME/glib!93
2018-06-11 13:37:55 +00:00
Paul Eggert
137dd7789b gtimezone: port to tzcode 2014c
Problem reported by Marien Zwart in:
https://gitlab.gnome.org/GNOME/glib/issues/878
Derived from a fix by John Ralls proposed in that bug report.
2018-06-11 14:30:16 +01:00
Jehan
866275f56b gio: fix various "warning: unused variable". 2018-06-11 15:13:55 +02:00
Jehan
f96417e470 gio: UNIX_PATH_MAX may be defined.
On an Android build, API 22, at least, I got a:
> warning: "UNIX_PATH_MAX" redefined

We were currently defining it as:
> #define UNIX_PATH_MAX sizeof (((struct sockaddr_un *) 0)->sun_path)
Whereas Android's headers define this variable of sockaddr_un as:
> char sun_path[UNIX_PATH_MAX];
So by definition, we will still get the right result in the end by just
using the original value of UNIX_PATH_MAX.
2018-06-11 15:13:55 +02:00
Jehan
631035342d gio: C_IN is defined in recent Android headers.
C_IN macro was added years ago in bcbaf1bef0, using same value as the
internal code of Android with the reasonning that "some parts of the API
used by the resolver objects is not public in the Android NDK (yet)".
Well since then things are changed, since it is definitely available (at
least on the API 22 of Android which I am using) in the public header
arpa/nameser_compat.h.
Let's just add a #ifndef to handle both cases when you build with an
older or recent API.
2018-06-11 15:13:55 +02:00
Philip Withnall
ad957b6630 Merge branch 'wip/piotrdrag/unicode-typography' into 'master'
Fix tests for Unicode strings

Closes #1212

See merge request GNOME/glib!75
2018-06-11 11:03:43 +00:00
Philip Withnall
18a34845b5 Merge branch 'classify-test-suites' into 'master'
Classify the tests

See merge request GNOME/glib!91
2018-06-11 11:02:09 +00:00
Philip Withnall
15a490755e Merge branch 'wip/lantw/freebsd-socket-tests' into 'master'
socket: Fix get_available_bytes on systems other than Linux and Windows

See merge request GNOME/glib!70
2018-06-11 10:58:25 +00:00
Philip Withnall
262b153c41 Merge branch 'wip/lantw/freebsd-meson-builds' into 'master'
Fix meson build files for FreeBSD

See merge request GNOME/glib!73
2018-06-11 10:53:10 +00:00
Philip Withnall
379e8fd22d Merge branch 'wip/lantw/freebsd-gettext-tests' into 'master'
tests: Set both environment variable and locale when running tests

See merge request GNOME/glib!69
2018-06-11 10:51:35 +00:00
Chun-wei Fan
2358ee17b5 README.win32: Mention about /utf-8 and GIT
Let people know that Visual Studio 2015 and later provide a /utf-8
option to eliminate the need to set the System's non-Unicode locale and
the subsequent reboot.

Also let people know that it is recommended to have GIT for Windows
installed so that some dependencies' sources can be downloaded and built
along with GLib et al when needed.

Please see MR !65 for a discussion on the reasoning why GIT for Windows
is recommended.
2018-06-11 10:34:52 +08:00
Emmanuele Bassi
16d1a3d28c Classify the tests
Meson has the ability to classify tests according to "suites", a list of
tags. This is especially useful when we want to run specific sets of
tests — e.g. only GLib's tests — instead of the whole test suite. It
also allows us to classify special tests, like "slow" ones, so that we
can only run them when needed.
2018-06-10 15:33:06 +01:00
Ting-Wei Lan
293c103a7d socket: Fix get_available_bytes on systems other than Linux and Windows
FIONREAD ioctl on Linux reports the size of payload on UDP sockets.
However, other systems usually add internal header size to the reported
size, which vary between different operating systems and socket types.
To make it work on more systems, we should follow what we do on Windows
instead of using this unreliable FIONREAD ioctl.

This fixes socket test on FreeBSD.
2018-06-09 10:02:50 +08:00
Ting-Wei Lan
a77790330b meson: libelf.pc is not always available
libelf, just like libc, is not a single project. It is an interface
which can be implemented independently by different operating systems.
Therefore, we cannot expect all systems to provide a .pc file, and we
should fallback to cc.find_library and cc.has_function like what we
already do in autotools build.
2018-06-09 09:40:51 +08:00
Philip Withnall
e22bffb522 Merge branch 'wip/oholy/trashing-locations2' into 'master'
Resubmit of reverted trash related changes and tests

See merge request GNOME/glib!83
2018-06-09 00:28:09 +00:00
Philip Withnall
e3280675f5 Merge branch 'wip/lantw/freebsd-kqueue-simple' into 'master'
FreeBSD kqueue file monitor fixes: the simple parts

See merge request GNOME/glib!76
2018-06-08 21:36:27 +00:00
Philip Withnall
d1e2ef56ea Merge branch 'meson-distcheck' into 'master'
Update list of meson files to distcheck

See merge request GNOME/glib!86
2018-06-08 20:50:01 +00:00
Xavier Claessens
cb10eacedf Update list of meson files to distcheck 2018-06-08 15:29:20 -04:00
Ting-Wei Lan
6f2b3503a5 tests: Set both environment variable and locale when running tests
Non-glibc gettext implementation seems to decide the language from
LC_MESSAGES environment variable instead of LC_MESSAGES locale, so
we should set both environment variable and locale when running tests
which need translation from specific languages.
2018-06-09 02:40:01 +08:00
Ting-Wei Lan
313a0fffe5 tests: Use de_DE.UTF-8 instead of de_DE in gsettings test
FreeBSD doesn't have a de_DE locale without encoding suffix.
2018-06-09 02:40:01 +08:00
Piotr Drąg
b974cccdaf Revert "Partially revert 10c490cdfe3ae042f747bd00f787492e2bdb7ed0"
This reverts commit 2d56c49b10.
2018-06-08 16:15:54 +02:00
Piotr Drąg
0bb3cacacb Fix tests for Unicode strings
Based on a patch by Simon McVittie <simon.mcvittie@collabora.co.uk>.

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1212
2018-06-08 16:13:52 +02:00
Philip Withnall
6775fe2555 docs: Add (transfer full) annotation to g_content_type_get_mime_type()
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/811
2018-06-08 14:05:40 +01:00
Ondrej Holy
1cbb5dd95f glocalfile: Fix error code when trash not found
G_IO_ERROR_NOT_SUPPORTED is used as parameter for g_set_io_error(),
however, errno is expected instead and thus error code is set to 0,
which is wrong. Let's use ENOTSUP instead.
2018-06-08 14:15:18 +02:00
Philip Withnall
e1eaea3eea Merge branch '1406-compile-resources-help' into 'master'
glib-compile-resources: Clarify --help output for --sourcedir argument

Closes #1406

See merge request GNOME/glib!81
2018-06-08 11:48:21 +00:00
Ondrej Holy
15cdcd2e0b glocalfile: Check that parent device is the same when trashing
To be honest, I am not sure why, but in some special environments (e.g.
our CI integration) can happen, that file device number is different from
parent device number. Return "Unable to find or create trash directory for
%s" error from g_local_file_trash() in that case and also set
G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH appropriately.
2018-06-08 13:27:13 +02:00
Ondrej Holy
83ca61a421 glocalfile: Add test case for g_file_trash
g_local_file_trash has been changed to return G_IO_ERROR_NOT_SUPPORTED
for locations on system-internal mounts. Let's verify that.

https://gitlab.gnome.org/GNOME/glib/issues/251
2018-06-08 13:27:13 +02:00
Philip Withnall
ebcb434c75 Merge branch 'master.nomsvcproj' into 'master'
Remove glib-zip.in (from Issue #1409)

See merge request GNOME/glib!80
2018-06-08 10:52:38 +00:00
Philip Withnall
c251c719b6 glib-compile-resources: Minor string improvements to --help output
Fix some capitalisation problems, and one missing space.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-08 11:43:44 +01:00
Philip Withnall
037f286713 glib-compile-resources: Clarify --help output for --sourcedir argument
Make the --help output more consistent with the man page, making it more
obvious that --sourcedir only applies to the files referenced in FILE,
not to the location of FILE itself.

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

https://gitlab.gnome.org/GNOME/glib/issues/1406
2018-06-08 11:42:52 +01:00
Ondrej Holy
13e751cab4 glocalfile: Update G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH logic
Change G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH logic to be consistent
with recent g_local_file_trash changes, i.e. set this to FALSE for
locations on system-internal mounts.

https://gitlab.gnome.org/GNOME/glib/issues/251
2018-06-08 11:24:23 +02:00
Ondrej Holy
d1eaf72c00 glocalfile: Allow trashing only for locations supported by trash:///
New bugs appears periodically in nautilus/gvfs/glib components that not
all trashed files are shown in trash:///. It used to be problem mostly
for "bind mounts" and btrfs subvolumes only. Currently, it is also
problem for nfs, cifs and other filesystems, which have been recently
added by commmit 0d69462f on the list of system internal filesystems.

This happens because the trash backend doesn't monitor files on system
internal mounts. Such behavior is not against the trash-spec, however,
we should be consistent within GNOME.

This behavior has the nice side-effect that it solves issues with hangs
on network filesystems: https://gitlab.gnome.org/GNOME/glib/issues/605,
because those are currently on the system internal filesystem list.

https://gitlab.gnome.org/GNOME/glib/issues/251
2018-06-08 11:24:20 +02:00
Chun-wei Fan
26b5d7dfff Remove glib-zip.in
We have not updated nor used this script for a long time, and nowadays
Meson makes it much easier to build on Windows for either Visual Studio
or MinGW, even straight from a GIT checkout, so it's about time that we
drop the glib-zip script from the source tree.
2018-06-08 15:47:22 +08:00
Chun-wei Fan
aa44ece684 README.win32: Give details about MSVC builds
Give a more detailed outline of the steps needed for a Visual Studio
build of GLib.
2018-06-08 15:45:03 +08:00
Jehan
2cac8381db gio: fix g-icon tests to follow recent changes.
Main changes were:
- take into account that style variants are added to the list of icon
  names.
- In the test of icons set with 3 names ("first", "testicon" and
  "last"), I also changed "first" to "first-symbolic" so that we can
  test in such a case that the variant is the regular icon (only for
  this name, out of the 3).
- Finally icon hashes are necessarily changed, and since emblems are
  sorted by their hash in emblem icons, I had to invert an order which
  was now different in one of the tests.
2018-06-08 04:16:15 +02:00
Jehan
8f729c06ea gio: update icon list when appending or prepending an icon name to...
... a theme icon.
Otherwise fallbacks of the added icon name are not added to the list (if
use-default-fallbacks is set), nor is the regular/symbolic variant. Also
if we do not recreate the finale list from scratch, sorting of icons and
their variants may end up wrong.
To this end, let's keep around the icon names used for initialization,
separate from the finale name list.
2018-06-08 04:16:15 +02:00
Jehan
5fb6d788a5 gio: do not add an icon name already in the list.
This may happen when creating an icon with several icon name whereas one
is already a variant of a previous one.
2018-06-08 04:16:15 +02:00
Jehan
9290044265 gio: generate (non-)symbolic and fallback variants for every icon name.
When a themed icon is constructed with several input icon names, add the
variants (symbolic as well as level fallbacks) for every icon names, not
only the first one.
The search order is: first icon name, then its level fallbacks, then
second icon name, then its level fallbacks, then all style variants
(symbolic or regular, opposite to requested style) keeping the same
order again.

This fixes the contenttype GIO unit test.
2018-06-08 04:16:15 +02:00
Jehan
e0f2671a4a gio: icons should fallback to non-preferred style appropriately.
Whatever the preferred icon style is (symbolic, regular or the requested
style), fallbacking to the other style in case of absent variant is
better than not finding any icon at all.
Also style fallbacking should be managed separately from property
"use-default-fallbacks". Default fallbacks are meant for the process of
getting up in context levels (as separated by dashes in icon name). Even
though it also uses dash characters in format, this is a different
concept as the variant of styles.

Without this commit for instance, if an icon only had a symbolic
variant, and the theme had "-gtk-icon-style" set to "regular" while your
GTK+ application requested the regular icon name, you were getting no
icons, and the application would look completely broken.
Now one would at least fallback to the symbolic icon as last resort
(which is infinitely better than having no icons).
2018-06-08 04:16:15 +02:00
Xavier Claessens
caf68ed87b Merge branch 'fam-ci' into 'master'
Fam ci

See merge request GNOME/glib!78
2018-06-07 17:23:26 +00:00
Philip Withnall
11a8fd6b87 Merge branch 'revert-205059b9' into 'master'
Revert "Merge branch 'wip/oholy/trashing-locations' into 'master'"

See merge request GNOME/glib!79
2018-06-07 16:57:49 +00:00
Philip Withnall
da3daf2803 Revert "Merge branch 'wip/oholy/trashing-locations' into 'master'"
This reverts merge request !49
2018-06-07 16:42:57 +00:00
Xavier Claessens
7016aedde8 ci: Build fam module on linux 2018-06-07 11:33:43 -04:00