Commit Graph

18497 Commits

Author SHA1 Message Date
Philip Withnall
0e3b137210 codegen: Fix a minor Python linting warning
This introduces no functional changes.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795304
2018-06-14 18:57:53 +01:00
Philip Withnall
3a1536ba34 codegen: Suppress the old --xml-files option in the --help output
Since it’s deprecated in favour of positional arguments, including it in
the help output is confusing.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795304
2018-06-14 18:57:53 +01:00
Philip Withnall
8916874ee6 codegen: Add --interface-info-[body|header] modes
These generate basic .c and .h files containing the GDBusInterfaceInfo
for a D-Bus introspection XML file, but no other code (no skeletons,
proxies, GObjects, etc.).

This is useful for projects who want to describe their D-Bus interfaces
using introspection XML, but who wish to implement the interfaces
manually (for various reasons, typically because the skeletons generated
by gdbus-codegen are too simplistic and limiting). Previously, these
projects would have had to write the GDBusInterfaceInfo manually, which
is painstaking and error-prone.

The new --interface-info-[body|header] options are very similar to
--[body|header], but mutually exclusive with them.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795304
2018-06-14 18:57:53 +01:00
Philip Withnall
99b64d4014 codegen: Support Since and name changing annotations on annotations
Recursive annotations do seem to be supported, so we should support them
properly in the type system representation. This currently introduces no
behavioural changes, but will be used in upcoming commits.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795304
2018-06-14 18:57:53 +01:00
Philip Withnall
c36c55dbd6 Merge branch 'fdonotif-fix-backend-dispose-race' into 'master'
gfdonotificationbackend: hold a strong ref on backend

See merge request GNOME/glib!106
2018-06-14 17:49:29 +00:00
Philip Withnall
7830b65c5f Merge branch 'triple_dash' into 'master'
goption: Reject group options specified with three dashes

Closes #1418

See merge request GNOME/glib!108
2018-06-14 17:43:53 +00:00
Philip Withnall
6dc543c6d3 Merge branch 'issue-699' into 'master'
Deprecate g_type_class_add_private()

Closes #699

See merge request GNOME/glib!7
2018-06-14 17:27:30 +00:00
Philip Withnall
ac690d9a8c docs: Amend the docs for g_str_equal() to reflect current general usage
People do (and should) use g_str_equal() for string comparisons outside
of hash tables, because it’s easier to read than
`strcmp (str1, str2) == 0`. That should not be discouraged.

However, we should still be careful to point out that g_str_equal() is
not NULL-safe, and g_strcmp0() is.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-14 18:12:42 +01:00
Nathan Miller
0b09890bff goption: Reject group options specified with three dashes
Commandline option parsing would recognize group options specified
with three dashes (i.e. ---foo 42).  This behaviour was limited to group
options.
2018-06-14 10:49:31 -05:00
Xavier Claessens
2fe4fa6cd0 Merge branch 'meson-version' into 'master'
build: Bump Meson dependency to 0.46.1

See merge request GNOME/glib!107
2018-06-14 13:44:51 +00:00
Philip Withnall
9c840fedd8 build: Bump Meson dependency to 0.46.1
We don’t strictly require this, but given that our CI runs it, we
essentially never test with 0.46.0, so it might as well be broken.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-14 13:02:18 +01:00
Emmanuele Bassi
7e5db31d36 Deprecate g_type_class_add_private()
It's been 4 years and 8 development cycles since we introduced
G_ADD_PRIVATE and offset-based private data access. It is now
time to finally deprecate the old mechanism.

Closes: #699
2018-06-14 11:33:53 +01:00
Philip Withnall
d8c003dea6 Merge branch 'G_SOURCE_FUNC-macro' into 'master'
Add G_SOURCE_FUNC cast macro which suppresses -Wcast-function-type

See merge request GNOME/glib!82
2018-06-14 09:34:12 +00:00
Will Thompson
039fa6897b
Add G_SOURCE_FUNC cast macro which suppresses -Wcast-function-type
This is the workaround suggested by
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wcast-function-type

This warning is not enabled by default during the GLib build, but
applications may want to opt into it.
2018-06-14 10:11:12 +01:00
Arnaud Rebillout
5a73eef749 gfdonotificationbackend: hold a strong ref on backend
This is to avoid race between dispose() being called on the
GFdoNotificationBackend instance, and any pending operations which are
still waiting on a D-Bus reply when it’s disposed.

(thx to Philip Withnall for pointing that out)

Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>
2018-06-14 11:28:17 +07:00
Philip Withnall
c26558c1b1 Merge branch 'g_dbus_is_supported_address-assertion-failure' into 'master'
g_dbus_is_supported_address(): set error if returning FALSE

See merge request GNOME/glib!101
2018-06-13 11:31:41 +00:00
Will Thompson
ba7b035f5b
g_dbus_is_supported_address(): set error if returning FALSE
Previously, calling:

    g_dbus_is_supported_address ("some-imaginary-transport:", NULL)

correctly returned FALSE; but calling:

    g_dbus_is_supported_address ("some-imaginary-transport:", &error)

crashed with:

    GLib-GIO:ERROR:../gio/gdbusaddress.c:434:g_dbus_is_supported_address:
    assertion failed: (ret || (!ret && (error == NULL || *error != NULL)))

This was because, if the address component did not start with a known
transport, no error was set. Fix this, reusing an error string used by
the corresponding else branch in g_dbus_address_connect(), and adjust
the test to pass both NULL and non-NULL GError **s to this function in
every test case. This case:

    g_assert (!g_dbus_is_supported_address ("some-imaginary-transport:foo=bar;unix:path=/this/is/valid", NULL));

would have caught this bug with a non-NULL GError **.
2018-06-13 11:01:56 +01:00
Philip Withnall
e48a3920d4 Merge branch 'fdonotif-segfault-fix' into 'master'
gfdonotificationbackend: Fix possible invalid pointer in dbus callback

See merge request GNOME/glib!90
2018-06-13 09:27:11 +00:00
Arnaud Rebillout
57e070f874 gfdonotificationbackend: Fix possible invalid pointer in dbus callback
The way things were before: a FreedesktopNotification struct is
allocated before the dbus call, and this same struct is possibly re-used
for other dbus calls. If the server becomes unavailable, the callback
will be invoked after the call times out, which leaves a long time where
other dbus calls can happen, re-using the same FreedesktopNotification
as user data. When the first call times out, the callback is invoked,
and the user data is freed. Subsequent calls that used the same user
data will time out later on, and try to free a pointer that was already
freed, hence segfaults.

This bug can be reproduced in Cinnamon 3.6.7, as mentioned in:
<https://github.com/linuxmint/Cinnamon/issues/7491>

This commit fixes that by always allocating a new
FreedesktopNotification before invoking dbus_call(), ensuring that the
callback always have a valid user data.

Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>
2018-06-13 08:32:30 +07:00
Xavier Claessens
0d0e23328f Merge branch '776583-win32-notifications-warn-once' into 'master'
gwin32notificationbackend: Only warn once

See merge request GNOME/glib!96
2018-06-12 23:09:59 +00:00
Philip Withnall
e660355d25 Merge branch 'tests-remove-perl' into 'master'
tests: Port gen-casefold-txt.pl and gen-casemap-txt.pl to Python 3. See #1332

See merge request GNOME/glib!37
2018-06-12 20:31:43 +00:00
Christoph Reiter
a580185cdc tests: Port gen-casefold-txt.pl and gen-casemap-txt.pl to Python 3. See #1332
I've tried to keep the code structure roughly the same.
2018-06-12 22:18:03 +02:00
Philip Withnall
603d40467c Merge branch '303-win32-spawn' into 'master'
gspawn: Make error codes on Windows more specific

Closes #303

See merge request GNOME/glib!100
2018-06-12 19:10:52 +00:00
Philip Withnall
d157102a54 gspawn: Factor out error code conversion function
This will be used in gspawn-win32.c too in an upcoming commit.

https://gitlab.gnome.org/GNOME/glib/issues/303

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-12 16:13:51 +01:00
Philip Withnall
6c8da69443 gspawn: Make error codes on Windows more specific
A slightly modified patch originally written by Morten Welinder
<terra@gnome.org> to make the error codes returned by g_spawn_*()
functions more specific when on Windows. They are already this specific
on Linux.

Add a unit test for the ENOENT case.

https://gitlab.gnome.org/GNOME/glib/issues/303

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-12 16:13:44 +01:00
Philip Withnall
f4d2051fc1 gspawn: Fix errno saving in Windows implementation
The error number was saved after some g_debug() and g_free() calls, in
various places, which meant it could have been overwritten since the
error we care about happened.

https://gitlab.gnome.org/GNOME/glib/issues/303

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-12 15:33:35 +01:00
Daniel Mustieles
8259ad9907 Updated Spanish translation 2018-06-12 15:56:27 +02:00
Philip Withnall
39382c7889 gwin32notificationbackend: Only warn once
Use a GOnce to make sure we only warn about notifications not being
supported on Windows once, rather than on each attempted notification.

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

Helps: https://gitlab.gnome.org/GNOME/glib/issues/1234
2018-06-12 12:45:35 +01:00
Christoph Reiter
fded2090e2 Merge branch '811-content-type-docs' into 'master'
docs: Add (transfer full) annotation to g_content_type_get_mime_type()

Closes #811

See merge request GNOME/glib!84
2018-06-12 08:52:56 +00:00
Philip Withnall
54498aa7ae Merge branch 'lrn/binary-tests' into 'master'
Force binary mode for stdout in printf tests

See merge request GNOME/glib!89
2018-06-11 15:06:25 +00:00
Philip Withnall
815478a74e Merge branch 'refcount-types' into 'master'
Reference counting types

See merge request GNOME/glib!54
2018-06-11 14:20:46 +00:00
Руслан Ижбулатов
ce1e32ec34 Force binary mode for stdout in printf tests
This allows test calls to produce output with \n
line separators on Windows, instead of \r\n.
Reduces the number of ifdefs, since all checks
can be done against one template on all platforms.
2018-06-11 14:20:34 +00:00
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