Commit Graph

17926 Commits

Author SHA1 Message Date
Ernestas Kulik
c01c255895 tests: data-input-stream: fix -Wduplicated-branches
The fix makes things a bit awkward, but it seems to work just fine.

https://bugzilla.gnome.org/show_bug.cgi?id=793399
2018-02-16 17:38:26 +00:00
Piotr Drąg
59d4ee99f2 Update Polish translation 2018-02-16 17:35:24 +01:00
Lubomir Rintel
c1f5e52844 gtype: cast *_init functions to void(*)(void) first
The *_init() functions have prototypes incompatible with *InitFunc types they
are being cast to. This upsets GCC 8's -Wcast-function-type that's enabled by
default with -Wextra.

Let's not have the public header files emit a warning and neutralize it by
doing a void(*)(void) cast first.

https://bugzilla.gnome.org/show_bug.cgi?id=793272
2018-02-16 15:48:15 +00:00
Ernestas Kulik
62e8168878 gatomic: fix -Wduplicated-branches
The checks that the argument passed is a pointer to an integer contain
duplicate branches, which GCC complains about very loudly as of version
7.

https://bugzilla.gnome.org/show_bug.cgi?id=793399
2018-02-16 15:43:11 +00:00
Ernestas Kulik
c97922c104 gtester: fix -Wduplicated-branches
One of the “quick” or “slow” test run modes is always added to the
argument list, making the branching pointless, which, coincidentally,
now causes a warning.

https://bugzilla.gnome.org/show_bug.cgi?id=793399
2018-02-16 15:14:39 +00:00
Rafael Fontenelle
f84ce12989 Update Brazilian Portuguese translation 2018-02-16 15:12:15 +00:00
Rafal Luzynski
be4f96b650 g_date_time_format: Support nominative/genitive months
Supports %OB (alternative, standalone, nominative) month name along
with the old %B (primary, in a complete date format context, genitive)
month name.  Similarly %Ob and %Oh for abbreviated month names.
Depending on the underlying operating system uses nl_langinfo()
or provides our custom implementation.

(Tweaked by Philip Withnall <withnall@endlessm.com> to add test case
comment and bug reference.)

https://bugzilla.gnome.org/show_bug.cgi?id=749206
2018-02-16 14:37:51 +00:00
Natanael Copa
d933cf99bf gquark: simplify g_intern_string/g_intern_static_string
Move the common code to a quark_intern_string_locked function. This has
no effect on the generated code but makes codebase a bit cleaner.

https://bugzilla.gnome.org/show_bug.cgi?id=768507
2018-02-16 12:49:43 +00:00
Natanael Copa
2f07630b43 gquark: simplify g_quark_from_static_string/g_quark_from_string
Move common code to quark_from_string_locked  wrapper function. This has
no effect on generated code but it makes codebase a bit cleaner.

https://bugzilla.gnome.org/show_bug.cgi?id=768507
2018-02-16 12:49:43 +00:00
Philip Withnall
a66fc8e3a9 gfile: Fix FD leak introduced in error path in previous commit
The hazards of ‘just a quick fix and I will push’.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-02-16 12:03:47 +00:00
Andrés Souto
a5778ef7c5 gio: bump splice copy buffer size to 1024k
This change increases throughput when copying files for some filesystems

(Modified by Philip Withnall <withnall@endlessm.com> to add more error
handling.)

https://bugzilla.gnome.org/show_bug.cgi?id=791457
2018-02-16 11:54:56 +00:00
Philip Withnall
2ffba0e262 gdatainputstream: Document the returned string is always nul-terminated
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody

https://bugzilla.gnome.org/show_bug.cgi?id=742124
2018-02-16 11:15:02 +00:00
Philip Withnall
0664b61782 gdbusconnection: Fix error in g_dbus_connection_emit_signal() docs
It incorrectly said that an error could only be returned if the GVariant
was incorrect for the D-Bus API, but that’s not true: an error will also
be returned if you call it on a closed GDBusConnection.

Clarify that, and mention the actual error codes which are returned.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-02-15 16:42:26 +00:00
Emmanuele Bassi
80d328b3a8 build: Separate the Objective C files into their own helper lib
This avoid polluting the CFLAGS with -xobjective-c.

(Rebased by Philip Withnall <withnall@endlessm.com>.)

https://bugzilla.gnome.org/show_bug.cgi?id=672777
2018-02-15 14:31:36 +00:00
Emmanuele Bassi
9453b97e09 docs: Add G_ENABLE_DIAGNOSTIC
We need to mention this environment variable, so that developers have a
fighting chance of actually using it.

https://bugzilla.gnome.org/show_bug.cgi?id=732184
2018-02-15 11:25:53 +00:00
Emmanuele Bassi
77419cf578 docs: Mention the newly added return values
The return value of the g_hash_table_add(), g_hash_table_insert(), and
g_hash_table_replace() functions was changed from void to gboolean in
GLib 2.40, but it was not mentioned in the API reference or the release
notes.

https://bugzilla.gnome.org/show_bug.cgi?id=793300
2018-02-15 11:25:53 +00:00
Philip Withnall
809c66639f gobject: Mention transfer semantics of installing properties on GObjects
GParamSpec supports floating references.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-02-14 15:11:11 +00:00
Matthias Clasen
ee57d56e8d 2.55.2 2018-02-14 08:19:20 -05:00
Fabio Tomat
d3e5a190d2 Update Friulian translation 2018-02-13 18:48:54 +00:00
Philip Withnall
66ab836f5a gsubprocess: Fix a critical calling communicate() with no pipes
If calling g_subprocess_communicate() on a GSubprocess with no
stdout/stderr pipe, a critical warning would be emitted from
g_memory_output_stream_steal_as_bytes(), as it would be called on a NULL
output stream.

Fix that, improve the relevant GIR annotations, and expand the unit
tests to cover it (and various other combinations of flags).

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

https://bugzilla.gnome.org/show_bug.cgi?id=793331
2018-02-13 16:27:32 +00:00
Philip Withnall
4183cedbe2 tests: Use a different time for testing UNIX timestamps
The test_GDateTime_new_from_unix() test creates a UNIX timestamp
representing 1990-01-01 00:00:00 in the local timezone, and then turns
it into a GDateTime using g_date_time_new_from_unix_local(). This should
succeed regardless of the current local timezone (TZ environment
variable).

However, it was failing for TZ=America/Lima, and *only* for that
timezone.

As it turns out, Lima used to have a DST leap at exactly 00:00:00 on the
1st of January — but this stopped in 1994, which made investigation a
bit harder. See:
https://www.timeanddate.com/time/change/peru/lima?year=1990.

What was happening is that 1990-01-01 00:00:00 was being converted to
the timestamp 631170000, but GDateTime was converting that timestamp to
1990-01-01 01:00:00 when loading it. Both conversions are correct: a DST
leap creates an equivalence between an hour’s worth of timestamps.

We can somewhat validate this by seeing that timestamp 631169999 maps to
1989-12-31 23:59:59, and timestamp 631170001 maps to 1990-01-01
01:00:01.

Fix this by changing the date used by the test to one where no timezone
was undergoing a DST leap in 1990. This should never change, as all that
data is now historical.

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

https://bugzilla.gnome.org/show_bug.cgi?id=793319
2018-02-13 15:56:30 +00:00
Philip Withnall
35d5add4bb build: Lower libmount dependency to 2.23
Since commit 96ebcee8c4, we don’t actually need libmount 2.28. Lower our
dependency to 2.23 so that we can continue to build against CentOS 7.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=793288
2018-02-13 14:59:03 +00:00
Philip Withnall
644ecec971 gconvert: Fix some typos in documentation comments
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-02-13 14:49:20 +00:00
Philip Withnall
0cd5127494 build: Fix Meson checks for res_nclose() and res_ndestroy()
The checks wouldn’t compile, and hence would always fail.

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

https://bugzilla.gnome.org/show_bug.cgi?id=793291
2018-02-13 14:18:34 +00:00
Philip Withnall
04b3ce7255 build: Remove incorrect to_int() calls in meson.build
They’re called on assignment to these variables.

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

https://bugzilla.gnome.org/show_bug.cgi?id=793288
2018-02-13 14:17:11 +00:00
Philip Withnall
b716660fab build: Drop fallback checks for libmount versions without pkg-config
Building against libmount installed into a non-default prefix wasn’t
working, as we were using #include <libmount/libmount.h> rather than
the correct #include <libmount.h> — all the mount.pc pkg-config files
set `Cflags: -I${includedir}/libmount`.

Fixing this while retaining the fallback support for versions of
libmount without a pkg-config file would have been tricky (we would need
to work out a suitable -I flag to set in LIBMOUNT_CFLAGS) to still be
able to use the correct #include path). Thankfully, libmount gained
pkg-config support a long time ago, so I think we can safely drop the
fallback code. In particular, Debian Jessie, Ubuntu Trusty, and CentOS 5
all ship a mount.pc file.

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

https://bugzilla.gnome.org/show_bug.cgi?id=793288
2018-02-13 14:17:11 +00:00
Michael Catanzaro
c3c7b52f91 goutputstream: Fix missing call to clear_pending in flush_async
If flush_async is deleted by a child class, then calling
g_output_stream_flush_async would leave the GOutputStream in an invalid
state. I'm not aware of any GOutputStream that would be affected by this
issue, but might as well fix it.

https://bugzilla.gnome.org/show_bug.cgi?id=738277
2018-02-13 08:04:24 -06:00
Will Thompson
5b88ed8caf
gsettings: fix typo in class documentation 2018-02-12 21:28:16 +00:00
Philip Withnall
f8ee429db7 gdbusproxy: Add some missing (transfer) and (nullable) annotations
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=773663
2018-02-12 11:33:12 +00:00
Cheng-Chia Tseng
f82b8f31e3 Update Chinese (Taiwan) translation 2018-02-10 07:31:17 +00:00
Fran Dieguez
80ce29f44b Update Galician translation 2018-02-09 13:56:51 +00:00
Mikhail Zabaluev
7f1fd247a7 gconvert: g_filename_from_utf8() returns (type filename)
The existing array annotation is inconsistent with the other
conversion functions. Now that the implementation guarantees
no embedded NULs, the return value can be re-annotated.

https://bugzilla.gnome.org/show_bug.cgi?id=756128
2018-02-09 13:05:22 +00:00
Mikhail Zabaluev
8a93e2d54e gconvert: Correctly annotate string types and output parameters
Note that the g_convert() API works with byte arrays. It's wrong to
default to utf8 there, because iconv can read and produce strings with
interior nul characters which are not allowed in (type utf8).
The documentation was misleading about that in some places, so that got
corrected as well.

Strings in the locale encoding are annotated as dynamic-length byte
arrays because they don't have any guaranteed format and can contain
nul bytes. For UTF-8 strings in g_*_{from,to}_utf8(), GLib assumes
no embedded nul bytes and the (type utf8) annotations on the UTF-8
parameters and return values remain as they were. Likewise for
(type filename).

https://bugzilla.gnome.org/show_bug.cgi?id=756128
2018-02-09 13:05:22 +00:00
Philip Withnall
565d8fa1ee docs: Add Markdown backticks around /dev/null in a few places
This improves the formatting of the documentation ever so slightly.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-02-08 16:39:32 +00:00
Philip Withnall
ca95aa7e12 Revert "GValue – Don't cast G_VALUE_TYPE() argument to GValue*"
After building a test run of all GNOME modules against this, we can
conclude that it is a visible API break: it breaks the NetworkManager
build.

http://build.gnome.org/continuous/buildmaster/builds/2018/02/08/46/build/log-NetworkManager.txt

NetworkManager is (almost legitimately) passing a gpointer to
G_VALUE_TYPE, which I think is a use case we should continue supporting.

This reverts commit a05a21bec2.

https://bugzilla.gnome.org/show_bug.cgi?id=793186
2018-02-08 14:28:32 +00:00
Emmanuele Bassi
76df8cba85 Add myself to the DOAP for GLib
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=793298
2018-02-08 13:45:26 +00:00
Philip Withnall
bba5d91add doap: Update git URIs to reflect GNOME GitLab migration
We’ve moved to GNOME GitLab! This is great.

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

https://bugzilla.gnome.org/show_bug.cgi?id=793298
2018-02-08 13:25:58 +00:00
Philip Withnall
9a50dcb7f3 doap: Add myself as a maintainer
I’m not sure how I’ve been conned into this.

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

https://bugzilla.gnome.org/show_bug.cgi?id=793298
2018-02-08 13:25:58 +00:00
Sebastian Dröge
a05a21bec2 GValue – Don't cast G_VALUE_TYPE() argument to GValue*
It's not possible to subclass GValue, and by always explicitly casting
here it is easy to write broken code (e.g. passing a GValue**) without
the compiler warning about that.

By not casting, the compiler will error out if anything but a GValue* is
passed here.

https://bugzilla.gnome.org/show_bug.cgi?id=793186
2018-02-08 12:29:57 +00:00
Philip Withnall
e9dd5e1819 gkeyfile: Fix -Wincompatible-pointer-types warning
Introduced in commit 1574321e51.

This fix introduces no functional changes (just a cast).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-02-08 12:29:57 +00:00
Matthias Clasen
a4fc4c1e6e trivial: add some helpful comments
Not everybody knows console color codes by heart.
2018-02-06 11:05:57 -05:00
Philip Withnall
567e5548bb codegen: Fix a typo in g_variant_get_objv()
g_variant_get_objpathv() doesn’t exist. The code actually meant
g_variant_get_objv().

This fixes a leak with `ao`-type properties in generated code.
Previously they wouldn’t be freed; now the container is (correctly)
freed.

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

https://bugzilla.gnome.org/show_bug.cgi?id=770335
2018-02-06 16:00:01 +00:00
Philip Withnall
79d9ea2598 gthread: Fix a typo in an #ifdef on the non-native mutex path
This seems to have been present since the code was introduced in commit
cedc82290f. The attr variable is defined
under one #ifdef, but destroyed under another, which doesn’t make any
sense. The second #ifdef variable is actually an enum value, rather than
the static initialiser value which makes more sense in the context.

Note that GMutex used to be statically initialised to the value of
PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP in gthread.h, before this was
reworked in commit e081eadda5.

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

https://bugzilla.gnome.org/show_bug.cgi?id=793026
2018-02-06 15:52:29 +00:00
Allison Lortie
1574321e51 GKeyFile: add API for getting locale of a string
g_key_file_get_locale_string() returns a translated string from the
keyfile.  In some cases, it may be useful to know the locale that that
string came from.

Add a new API, g_key_file_get_locale_for_key(), that returns the locale
of the string.

Include tests.

(Modified by Philip Withnall to rename the API and fix some minor review
issues. Squash in a separate test case commit.)

https://bugzilla.gnome.org/show_bug.cgi?id=605700
2018-02-06 15:51:33 +00:00
Kukuh Syafaat
7b3f78fddb Update Indonesian translation 2018-02-05 16:36:37 +00:00
Piotr Drąg
32b16798fd Update Polish translation 2018-02-05 00:10:55 +01:00
Philip Withnall
8e74fbf300 gnetworkaddress: Fix minor memory leak
From commit 99b792fac0.

Spotted by Coverity; CID 1385719.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-02-04 17:33:16 +01:00
Patrick Griffis
1c0bed93a3 docs: Clarify dest requirements of g_utf8_strncpy()
(Minor wording tweak by Philip Withnall.)

https://bugzilla.gnome.org/show_bug.cgi?id=520116
2018-02-03 12:12:28 +01:00
Philip Withnall
40be86bb0e gio: Port GThreadedResolver to use res_nquery() to fix thread-safety
res_query() uses global state in the form of the struct __res_state
which contains the contents of resolv.conf (and other things). On Linux,
this state seems to be thread-local, so there is no problem. On OS X,
however, it is not, and hence multiple res_query() calls from parallel
threads will compete and return bogus results.

The fix for this is to use res_nquery(), introduced in BIND 8.2, which
takes an explicit state argument. This allows us to manually store the
state thread-locally. If res_nquery() isn’t available, we fall back to
res_query(). It should be available on OS X though. As a data point,
it’s available on Fedora 27.

There’s a slight complication in the fact that OS X requires the state
to be freed using res_ndestroy() rather than res_nclose(). Linux uses
res_nclose().

(See, for example, the NetBSD man page:
https://www.unix.com/man-page/netbsd/3/res_ninit/. The Linux one is
incomplete and not so useful:
http://man7.org/linux/man-pages/man3/resolver.3.html.)

The new code will call res_ninit() once per res_nquery() task. This is
not optimal, but no worse than before — since res_query() was being
called in a worker thread, on Linux, it would implicitly initialise the
thread-local struct __res_state when it was called. We’ve essentially
just made that explicit. In practical terms, this means a
stat("/etc/resolv.conf") call per res_nquery() task.

In future, we could improve this by using an explicit thread pool with
some manually-created worker threads, each of which initialises a struct
__res_state on spawning, and only updates it on receiving
the #GResolver::reload signal.

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

https://bugzilla.gnome.org/show_bug.cgi?id=792050
2018-02-02 18:05:27 +01:00
Allison Lortie
235f4958a9 gsettings: remove redundancy in 'list-recursive'
Some projects use child schemas in an odd way: they link children which
already have their path pre-defined.  This causes the child schema (and
its keys) to be printed out twice:

 - once because it is, itself, a non-relocatable schema

 - once, as a recursion from its parent

We can avoid this by not recursing into child schemas that are
non-relocatable (on the assumption that they will be enumerated
elsewhere).

https://bugzilla.gnome.org/show_bug.cgi?id=723003
2018-02-02 14:41:00 +01:00