Commit Graph

18326 Commits

Author SHA1 Message Date
Robert Ancell
947fea1d16 GDateTime: Reject days outside of month limits
The previous code allowed February 30th.
2017-08-16 11:47:32 +12:00
Aurimas Černius
f6ee658974 Updated Lithuanian translation 2017-08-15 17:51:59 +03:00
Nirbheek Chauhan
4c46869081 meson: Always define _GNU_SOURCE for pthread checks
Without this, GNU-specific symbols won't be defined and the compiler
check will pass because GCC will assume that you know what you're
doing since it doesn't know what the symbol prototype is and compiler
checks aren't built with -Wall -Werror.

This will then cause a build failure because the wrong prototype will
be used.
2017-08-14 21:49:22 +05:30
Руслан Ижбулатов
788705633e W32: Support XDG_* environment variables
Try to get XDG_* environment variables and, if they are available, use their
contents to initialize various directories the same way this happens on *nix.
When these variables are not available, fall back to the W32-specific APIs for
getting directories.

https://bugzilla.gnome.org/show_bug.cgi?id=766358
2017-08-14 15:45:01 +01:00
Fran Dieguez
f9fe9ea417 Update Galician translation 2017-08-12 10:29:12 +00:00
Philip Withnall
fac7f2be2e gsequence: Add introspection annotations to Return values
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=786060
2017-08-10 16:38:41 +01:00
Emmanuele Bassi
50eeb24415 meson: Update the pthread feature checks
For GNU extensions, we need to define _GNU_SOURCE; but, more
importantly, we need to tell Meson to use the threadlib dependency when
compiling and linking the feature check.

This currently exposes a bug in Meson; see:

https://github.com/mesonbuild/meson/issues/2165

But once that's fixed, the check will work as intended.

https://bugzilla.gnome.org/show_bug.cgi?id=785955
2017-08-10 14:36:11 +01:00
Emmanuele Bassi
1a755a63e1 meson: Define _GNU_SOURCE as a project argument
We use it pretty much everywhere in order to get feature detection, and
that's also what the AC_USE_SYSTEM_EXTENSIONS m4 macro defines in the
Autotools build.

https://bugzilla.gnome.org/show_bug.cgi?id=785955
2017-08-10 14:36:11 +01:00
Fran Dieguez
4860511d8d Update Galician translation 2017-08-10 09:29:48 +00:00
Kukuh Syafaat
189243b585 Update Indonesian translation 2017-08-08 16:01:29 +00:00
Daniel Boles
f6aa8c3988 GSList: Note that using ->next directly is OK
as for GList
2017-08-07 20:39:06 +01:00
Daniel Boles
a2ec32833e GList: Fix typo of member ->prev in documentation
It said list->previous, which is not a thing that exists.
2017-08-07 20:33:25 +01:00
Matthias Clasen
47e10489c5 2.53.5 2017-08-07 12:35:17 -04:00
Simon McVittie
7c97e3d784 gdbus: Check signature of NameAcquired, NameLost
Calling g_variant_get (parameters, "(&s)") when parameters has a
signature other than (s) is considered to be a programming error.
In practice the message bus (dbus-daemon or a reimplementation) should
always send the expected type, but be defensive.

(Modified by Philip Withnall to improve type check.)

Signed-off-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=784392
2017-08-07 17:31:31 +01:00
Simon McVittie
c53b44edb2 GBusNameOwnerFlags: Add DO_NOT_QUEUE flag
PulseAudio and LibreOffice are among the services that use this flag.
Refusing to queue for a name lets you do this transaction,
but atomically, avoiding the transient state where you briefly join
the queue and then are given the name when its primary owner drops it:

    result = RequestName(name)

    if result == IN_QUEUE:
        ReleaseName(name)
        result = EXISTS

    return result

(Modified by Philip Withnall to add documentation.)

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

https://bugzilla.gnome.org/show_bug.cgi?id=784392
2017-08-07 17:16:07 +01:00
Simon McVittie
92f1ba200d GBusNameOwnerFlags: Note equivalence with D-Bus Specification
The implementation passes flags through directly to the RequestName()
call, so if any new values break that equivalence, the implementation
will have to be changed.

Signed-off-by: Simon McVittie <smcv@collabora.com>

https://bugzilla.gnome.org/show_bug.cgi?id=784392
2017-08-07 17:10:07 +01:00
Philip Withnall
05abc6cfce gio: Fix crash in open URI portal when no callback is provided
If no callback is provided, token is never set, but it’s then passed to
g_variant_new_string(), which requires a non-NULL input.

Fix that by moving all the option handling inside the (callback != NULL)
case.

Spotted by Coverity (CID #1378714).

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

https://bugzilla.gnome.org/show_bug.cgi?id=785817
2017-08-07 17:08:07 +01:00
Mihai Moldovan
31ae2c5598 glib-genmarshal: wrap prototypes in G_{BEGIN,END}_DECLS.
Since --header --body has been deprecated and replaced with --body
--prototypes, the generated body is not wrapped with G_{BEGIN,END}_DECLS
any longer. Projects using C++ break due to that. Automatically wrap
prototypes individually in G_{BEGIN,END}_DECLS instead.

https://bugzilla.gnome.org/show_bug.cgi?id=785554
2017-08-07 17:07:06 +01:00
Matej Urbančič
c4dc30e2a3 Updated Slovenian translation 2017-08-07 08:44:11 +02:00
Daniel Mustieles
ce46e13fbc Updated Spanish translation 2017-08-05 11:56:28 +02:00
Philip Withnall
1782219fb8 docs: Fix typo in GDBusInterfaceSkeleton documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-04 13:30:10 +01:00
Tim-Philipp Müller
a1fdae8afc meson: don't error out if xmllint is not found
Only needed for glib/tests and entirely optional.
2017-08-03 19:23:25 +01:00
Philip Withnall
ad9d5a11f2 tests: Fix gschema-compile test for translatable string changes
Little did I know when making commit
c257757cf6 that a lot of the output of
glib-compile-schemas is string matched in some of the unit tests. Fix
them to match the updated strings.

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

https://bugzilla.gnome.org/show_bug.cgi?id=695573
2017-08-03 16:32:42 +01:00
Philip Withnall
25c01e1c55 glib-compile-schemas: Use double quotes rather than single quotes
It’s what GLib is standardising on. See bug #772221.

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

https://bugzilla.gnome.org/show_bug.cgi?id=695573
2017-08-03 16:31:37 +01:00
Daniel Boles
e02e3540ab gspawn: Don’t mention removed gdk_spawn functions
Mention alternatives that actually still exist instead.

https://bugzilla.gnome.org/show_bug.cgi?id=785520
2017-08-03 14:44:40 +01:00
Daniel Macks
f591366eee gtest: Handle -s as explicit SKIP instead of inhibiting altogether
Improves diagnostics and makes test transcripts easier to compare

https://bugzilla.gnome.org/show_bug.cgi?id=769135
2017-08-03 12:43:00 +01:00
Daniel Macks
f7a14fece4 Use "-module" when compiling loadable modules
Some platforms use different extensions for compile-time linkable
libraries vs runtime-loadable modules. Need to use special libtool
flag in the latter case for consistency with what gmodule expects.

https://bugzilla.gnome.org/show_bug.cgi?id=731703
2017-08-03 12:28:10 +01:00
Philip Withnall
22700faf88 build: Loosen --enable-compile-warnings check
Instead of requiring --enable-compile-warnings or
--enable-compile-warnings=yes, allow any value which is not ‘no’. This
enables compile warnings for --enable-compile-warnings=maximum or
--enable-compile-warnings=error, which are common values for other GNOME
projects. While we don’t change our behaviour for [yes, maximum, error],
at least it means the warnings are enabled now, rather than disabled.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-03 11:55:23 +01:00
Philip Withnall
9652839606 gslice: Fix inline delarations in GSlice
Accidentally introduced in commit
5cddde1fb2.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-03 11:54:58 +01:00
Philip Withnall
c257757cf6 glib-compile-schemas: Improve some translatable strings
• Fix capitalisation to be consistent
 • Use Unicode quotation marks where appropriate
 • Move trailing \n characters out of the translable strings and append
   them unconditionally

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

https://bugzilla.gnome.org/show_bug.cgi?id=695573
2017-08-03 11:41:13 +01:00
Daniel Boles
94816e10d2 glib-compile-schemas: Fix typo in newly translatable string 2017-08-03 11:30:20 +01:00
Jiro Matsuzawa
a7aa8acc48 glib-compile-schemas: Mark missing strings for translation
https://bugzilla.gnome.org/show_bug.cgi?id=695573
2017-08-03 11:19:08 +01:00
Philip Withnall
f2b6c11629 gstrfuncs: Expand documentation for errno functions
Mention that it really is a good idea to save errno before doing
literally anything else after calling a function which could set it.

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

https://bugzilla.gnome.org/show_bug.cgi?id=785577
2017-08-03 10:21:13 +01:00
Philip Withnall
5cddde1fb2 Consistently save errno immediately after the operation setting it
Prevent the situation where errno is set by function A, then function B
is called (which is typically _(), but could be anything else) and it
overwrites errno, then errno is checked by the caller.

errno is a horrific API, and we need to be careful to save its value as
soon as a function call (which might set it) returns. i.e. Follow the
pattern:
  int errsv, ret;
  ret = some_call_which_might_set_errno ();
  errsv = errno;

  if (ret < 0)
    puts (strerror (errsv));

This patch implements that pattern throughout GLib. There might be a few
places in the test code which still use errno directly. They should be
ported as necessary. It doesn’t modify all the call sites like this:
  if (some_call_which_might_set_errno () && errno == ESOMETHING)
since the refactoring involved is probably more harmful than beneficial
there. It does, however, refactor other call sites regardless of whether
they were originally buggy.

https://bugzilla.gnome.org/show_bug.cgi?id=785577
2017-08-03 10:21:13 +01:00
Ondrej Holy
41a4a70b43 gunixmounts: Add missing const qualifier for mtab path
get_mtab_read_file and get_mtab_monitor_file returns const path,
but const qualifier is missing. Let's add it.

https://bugzilla.gnome.org/show_bug.cgi?id=779607
2017-08-03 10:22:43 +02:00
Ondrej Holy
2db36d0d5c gunixmounts: Prevent "mounts-changed" race if /etc/mtab is used
The /etc/mtab file is still used by some distributions (e.g. Slackware),
so it has to be monitored instead of /proc/self/mountinfo in order to
avoid races between g_unix_mounts_get and "mounts-changed" signal. The
util-linux is built with --enable-libmount-support-mtab in that case and
mnt_has_regular_mtab is used for checks. Let's use mnt_has_regular_mtab
also to determine which file to monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=779607
2017-08-03 10:22:43 +02:00
Руслан Ижбулатов
b267f648d9 glib/gpoll W32: trust WFMOE() return value
WaitForMultipleObjectsEx() returns the index of the *first* handle that triggered the wakeup, and promises that all handles with lower index are still inactive. Therefore, don't check them, only check the handles with higher index. This removes the need of rearranging the handles (and, now, handle_to_fd) array, it's enough to take a pointer to the next item and use it as a new, shorter array.

https://bugzilla.gnome.org/show_bug.cgi?id=785468
2017-08-01 12:50:13 +00:00
Руслан Ижбулатов
226ea94685 glib/gpoll W32: faster GPollFD lookup
Put all ptrs for GPollFDs that contribute handles into an array, the layout of which mirrors the handles array. This way finding GPollFD for a handle is a simple matter of knowing this handle's index in the handles array (which is something we always know). Removes the need to loop through all fds looking for the right one. And, with the message FD also passed along, it's now completely unnecessary to even pass fds to poll_rest() at all.

https://bugzilla.gnome.org/show_bug.cgi?id=785468
2017-08-01 12:50:12 +00:00
Руслан Ижбулатов
201977983e glib/gpoll W32: pass along GPollFD ptr for msg
Instead of just indicating that messages should be polled for, save the pointer to GPollFD that contains G_WIN32_MSG_HANDLE, and pass it along. This way it won't be necessary to loop through all fds later on, searching for G_WIN32_MSG_HANDLE.

https://bugzilla.gnome.org/show_bug.cgi?id=785468
2017-08-01 12:50:11 +00:00
Руслан Ижбулатов
1f3da929f5 glib/gpoll W32: fold f->revents = 0 into for() loop
GCC most likely optimizes that already, but no harm in trying.

https://bugzilla.gnome.org/show_bug.cgi?id=785468
2017-08-01 12:50:10 +00:00
Руслан Ижбулатов
cb2316aaa1 glib/gpoll W32: use WFSOE() instead of SleepEx()
WaitForSingleObjectEx() is supposed to be a more efficient sleep method.
It waits on the handle of the current process. That handle will be signaled once the process terminates, and since we're *inside* the process, it'll never happen (and if it does, we won't care anymore).
The use of an alertable wait ensures that we wake up when a completion routine wants to run.

https://bugzilla.gnome.org/show_bug.cgi?id=785468
2017-08-01 12:50:10 +00:00
Alistair Francis
d67b58a9a6 glib/gpoll: Remove if conditional
The original ready < nhandles - 1 can be re-written as ready + 1 < nhandles
which is the same confition that we are checking on the first
itteration of the for loop. This means we can remove the if statement
and let the for loop check the code.

This also has the side effect of removing an invalid check as
WAIT_OBJECT_0 was not subtracted from ready in the if statement.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
2017-08-01 12:50:09 +00:00
Руслан Ижбулатов
425a9f5864 gio: add a simple gpoll performance test for W32
It just creates a number of socket pairs, then triggers read-ready status on these pairs in different patterns (none, one, half, all) and checks how much time it takes to g_poll() those. Also sometimes posts a Windows message and polls for its arrival.
The g_main_context_new() is necessary to initialize g_poll() debugging on W32.

Measures minimal and maximal time it takes to g_poll(), as well as the average, over 1000 runs.
Collects the time values into 25 non-linear buckets between 0ns and 1000ns, and displays them at the conclusion of each subtest.

https://bugzilla.gnome.org/show_bug.cgi?id=785468
2017-08-01 12:50:08 +00:00
Alberts Muktupāvels
8cc9950202 glib-mkenums: fix parsing of flags annotation
https://bugzilla.gnome.org/show_bug.cgi?id=779332
2017-08-01 10:24:44 +01:00
Emmanuele Bassi
ca69df0f16 Revert "glib-mkenums: fix parsing of /*< flags >*/ annotation"
This reverts commit 1672678bc4.

A more comprehensive fix will follow.
2017-08-01 10:11:09 +01:00
Christoph Reiter
867b5e6f90 glib-mkenums: Python2: use locale encoding when redirecting stdout
In case of Python 2 and stdout being redirected to a file, sys.stdout.encoding
is None and it defaults ASCII for encoding text.

To match the behaviour of Python 3, which uses the locale encoding also when
redirecting to a file, wrap sys.stdout with a StreamWriter using the
locale encoding.

https://bugzilla.gnome.org/show_bug.cgi?id=785113
2017-07-26 22:27:48 +02:00
Debarshi Ray
a7926117dd gdatetime: Silence -Wmaybe-uninitialized
GCC 6.3.1 thinks that tmp is being used uninitialized:
  gdatetime.c: In function ‘format_ampm’:
  gdatetime.c:2248:7: warning: ‘tmp’ may be used uninitialized in this
    function [-Wmaybe-uninitialized]
         g_free (tmp);
         ^~~~~~~~~~~~

It is not an actual problem because the code in question is guarded by
"if (!locale_is_utf8)" and "#if defined (HAVE_LANGINFO_TIME)", and it
does get initialized under those circumstances. Still, it is a small
price to pay for a cleaner build and having actual problems stand out
more prominently.

https://bugzilla.gnome.org/show_bug.cgi?id=785438
2017-07-26 18:14:10 +02:00
Piotr Drąg
528a1b9288 Use the glib preset for i18n in Meson
Preset handles xgettext options for us,
and we can rely on Meson to parse LINGUAS.

https://bugzilla.gnome.org/show_bug.cgi?id=784965
2017-07-25 18:57:14 +02:00
Debarshi Ray
b51a0e7c63 GApplication: Use a WARNING if dbus_unregister is called by destructor
Unlike g_application_register, there is no public API to unregister the
GApplication from D-Bus. Therefore, if the GApplication is set up
manually without using g_application_run, then neither can the
GApplicationImpl be destroyed nor can dbus_unregister be called before
destruction.

This is fine as long as no sub-class has implemented dbus_unregister.
If they have, their method method will be called after destruction, and
they should be prepared to deal with the consequences.

As long as there is no public API for unregistering, let's demote the
assertion to a WARNING. Bravehearts who don't use g_application_run
can continue to implement dbus_unregister, but they would have been
adequately notified.

This reverts commit c1ae1170fa.

https://bugzilla.gnome.org/show_bug.cgi?id=725950
2017-07-24 19:52:48 +02:00
Debarshi Ray
df06dc6550 GApplication: Don't call dbus_unregister multiple times
https://bugzilla.gnome.org/show_bug.cgi?id=725950
2017-07-24 19:52:48 +02:00