Commit Graph

17848 Commits

Author SHA1 Message Date
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
Philip Withnall
32cc60dbff gmessages: Fix -Wformat warnings for g_message() and friends
When compiling with G_LOG_USE_STRUCTURED, g_message(), g_debug(), etc.
use g_log_structured(). The message format string and its format
arguments are passed as the final set of arguments in a longer varargs
list, which includes the log domain and level (and other) fields.
Passing the message format in this way means it’s not possible for the
compiler to know to check its format placeholders when compiling with
-Wformat.

Fix support for this by adding a new semi-private helper function,
_g_log_structured_standard(), which only uses varargs for the message
format and its arguments, and uses fixed arguments for the other fields.
This is then converted to a set of GLogFields and passed to
g_log_structured() as normal.

Support for -Wformat when compiling *without* G_LOG_USE_STRUCTURED was
never broken.

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

https://bugzilla.gnome.org/show_bug.cgi?id=793074
2018-02-02 10:10:43 +01:00
Philip Withnall
07f75f6cc2 gdbusmessage: Make a translatable message translatable with plurals
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=658713
2018-02-02 10:07:12 +01:00
Philip Withnall
5ed77c1104 gdatainputstream: Deprecate read_until() in favour of read_upto()
g_data_input_stream_read_upto() was introduced in 2.26; now it’s GLib
2.56, we can probably deprecate the old versions (since the handling of
consuming the stop character differs between the sync and async versions
of it).

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

https://bugzilla.gnome.org/show_bug.cgi?id=584284
2018-02-02 10:05:55 +01:00
Philip Withnall
3a88ab6c25 tests: Add some documentation to the illegal sequence conversion test
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790698
2018-02-02 10:04:20 +01:00
Philip Withnall
8abf3a04e6 gconvert: Fix error handling for g_iconv() with unrepresentable chars
The behaviour of upstream iconv() when faced with a character which is
valid in the input encoding, but not representable in the output
encoding, is implementation defined:

http://pubs.opengroup.org/onlinepubs/9699919799/

Specifically:

   If iconv() encounters a character in the input buffer that is valid,
   but for which an identical character does not exist in the target
   codeset, iconv() shall perform an implementation-defined conversion
   on this character.

This behaviour was being exposed in our g_iconv() wrapper and also in
g_convert_with_iconv() — but users of g_convert_with_iconv() (both the
GLib unit tests, and the implementation of g_convert_with_fallback())
were assuming that iconv() would return EILSEQ if faced with an
unrepresentable character.

On platforms like NetBSD, this is not the case: NetBSD’s iconv()
finishes the conversion successfully, and outputs a string containing
replacement characters. It signals those replacements in its return
value from iconv(), which is positive (specifically, non-zero) in such a
case.

Let’s codify the existing assumed behaviour of g_convert_with_iconv(),
documenting that it will return G_CONVERT_ERROR_INVALID_SEQUENCE if
faced with an unrepresentable character. As g_iconv() is a thin wrapper
around iconv(), leave the behaviour there implementation-defined (but
document it as such).

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

https://bugzilla.gnome.org/show_bug.cgi?id=790698
2018-02-02 10:04:20 +01:00
Philip Withnall
a19eed4691 tests: Add a missing const to a variable in the GConvert tests
Also rename it to make it clearer how it’s encoded (as UTF-8).

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

https://bugzilla.gnome.org/show_bug.cgi?id=790698
2018-02-02 10:04:20 +01:00
Philip Withnall
19bc03ef65 docs: Minor wording improvements in GConvert documentation
Fix capitalisation of GLib, make some text less gender-specific, and add
some missing colons.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790698
2018-02-02 10:04:20 +01:00
Philip Withnall
ad6afd0fc1 docs: Replace an XML entity with a UTF-8 character instead
Another part of the long tail of converting our documentation from
DocBook to Markdown.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790698
2018-02-02 10:04:20 +01:00
Philip Withnall
38592939d7 docs: Clarify the definition of goffset
off64_t doesn’t exist in any standard (definitely not C99), and so
goffset is actually closer to off_t in 64-bit mode.

However, goffset is always defined as gint64, so make that clear.

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

https://bugzilla.gnome.org/show_bug.cgi?id=792856
2018-02-02 09:29:22 +01:00
Stewart Brodie
fc857073a0 gkeyfile: Fix FD validity test to be technically correct
The fd could be valid and zero.

https://bugzilla.gnome.org/show_bug.cgi?id=760324
2018-02-02 09:20:11 +01:00
Philip Withnall
b6d1c128b3 gcharset: Mention the environment variables queried by g_get_charset()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-02-01 17:38:28 +00:00
Bastien Nocera
e889fb2a7f resolver: Return early if URI is invalid
https://bugzilla.gnome.org/show_bug.cgi?id=772989
2018-02-01 14:58:29 +00:00
Bastien Nocera
99b792fac0 networkaddress: Add early sanity check to _g_uri_parse_authority()
Check whether the URI is valid ASCII before trying to parse it. This
should catch broken URIs early.

https://bugzilla.gnome.org/show_bug.cgi?id=772989
2018-02-01 14:58:28 +00:00
Bastien Nocera
5f2c20e88b networkaddress: Return an error from _g_uri_parse_authority()
So that errors can be propagated if necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=772989
2018-02-01 14:58:28 +00:00
Bastien Nocera
88366621ee GSimpleProxyResolver: Add test case for broken hostname
https://bugzilla.gnome.org/show_bug.cgi?id=772989
2018-02-01 14:58:28 +00:00
Bastien Nocera
132cf9a9d4 resolver: Return error looking up services on invalid hostnames
Make g_resolver_lookup_service() and
g_resolver_lookup_service_async() error out when invalid hostnames are
passed.

https://bugzilla.gnome.org/show_bug.cgi?id=772989
2018-02-01 14:58:28 +00:00
Bastien Nocera
cb8c919952 simpleproxyresolver: Don't crash on invalid hostname
Check for g_hostname_to_ascii() failure, rather than crashing when
checking whether an invalid hostname should go through the proxy.

The HTTP library should report the error about the invalid hostname
once we actually try to connect to it.

https://bugzilla.gnome.org/show_bug.cgi?id=772989
2018-02-01 14:17:50 +00:00
Ignacio Casal Quinteiro
1a99154898 gpollableoutputstream: document side effects of WOULD_BLOCK on D/TLS
If the underlying transport is D/TLS the same data and data length
is required to be sent on the next iteration when a WOULD_BLOCK
happens. This is due to the fact that gnutls or openssl keep
an internal state for the data.

https://bugzilla.gnome.org/show_bug.cgi?id=792862
2018-01-31 22:37:18 +00:00
Philip Withnall
4752d72a60 gdbusaddress: Disable proxy support for D-Bus addresses
See the discussion in the bug report: with proxy support enabled, a
proxy resolver is created. Doing that will load all the GIO modules, and
typically at least one of them will try to use GDBus during
initialisation, which will cause a deadlock.

Using a TCP address with GDBusAddress is still supported, but accessing
it over a proxy is not.

Document this.

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

https://bugzilla.gnome.org/show_bug.cgi?id=792499
2018-01-31 22:25:02 +00:00
Iñigo Martínez
3ef83618d9 gdbus-codegen: Improve documentation
Recent changes has extended the functionality of `gdbus-codegen`
by implementing new options.

This patch extends the documentation including the behaviour of
the new options along the old ones.

(Wording tweaked by Philip Withnall before pushing.)

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-31 22:14:04 +00:00
Iñigo Martínez
93042e0052 gdbus-codegen: Fix issue with docbook generation
In cases where gdbus-codegen is used only for docbook generation,
the execution stops with the following error message:

  `Using --header or --body requires --output`

This is because it was assumed that, in addition to the docbook
generation, the header or source code were always generated.

This patch fixes this, and the header or source code generation
is not mandatory, so the docbook can be generated separately.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-31 22:12:51 +00:00
Pavlo Solntsev
382d13b618 Clarification for memmory allocation function
Difference between g_try_... family of functions and their counterparts
has been clarified.

https://bugzilla.gnome.org/show_bug.cgi?id=792903
2018-01-31 22:10:51 +00:00
Ondrej Holy
7e0d42e3dc gunixmounts: Skip accumulated events from file monitor
Skip accumulated events from file monitor which we are not able to handle
in a real time instead of emitting mounts_changed signal several times.
This should behave equally to GIOChannel based monitoring. See Bug 792235.

https://bugzilla.gnome.org/show_bug.cgi?id=793006
2018-01-30 15:31:13 +01:00
Emmanuele Bassi
c1d58dd7e0 build: Document the chmod-scripts configure command
The chmod of all the scripts we generate from a template via configure
is necessary because configure will not preserve the bits of the
template when generating a new file.

There's no explanation for it, and you have to hunt it down the commit
history. Since Meson does the right thing, we added the executable bit
on the templates, but we cannot remove the AC_CONFIG_COMMANDS macro from
the Autotools build without breaking it. Let's document this, to avoid
nasty surprises.
2018-01-30 11:18:34 +00:00
Christian Hergert
47b78e6d83 tests: additional test for g_bytes_new_from_bytes()
This adds two new tests for g_bytes_new_from_bytes().

One test ensures that when creating a new GBytes that is a slice of
the entire base bytes, we just return the base bytes with it's reference
count incremented by one.

The other test ensures that when performing sub-slices of GBytes, for
which the parent GBytes also references a GBytes, that we skip the
intermediate GBytes and reference the base GBytes. Additional testing
of the internal state of the GBytes structure is performed to prove
the correctness of the implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=792780
2018-01-27 11:43:38 -08:00
Christian Hergert
4151bce6db bytes: avoid intermediate refs in g_bytes_new_from_bytes()
When referencing a GBytes that is already a slice of another GBytes, we
can avoid referencing the intermediate GBytes and instead reference the
root bytes.

Doing so helps avoid keeping N GBytes instances alive when the
intermediates would have otherwise been finalized.

https://bugzilla.gnome.org/show_bug.cgi?id=792780
2018-01-27 11:43:38 -08:00
Bastien Nocera
801accf746 GNotification: Don't ignore set_urgent()'s argument
set_urgent() would behave is if @urgent was always true. The regression
was introduced in commit 01098e34c1

https://bugzilla.gnome.org/show_bug.cgi?id=792777
2018-01-23 14:24:12 +00:00
Philip Withnall
cea72036e3 gnotification: Add missing deprecation tag to set_urgent()
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=792777
2018-01-22 11:24:47 +00:00