Commit Graph

17668 Commits

Author SHA1 Message Date
Philip Withnall
5040de9fc7 docs: Mention gsize, goffset, etc. are in C99
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=569375
2017-10-06 12:14:59 +01:00
Philip Withnall
493723b4d9 gmessages: Update advice for G_LOG_DOMAIN
Suggest defining it for all code — for applications as well as for
libraries. This allows G_MESSAGES_DEBUG=my-app to be used to filter out
all messages from libraries which it uses, for example.

https://bugzilla.gnome.org/show_bug.cgi?id=777956
2017-10-06 11:26:47 +01:00
Philip Withnall
8330b09d78 Bug 679467 — Mention translation in g_warning() documentation
Include a line in the documentation for g_warning(), g_error(), g_critical()
and g_debug() mentioning that the messages passed to them typically should not
be translated.

Closes: https://bugzilla.gnome.org/show_bug.cgi?id=679467
2017-10-06 11:23:01 +01:00
Philip Withnall
0a10f7375f glocalfileinfo: Use g_strcmp0() for some comparisons which might be NULL
The return value from g_get_user_special_dir() might be NULL. Safest to
use g_strcmp0() uniformly everywhere.

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

https://bugzilla.gnome.org/show_bug.cgi?id=661442
2017-10-06 11:17:40 +01:00
Philip Withnall
9cbff9f768 gclosure: Fix (transfer) annotations on GClosure constructors
They return floating references. The convention established by GVariant
is to annotate these as (transfer none) so that the caller does a
ref+sink on them, rather than just a ref.

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

https://bugzilla.gnome.org/show_bug.cgi?id=677233
2017-10-06 11:17:33 +01:00
Philip Withnall
121b1e5215 docs: Fix incorrect macro name in GType tutorial
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=770459
2017-10-05 15:40:14 +01:00
Colomban Wendling
b090a079f7 Fix documentation about stopping signal emission from inside a hook
Stopping signal emission from an emission hook is, and always has been,
actually forbidden.  Update the documentation not to lie to the reader.

https://bugzilla.gnome.org/show_bug.cgi?id=773355
2017-10-05 15:26:08 +01:00
Ondrej Holy
1508db2f66 gio: Add hack to close up dbus-daemon race
If gio open exits before the program it starts fully activates, then
the dbus-daemon may avoid doing the activating method call.

This commit works around the problem by pinging the activated application,
and waiting for a reply.

Same workaround is used in gtk-launch and was used in gvfs-open before
it was replaced by gio open.

https://bugzilla.gnome.org/show_bug.cgi?id=780296
2017-10-05 16:19:31 +02:00
Volker Sobek
c7dc81ce78 docs: Escape some backslashes for markdown
These no longer showed up correctly in the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=727346
2017-10-05 15:07:09 +01:00
Martin Blanchard
d3745d14e1 gprintf: Add a reminder concerning <glib/gprintf.h>
g_printf(), g_fprintf(), g_sprintf(), g_vprintf(), g_vfprintf(),
() and g_vasprintf() require gprintf.h to be explicitly included
in order to be used. This patch adds a reminder in each function's
documentation abstract.

https://bugzilla.gnome.org/show_bug.cgi?id=760716
2017-10-05 15:02:39 +01:00
Martin Blanchard
c443adeffb gprintf: Fix documentation regarding <glib/gprintf.h>
g_snprintf() and g_vsnprintf() declarations were moved and
don't require gprintf.h to be included anymore but g_vasprintf()
is and requires gprintf.h to be explicitly included.

https://bugzilla.gnome.org/show_bug.cgi?id=760716
2017-10-05 15:01:28 +01:00
Philip Withnall
85680f4a06 docs: Rewrap line to avoid it being interpreted as a list
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=767215
2017-10-05 14:49:49 +01:00
Jiro Matsuzawa
acea147cbc gsettings: Suppress error messages of completion
https://bugzilla.gnome.org/show_bug.cgi?id=695681
2017-10-05 14:41:24 +01:00
Philip Withnall
55905db86a gfile: Fix typo in documentation for g_file_set_attribute()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-05 13:46:41 +01:00
Aurélien Zanelli
21d2c64660 gfileutils: add some sanity checks
To avoid handling non-null GError or NULL filename.

https://bugzilla.gnome.org/show_bug.cgi?id=754026
2017-10-05 13:42:19 +01:00
Xavi Ivars
eb5120d0df
[l10n] Updated Catalan (Valencian) translation 2017-10-05 13:56:23 +02:00
Simon McVittie
733c7bd9c5 g_test_log: Consistently use GLib whitespace style
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=788467
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
2017-10-03 17:22:48 +01:00
Simon McVittie
23ba8aec92 testutils: Report fatal errors and warnings as TAP
Lines starting with "Bail out!" are special TAP syntax: they mark
the entire test execution (one binary or script) as failed, and stop
processing. Automake's parallel test harness knows this, and will print
the diagnostic in the test results, leading to clearer output.

Without this change, having changed glib/tests/bytes.c to emit a
spurious g_warning():

ERROR: bytes - too few tests run (expected 15, got 0)
ERROR: bytes - exited with status 133 (terminated by signal 5?)

With this change, it's clearer what has happened:

ERROR: bytes - Bail out! FATAL-WARNING: I broke this as a demonstration

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=788467
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
2017-10-03 15:16:15 +01:00
Philip Withnall
81d7af312e gmem: Make it more obvious that g_mem_set_vtable() does nothing
Clarify the big deprecation warning in the documentation.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-03 09:36:08 +01:00
Jeremy Bicha
2afcf6c393 trivial: tweak Spanish translation header 2017-10-02 22:06:18 -04:00
Matthias Clasen
8be9a6f020 Revert "Prepare for 2.54.1"
This reverts commit 9a08d3ef8f.

Turns out there's new api here already.
2017-10-02 10:54:58 -04:00
Matthias Clasen
9a08d3ef8f Prepare for 2.54.1 2017-10-02 10:45:53 -04:00
Philip Withnall
702b6af87c gtestutils: Explicitly cast args to g_assertion_message_cmpnum()
This avoids warnings when compiling with -Wconversion on 32-bit
architectures, as the conversion to (long double) is not necessarily
lossless. We don’t care about that, though, since the actual comparison
was done with the correct types, and g_assertion_message_cmpnum() is
only used to print failure information.

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

https://bugzilla.gnome.org/show_bug.cgi?id=788385
2017-10-02 15:32:46 +01:00
Philip Withnall
0e888bdf52 gtypes: Fix signedness of __builtin_bswap() usage
In GUINT64_TO_BE(), for example, when compiling with -Wsign-conversion,
we get a warning due to an implicit cast from (gint64) to (guint64) when
passing the argument to __builtin_bswap64().

According to the GCC documentation, __builtin_bswap64() takes an
unsigned argument:

https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

Cast the input appropriately.

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

https://bugzilla.gnome.org/show_bug.cgi?id=788384
2017-10-02 15:31:20 +01:00
Philip Withnall
b0cbd21b25 glib-compile-resources: Fix leak of a GHashTable
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788138
2017-10-02 15:30:23 +01:00
Ondrej Holy
f6fa90fb0d gunixmounts: Fix mount points generation
Commit 53ed180 improved mtab processing, however, also introduced bug
in code obtaining mount points. mtab was used by mistake also for
g_unix_mount_points_get implementation, which is obviously wrong and
fstab has to be used instead...

https://bugzilla.gnome.org/show_bug.cgi?id=781867
2017-10-02 12:19:51 +02:00
Matej Urbančič
d4a21e001a Updated Slovenian translation 2017-09-29 08:41:37 +02:00
Philip Withnall
330e6911b5 goutputstream: Add missing (optional) annotations to bytes_written args
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-09-27 10:31:34 +01:00
Nelson Benítez León
c1a31c3aaa gio/gunixmounts.c: Don't use mtime to monitor mounts on /proc/
Fix get_mounts_timestamp() to not use a stat'ed mtime for /proc/ files.
Instead, use mount_poller_time if /proc/ watch is running, or otherwise
return a new generated timestamp to always assume mounts-changed, which
is safer than previous behaviour of always assuming mounts-not-changed
(as mtime never changes for /proc/ files when queried from the same
process).

We say it's safer because allows caches depending on:

g_unix_mounts_get(&time_read)
g_unix_mounts_changed_since()

to drop possibly outdated/duplicated values, as that was the case for the
GIO mounts cache used in gio/glocalfile.c which provides mount info for
g_file_query_filesystem_info() call, as described in below referenced bug.

This fix complements related commit bd9e266e11

https://bugzilla.gnome.org/show_bug.cgi?id=787731
2017-09-22 20:28:44 +05:00
Nelson Benítez León
32a9b88b20 gio/tests: Add testcase for bug 787731
Add testcase for function g_file_query_filesystem_info()
reporting outdated info for "filesystem::readonly" attribute
when said attribute was different in a previous mounted
partition in the same device (as GIO maintains a mounts cache
per 'st_dev' stat() member).

To trigger a mount operation, testcase uses program 'bindfs'
instead of 'mount --bind' as bindfs does not require root
privileges. And 'fusermount -u' command is used to unmount said
bindfs mount.

As a reference in Fedora, 'bindfs' is installed from 'bindfs'
package and 'fusermount' from 'fuse' package (this one is installed
by default as being part of 'System Tools' group).

The test creates a directory with a file in it, then mounts it
readonly over another directory (the mountpoint), it then checks
that g_file_query_filesystem_info() for the file in it indeed reports
"filesystem::readonly" as TRUE. Then unmounts and mounts again this
time rw (not readonly), it then checks again if g_file_query_filesystem_info()
is reporting "filesystem::readonly" as TRUE, if that's the case, it
confirms the bug by opening said file in write mode.

Testcase is only added for Unix builds.

https://bugzilla.gnome.org/show_bug.cgi?id=787731
2017-09-22 20:28:44 +05:00
Philip Withnall
1304197ed0 gmessages: Fix a typo in the documentation for g_log_set_handler_full()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-09-22 13:34:19 +01:00
Philip Withnall
09796b3ccc Partially revert "gio: Add missing (array length) annotations"
This reverts commit 8028494335.

Adding (array length=…) to a gchar* parameter causes the GIR file to
contain an array of strings, rather than an array of characters. While
we fix GIR, revert those changes.

Some of the other changes in the file (which have an explicit
(element-type) already) are fine.

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

https://bugzilla.gnome.org/show_bug.cgi?id=765063
2017-09-21 12:05:06 +01:00
Alisa Maas
8028494335 gio: Add missing (array length) annotations
https://bugzilla.gnome.org/show_bug.cgi?id=765063
2017-09-21 11:08:12 +01:00
Matej Urbančič
e7a60ed262 Updated Slovenian translation 2017-09-20 14:11:11 +02:00
Chun-wei Fan
213c31a49d build: Change DLL naming in Visual Studio projects
The previous commit to glib/glibconfig.h.win32.in, though it improves
the state of GLib and fixes bugs, cannot be used as a drop-in
replacement for code that builds against the previous
glib/glibconfig.h(.win32.in) that were build using the Visual Studio
projects.  Change the DLL names as a result so that the likelihood of
problems caused by replacing existing GLib DLLs can be reduced--code
that was built against previous GLib MSVC builds should be rebuilt, so
that things will work with the newer DLLs, instead of depending on the
older DLLs.

Note that if Visual Studio builds are done through Meson, existing code
that link against GLib should be rebuilt as well, for the same reason.
DLLs built with the Visual Studio projects from 2.55.0 onwards should be
compatible with the ones that are built with Visual Studio via Meson.
2017-09-15 12:56:40 +08:00
Chun-wei Fan
4fd056a5f5 glib/glibconfig.h.win32.in: Update and clean up
Make the entries in here more consistent with what Meson produces with
its Visual Studio builds.  Also fix the macros [GSIZE|GSSIZE]_TO_[LE|BE]
for x64 builds.
2017-09-15 12:50:50 +08:00
Chun-wei Fan
9831516835 config.h.win32.in: Fix previous commit
We should still let people building via the MSVC projects decide whether
they use the bundled PCRE sources for building GLib.  Accidentally
changed it in the previous commit.
2017-09-15 11:48:58 +08:00
Chun-wei Fan
751a757766 build: Update config.h.win32.in
Update config.h.win32.in to match closely to what Meson will produce for
the various Visual Studio versions (2008~2017), as it seems that Meson
produces a better config.h for our MSVC builds of GLib.

One of the major changes in this is that all Visual Studio builds
(either through Meson, which is already so, or via the existing
projects) is that the built binaries will require Windows 7 or later,
so that we let people know early on in a cycle that MSVC builds of
2.55.0 and later will definitely need Windows 7 or later.
2017-09-15 11:37:40 +08:00
Robert Ancell
db2ae64636 Fix comment/docs grammar: incase -> in case 2017-09-15 13:50:41 +12:00
Chun-wei Fan
a7a6449f4d meson: Install items according to their relevance
The m4 and bash completion items are usable and relevant
depending on the host system's configuration.  So, we check for the
presence of the programs that these items depend on, and only install
them when those programs are found.

For the Valgrind suppression files, we don't install them on Windows as
Valgrind is currently not supported on Windows.

Als fix the path where the GDB helpers are installed, as the path is
incorrectly constructed.

This will fix the "install" stage when building on Visual Studio at
least as there are some post-install steps that are related to them,
which will make use of these programs.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-09-14 16:02:03 +08:00
Chun-wei Fan
65d6990579 build: Dist the other required Meson build files
Some of the Meson build files are not dist'ed by 'make dist', which are
reqired for things to work, and there was a missing '\' that cause some
of the meson.build files under tests/ not to be disted.

https://bugzilla.gnome.org/show_bug.cgi?id=783210
2017-09-14 16:02:00 +08:00
Chun-wei Fan
4c417c4965 build: Define G_HAVE_GNUC_[VARARGS|VISIBILITY] conditionally
They are not supported by Visual Studio, so only define them in
glibconfig.h.in when not on Visual Studio.  Fixes builds of GTK+-2.x
against Meson/MSVC builds of GLib.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-09-14 10:23:34 +08:00
Philip Withnall
5e55a4e243 gtlsbackend: Default to indicating no support for DTLS in GTlsBackend
I’m unsure what the original reasoning for returning TRUE by default
from supports_dtls was, but it is not backwards-compatible. If a
pre-existing GTlsBackend implementation never implements the
supports_dtls vfunc, the supports_dtls() method will magically return
TRUE rather than FALSE.

Since any backend which does implement DTLS should be implementing the
supports_dtls vfunc (and no DTLS-supporting backends have actually been
merged yet; see bug #697908), it seems safer to make this slight API
break in the name of backwards compatibility than to leave it as
returning TRUE incorrectly.

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

https://bugzilla.gnome.org/show_bug.cgi?id=787485
2017-09-13 17:38:42 +01:00
Philip Withnall
015ab311f8 gmessages: Add IDs for documentation headers
This fixes some broken cross-references between various places in the
logging documentation.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-09-13 17:07:29 +01:00
Philip Withnall
a2cf4806a4 tests: Add tests for g_slist_copy() and g_slist_copy_deep()
This gives us 100% coverage of GSList (when running `make lcov`).

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

https://bugzilla.gnome.org/show_bug.cgi?id=787581
2017-09-13 13:37:13 +01:00
Sam Thursfield
bb26bc29e3 Make GListModelInterface::get_item usable from GObject Introspection bindings
Language bindings have so far been unable to implement the GListModel
interface because the ::get_item virtual function returns a
non-bindable type (gpointer). The `gpointer` type gets translated into
`void` by G-I meaning that get_item() implementations can't return any
items.

We can set the return type of the get_item() vfunc explicitly to
GObject, which fixes the issue.

This patch also removes the existing (type GObject) annotation on
g_list_model_get_item(), which is necessary because if its return type
matches that of the get_item() vfunc, G-I connects the two and
propagates the 'skip' annotation from one to the other resulting in the
get_item() vfunc being hidden. There's no API break here because the
'skip' annotation makes g_list_model_get_item() invisible to G-I users
anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=787271
2017-09-12 12:32:20 +01:00
Philip Withnall
1a5cebec39 docs: Discourage use of gstdio.h and clarify its header requirements
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=781598
2017-09-12 12:20:18 +01:00
Philip Withnall
39469aa7bb Revert "gstdio: #include fcntl.h on UNIX in gstdio.h"
This reverts commit 6f8073d44a.

As per further discussion on bug #781598, we can’t do this in GLib,
since fcntl.h is not guaranteed to be present on all Unix systems. Users
of GLib *must* do a header check (for example, using AC_CHECK_HEADERS)
and #include fcntl.h themselves.
2017-09-12 12:12:27 +01:00
Christian Schramm
54e3ed17f0 gslist: Simplified node removal and got rid of some code duplication
Merged two almost identical functions for removing at most one
or all nodes containing some data. Also simplified the code a bit
by using a pointer to a pointer (see
http://wordaligned.org/articles/two-star-programming).

(Modified by Philip Withnall to fix two code formatting nitpicks.)

https://bugzilla.gnome.org/show_bug.cgi?id=722256
2017-09-12 12:11:06 +01:00
Reuben Thomas
6f8073d44a gstdio: #include fcntl.h on UNIX in gstdio.h
https://bugzilla.gnome.org/show_bug.cgi?id=781598
2017-09-12 11:10:54 +01:00