Commit Graph

17099 Commits

Author SHA1 Message Date
Philip Withnall
9374ecc3cb gdatetime: Fix overflow checks when constructing from timestamps
GDateTime does overflow checks to see if the timestamp being passed in
is too big to be represented. However, it only does those after
converting from a timestamp to an interval, which involves some
multiplications and additions — and hence can overflow, and cause the
later bounds check to erroneously succeed. This results in a non-NULL
GDateTime being returned which represents completely the wrong date.

Fix the overflow checks (do them earlier) and add some unit tests.

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

https://bugzilla.gnome.org/show_bug.cgi?id=782089
2017-05-05 10:51:08 +01:00
Rico Tzschichholz
17395d79eb Revert "ginputstream: Add missing (out) annotations to read() functions"
This reverts commit 8446ee8c20.
2017-05-04 16:27:39 +02:00
Jonh Wendell
fff6fc02b9 build: Bump version to 2.53.2
So that early adopters of new API have a version number to target.
2017-05-04 11:03:48 -03:00
Philip Withnall
b1cd3378fb gdatetime: Remove an unnecessary NULL pointer check
datetime->tz can never be NULL, so this pointer check is unnecessary and
confusing, and messes up static analysis.

https://bugzilla.gnome.org/show_bug.cgi?id=732000
2017-05-02 23:42:16 +01:00
Philip Withnall
404c2d2454 ghash: Document that GHashTable is not suitable for static hash tables
Instead, gperf should be used for that kind of thing.

Inspired by http://stackoverflow.com/q/42372382/2931197.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-05-02 16:59:50 +01:00
Philip Withnall
f6f6b3d83c garray: Add g_ptr_array_find[_with_equal_func]()
Partially based on telepathy-glib’s tp_g_ptr_array_contains(), and a
patch by Xavier Claessens <xavier.claessens@collabora.co.uk>.

Test cases included.

https://bugzilla.gnome.org/show_bug.cgi?id=698064
2017-05-02 16:54:41 +01:00
Philip Withnall
42a8e952ef gtimer: Whitespace fixes
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-05-02 16:02:30 +01:00
Krzesimir Nowak
070383ca36 gvariant: Fix the max unsigned 64-bit integer value
It should be 2^64-1, not just 2^64.

Reviewed-by: Philip Withnall <philip@tecnocode.co.uk>
2017-05-02 15:02:44 +02:00
Matthias Clasen
6ddfd516e6 Small documentation additions
The GNetworkMonitor docs were talking about one implementation,
omitting the others. While fixing that, add a bit about implementations
to the GProxyResolver docs too.
2017-05-02 07:23:32 -04:00
Matthias Clasen
f340354861 portal support: Raise the priority for network monitor
When we are inside a sandbox, we want to use the portal
implementation, since it is the only one that has a chance
of working.

This is safe to do, since the portal implementation will
just fail initialization when loaded outside a sandbox.
2017-05-02 06:48:35 -04:00
Philip Withnall
f5993c0e5d gportalsupport: Fix compilation failure from previous commit
Igor says: Thith code did not path the compilation check.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-05-01 19:34:51 +01:00
Matthias Clasen
82e31de04d portal support: Read /.flatpak-info
The flatpak-info file was moved to a different location a while
ago, we should read it from there instead of relying on the
compat symlink. One advantage is that this is a fixed, short
path, we don't have to construct one dynamically.

https://bugzilla.gnome.org/show_bug.cgi?id=781826
2017-05-01 14:15:44 -04:00
Philip Withnall
84134c64ed docs: Remove some extraneous words from g_settings_sync() documentation
Looks like the author started typing one thing, then changed their mind
about how to phrase the sentence, and typed something else.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2017-04-30 22:04:17 +01:00
Philip Withnall
d21fb0ed3c docs: Add an example for using the g_spawn_*() APIs
And clarify that you must add a child watch or *not* use the
G_SPAWN_DO_NOT_REAP_CHILD flag, otherwise your child will become a
zombie on exit, and will not be reaped until the parent process exits.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2017-04-30 09:41:35 +01:00
Timm Bäder
3e2187975d gappinfo: Clear previously set error before calling portal
Otherwise, we might end up returning TRUE from
g_app_info_launch_default_for_uri but with a set error parameter. This
will lead to confusing results depending on how the caller checks for
errors. Checking error != NULL indicats the call failed but checking the
return value indicates that it succeeded.
2017-04-29 15:15:49 +02:00
Patrick Griffis
cbcf10411c tests: Fix g_content_type_is_mime_type() test on OSX
It should be passed a mime type not a content type.

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-29 03:47:54 -04:00
Emmanuele Bassi
17a3c782db genmarshal: Always generate the prototypes in the body
This way code that does not manually include the generated marshallers
header and wishes to build with `-Wmissing-prototypes` will not generate
a compiler warning.

https://bugzilla.gnome.org/show_bug.cgi?id=781755
2017-04-28 17:39:14 +01:00
Emmanuele Bassi
616cff7c87 genmarshal: Use fewer magic numbers
https://bugzilla.gnome.org/show_bug.cgi?id=781755
2017-04-28 17:39:14 +01:00
Emmanuele Bassi
a8b5192d16 genmarshal: Constify global variables
https://bugzilla.gnome.org/show_bug.cgi?id=781755
2017-04-28 17:39:14 +01:00
Emmanuele Bassi
1ffad8fed9 genmarshal: Conform --help output to conventions
The convention for arguments taking a value is:

  --argument=VALUE

with the `VALUE` in caps.

https://bugzilla.gnome.org/show_bug.cgi?id=781755
2017-04-28 17:39:14 +01:00
declan
aefffa3fbc gdbusmessage: Don’t use major()/minor() if they’re unavailable
https://bugzilla.gnome.org/show_bug.cgi?id=777030
2017-04-28 15:26:28 +01:00
Philip Withnall
b63469d726 docs: Fix (nullable) (optional) annotations
There are a few places where commit 18a33f72 replaced valid (nullable)
(optional) annotations with just (optional). That has a different
meaning.

(nullable) (optional) can only be applied to gpointer* parameters, and
means that both the gpointer* and returned gpointer can be NULL. i.e.
The caller can pass in NULL to ignore the return value; and the returned
value can be NULL.

(optional) can be applied to anything* parameters, and means that the
anything* can be NULL. i.e. The caller can pass in NULL to ignore the
return value. The return value cannot be NULL.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-04-28 12:32:12 +01:00
Philip Withnall
88ad0dab21 gdbusconnection: Add some comments about object ownership
Some annotations I made while trying to debug bug #781847. They
introduce no behavioural changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-04-28 12:06:25 +01:00
Daniel Macks
ea586b47a3 Implement g_content_type_is_mime_type() (clone of win32's)
Add missing function, copying from gcontenttype-win32.c per Patrick
Griffis (Comment #55 of bug report)

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-28 06:30:11 -04:00
Daniel Macks
ecc27a0cba Add test-case for g_content_type_is_mime_type()
Verify presence of new interface.

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-28 06:30:11 -04:00
Rafal Luzynski
643c722f1e gosxappinfo: fix typo in g_osx_app_info_launch_internal
Correct error domain is G_IO_ERROR.

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-28 06:30:11 -04:00
Patrick Griffis
0c4dd4a802 gosxappinfo: Special case x-scheme-handler
This is the only way they are exposed on Unix so we need to handle it

https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-28 06:30:11 -04:00
Patrick Griffis
fac83e09d6 gosxappinfo: Fix get_default_for_type() on 10.10+
https://bugzilla.gnome.org/show_bug.cgi?id=734946
2017-04-28 06:30:11 -04:00
Patrick Griffis
d4bfee1e7a build: Don't build dbus-appinfo on OSX
https://bugzilla.gnome.org/show_bug.cgi?id=780309
2017-04-27 21:52:04 -04:00
Krzesimir Nowak
75cd848ea8 gvariant: Fix some typos in documentation
Reformatted the docs for G_VARIANT_TYPE_UINT64 to avoid having a
number in the beginning of the line, because apparently gtk-doc treats
that as a first element of the numbered list. The number being that
big probably makes gtk-doc to treat it as 1.

Fixed the g_variant_new_fixed_array documentation - it was partially
copy-pasted from the g_variant_get_fixed_array documentation.

The rest should be quite obvious.

https://bugzilla.gnome.org/show_bug.cgi?id=781830
2017-04-27 15:44:08 +01:00
Patrick Griffis
f3321da462 gosxappinfo: Fix typo in ifdef
https://bugzilla.gnome.org/show_bug.cgi?id=780300
2017-04-27 09:35:29 -04:00
Daniel Mustieles
42c4a72e29 Update Spanish translation 2017-04-26 08:16:54 +00:00
Matthias Clasen
7651ce2ee4 2.53.1 2017-04-25 06:10:22 -04:00
Philip Withnall
281e301036 gmain: Allow GSource methods to be called from a finalize() callback
Temporarily increase the ref count of a GSource to 1 while calling its
finalize() callback, so that the finalize() implementation can call
GSource methods (like g_source_set_ready_time()) without causing
critical warnings. It’s safe to call those methods at this point, as the
source has been destroyed, but nothing has been freed.

This is an indirect way of fixing a race between GCancellable and
GCancellableSource, whereby the GCancellable::cancelled callback for the
GCancellableSource is not disconnected until the GCancellableSource’s
finalize() function is called. Previously, this meant there was a window
in which the GCancellableSource’s ref count was 0, but the ::cancelled
callback was still connected, and could legitimately be called as a
result of another thread calling g_cancellable_cancel() on the
GCancellable. The callback calls g_source_set_ready_time() on the
GSource, and there’s no thread-safe way of checking whether the GSource
has been destroyed. Instead, we have to change GSource so its ref count
is only decremented to 0 inside the locked section in
g_source_unref_internal() *after* the finalize() function has been
called, and hence after the GCancellable::cancelled callback has been
disconnected. The use of g_cancellable_disconnect() ensures that the
callback disconnection is thread safe.

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

https://bugzilla.gnome.org/show_bug.cgi?id=781601
2017-04-25 10:21:04 +01:00
Aurimas Černius
09762ac4d6 Updated Lithuanian translation 2017-04-24 23:14:54 +03:00
Florian Heiser
725d0053c0 Update German translation 2017-04-22 02:03:46 +00:00
Jordi Mas
3362bf7a40 Update Catalan translation 2017-04-19 22:53:43 +02:00
Andika Triwidada
4a444d48e2 Update Indonesian translation 2017-04-18 11:06:47 +00:00
Philip Withnall
e8487812b9 gmessages: Fix documentation formatting 2017-04-18 11:58:28 +01:00
John Lindgren
7641cf29e3 Do not mix declarations with code.
https://bugzilla.gnome.org/show_bug.cgi?id=781298
2017-04-14 05:24:48 +00:00
Philip Withnall
c192595268 ginputstream: Add missing (transfer full) annotation to read_bytes() 2017-04-13 10:25:25 +01:00
Philip Withnall
8446ee8c20 ginputstream: Add missing (out) annotations to read() functions
https://bugzilla.gnome.org/show_bug.cgi?id=781234
2017-04-13 10:24:11 +01:00
Philip Withnall
8c4a6fdbf5 gio: Fix some typos of ‘asynchronous’ in documentation comments 2017-04-13 10:23:50 +01:00
Paolo Bonzini
9ba95e25b7 gmain: only signal GWakeup right before or during a blocking poll
Since commit e4ee307 ("Do not wake up main loop if change is from same
thread", bug 761102), GMainContext uses context->owner to decide if the
event loop is being run in the current thread.  However, what really
matters is the phase in the prepare/query/poll/check/dispatch sequence.
Wakeups are only needed between the end of prepare and the end of poll,
and then only if prepare found that no sources were ready.

There is no need to take threads into account, because prepare, check
and all callers of conditional_wakeup all look at the new need_wakeup
flag inside LOCK_CONTEXT/UNLOCK_CONTEXT.

With this change, g_main_context_is_owner and g_main_context_wait are
the only functions for which acquire/release matters, just like before
commit e4ee307.

Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
2017-04-11 13:27:31 -04:00
Paolo Bonzini
0c0469b56d gmain: Signal wakeups if context has never been acquired as well
Should address backwards compatibility with how qemu is using
`GMainContext`.

See https://bugzilla.gnome.org/show_bug.cgi?id=761102#c14

Input-into-keyboard-by: Colin Walters <walters@verbum.org>
2017-04-11 11:49:32 -04:00
Víctor Manuel Jáquez Leal
3d7534eae5 gio-tool: Fix errors format string
Compiling with clang 3.8.1-18 (debian, x86_64) I ran across this
error:

gio-tool.c:40:31: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
  message = g_strdup_vprintf (format, args);
                              ^~~~~~
gio-tool.c:55:31: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
  message = g_strdup_vprintf (format, args);
                              ^~~~~~
2 errors generated.

To fix the first one, related with the function print_error(), this
patch adds to the function prototype a compiler's attribute.

For the second one, since the usage of that function is to print
one string and the format is already provided, the patch simplifies
the function by no receiving variadic arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=781125
2017-04-10 15:43:12 +02:00
Piotr Drąg
77d00030e5 gio-tool: Fix closing Unicode quotation mark
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772221
2017-04-10 15:40:42 +02:00
Emmanuele Bassi
f952fdf3fc Drop trailing semi-colon from G_DEFINE_ macro
It's unnecessary, and only adds visual noise; we have been fairly
inconsistent in the past, but the semi-colon-less version clearly
dominates in the code base.

https://bugzilla.gnome.org/show_bug.cgi?id=669355
2017-04-10 10:38:31 +01:00
Ondrej Holy
fb7d2184a6 gio-tool: Do not leak GOptionContext
GOptionContext is freed only in case of success. Free the context
also in case of failure.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00
Ondrej Holy
292f10d053 gio-tool: Add g_drive_is_removable() support
The g_drive_is_removable() support was added recently in gio/gvfs
(see Bug 765900 and Bug 765457). It was also added in gvfs-mount,
but we forgot to add it also in gio-tool-mount.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-04-10 10:14:04 +02:00