Commit Graph

16552 Commits

Author SHA1 Message Date
Dan Winship
6de5595570 Fix gio/tests/socket-listener
g_socket_listener_add_address() is synchronous; all of the events will
have been emitted before it returns and it doesn't queue any sources.
The test was unintentionally depending on the fact that
g_main_context_iterate(NULL, TRUE) would return anyway (at least the
first time it was called), but that's no longer true after e4ee307.

https://bugzilla.gnome.org/show_bug.cgi?id=768968
2016-07-19 17:22:07 -04:00
Emmanuele Bassi
7e40228cae Update the ignore file for GIO 2016-07-19 14:18:49 +01:00
Rico Tzschichholz
c67bd6cc54 gmessages: Fix G_GNUC_PRINTF mark for g_log_structured
GCC fails to build because of the trailing arguments, not part of the
format:

../../glib/gmessages.c: In function 'g_log_default_handler':
../../glib/gmessages.c:2385:21: error: too many arguments for format
[-Werror=format-extra-args]
                     NULL);
                     ^

The documentation for `__attribute__((format(...)))` in GCC

https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes

States that the second index must be 0 for functions that are not
available to be checked, like for vprintf-style functions. In this case
it's also appropriate because of the trailing arguments.

The sd-journal API in systemd, upon which the structured logging API is
modelled, also uses 0 as the second argument for the format attribute.

https://bugzilla.gnome.org/show_bug.cgi?id=744456
2016-07-19 11:10:34 +01:00
Ting-Wei Lan
07932996fa gmessages: Add G_GNUC_PRINTF mark for g_log_structured
It is required to avoid non-literal format string warning when using clang.

https://bugzilla.gnome.org/show_bug.cgi?id=744456
2016-07-19 01:55:06 +08:00
Daniel Mustieles
0346254502 Updated Spanish translation 2016-07-18 16:45:41 +02:00
Chun-wei Fan
97972471ca gio/glocalfile.c: Windows: Define ECANCELED if not already defined
Older Visual Studio may not have it defined, so define it like what is
defined for Visual Studio 2010 and later.
2016-07-18 14:41:17 +08:00
Chun-wei Fan
c08b1a6ae5 glib/gmessages.c: Use G_VA_COPY() instead of va_copy()
Some compilers may not support va_copy(), so use the G_VA_COPY macro so
that things can be supported properly on all supported compilers.
2016-07-18 14:25:52 +08:00
Chun-wei Fan
c6aee1bf15 Visual Studio builds: Build the gio tool
https://bugzilla.gnome.org/show_bug.cgi?id=768357
2016-07-18 10:39:20 +08:00
Matthias Clasen
8d68a27f70 Update 2016-07-17 13:17:55 -04:00
Philip Withnall
12acd90d8a gmessages: Document namespacing recommendation for structured log fields
We recommend that all custom log fields are namespaced to avoid
collisions.

https://bugzilla.gnome.org/show_bug.cgi?id=744456
2016-07-17 17:10:41 +01:00
Matthias Clasen
42725fb17d Another variadic macro fix
It turns out that g_info_structured (format, ...) makes
g_info_structured ("Hey!") not work, since it requires at
least one argument after the format string. So shorten
the argument list to just ...
2016-07-17 02:31:37 -04:00
Matthias Clasen
17f48d7144 Fix variadic macro syntax
It turns out that the macros looked fine in the header, but made
gcc fall over on first use. __VA_ARGS__ is only allowed in the
replacement text.
2016-07-17 02:05:07 -04:00
Matthias Clasen
75084c990f gmessages: Suppress journald code locations
This only leads to the location of our sd_journal_sendv call
being embedded into every log message coming from the old
API.
2016-07-17 01:47:32 -04:00
Philip Withnall
fce7cfaf40 gmessages: Rebase g_log() on g_log_structured()
Replace the underlying write_string() call which is the ultimate result
of calling g_log() with a call to g_log_structured(). This means that
all g_log() calls will pass through the structured log handling code
path, as long as they are not already modified or dropped by the g_log()
code (fatal masks, aborts, etc.).

In the case that the default structured log writer is in use, this will
result in the same format of log output to stdout or stderr, as
previously happened. If a non-default writer is in use, it handles the
message as it sees fit.

https://bugzilla.gnome.org/show_bug.cgi?id=744456
2016-07-16 23:52:18 -04:00
Philip Withnall
37ef301684 gmessages: Add colour output support to structured log messages
If outputting to a terminal which supports coloured output (rather than,
for example, redirecting to a file). This is only enabled for structured
log messages, where colour output support can be tested. It is not
enabled for non-structured log messages.

https://bugzilla.gnome.org/show_bug.cgi?id=744456
2016-07-16 23:52:18 -04:00
Philip Withnall
052eaf24f7 gmessages: Add a structured logging API
In parallel with g_log(), add a new structured logging API, based around
g_log_structured() and various helper functions which are exposed
publicly to allow programs to build their own logging policies easily,
without having to rewrite a lot of gmessages.c because it’s all
internal.

See the expanded documentation at the top of gmessages.c for some
rationale. See the g_log_structured() documentation for some example
code.

https://bugzilla.gnome.org/show_bug.cgi?id=744456
2016-07-16 23:52:18 -04:00
Christian Persch
8345a42cd0 Recognise common C++ extension for automatic target selection
glib-compile-resources --generate is supposed to automatically detect
whether to generate source code or header from the target's file extension.
However, this only worked for C; extend this to include the canonical
C++ filename extensions. Also make the check case insensitive.

https://bugzilla.gnome.org/show_bug.cgi?id=747134
2016-07-16 23:30:46 -04:00
Lars Uebernickel
0e5e3d0d65 gsettings: clarify changed signal documentation
Make it clear that this signal is only guaranteed to be emitted when a
key has been read before.

https://bugzilla.gnome.org/show_bug.cgi?id=750257
2016-07-16 23:26:56 -04:00
Ismo Puustinen
9864c8abf5 gio: properly free memory, preventing leak and illegal access.
https://bugzilla.gnome.org/show_bug.cgi?id=753231
2016-07-16 23:24:39 -04:00
Matthias Clasen
3c861237fb Convince gcc to compile this code
It shouldn't be that hard.
2016-07-16 23:24:39 -04:00
Matthias Clasen
21ceeed3b9 Improve error reporting
Include the filename for the file in question in many of the
error messages in glocalfile.c. This is useful information when
diagnosing such errors, so make it easily available.

http://bugzilla.gnome.org/show_bug.cgi?id=754012
2016-07-16 23:09:09 -04:00
Chun-wei Fan
b08a8dc949 gio tool: Fix build on Windows/non-GCC
The recently-added GIO tools is intended to be built on all platforms, so
adjust the code a bit to enable this:

-Use gssize instead of ssize_t, as ssize_t is not supported by all
 compilers.
-Include io.h on Windows, and define STDIN_FILENO and STDOUT_FILENO if
 necessary on Windows.

https://bugzilla.gnome.org/show_bug.cgi?id=768357
2016-07-16 23:03:48 -04:00
Ryan Lortie
ca03753853 g_settings_reset(): add precondition checks
Ensure that @key is non-%NULL on g_settings_reset().

It turns out that using g_settings_reset() with %NULL key (although
invalid as per the API documentation and not possible via bindings)
accidentally produces the same effect as the _reset_all() API that we
are about to add.

Add the standard precondition checks to prevent that from happening.

https://bugzilla.gnome.org/show_bug.cgi?id=744678
2016-07-16 22:26:43 -04:00
Xavier Claessens
fdd0ed1972 Doc: Clarify when g_variant_get_fixed_array() should be used instead of _get_bytestring()
https://bugzilla.gnome.org/show_bug.cgi?id=746685
2016-07-16 22:13:47 -04:00
Krzesimir Nowak
992ded39bf GVariant: Add a G_VARIANT_DICT_INIT macro
The macro could be used at initialization time to avoid having an
unitialized dict, especially with g_auto variables.

The macro tries to be a bit more type-safe by making sure that the asv
parameter is actually "GVariant *".

https://bugzilla.gnome.org/show_bug.cgi?id=766370
2016-07-16 21:41:16 -04:00
Krzesimir Nowak
e1c640f819 GVariant: Add a G_VARIANT_BUILDER_INIT macro
The macro could be used at initialization time to avoid having an
unitialized builder, especially with g_auto variables.

The macro tries to be a bit more type-safe by making sure that the
variant_type parameter is actually "const GVariantType
*". Unfortunately I have no idea how to make it possible to also pass
a "const gchar *" parameter without warning.

https://bugzilla.gnome.org/show_bug.cgi?id=766370
2016-07-16 21:41:16 -04:00
Matthias Clasen
e0e652e403 Fix a corner-case in g_utf8_find_next_char
In the case that *p is '\0', we should return p + 1, not p.
This change allows to simplify g_utf8_find_next_char a bit.

https://bugzilla.gnome.org/show_bug.cgi?id=547200
2016-07-16 21:34:21 -04:00
Milan Crha
4215c0ce91 Fix memory leaks in GNetworkMonitorNetlink
As claimed by valgrind in a downstream bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=1317369

https://bugzilla.gnome.org/show_bug.cgi?id=766933
2016-07-16 21:15:30 -04:00
Olivier Crête
e3e3ed0d7d socketservice: Document that it starts pre-activated.
https://bugzilla.gnome.org/show_bug.cgi?id=728207
2016-07-16 21:12:06 -04:00
Matthias Clasen
48ea710ee3 Do not use revents as not updated
revents is set in the same function after some lines. This check was
using revents from previous loop. This had the problem of causing two
poll execution for every changes to poll records.

Note that is not possible to move the code after revents is updated
as probably poll_changed is TRUE causing the function to exit.

Adapted from a patch by Frediano Ziglio,

https://bugzilla.gnome.org/show_bug.cgi?id=761102
2016-07-16 21:09:26 -04:00
Frediano Ziglio
e4ee3079c5 Do not wake up main loop if change is from same thread
This reduce the frequency the loop is waked up adding and removing
file descriptors or timeouts.
Considering that to support recursion events are removed from list and
added again this reduce iteration number a lot.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=761102
2016-07-16 21:08:51 -04:00
Aurélien Zanelli
b121a7916d gio/tests/gsettings: fix GSettings reference leaks in some tests
GSettings objects were not unreffed in test_flags, test_enums and
test_ranges tests and when we skip internationalization tests, ie
test_l10n(_context).

https://bugzilla.gnome.org/show_bug.cgi?id=768560
2016-07-16 20:57:20 -04:00
Kang Hu
42dad59cc1 gobject: add GOBJECT_IF_DEBUG macro for debugging gobjects and gsignals.
historically, DEBUG_CODE(gtype.c) and IF_DEBUG(gobject.c, gsignal.c)
macros are used to support debugging messages about object bookkeeping
and signal emission.
DEBUG_CODE has never been used in gtype.c. IF_DEBUG, when used, must be
accompanied by an extra #ifdef G_ENABLE_DEBUG. this is cumbersome.

this patch add a new macro GOBJECT_IF_DEBUG based on DEBUG_CODE as
a replacement for both DEBUG_CODE and IF_DEBUG.

https://bugzilla.gnome.org/show_bug.cgi?id=729914
2016-07-16 20:54:44 -04:00
Aurélien Zanelli
ec5397f9b0 keyfile: return 0 when the parsed double value is invalid
As specified in the g_key_file_get_double documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=768504
2016-07-16 20:50:54 -04:00
Aurélien Zanelli
3560faadd1 glib/tests/keyfile: check return value of g_key_file_get_double is 0 for invalid values
As specified in the documentation of g_key_file_get_double function.

https://bugzilla.gnome.org/show_bug.cgi?id=768504
2016-07-16 20:50:54 -04:00
Jonatan Pålsson
1e3f2ba415 docs: Remove superflous XML comments in doc string for GDBusProxyTypeFunc
https://bugzilla.gnome.org/show_bug.cgi?id=766899
2016-07-16 20:49:52 -04:00
Matthias Clasen
b4878dec3a Add a test for g_hmac_for_bytes 2016-07-16 20:48:41 -04:00
Giovanni Campagna
183ed8a3f8 Add g_compute_hmac_for_bytes()
As an introspection-friendly GBytes variant of g_compute_hmac_for_data()

https://bugzilla.gnome.org/show_bug.cgi?id=765338
2016-07-16 20:48:41 -04:00
Giovanni Campagna
a9e9bc74c3 Fix annotations of g_compute_hmac_for_data
https://bugzilla.gnome.org/show_bug.cgi?id=765338
2016-07-16 20:40:11 -04:00
Evan Nemerson
ebfbae534b gtestutils: add missing dash in seed argument's --help documentation
https://bugzilla.gnome.org/show_bug.cgi?id=760115
2016-07-16 20:39:18 -04:00
Stephan Bergmann
e7478ec967 Swallow -- argument when necessary
https://bugzilla.gnome.org/show_bug.cgi?id=768806
2016-07-16 20:34:51 -04:00
Simon McVittie
0f2e4fd01c Do not attempt to autolaunch a session dbus-daemon with no DISPLAY
The two known use-cases for autolaunching are:

* X-forwarding: "ssh -Y myhost myapp" resulting in a
  session bus on myhost but an X server on the original host

* Legacy desktop environments on OSs without D-Bus integration:
  e.g. running a single GNOME or KDE app under fvwm or something,
  without a session dbus-daemon being started by either systemd,
  gnome-session, or OS integration scripts analogous to Debian's
  /etc/X11/Xsession.d/75dbus_dbus-launch

In either case, an X11 DISPLAY is also needed.

"dbus-launch --autolaunch" doesn't do anything useful when unable
to connect to an X11 display; this has been the case since the feature
was added in 2006, and is useful to avoid "split brain" situations in
which two processes that ought to be part of the same session end up
on separate session buses. Since dbus commit 407c111 in 2011,
libdbus hasn't even attempted to run "dbus-launch --autolaunch"
unless getenv("DISPLAY") returns non-null in the parent: this avoids
doing a relatively complicated fork-and-exec that is clearly not
going to lead to success. This commit gives GDBus the same policy.

This change was originally made to work around a race condition in
subprocess spawning (Debian bug #737380, GNOME bug #711090) but
it seems valid in its own right.

In my opinion as D-Bus maintainer, "dbus-launch --autolaunch" should
be considered to be an X11 feature, and any future D-Bus enhancements
(e.g. kdbus) or successors for X11 (e.g. Wayland, Mir) should obtain
a session bus address by other means - either a session manager
such as "systemd --user", gnome-session or Upstart, or a wrapper
for the user session like dbus-run-session(1).

Related to dbus bug <https://bugs.freedesktop.org/show_bug.cgi?id=19997>.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=723506
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737380
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-07-16 20:33:34 -04:00
suhail
69a2c70174 docs: trivial typo fixes
https://bugzilla.gnome.org/show_bug.cgi?id=767949
2016-07-16 20:32:16 -04:00
Tiago Santos
a9b1f8118a Updated Portuguese translation 2016-07-16 18:33:27 +00:00
Chao-Hsiung Liao
dbb3e551f8 Updated Chinese (Taiwan) translation 2016-07-16 02:51:15 +00:00
Yosef Or Boczko
bb310d47de Updated Hebrew translation 2016-07-15 16:31:09 +03:00
Piotr Drąg
128f85730b Add Language headers to po files
Future versions of gettext will fail if this header is missing.
2016-07-14 17:23:02 +02:00
Ting-Wei Lan
cef799377e gio-querymodules: Call setlocale in main function
It is required to correctly show translated messages on some locales.

https://bugzilla.gnome.org/show_bug.cgi?id=760423
2016-07-14 11:25:42 +08:00
Matthias Clasen
63654183a8 documents portal: Make sure O_PATH is defined
FreeBSD doesn't have it.

https://bugzilla.gnome.org/show_bug.cgi?id=768780
2016-07-13 12:38:22 -04:00
Nirbheek Chauhan
92e3189613 gmacros.h: offsetof is also available on MSVC
All versions since Visual C++ 2005 have this available, so we can just
use it for G_STRUCT_OFFSET.

See: https://msdn.microsoft.com/en-us/library/dz4y9b9a.aspx
2016-07-13 11:44:34 +08:00