Commit Graph

18183 Commits

Author SHA1 Message Date
Xavier Claessens
4b82738f0a Meson: Add missing flags on Windows
win32_cflags gets used globally as cflags and exposed in the .pc file.
win32_ldflags gets passed to glib-2.0 and exposed in the .pc file.

This should match what the autotools build is currently doing with
GLIB_EXTRA_CFLAGS and G_LIBS_EXTRA.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
2018-05-16 10:19:08 -04:00
Xavier Claessens
cf28bf1f11 Meson: Remove FIXME about COCOA_LIBS and CARBON_LIBS
They are already handled properly by osx_ldflags. As far as I can tell
it does the same as with autotools.

https://bugzilla.gnome.org/show_bug.cgi?id=784995
2018-05-16 10:19:08 -04:00
Ondrej Holy
d0821da524 gio: Add g_unix_mount_get_options
GVfsUDisks2VolumeMonitor handles x-gvfs-hide/x-gvfs-show mount options
used to overwrite our heuristics whether the mount should be shown, or
hidden. Unfortunately, it works currently only for mounts with
corresponding fstab entries, because the options are read over
g_unix_mount_point_get_options. Let's introduce g_unix_mount_get_options
to allow reading of the options for all sort of mounts (e.g. created
over pam_mount, or manually mounted).

(Minor fixes to the documentation by Philip Withnall
<withnall@endlessm.com>.)

https://bugzilla.gnome.org/show_bug.cgi?id=668132
2018-05-16 11:31:42 +01:00
Philip Withnall
12de474808 gtimezone: Fix two minor leaks in zone_info_unix()
• A leak of filename on an error path
 • A leak of resolved_identifier if no out_identifier return location
   was provided

The latter was spotted by Peter Bloomfield
(8945227743 (note_111254)).
Thanks!

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-05-16 11:27:25 +01:00
Nirbheek Chauhan
a9fe62aa2c gwin32: Fix detection of MinGW32 vs MinGW-w64
__MINGW32__ is defined on all MinGW variants including MinGW-w64.
__MINGW64_VERSION_MAJOR is only defined on MinGW-w64.

This difference is important because on MinGW-w64 we must #include
winternl.h because including ntdef.h results in compiler errors
about symbol redefinition, and the header warns that it is deprecated
and may be removed in the future.

https://bugzilla.gnome.org/show_bug.cgi?id=795849
2018-05-16 11:07:30 +01:00
Nirbheek Chauhan
ab0a0c706c meson: Fix error message for iconv detection 2018-05-16 14:26:11 +05:30
Xavier Claessens
7b8d8835f5 Meson: libintl is a public dependency of glib-2.0
On non-glibc platforms gettext is provided by extra libintl dependency.
We wrongly thought libintl is an internal dependency and applications
needs to explicitly link on it, but turns out that breaks many
applications and with autotools the .pc generated actually has -lintl in
public "Libs:".

https://bugzilla.gnome.org/show_bug.cgi?id=796085
2018-05-15 13:00:44 -04:00
Philip Withnall
e64113bca0 gobject: Add g_autoptr() support for GTypeClass, GEnumClass, GFlagsClass
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=789968
2018-05-15 15:38:33 +01:00
Philip Withnall
cdfc79aae9 gobject: Add g_autoptr() support for GParamSpec
Do not add support for its subtypes, since all their constructors return
GParamSpec*, and g_param_spec_unref() takes a GParamSpec* rather than a
gpointer — adding G_DEFINE_AUTOPTR_CLEANUP_FUNC() for subtypes of
GParamSpec results in compiler warnings about mismatched parameter
types (GParamSpecBoolean* vs GParamSpec*, for example).

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

https://bugzilla.gnome.org/show_bug.cgi?id=796139
2018-05-15 15:34:09 +01:00
Ondrej Holy
1ec70e713c gio: Fix typo in g_file_info_set_attribute docs
g_file_info_set_attribute mentions %G_ATTRIBUTE_TYPE_INVALID, but no
such value exists. It should be %G_FILE_ATTRIBUTE_TYPE_INVALID.

https://bugzilla.gnome.org/show_bug.cgi?id=796138
2018-05-15 15:54:18 +02:00
Philip Withnall
1f20ddbb55 gqueue: Document to use GAsyncQueue for thread-safe queuing
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-05-15 12:50:50 +01:00
Kukuh Syafaat
ea8bd63d34 Update Indonesian translation 2018-05-12 03:59:08 +00:00
David Faure
1c177ce0ab xdgmime: Add better detection for text vs. binary and zero-sized files
This detects zero-sized files to return the special-case
"application/x-zerosize" mime-type, as well as trying to differentiate
unknown file types based on their first 128 bytes of data, so that text
editors can automatically handle unknown text files.

Based on:
https://cgit.freedesktop.org/xdg/xdgmime/commit/?id=5181175d5fdaa3832b0fd094cda0120b1fe92af6
https://cgit.freedesktop.org/xdg/xdgmime/commit/?id=9c5802b8da56187c5c6abaf70042d14b12d832a9

https://bugzilla.gnome.org/show_bug.cgi?id=795544
2018-05-10 11:46:17 +01:00
Philip Withnall
d0a48f26c7 garray: Add g_ptr_array_steal_index*() functions
These make it easy to steal elements from pointer arrays without having
the array’s GDestroyNotify called on them, similarly to what’s possible
with g_hash_table_steal().

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

https://bugzilla.gnome.org/show_bug.cgi?id=795376
2018-05-09 13:52:05 +01:00
Philip Withnall
e6200eaea2 garray: Document that return value of g_ptr_array_remove() may be junk
If using g_ptr_array_remove*() with a non-NULL GDestroyNotify function,
the value returned will probably be freed memory (depending on what the
GDestroyNotify) function actually does. Warn about that in the
documentation. We can’t just unconditionally return NULL in these cases,
though, since the user might have set the GDestroyNotify to a nifty
function which doesn’t actually free the element; so returning it might
still be valid and useful.

Also add missing (nullable) annotations to that documentation.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795376
2018-05-09 13:52:05 +01:00
Philip Withnall
2c9a84e5a3 garray: Factor out implementation of g_ptr_array_remove_index*()
They were almost identically the same. This introduces no functional
changes, but will help with upcoming additions to GPtrArray.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795376
2018-05-09 13:52:05 +01:00
Nirbheek Chauhan
3e96523e6b meson: Fix atomic ops test to match configure.ac
We must try linking, not just compiling. That will give a false
positive.
2018-05-09 18:04:59 +05:30
Nirbheek Chauhan
91c9cb5a52 config.h.meson: Add some missing #mesondefines
The compiler checks were being completely ignored.
2018-05-09 18:04:09 +05:30
Xavier Claessens
b6cb22f32b Meson: Do not build tests with nodelete/Bsymbolic-functions
-z nodelete breaks the libresourceplugin module usage in the resources.c
test, which expects to be able to unload it.

Make the Meson build match what the autotools build does: only pass
glib_link_flags to the headline libraries (glib-2.0, gio-2.0,
gobject-2.0, gthread-2.0, gmodule-2.0) and omit it from all other build
targets.

https://bugzilla.gnome.org/show_bug.cgi?id=788771
2018-05-09 12:52:59 +01:00
Christian Hergert
e924f77736 gtype: improve get_type fast path
The -fstack-protector-strong used in many distributions by default has a
rather drastic slowdown of the fast path in generated _get_type()
functions using G_DEFINE_* macros. The amount can vary by architecture,
GCC version, and compiler flags.

To work around this, and ensure a higher probability that our fast-path
will match what we had previously, we need to break out the slow-path
(registering the type) into a secondary function that is not a candidate
for inlining.

This ensures that the common case (type registered, return the GType id)
is the hot path and handled in the prologue of the generated assembly even
when -fstack-protector-strong is enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=795180
2018-05-09 12:25:06 +01:00
Christian Hergert
ede5c3f8d9 macros: add G_GNUC_NO_INLINE function attribute
https://bugzilla.gnome.org/show_bug.cgi?id=795180
2018-05-09 12:25:06 +01:00
okimoto
2fd0627326 gutils: Fix deprecation annotation for g_format_size_for_display()
It was deprecated in 2.30.

https://bugzilla.gnome.org/show_bug.cgi?id=795960
2018-05-09 10:52:15 +01:00
Philip Withnall
6acece5074 ghash: Add g_hash_table_steal_extended()
This is a combination of g_hash_table_lookup_extended() and
g_hash_table_steal(), so that users can combine the two to reduce code
and eliminate a pointless second hash table lookup by
g_hash_table_steal().

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

https://bugzilla.gnome.org/show_bug.cgi?id=795302
2018-05-08 12:41:13 +01:00
Philip Withnall
864cb71524 glib: Update internal copy of valgrind.h from Valgrind 3.13 release
Update our copy of valgrind.h from the Valgrind 3.13 release tarball.
This seems to include fixes for PPC and Solaris. No changes made to the
header file.

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

https://bugzilla.gnome.org/show_bug.cgi?id=736741
2018-05-08 12:37:20 +01:00
Philip Withnall
0adbeacd01 gregex: Highlight in the docs that input must be in UTF-8
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=748620
2018-05-08 12:27:55 +01:00
Philip Withnall
f75624f593 gregex: Highlight some argument names in the documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=748620
2018-05-08 12:27:55 +01:00
Philip Withnall
fe35f577b0 gregex: Clarify units in documentation
Make it a bit clearer that all lengths passed to GRegex methods are in
bytes (not characters). This is mentioned in the section overview, but
who reads that?

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

https://bugzilla.gnome.org/show_bug.cgi?id=748620
2018-05-08 12:27:55 +01:00
Philip Withnall
9870de442f gobject: Fix a typo in the G_VALUE_LCOPY documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-05-07 20:43:59 +01:00
Christoph Reiter
98a0ab929d Always assume that we use a gnu/c99 printf implementation
On Windows we use gnulib and elsewhere we use glibc or similar.

Also change G_GNUC_PRINTF to use gnu_printf instead of __format__ if
possible because __format__ evaluates to ms_printf under MinGW,
but we use gnulib there and not the system printf.
gnu_printf is only available with GCC>=4.4 and not with clang.

https://bugzilla.gnome.org/show_bug.cgi?id=795569
2018-05-07 19:50:25 +02:00
Matthew Leeds
b437a13a70 gio: Fix a typo in the docs for g_file_is_native() 2018-05-04 18:32:43 -07:00
Philip Withnall
cc4de801c9 gobject: Reimplement g_param_values_cmp() for GParamSpecVariant
The existing implementation was completely incorrect (despite the fix in
commit 566e64a66) — it always compared GVariants by pointer, rather than
by value.

Reimplement it to compare them by value where possible, depending on
their type. The core of this implementation is g_variant_compare(). See
the documentation and tests for further details of the new sort order.

This adds documentation and tests.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795735
2018-05-04 18:17:59 +01:00
Philip Withnall
a06117d062 Revert "Fix the cmp implementation for variant values"
This reverts commit 566e64a660.

This fix went from one broken state to another. The real fix is to use
g_variant_compare(), which is pending review. See bug #795735.

https://bugzilla.gnome.org/show_bug.cgi?id=795735
2018-05-04 17:22:17 +01:00
Iñigo Martínez
5faac84413 gdbus-codegen: Fix header include in the body file
When body file is generated, the header name to be included is
built by using the path passed by `--output` directory. However,
this might not be correct because, if the path includes a
subdirectory, the whole path will be used instead of only the
base name.

Please see:
  https://github.com/mesonbuild/meson/issues/3488
  https://github.com/gnome-mpv/gnome-mpv/issues/305#issuecomment-385056156

https://bugzilla.gnome.org/show_bug.cgi?id=795802
2018-05-04 17:16:10 +01:00
Tomasz Miąsko
9d40f64960 gdesktopappinfo: Mark GDesktopAppInfo constructors as nullable.
GDesktopAppInfo constructors return NULL on error without having
separate **GError parameter.

https://bugzilla.gnome.org/show_bug.cgi?id=795152
2018-05-04 17:13:39 +01:00
Marek Černocký
47c4a9f694 Updated Czech translation 2018-05-04 00:38:05 +02:00
Havard Graff
71fba3b3be kqueue/meson: add missing dependency
gioenumtypes needs to be generated:
In file included from ../../../../external/glib/gio/kqueue/gkqueuefilemonitor.c:37:
In file included from ../../../../external/./glib/gio/glocalfilemonitor.h:25:
In file included from ../../../../external/./glib/gio/gunixmounts.h:24:
../../../../external/./glib/gio/gio.h:86:10: fatal error: 'gio/gioenumtypes.h' file not found
#include <gio/gioenumtypes.h>
         ^~~~~~~~~~~~~~~~~~~~

https://bugzilla.gnome.org/show_bug.cgi?id=794325
2018-05-03 00:01:50 +01:00
Ting-Wei Lan
50677e9336 gtimezone: Fallback to /var/db/zoneinfo on FreeBSD
The timezone setup utility of FreeBSD, tzsetup, which is run during the
installation, creates /etc/localtime by copying the chosen timezone file
from /usr/share/zoneinfo. Although it can correctly deal with the case
where /etc/localtime is a symlink, it is not the default and there is no
user interface to change the default copying behaviour.

Fortunately, tzsetup has been modified to write the name of the chosen
timezone to /var/db/zoneinfo in 2009, so we can know the name of the
current timezone by reading it. DragonflyBSD also seems to do the same
thing in its tzsetup.

https://svnweb.freebsd.org/changeset/base/198267
https://bugzilla.gnome.org/show_bug.cgi?id=795165
2018-05-02 17:33:10 +01:00
Christoph Reiter
3d2ab4680d ci: use timeout-multiplier=2 for running the tests
It looks like the coverage generation makes the tests a bit slower and
some are now hitting timeouts. Flaky tests are always more annoying than
slow ones, and we don't know how much resources we get under CI,
so increase the timeout.

https://bugzilla.gnome.org/show_bug.cgi?id=795636
2018-05-02 14:52:50 +02:00
Matthias Clasen
566e64a660 Fix the cmp implementation for variant values
This was causing g_param_value_defaults to return 1
for GVariant values even when the value is clearly
different from the default.

This was showing up as gtk-builder-tool stripping
non-default values for GtkActionable::action-target
from ui files.
2018-05-02 08:30:59 -04:00
Matthias Clasen
2d67f91e26 2.57.0 2018-05-02 08:30:40 -04:00
Christoph Reiter
961be2b0bf ci: collect test coverage and deploy a html report through gitlab pages
Use lcov for both Fedora and MSYS2 to create coverage reports and add a second
ci stage which merges the coverage and creates a html report using genhtml.

In the final stage, which is only run on master, the result is published on
gitlab pages.

https://bugzilla.gnome.org/show_bug.cgi?id=795636
2018-05-02 11:14:45 +01:00
Christoph Reiter
e8798a4c22 ci: update meson
Rebuild the fedora docker image to get the newest meson release and
use pip to install the newest version for MSYS2.

https://bugzilla.gnome.org/show_bug.cgi?id=795711
2018-05-02 11:09:25 +01:00
Ting-Wei Lan
a0c7f85437 tests: Fix GDateTime format tests on non-English locales
It seems that the test expects g_date_time_format to return formatted
results in English, and there is no setlocale (LC_ALL, "") call in the
file so the test does run in the default C locale. However, gettext
seems to read the value of LC_MESSAGES from the environment by itself.
Even if the value of LC_MESSAGES locale is C because of not calling
setlocale, gettext still translates the name of the month according to
the LC_MESSAGES environment variable, causing g_date_time_format_locale
to fail on the "%b" test case because it cannot convert UTF-8 text
returned by get_month_name_with_day to ASCII.

To avoid the test failure, we set the LC_MESSAGES environment variable
to C before format tests and restore it at the end of the function.

https://bugzilla.gnome.org/show_bug.cgi?id=795165
2018-05-01 21:43:23 +01:00
Philip Withnall
c47cf7355c gfileutils: Add missing ‘Since’ line to g_canonicalize_filename() docs
I missed this in code review.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-05-01 08:51:57 +01:00
Georges Basile Stavracas Neto
cb32614382 timezone: Correctly resolve symlink from /etc/localtime
The return value of g_file_read_link ("/etc/localtime") can
be a relative path in the form of "../usr/share/zoneinfo".
This breaks the prefix check that is performed, and makes
the timezone identifier be "../usr/share/zoneinfo/America/Sao_Paulo",
for example, which breaks other parts of the system.

Fix that by canonicalizing the symlink path if we detect
is it a relative path.

(Tweaked by Philip Withnall <withnall@endlessm.com> to remove a
conditional which was unnecessary.)

https://bugzilla.gnome.org/show_bug.cgi?id=111848
2018-04-30 21:59:22 +01:00
Georges Basile Stavracas Neto
0f37af7e9b glocalfile: Use g_canonicalize_filename
Drop the local function in favor of the exposed
one.

https://bugzilla.gnome.org/show_bug.cgi?id=111848
2018-04-30 21:54:49 +01:00
Georges Basile Stavracas Neto
b9b642de06 fileutils: Add g_canonicalize_filename
Getting the canonical filename is a relatively common
operation when dealing with symbolic links.

This commit exposes GLocalFile's implementation of a
filename canonicalizer function, with a few additions
to make it more useful for consumers of it.

Instead of always assuming g_get_current_dir(), the
exposed function allows passing it as an additional
parameter.

This will be used to fix the GTimeZone code to retrieve
the local timezone from a zoneinfo symlink.

(Tweaked by Philip Withnall <withnall@endlessm.com> to drop g_autofree
usage and add some additional tests.)

https://bugzilla.gnome.org/show_bug.cgi?id=111848
2018-04-30 21:54:31 +01:00
Xavier Claessens
a67dc37e9c Meson: Add -Wl,-z,nodelete and -Wl,-Bsymbolic-functions where supported
https://bugzilla.gnome.org/show_bug.cgi?id=788771
2018-04-30 12:14:07 -04:00
Xavier Claessens
9d12af9ef8 configure.ac: Remove --disable-znodelete options
There is no reason to disable this linker flags, and we are not going to
add this option in our meson build system, so remove it from autotools
too to be on par. If anyone complains with a valid use-case we can add
them back.

Keeping -Bsymbolc for now because it is used for refdbg and Debian has a
package that build glib with that flag.

https://bugzilla.gnome.org/show_bug.cgi?id=788771
2018-04-30 12:14:07 -04:00
Christoph Reiter
fe9457dedd gliststore: Improve the test coverage
https://bugzilla.gnome.org/show_bug.cgi?id=795307
2018-04-30 13:02:41 +02:00