diff options
94 files changed, 2494 insertions, 1220 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f4c005a9a..d804269a9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,11 +11,11 @@ cache: - _ccache/ variables: - FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v26" + FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v27" COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v7" DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v19" ALPINE_IMAGE: "registry.gitlab.gnome.org/gnome/glib/alpine:v3" - MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v15" + MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v16" MESON_TEST_TIMEOUT_MULTIPLIER: 4 G_MESSAGES_DEBUG: all MESON_COMMON_OPTIONS: "--buildtype debug --wrap-mode=nodownload --fatal-meson-warnings" @@ -185,8 +185,8 @@ fedora-x86_64: --prefix=$HOME/glib-installed --localstatedir=/var --libdir=lib - -Dsystemtap=true - -Ddtrace=true + -Dsystemtap=enabled + -Ddtrace=enabled -Dinstalled_tests=true -Ddocumentation=true -Dintrospection=enabled @@ -240,8 +240,8 @@ debian-stable-x86_64: --prefix=$HOME/glib-installed --localstatedir=/var --libdir=lib - -Dsystemtap=true - -Ddtrace=true + -Dsystemtap=enabled + -Ddtrace=enabled _build - meson compile -C _build - .gitlab-ci/run-tests.sh @@ -312,7 +312,6 @@ muslc-alpine-x86_64: --prefix=$HOME/glib-installed --localstatedir=/var --libdir=lib - -Dsystemtap=true _build - meson compile -C _build - .gitlab-ci/run-tests.sh @@ -343,7 +342,7 @@ installed-tests: --prefix=/usr --libdir=/usr/lib64 -Dinstalled_tests=true -Ddefault_library=both - -Ddtrace=false + -Ddtrace=disabled _build - meson compile -C _build - sudo meson install -C _build @@ -383,8 +382,8 @@ G_DISABLE_ASSERT: script: - meson setup ${MESON_COMMON_OPTIONS} --werror - -Dsystemtap=true - -Ddtrace=true + -Dsystemtap=enabled + -Ddtrace=enabled -Dinstalled_tests=true -Dglib_assert=false -Dintrospection=enabled @@ -421,8 +420,8 @@ valgrind: script: - meson setup ${MESON_COMMON_OPTIONS} --werror - -Dsystemtap=true - -Ddtrace=true + -Dsystemtap=enabled + -Ddtrace=enabled -Dinstalled_tests=true -Dintrospection=enabled _build @@ -492,6 +491,21 @@ cross-mingw64: - _build/gthread/libgthread-2.0-0.dll - _build/gobject/libgobject-2.0-0.dll +# A note about msys2: it’s a rolling release distribution, running Windows under +# Docker isn’t really supported, and the win32-ps CI runner is shared. All that +# adds up to mean that we have to run CI against the latest msys2 packages, and +# that this occasionally causes build failures in GLib due to changes in msys2. +# In order to avoid that pre-empting other GLib development, the policy in such +# cases is to: +# 1. Immediately and without hesitation make the msys2-* CI jobs non-fatal +# (add `allow_failure: true` below). +# 2. File an issue about fixing the GLib msys2 build and re-enabling failure +# on the CI job +# 3. Set the milestone for that issue to be the next GLib release, so it’s done +# in a timely manner; and tag it as ~win32 so the GLib Windows maintainers +# are notified and can work on it. +# 4. Rebase any pending broken MRs on top of the commit which makes the CI job +# non-fatal, so that development on `main` is unblocked. msys2-mingw32: extends: .only-default-and-merges stage: build @@ -520,6 +534,7 @@ msys2-mingw32: - _coverage/ - _reference/ +# See the note about msys2 CI job failure policy above. msys2-clang64: extends: .only-schedules-or-manual stage: build @@ -602,7 +617,7 @@ vs2017-x64-static: - _build/meson-logs freebsd-13-x86_64: - extends: .only-origin-or-manual + extends: .only-schedules-or-manual stage: build tags: - freebsd-13 @@ -750,8 +765,8 @@ scan-build: --localstatedir=/var --libdir=lib -Dglib_debug=enabled - -Dsystemtap=true - -Ddtrace=true + -Dsystemtap=enabled + -Ddtrace=enabled -Dinstalled_tests=true -Dintrospection=enabled _scan_build @@ -780,8 +795,8 @@ scan-build: --prefix=$HOME/glib-installed --localstatedir=/var --libdir=lib - -Dsystemtap=true - -Ddtrace=true + -Dsystemtap=enabled + -Ddtrace=enabled -Dinstalled_tests=true -Dintrospection=enabled _coverity_build diff --git a/.gitlab-ci/fedora.Dockerfile b/.gitlab-ci/fedora.Dockerfile index 3713cc357..f13f0427e 100644 --- a/.gitlab-ci/fedora.Dockerfile +++ b/.gitlab-ci/fedora.Dockerfile @@ -1,4 +1,4 @@ -FROM fedora:37 +FROM fedora:39 RUN dnf -y update \ && dnf -y install \ diff --git a/.gitlab-ci/mingw.Dockerfile b/.gitlab-ci/mingw.Dockerfile index d688a35a1..fde9550d0 100644 --- a/.gitlab-ci/mingw.Dockerfile +++ b/.gitlab-ci/mingw.Dockerfile @@ -1,4 +1,4 @@ -FROM registry.gitlab.gnome.org/gnome/glib/fedora:v25 +FROM registry.gitlab.gnome.org/gnome/glib/fedora:v27 USER root diff --git a/docs/reference/gio/gdbus-codegen.rst b/docs/reference/gio/gdbus-codegen.rst index 2f973657a..22fa4852e 100644 --- a/docs/reference/gio/gdbus-codegen.rst +++ b/docs/reference/gio/gdbus-codegen.rst @@ -443,7 +443,7 @@ The following D-Bus annotations are supported by ``gdbus-codegen``: As an easier alternative to using the ``org.gtk.GDBus.DocString`` annotation, note that parser used by ``gdbus-codegen`` parses XML comments in a way similar -to `gtk-doc <https://developer-old.gnome.org/gtk-doc-manual/stable/>`_:: +to `gtk-doc <https://gitlab.gnome.org/GNOME/gtk-doc/>`_:: <!-- net.Corp.Bar: @@ -797,7 +797,7 @@ only if, each added method, property signal is annotated with the versions. The generated C code currently happens to be annotated with -`gtk-doc <https://developer-old.gnome.org/gtk-doc-manual/stable/>`_ and +`gtk-doc <https://gitlab.gnome.org/GNOME/gtk-doc/>`_ and `GObject Introspection <https://gi.readthedocs.io/en/latest/>`_ comments and annotations. The layout and contents might change in the future so no guarantees about e.g. ``SECTION`` usage etc. are given. diff --git a/docs/reference/gio/glib-compile-schemas.rst b/docs/reference/gio/glib-compile-schemas.rst index 4f420929f..a6f794d98 100644 --- a/docs/reference/gio/glib-compile-schemas.rst +++ b/docs/reference/gio/glib-compile-schemas.rst @@ -34,9 +34,9 @@ used by ``GSettings``. The XML schema files must have the filename extension ``GSettings`` documentation. At runtime, GSettings looks for schemas in the ``glib-2.0/schemas`` -subdirectories of all directories specified in the ``XDG_DATA_DIRS`` environment -variable. The usual location to install schema files is -``/usr/share/glib-2.0/schemas``. +subdirectories of all directories specified in the ``XDG_DATA_DIRS`` and +``XDG_DATA_HOME`` environment variables. The usual location to install schema +files is ``/usr/share/glib-2.0/schemas``. In addition to schema files, ``glib-compile-schemas`` reads ‘vendor override’ files, which are key files that can override default values for keys in diff --git a/docs/reference/gio/meson.build b/docs/reference/gio/meson.build index 35ea67b37..d2724565c 100644 --- a/docs/reference/gio/meson.build +++ b/docs/reference/gio/meson.build @@ -1,8 +1,17 @@ +gio_manpages = [ + 'gapplication', + 'gdbus-codegen', + 'gdbus', + 'gio-querymodules', + 'gio', + 'glib-compile-resources', + 'glib-compile-schemas', + 'gresource', + 'gsettings', +] + if get_option('man-pages').enabled() - manpages = ['gapplication', 'gio-querymodules', 'glib-compile-schemas', - 'glib-compile-resources', 'gsettings', 'gresource', 'gdbus', - 'gio', 'gdbus-codegen'] - foreach page : manpages + foreach page: gio_manpages custom_target(page + '-man', input: page + '.rst', output: page + '.1', @@ -19,6 +28,25 @@ if get_option('man-pages').enabled() endforeach endif +if get_option('documentation') + man_html_path = docs_dir / 'gio-2.0' + + foreach page: gio_manpages + custom_target( + input: page + '.rst', + output: page + '.html', + command: [ + rst2html5, + '@INPUT@', + ], + capture: true, + install: true, + install_dir: man_html_path, + install_tag: 'doc', + ) + endforeach +endif + if get_option('documentation') and enable_gir expand_content_files = [ 'dbus-error.md', diff --git a/docs/reference/glib/conversion-macros.md b/docs/reference/glib/conversion-macros.md index 32f70fc60..c4f0fb773 100644 --- a/docs/reference/glib/conversion-macros.md +++ b/docs/reference/glib/conversion-macros.md @@ -39,8 +39,8 @@ p = (void*) (long) 42; i = (int) (long) p; ``` -The GLib macros `GPOINTER_TO_INT()`, `GINT_TO_POINTER()`, etc. take care to -do the right thing on every platform. +The GLib macros [`GPOINTER_TO_INT()`](#gpointer-to-int), [`GINT_TO_POINTER()`](#gint-to-pointer), +etc. take care to do the right thing on every platform. **Warning**: You may not store pointers in integers. This is not portable in any way, shape or form. These macros only allow storing integers in @@ -48,18 +48,33 @@ pointers, and only preserve 32 bits of the integer; values outside the range of a 32-bit integer will be mangled. -``GINT_TO_POINTER(value)``, ``GPOINTER_TO_INT(value)`` -: Stuffs an integer into a pointer type, and vice versa. Remember, you may not - store pointers in integers. This is not portable in any way, shape or form. - These macros only allow storing integers in pointers, and only preserve 32 - bits of the integer; values outside the range of a 32-bit integer will be - mangled. +`GINT_TO_POINTER(value)`<a name="gint-to-pointer"></a>, `GPOINTER_TO_INT(value)`<a name="gpointer-to-int"></a> -``GUINT_TO_POINTER(value)``, ``GPOINTER_TO_UINT(value)`` -: Stuffs an unsigned integer into a pointer type, and vice versa. +: Stuffs an integer into a pointer type, and vice versa. -``GSIZE_TO_POINTER(value)``, ``GPOINTER_TO_SIZE(value)`` -: Stuffs a `size_t` into a pointer type, and vice versa. + Remember, you may not store pointers in integers. This is not portable in + any way, shape or form. These macros only allow storing integers in + pointers, and only preserve 32 bits of the integer; values outside the + range of a 32-bit integer will be mangled. + +`GUINT_TO_POINTER(value)`<a name="guint-to-pointer"></a>, `GPOINTER_TO_UINT(value)`<a name="gpointer-to-uint"></a> + +: Stuffs an unsigned integer into a pointer type, and vice versa. + +`GSIZE_TO_POINTER(value)`<a name="gsize-to-pointer"></a>, `GPOINTER_TO_SIZE(value)`<a name="gpointer-to-size"></a> + +: Stuffs a `size_t` into a pointer type, and vice versa. + +`GTYPE_TO_POINTER(value)`<a name="gtype-to-pointer"></a>, `GPOINTER_TO_TYPE(value)`<a name="gpointer-to-type"></a> + +: Stuffs a [`GType`](../gobject/alias.Type.html) into a pointer type, and + vice versa. + + These macros should be used instead of [`GSIZE_TO_POINTER()`](#gsize-to-pointer), + [`GPOINTER_TO_SIZE()`](#gpointer-to-size) to ensure portability, since + `GType` is not guaranteed to be the same as `size_t`. + + Since: 2.80 ## Byte Order Conversion @@ -92,190 +107,250 @@ Note that the byte order conversion macros may evaluate their arguments multiple times, thus you should not use them with arguments which have side-effects. -`G_BYTE_ORDER` -: The host byte order. This can be either `G_LITTLE_ENDIAN` or `G_BIG_ENDIAN`. +`G_BYTE_ORDER`<a name="g-byte-order"></a> + +: The host byte order. This can be either [`G_LITTLE_ENDIAN`](#g-little-endian) + or [`G_BIG_ENDIAN`](#g-big-endian). -`G_LITTLE_ENDIAN` -: Specifies the little endian byte order. +`G_LITTLE_ENDIAN`<a name="g-little-endian"></a> -`G_BIG_ENDIAN` -: Specifies the big endian byte order. +: Specifies the little endian byte order. -`G_PDP_ENDIAN` -: Specifies the PDP endian byte order. +`G_BIG_ENDIAN`<a name="g-big-endian"></a> + +: Specifies the big endian byte order. + +`G_PDP_ENDIAN`<a name="g-pdp-endian"></a> + +: Specifies the PDP endian byte order. ### Signed -`GINT_FROM_BE(value)` -: Converts an `int` value from big-endian to host byte order. +`GINT_FROM_BE(value)`<a name="gint-from-be"></a> + +: Converts an `int` value from big-endian to host byte order. + +`GINT_FROM_LE(value)`<a name="gint-from-le"></a> + +: Converts an `int` value from little-endian to host byte order. + +`GINT_TO_BE(value)`<a name="gint-to-be"></a> + +: Converts an `int` value from host byte order to big-endian. + +`GINT_TO_LE(value)`<a name="gint-to-le"></a> + +: Converts an `int` value from host byte order to little-endian. + +`GLONG_FROM_BE(value)`<a name="glong-from-be"></a> + +: Converts a `long` value from big-endian to the host byte order. + +`GLONG_FROM_LE(value)`<a name="glong-from-le"></a> + +: Converts a `long` value from little-endian to host byte order. + +`GLONG_TO_BE(value)`<a name="glong-to-be"></a> + +: Converts a `long` value from host byte order to big-endian. + +`GLONG_TO_LE(value)`<a name="glong-to-le"></a> + +: Converts a `long` value from host byte order to little-endian. + +`GSSIZE_FROM_BE(value)`<a name="gssize-from-be"></a> + +: Converts a `ssize_t` value from big-endian to host byte order. + +`GSSIZE_FROM_LE(value)`<a name="gssize-from-le"></a> + +: Converts a `ssize_t` value from little-endian to host byte order. + +`GSSIZE_TO_BE(value)`<a name="gssize-to-be"></a> + +: Converts a `ssize_t` value from host byte order to big-endian. + +`GSSIZE_TO_LE(value)`<a name="gssize-to-le"></a> -`GINT_FROM_LE(value)` -: Converts an `int` value from little-endian to host byte order. +: Converts a `ssize_t` value from host byte order to little-endian. -`GINT_TO_BE(value)` -: Converts an `int` value from host byte order to big-endian. +`GINT16_FROM_BE(value)`<a name="gint16-from-be"></a> -`GINT_TO_LE(value)` -: Converts an `int` value from host byte order to little-endian. +: Converts an `int16_t` value from big-endian to host byte order. -`GLONG_FROM_BE(value)` -: Converts a `long` value from big-endian to the host byte order. +`GINT16_FROM_LE(value)`<a name="gint16-from-le"></a> -`GLONG_FROM_LE(value)` -: Converts a `long` value from little-endian to host byte order. +: Converts an `int16_t` value from little-endian to host byte order. -`GLONG_TO_BE(value)` -: Converts a `long` value from host byte order to big-endian. +`GINT16_TO_BE(value)`<a name="gint16-to-be"></a> -`GLONG_TO_LE(value)` -: Converts a `long` value from host byte order to little-endian. +: Converts an `int16_t` value from host byte order to big-endian. -`GSSIZE_FROM_BE(value)` -: Converts a `ssize_t` value from big-endian to host byte order. +`GINT16_TO_LE(value)`<a name="gint16-to-le"></a> -`GSSIZE_FROM_LE(value)` -: Converts a `ssize_t` value from little-endian to host byte order. +: Converts an `int16_t` value from host byte order to little-endian. -`GSSIZE_TO_BE(value)` -: Converts a `ssize_t` value from host byte order to big-endian. +`GINT32_FROM_BE(value)`<a name="gint32-from-be"></a> -`GSSIZE_TO_LE(value)` -: Converts a `ssize_t` value from host byte order to little-endian. +: Converts an `int32_t` value from big-endian to host byte order. -`GINT16_FROM_BE(value)` -: Converts an `int16_t` value from big-endian to host byte order. +`GINT32_FROM_LE(value)`<a name="gint32-from-le"></a> -`GINT16_FROM_LE(value)` -: Converts an `int16_t` value from little-endian to host byte order. +: Converts an `int32_t` value from little-endian to host byte order. -`GINT16_TO_BE(value)` -: Converts an `int16_t` value from host byte order to big-endian. +`GINT32_TO_BE(value)`<a name="gint32-to-be"></a> -`GINT16_TO_LE(value)` -: Converts an `int16_t` value from host byte order to little-endian. +: Converts an `int32_t` value from host byte order to big-endian. -`GINT32_FROM_BE(value)` -: Converts an `int32_t` value from big-endian to host byte order. +`GINT32_TO_LE(value)`<a name="gint32-to-le"></a> -`GINT32_FROM_LE(value)` -: Converts an `int32_t` value from little-endian to host byte order. +: Converts an `int32_t` value from host byte order to little-endian. -`GINT32_TO_BE(value)` -: Converts an `int32_t` value from host byte order to big-endian. +`GINT64_FROM_BE(value)`<a name="gint64-from-be"></a> -`GINT32_TO_LE(value)` -: Converts an `int32_t` value from host byte order to little-endian. +: Converts an `int64_t` value from big-endian to host byte order. -`GINT64_FROM_BE(value)` -: Converts an `int64_t` value from big-endian to host byte order. +`GINT64_FROM_LE(value)`<a name="gint64-from-le"></a> -`GINT64_FROM_LE(value)` -: Converts an `int64_t` value from little-endian to host byte order. +: Converts an `int64_t` value from little-endian to host byte order. -`GINT64_TO_BE(value)` -: Converts an `int64_t` value from host byte order to big-endian. +`GINT64_TO_BE(value)`<a name="gint64-to-be"></a> -`GINT64_TO_LE(value)` -: Converts an `int64_t` value from host byte order to little-endian. +: Converts an `int64_t` value from host byte order to big-endian. + +`GINT64_TO_LE(value)`<a name="gint64-to-le"></a> + +: Converts an `int64_t` value from host byte order to little-endian. ### Unsigned -`GUINT_FROM_BE(value)` -: Converts an `unsigned int` value from big-endian to host byte order. +`GUINT_FROM_BE(value)`<a name="guint-from-be"></a> + +: Converts an `unsigned int` value from big-endian to host byte order. + +`GUINT_FROM_LE(value)`<a name="guint-from-le"></a> + +: Converts an `unsigned int` value from little-endian to host byte order. + +`GUINT_TO_BE(value)`<a name="guint-to-be"></a> + +: Converts an `unsigned int` value from host byte order to big-endian. + +`GUINT_TO_LE(value)`<a name="guint-to-le"></a> + +: Converts an `unsigned int` value from host byte order to little-endian. + +`GULONG_FROM_BE(value)`<a name="gulong-from-be"></a> + +: Converts an `unsigned long` value from big-endian to host byte order. + +`GULONG_FROM_LE(value)`<a name="gulong-from-le"></a> + +: Converts an `unsigned long` value from little-endian to host byte order. + +`GULONG_TO_BE(value)`<a name="gulong-to-be"></a> + +: Converts an `unsigned long` value from host byte order to big-endian. + +`GULONG_TO_LE(value)`<a name="gulong-to-le"></a> + +: Converts an `unsigned long` value from host byte order to little-endian. + +`GSIZE_FROM_BE(value)`<a name="gsize-from-be"></a> + +: Converts a `size_t` value from big-endian to the host byte order. + +`GSIZE_FROM_LE(value)`<a name="gsize-from-le"></a> + +: Converts a `size_t` value from little-endian to host byte order. + +`GSIZE_TO_BE(value)`<a name="gsize-to-be"></a> + +: Converts a `size_t` value from host byte order to big-endian. + +`GSIZE_TO_LE(value)`<a name="gsize-to-le"></a> + +: Converts a `size_t` value from host byte order to little-endian. + +`GUINT16_FROM_BE(value)`<a name="guint16-from-be"></a> + +: Converts a `uint16_t` value from big-endian to host byte order. + +`GUINT16_FROM_LE(value)`<a name="guint16-from-le"></a> + +: Converts a `uint16_t` value from little-endian to host byte order. + +`GUINT16_TO_BE(value)`<a name="guint16-to-be"></a> + +: Converts a `uint16_t` value from host byte order to big-endian. + +`GUINT16_TO_LE(value)`<a name="guint16-to-le"></a> + +: Converts a `uint16_t` value from host byte order to little-endian. -`GUINT_FROM_LE(value)` -: Converts an `unsigned int` value from little-endian to host byte order. +`GUINT32_FROM_BE(value)`<a name="guint32-from-be"></a> -`GUINT_TO_BE(value)` -: Converts an `unsigned int` value from host byte order to big-endian. +: Converts a `uint32_t` value from big-endian to host byte order. -`GUINT_TO_LE(value)` -: Converts an `unsigned int` value from host byte order to little-endian. +`GUINT32_FROM_LE(value)`<a name="guint32-from-le"></a> -`GULONG_FROM_BE(value)` -: Converts an `unsigned long` value from big-endian to host byte order. +: Converts a `uint32_t` value from little-endian to host byte order. -`GULONG_FROM_LE(value)` -: Converts an `unsigned long` value from little-endian to host byte order. +`GUINT32_TO_BE(value)`<a name="guint32-to-be"></a> -`GULONG_TO_BE(value)` -: Converts an `unsigned long` value from host byte order to big-endian. +: Converts a `uint32_t` value from host byte order to big-endian. -`GULONG_TO_LE(value)` -: Converts an `unsigned long` value from host byte order to little-endian. +`GUINT32_TO_LE(value)`<a name="guint32-to-le"></a> -`GSIZE_FROM_BE(value)` -: Converts a `size_t` value from big-endian to the host byte order. +: Converts a `uint32_t` value from host byte order to little-endian. -`GSIZE_FROM_LE(value)` -: Converts a `size_t` value from little-endian to host byte order. +`GUINT64_FROM_BE(value)`<a name="guint64-from-be"></a> -`GSIZE_TO_BE(value)` -: Converts a `size_t` value from host byte order to big-endian. +: Converts a `uint64_t` value from big-endian to host byte order. -`GSIZE_TO_LE(value)` -: Converts a `size_t` value from host byte order to little-endian. +`GUINT64_FROM_LE(value)`<a name="guint64-from-le"></a> -`GUINT16_FROM_BE(value)` -: Converts a `uint16_t` value from big-endian to host byte order. +: Converts a `uint64_t` value from little-endian to host byte order. -`GUINT16_FROM_LE(value)` -: Converts a `uint16_t` value from little-endian to host byte order. +`GUINT64_TO_BE(value)`<a name="guint64-to-be"></a> -`GUINT16_TO_BE(value)` -: Converts a `uint16_t` value from host byte order to big-endian. +: Converts a `uint64_t` value from host byte order to big-endian. -`GUINT16_TO_LE(value)` -: Converts a `uint16_t` value from host byte order to little-endian. +`GUINT64_TO_LE(value)`<a name="guint64-to-le"></a> -`GUINT32_FROM_BE(value)` -: Converts a `uint32_t` value from big-endian to host byte order. +: Converts a `uint64_t` value from host byte order to little-endian. -`GUINT32_FROM_LE(value)` -: Converts a `uint32_t` value from little-endian to host byte order. +`GUINT16_SWAP_BE_PDP(value)`<a name="guint16-swap-be-pdp"></a> -`GUINT32_TO_BE(value)` -: Converts a `uint32_t` value from host byte order to big-endian. +: Converts a `uint16_t` value between big-endian and pdp-endian byte order. + The conversion is symmetric so it can be used both ways. -`GUINT32_TO_LE(value)` -: Converts a `uint32_t` value from host byte order to little-endian. +`GUINT16_SWAP_LE_BE(value)`<a name="guint16-swap-le-be"></a> -`GUINT64_FROM_BE(value)` -: Converts a `uint64_t` value from big-endian to host byte order. +: Converts a `uint16_t` value between little-endian and big-endian byte order. + The conversion is symmetric so it can be used both ways. -`GUINT64_FROM_LE(value)` -: Converts a `uint64_t` value from little-endian to host byte order. +`GUINT16_SWAP_LE_PDP(value)`<a name="guint16-swap-le-pdp"></a> -`GUINT64_TO_BE(value)` -: Converts a `uint64_t` value from host byte order to big-endian. +: Converts a `uint16_t` value between little-endian and pdp-endian byte order. + The conversion is symmetric so it can be used both ways. -`GUINT64_TO_LE(value)` -: Converts a `uint64_t` value from host byte order to little-endian. +`GUINT32_SWAP_BE_PDP(value)`<a name="guint32-swap-be-pdp"></a> -`GUINT16_SWAP_BE_PDP(value)` -: Converts a `uint16_t` value between big-endian and pdp-endian byte order. - The conversion is symmetric so it can be used both ways. +: Converts a `uint32_t` value between big-endian and pdp-endian byte order. + The conversion is symmetric so it can be used both ways. -`GUINT16_SWAP_LE_BE(value)` -: Converts a `uint16_t` value between little-endian and big-endian byte order. - The conversion is symmetric so it can be used both ways. +`GUINT32_SWAP_LE_BE(value)`<a name="guint32-swap-le-be"></a> -`GUINT16_SWAP_LE_PDP(value)` -: Converts a `uint16_t` value between little-endian and pdp-endian byte order. - The conversion is symmetric so it can be used both ways. +: Converts a `uint32_t` value between little-endian and big-endian byte order. + The conversion is symmetric so it can be used both ways. -`GUINT32_SWAP_BE_PDP(value)` -: Converts a `uint32_t` value between big-endian and pdp-endian byte order. - The conversion is symmetric so it can be used both ways. +`GUINT32_SWAP_LE_PDP(value)`<a name="guint32-swap-le-pdp"></a> -`GUINT32_SWAP_LE_BE(value)` -: Converts a `uint32_t` value between little-endian and big-endian byte order. - The conversion is symmetric so it can be used both ways. +: Converts a `uint32_t` value between little-endian and pdp-endian byte order. + The conversion is symmetric so it can be used both ways. -`GUINT32_SWAP_LE_PDP(value)` -: Converts a `uint32_t` value between little-endian and pdp-endian byte order. - The conversion is symmetric so it can be used both ways. +`GUINT64_SWAP_LE_BE(value)`<a name="guint64-swap-le-be"></a> -`GUINT64_SWAP_LE_BE(value)` -: Converts a `uint64_t` value between little-endian and big-endian byte order. - The conversion is symmetric so it can be used both ways. +: Converts a `uint64_t` value between little-endian and big-endian byte order. + The conversion is symmetric so it can be used both ways. diff --git a/docs/reference/glib/gvariant-text-format.md b/docs/reference/glib/gvariant-text-format.md index 4a142e460..0d10aeb3e 100644 --- a/docs/reference/glib/gvariant-text-format.md +++ b/docs/reference/glib/gvariant-text-format.md @@ -85,14 +85,14 @@ won't work and you'll end up with the individual characters corresponding to each byte. Unicode escapes of the form `\uxxxx` and `\Uxxxxxxxx` are supported, in -hexadecimal. The usual control sequence escapes `\a`, `\b`, `\f`, `\n`, -`\r`, `\t` and `\v` are supported. Additionally, a `\` before a newline -character causes the newline to be ignored. Finally, any other character -following `\` is copied literally (for example, `\"` or `\\`) but for -forwards compatibility with future additions you should only use this -feature when necessary for escaping backslashes or quotes. - -The usual octal and hexadecimal escapes `\0nnn` and `\xnn` are not supported +hexadecimal. The [usual control sequence escapes][C escape sequences] +`\a`, `\b`, `\f`, `\n`, `\r`, `\t` and `\v` are supported. +Additionally, a `\` before a newline character causes the newline to be ignored. +Finally, any other character following `\` is copied literally +(for example, `\"` or `\\`) but for forwards compatibility with future additions +you should only use this feature when necessary for escaping backslashes or quotes. + +The usual octal and hexadecimal escapes `\nnn` and `\xnn` are not supported here. Those escapes are used to encode byte values and `GVariant` strings are Unicode. @@ -303,10 +303,15 @@ end with a `NUL` byte. Bytestrings are specified with either `b""` or `b''`. As with strings, there is no fundamental difference between the two different types of quotes. -Bytestrings support the full range of escapes that you would expect (ie: -those supported by [`func@GLib.strcompress`]. This includes the normal control -sequence escapes (as mentioned in the section on strings) as well as octal -and hexadecimal escapes of the forms `\0nnn` and `\xnn`. +Like in strings, the [C-style control sequence escapes][C escape sequences] +`\a`, `\b`, `\f`, `\n`, `\r`, `\t` and `\v` are supported. Similarly, +a `\` before a newline character causes the newline to be ignored. +Unlike in strings, you can use octal escapes of the form `\nnn`. +Finally, any other character following `\` is copied literally +(for example, `\"` or `\\`) but for forwards compatibility +with future additions you should only use this feature when necessary +for escaping backslashes or quotes. Unlike in strings, Unicode escapes +are not supported. `b'abc'` is equivalent to `[byte 0x61, 0x62, 0x63, 0]`. @@ -344,3 +349,5 @@ string to be parsed. Format strings that collect multiple arguments are permitted, so you may require more varargs parameters than the number of `%` signs that appear. You can also give format strings that collect no arguments, but there's no good reason to do so. + +[C escape sequences]: https://en.wikipedia.org/wiki/Escape_sequences_in_C#Escape_sequences diff --git a/docs/reference/glib/i18n.md b/docs/reference/glib/i18n.md index 7c99be4bf..912a5cfef 100644 --- a/docs/reference/glib/i18n.md +++ b/docs/reference/glib/i18n.md @@ -47,3 +47,103 @@ The [gettext manual](http://www.gnu.org/software/gettext/manual/gettext.html#Maintainers) covers details of how to integrate gettext into a project’s build system and workflow. + +## Macros + +GLib provides various convenience C pre-processor macros that make it easy +for tools like [`xgettext`](https://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html) +to extract translatable strings from the source of a library or an +application. These macros are defined when including `<glib/gi18n.h>` or +`<glib/gi18n-lib.h>`. + +`_(String)` +: Marks a string for translation. The string will be replaced by its + translation at run time, if any exists; otherwise, it will be passed + as is. + + +`N_(String)` +: Marks a string for translation. Unlike `_()`, this macro will not + replace the string with its translation; this is useful when the + translatable string is inside a `struct` or array declaration, for + instance: + + static const char *messages[] = { + N_("some very meaningful message"), + N_("and another one"), + }; + + It is the responsibility of the developer to call `gettext()` when + using the string, e.g.: + + g_print ("%s", idx >= G_N_ELEMENTS (messages) + ? _("default message") + : gettext (messages[idx])); + + +`C_(Context, String)` +: Uses `gettext` to get the translation for `String`. `Context` is + used as a context. This is mainly useful for short strings which + may need different translations, depending on the context in which + they are used. For instance: + + label1 = C_("Navigation", "Back"); + label2 = C_("Body part", "Back"); + + If you are using the `C_()` macro, you need to make sure that you + pass `--keyword=C_:1c,2` to `xgettext` when extracting messages. + This only works with a version of GNU gettext newer than 0.15. + + This macro is available since GLib 2.16 + + +`NC_(Context, String)` +: Only marks a string for translation, with context. Similar to `N_()`, + but allows you to add a context to the translatable string, for + instance: + + static const char *messages[] = { + NC_("some context", "some very meaningful message"), + NC_("some context", "and another one") + }; + + It is the responsibility of the developer to call [func@GLib.dpgettext2] + when using the string, e.g.: + + g_print ("%s", idx >= G_N_ELEMENTS (messages) + ? g_dpgettext2 (NULL, "some context", "a default message") + : g_dpgettext2 (NULL, "some context", messages[idx]); + + If you are using the `NC_()` macro, you need to make sure that you pass + `--keyword=NC_:1c,2` to `xgettext` when extracting messages. This only + works with a version of GNU gettext newer than 0.15. Intltool has support + for the `NC_()` macro since version 0.40.1. + + This macro is available since GLib 2.18 + +`Q_(String)` +: Like `_()`, but handles context inside the translatable string. This has + the advantage that the string can be adorned with a prefix to guarantee + uniqueness and provide context to the translator. + + The `String` is made of two parts, separated by the `|` character. The + leading part is the prefix, which must not be translated; the trailing + part is the translatable message. + + One use case given in the gettext manual is GUI translation, where one + could e.g. disambiguate two ‘Open’ menu entries as `"File|Open"` and + `"Printer|Open"`. Another use case is the string ‘Russian’ which may + have to be translated differently depending on whether it’s the name + of a character set or a language. This could be solved by using + `"charset|Russian"` and `"language|Russian"`. + + See also the `C_()` macro for a different way to mark up translatable + strings with context. + + If you are using the `Q_()` macro, you need to make sure that you pass + `--keyword=Q_` to `xgettext` when extracting messages. If you are using + a version of GNU gettext newer than 0.15, you can also use `--keyword=Q_:1g` + to let xgettext split the context string off into a `msgctxt` line in + the `.po` file. + + This macro is available since GLib 2.4 diff --git a/docs/reference/glib/meson.build b/docs/reference/glib/meson.build index 47c5ecf3a..3c95143d6 100644 --- a/docs/reference/glib/meson.build +++ b/docs/reference/glib/meson.build @@ -1,7 +1,7 @@ +glib_manpages = ['glib-gettextize', 'gtester', 'gtester-report'] if get_option('man-pages').enabled() - manpages = ['glib-gettextize', 'gtester', 'gtester-report'] - foreach page : manpages + foreach page: glib_manpages custom_target(page + '-man', input: page + '.rst', output: page + '.1', @@ -20,37 +20,49 @@ endif if get_option('documentation') # GVariant specification is currently standalone - rst2html5 = find_program('rst2html5', 'rst2html5.py', required: false) + spec_path = docs_dir / 'glib-2.0' + man_html_path = docs_dir / 'glib-2.0' - if rst2html5.found() - spec_path = docs_dir / 'glib-2.0' + figures = files( + 'gvariant-byte-boundaries.svg', + 'gvariant-integer-and-string-structure.svg', + 'gvariant-integer-array.svg', + 'gvariant-string-array.svg', + ) - figures = files( - 'gvariant-byte-boundaries.svg', - 'gvariant-integer-and-string-structure.svg', - 'gvariant-integer-array.svg', - 'gvariant-string-array.svg', - ) + custom_target('gvariant-specification-1.0', + input: 'gvariant-specification-1.0.rst', + output: 'gvariant-specification-1.0.html', + command: [ + rst2html5, + '@INPUT@', + ], + capture: true, + install: true, + install_dir: spec_path, + install_tag: 'doc', + depend_files: figures, + ) - custom_target('gvariant-specification-1.0', - input: 'gvariant-specification-1.0.rst', - output: 'gvariant-specification-1.0.html', + install_data(figures, + install_dir: spec_path, + install_tag: 'doc', + ) + + foreach page: glib_manpages + custom_target( + input: page + '.rst', + output: page + '.html', command: [ rst2html5, '@INPUT@', ], capture: true, install: true, - install_dir: spec_path, + install_dir: man_html_path, install_tag: 'doc', - depend_files: figures, ) - - install_data(figures, - install_dir : spec_path, - install_tag : 'doc', - ) - endif + endforeach endif if get_option('documentation') and enable_gir diff --git a/docs/reference/glib/string-utils.md b/docs/reference/glib/string-utils.md index 977af4b0c..a1aff8cb2 100644 --- a/docs/reference/glib/string-utils.md +++ b/docs/reference/glib/string-utils.md @@ -18,7 +18,7 @@ Note that the functions [func@GLib.printf], [func@GLib.fprintf], explicitly include `<glib/gprintf.h>` in order to use the GLib `printf()` functions. -## String precision pitfalls # {#string-precision} +## String precision pitfalls While you may use the `printf()` functions to format UTF-8 strings, notice that the precision of a `%Ns` parameter is interpreted diff --git a/docs/reference/gobject/meson.build b/docs/reference/gobject/meson.build index fd683aa59..944cea1da 100644 --- a/docs/reference/gobject/meson.build +++ b/docs/reference/gobject/meson.build @@ -1,6 +1,7 @@ +gobject_manpages = ['glib-mkenums', 'glib-genmarshal', 'gobject-query'] + if get_option('man-pages').enabled() - manpages = ['glib-mkenums', 'glib-genmarshal', 'gobject-query'] - foreach page : manpages + foreach page: gobject_manpages custom_target(page + '-man', input: page + '.rst', output: page + '.1', @@ -17,6 +18,25 @@ if get_option('man-pages').enabled() endforeach endif +if get_option('documentation') + man_html_path = docs_dir / 'gobject-2.0' + + foreach page: gobject_manpages + custom_target( + input: page + '.rst', + output: page + '.html', + command: [ + rst2html5, + '@INPUT@', + ], + capture: true, + install: true, + install_dir: man_html_path, + install_tag: 'doc', + ) + endforeach +endif + if get_option('documentation') and enable_gir expand_content_files = [ 'boxed.md', diff --git a/docs/supported-platforms.md b/docs/supported-platforms.md index 74dd01d1a..baaef70a4 100644 --- a/docs/supported-platforms.md +++ b/docs/supported-platforms.md @@ -38,10 +38,10 @@ GLib is regularly built on at least the following systems: * FreeBSD: https://wiki.gnome.org/Projects/Jhbuild/FreeBSD * openSUSE: https://build.opensuse.org/package/show/GNOME:Factory/glib2 * CI runners, https://gitlab.gnome.org/GNOME/glib/blob/main/.gitlab-ci.yml: - - Fedora (34, https://gitlab.gnome.org/GNOME/glib/-/blob/main/.gitlab-ci/fedora.Dockerfile) - - Debian (Bullseye, https://gitlab.gnome.org/GNOME/glib/-/blob/main/.gitlab-ci/debian-stable.Dockerfile) + - Fedora (39, https://gitlab.gnome.org/GNOME/glib/-/blob/main/.gitlab-ci/fedora.Dockerfile) + - Debian (Bookworm, https://gitlab.gnome.org/GNOME/glib/-/blob/main/.gitlab-ci/debian-stable.Dockerfile) - Windows (MinGW64) - - Windows (msys2-mingw32) + - Windows (msys2-mingw32 and msys2-clang64; msys2 is a rolling release distribution) - Windows (Visual Studio 2017, and a static linking version) - Android (NDK r23b, API 31, arm64, https://gitlab.gnome.org/GNOME/glib/-/blob/main/.gitlab-ci/android-ndk.sh) - FreeBSD (12 and 13) diff --git a/gio/gactiongroupexporter.c b/gio/gactiongroupexporter.c index 3ec1db224..1e253ec88 100644 --- a/gio/gactiongroupexporter.c +++ b/gio/gactiongroupexporter.c @@ -531,10 +531,8 @@ org_gtk_Actions_method_call (GDBusConnection *connection, } static void -g_action_group_exporter_free (gpointer user_data) +g_action_group_exporter_free (GActionGroupExporter *exporter) { - GActionGroupExporter *exporter = user_data; - g_signal_handlers_disconnect_by_func (exporter->action_group, g_action_group_exporter_action_added, exporter); g_signal_handlers_disconnect_by_func (exporter->action_group, @@ -616,15 +614,6 @@ g_dbus_connection_export_action_group (GDBusConnection *connection, } exporter = g_slice_new (GActionGroupExporter); - id = g_dbus_connection_register_object (connection, object_path, org_gtk_Actions, &vtable, - exporter, g_action_group_exporter_free, error); - - if (id == 0) - { - g_slice_free (GActionGroupExporter, exporter); - return 0; - } - exporter->context = g_main_context_ref_thread_default (); exporter->pending_changes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); exporter->pending_source = NULL; @@ -632,14 +621,20 @@ g_dbus_connection_export_action_group (GDBusConnection *connection, exporter->connection = g_object_ref (connection); exporter->object_path = g_strdup (object_path); - g_signal_connect (action_group, "action-added", - G_CALLBACK (g_action_group_exporter_action_added), exporter); - g_signal_connect (action_group, "action-removed", - G_CALLBACK (g_action_group_exporter_action_removed), exporter); - g_signal_connect (action_group, "action-state-changed", - G_CALLBACK (g_action_group_exporter_action_state_changed), exporter); - g_signal_connect (action_group, "action-enabled-changed", - G_CALLBACK (g_action_group_exporter_action_enabled_changed), exporter); + id = g_dbus_connection_register_object (connection, object_path, org_gtk_Actions, &vtable, + exporter, (GDestroyNotify) g_action_group_exporter_free, error); + + if (id != 0) + { + g_signal_connect (action_group, "action-added", + G_CALLBACK (g_action_group_exporter_action_added), exporter); + g_signal_connect (action_group, "action-removed", + G_CALLBACK (g_action_group_exporter_action_removed), exporter); + g_signal_connect (action_group, "action-state-changed", + G_CALLBACK (g_action_group_exporter_action_state_changed), exporter); + g_signal_connect (action_group, "action-enabled-changed", + G_CALLBACK (g_action_group_exporter_action_enabled_changed), exporter); + } return id; } diff --git a/gio/gapplication.c b/gio/gapplication.c index 0520ce5b3..06256cdde 100644 --- a/gio/gapplication.c +++ b/gio/gapplication.c @@ -1614,6 +1614,9 @@ g_application_class_init (GApplicationClass *class) * The group of actions that the application exports. * * Since: 2.28 + * Deprecated: 2.32: Use the [iface@Gio.ActionMap] interface instead. + * Never ever mix use of this API with use of `GActionMap` on the + * same @application or things will go very badly wrong. */ g_object_class_install_property (object_class, PROP_ACTION_GROUP, g_param_spec_object ("action-group", NULL, NULL, diff --git a/gio/gapplicationimpl-dbus.c b/gio/gapplicationimpl-dbus.c index b78ebe76a..056b462c5 100644 --- a/gio/gapplicationimpl-dbus.c +++ b/gio/gapplicationimpl-dbus.c @@ -32,6 +32,7 @@ #include "gdbusconnection.h" #include "gdbusintrospection.h" #include "gdbuserror.h" +#include "gdbusprivate.h" #include "glib/gstdio.h" #include <string.h> @@ -163,7 +164,7 @@ send_property_change (GApplicationImpl *impl) g_dbus_connection_emit_signal (impl->session_bus, NULL, impl->object_path, - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "PropertiesChanged", g_variant_new ("(sa{sv}as)", "org.gtk.Application", @@ -510,10 +511,10 @@ g_application_impl_attempt_primary (GApplicationImpl *impl, if (app_flags & G_APPLICATION_ALLOW_REPLACEMENT) { impl->name_lost_signal = g_dbus_connection_signal_subscribe (impl->session_bus, - "org.freedesktop.DBus", - "org.freedesktop.DBus", + DBUS_SERVICE_DBUS, + DBUS_INTERFACE_DBUS, "NameLost", - "/org/freedesktop/DBus", + DBUS_PATH_DBUS, impl->bus_name, G_DBUS_SIGNAL_FLAGS_NONE, name_lost, @@ -526,9 +527,9 @@ g_application_impl_attempt_primary (GApplicationImpl *impl, name_owner_flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE; reply = g_dbus_connection_call_sync (impl->session_bus, - "org.freedesktop.DBus", - "/org/freedesktop/DBus", - "org.freedesktop.DBus", + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "RequestName", g_variant_new ("(su)", impl->bus_name, name_owner_flags), G_VARIANT_TYPE ("(u)"), @@ -540,8 +541,7 @@ g_application_impl_attempt_primary (GApplicationImpl *impl, g_variant_get (reply, "(u)", &rval); g_variant_unref (reply); - /* DBUS_REQUEST_NAME_REPLY_EXISTS: 3 */ - impl->primary = (rval != 3); + impl->primary = (rval != DBUS_REQUEST_NAME_REPLY_EXISTS); if (!impl->primary && impl->name_lost_signal) { @@ -599,8 +599,8 @@ g_application_impl_stop_primary (GApplicationImpl *impl) if (impl->primary && impl->bus_name) { - g_dbus_connection_call (impl->session_bus, "org.freedesktop.DBus", - "/org/freedesktop/DBus", "org.freedesktop.DBus", + g_dbus_connection_call (impl->session_bus, DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "ReleaseName", g_variant_new ("(s)", impl->bus_name), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); impl->primary = FALSE; diff --git a/gio/gdbus-tool.c b/gio/gdbus-tool.c index 53e22ebdd..4755b09d7 100644 --- a/gio/gdbus-tool.c +++ b/gio/gdbus-tool.c @@ -37,9 +37,10 @@ #ifdef G_OS_WIN32 #include "glib/glib-private.h" -#include "gdbusprivate.h" #endif +#include "gdbusprivate.h" + /* ---------------------------------------------------------------------------------------------------- */ /* Escape values for console colors */ @@ -191,7 +192,7 @@ print_methods_and_signals (GDBusConnection *c, result = g_dbus_connection_call_sync (c, name, path, - "org.freedesktop.DBus.Introspectable", + DBUS_INTERFACE_INTROSPECTABLE, "Introspect", NULL, G_VARIANT_TYPE ("(s)"), @@ -263,7 +264,7 @@ print_paths (GDBusConnection *c, result = g_dbus_connection_call_sync (c, name, path, - "org.freedesktop.DBus.Introspectable", + DBUS_INTERFACE_INTROSPECTABLE, "Introspect", NULL, G_VARIANT_TYPE ("(s)"), @@ -332,9 +333,9 @@ print_names (GDBusConnection *c, error = NULL; result = g_dbus_connection_call_sync (c, - "org.freedesktop.DBus", - "/org/freedesktop/DBus", - "org.freedesktop.DBus", + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "ListNames", NULL, G_VARIANT_TYPE ("(as)"), @@ -356,9 +357,9 @@ print_names (GDBusConnection *c, error = NULL; result = g_dbus_connection_call_sync (c, - "org.freedesktop.DBus", - "/org/freedesktop/DBus", - "org.freedesktop.DBus", + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "ListActivatableNames", NULL, G_VARIANT_TYPE ("(as)"), @@ -501,7 +502,7 @@ call_helper_get_method_in_signature (GDBusConnection *c, result = g_dbus_connection_call_sync (c, dest, path, - "org.freedesktop.DBus.Introspectable", + DBUS_INTERFACE_INTROSPECTABLE, "Introspect", NULL, G_VARIANT_TYPE ("(s)"), @@ -1500,7 +1501,7 @@ dump_interface (GDBusConnection *c, result = g_dbus_connection_call_sync (c, name, object_path, - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "GetAll", g_variant_new ("(s)", o->name), NULL, @@ -1538,7 +1539,7 @@ dump_interface (GDBusConnection *c, result = g_dbus_connection_call_sync (c, name, object_path, - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "Get", g_variant_new ("(ss)", o->name, o->properties[n]->name), G_VARIANT_TYPE ("(v)"), @@ -1720,7 +1721,7 @@ introspect_do (GDBusConnection *c, result = g_dbus_connection_call_sync (c, opt_introspect_dest, object_path, - "org.freedesktop.DBus.Introspectable", + DBUS_INTERFACE_INTROSPECTABLE, "Introspect", NULL, G_VARIANT_TYPE ("(s)"), diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c index 72e58fd77..d2d98b14d 100644 --- a/gio/gdbusconnection.c +++ b/gio/gdbusconnection.c @@ -289,8 +289,8 @@ call_destroy_notify (GMainContext *context, typedef struct { - /* All fields are immutable after construction. */ gatomicrefcount ref_count; + /* All remaining fields are immutable after construction. */ GDBusSignalCallback callback; gpointer user_data; GDestroyNotify user_data_free_func; @@ -482,7 +482,7 @@ struct _GDBusConnection GMutex init_lock; /* Set (by loading the contents of /var/lib/dbus/machine-id) the first time - * someone calls org.freedesktop.DBus.Peer.GetMachineId(). Protected by @lock. + * someone calls DBUS_INTERFACE_PEER.GetMachineId(). Protected by @lock. */ gchar *machine_id; @@ -2418,7 +2418,7 @@ name_watcher_deliver_get_name_owner_reply_unlocked (SignalData *name_watcher, if (type == G_DBUS_MESSAGE_TYPE_ERROR) { if (g_strcmp0 (g_dbus_message_get_error_name (message), - "org.freedesktop.DBus.Error.NameHasNoOwner")) + DBUS_ERROR_NAME_HAS_NO_OWNER)) name_watcher_set_name_owner_unlocked (name_watcher, NULL); /* else it's something like NoReply or AccessDenied, which tells * us nothing - leave the owner set to whatever we most recently @@ -2972,9 +2972,9 @@ initable_init (GInitable *initable, } hello_result = g_dbus_connection_call_sync (connection, - "org.freedesktop.DBus", /* name */ - "/org/freedesktop/DBus", /* path */ - "org.freedesktop.DBus", /* interface */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "Hello", NULL, /* parameters */ G_VARIANT_TYPE ("(s)"), @@ -3655,9 +3655,9 @@ add_match_rule (GDBusConnection *connection, if (match_rule[0] == '-') return; - message = g_dbus_message_new_method_call ("org.freedesktop.DBus", /* name */ - "/org/freedesktop/DBus", /* path */ - "org.freedesktop.DBus", /* interface */ + message = g_dbus_message_new_method_call (DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "AddMatch"); g_dbus_message_set_body (message, g_variant_new ("(s)", match_rule)); error = NULL; @@ -3686,9 +3686,9 @@ remove_match_rule (GDBusConnection *connection, if (match_rule[0] == '-') return; - message = g_dbus_message_new_method_call ("org.freedesktop.DBus", /* name */ - "/org/freedesktop/DBus", /* path */ - "org.freedesktop.DBus", /* interface */ + message = g_dbus_message_new_method_call (DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "RemoveMatch"); g_dbus_message_set_body (message, g_variant_new ("(s)", match_rule)); @@ -3714,9 +3714,9 @@ remove_match_rule (GDBusConnection *connection, static gboolean is_signal_data_for_name_lost_or_acquired (SignalData *signal_data) { - return g_strcmp0 (signal_data->sender, "org.freedesktop.DBus") == 0 && - g_strcmp0 (signal_data->interface_name, "org.freedesktop.DBus") == 0 && - g_strcmp0 (signal_data->object_path, "/org/freedesktop/DBus") == 0 && + return g_strcmp0 (signal_data->sender, DBUS_SERVICE_DBUS) == 0 && + g_strcmp0 (signal_data->interface_name, DBUS_INTERFACE_DBUS) == 0 && + g_strcmp0 (signal_data->object_path, DBUS_PATH_DBUS) == 0 && (g_strcmp0 (signal_data->member, "NameLost") == 0 || g_strcmp0 (signal_data->member, "NameAcquired") == 0); } @@ -3885,7 +3885,7 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection, */ rule = args_to_rule (sender, interface_name, member, object_path, arg0, flags); - if (sender != NULL && (g_dbus_is_unique_name (sender) || g_strcmp0 (sender, "org.freedesktop.DBus") == 0)) + if (sender != NULL && (g_dbus_is_unique_name (sender) || g_strcmp0 (sender, DBUS_SERVICE_DBUS) == 0)) sender_is_its_own_owner = TRUE; else sender_is_its_own_owner = FALSE; @@ -4715,7 +4715,7 @@ invoke_get_property_in_idle_cb (gpointer _data) &es)) { reply = g_dbus_message_new_method_error (data->message, - "org.freedesktop.DBus.Error.UnknownMethod", + DBUS_ERROR_UNKNOWN_METHOD, _("No such interface “org.freedesktop.DBus.Properties” on object at path %s"), g_dbus_message_get_path (data->message)); g_dbus_connection_send_message (data->connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); @@ -4851,7 +4851,7 @@ validate_and_maybe_schedule_property_getset (GDBusConnection *connect if (vtable == NULL) goto out; - /* Check that the property exists - if not fail with org.freedesktop.DBus.Error.InvalidArgs + /* Check that the property exists - if not fail with DBUS_ERROR_INVALID_ARGS */ property_info = NULL; @@ -4860,7 +4860,7 @@ validate_and_maybe_schedule_property_getset (GDBusConnection *connect if (property_info == NULL) { reply = g_dbus_message_new_method_error (message, - "org.freedesktop.DBus.Error.InvalidArgs", + DBUS_ERROR_INVALID_ARGS, _("No such property “%s”"), property_name); g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); @@ -4872,7 +4872,7 @@ validate_and_maybe_schedule_property_getset (GDBusConnection *connect if (is_get && !(property_info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)) { reply = g_dbus_message_new_method_error (message, - "org.freedesktop.DBus.Error.InvalidArgs", + DBUS_ERROR_INVALID_ARGS, _("Property “%s” is not readable"), property_name); g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); @@ -4883,7 +4883,7 @@ validate_and_maybe_schedule_property_getset (GDBusConnection *connect else if (!is_get && !(property_info->flags & G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE)) { reply = g_dbus_message_new_method_error (message, - "org.freedesktop.DBus.Error.InvalidArgs", + DBUS_ERROR_INVALID_ARGS, _("Property “%s” is not writable"), property_name); g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); @@ -4896,14 +4896,14 @@ validate_and_maybe_schedule_property_getset (GDBusConnection *connect { GVariant *value; - /* Fail with org.freedesktop.DBus.Error.InvalidArgs if the type + /* Fail with DBUS_ERROR_INVALID_ARGS if the type * of the given value is wrong */ g_variant_get_child (g_dbus_message_get_body (message), 2, "v", &value); if (g_strcmp0 (g_variant_get_type_string (value), property_info->signature) != 0) { reply = g_dbus_message_new_method_error (message, - "org.freedesktop.DBus.Error.InvalidArgs", + DBUS_ERROR_INVALID_ARGS, _("Error setting property “%s”: Expected type “%s” but got “%s”"), property_name, property_info->signature, g_variant_get_type_string (value)); @@ -5000,7 +5000,7 @@ handle_getset_property (GDBusConnection *connection, &property_name, NULL); - /* Fail with org.freedesktop.DBus.Error.InvalidArgs if there is + /* Fail with DBUS_ERROR_INVALID_ARGS if there is * no such interface registered */ ei = g_hash_table_lookup (eo->map_if_name_to_ei, interface_name); @@ -5008,7 +5008,7 @@ handle_getset_property (GDBusConnection *connection, { GDBusMessage *reply; reply = g_dbus_message_new_method_error (message, - "org.freedesktop.DBus.Error.InvalidArgs", + DBUS_ERROR_INVALID_ARGS, _("No such interface “%s”"), interface_name); g_dbus_connection_send_message_unlocked (eo->connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); @@ -5069,7 +5069,7 @@ invoke_get_all_properties_in_idle_cb (gpointer _data) &es)) { reply = g_dbus_message_new_method_error (data->message, - "org.freedesktop.DBus.Error.UnknownMethod", + DBUS_ERROR_UNKNOWN_METHOD, _("No such interface “org.freedesktop.DBus.Properties” on object at path %s"), g_dbus_message_get_path (data->message)); g_dbus_connection_send_message (data->connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); @@ -5215,7 +5215,7 @@ handle_get_all_properties (GDBusConnection *connection, "(&s)", &interface_name); - /* Fail with org.freedesktop.DBus.Error.InvalidArgs if there is + /* Fail with DBUS_ERROR_INVALID_ARGS if there is * no such interface registered */ ei = g_hash_table_lookup (eo->map_if_name_to_ei, interface_name); @@ -5223,7 +5223,7 @@ handle_get_all_properties (GDBusConnection *connection, { GDBusMessage *reply; reply = g_dbus_message_new_method_error (message, - "org.freedesktop.DBus.Error.InvalidArgs", + DBUS_ERROR_INVALID_ARGS, _("No such interface “%s”"), interface_name); g_dbus_connection_send_message_unlocked (eo->connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); @@ -5256,7 +5256,7 @@ static const gchar introspect_tail[] = "</node>\n"; static const gchar introspect_properties_interface[] = - " <interface name=\"org.freedesktop.DBus.Properties\">\n" + " <interface name=\"" DBUS_INTERFACE_PROPERTIES "\">\n" " <method name=\"Get\">\n" " <arg type=\"s\" name=\"interface_name\" direction=\"in\"/>\n" " <arg type=\"s\" name=\"property_name\" direction=\"in\"/>\n" @@ -5279,12 +5279,12 @@ static const gchar introspect_properties_interface[] = " </interface>\n"; static const gchar introspect_introspectable_interface[] = - " <interface name=\"org.freedesktop.DBus.Introspectable\">\n" + " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">\n" " <method name=\"Introspect\">\n" " <arg type=\"s\" name=\"xml_data\" direction=\"out\"/>\n" " </method>\n" " </interface>\n" - " <interface name=\"org.freedesktop.DBus.Peer\">\n" + " <interface name=\"" DBUS_INTERFACE_PEER "\">\n" " <method name=\"Ping\"/>\n" " <method name=\"GetMachineId\">\n" " <arg type=\"s\" name=\"machine_uuid\" direction=\"out\"/>\n" @@ -5389,11 +5389,11 @@ handle_introspect (GDBusConnection *connection, sizeof (introspect_tail)); introspect_append_header (s); if (!g_hash_table_lookup (eo->map_if_name_to_ei, - "org.freedesktop.DBus.Properties")) + DBUS_INTERFACE_PROPERTIES)) g_string_append (s, introspect_properties_interface); if (!g_hash_table_lookup (eo->map_if_name_to_ei, - "org.freedesktop.DBus.Introspectable")) + DBUS_INTERFACE_INTROSPECTABLE)) g_string_append (s, introspect_introspectable_interface); /* then include the registered interfaces */ @@ -5439,7 +5439,7 @@ call_in_idle_cb (gpointer user_data) { GDBusMessage *reply; reply = g_dbus_message_new_method_error (g_dbus_method_invocation_get_message (invocation), - "org.freedesktop.DBus.Error.UnknownMethod", + DBUS_ERROR_UNKNOWN_METHOD, _("No such interface “%s” on object at path %s"), g_dbus_method_invocation_get_interface_name (invocation), g_dbus_method_invocation_get_object_path (invocation)); @@ -5534,13 +5534,13 @@ validate_and_maybe_schedule_method_call (GDBusConnection *connection, /* TODO: the cost of this is O(n) - it might be worth caching the result */ method_info = g_dbus_interface_info_lookup_method (interface_info, g_dbus_message_get_member (message)); - /* if the method doesn't exist, return the org.freedesktop.DBus.Error.UnknownMethod + /* if the method doesn't exist, return the DBUS_ERROR_UNKNOWN_METHOD * error to the caller */ if (method_info == NULL) { reply = g_dbus_message_new_method_error (message, - "org.freedesktop.DBus.Error.UnknownMethod", + DBUS_ERROR_UNKNOWN_METHOD, _("No such method “%s”"), g_dbus_message_get_member (message)); g_dbus_connection_send_message_unlocked (connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); @@ -5561,7 +5561,7 @@ validate_and_maybe_schedule_method_call (GDBusConnection *connection, } /* Check that the incoming args are of the right type - if they are not, return - * the org.freedesktop.DBus.Error.InvalidArgs error to the caller + * the DBUS_ERROR_INVALID_ARGS error to the caller */ in_type = _g_dbus_compute_complete_signature (method_info->in_args); if (!g_variant_is_of_type (parameters, in_type)) @@ -5571,7 +5571,7 @@ validate_and_maybe_schedule_method_call (GDBusConnection *connection, type_string = g_variant_type_dup_string (in_type); reply = g_dbus_message_new_method_error (message, - "org.freedesktop.DBus.Error.InvalidArgs", + DBUS_ERROR_INVALID_ARGS, _("Type of message, “%s”, does not match expected type “%s”"), g_variant_get_type_string (parameters), type_string); @@ -5645,28 +5645,28 @@ obj_message_func (GDBusConnection *connection, } } - if (g_strcmp0 (interface_name, "org.freedesktop.DBus.Introspectable") == 0 && + if (g_strcmp0 (interface_name, DBUS_INTERFACE_INTROSPECTABLE) == 0 && g_strcmp0 (member, "Introspect") == 0 && g_strcmp0 (signature, "") == 0) { handled = handle_introspect (connection, eo, message); goto out; } - else if (g_strcmp0 (interface_name, "org.freedesktop.DBus.Properties") == 0 && + else if (g_strcmp0 (interface_name, DBUS_INTERFACE_PROPERTIES) == 0 && g_strcmp0 (member, "Get") == 0 && g_strcmp0 (signature, "ss") == 0) { handled = handle_getset_property (connection, eo, message, TRUE); goto out; } - else if (g_strcmp0 (interface_name, "org.freedesktop.DBus.Properties") == 0 && + else if (g_strcmp0 (interface_name, DBUS_INTERFACE_PROPERTIES) == 0 && g_strcmp0 (member, "Set") == 0 && g_strcmp0 (signature, "ssv") == 0) { handled = handle_getset_property (connection, eo, message, FALSE); goto out; } - else if (g_strcmp0 (interface_name, "org.freedesktop.DBus.Properties") == 0 && + else if (g_strcmp0 (interface_name, DBUS_INTERFACE_PROPERTIES) == 0 && g_strcmp0 (member, "GetAll") == 0 && g_strcmp0 (signature, "s") == 0) { @@ -7011,9 +7011,9 @@ handle_subtree_introspect (GDBusConnection *connection, for (n = 0; interfaces[n] != NULL; n++) { - if (strcmp (interfaces[n]->name, "org.freedesktop.DBus.Properties") == 0) + if (strcmp (interfaces[n]->name, DBUS_INTERFACE_PROPERTIES) == 0) has_properties_interface = TRUE; - else if (strcmp (interfaces[n]->name, "org.freedesktop.DBus.Introspectable") == 0) + else if (strcmp (interfaces[n]->name, DBUS_INTERFACE_INTROSPECTABLE) == 0) has_introspectable_interface = TRUE; } if (!has_properties_interface) @@ -7095,7 +7095,7 @@ handle_subtree_method_invocation (GDBusConnection *connection, is_property_get = FALSE; is_property_set = FALSE; is_property_get_all = FALSE; - if (g_strcmp0 (interface_name, "org.freedesktop.DBus.Properties") == 0) + if (g_strcmp0 (interface_name, DBUS_INTERFACE_PROPERTIES) == 0) { if (g_strcmp0 (member, "Get") == 0 && g_strcmp0 (signature, "ss") == 0) is_property_get = TRUE; @@ -7177,7 +7177,7 @@ handle_subtree_method_invocation (GDBusConnection *connection, interface_user_data); CONNECTION_UNLOCK (connection); } - /* handle org.freedesktop.DBus.Properties interface if not explicitly handled */ + /* handle DBUS_INTERFACE_PROPERTIES if not explicitly handled */ else if (is_property_get || is_property_set || is_property_get_all) { if (is_property_get) @@ -7196,14 +7196,14 @@ handle_subtree_method_invocation (GDBusConnection *connection, interface_info = interfaces[n]; } - /* Fail with org.freedesktop.DBus.Error.InvalidArgs if the user-code + /* Fail with DBUS_ERROR_INVALID_ARGS if the user-code * claims it won't support the interface */ if (interface_info == NULL) { GDBusMessage *reply; reply = g_dbus_message_new_method_error (message, - "org.freedesktop.DBus.Error.InvalidArgs", + DBUS_ERROR_INVALID_ARGS, _("No such interface “%s”"), interface_name); g_dbus_connection_send_message (es->connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); @@ -7292,7 +7292,7 @@ process_subtree_vtable_message_in_idle_cb (gpointer _data) handled = FALSE; - if (g_strcmp0 (g_dbus_message_get_interface (data->message), "org.freedesktop.DBus.Introspectable") == 0 && + if (g_strcmp0 (g_dbus_message_get_interface (data->message), DBUS_INTERFACE_INTROSPECTABLE) == 0 && g_strcmp0 (g_dbus_message_get_member (data->message), "Introspect") == 0 && g_strcmp0 (g_dbus_message_get_signature (data->message), "") == 0) handled = handle_subtree_introspect (data->es->connection, @@ -7315,7 +7315,7 @@ process_subtree_vtable_message_in_idle_cb (gpointer _data) { GDBusMessage *reply; reply = g_dbus_message_new_method_error (data->message, - "org.freedesktop.DBus.Error.UnknownMethod", + DBUS_ERROR_UNKNOWN_METHOD, _("Method “%s” on interface “%s” with signature “%s” does not exist"), g_dbus_message_get_member (data->message), g_dbus_message_get_interface (data->message), @@ -7546,7 +7546,7 @@ handle_generic_get_machine_id_unlocked (GDBusConnection *connection, if (connection->machine_id == NULL) { reply = g_dbus_message_new_method_error_literal (message, - "org.freedesktop.DBus.Error.Failed", + DBUS_ERROR_FAILED, error->message); g_error_free (error); } @@ -7609,21 +7609,21 @@ handle_generic_unlocked (GDBusConnection *connection, signature = g_dbus_message_get_signature (message); path = g_dbus_message_get_path (message); - if (g_strcmp0 (interface_name, "org.freedesktop.DBus.Introspectable") == 0 && + if (g_strcmp0 (interface_name, DBUS_INTERFACE_INTROSPECTABLE) == 0 && g_strcmp0 (member, "Introspect") == 0 && g_strcmp0 (signature, "") == 0) { handle_generic_introspect_unlocked (connection, path, message); handled = TRUE; } - else if (g_strcmp0 (interface_name, "org.freedesktop.DBus.Peer") == 0 && + else if (g_strcmp0 (interface_name, DBUS_INTERFACE_PEER) == 0 && g_strcmp0 (member, "Ping") == 0 && g_strcmp0 (signature, "") == 0) { handle_generic_ping_unlocked (connection, path, message); handled = TRUE; } - else if (g_strcmp0 (interface_name, "org.freedesktop.DBus.Peer") == 0 && + else if (g_strcmp0 (interface_name, DBUS_INTERFACE_PEER) == 0 && g_strcmp0 (member, "GetMachineId") == 0 && g_strcmp0 (signature, "") == 0) { @@ -7723,7 +7723,7 @@ distribute_method_call (GDBusConnection *connection, if (object_found == TRUE) { reply = g_dbus_message_new_method_error (message, - "org.freedesktop.DBus.Error.UnknownMethod", + DBUS_ERROR_UNKNOWN_METHOD, _("No such interface “%s” on object at path %s"), interface_name, path); @@ -7731,7 +7731,7 @@ distribute_method_call (GDBusConnection *connection, else { reply = g_dbus_message_new_method_error (message, - "org.freedesktop.DBus.Error.UnknownMethod", + DBUS_ERROR_UNKNOWN_METHOD, _("Object does not exist at path “%s”"), path); } diff --git a/gio/gdbusdaemon.c b/gio/gdbusdaemon.c index 948dd803e..2d04abcbb 100644 --- a/gio/gdbusdaemon.c +++ b/gio/gdbusdaemon.c @@ -28,32 +28,11 @@ #include <gio/gio.h> #include <gio/gunixsocketaddress.h> #include "gdbusdaemon.h" +#include "gdbusprivate.h" #include "glibintl.h" #include "gdbus-daemon-generated.h" -#define DBUS_SERVICE_NAME "org.freedesktop.DBus" - -/* Owner flags */ -#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT 0x1 /**< Allow another service to become the primary owner if requested */ -#define DBUS_NAME_FLAG_REPLACE_EXISTING 0x2 /**< Request to replace the current primary owner */ -#define DBUS_NAME_FLAG_DO_NOT_QUEUE 0x4 /**< If we can not become the primary owner do not place us in the queue */ - -/* Replies to request for a name */ -#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1 /**< Service has become the primary owner of the requested name */ -#define DBUS_REQUEST_NAME_REPLY_IN_QUEUE 2 /**< Service could not become the primary owner and has been placed in the queue */ -#define DBUS_REQUEST_NAME_REPLY_EXISTS 3 /**< Service is already in the queue */ -#define DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4 /**< Service is already the primary owner */ - -/* Replies to releasing a name */ -#define DBUS_RELEASE_NAME_REPLY_RELEASED 1 /**< Service was released from the given name */ -#define DBUS_RELEASE_NAME_REPLY_NON_EXISTENT 2 /**< The given name does not exist on the bus */ -#define DBUS_RELEASE_NAME_REPLY_NOT_OWNER 3 /**< Service is not an owner of the given name */ - -/* Replies to service starts */ -#define DBUS_START_REPLY_SUCCESS 1 /**< Service was auto started */ -#define DBUS_START_REPLY_ALREADY_RUNNING 2 /**< Service was already running */ - #define IDLE_TIMEOUT_MSEC 3000 struct _GDBusDaemon @@ -576,7 +555,7 @@ match_matches (GDBusDaemon *daemon, check_type = CHECK_TYPE_NAME; value = g_dbus_message_get_sender (message); if (value == NULL) - value = DBUS_SERVICE_NAME; + value = DBUS_SERVICE_DBUS; break; case MATCH_ELEMENT_DESTINATION: check_type = CHECK_TYPE_NAME; @@ -718,8 +697,8 @@ send_name_owner_changed (GDBusDaemon *daemon, { GDBusMessage *signal_message; - signal_message = g_dbus_message_new_signal ("/org/freedesktop/DBus", - "org.freedesktop.DBus", + signal_message = g_dbus_message_new_signal (DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "NameOwnerChanged"); g_dbus_message_set_body (signal_message, g_variant_new ("(sss)", @@ -774,8 +753,8 @@ name_replace_owner (Name *name, NameOwner *owner) g_assert (old_owner->client != new_client); g_dbus_connection_emit_signal (old_client->connection, - NULL, "/org/freedesktop/DBus", - "org.freedesktop.DBus", "NameLost", + NULL, DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "NameLost", g_variant_new ("(s)", name->name), NULL); @@ -797,8 +776,8 @@ name_replace_owner (Name *name, NameOwner *owner) new_name = new_client->id; g_dbus_connection_emit_signal (new_client->connection, - NULL, "/org/freedesktop/DBus", - "org.freedesktop.DBus", "NameAcquired", + NULL, DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "NameAcquired", g_variant_new ("(s)", name->name), NULL); } @@ -875,7 +854,7 @@ client_new (GDBusDaemon *daemon, GDBusConnection *connection) g_hash_table_insert (daemon->clients, client->id, client); g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (daemon), connection, - "/org/freedesktop/DBus", &error); + DBUS_PATH_DBUS, &error); g_assert_no_error (error); g_signal_connect (connection, "closed", G_CALLBACK (connection_closed), client); @@ -1035,9 +1014,9 @@ handle_get_name_owner (_GFreedesktopDBus *object, GDBusDaemon *daemon = G_DBUS_DAEMON (object); Name *name; - if (strcmp (arg_name, DBUS_SERVICE_NAME) == 0) + if (strcmp (arg_name, DBUS_SERVICE_DBUS) == 0) { - _g_freedesktop_dbus_complete_get_name_owner (object, invocation, DBUS_SERVICE_NAME); + _g_freedesktop_dbus_complete_get_name_owner (object, invocation, DBUS_SERVICE_DBUS); return TRUE; } @@ -1073,8 +1052,8 @@ handle_hello (_GFreedesktopDBus *object, _g_freedesktop_dbus_complete_hello (object, invocation, client->id); g_dbus_connection_emit_signal (client->connection, - NULL, "/org/freedesktop/DBus", - "org.freedesktop.DBus", "NameAcquired", + NULL, DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "NameAcquired", g_variant_new ("(s)", client->id), NULL); @@ -1191,11 +1170,11 @@ handle_release_name (_GFreedesktopDBus *object, return TRUE; } - if (strcmp (arg_name, DBUS_SERVICE_NAME) == 0) + if (strcmp (arg_name, DBUS_SERVICE_DBUS) == 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, - "Cannot release a service named " DBUS_SERVICE_NAME ", because that is owned by the bus"); + "Cannot release a service named " DBUS_SERVICE_DBUS ", because that is owned by the bus"); return TRUE; } @@ -1305,11 +1284,11 @@ handle_request_name (_GFreedesktopDBus *object, return TRUE; } - if (strcmp (arg_name, DBUS_SERVICE_NAME) == 0) + if (strcmp (arg_name, DBUS_SERVICE_DBUS) == 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, - "Cannot acquire a service named " DBUS_SERVICE_NAME ", because that is reserved"); + "Cannot acquire a service named " DBUS_SERVICE_DBUS ", because that is reserved"); return TRUE; } @@ -1425,7 +1404,7 @@ route_message (Client *source_client, GDBusMessage *message) dest_client = NULL; dest = g_dbus_message_get_destination (message); - if (dest != NULL && strcmp (dest, DBUS_SERVICE_NAME) != 0) + if (dest != NULL && strcmp (dest, DBUS_SERVICE_DBUS) != 0) { dest_client = g_hash_table_lookup (daemon->clients, dest); @@ -1459,7 +1438,7 @@ route_message (Client *source_client, GDBusMessage *message) broadcast_message (daemon, message, dest_client != NULL, TRUE, dest_client); /* Swallow messages not for the bus */ - if (dest == NULL || strcmp (dest, DBUS_SERVICE_NAME) != 0) + if (dest == NULL || strcmp (dest, DBUS_SERVICE_DBUS) != 0) { g_object_unref (message); message = NULL; @@ -1531,7 +1510,7 @@ filter_function (GDBusConnection *connection, } if (g_dbus_message_get_sender (message) == NULL) - g_dbus_message_set_sender (message, DBUS_SERVICE_NAME); + g_dbus_message_set_sender (message, DBUS_SERVICE_DBUS); if (g_dbus_message_get_destination (message) == NULL) g_dbus_message_set_destination (message, client->id); } diff --git a/gio/gdbuserror.c b/gio/gdbuserror.c index 432b24c12..cb8521102 100644 --- a/gio/gdbuserror.c +++ b/gio/gdbuserror.c @@ -35,10 +35,10 @@ static const GDBusErrorEntry g_dbus_error_entries[] = { - {G_DBUS_ERROR_FAILED, "org.freedesktop.DBus.Error.Failed"}, + {G_DBUS_ERROR_FAILED, DBUS_ERROR_FAILED}, {G_DBUS_ERROR_NO_MEMORY, "org.freedesktop.DBus.Error.NoMemory"}, {G_DBUS_ERROR_SERVICE_UNKNOWN, "org.freedesktop.DBus.Error.ServiceUnknown"}, - {G_DBUS_ERROR_NAME_HAS_NO_OWNER, "org.freedesktop.DBus.Error.NameHasNoOwner"}, + {G_DBUS_ERROR_NAME_HAS_NO_OWNER, DBUS_ERROR_NAME_HAS_NO_OWNER}, {G_DBUS_ERROR_NO_REPLY, "org.freedesktop.DBus.Error.NoReply"}, {G_DBUS_ERROR_IO_ERROR, "org.freedesktop.DBus.Error.IOError"}, {G_DBUS_ERROR_BAD_ADDRESS, "org.freedesktop.DBus.Error.BadAddress"}, @@ -51,10 +51,10 @@ static const GDBusErrorEntry g_dbus_error_entries[] = {G_DBUS_ERROR_NO_NETWORK, "org.freedesktop.DBus.Error.NoNetwork"}, {G_DBUS_ERROR_ADDRESS_IN_USE, "org.freedesktop.DBus.Error.AddressInUse"}, {G_DBUS_ERROR_DISCONNECTED, "org.freedesktop.DBus.Error.Disconnected"}, - {G_DBUS_ERROR_INVALID_ARGS, "org.freedesktop.DBus.Error.InvalidArgs"}, + {G_DBUS_ERROR_INVALID_ARGS, DBUS_ERROR_INVALID_ARGS}, {G_DBUS_ERROR_FILE_NOT_FOUND, "org.freedesktop.DBus.Error.FileNotFound"}, {G_DBUS_ERROR_FILE_EXISTS, "org.freedesktop.DBus.Error.FileExists"}, - {G_DBUS_ERROR_UNKNOWN_METHOD, "org.freedesktop.DBus.Error.UnknownMethod"}, + {G_DBUS_ERROR_UNKNOWN_METHOD, DBUS_ERROR_UNKNOWN_METHOD}, {G_DBUS_ERROR_TIMED_OUT, "org.freedesktop.DBus.Error.TimedOut"}, {G_DBUS_ERROR_MATCH_RULE_NOT_FOUND, "org.freedesktop.DBus.Error.MatchRuleNotFound"}, {G_DBUS_ERROR_MATCH_RULE_INVALID, "org.freedesktop.DBus.Error.MatchRuleInvalid"}, diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c index 331e68d45..94b241ee2 100644 --- a/gio/gdbusmessage.c +++ b/gio/gdbusmessage.c @@ -1416,7 +1416,7 @@ validate_headers (GDBusMessage *message, case G_DBUS_MESSAGE_HEADER_FIELD_PATH: if (!validate_header (message, field_type, header_value, G_VARIANT_TYPE_OBJECT_PATH, error)) goto out; - if (g_strcmp0 (g_variant_get_string (header_value, NULL), "/org/freedesktop/DBus/Local") == 0) + if (g_strcmp0 (g_variant_get_string (header_value, NULL), DBUS_PATH_LOCAL) == 0) { g_set_error (error, G_IO_ERROR, @@ -1438,7 +1438,7 @@ validate_headers (GDBusMessage *message, message_type_to_string (message->type)); goto out; } - if (g_strcmp0 (g_variant_get_string (header_value, NULL), "org.freedesktop.DBus.Local") == 0) + if (g_strcmp0 (g_variant_get_string (header_value, NULL), DBUS_INTERFACE_LOCAL) == 0) { g_set_error (error, G_IO_ERROR, diff --git a/gio/gdbusmethodinvocation.c b/gio/gdbusmethodinvocation.c index 00a6de26e..2e4f0d679 100644 --- a/gio/gdbusmethodinvocation.c +++ b/gio/gdbusmethodinvocation.c @@ -464,7 +464,7 @@ g_dbus_method_invocation_return_value_internal (GDBusMethodInvocation *invocatio else g_assert_not_reached (); } - else if (g_str_equal (invocation->interface_name, "org.freedesktop.DBus.Properties") && + else if (g_str_equal (invocation->interface_name, DBUS_INTERFACE_PROPERTIES) && g_str_equal (invocation->method_name, "GetAll")) { if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(a{sv})"))) diff --git a/gio/gdbusnameowning.c b/gio/gdbusnameowning.c index 40feba2fd..654681928 100644 --- a/gio/gdbusnameowning.c +++ b/gio/gdbusnameowning.c @@ -258,9 +258,9 @@ on_name_lost_or_acquired (GDBusConnection *connection, Client *client = user_data; const gchar *name; - if (g_strcmp0 (object_path, "/org/freedesktop/DBus") != 0 || - g_strcmp0 (interface_name, "org.freedesktop.DBus") != 0 || - g_strcmp0 (sender_name, "org.freedesktop.DBus") != 0) + if (g_strcmp0 (object_path, DBUS_PATH_DBUS) != 0 || + g_strcmp0 (interface_name, DBUS_INTERFACE_DBUS) != 0 || + g_strcmp0 (sender_name, DBUS_SERVICE_DBUS) != 0) goto out; if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(s)"))) @@ -319,20 +319,20 @@ request_name_cb (GObject *source_object, switch (request_name_reply) { - case 1: /* DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER */ + case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER: /* We got the name - now listen for NameLost and NameAcquired */ call_acquired_handler (client); break; - case 2: /* DBUS_REQUEST_NAME_REPLY_IN_QUEUE */ + case DBUS_REQUEST_NAME_REPLY_IN_QUEUE: /* Waiting in line - listen for NameLost and NameAcquired */ call_lost_handler (client); break; default: /* assume we couldn't get the name - explicit fallthrough */ - case 3: /* DBUS_REQUEST_NAME_REPLY_EXISTS */ - case 4: /* DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER */ + case DBUS_REQUEST_NAME_REPLY_EXISTS: + case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER: /* Some other part of the process is already owning the name */ call_lost_handler (client); unsubscribe = TRUE; @@ -419,10 +419,10 @@ has_connection (Client *client) * ensure that the user callbacks get called an appropriate number of times. */ client->name_lost_subscription_id = g_dbus_connection_signal_subscribe (client->connection, - "org.freedesktop.DBus", - "org.freedesktop.DBus", + DBUS_SERVICE_DBUS, + DBUS_INTERFACE_DBUS, "NameLost", - "/org/freedesktop/DBus", + DBUS_PATH_DBUS, client->name, G_DBUS_SIGNAL_FLAGS_NONE, on_name_lost_or_acquired, @@ -430,10 +430,10 @@ has_connection (Client *client) (GDestroyNotify) client_unref); client->name_acquired_subscription_id = g_dbus_connection_signal_subscribe (client->connection, - "org.freedesktop.DBus", - "org.freedesktop.DBus", + DBUS_SERVICE_DBUS, + DBUS_INTERFACE_DBUS, "NameAcquired", - "/org/freedesktop/DBus", + DBUS_PATH_DBUS, client->name, G_DBUS_SIGNAL_FLAGS_NONE, on_name_lost_or_acquired, @@ -443,9 +443,9 @@ has_connection (Client *client) /* attempt to acquire the name */ client->needs_release = TRUE; g_dbus_connection_call (client->connection, - "org.freedesktop.DBus", /* bus name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "RequestName", /* method name */ g_variant_new ("(su)", client->name, @@ -936,9 +936,9 @@ g_bus_unown_name (guint owner_id) */ error = NULL; result = g_dbus_connection_call_sync (client->connection, - "org.freedesktop.DBus", /* bus name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "ReleaseName", /* method name */ g_variant_new ("(s)", client->name), G_VARIANT_TYPE ("(u)"), @@ -954,7 +954,7 @@ g_bus_unown_name (guint owner_id) else { g_variant_get (result, "(u)", &release_name_reply); - if (release_name_reply != 1 /* DBUS_RELEASE_NAME_REPLY_RELEASED */) + if (release_name_reply != DBUS_RELEASE_NAME_REPLY_RELEASED) { g_warning ("Unexpected reply %d when releasing name %s", release_name_reply, client->name); } diff --git a/gio/gdbusnamewatching.c b/gio/gdbusnamewatching.c index c86051c72..31b798a16 100644 --- a/gio/gdbusnamewatching.c +++ b/gio/gdbusnamewatching.c @@ -344,9 +344,9 @@ on_name_owner_changed (GDBusConnection *connection, if (!client->initialized) goto out; - if (g_strcmp0 (object_path, "/org/freedesktop/DBus") != 0 || - g_strcmp0 (interface_name, "org.freedesktop.DBus") != 0 || - g_strcmp0 (sender_name, "org.freedesktop.DBus") != 0) + if (g_strcmp0 (object_path, DBUS_PATH_DBUS) != 0 || + g_strcmp0 (interface_name, DBUS_INTERFACE_DBUS) != 0 || + g_strcmp0 (sender_name, DBUS_SERVICE_DBUS) != 0) goto out; g_variant_get (parameters, @@ -424,9 +424,9 @@ static void invoke_get_name_owner (Client *client) { g_dbus_connection_call (client->connection, - "org.freedesktop.DBus", /* bus name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetNameOwner", /* method name */ g_variant_new ("(s)", client->name), G_VARIANT_TYPE ("(s)"), @@ -457,11 +457,11 @@ start_service_by_name_cb (GObject *source_object, guint32 start_service_result; g_variant_get (result, "(u)", &start_service_result); - if (start_service_result == 1) /* DBUS_START_REPLY_SUCCESS */ + if (start_service_result == DBUS_START_REPLY_SUCCESS) { invoke_get_name_owner (client); } - else if (start_service_result == 2) /* DBUS_START_REPLY_ALREADY_RUNNING */ + else if (start_service_result == DBUS_START_REPLY_ALREADY_RUNNING) { invoke_get_name_owner (client); } @@ -504,10 +504,10 @@ has_connection (Client *client) /* start listening to NameOwnerChanged messages immediately */ client->name_owner_changed_subscription_id = g_dbus_connection_signal_subscribe (client->connection, - "org.freedesktop.DBus", /* name */ - "org.freedesktop.DBus", /* if */ + DBUS_SERVICE_DBUS, + DBUS_INTERFACE_DBUS, "NameOwnerChanged", /* signal */ - "/org/freedesktop/DBus", /* path */ + DBUS_PATH_DBUS, client->name, G_DBUS_SIGNAL_FLAGS_NONE, on_name_owner_changed, @@ -517,9 +517,9 @@ has_connection (Client *client) if (client->flags & G_BUS_NAME_WATCHER_FLAGS_AUTO_START) { g_dbus_connection_call (client->connection, - "org.freedesktop.DBus", /* bus name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "StartServiceByName", /* method name */ g_variant_new ("(su)", client->name, 0), G_VARIANT_TYPE ("(u)"), diff --git a/gio/gdbusobjectmanagerclient.c b/gio/gdbusobjectmanagerclient.c index cb35d0669..149824cc7 100644 --- a/gio/gdbusobjectmanagerclient.c +++ b/gio/gdbusobjectmanagerclient.c @@ -1026,7 +1026,7 @@ signal_cb (GDBusConnection *connection, //g_debug ("yay, signal_cb %s %s: %s\n", signal_name, object_path, g_variant_print (parameters, TRUE)); g_object_ref (manager); - if (g_strcmp0 (interface_name, "org.freedesktop.DBus.Properties") == 0) + if (g_strcmp0 (interface_name, DBUS_INTERFACE_PROPERTIES) == 0) { if (g_strcmp0 (signal_name, "PropertiesChanged") == 0) { @@ -1145,9 +1145,9 @@ subscribe_signals (GDBusObjectManagerClient *manager, /* The bus daemon may not implement path_namespace so gracefully * handle this by using a fallback triggered if @error is set. */ ret = g_dbus_connection_call_sync (manager->priv->connection, - "org.freedesktop.DBus", - "/org/freedesktop/DBus", - "org.freedesktop.DBus", + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "AddMatch", g_variant_new ("(s)", manager->priv->match_rule), @@ -1230,9 +1230,9 @@ maybe_unsubscribe_signals (GDBusObjectManagerClient *manager) * fail - therefore, don't bother checking the return value */ g_dbus_connection_call (manager->priv->connection, - "org.freedesktop.DBus", - "/org/freedesktop/DBus", - "org.freedesktop.DBus", + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "RemoveMatch", g_variant_new ("(s)", manager->priv->match_rule), @@ -1419,7 +1419,7 @@ initable_init (GInitable *initable, NULL, /* GDBusInterfaceInfo* */ manager->priv->name, manager->priv->object_path, - "org.freedesktop.DBus.ObjectManager", + DBUS_INTERFACE_OBJECT_MANAGER, cancellable, error); if (manager->priv->control_proxy == NULL) diff --git a/gio/gdbusobjectmanagerserver.c b/gio/gdbusobjectmanagerserver.c index bbc390fec..94668c72c 100644 --- a/gio/gdbusobjectmanagerserver.c +++ b/gio/gdbusobjectmanagerserver.c @@ -34,6 +34,8 @@ #include "gioerror.h" +#include "gdbusprivate.h" + #include "glibintl.h" /** @@ -841,7 +843,7 @@ static const GDBusMethodInfo * const manager_method_info_pointers[] = static const GDBusInterfaceInfo manager_interface_info = { -1, - "org.freedesktop.DBus.ObjectManager", + DBUS_INTERFACE_OBJECT_MANAGER, (GDBusMethodInfo **) manager_method_info_pointers, (GDBusSignalInfo **) manager_signal_info_pointers, (GDBusPropertyInfo **) NULL, diff --git a/gio/gdbusprivate.h b/gio/gdbusprivate.h index 57147e172..f7910f63c 100644 --- a/gio/gdbusprivate.h +++ b/gio/gdbusprivate.h @@ -32,6 +32,42 @@ G_BEGIN_DECLS #define DBUS_INTERFACE_DBUS DBUS_SERVICE_DBUS #define DBUS_PATH_DBUS "/org/freedesktop/DBus" +/* Reserved by the specification for locally-generated messages */ +#define DBUS_INTERFACE_LOCAL "org.freedesktop.DBus.Local" +#define DBUS_PATH_LOCAL "/org/freedesktop/DBus/Local" + +/* Other well-known D-Bus interfaces from the specification */ +#define DBUS_INTERFACE_INTROSPECTABLE "org.freedesktop.DBus.Introspectable" +#define DBUS_INTERFACE_OBJECT_MANAGER "org.freedesktop.DBus.ObjectManager" +#define DBUS_INTERFACE_PEER "org.freedesktop.DBus.Peer" +#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties" + +/* Frequently-used D-Bus error names */ +#define DBUS_ERROR_FAILED "org.freedesktop.DBus.Error.Failed" +#define DBUS_ERROR_INVALID_ARGS "org.freedesktop.DBus.Error.InvalidArgs" +#define DBUS_ERROR_NAME_HAS_NO_OWNER "org.freedesktop.DBus.Error.NameHasNoOwner" +#define DBUS_ERROR_UNKNOWN_METHOD "org.freedesktop.DBus.Error.UnknownMethod" + +/* Owner flags */ +#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT 0x1 /**< Allow another service to become the primary owner if requested */ +#define DBUS_NAME_FLAG_REPLACE_EXISTING 0x2 /**< Request to replace the current primary owner */ +#define DBUS_NAME_FLAG_DO_NOT_QUEUE 0x4 /**< If we can not become the primary owner do not place us in the queue */ + +/* Replies to request for a name */ +#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1 /**< Service has become the primary owner of the requested name */ +#define DBUS_REQUEST_NAME_REPLY_IN_QUEUE 2 /**< Service could not become the primary owner and has been placed in the queue */ +#define DBUS_REQUEST_NAME_REPLY_EXISTS 3 /**< Service is already in the queue */ +#define DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4 /**< Service is already the primary owner */ + +/* Replies to releasing a name */ +#define DBUS_RELEASE_NAME_REPLY_RELEASED 1 /**< Service was released from the given name */ +#define DBUS_RELEASE_NAME_REPLY_NON_EXISTENT 2 /**< The given name does not exist on the bus */ +#define DBUS_RELEASE_NAME_REPLY_NOT_OWNER 3 /**< Service is not an owner of the given name */ + +/* Replies to service starts */ +#define DBUS_START_REPLY_SUCCESS 1 /**< Service was auto started */ +#define DBUS_START_REPLY_ALREADY_RUNNING 2 /**< Service was already running */ + /* ---------------------------------------------------------------------------------------------------- */ typedef struct GDBusWorker GDBusWorker; diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c index 5d9a637c3..c1d6e4bde 100644 --- a/gio/gdbusproxy.c +++ b/gio/gdbusproxy.c @@ -1058,7 +1058,7 @@ on_properties_changed (GDBusConnection *connection, g_dbus_connection_call (proxy->priv->connection, proxy->priv->name_owner, proxy->priv->object_path, - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "Get", g_variant_new ("(ss)", proxy->priv->interface_name, data->prop_name), G_VARIANT_TYPE ("(v)"), @@ -1330,7 +1330,7 @@ on_name_owner_changed (GDBusConnection *connection, g_dbus_connection_call (proxy->priv->connection, data->name_owner, proxy->priv->object_path, - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "GetAll", g_variant_new ("(s)", proxy->priv->interface_name), G_VARIANT_TYPE ("(a{sv})"), @@ -1424,7 +1424,7 @@ async_init_data_set_name_owner (GTask *task, g_dbus_connection_call (proxy->priv->connection, name_owner, proxy->priv->object_path, - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "GetAll", g_variant_new ("(s)", proxy->priv->interface_name), G_VARIANT_TYPE ("(a{sv})"), @@ -1485,9 +1485,9 @@ async_init_call_get_name_owner (GTask *task) GDBusProxy *proxy = g_task_get_source_object (task); g_dbus_connection_call (proxy->priv->connection, - "org.freedesktop.DBus", /* name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetNameOwner", g_variant_new ("(s)", proxy->priv->name), @@ -1563,8 +1563,8 @@ async_init_start_service_by_name_cb (GDBusConnection *connection, "(u)", &start_service_result); g_variant_unref (result); - if (start_service_result == 1 || /* DBUS_START_REPLY_SUCCESS */ - start_service_result == 2) /* DBUS_START_REPLY_ALREADY_RUNNING */ + if (start_service_result == DBUS_START_REPLY_SUCCESS || + start_service_result == DBUS_START_REPLY_ALREADY_RUNNING) { /* continue to invoke GetNameOwner() */ } @@ -1594,9 +1594,9 @@ async_init_call_start_service_by_name (GTask *task) GDBusProxy *proxy = g_task_get_source_object (task); g_dbus_connection_call (proxy->priv->connection, - "org.freedesktop.DBus", /* name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "StartServiceByName", g_variant_new ("(su)", proxy->priv->name, @@ -1688,7 +1688,7 @@ async_initable_init_first (GAsyncInitable *initable) proxy->priv->properties_changed_subscription_id = g_dbus_connection_signal_subscribe (proxy->priv->connection, proxy->priv->name, - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "PropertiesChanged", proxy->priv->object_path, proxy->priv->interface_name, @@ -1719,10 +1719,10 @@ async_initable_init_first (GAsyncInitable *initable) { proxy->priv->name_owner_changed_subscription_id = g_dbus_connection_signal_subscribe (proxy->priv->connection, - "org.freedesktop.DBus", /* name */ - "org.freedesktop.DBus", /* interface */ + DBUS_SERVICE_DBUS, + DBUS_INTERFACE_DBUS, "NameOwnerChanged", /* signal name */ - "/org/freedesktop/DBus", /* path */ + DBUS_PATH_DBUS, proxy->priv->name, /* arg0 */ signal_flags, on_name_owner_changed, diff --git a/gio/gdebugcontrollerdbus.c b/gio/gdebugcontrollerdbus.c index 03dd1be98..148b7959f 100644 --- a/gio/gdebugcontrollerdbus.c +++ b/gio/gdebugcontrollerdbus.c @@ -241,7 +241,7 @@ set_debug_enabled (GDebugControllerDBus *self, g_dbus_connection_emit_signal (priv->connection, NULL, "/org/gtk/Debugging", - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "PropertiesChanged", g_variant_new ("(sa{sv}as)", "org.gtk.Debugging", diff --git a/gio/gfile.c b/gio/gfile.c index ce0d806cc..c880b22c2 100644 --- a/gio/gfile.c +++ b/gio/gfile.c @@ -3900,7 +3900,7 @@ copy_async_invoke_ready (GObject *file, } /** - * g_file_copy_async_with_closures: (rename-to g_file_copy_async) (finish-func g_file_copy_finish): + * g_file_copy_async_with_closures: (rename-to g_file_copy_async) (finish-func copy_finish): * @source: input [type@Gio.File] * @destination: destination [type@Gio.File] * @flags: set of [flags@Gio.FileCopyFlags] @@ -4153,7 +4153,7 @@ g_file_move_async (GFile *source, } /** - * g_file_move_async_with_closures: (rename-to g_file_move_async) (finish-func g_file_move_finish): + * g_file_move_async_with_closures: (rename-to g_file_move_async) (finish-func move_finish): * @source: input [type@Gio.File] * @destination: destination [type@Gio.File] * @flags: set of [flags@Gio.FileCopyFlags] diff --git a/gio/ggtknotificationbackend.c b/gio/ggtknotificationbackend.c index b749eae41..1ddf57b00 100644 --- a/gio/ggtknotificationbackend.c +++ b/gio/ggtknotificationbackend.c @@ -22,6 +22,7 @@ #include "giomodule-priv.h" #include "gdbusconnection.h" +#include "gdbusprivate.h" #include "gapplication.h" #include "gnotification-private.h" @@ -58,8 +59,8 @@ g_gtk_notification_backend_is_supported (void) if (session_bus == NULL) return FALSE; - reply = g_dbus_connection_call_sync (session_bus, "org.freedesktop.DBus", "/org/freedesktop/DBus", - "org.freedesktop.DBus", + reply = g_dbus_connection_call_sync (session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetNameOwner", g_variant_new ("(s)", "org.gtk.Notifications"), G_VARIANT_TYPE ("(s)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL); diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index 2df7c91e5..ec45e45d2 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -103,12 +103,6 @@ #include "glibintl.h" -struct ThumbMD5Context { - guint32 buf[4]; - guint32 bits[2]; - unsigned char in[64]; -}; - #ifndef G_OS_WIN32 typedef struct { diff --git a/gio/gmenuexporter.c b/gio/gmenuexporter.c index 909780cb2..1d4db1352 100644 --- a/gio/gmenuexporter.c +++ b/gio/gmenuexporter.c @@ -707,11 +707,9 @@ g_menu_exporter_create_group (GMenuExporter *exporter) } static void -g_menu_exporter_free (gpointer user_data) +g_menu_exporter_free (GMenuExporter *exporter) { - GMenuExporter *exporter = user_data; - - g_menu_exporter_menu_free (exporter->root); + g_clear_pointer (&exporter->root, g_menu_exporter_menu_free); g_clear_pointer (&exporter->peer_remote, g_menu_exporter_remote_free); g_hash_table_unref (exporter->remotes); g_hash_table_unref (exporter->groups); @@ -794,21 +792,16 @@ g_dbus_connection_export_menu_model (GDBusConnection *connection, guint id; exporter = g_slice_new0 (GMenuExporter); - - id = g_dbus_connection_register_object (connection, object_path, org_gtk_Menus_get_interface (), - &vtable, exporter, g_menu_exporter_free, error); - - if (id == 0) - { - g_slice_free (GMenuExporter, exporter); - return 0; - } - exporter->connection = g_object_ref (connection); exporter->object_path = g_strdup (object_path); exporter->groups = g_hash_table_new (NULL, NULL); exporter->remotes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_menu_exporter_remote_free); - exporter->root = g_menu_exporter_group_add_menu (g_menu_exporter_create_group (exporter), menu); + + id = g_dbus_connection_register_object (connection, object_path, org_gtk_Menus_get_interface (), + &vtable, exporter, (GDestroyNotify) g_menu_exporter_free, error); + + if (id != 0) + exporter->root = g_menu_exporter_group_add_menu (g_menu_exporter_create_group (exporter), menu); return id; } diff --git a/gio/gsocketclient.c b/gio/gsocketclient.c index b238a3cce..7b8d3abbb 100644 --- a/gio/gsocketclient.c +++ b/gio/gsocketclient.c @@ -1919,6 +1919,7 @@ try_next_connection_or_finish (GSocketClientAsyncConnectData *data, } complete_connection_with_error (data, g_steal_pointer (&data->error_info->best_error)); + g_object_unref (data->task); } static void diff --git a/gio/tests/actions.c b/gio/tests/actions.c index a24c52c5e..2b7a100fc 100644 --- a/gio/tests/actions.c +++ b/gio/tests/actions.c @@ -1125,6 +1125,46 @@ test_dbus_export (void) session_bus_down (); } +static void +test_dbus_export_error_handling (void) +{ + GDBusConnection *bus = NULL; + GSimpleActionGroup *group = NULL; + GError *local_error = NULL; + guint id1, id2; + + g_test_summary ("Test that error handling of action group export failure works"); + g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/3366"); + + session_bus_up (); + bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); + + group = g_simple_action_group_new (); + g_simple_action_group_add_entries (group, + exported_entries, + G_N_ELEMENTS (exported_entries), + NULL); + + id1 = g_dbus_connection_export_action_group (bus, "/", G_ACTION_GROUP (group), &local_error); + g_assert_no_error (local_error); + g_assert_cmpuint (id1, !=, 0); + + /* Trigger a failure by trying to export on a path which is already in use */ + id2 = g_dbus_connection_export_action_group (bus, "/", G_ACTION_GROUP (group), &local_error); + g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS); + g_assert_cmpuint (id2, ==, 0); + g_clear_error (&local_error); + + g_dbus_connection_unexport_action_group (bus, id1); + + while (g_main_context_iteration (NULL, FALSE)); + + g_object_unref (group); + g_object_unref (bus); + + session_bus_down (); +} + static gpointer do_export (gpointer data) { @@ -1448,6 +1488,7 @@ main (int argc, char **argv) g_test_add_func ("/actions/entries", test_entries); g_test_add_func ("/actions/parse-detailed", test_parse_detailed); g_test_add_func ("/actions/dbus/export", test_dbus_export); + g_test_add_func ("/actions/dbus/export/error-handling", test_dbus_export_error_handling); g_test_add_func ("/actions/dbus/threaded", test_dbus_threaded); g_test_add_func ("/actions/dbus/bug679509", test_bug679509); g_test_add_func ("/actions/property", test_property_actions); diff --git a/gio/tests/debugcontroller.c b/gio/tests/debugcontroller.c index 862e8f666..3a6b12f7b 100644 --- a/gio/tests/debugcontroller.c +++ b/gio/tests/debugcontroller.c @@ -24,6 +24,7 @@ #include <gio/gio.h> #include <locale.h> +#include "gdbusprivate.h" static void test_dbus_basic (void) @@ -218,7 +219,7 @@ test_dbus_properties (void) properties_changed_id = g_dbus_connection_signal_subscribe (remote_connection, g_dbus_connection_get_unique_name (controller_connection), - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "PropertiesChanged", "/org/gtk/Debugging", NULL, @@ -231,7 +232,7 @@ test_dbus_properties (void) g_dbus_connection_call (remote_connection, g_dbus_connection_get_unique_name (controller_connection), "/org/gtk/Debugging", - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "Get", g_variant_new ("(ss)", "org.gtk.Debugging", "DebugEnabled"), G_VARIANT_TYPE ("(v)"), diff --git a/gio/tests/gdbus-connection.c b/gio/tests/gdbus-connection.c index fc8816716..ab02ed780 100644 --- a/gio/tests/gdbus-connection.c +++ b/gio/tests/gdbus-connection.c @@ -26,6 +26,7 @@ #include <sys/types.h> +#include "gdbusprivate.h" #include "gdbus-tests.h" /* all tests rely on a shared mainloop */ @@ -213,10 +214,10 @@ test_connection_life_cycle (void) /* signal registration */ g_atomic_int_set (&on_signal_registration_freed_called, FALSE); g_dbus_connection_signal_subscribe (c2, - "org.freedesktop.DBus", /* bus name */ - "org.freedesktop.DBus", /* interface */ + DBUS_SERVICE_DBUS, + DBUS_INTERFACE_DBUS, "NameOwnerChanged", /* member */ - "/org/freesktop/DBus", /* path */ + DBUS_PATH_DBUS, NULL, /* arg0 */ G_DBUS_SIGNAL_FLAGS_NONE, on_name_owner_changed, @@ -424,9 +425,9 @@ test_connection_send (void) ca = g_cancellable_new (); g_cancellable_cancel (ca); g_dbus_connection_call (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetId", /* method name */ NULL, NULL, G_DBUS_CALL_FLAGS_NONE, @@ -441,9 +442,9 @@ test_connection_send (void) * Check that we get a reply to the GetId() method call. */ g_dbus_connection_call (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetId", /* method name */ NULL, NULL, G_DBUS_CALL_FLAGS_NONE, @@ -457,9 +458,9 @@ test_connection_send (void) * Check that we get an error reply to the NonExistantMethod() method call. */ g_dbus_connection_call (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "NonExistantMethod", /* method name */ NULL, NULL, G_DBUS_CALL_FLAGS_NONE, @@ -474,9 +475,9 @@ test_connection_send (void) */ ca = g_cancellable_new (); g_dbus_connection_call (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetId", /* method name */ NULL, NULL, G_DBUS_CALL_FLAGS_NONE, @@ -497,9 +498,9 @@ test_connection_send (void) g_assert_true (g_dbus_connection_is_closed (c)); g_dbus_connection_call (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetId", /* method name */ NULL, NULL, G_DBUS_CALL_FLAGS_NONE, @@ -618,10 +619,10 @@ test_connection_signals (void) &count_s2, NULL); s3 = g_dbus_connection_signal_subscribe (c1, - "org.freedesktop.DBus", /* sender */ - "org.freedesktop.DBus", /* interface */ + DBUS_SERVICE_DBUS, + DBUS_INTERFACE_DBUS, "NameOwnerChanged", /* member */ - "/org/freedesktop/DBus", /* path */ + DBUS_PATH_DBUS, NULL, G_DBUS_SIGNAL_FLAGS_NONE, test_connection_signal_handler, @@ -687,9 +688,9 @@ test_connection_signals (void) * To ensure this is not the case, do a synchronous call on c1. */ result = g_dbus_connection_call_sync (c1, - "org.freedesktop.DBus", /* bus name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetId", /* method name */ NULL, /* parameters */ NULL, /* return type */ @@ -1047,11 +1048,11 @@ test_connection_filter (void) &data, NULL); - m = g_dbus_message_new_method_call ("org.freedesktop.DBus", /* name */ - "/org/freedesktop/DBus", /* path */ - "org.freedesktop.DBus", /* interface */ + m = g_dbus_message_new_method_call (DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetNameOwner"); - g_dbus_message_set_body (m, g_variant_new ("(s)", "org.freedesktop.DBus")); + g_dbus_message_set_body (m, g_variant_new ("(s)", DBUS_SERVICE_DBUS)); error = NULL; g_dbus_connection_send_message (c, m, G_DBUS_SEND_MESSAGE_FLAGS_NONE, &serial_temp, &error); g_assert_no_error (error); @@ -1114,10 +1115,10 @@ test_connection_filter (void) /* wait for service to be available */ signal_handler_id = g_dbus_connection_signal_subscribe (c, - "org.freedesktop.DBus", /* sender */ - "org.freedesktop.DBus", + DBUS_SERVICE_DBUS, + DBUS_INTERFACE_DBUS, "NameOwnerChanged", - "/org/freedesktop/DBus", + DBUS_PATH_DBUS, NULL, /* arg0 */ G_DBUS_SIGNAL_FLAGS_NONE, test_connection_filter_name_owner_changed_signal_handler, @@ -1197,11 +1198,11 @@ send_bogus_message (GDBusConnection *c, guint32 *out_serial) GDBusMessage *m; GError *error; - m = g_dbus_message_new_method_call ("org.freedesktop.DBus", /* name */ - "/org/freedesktop/DBus", /* path */ - "org.freedesktop.DBus", /* interface */ + m = g_dbus_message_new_method_call (DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetNameOwner"); - g_dbus_message_set_body (m, g_variant_new ("(s)", "org.freedesktop.DBus")); + g_dbus_message_set_body (m, g_variant_new ("(s)", DBUS_SERVICE_DBUS)); error = NULL; g_dbus_connection_send_message (c, m, G_DBUS_SEND_MESSAGE_FLAGS_NONE, out_serial, &error); g_assert_no_error (error); diff --git a/gio/tests/gdbus-error.c b/gio/tests/gdbus-error.c index 4925b950b..b2a117f5e 100644 --- a/gio/tests/gdbus-error.c +++ b/gio/tests/gdbus-error.c @@ -24,6 +24,8 @@ #include <unistd.h> #include <string.h> +#include "gdbusprivate.h" + /* ---------------------------------------------------------------------------------------------------- */ /* Test that registered errors are properly mapped */ /* ---------------------------------------------------------------------------------------------------- */ @@ -66,13 +68,13 @@ test_registered_errors (void) * * We just check a couple of well-known errors. */ - check_registered_error ("org.freedesktop.DBus.Error.Failed", + check_registered_error (DBUS_ERROR_FAILED, G_DBUS_ERROR, G_DBUS_ERROR_FAILED); check_registered_error ("org.freedesktop.DBus.Error.AddressInUse", G_DBUS_ERROR, G_DBUS_ERROR_ADDRESS_IN_USE); - check_registered_error ("org.freedesktop.DBus.Error.UnknownMethod", + check_registered_error (DBUS_ERROR_UNKNOWN_METHOD, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); check_registered_error ("org.freedesktop.DBus.Error.UnknownObject", diff --git a/gio/tests/gdbus-example-export.c b/gio/tests/gdbus-example-export.c index 182305068..951700519 100644 --- a/gio/tests/gdbus-example-export.c +++ b/gio/tests/gdbus-example-export.c @@ -1,6 +1,8 @@ #include <gio/gio.h> #include <stdlib.h> +#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties" + /* ---------------------------------------------------------------------------------------------------- */ /* The object we want to export */ @@ -253,7 +255,7 @@ send_property_change (GObject *obj, g_dbus_connection_emit_signal (connection, NULL, "/org/myorg/MyObject", - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "PropertiesChanged", g_variant_new ("(sa{sv}as)", "org.myorg.MyObject", diff --git a/gio/tests/gdbus-example-server.c b/gio/tests/gdbus-example-server.c index b19f6505d..864a41237 100644 --- a/gio/tests/gdbus-example-server.c +++ b/gio/tests/gdbus-example-server.c @@ -7,6 +7,8 @@ #include <unistd.h> #endif +#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties" + /* ---------------------------------------------------------------------------------------------------- */ static GDBusNodeInfo *introspection_data = NULL; @@ -243,7 +245,7 @@ handle_set_property (GDBusConnection *connection, g_dbus_connection_emit_signal (connection, NULL, object_path, - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "PropertiesChanged", g_variant_new ("(sa{sv}as)", interface_name, @@ -306,7 +308,7 @@ on_timeout_cb (gpointer user_data) g_dbus_connection_emit_signal (connection, NULL, "/org/gtk/GDBus/TestObject", - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "PropertiesChanged", g_variant_new ("(sa{sv}as)", "org.gtk.GDBus.TestInterface", diff --git a/gio/tests/gdbus-exit-on-close.c b/gio/tests/gdbus-exit-on-close.c index e3aba16a9..8f504d4fe 100644 --- a/gio/tests/gdbus-exit-on-close.c +++ b/gio/tests/gdbus-exit-on-close.c @@ -25,6 +25,7 @@ #include <unistd.h> #include <string.h> +#include "gdbusprivate.h" #include "gdbus-tests.h" /* all tests rely on a shared mainloop */ @@ -137,9 +138,9 @@ test_exit_on_close_subprocess (gconstpointer test_data) GVariant *v; GError *error = NULL; - v = g_dbus_connection_call_sync (c, "org.freedesktop.DBus", - "/org/freedesktop/DBus", - "org.freedesktop.DBus", + v = g_dbus_connection_call_sync (c, DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "ListNames", NULL, G_VARIANT_TYPE ("(as)"), diff --git a/gio/tests/gdbus-export.c b/gio/tests/gdbus-export.c index af88dc442..599df5bb5 100644 --- a/gio/tests/gdbus-export.c +++ b/gio/tests/gdbus-export.c @@ -25,6 +25,7 @@ #include <string.h> #include "gdbus-tests.h" +#include "gdbusprivate.h" /* all tests rely on a shared mainloop */ static GMainLoop *loop = NULL; @@ -377,7 +378,7 @@ get_nodes_at (GDBusConnection *c, NULL, g_dbus_connection_get_unique_name (c), object_path, - "org.freedesktop.DBus.Introspectable", + DBUS_INTERFACE_INTROSPECTABLE, NULL, &error); g_assert_no_error (error); @@ -436,7 +437,7 @@ has_interface (GDBusConnection *c, NULL, g_dbus_connection_get_unique_name (c), object_path, - "org.freedesktop.DBus.Introspectable", + DBUS_INTERFACE_INTROSPECTABLE, NULL, &error); g_assert_no_error (error); @@ -485,7 +486,7 @@ count_interfaces (GDBusConnection *c, NULL, g_dbus_connection_get_unique_name (c), object_path, - "org.freedesktop.DBus.Introspectable", + DBUS_INTERFACE_INTROSPECTABLE, NULL, &error); g_assert_no_error (error); @@ -778,7 +779,7 @@ test_dispatch_thread_func (gpointer user_data) /* generic interfaces */ error = NULL; value = g_dbus_proxy_call_sync (foo_proxy, - "org.freedesktop.DBus.Peer.Ping", + DBUS_INTERFACE_PEER ".Ping", NULL, G_DBUS_CALL_FLAGS_NONE, -1, @@ -826,7 +827,7 @@ test_dispatch_thread_func (gpointer user_data) NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS); - g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Type of message, “(s)”, does not match expected type “()”"); + g_assert_cmpstr (error->message, ==, "GDBus.Error:" DBUS_ERROR_INVALID_ARGS ": Type of message, “(s)”, does not match expected type “()”"); g_error_free (error); g_assert_null (value); @@ -839,7 +840,7 @@ test_dispatch_thread_func (gpointer user_data) NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); - g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such method “NonExistantMethod”"); + g_assert_cmpstr (error->message, ==, "GDBus.Error:" DBUS_ERROR_UNKNOWN_METHOD ": No such method “NonExistantMethod”"); g_error_free (error); g_assert_null (value); @@ -858,7 +859,7 @@ test_dispatch_thread_func (gpointer user_data) /* user properties */ error = NULL; value = g_dbus_proxy_call_sync (foo_proxy, - "org.freedesktop.DBus.Properties.Get", + DBUS_INTERFACE_PROPERTIES ".Get", g_variant_new ("(ss)", "org.example.Foo", "PropertyUno"), @@ -877,7 +878,7 @@ test_dispatch_thread_func (gpointer user_data) error = NULL; value = g_dbus_proxy_call_sync (foo_proxy, - "org.freedesktop.DBus.Properties.Get", + DBUS_INTERFACE_PROPERTIES ".Get", g_variant_new ("(ss)", "org.example.Foo", "ThisDoesntExist"), @@ -887,12 +888,12 @@ test_dispatch_thread_func (gpointer user_data) &error); g_assert_null (value); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS); - g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property “ThisDoesntExist”"); + g_assert_cmpstr (error->message, ==, "GDBus.Error:" DBUS_ERROR_INVALID_ARGS ": No such property “ThisDoesntExist”"); g_error_free (error); error = NULL; value = g_dbus_proxy_call_sync (foo_proxy, - "org.freedesktop.DBus.Properties.Get", + DBUS_INTERFACE_PROPERTIES ".Get", g_variant_new ("(ss)", "org.example.Foo", "NotReadable"), @@ -902,12 +903,12 @@ test_dispatch_thread_func (gpointer user_data) &error); g_assert_null (value); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS); - g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Property “NotReadable” is not readable"); + g_assert_cmpstr (error->message, ==, "GDBus.Error:" DBUS_ERROR_INVALID_ARGS ": Property “NotReadable” is not readable"); g_error_free (error); error = NULL; value = g_dbus_proxy_call_sync (foo_proxy, - "org.freedesktop.DBus.Properties.Set", + DBUS_INTERFACE_PROPERTIES ".Set", g_variant_new ("(ssv)", "org.example.Foo", "NotReadable", @@ -928,7 +929,7 @@ test_dispatch_thread_func (gpointer user_data) error = NULL; value = g_dbus_proxy_call_sync (foo_proxy, - "org.freedesktop.DBus.Properties.Set", + DBUS_INTERFACE_PROPERTIES ".Set", g_variant_new ("(ssv)", "org.example.Foo", "NotWritable", @@ -939,12 +940,12 @@ test_dispatch_thread_func (gpointer user_data) &error); g_assert_null (value); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS); - g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Property “NotWritable” is not writable"); + g_assert_cmpstr (error->message, ==, "GDBus.Error:" DBUS_ERROR_INVALID_ARGS ": Property “NotWritable” is not writable"); g_error_free (error); error = NULL; value = g_dbus_proxy_call_sync (foo_proxy, - "org.freedesktop.DBus.Properties.GetAll", + DBUS_INTERFACE_PROPERTIES ".GetAll", g_variant_new ("(s)", "org.example.Foo"), G_DBUS_CALL_FLAGS_NONE, @@ -1466,7 +1467,7 @@ static const GDBusInterfaceInfo test_interface_info1 = static const GDBusInterfaceInfo test_interface_info2 = { -1, - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, (GDBusMethodInfo **) NULL, (GDBusSignalInfo **) NULL, (GDBusPropertyInfo **) NULL, @@ -1491,7 +1492,7 @@ check_interfaces (GDBusConnection *c, NULL, g_dbus_connection_get_unique_name (c), object_path, - "org.freedesktop.DBus.Introspectable", + DBUS_INTERFACE_INTROSPECTABLE, NULL, &error); g_assert_no_error (error); @@ -1555,8 +1556,8 @@ test_registered_interfaces (void) guint id1, id2; const gchar *interfaces[] = { "org.example.Foo", - "org.freedesktop.DBus.Properties", - "org.freedesktop.DBus.Introspectable", + DBUS_INTERFACE_PROPERTIES, + DBUS_INTERFACE_INTROSPECTABLE, NULL, }; @@ -1607,10 +1608,10 @@ test_async_method_call (GDBusConnection *connection, const GDBusPropertyInfo *property; /* Strictly speaking, this function should also expect to receive - * method calls not on the org.freedesktop.DBus.Properties interface, + * method calls not on the DBUS_INTERFACE_PROPERTIES interface, * but we don't do any during this testcase, so assert that. */ - g_assert_cmpstr (interface_name, ==, "org.freedesktop.DBus.Properties"); + g_assert_cmpstr (interface_name, ==, DBUS_INTERFACE_PROPERTIES); g_assert_null (g_dbus_method_invocation_get_method_info (invocation)); property = g_dbus_method_invocation_get_property_info (invocation); @@ -1714,7 +1715,7 @@ test_async_case (GDBusConnection *connection, va_start (ap, format_string); g_dbus_connection_call (connection, g_dbus_connection_get_unique_name (connection), "/foo", - "org.freedesktop.DBus.Properties", method, g_variant_new_va (format_string, NULL, &ap), + DBUS_INTERFACE_PROPERTIES, method, g_variant_new_va (format_string, NULL, &ap), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, ensure_result_cb, (gpointer) expected_reply); va_end (ap); diff --git a/gio/tests/gdbus-introspection.c b/gio/tests/gdbus-introspection.c index 44cb7a96a..cb99c9410 100644 --- a/gio/tests/gdbus-introspection.c +++ b/gio/tests/gdbus-introspection.c @@ -24,6 +24,7 @@ #include <unistd.h> #include <string.h> +#include "gdbusprivate.h" #include "gdbus-tests.h" /* all tests rely on a shared mainloop */ @@ -50,7 +51,7 @@ test_introspection (GDBusProxy *proxy) * Invoke Introspect(), then parse the output. */ result = g_dbus_proxy_call_sync (proxy, - "org.freedesktop.DBus.Introspectable.Introspect", + DBUS_INTERFACE_INTROSPECTABLE ".Introspect", NULL, G_DBUS_CALL_FLAGS_NONE, -1, @@ -69,7 +70,7 @@ test_introspection (GDBusProxy *proxy) interface_info = g_dbus_node_info_lookup_interface (node_info, "com.example.NonExistantInterface"); g_assert (interface_info == NULL); - interface_info = g_dbus_node_info_lookup_interface (node_info, "org.freedesktop.DBus.Introspectable"); + interface_info = g_dbus_node_info_lookup_interface (node_info, DBUS_INTERFACE_INTROSPECTABLE); g_assert (interface_info != NULL); method_info = g_dbus_interface_info_lookup_method (interface_info, "NonExistantMethod"); g_assert (method_info == NULL); diff --git a/gio/tests/gdbus-method-invocation.c b/gio/tests/gdbus-method-invocation.c index 1bcf57377..cb0f45969 100644 --- a/gio/tests/gdbus-method-invocation.c +++ b/gio/tests/gdbus-method-invocation.c @@ -25,6 +25,7 @@ #include <string.h> #include <unistd.h> +#include "gdbusprivate.h" #include "gdbus-tests.h" static const GDBusArgInfo foo_get_fds_in_args = @@ -141,7 +142,7 @@ test_method_invocation_return_method_call (GDBusConnection *connection, { gboolean no_reply = g_dbus_message_get_flags (g_dbus_method_invocation_get_message (invocation)) & G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED; - if (g_str_equal (interface_name, "org.freedesktop.DBus.Properties") && + if (g_str_equal (interface_name, DBUS_INTERFACE_PROPERTIES) && g_str_equal (method_name, "Get")) { const gchar *iface_name, *prop_name; @@ -178,7 +179,7 @@ test_method_invocation_return_method_call (GDBusConnection *connection, g_test_assert_expected_messages (); } - else if (g_str_equal (interface_name, "org.freedesktop.DBus.Properties") && + else if (g_str_equal (interface_name, DBUS_INTERFACE_PROPERTIES) && g_str_equal (method_name, "Set")) { const gchar *iface_name, *prop_name; @@ -202,7 +203,7 @@ test_method_invocation_return_method_call (GDBusConnection *connection, g_test_assert_expected_messages (); g_variant_unref (value); } - else if (g_str_equal (interface_name, "org.freedesktop.DBus.Properties") && + else if (g_str_equal (interface_name, DBUS_INTERFACE_PROPERTIES) && g_str_equal (method_name, "GetAll")) { const gchar *iface_name; @@ -325,11 +326,11 @@ test_method_invocation_return (void) } calls[] = { - { "org.freedesktop.DBus.Properties", "Get", "('org.example.Foo', 'InvalidType')", TRUE }, - { "org.freedesktop.DBus.Properties", "Get", "('org.example.Foo', 'InvalidTypeNull')", TRUE }, - { "org.freedesktop.DBus.Properties", "Get", "('org.example.Foo', 'InvalidValueType')", TRUE }, - { "org.freedesktop.DBus.Properties", "Set", "('org.example.Foo', 'InvalidType', <'irrelevant'>)", TRUE }, - { "org.freedesktop.DBus.Properties", "GetAll", "('org.example.Foo',)", TRUE }, + { DBUS_INTERFACE_PROPERTIES, "Get", "('org.example.Foo', 'InvalidType')", TRUE }, + { DBUS_INTERFACE_PROPERTIES, "Get", "('org.example.Foo', 'InvalidTypeNull')", TRUE }, + { DBUS_INTERFACE_PROPERTIES, "Get", "('org.example.Foo', 'InvalidValueType')", TRUE }, + { DBUS_INTERFACE_PROPERTIES, "Set", "('org.example.Foo', 'InvalidType', <'irrelevant'>)", TRUE }, + { DBUS_INTERFACE_PROPERTIES, "GetAll", "('org.example.Foo',)", TRUE }, { "org.example.Foo", "WrongReturnType", "()", TRUE }, { "org.example.Foo", "GetFDs", "('Valid',)", FALSE }, { "org.example.Foo", "GetFDs", "('WrongNumber',)", TRUE }, diff --git a/gio/tests/gdbus-names.c b/gio/tests/gdbus-names.c index c06971097..37711662a 100644 --- a/gio/tests/gdbus-names.c +++ b/gio/tests/gdbus-names.c @@ -25,6 +25,7 @@ #include <gio/gio.h> #include <unistd.h> +#include "gdbusprivate.h" #include "gdbus-tests.h" /* ---------------------------------------------------------------------------------------------------- */ @@ -181,9 +182,9 @@ test_bus_own_name (void) g_assert (c != NULL); g_assert (!g_dbus_connection_is_closed (c)); result = g_dbus_connection_call_sync (c, - "org.freedesktop.DBus", /* bus name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "NameHasOwner", /* method name */ g_variant_new ("(s)", name), G_VARIANT_TYPE ("(b)"), @@ -209,9 +210,9 @@ test_bus_own_name (void) * Check that the name was actually released. */ result = g_dbus_connection_call_sync (c, - "org.freedesktop.DBus", /* bus name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "NameHasOwner", /* method name */ g_variant_new ("(s)", name), G_VARIANT_TYPE ("(b)"), diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c index 763689a4f..0131ac2bc 100644 --- a/gio/tests/gdbus-peer.c +++ b/gio/tests/gdbus-peer.c @@ -48,6 +48,7 @@ #include <gio/giowin32-afunix.h> #endif +#include "gdbusprivate.h" #include "gdbus-tests.h" #include "gdbus-object-manager-example/objectmanager-gen.h" @@ -2156,7 +2157,7 @@ codegen_test_peer (void) /* Poke server and make sure animal is updated */ value = g_dbus_proxy_call_sync (G_DBUS_PROXY (animal1), - "org.freedesktop.DBus.Peer.Ping", + DBUS_INTERFACE_PEER ".Ping", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); g_assert_no_error (error); @@ -2177,7 +2178,7 @@ codegen_test_peer (void) /* Some random unrelated call, just to get some test coverage */ value = g_dbus_proxy_call_sync (G_DBUS_PROXY (animal2), - "org.freedesktop.DBus.Peer.GetMachineId", + DBUS_INTERFACE_PEER ".GetMachineId", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); g_assert_no_error (error); @@ -2191,7 +2192,7 @@ codegen_test_peer (void) /* Poke server and make sure animal is updated */ value = g_dbus_proxy_call_sync (G_DBUS_PROXY (animal2), - "org.freedesktop.DBus.Peer.Ping", + DBUS_INTERFACE_PEER ".Ping", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); g_assert_no_error (error); diff --git a/gio/tests/gdbus-proxy-threads.c b/gio/tests/gdbus-proxy-threads.c index 9cb1a6e22..2edc8422a 100644 --- a/gio/tests/gdbus-proxy-threads.c +++ b/gio/tests/gdbus-proxy-threads.c @@ -28,18 +28,9 @@ #include <gio/gio.h> +#include "gdbusprivate.h" #include "gdbus-tests.h" -#ifdef HAVE_DBUS1 -# include <dbus/dbus-shared.h> -#else -# define DBUS_INTERFACE_DBUS "org.freedesktop.DBus" -# define DBUS_PATH_DBUS "/org/freedesktop/DBus" -# define DBUS_SERVICE_DBUS "org.freedesktop.DBus" -# define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1 -# define DBUS_RELEASE_NAME_REPLY_RELEASED 1 -#endif - #define MY_NAME "com.example.Test.Myself" /* This many threads create and destroy GDBusProxy instances, in addition * to the main thread processing their NameOwnerChanged signals. diff --git a/gio/tests/gdbus-proxy.c b/gio/tests/gdbus-proxy.c index ab36eae0e..eefb8688d 100644 --- a/gio/tests/gdbus-proxy.c +++ b/gio/tests/gdbus-proxy.c @@ -24,6 +24,7 @@ #include <unistd.h> #include <string.h> +#include "gdbusprivate.h" #include "gdbus-tests.h" /* all tests rely on a shared mainloop */ @@ -757,9 +758,9 @@ kill_test_service (GDBusConnection *connection) gboolean name_disappeared = FALSE; ret = g_dbus_connection_call_sync (connection, - "org.freedesktop.DBus", - "/org/freedesktop/DBus", - "org.freedesktop.DBus", + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetConnectionUnixProcessID", g_variant_new ("(s)", name), NULL, @@ -977,9 +978,9 @@ add_or_remove_match_rule (GDBusConnection *connection, GDBusMessage *message = NULL; GError *error = NULL; - message = g_dbus_message_new_method_call ("org.freedesktop.DBus", /* name */ - "/org/freedesktop/DBus", /* path */ - "org.freedesktop.DBus", /* interface */ + message = g_dbus_message_new_method_call (DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, (add_or_remove == ADD_MATCH) ? "AddMatch" : "RemoveMatch"); g_dbus_message_set_body (message, match_rule); g_dbus_connection_send_message (connection, diff --git a/gio/tests/gdbus-serialization.c b/gio/tests/gdbus-serialization.c index cfdf2accc..b026e52b8 100644 --- a/gio/tests/gdbus-serialization.c +++ b/gio/tests/gdbus-serialization.c @@ -1027,10 +1027,10 @@ test_message_serialize_header_checks (void) g_clear_error (&error); g_assert_null (blob); /* interface reserved value => error */ - g_dbus_message_set_interface (message, "org.freedesktop.DBus.Local"); + g_dbus_message_set_interface (message, DBUS_INTERFACE_LOCAL); blob = g_dbus_message_to_blob (message, &blob_size, G_DBUS_CAPABILITY_FLAGS_NONE, &error); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT); - g_assert_cmpstr (error->message, ==, "Cannot serialize message: SIGNAL message: INTERFACE header field is using the reserved value org.freedesktop.DBus.Local"); + g_assert_cmpstr (error->message, ==, "Cannot serialize message: SIGNAL message: INTERFACE header field is using the reserved value " DBUS_INTERFACE_LOCAL); g_clear_error (&error); g_assert_null (blob); /* reset interface */ @@ -1044,10 +1044,10 @@ test_message_serialize_header_checks (void) g_clear_error (&error); g_assert_null (blob); /* path reserved value => error */ - g_dbus_message_set_path (message, "/org/freedesktop/DBus/Local"); + g_dbus_message_set_path (message, DBUS_PATH_LOCAL); blob = g_dbus_message_to_blob (message, &blob_size, G_DBUS_CAPABILITY_FLAGS_NONE, &error); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT); - g_assert_cmpstr (error->message, ==, "Cannot serialize message: SIGNAL message: PATH header field is using the reserved value /org/freedesktop/DBus/Local"); + g_assert_cmpstr (error->message, ==, "Cannot serialize message: SIGNAL message: PATH header field is using the reserved value " DBUS_PATH_LOCAL); g_clear_error (&error); g_assert_null (blob); /* reset path */ diff --git a/gio/tests/gdbus-subscribe.c b/gio/tests/gdbus-subscribe.c index 4cba4f565..2392f88c6 100644 --- a/gio/tests/gdbus-subscribe.c +++ b/gio/tests/gdbus-subscribe.c @@ -5,14 +5,9 @@ #include <gio/gio.h> +#include "gdbusprivate.h" #include "gdbus-tests.h" -/* From the D-Bus Specification */ -#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1 - -#define DBUS_SERVICE_DBUS "org.freedesktop.DBus" -#define DBUS_PATH_DBUS "/org/freedesktop/DBus" -#define DBUS_INTERFACE_DBUS DBUS_SERVICE_DBUS #define NAME_OWNER_CHANGED "NameOwnerChanged" /* A signal that each connection emits to indicate that it has finished diff --git a/gio/tests/gdbus-test-codegen.c b/gio/tests/gdbus-test-codegen.c index 9c84ea65c..ce8e327dd 100644 --- a/gio/tests/gdbus-test-codegen.c +++ b/gio/tests/gdbus-test-codegen.c @@ -25,6 +25,7 @@ #include <string.h> #include <stdio.h> +#include "gdbusprivate.h" #include "gdbus-tests.h" #include "gstdio.h" @@ -1511,7 +1512,7 @@ introspect (GDBusConnection *connection, g_dbus_connection_call (connection, name, object_path, - "org.freedesktop.DBus.Introspectable", + DBUS_INTERFACE_INTROSPECTABLE, "Introspect", NULL, /* params */ G_VARIANT_TYPE ("(s)"), @@ -1603,7 +1604,7 @@ om_check_get_all (GDBusConnection *c, g_dbus_connection_call (c, g_dbus_connection_get_unique_name (c), "/managed", - "org.freedesktop.DBus.ObjectManager", + DBUS_INTERFACE_OBJECT_MANAGER, "GetManagedObjects", NULL, /* params */ G_VARIANT_TYPE ("(a{oa{sa{sv}}})"), @@ -2016,7 +2017,7 @@ check_object_manager (void) om_signal_id = g_dbus_connection_signal_subscribe (c, NULL, /* sender */ - "org.freedesktop.DBus.ObjectManager", + DBUS_INTERFACE_OBJECT_MANAGER, NULL, /* member */ NULL, /* object_path */ NULL, /* arg0 */ @@ -2060,7 +2061,7 @@ check_object_manager (void) /* Check that the manager object is visible */ info = introspect (c, g_dbus_connection_get_unique_name (c), "/managed", loop); g_assert_cmpint (count_interfaces (info), ==, 4); /* ObjectManager + Properties,Introspectable,Peer */ - g_assert (has_interface (info, "org.freedesktop.DBus.ObjectManager")); + g_assert (has_interface (info, DBUS_INTERFACE_OBJECT_MANAGER)); g_assert_cmpint (count_nodes (info), ==, 0); g_dbus_node_info_unref (info); diff --git a/gio/tests/gdbus-testserver.c b/gio/tests/gdbus-testserver.c index 3a16db378..9948388ef 100644 --- a/gio/tests/gdbus-testserver.c +++ b/gio/tests/gdbus-testserver.c @@ -1,6 +1,8 @@ #include <gio/gio.h> #include <stdlib.h> +#include "gdbusprivate.h" + static GDBusNodeInfo *introspection_data = NULL; static GMainLoop *loop = NULL; static GHashTable *properties = NULL; @@ -688,7 +690,7 @@ handle_method_call (GDBusConnection *connection, g_dbus_connection_emit_signal (connection, NULL, "/com/example/TestObject", - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "PropertiesChanged", g_variant_new_parsed ("('com.example.Frob', [{%s, %v}], @as [])", name, value), NULL); @@ -703,7 +705,7 @@ handle_method_call (GDBusConnection *connection, g_dbus_connection_emit_signal (connection, NULL, "/com/example/TestObject", - "org.freedesktop.DBus.Properties", + DBUS_INTERFACE_PROPERTIES, "PropertiesChanged", g_variant_new_parsed ("('com.example.Frob', @a{sv} [], ['PropertyThatWillBeInvalidated'])"), NULL); diff --git a/gio/tests/gdbus-threading.c b/gio/tests/gdbus-threading.c index 755b490e0..297929ab0 100644 --- a/gio/tests/gdbus-threading.c +++ b/gio/tests/gdbus-threading.c @@ -24,6 +24,7 @@ #include <unistd.h> #include <string.h> +#include "gdbusprivate.h" #include "gdbus-tests.h" /* all tests rely on a global connection */ @@ -185,9 +186,9 @@ test_delivery_in_thread_func (gpointer _data) * Check that we get a reply to the GetId() method call. */ g_dbus_connection_call (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetId", /* method name */ NULL, NULL, G_DBUS_CALL_FLAGS_NONE, @@ -212,9 +213,9 @@ test_delivery_in_thread_func (gpointer _data) ca = g_cancellable_new (); g_cancellable_cancel (ca); g_dbus_connection_call (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetId", /* method name */ NULL, NULL, G_DBUS_CALL_FLAGS_NONE, @@ -239,9 +240,9 @@ test_delivery_in_thread_func (gpointer _data) */ ca = g_cancellable_new (); g_dbus_connection_call (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS, "GetId", /* method name */ NULL, NULL, G_DBUS_CALL_FLAGS_NONE, @@ -563,8 +564,8 @@ ensure_connection_works (GDBusConnection *conn) GVariant *v; GError *error = NULL; - v = g_dbus_connection_call_sync (conn, "org.freedesktop.DBus", - "/org/freedesktop/DBus", "org.freedesktop.DBus", "GetId", NULL, NULL, 0, -1, + v = g_dbus_connection_call_sync (conn, DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "GetId", NULL, NULL, 0, -1, NULL, &error); g_assert_no_error (error); g_assert_nonnull (v); diff --git a/gio/tests/gmenumodel.c b/gio/tests/gmenumodel.c index d75f36a29..22d1b4d61 100644 --- a/gio/tests/gmenumodel.c +++ b/gio/tests/gmenumodel.c @@ -1159,6 +1159,42 @@ test_dbus_peer_subscriptions (void) #endif } +static void +test_dbus_export_error_handling (void) +{ + GRand *rand = NULL; + RandomMenu *menu = NULL; + GDBusConnection *bus; + GError *local_error = NULL; + guint id1, id2; + + g_test_summary ("Test that error handling of menu model export failure works"); + g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/3366"); + + bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); + + rand = g_rand_new_with_seed (g_test_rand_int ()); + menu = random_menu_new (rand, 2); + + id1 = g_dbus_connection_export_menu_model (bus, "/", G_MENU_MODEL (menu), &local_error); + g_assert_no_error (local_error); + g_assert_cmpuint (id1, !=, 0); + + /* Trigger a failure by trying to export on a path which is already in use */ + id2 = g_dbus_connection_export_menu_model (bus, "/", G_MENU_MODEL (menu), &local_error); + g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS); + g_assert_cmpuint (id2, ==, 0); + g_clear_error (&local_error); + + g_dbus_connection_unexport_menu_model (bus, id1); + + while (g_main_context_iteration (NULL, FALSE)); + + g_clear_object (&menu); + g_rand_free (rand); + g_clear_object (&bus); +} + static gpointer do_modify (gpointer data) { @@ -1658,6 +1694,7 @@ main (int argc, char **argv) g_test_add_func ("/gmenu/dbus/threaded", test_dbus_threaded); g_test_add_func ("/gmenu/dbus/peer/roundtrip", test_dbus_peer_roundtrip); g_test_add_func ("/gmenu/dbus/peer/subscriptions", test_dbus_peer_subscriptions); + g_test_add_func ("/gmenu/dbus/export/error-handling", test_dbus_export_error_handling); g_test_add_func ("/gmenu/attributes", test_attributes); g_test_add_func ("/gmenu/attributes/iterate", test_attribute_iter); g_test_add_func ("/gmenu/links", test_links); diff --git a/gio/tests/gsocketclient-slow.c b/gio/tests/gsocketclient-slow.c index f56e11d25..18781eff9 100644 --- a/gio/tests/gsocketclient-slow.c +++ b/gio/tests/gsocketclient-slow.c @@ -19,6 +19,7 @@ */ #include <gio/gio.h> +#include <gio/gnetworking.h> /* For IPV6_V6ONLY */ static void on_connected (GObject *source_object, @@ -173,6 +174,70 @@ test_happy_eyeballs_cancel_instant (void) g_object_unref (cancel); } +static void +async_result_cb (GObject *source, + GAsyncResult *res, + gpointer user_data) +{ + GAsyncResult **result_out = user_data; + + g_assert_null (*result_out); + *result_out = g_object_ref (res); + + g_main_context_wakeup (NULL); +} + +static void +test_connection_failed (void) +{ + GSocketClient *client = NULL; + GInetAddress *inet_address = NULL; + GSocketAddress *address = NULL; + GSocket *socket = NULL; + guint16 port; + GAsyncResult *async_result = NULL; + GSocketConnection *conn = NULL; + GError *local_error = NULL; + + g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/3184"); + + inet_address = g_inet_address_new_any (G_SOCKET_FAMILY_IPV6); + address = g_inet_socket_address_new (inet_address, 0); + g_object_unref (inet_address); + + socket = g_socket_new (G_SOCKET_FAMILY_IPV6, G_SOCKET_TYPE_STREAM, G_SOCKET_PROTOCOL_TCP, &local_error); + g_assert_no_error (local_error); + g_socket_set_option (socket, IPPROTO_IPV6, IPV6_V6ONLY, FALSE, NULL); + g_socket_bind (socket, address, TRUE, &local_error); + g_assert_no_error (local_error); + + /* reserve a port without listening so we know that connecting to it will fail */ + port = g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (address)); + + client = g_socket_client_new (); + /* Connect to the port we have reserved but do not listen to. Because of the slow connection + * caused by slow-connect-preload.c and the fact that we try to connect to both IPv4 and IPv6 + * we will in some way exercise the code path in try_next_connection_or_finish() that ends + * with a call to complete_connection_with_error(). This path previously had a memory leak. + * Note that the slowness is important, because without it we could bail out already in the + * address enumeration phase because it finishes when there are no connection attempts in + * progress. */ + g_socket_client_connect_to_host_async (client, "localhost", port, NULL, async_result_cb, &async_result); + + while (async_result == NULL) + g_main_context_iteration (NULL, TRUE); + + conn = g_socket_client_connect_to_uri_finish (client, async_result, &local_error); + g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_CONNECTION_REFUSED); + g_assert_null (conn); + g_clear_error (&local_error); + g_clear_object (&async_result); + + g_clear_object (&client); + g_clear_object (&socket); + g_clear_object (&address); +} + int main (int argc, char *argv[]) { @@ -181,7 +246,7 @@ main (int argc, char *argv[]) g_test_add_func ("/socket-client/happy-eyeballs/slow", test_happy_eyeballs); g_test_add_func ("/socket-client/happy-eyeballs/cancellation/instant", test_happy_eyeballs_cancel_instant); g_test_add_func ("/socket-client/happy-eyeballs/cancellation/delayed", test_happy_eyeballs_cancel_delayed); - + g_test_add_func ("/socket-client/connection-fail", test_connection_failed); return g_test_run (); } diff --git a/girepository/compiler/compiler.c b/girepository/compiler/compiler.c index c786d4f5e..e9b1b1563 100644 --- a/girepository/compiler/compiler.c +++ b/girepository/compiler/compiler.c @@ -218,6 +218,7 @@ main (int argc, char **argv) char *message = g_strdup_printf (_("Error parsing file ‘%s’: %s"), input[0], error->message); g_fprintf (stderr, "%s\n", message); g_free (message); + gi_ir_parser_free (parser); return 1; } @@ -253,10 +254,7 @@ main (int argc, char **argv) g_debug ("[building] done"); -#if 0 - /* No point */ gi_ir_parser_free (parser); -#endif return 0; } diff --git a/girepository/gdump.c b/girepository/gdump.c index 2388626d8..d04f2fe76 100644 --- a/girepository/gdump.c +++ b/girepository/gdump.c @@ -448,6 +448,13 @@ dump_boxed_type (GType type, const char *symbol, FILE *out) } static void +dump_pointer_type (GType type, const char *symbol, FILE *out) +{ + escaped_printf (out, " <pointer name=\"%s\" get-type=\"%s\"/>\n", + g_type_name (type), symbol); +} + +static void dump_flags_type (GType type, const char *symbol, FILE *out) { unsigned int i; @@ -562,7 +569,7 @@ dump_type (GType type, const char *symbol, FILE *out) dump_enum_type (type, symbol, out); break; case G_TYPE_POINTER: - /* GValue, etc. Just skip them. */ + dump_pointer_type (type, symbol, out); break; default: dump_fundamental_type (type, symbol, out); diff --git a/girepository/girepository-private.h b/girepository/girepository-private.h index 8ff312365..29156c5b4 100644 --- a/girepository/girepository-private.h +++ b/girepository/girepository-private.h @@ -57,7 +57,8 @@ struct _GIBaseInfo GITypelib *typelib; uint32_t offset; - uint32_t type_is_embedded : 1; /* Used by GITypeInfo */ + unsigned int type_is_embedded : 1; /* Used by GITypeInfo */ + unsigned int padding_bitfield : 31; /* For future expansion */ /* A copy of GIBaseInfo is exposed publicly for stack-allocated derivatives * such as GITypeInfo, so its size is now ABI. */ diff --git a/girepository/girepository.c b/girepository/girepository.c index 24d83ca25..a6a81716d 100644 --- a/girepository/girepository.c +++ b/girepository/girepository.c @@ -30,6 +30,7 @@ #include <stdlib.h> #include <glib.h> +#include <glib-private.h> #include <glib/gprintf.h> #include <gmodule.h> #include "gibaseinfo-private.h" @@ -65,6 +66,23 @@ * The environment variable takes precedence over the default search path * and the [method@GIRepository.Repository.prepend_search_path] calls. * + * ### Namespace ordering + * + * In situations where namespaces may be searched in order, or returned in a + * list, the namespaces will be returned in alphabetical order, with all fully + * loaded namespaces being returned before any lazily loaded ones (those loaded + * with `GI_REPOSITORY_LOAD_FLAG_LAZY`). This allows for deterministic and + * reproducible results. + * + * Similarly, if a symbol (such as a `GType` or error domain) is being searched + * for in the set of loaded namespaces, the namespaces will be searched in that + * order. In particular, this means that a symbol which exists in two namespaces + * will always be returned from the alphabetically-higher namespace. This should + * only happen in the case of `Gio` and `GioUnix`/`GioWin32`, which all refer to + * the same `.so` file and expose overlapping sets of symbols. Symbols should + * always end up being resolved to `GioUnix` or `GioWin32` if they are platform + * dependent, rather than `Gio` itself. + * * Since: 2.80 */ @@ -98,8 +116,14 @@ struct _GIRepository GPtrArray *typelib_search_path; /* (element-type filename) (owned) */ GPtrArray *library_paths; /* (element-type filename) (owned) */ + /* Certain operations require iterating over the typelibs and the iteration + * order may affect the results. So keep an ordered list of the typelibs, + * alongside the hash table which keep the canonical strong reference to them. */ GHashTable *typelibs; /* (string) namespace -> GITypelib */ + GPtrArray *ordered_typelibs; /* (element-type unowned GITypelib) (owned) (not nullable) */ GHashTable *lazy_typelibs; /* (string) namespace-version -> GITypelib */ + GPtrArray *ordered_lazy_typelibs; /* (element-type unowned GITypelib) (owned) (not nullable) */ + GHashTable *info_by_gtype; /* GType -> GIBaseInfo */ GHashTable *info_by_error_domain; /* GQuark -> GIBaseInfo */ GHashTable *interfaces_for_gtype; /* GType -> GTypeInterfaceCache */ @@ -112,7 +136,6 @@ struct _GIRepository G_DEFINE_TYPE (GIRepository, gi_repository, G_TYPE_OBJECT); #ifdef G_PLATFORM_WIN32 - #include <windows.h> static HMODULE girepository_dll = NULL; @@ -132,19 +155,117 @@ DllMain (HINSTANCE hinstDLL, return TRUE; } -#endif +#endif /* DLL_EXPORT */ +#endif /* G_PLATFORM_WIN32 */ -#undef GOBJECT_INTROSPECTION_LIBDIR +#ifdef __APPLE__ +#include <mach-o/dyld.h> -/* GOBJECT_INTROSPECTION_LIBDIR is used only in code called just once, - * so no problem leaking this - */ -#define GOBJECT_INTROSPECTION_LIBDIR \ - g_build_filename (g_win32_get_package_installation_directory_of_module (girepository_dll), \ - "lib", \ - NULL) +/* This function returns the file path of the loaded libgirepository1.0.dylib. + * It iterates over all the loaded images to find the one with the + * gi_repository_init symbol and returns its file path. + */ +static const char * +gi_repository_get_library_path_macos (void) +{ + /* + * Relevant documentation: + * https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/MachOTopics/0-Introduction/introduction.html + * https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dyld.3.html + * https://opensource.apple.com/source/xnu/xnu-2050.18.24/EXTERNAL_HEADERS/mach-o/loader.h + */ + const void *ptr = gi_repository_init; + const struct mach_header *header; + intptr_t offset; + uint32_t i, count; + + /* Iterate over all the loaded images */ + count = _dyld_image_count (); + for (i = 0; i < count; i++) + { + header = _dyld_get_image_header (i); + offset = _dyld_get_image_vmaddr_slide (i); + + /* Locate the first `load` command */ + struct load_command *cmd = (struct load_command *) ((char *) header + sizeof (struct mach_header)); + if (header->magic == MH_MAGIC_64) + cmd = (struct load_command *) ((char *) header + sizeof (struct mach_header_64)); + /* Find the first `segment` command iterating over all the `load` commands. + * Then, check if the gi_repository_init symbol is in this image by checking + * if the pointer is in the segment's memory address range. + */ + uint32_t j = 0; + while (j < header->ncmds) + { + if (cmd->cmd == LC_SEGMENT) + { + struct segment_command *seg = (struct segment_command *) cmd; + if (((intptr_t) ptr >= (seg->vmaddr + offset)) && ((intptr_t) ptr < (seg->vmaddr + offset + seg->vmsize))) + return _dyld_get_image_name (i); + } + if (cmd->cmd == LC_SEGMENT_64) + { + struct segment_command_64 *seg = (struct segment_command_64 *) cmd; + if (((uintptr_t ) ptr >= (seg->vmaddr + offset)) && ((uintptr_t ) ptr < (seg->vmaddr + offset + seg->vmsize))) + return _dyld_get_image_name (i); + } + /* Jump to the next command */ + j++; + cmd = (struct load_command *) ((char *) cmd + cmd->cmdsize); + } + } + return NULL; +} +#endif /* __APPLE__ */ + +/* + * gi_repository_get_libdir: + * + * Returns the directory where the typelib files are installed. + * + * In platforms without relocation support, this functions returns the + * `GOBJECT_INTROSPECTION_LIBDIR` directory defined at build time . + * + * On Windows and macOS this function returns the directory + * relative to the installation directory detected at runtime. + * + * On macOS, if the library is installed in + * `/Applications/MyApp.app/Contents/Home/lib/libgirepository-1.0.dylib`, it returns + * `/Applications/MyApp.app/Contents/Home/lib/girepository-1.0` + * + * On Windows, if the application is installed in + * `C:/Program Files/MyApp/bin/MyApp.exe`, it returns + * `C:/Program Files/MyApp/lib/girepository-1.0` +*/ +static const gchar * +gi_repository_get_libdir (void) +{ + static gchar *static_libdir; + + if (g_once_init_enter_pointer (&static_libdir)) + { + gchar *libdir; +#if defined(G_PLATFORM_WIN32) + const char *toplevel = g_win32_get_package_installation_directory_of_module (girepository_dll); + libdir = g_build_filename (toplevel, GOBJECT_INTROSPECTION_RELATIVE_LIBDIR, NULL); + g_ignore_leak (libdir); +#elif defined(__APPLE__) + const char *libpath = gi_repository_get_library_path_macos (); + if (libpath != NULL) + { + libdir = g_path_get_dirname (libpath); + g_ignore_leak (libdir); + } else { + libdir = GOBJECT_INTROSPECTION_LIBDIR; + } +#else /* !G_PLATFORM_WIN32 && !__APPLE__ */ + libdir = GOBJECT_INTROSPECTION_LIBDIR; #endif + g_once_init_leave_pointer (&static_libdir, libdir); + } + return static_libdir; +} static void gi_repository_init (GIRepository *repository) @@ -174,7 +295,7 @@ gi_repository_init (GIRepository *repository) repository->typelib_search_path = g_ptr_array_new_null_terminated (1, g_free, TRUE); } - libdir = GOBJECT_INTROSPECTION_LIBDIR; + libdir = gi_repository_get_libdir (); typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL); @@ -187,10 +308,13 @@ gi_repository_init (GIRepository *repository) = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) gi_typelib_unref); + repository->ordered_typelibs = g_ptr_array_new_with_free_func (NULL); repository->lazy_typelibs = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) gi_typelib_unref); + repository->ordered_lazy_typelibs = g_ptr_array_new_with_free_func (NULL); + repository->info_by_gtype = g_hash_table_new_full (g_direct_hash, g_direct_equal, (GDestroyNotify) NULL, @@ -212,7 +336,10 @@ gi_repository_finalize (GObject *object) GIRepository *repository = GI_REPOSITORY (object); g_hash_table_destroy (repository->typelibs); + g_ptr_array_unref (repository->ordered_typelibs); g_hash_table_destroy (repository->lazy_typelibs); + g_ptr_array_unref (repository->ordered_lazy_typelibs); + g_hash_table_destroy (repository->info_by_gtype); g_hash_table_destroy (repository->info_by_error_domain); g_hash_table_destroy (repository->interfaces_for_gtype); @@ -497,6 +624,29 @@ load_dependencies_recurse (GIRepository *repository, return TRUE; } +/* Sort typelibs by namespace. The main requirement here is just to make iteration + * deterministic, otherwise results can change as a lot of the code here would + * just iterate over a `GHashTable`. + * + * A sub-requirement of this is that namespaces are sorted such that if a GType + * or symbol is found in multiple namespaces where one is a prefix of the other, + * the longest namespace wins. In practice, this only happens in + * Gio/GioUnix/GioWin32, as all three of those namespaces refer to the same + * `.so` file and overlapping sets of the same symbols, but we want the platform + * specific namespace to be returned in preference to anything else (even though + * either namespace is valid). + * See https://gitlab.gnome.org/GNOME/glib/-/issues/3303 */ +static int +sort_typelibs_cb (const void *a, + const void *b) +{ + GITypelib *typelib_a = *(GITypelib **) a; + GITypelib *typelib_b = *(GITypelib **) b; + + return strcmp (gi_typelib_get_namespace (typelib_a), + gi_typelib_get_namespace (typelib_b)); +} + static const char * register_internal (GIRepository *repository, const char *source, @@ -507,11 +657,11 @@ register_internal (GIRepository *repository, Header *header; const char *namespace; - g_return_val_if_fail (typelib != NULL, FALSE); + g_return_val_if_fail (typelib != NULL, NULL); header = (Header *)typelib->data; - g_return_val_if_fail (header != NULL, FALSE); + g_return_val_if_fail (header != NULL, NULL); namespace = gi_typelib_get_string (typelib, header->namespace); @@ -521,6 +671,8 @@ register_internal (GIRepository *repository, namespace)); g_hash_table_insert (repository->lazy_typelibs, build_typelib_key (namespace, source), gi_typelib_ref (typelib)); + g_ptr_array_add (repository->ordered_lazy_typelibs, typelib); + g_ptr_array_sort (repository->ordered_lazy_typelibs, sort_typelibs_cb); } else { @@ -535,13 +687,20 @@ register_internal (GIRepository *repository, if (g_hash_table_lookup_extended (repository->lazy_typelibs, namespace, (gpointer)&key, &value)) - g_hash_table_remove (repository->lazy_typelibs, key); + { + g_hash_table_remove (repository->lazy_typelibs, key); + g_ptr_array_remove (repository->ordered_lazy_typelibs, typelib); + } else - key = build_typelib_key (namespace, source); + { + key = build_typelib_key (namespace, source); + } g_hash_table_insert (repository->typelibs, g_steal_pointer (&key), gi_typelib_ref (typelib)); + g_ptr_array_add (repository->ordered_typelibs, typelib); + g_ptr_array_sort (repository->ordered_typelibs, sort_typelibs_cb); } /* These types might be resolved now, clear the cache */ @@ -870,32 +1029,29 @@ gi_repository_get_info (GIRepository *repository, NULL, typelib, entry->offset); } -typedef struct { - const char *gtype_name; - GITypelib *result_typelib; -} FindByGTypeData; - static DirEntry * -find_by_gtype (GHashTable *table, FindByGTypeData *data, gboolean check_prefix) +find_by_gtype (GPtrArray *ordered_table, + const char *gtype_name, + gboolean check_prefix, + GITypelib **out_result_typelib) { - GHashTableIter iter; - gpointer key, value; - DirEntry *ret; - - g_hash_table_iter_init (&iter, table); - while (g_hash_table_iter_next (&iter, &key, &value)) + /* Search in reverse order as the longest namespaces will be listed last, and + * those are the ones we want to search first. */ + for (guint i = ordered_table->len; i > 0; i--) { - GITypelib *typelib = (GITypelib*)value; + GITypelib *typelib = g_ptr_array_index (ordered_table, i - 1); + DirEntry *ret; + if (check_prefix) { - if (!gi_typelib_matches_gtype_name_prefix (typelib, data->gtype_name)) + if (!gi_typelib_matches_gtype_name_prefix (typelib, gtype_name)) continue; } - ret = gi_typelib_get_dir_entry_by_gtype_name (typelib, data->gtype_name); + ret = gi_typelib_get_dir_entry_by_gtype_name (typelib, gtype_name); if (ret) { - data->result_typelib = typelib; + *out_result_typelib = typelib; return ret; } } @@ -924,7 +1080,8 @@ GIBaseInfo * gi_repository_find_by_gtype (GIRepository *repository, GType gtype) { - FindByGTypeData data; + const char *gtype_name; + GITypelib *result_typelib = NULL; GIBaseInfo *cached; DirEntry *entry; @@ -940,8 +1097,7 @@ gi_repository_find_by_gtype (GIRepository *repository, if (g_hash_table_contains (repository->unknown_gtypes, (gpointer)gtype)) return NULL; - data.gtype_name = g_type_name (gtype); - data.result_typelib = NULL; + gtype_name = g_type_name (gtype); /* Inside each typelib, we include the "C prefix" which acts as * a namespace mechanism. For GtkTreeView, the C prefix is Gtk. @@ -950,25 +1106,25 @@ gi_repository_find_by_gtype (GIRepository *repository, * target type does not have this typelib's C prefix. Use this * assumption as our first attempt at locating the DirEntry. */ - entry = find_by_gtype (repository->typelibs, &data, TRUE); + entry = find_by_gtype (repository->ordered_typelibs, gtype_name, TRUE, &result_typelib); if (entry == NULL) - entry = find_by_gtype (repository->lazy_typelibs, &data, TRUE); + entry = find_by_gtype (repository->ordered_lazy_typelibs, gtype_name, TRUE, &result_typelib); - /* Not ever class library necessarily specifies a correct c_prefix, + /* Not every class library necessarily specifies a correct c_prefix, * so take a second pass. This time we will try a global lookup, * ignoring prefixes. * See http://bugzilla.gnome.org/show_bug.cgi?id=564016 */ if (entry == NULL) - entry = find_by_gtype (repository->typelibs, &data, FALSE); + entry = find_by_gtype (repository->ordered_typelibs, gtype_name, FALSE, &result_typelib); if (entry == NULL) - entry = find_by_gtype (repository->lazy_typelibs, &data, FALSE); + entry = find_by_gtype (repository->ordered_lazy_typelibs, gtype_name, FALSE, &result_typelib); if (entry != NULL) { cached = gi_info_new_full (gi_typelib_blob_type_to_info_type (entry->blob_type), repository, - NULL, data.result_typelib, entry->offset); + NULL, result_typelib, entry->offset); g_hash_table_insert (repository->info_by_gtype, (gpointer) gtype, @@ -1020,28 +1176,27 @@ gi_repository_find_by_name (GIRepository *repository, NULL, typelib, entry->offset); } -typedef struct { - GIRepository *repository; - GQuark domain; - - GITypelib *result_typelib; - DirEntry *result; -} FindByErrorDomainData; - -static void -find_by_error_domain_foreach (gpointer key, - gpointer value, - gpointer datap) +static DirEntry * +find_by_error_domain (GPtrArray *ordered_typelibs, + GQuark target_domain, + GITypelib **out_typelib) { - GITypelib *typelib = (GITypelib*)value; - FindByErrorDomainData *data = datap; + /* Search in reverse order as the longest namespaces will be listed last, and + * those are the ones we want to search first. */ + for (guint i = ordered_typelibs->len; i > 0; i--) + { + GITypelib *typelib = g_ptr_array_index (ordered_typelibs, i - 1); + DirEntry *entry; - if (data->result != NULL) - return; + entry = gi_typelib_get_dir_entry_by_error_domain (typelib, target_domain); + if (entry != NULL) + { + *out_typelib = typelib; + return entry; + } + } - data->result = gi_typelib_get_dir_entry_by_error_domain (typelib, data->domain); - if (data->result) - data->result_typelib = typelib; + return NULL; } /** @@ -1064,8 +1219,9 @@ GIEnumInfo * gi_repository_find_by_error_domain (GIRepository *repository, GQuark domain) { - FindByErrorDomainData data; GIEnumInfo *cached; + DirEntry *result = NULL; + GITypelib *result_typelib = NULL; g_return_val_if_fail (GI_IS_REPOSITORY (repository), NULL); @@ -1075,20 +1231,15 @@ gi_repository_find_by_error_domain (GIRepository *repository, if (cached != NULL) return (GIEnumInfo *) gi_base_info_ref ((GIBaseInfo *)cached); - data.repository = repository; - data.domain = domain; - data.result_typelib = NULL; - data.result = NULL; - - g_hash_table_foreach (repository->typelibs, find_by_error_domain_foreach, &data); - if (data.result == NULL) - g_hash_table_foreach (repository->lazy_typelibs, find_by_error_domain_foreach, &data); + result = find_by_error_domain (repository->ordered_typelibs, domain, &result_typelib); + if (result == NULL) + result = find_by_error_domain (repository->ordered_lazy_typelibs, domain, &result_typelib); - if (data.result != NULL) + if (result != NULL) { - cached = (GIEnumInfo *) gi_info_new_full (gi_typelib_blob_type_to_info_type (data.result->blob_type), + cached = (GIEnumInfo *) gi_info_new_full (gi_typelib_blob_type_to_info_type (result->blob_type), repository, - NULL, data.result_typelib, data.result->offset); + NULL, result_typelib, result->offset); g_hash_table_insert (repository->info_by_error_domain, GUINT_TO_POINTER (domain), @@ -1179,13 +1330,16 @@ gi_repository_get_object_gtype_interfaces (GIRepository *repository, } static void -collect_namespaces (gpointer key, - gpointer value, - gpointer data) +collect_namespaces (GPtrArray *ordered_typelibs, + char **names, + size_t *inout_i) { - GList **list = data; - - *list = g_list_append (*list, key); + for (guint j = 0; j < ordered_typelibs->len; j++) + { + GITypelib *typelib = g_ptr_array_index (ordered_typelibs, j); + const char *namespace = gi_typelib_get_namespace (typelib); + names[(*inout_i)++] = g_strdup (namespace); + } } /** @@ -1207,20 +1361,18 @@ char ** gi_repository_get_loaded_namespaces (GIRepository *repository, size_t *n_namespaces_out) { - GList *l, *list = NULL; char **names; size_t i; + size_t n_typelibs; g_return_val_if_fail (GI_IS_REPOSITORY (repository), NULL); - g_hash_table_foreach (repository->typelibs, collect_namespaces, &list); - g_hash_table_foreach (repository->lazy_typelibs, collect_namespaces, &list); - - names = g_malloc0 (sizeof (char *) * (g_list_length (list) + 1)); + n_typelibs = repository->ordered_typelibs->len + repository->ordered_lazy_typelibs->len; + names = g_malloc0 (sizeof (char *) * (n_typelibs + 1)); i = 0; - for (l = list; l; l = l->next) - names[i++] = g_strdup (l->data); - g_list_free (list); + + collect_namespaces (repository->ordered_typelibs, names, &i); + collect_namespaces (repository->ordered_lazy_typelibs, names, &i); if (n_namespaces_out != NULL) *n_namespaces_out = i; @@ -1755,7 +1907,7 @@ require_internal (GIRepository *repository, char *tmp_version = NULL; g_return_val_if_fail (GI_IS_REPOSITORY (repository), NULL); - g_return_val_if_fail (namespace != NULL, FALSE); + g_return_val_if_fail (namespace != NULL, NULL); typelib = get_registered_status (repository, namespace, version, allow_lazy, &is_lazy, &version_conflict); diff --git a/girepository/girmodule-private.h b/girepository/girmodule-private.h index c3cb9df2a..c6b9f413c 100644 --- a/girepository/girmodule-private.h +++ b/girepository/girmodule-private.h @@ -47,7 +47,7 @@ struct _GIIrModule char *version; char *shared_library; char *c_prefix; - GList *dependencies; + GPtrArray *dependencies; /* (owned) */ GList *entries; /* All modules that are included directly or indirectly */ diff --git a/girepository/girmodule.c b/girepository/girmodule.c index e595f7a46..87bb13ad3 100644 --- a/girepository/girmodule.c +++ b/girepository/girmodule.c @@ -75,12 +75,15 @@ gi_ir_module_free (GIIrModule *module) GList *e; g_free (module->name); + g_free (module->version); + g_free (module->shared_library); + g_free (module->c_prefix); for (e = module->entries; e; e = e->next) gi_ir_node_free ((GIIrNode *)e->data); g_list_free (module->entries); - /* Don't free dependencies, we inherit that from the parser */ + g_clear_pointer (&module->dependencies, g_ptr_array_unref); g_list_free (module->include_modules); @@ -348,35 +351,39 @@ gi_ir_module_build_typelib (GIIrModule *module) /* Serialize dependencies into one string; this is convenient * and not a major change to the typelib format. */ - { - GString *dependencies_str = g_string_new (""); - GList *link; - for (link = module->dependencies; link; link = link->next) - { - const char *dependency = link->data; - if (!strcmp (dependency, module->name)) - continue; - g_string_append (dependencies_str, dependency); - if (link->next) - g_string_append_c (dependencies_str, '|'); - } - dependencies = g_string_free (dependencies_str, FALSE); - if (!dependencies[0]) - { - g_free (dependencies); - dependencies = NULL; - } - } + if (module->dependencies->len) + { + GString *dependencies_str = g_string_new (NULL); + for (guint i = module->dependencies->len; i > 0; --i) + { + const char *dependency = g_ptr_array_index (module->dependencies, i-1); + if (!strcmp (dependency, module->name)) + continue; + g_string_append (dependencies_str, dependency); + if (i > 1) + g_string_append_c (dependencies_str, '|'); + } + dependencies = g_string_free (dependencies_str, FALSE); + if (dependencies && !dependencies[0]) + { + g_free (dependencies); + dependencies = NULL; + } + } + else + { + dependencies = NULL; + } restart: gi_ir_node_init_stats (); strings = g_hash_table_new (g_str_hash, g_str_equal); - types = g_hash_table_new (g_str_hash, g_str_equal); + types = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); nodes_with_attributes = NULL; n_entries = g_list_length (module->entries); - g_message ("%d entries (%d local), %d dependencies", n_entries, n_local_entries, - g_list_length (module->dependencies)); + g_message ("%d entries (%d local), %u dependencies", n_entries, n_local_entries, + module->dependencies ? module->dependencies->len : 0); dir_size = n_entries * sizeof (DirEntry); size = header_size + dir_size; @@ -478,7 +485,6 @@ gi_ir_module_build_typelib (GIIrModule *module) for (e = module->entries, i = 0; e; e = e->next, i++) { - GIIrTypelibBuild build; GIIrNode *node = e->data; if (strchr (node->name, '.')) @@ -521,6 +527,7 @@ gi_ir_module_build_typelib (GIIrModule *module) } else { + GIIrTypelibBuild build = {0}; old_offset = offset; offset2 = offset + gi_ir_node_get_size (node); @@ -529,7 +536,6 @@ gi_ir_module_build_typelib (GIIrModule *module) entry->offset = offset; entry->name = gi_ir_write_string (node->name, strings, data, &offset2); - memset (&build, 0, sizeof (build)); build.module = module; build.strings = strings; build.types = types; @@ -537,6 +543,7 @@ gi_ir_module_build_typelib (GIIrModule *module) build.n_attributes = header->n_attributes; build.data = data; gi_ir_node_build_typelib (node, NULL, &build, &offset, &offset2, NULL); + g_clear_list (&build.stack, NULL); nodes_with_attributes = build.nodes_with_attributes; header->n_attributes = build.n_attributes; @@ -589,6 +596,7 @@ gi_ir_module_build_typelib (GIIrModule *module) g_hash_table_destroy (strings); g_hash_table_destroy (types); g_list_free (nodes_with_attributes); + g_free (dependencies); return typelib; } diff --git a/girepository/girnode.c b/girepository/girnode.c index b3ea89323..aacc2a0d3 100644 --- a/girepository/girnode.c +++ b/girepository/girnode.c @@ -415,10 +415,8 @@ gi_ir_node_free (GIIrNode *node) g_free (union_->free_func); gi_ir_node_free ((GIIrNode *)union_->discriminator_type); - for (l = union_->members; l; l = l->next) - gi_ir_node_free ((GIIrNode *)l->data); - for (l = union_->discriminators; l; l = l->next) - gi_ir_node_free ((GIIrNode *)l->data); + g_clear_list (&union_->members, (GDestroyNotify) gi_ir_node_free); + g_clear_list (&union_->discriminators, (GDestroyNotify) gi_ir_node_free); } break; @@ -1460,24 +1458,23 @@ gi_ir_node_build_typelib (GIIrNode *node, else { GString *str; - char *s; gpointer value; str = g_string_new (0); serialize_type (build, type, str); - s = g_string_free (str, FALSE); types_count += 1; - value = g_hash_table_lookup (types, s); + value = g_hash_table_lookup (types, str->str); if (value) { blob->offset = GPOINTER_TO_UINT (value); - g_free (s); + g_string_free (g_steal_pointer (&str), TRUE); } else { unique_types_count += 1; - g_hash_table_insert (types, s, GUINT_TO_POINTER(*offset2)); + g_hash_table_insert (types, g_string_free_and_steal (g_steal_pointer (&str)), + GUINT_TO_POINTER(*offset2)); blob->offset = *offset2; switch (type->tag) diff --git a/girepository/girparser.c b/girepository/girparser.c index dee322b50..dd0fb48b2 100644 --- a/girepository/girparser.c +++ b/girepository/girparser.c @@ -28,6 +28,7 @@ #include "girnode-private.h" #include "gitypelib-internal.h" +#include "glib-private.h" #include <stdlib.h> #include <string.h> @@ -120,7 +121,7 @@ struct _ParseContext GList *modules; GList *include_modules; - GList *dependencies; + GPtrArray *dependencies; GHashTable *aliases; GHashTable *disguised_structures; GHashTable *pointer_structures; @@ -212,13 +213,10 @@ gi_ir_parser_set_debug (GIIrParser *parser, void gi_ir_parser_free (GIIrParser *parser) { - GList *l; - g_strfreev (parser->includes); g_strfreev (parser->gi_gir_path); - for (l = parser->parsed_modules; l; l = l->next) - gi_ir_module_free (l->data); + g_clear_list (&parser->parsed_modules, (GDestroyNotify) gi_ir_module_free); g_slice_free (GIIrParser, parser); } @@ -454,30 +452,24 @@ typedef struct { unsigned int is_signed : 1; } IntegerAliasInfo; -/* - * signedness: - * @T: a numeric type - * - * Returns: 1 if @T is signed, 0 if it is unsigned - */ -#define signedness(T) (((T) -1) <= 0) -G_STATIC_ASSERT (signedness (int) == 1); -G_STATIC_ASSERT (signedness (unsigned int) == 0); - static IntegerAliasInfo integer_aliases[] = { - { "gchar", sizeof (gchar), 1 }, - { "guchar", sizeof (guchar), 0 }, - { "gshort", sizeof (gshort), 1 }, - { "gushort", sizeof (gushort), 0 }, - { "gint", sizeof (gint), 1 }, - { "guint", sizeof (guint), 0 }, - { "glong", sizeof (glong), 1 }, - { "gulong", sizeof (gulong), 0 }, - { "gssize", sizeof (gssize), 1 }, - { "gsize", sizeof (gsize), 0 }, - { "gintptr", sizeof (gintptr), 1 }, - { "guintptr", sizeof (guintptr), 0 }, -#define INTEGER_ALIAS(T) { #T, sizeof (T), signedness (T) } + /* It is platform-dependent whether gchar is signed or unsigned, but + * GObject-Introspection has traditionally treated it as signed, + * so continue to hard-code that instead of using INTEGER_ALIAS */ + { "gchar", sizeof (gchar), 1 }, + +#define INTEGER_ALIAS(T) { #T, sizeof (T), G_SIGNEDNESS_OF (T) } + INTEGER_ALIAS (guchar), + INTEGER_ALIAS (gshort), + INTEGER_ALIAS (gushort), + INTEGER_ALIAS (gint), + INTEGER_ALIAS (guint), + INTEGER_ALIAS (glong), + INTEGER_ALIAS (gulong), + INTEGER_ALIAS (gssize), + INTEGER_ALIAS (gsize), + INTEGER_ALIAS (gintptr), + INTEGER_ALIAS (guintptr), INTEGER_ALIAS (off_t), INTEGER_ALIAS (time_t), #ifdef G_OS_UNIX @@ -1353,8 +1345,6 @@ start_parameter (GMarkupParseContext *context, param->closure = closure ? atoi (closure) : -1; param->destroy = destroy ? atoi (destroy) : -1; - ((GIIrNode *)param)->name = g_strdup (name); - switch (CURRENT_NODE (ctx)->type) { case GI_IR_NODE_FUNCTION: @@ -3106,9 +3096,8 @@ start_element_handler (GMarkupParseContext *context, return; } - ctx->dependencies = g_list_prepend (ctx->dependencies, - g_strdup_printf ("%s-%s", name, version)); - + g_ptr_array_insert (ctx->dependencies, 0, + g_strdup_printf ("%s-%s", name, version)); state_switch (ctx, STATE_INCLUDE); goto out; @@ -3196,7 +3185,12 @@ start_element_handler (GMarkupParseContext *context, ctx->include_modules = NULL; ctx->modules = g_list_append (ctx->modules, ctx->current_module); - ctx->current_module->dependencies = ctx->dependencies; + + if (ctx->current_module->dependencies != ctx->dependencies) + { + g_clear_pointer (&ctx->current_module->dependencies, g_ptr_array_unref); + ctx->current_module->dependencies = g_ptr_array_ref (ctx->dependencies); + } state_switch (ctx, STATE_NAMESPACE); goto out; @@ -3378,13 +3372,19 @@ state_switch_end_struct_or_union (GMarkupParseContext *context, const char *element_name, GError **error) { - pop_node (ctx); + GIIrNode *node = pop_node (ctx); + if (ctx->node_stack == NULL) { state_switch (ctx, STATE_NAMESPACE); } else { + /* In this case the node was not tracked by any other node, so we need + * to free the node, or we'd leak. + */ + g_clear_pointer (&node, gi_ir_node_free); + if (CURRENT_NODE (ctx)->type == GI_IR_NODE_STRUCT) state_switch (ctx, STATE_STRUCT); else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_UNION) @@ -3736,6 +3736,8 @@ cleanup (GMarkupParseContext *context, ParseContext *ctx = user_data; GList *m; + g_clear_slist (&ctx->node_stack, NULL); + for (m = ctx->modules; m; m = m->next) gi_ir_module_free (m->data); g_list_free (ctx->modules); @@ -3770,6 +3772,7 @@ gi_ir_parser_parse_string (GIIrParser *parser, { ParseContext ctx = { 0 }; GMarkupParseContext *context; + GIIrModule *module = NULL; ctx.parser = parser; ctx.state = STATE_START; @@ -3780,7 +3783,7 @@ gi_ir_parser_parse_string (GIIrParser *parser, ctx.disguised_structures = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); ctx.pointer_structures = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); ctx.type_depth = 0; - ctx.dependencies = NULL; + ctx.dependencies = g_ptr_array_new_with_free_func (g_free); ctx.current_module = NULL; context = g_markup_parse_context_new (&firstpass_parser, 0, &ctx, NULL); @@ -3801,12 +3804,15 @@ gi_ir_parser_parse_string (GIIrParser *parser, if (!g_markup_parse_context_end_parse (context, error)) goto out; - parser->parsed_modules = g_list_concat (g_list_copy (ctx.modules), + if (ctx.modules) + module = ctx.modules->data; + + parser->parsed_modules = g_list_concat (g_steal_pointer (&ctx.modules), parser->parsed_modules); out: - if (ctx.modules == NULL) + if (module == NULL) { /* An error occurred before we created a module, so we haven't * transferred ownership of these hash tables to the module. @@ -3814,13 +3820,16 @@ gi_ir_parser_parse_string (GIIrParser *parser, g_clear_pointer (&ctx.aliases, g_hash_table_unref); g_clear_pointer (&ctx.disguised_structures, g_hash_table_unref); g_clear_pointer (&ctx.pointer_structures, g_hash_table_unref); + g_clear_list (&ctx.modules, (GDestroyNotify) gi_ir_module_free); g_list_free (ctx.include_modules); } + g_clear_slist (&ctx.node_stack, NULL); + g_clear_pointer (&ctx.dependencies, g_ptr_array_unref); g_markup_parse_context_free (context); - if (ctx.modules) - return ctx.modules->data; + if (module) + return module; if (error && *error == NULL) g_set_error (error, diff --git a/girepository/gitypelib.c b/girepository/gitypelib.c index 3c88a79e6..57411a86b 100644 --- a/girepository/gitypelib.c +++ b/girepository/gitypelib.c @@ -316,7 +316,8 @@ strsplit_iter_next (StrSplitIter *iter, } else { - g_string_overwrite_len (&iter->buf, 0, s, (gssize)len); + g_string_overwrite_len (&iter->buf, 0, s, (gssize)len + 1); + iter->buf.str[len] = '\0'; *out_val = iter->buf.str; } return TRUE; diff --git a/girepository/introspection/meson.build b/girepository/introspection/meson.build index 0a217e75f..13c99f3b6 100644 --- a/girepository/introspection/meson.build +++ b/girepository/introspection/meson.build @@ -27,6 +27,7 @@ glib_gir_sources = [ glib_types_h, glib_deprecated_sources, glib_sources, + files('../../glib/docs.c'), ] # For API compatibility reasons, GLib-2.0.gir needs to contain the platform @@ -268,6 +269,7 @@ if host_system == 'windows' '--identifier-prefix=GWin32' ], ) + gio_platform_gir = gio_win32_gir else gio_unix_gir_c_includes = [] foreach h: gio_unix_include_headers @@ -297,6 +299,7 @@ else '--identifier-prefix=GUnix' ], ) + gio_platform_gir = gio_unix_gir endif # GIRepository diff --git a/girepository/meson.build b/girepository/meson.build index 3a17cf5c8..dc02cf15e 100644 --- a/girepository/meson.build +++ b/girepository/meson.build @@ -85,6 +85,7 @@ gir_c_args = [ '-DGIR_DIR="@0@"'.format(glib_girdir), '-DGOBJECT_INTROSPECTION_LIBDIR="@0@"'.format(glib_libdir), '-DGOBJECT_INTROSPECTION_DATADIR="@0@"'.format(glib_datadir), + '-DGOBJECT_INTROSPECTION_RELATIVE_LIBDIR="@0@"'.format(get_option('libdir')), ] custom_c_args = [] @@ -240,6 +241,8 @@ pkg.generate(libgirepository, libraries: [libglib_dep, libgobject_dep], ) +subdir('compiler') + if enable_gir subdir('introspection') endif @@ -248,6 +251,5 @@ if build_tests subdir('tests') endif -subdir('compiler') subdir('decompiler') -subdir('inspector')
\ No newline at end of file +subdir('inspector') diff --git a/girepository/tests/dump.c b/girepository/tests/dump.c new file mode 100644 index 000000000..7c8683914 --- /dev/null +++ b/girepository/tests/dump.c @@ -0,0 +1,182 @@ +/* + * Copyright 2024 GNOME Foundation + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" + +#include <glib.h> +#include <glib/gstdio.h> + +#include "girepository.h" +#include "test-common.h" + +/* Dummy GTypes which can be introspected by the dumper. */ + +/* Dummy object type with no properties or signals. */ +struct _TestObject +{ + GObject parent_instance; +}; + +#define TEST_TYPE_OBJECT test_object_get_type () +G_MODULE_EXPORT G_DECLARE_FINAL_TYPE (TestObject, test_object, TEST, OBJECT, GObject) +G_DEFINE_FINAL_TYPE (TestObject, test_object, G_TYPE_OBJECT) + +static void +test_object_class_init (TestObjectClass *klass) +{ +} + +static void +test_object_init (TestObject *self) +{ +} + +/* Dummy interface type with no properties or signals. */ +struct _TestInterfaceInterface +{ + GTypeInterface g_iface; +}; + +#define TEST_TYPE_INTERFACE test_interface_get_type () +G_MODULE_EXPORT G_DECLARE_INTERFACE (TestInterface, test_interface, TEST, INTERFACE, GObject) +G_DEFINE_INTERFACE (TestInterface, test_interface, G_TYPE_OBJECT) + +static void +test_interface_default_init (TestInterfaceInterface *iface) +{ +} + +/* Test functions */ +static void +assert_dump (const char *input, + const char *expected_output) +{ + int fd = -1; + char *in_file_path = NULL; + char *out_file_path = NULL; + char *output = NULL; + gboolean retval; + GError *local_error = NULL; + + fd = g_file_open_tmp ("dump_XXXXXX", &in_file_path, NULL); + g_assert_cmpint (fd, >=, 0); + g_assert_true (g_close (fd, NULL)); + + out_file_path = g_strconcat (in_file_path, ".out", NULL); + + g_file_set_contents (in_file_path, input, -1, &local_error); + g_assert_no_error (local_error); + + retval = gi_repository_dump (in_file_path, out_file_path, &local_error); + g_assert_no_error (local_error); + g_assert_true (retval); + + g_file_get_contents (out_file_path, &output, NULL, &local_error); + g_assert_no_error (local_error); + + g_assert_cmpstr (output, ==, expected_output); + + g_unlink (out_file_path); + g_unlink (in_file_path); + g_free (output); + g_free (out_file_path); + g_free (in_file_path); +} + +static void +assert_dump_error (const char *input, + GQuark expected_error_domain, + int expected_error_code) +{ + int fd = -1; + char *in_file_path = NULL; + char *out_file_path = NULL; + gboolean retval; + GError *local_error = NULL; + + fd = g_file_open_tmp ("dump_XXXXXX", &in_file_path, NULL); + g_assert_cmpint (fd, >=, 0); + g_assert_true (g_close (fd, NULL)); + + out_file_path = g_strconcat (in_file_path, ".out", NULL); + + g_file_set_contents (in_file_path, input, -1, &local_error); + g_assert_no_error (local_error); + + retval = gi_repository_dump (in_file_path, out_file_path, &local_error); + g_assert_error (local_error, expected_error_domain, expected_error_code); + g_assert_false (retval); + g_clear_error (&local_error); + + g_unlink (out_file_path); + g_unlink (in_file_path); + g_free (out_file_path); + g_free (in_file_path); +} + +static void +test_empty_file (void) +{ + assert_dump ("", + "<?xml version=\"1.0\"?>\n" + "<dump>\n" + "</dump>\n"); +} + +static void +test_missing_get_type (void) +{ + assert_dump_error ("get-type:does_not_exist_get_type", + G_FILE_ERROR, G_FILE_ERROR_FAILED); +} + +static void +test_missing_quark (void) +{ + assert_dump_error ("error-quark:does_not_exist_error", + G_FILE_ERROR, G_FILE_ERROR_FAILED); +} + +static void +test_basic (void) +{ + assert_dump ("get-type:test_object_get_type\n" + "get-type:test_interface_get_type\n", + "<?xml version=\"1.0\"?>\n" + "<dump>\n" + " <class name=\"TestObject\" get-type=\"test_object_get_type\" parents=\"GObject\" final=\"1\">\n" + " </class>\n" + " <interface name=\"TestInterface\" get-type=\"test_interface_get_type\">\n" + " </interface>\n" + "</dump>\n"); +} + +int +main (int argc, + char *argv[]) +{ + repository_init (&argc, &argv); + + g_test_add_func ("/dump/empty-file", test_empty_file); + g_test_add_func ("/dump/missing-get-type", test_missing_get_type); + g_test_add_func ("/dump/missing-quark", test_missing_quark); + g_test_add_func ("/dump/basic", test_basic); + + return g_test_run (); +} diff --git a/girepository/tests/meson.build b/girepository/tests/meson.build index a8e5b3d19..59a41227c 100644 --- a/girepository/tests/meson.build +++ b/girepository/tests/meson.build @@ -5,6 +5,9 @@ girepository_tests = { 'cmph-bdz': { 'dependencies': [cmph_dep], }, + 'dump' : { + 'export_dynamic': true, + }, 'gthash' : { 'dependencies': [girepo_gthash_dep], }, @@ -29,6 +32,11 @@ if enable_gir gio_gir, ] + gio_platform_gir_testing_dep = [ + gio_gir_testing_dep, + gio_platform_gir, + ] + girepository_gir_testing_dep = [ gio_gir_testing_dep, girepository_gir, @@ -46,7 +54,8 @@ if enable_gir 'depends': gobject_gir_testing_dep, }, 'repository' : { - 'depends': gio_gir_testing_dep, + 'depends': [gio_gir_testing_dep, gio_platform_gir_testing_dep], + 'dependencies': [libgio_dep], }, 'repository-search-paths' : { 'c_args': '-DGOBJECT_INTROSPECTION_LIBDIR="@0@"'.format(glib_libdir), @@ -66,6 +75,7 @@ if enable_gir if cc.get_id() != 'msvc' girepository_tests += { 'autoptr-girepository' : { + 'dependencies': [libffi_dep], 'source' : 'autoptr.c', 'depends': gio_gir_testing_dep, }, @@ -115,6 +125,7 @@ foreach test_name, extra_args : girepository_tests override_options: extra_args.get('override_options', []), dependencies: test_deps + extra_args.get('dependencies', []), link_with: extra_args.get('link_with', []), + export_dynamic: extra_args.get('export_dynamic', false), install_dir: installed_tests_execdir, install_tag: 'tests', install: install, diff --git a/girepository/tests/repository-search-paths.c b/girepository/tests/repository-search-paths.c index 7bfe14dbd..cef32368c 100644 --- a/girepository/tests/repository-search-paths.c +++ b/girepository/tests/repository-search-paths.c @@ -22,6 +22,23 @@ #include "glib.h" #include "girepository.h" +static char * +test_repository_search_paths_get_expected_libdir_path (void) +{ +#if defined(G_PLATFORM_WIN32) + const char *tests_build_dir = g_getenv ("G_TEST_BUILDDIR"); + char *expected_rel_path = g_build_filename (tests_build_dir, "lib", "girepository-1.0", NULL); +#elif defined(__APPLE__) + const char *tests_build_dir = g_getenv ("G_TEST_BUILDDIR"); + char *expected_rel_path = g_build_filename (tests_build_dir, "..", "girepository-1.0", NULL); +#else /* !G_PLATFORM_WIN32 && !__APPLE__ */ + char *expected_rel_path = g_build_filename (GOBJECT_INTROSPECTION_LIBDIR, "girepository-1.0", NULL); +#endif + char *expected_path = g_canonicalize_filename (expected_rel_path, NULL); + g_clear_pointer (&expected_rel_path, g_free); + return expected_path; +} + static void test_repository_search_paths_default (void) { @@ -37,11 +54,9 @@ test_repository_search_paths_default (void) g_assert_cmpstr (search_paths[0], ==, g_get_tmp_dir ()); -#ifndef G_PLATFORM_WIN32 - char *expected_path = g_build_filename (GOBJECT_INTROSPECTION_LIBDIR, "girepository-1.0", NULL); + char *expected_path = test_repository_search_paths_get_expected_libdir_path (); g_assert_cmpstr (search_paths[1], ==, expected_path); g_clear_pointer (&expected_path, g_free); -#endif g_clear_object (&repository); } @@ -63,11 +78,9 @@ test_repository_search_paths_prepend (void) g_assert_cmpstr (search_paths[0], ==, g_test_get_dir (G_TEST_BUILT)); g_assert_cmpstr (search_paths[1], ==, g_get_tmp_dir ()); -#ifndef G_PLATFORM_WIN32 - char *expected_path = g_build_filename (GOBJECT_INTROSPECTION_LIBDIR, "girepository-1.0", NULL); + char *expected_path = test_repository_search_paths_get_expected_libdir_path (); g_assert_cmpstr (search_paths[2], ==, expected_path); g_clear_pointer (&expected_path, g_free); -#endif gi_repository_prepend_search_path (repository, g_test_get_dir (G_TEST_DIST)); search_paths = gi_repository_get_search_path (repository, &n_search_paths); @@ -78,11 +91,9 @@ test_repository_search_paths_prepend (void) g_assert_cmpstr (search_paths[1], ==, g_test_get_dir (G_TEST_BUILT)); g_assert_cmpstr (search_paths[2], ==, g_get_tmp_dir ()); -#ifndef G_PLATFORM_WIN32 - expected_path = g_build_filename (GOBJECT_INTROSPECTION_LIBDIR, "girepository-1.0", NULL); + expected_path = test_repository_search_paths_get_expected_libdir_path (); g_assert_cmpstr (search_paths[3], ==, expected_path); g_clear_pointer (&expected_path, g_free); -#endif g_clear_object (&repository); } diff --git a/girepository/tests/repository.c b/girepository/tests/repository.c index 565023147..312bd615c 100644 --- a/girepository/tests/repository.c +++ b/girepository/tests/repository.c @@ -35,6 +35,12 @@ #include "glib.h" #include "test-common.h" +#if defined(G_OS_UNIX) && !defined(__APPLE__) +#include "gio/gdesktopappinfo.h" +#elif defined(G_OS_WIN32) +#include "gio/gwin32inputstream.h" +#endif + static void test_repository_basic (RepositoryFixture *fx, const void *unused) @@ -507,12 +513,31 @@ test_repository_error_quark (RepositoryFixture *fx, g_test_summary ("Test finding an error quark by error domain"); + /* Find a simple error domain. */ + error_info = gi_repository_find_by_error_domain (fx->repository, G_RESOLVER_ERROR); + g_assert_nonnull (error_info); + g_assert_true (GI_IS_ENUM_INFO (error_info)); + g_assert_cmpstr (gi_base_info_get_name (GI_BASE_INFO (error_info)), ==, "ResolverError"); + + g_clear_pointer (&error_info, gi_base_info_unref); + + /* Find again to check the caching. */ error_info = gi_repository_find_by_error_domain (fx->repository, G_RESOLVER_ERROR); g_assert_nonnull (error_info); g_assert_true (GI_IS_ENUM_INFO (error_info)); g_assert_cmpstr (gi_base_info_get_name (GI_BASE_INFO (error_info)), ==, "ResolverError"); g_clear_pointer (&error_info, gi_base_info_unref); + + /* Try and find an unknown error domain. */ + g_assert_null (gi_repository_find_by_error_domain (fx->repository, GI_REPOSITORY_ERROR)); + + /* And check caching for unknown error domains. */ + g_assert_null (gi_repository_find_by_error_domain (fx->repository, GI_REPOSITORY_ERROR)); + + /* It would be good to try and find one which will resolve in both Gio and + * GioUnix/GioWin32, but neither of the platform-specific GIRs actually define + * any error domains at the moment. */ } static void @@ -777,6 +802,96 @@ test_repository_vfunc_info_with_invoker_on_object (RepositoryFixture *fx, g_clear_pointer (&invoker_info, gi_base_info_unref); } +static void +test_repository_find_by_gtype (RepositoryFixture *fx, + const void *unused) +{ + GIObjectInfo *object_info = NULL; + + g_test_summary ("Test finding a GType"); + + object_info = (GIObjectInfo *) gi_repository_find_by_gtype (fx->repository, G_TYPE_OBJECT); + g_assert_nonnull (object_info); + g_assert_true (GI_IS_OBJECT_INFO (object_info)); + g_assert_cmpstr (gi_base_info_get_name (GI_BASE_INFO (object_info)), ==, "Object"); + + g_clear_pointer (&object_info, gi_base_info_unref); + + /* Find it again; this time it should hit the cache. */ + object_info = (GIObjectInfo *) gi_repository_find_by_gtype (fx->repository, G_TYPE_OBJECT); + g_assert_nonnull (object_info); + g_assert_true (GI_IS_OBJECT_INFO (object_info)); + g_assert_cmpstr (gi_base_info_get_name (GI_BASE_INFO (object_info)), ==, "Object"); + + g_clear_pointer (&object_info, gi_base_info_unref); + + /* Try and find an unknown GType. */ + g_assert_null (gi_repository_find_by_gtype (fx->repository, GI_TYPE_BASE_INFO)); + + /* And check caching for unknown GTypes. */ + g_assert_null (gi_repository_find_by_gtype (fx->repository, GI_TYPE_BASE_INFO)); + + /* Now try and find one which will resolve in both Gio and GioUnix/GioWin32. + * The longest-named typelib should be returned. */ + { + GType platform_specific_type; + const char *expected_name, *expected_namespace; + +#if defined(G_OS_UNIX) && !(__APPLE__) + platform_specific_type = G_TYPE_DESKTOP_APP_INFO; + expected_name = "DesktopAppInfo"; + expected_namespace = "GioUnix"; +#elif defined(G_OS_WIN32) + platform_specific_type = G_TYPE_WIN32_INPUT_STREAM; + expected_name = "InputStream"; + expected_namespace = "GioWin32"; +#else + platform_specific_type = G_TYPE_INVALID; + expected_name = NULL; + expected_namespace = NULL; +#endif + + if (expected_name != NULL) + { + object_info = (GIObjectInfo *) gi_repository_find_by_gtype (fx->repository, platform_specific_type); + g_assert_nonnull (object_info); + g_assert_true (GI_IS_OBJECT_INFO (object_info)); + g_assert_cmpstr (gi_base_info_get_name (GI_BASE_INFO (object_info)), ==, expected_name); + g_assert_cmpstr (gi_base_info_get_namespace (GI_BASE_INFO (object_info)), ==, expected_namespace); + g_clear_pointer (&object_info, gi_base_info_unref); + } + } +} + +static void +test_repository_loaded_namespaces (RepositoryFixture *fx, + const void *unused) +{ + char **namespaces; + size_t n_namespaces; + + /* These should be in alphabetical order */ +#if defined(G_OS_UNIX) + const char *expected_namespaces[] = { "GLib", "GModule", "GObject", "Gio", "GioUnix", NULL }; +#elif defined(G_OS_WIN32) + const char *expected_namespaces[] = { "GLib", "GModule", "GObject", "Gio", "GioWin32", NULL }; +#else + const char *expected_namespaces[] = { "GLib", "GModule", "GObject", "Gio", NULL }; +#endif + + g_test_summary ("Test listing loaded namespaces"); + + namespaces = gi_repository_get_loaded_namespaces (fx->repository, &n_namespaces); + g_assert_cmpstrv (namespaces, expected_namespaces); + g_assert_cmpuint (n_namespaces, ==, g_strv_length ((char **) expected_namespaces)); + g_strfreev (namespaces); + + /* Test again but without passing `n_namespaces`. */ + namespaces = gi_repository_get_loaded_namespaces (fx->repository, NULL); + g_assert_cmpstrv (namespaces, expected_namespaces); + g_strfreev (namespaces); +} + int main (int argc, char *argv[]) @@ -794,7 +909,7 @@ main (int argc, ADD_REPOSITORY_TEST ("/repository/constructor-return-type", test_repository_constructor_return_type, &typelib_load_spec_gobject); ADD_REPOSITORY_TEST ("/repository/enum-info-c-identifier", test_repository_enum_info_c_identifier, &typelib_load_spec_glib); ADD_REPOSITORY_TEST ("/repository/enum-info-static-methods", test_repository_enum_info_static_methods, &typelib_load_spec_glib); - ADD_REPOSITORY_TEST ("/repository/error-quark", test_repository_error_quark, &typelib_load_spec_gio); + ADD_REPOSITORY_TEST ("/repository/error-quark", test_repository_error_quark, &typelib_load_spec_gio_platform); ADD_REPOSITORY_TEST ("/repository/flags-info-c-identifier", test_repository_flags_info_c_identifier, &typelib_load_spec_gobject); ADD_REPOSITORY_TEST ("/repository/fundamental-ref-func", test_repository_fundamental_ref_func, &typelib_load_spec_gobject); ADD_REPOSITORY_TEST ("/repository/instance-method-ownership-transfer", test_repository_instance_method_ownership_transfer, &typelib_load_spec_gio); @@ -804,6 +919,8 @@ main (int argc, ADD_REPOSITORY_TEST ("/repository/vfunc-info-with-no-invoker", test_repository_vfunc_info_with_no_invoker, &typelib_load_spec_gobject); ADD_REPOSITORY_TEST ("/repository/vfunc-info-with-invoker-on-interface", test_repository_vfunc_info_with_invoker_on_interface, &typelib_load_spec_gio); ADD_REPOSITORY_TEST ("/repository/vfunc-info-with-invoker-on-object", test_repository_vfunc_info_with_invoker_on_object, &typelib_load_spec_gio); + ADD_REPOSITORY_TEST ("/repository/find-by-gtype", test_repository_find_by_gtype, &typelib_load_spec_gio_platform); + ADD_REPOSITORY_TEST ("/repository/loaded-namespaces", test_repository_loaded_namespaces, &typelib_load_spec_gio_platform); return g_test_run (); } diff --git a/girepository/tests/test-common.h b/girepository/tests/test-common.h index 9d31998d1..e7340c64b 100644 --- a/girepository/tests/test-common.h +++ b/girepository/tests/test-common.h @@ -36,6 +36,11 @@ typedef struct static const TypelibLoadSpec typelib_load_spec_glib = { "GLib", "2.0" }; static const TypelibLoadSpec typelib_load_spec_gobject = { "GObject", "2.0" }; static const TypelibLoadSpec typelib_load_spec_gio = { "Gio", "2.0" }; +#if defined(G_OS_UNIX) +static const TypelibLoadSpec typelib_load_spec_gio_platform = { "GioUnix", "2.0" }; +#elif defined(G_OS_WIN32) +static const TypelibLoadSpec typelib_load_spec_gio_platform = { "GioWin32", "2.0" }; +#endif void repository_init (int *argc, char **argv[]); @@ -14,7 +14,7 @@ <homepage rdf:resource="http://www.gtk.org" /> <license rdf:resource="http://usefulinc.com/doap/licenses/lgpl" /> - <bug-database rdf:resource="https://gitlab.gnome.org/GNOME/glib/issues/new"/> + <bug-database rdf:resource="https://gitlab.gnome.org/GNOME/glib/-/issues"/> <download-page rdf:resource="http://download.gnome.org/sources/glib/" /> <developer-forum rdf:resource="https://discourse.gnome.org/tags/glib/" /> <category rdf:resource="http://api.gnome.org/doap-extensions#core" /> diff --git a/glib/glib-init.c b/glib/glib-init.c index 7d4a4d5d9..969570aa6 100644 --- a/glib/glib-init.c +++ b/glib/glib-init.c @@ -22,6 +22,7 @@ #include "config.h" #include "glib-init.h" +#include "glib-private.h" #include "gmacros.h" #include "gtypes.h" #include "gutils.h" /* for GDebugKey */ @@ -42,6 +43,10 @@ /* This seems as good a place as any to make static assertions about platform * assumptions we make throughout GLib. */ +/* Test that private macro G_SIGNEDNESS_OF() works as intended */ +G_STATIC_ASSERT (G_SIGNEDNESS_OF (int) == 1); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (unsigned int) == 0); + /* We do not support 36-bit bytes or other historical curiosities. */ G_STATIC_ASSERT (CHAR_BIT == 8); @@ -77,6 +82,11 @@ G_STATIC_ASSERT (G_ALIGNOF (TestInt) == G_ALIGNOF (int)); G_STATIC_ASSERT (sizeof (gchar) == 1); G_STATIC_ASSERT (sizeof (guchar) == 1); + +/* It is platform-dependent whether gchar is signed or unsigned, so there + * is no assertion here for it */ +G_STATIC_ASSERT (G_SIGNEDNESS_OF (guchar) == 0); + G_STATIC_ASSERT (sizeof (gint8) * CHAR_BIT == 8); G_STATIC_ASSERT (sizeof (guint8) * CHAR_BIT == 8); G_STATIC_ASSERT (sizeof (gint16) * CHAR_BIT == 16); @@ -95,12 +105,16 @@ G_STATIC_ASSERT (G_MINSHORT == SHRT_MIN); G_STATIC_ASSERT (G_MAXSHORT == SHRT_MAX); G_STATIC_ASSERT (sizeof (unsigned short) == sizeof (gushort)); G_STATIC_ASSERT (G_MAXUSHORT == USHRT_MAX); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (gshort) == 1); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (gushort) == 0); G_STATIC_ASSERT (sizeof (int) == sizeof (gint)); G_STATIC_ASSERT (G_MININT == INT_MIN); G_STATIC_ASSERT (G_MAXINT == INT_MAX); G_STATIC_ASSERT (sizeof (unsigned int) == sizeof (guint)); G_STATIC_ASSERT (G_MAXUINT == UINT_MAX); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (gint) == 1); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (guint) == 0); G_STATIC_ASSERT (sizeof (long) == GLIB_SIZEOF_LONG); G_STATIC_ASSERT (sizeof (long) == sizeof (glong)); @@ -108,6 +122,8 @@ G_STATIC_ASSERT (G_MINLONG == LONG_MIN); G_STATIC_ASSERT (G_MAXLONG == LONG_MAX); G_STATIC_ASSERT (sizeof (unsigned long) == sizeof (gulong)); G_STATIC_ASSERT (G_MAXULONG == ULONG_MAX); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (glong) == 1); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (gulong) == 0); G_STATIC_ASSERT (G_HAVE_GINT64 == 1); @@ -127,6 +143,10 @@ G_STATIC_ASSERT (G_ALIGNOF (gssize) == G_ALIGNOF (size_t)); * However, we do not assume that GPOINTER_TO_SIZE can store an arbitrary * pointer in a gsize (known to be false on CHERI). */ G_STATIC_ASSERT (sizeof (size_t) <= sizeof (void *)); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (size_t) == 0); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (gsize) == 0); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (gssize) == 1); + /* Standard C does not guarantee that size_t is the same as uintptr_t, * but GLib currently assumes they are the same: see * <https://gitlab.gnome.org/GNOME/glib/-/issues/2842>. @@ -139,10 +159,13 @@ G_STATIC_ASSERT (sizeof (size_t) <= sizeof (void *)); G_STATIC_ASSERT (sizeof (size_t) == sizeof (uintptr_t)); G_STATIC_ASSERT (G_ALIGNOF (size_t) == G_ALIGNOF (uintptr_t)); #endif + /* goffset is always 64-bit, even if off_t is only 32-bit * (compiling without large-file-support on 32-bit) */ G_STATIC_ASSERT (sizeof (goffset) == sizeof (gint64)); G_STATIC_ASSERT (G_ALIGNOF (goffset) == G_ALIGNOF (gint64)); +/* goffset is always signed */ +G_STATIC_ASSERT (G_SIGNEDNESS_OF (goffset) == 1); G_STATIC_ASSERT (sizeof (gfloat) == sizeof (float)); G_STATIC_ASSERT (G_ALIGNOF (gfloat) == G_ALIGNOF (float)); @@ -153,26 +176,44 @@ G_STATIC_ASSERT (sizeof (gintptr) == sizeof (intptr_t)); G_STATIC_ASSERT (sizeof (guintptr) == sizeof (uintptr_t)); G_STATIC_ASSERT (G_ALIGNOF (gintptr) == G_ALIGNOF (intptr_t)); G_STATIC_ASSERT (G_ALIGNOF (guintptr) == G_ALIGNOF (uintptr_t)); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (gintptr) == 1); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (guintptr) == 0); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (intptr_t) == 1); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (uintptr_t) == 0); G_STATIC_ASSERT (sizeof (gint8) == sizeof (int8_t)); G_STATIC_ASSERT (sizeof (guint8) == sizeof (uint8_t)); G_STATIC_ASSERT (G_ALIGNOF (gint8) == G_ALIGNOF (int8_t)); G_STATIC_ASSERT (G_ALIGNOF (guint8) == G_ALIGNOF (uint8_t)); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (gint8) == 1); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (guint8) == 0); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (int8_t) == 1); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (uint8_t) == 0); G_STATIC_ASSERT (sizeof (gint16) == sizeof (int16_t)); G_STATIC_ASSERT (sizeof (guint16) == sizeof (uint16_t)); G_STATIC_ASSERT (G_ALIGNOF (gint16) == G_ALIGNOF (int16_t)); G_STATIC_ASSERT (G_ALIGNOF (guint16) == G_ALIGNOF (uint16_t)); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (int16_t) == 1); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (uint16_t) == 0); G_STATIC_ASSERT (sizeof (gint32) == sizeof (int32_t)); G_STATIC_ASSERT (sizeof (guint32) == sizeof (uint32_t)); G_STATIC_ASSERT (G_ALIGNOF (gint32) == G_ALIGNOF (int32_t)); G_STATIC_ASSERT (G_ALIGNOF (guint32) == G_ALIGNOF (uint32_t)); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (gint32) == 1); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (guint32) == 0); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (int32_t) == 1); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (uint32_t) == 0); G_STATIC_ASSERT (sizeof (gint64) == sizeof (int64_t)); G_STATIC_ASSERT (sizeof (guint64) == sizeof (uint64_t)); G_STATIC_ASSERT (G_ALIGNOF (gint64) == G_ALIGNOF (int64_t)); G_STATIC_ASSERT (G_ALIGNOF (guint64) == G_ALIGNOF (uint64_t)); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (gint64) == 1); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (guint64) == 0); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (int64_t) == 1); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (uint64_t) == 0); /** * g_mem_gc_friendly: diff --git a/glib/glib-private.h b/glib/glib-private.h index c24b59d6f..7ab2579b0 100644 --- a/glib/glib-private.h +++ b/glib/glib-private.h @@ -25,6 +25,16 @@ #include "gstdioprivate.h" #include "gdatasetprivate.h" +/* + * G_SIGNEDNESS_OF: + * @T: a numeric type such as `unsigned int` + * + * An integer constant expression indicating whether @T is a signed type. + * + * Returns: 1 if @T is signed, 0 if it is unsigned + */ +#define G_SIGNEDNESS_OF(T) (((T) -1) <= 0) + /* gcc defines __SANITIZE_ADDRESS__, clang sets the address_sanitizer * feature flag. * diff --git a/glib/glib-unix.c b/glib/glib-unix.c index 7cb76dd33..932c230d6 100644 --- a/glib/glib-unix.c +++ b/glib/glib-unix.c @@ -38,6 +38,7 @@ #include "config.h" +#include "glib-private.h" #include "glib-unix.h" #include "glib-unixprivate.h" #include "gmain-internal.h" @@ -66,9 +67,11 @@ G_STATIC_ASSERT (sizeof (ssize_t) == GLIB_SIZEOF_SSIZE_T); G_STATIC_ASSERT (G_ALIGNOF (gssize) == G_ALIGNOF (ssize_t)); +G_STATIC_ASSERT (G_SIGNEDNESS_OF (ssize_t) == 1); G_STATIC_ASSERT (sizeof (GPid) == sizeof (pid_t)); G_STATIC_ASSERT (G_ALIGNOF (GPid) == G_ALIGNOF (pid_t)); +/* It's platform-dependent whether pid_t is signed, so no assertion */ /* If this assertion fails, then the ABI of g_unix_open_pipe() would be * ambiguous on this platform. diff --git a/glib/gmain.c b/glib/gmain.c index 329e6d399..ade05179a 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -1718,7 +1718,7 @@ g_source_set_callback_indirect (GSource *source, * parameter. Cast @func with G_SOURCE_FUNC() to avoid warnings about * incompatible function types. * - * See [memory management of sources][mainloop-memory-management] for details + * See [mainloop memory management](main-loop.html#memory-management-of-sources) for details * on how to handle memory management of @data. * * Typically, you won't use this function. Instead use functions specific @@ -5181,7 +5181,7 @@ timeout_add_full (gint priority, * timeout is recalculated based on the current time and the given interval * (it does not try to 'catch up' time lost in delays). * - * See [memory management of sources][mainloop-memory-management] for details + * See [mainloop memory management](main-loop.html#memory-management-of-sources) for details * on how to handle the return value and memory management of @data. * * This internally creates a main loop source using g_timeout_source_new() @@ -5226,7 +5226,7 @@ g_timeout_add_full (gint priority, * timeout is recalculated based on the current time and the given interval * (it does not try to 'catch up' time lost in delays). * - * See [memory management of sources][mainloop-memory-management] for details + * See [mainloop memory management](main-loop.html#memory-management-of-sources) for details * on how to handle the return value and memory management of @data. * * If you want to have a timer in the "seconds" range and do not care @@ -5311,7 +5311,7 @@ g_timeout_add_once (guint32 interval, * After each call to the timeout function, the time of the next * timeout is recalculated based on the current time and the given @interval * - * See [memory management of sources][mainloop-memory-management] for details + * See [mainloop memory management](main-loop.html#memory-management-of-sources) for details * on how to handle the return value and memory management of @data. * * If you want timing more precise than whole seconds, use g_timeout_add() @@ -5370,7 +5370,7 @@ g_timeout_add_seconds_full (gint priority, * of one second. If you need finer precision and have such a timeout, * you may want to use g_timeout_add() instead. * - * See [memory management of sources][mainloop-memory-management] for details + * See [mainloop memory management](main-loop.html#memory-management-of-sources) for details * on how to handle the return value and memory management of @data. * * The interval given is in terms of monotonic time, not wall clock @@ -6305,7 +6305,7 @@ idle_add_full (gint priority, * If the function returns %G_SOURCE_REMOVE or %FALSE it is automatically * removed from the list of event sources and will not be called again. * - * See [memory management of sources][mainloop-memory-management] for details + * See [mainloop memory management](main-loop.html#memory-management-of-sources) for details * on how to handle the return value and memory management of @data. * * This internally creates a main loop source using g_idle_source_new() @@ -6336,7 +6336,7 @@ g_idle_add_full (gint priority, * returns %FALSE it is automatically removed from the list of event * sources and will not be called again. * - * See [memory management of sources][mainloop-memory-management] for details + * See [mainloop memory management](main-loop.html#memory-management-of-sources) for details * on how to handle the return value and memory management of @data. * * This internally creates a main loop source using g_idle_source_new() diff --git a/glib/gmem.c b/glib/gmem.c index c72c9cc07..3b7a86a63 100644 --- a/glib/gmem.c +++ b/glib/gmem.c @@ -244,7 +244,7 @@ g_free_sized (void *mem, * g_clear_pointer: (skip) * @pp: (nullable) (not optional) (inout) (transfer full): a pointer to a * variable, struct member etc. holding a pointer - * @destroy: a function to which a gpointer can be passed, to destroy *@pp + * @destroy: a function to which a gpointer can be passed, to destroy `*pp` * * Clears a reference to a variable. * @@ -257,9 +257,32 @@ g_free_sized (void *mem, * A macro is also included that allows this function to be used without * pointer casts. This will mask any warnings about incompatible function types * or calling conventions, so you must ensure that your @destroy function is - * compatible with being called as `GDestroyNotify` using the standard calling - * convention for the platform that GLib was compiled for; otherwise the program - * will experience undefined behaviour. + * compatible with being called as [callback@GLib.DestroyNotify] using the + * standard calling convention for the platform that GLib was compiled for; + * otherwise the program will experience undefined behaviour. + * + * Examples of this kind of undefined behaviour include using many Windows Win32 + * APIs, as well as many if not all OpenGL and Vulkan calls on 32-bit Windows, + * which typically use the `__stdcall` calling convention rather than the + * `__cdecl` calling convention. + * + * The affected functions can be used by wrapping them in a + * [callback@GLib.DestroyNotify] that is declared with the standard calling + * convention: + * + * ```c + * // Wrapper needed to avoid mismatched calling conventions on Windows + * static void + * destroy_sync (void *sync) + * { + * glDeleteSync (sync); + * } + * + * // … + * + * g_clear_pointer (&sync, destroy_sync); + * ``` + * * Since: 2.34 **/ diff --git a/glib/gnulib/vasnprintf.c b/glib/gnulib/vasnprintf.c index a5b68db8c..7e151b462 100644 --- a/glib/gnulib/vasnprintf.c +++ b/glib/gnulib/vasnprintf.c @@ -379,7 +379,7 @@ multiply (mpn_t src1, mpn_t src2, mpn_t *dest) { /* src1 or src2 is zero. */ dest->nlimbs = 0; - dest->limbs = (mp_limb_t *) malloc (1); + dest->limbs = (mp_limb_t *) malloc (sizeof (mp_limb_t)); } else { diff --git a/glib/goption.c b/glib/goption.c index 785b151f0..8ac283ce4 100644 --- a/glib/goption.c +++ b/glib/goption.c @@ -56,7 +56,7 @@ typedef struct gpointer arg_data; union { - gboolean bool; + gboolean boolean; gint integer; gchar *str; gchar **array; @@ -1585,7 +1585,7 @@ free_changes_list (GOptionContext *context, switch (change->arg_type) { case G_OPTION_ARG_NONE: - *(gboolean *)change->arg_data = change->prev.bool; + *(gboolean *)change->arg_data = change->prev.boolean; break; case G_OPTION_ARG_INT: *(gint *)change->arg_data = change->prev.integer; diff --git a/glib/gpattern.c b/glib/gpattern.c index f77e69b6b..d02b2d420 100644 --- a/glib/gpattern.c +++ b/glib/gpattern.c @@ -33,15 +33,15 @@ /** * GPatternSpec: * - * A `GPatternSpec` struct is the 'compiled' form of a glob-style pattern. + * A `GPatternSpec` struct is the ‘compiled’ form of a glob-style pattern. * * The [func@GLib.pattern_match_simple] and [method@GLib.PatternSpec.match] functions - * match a string against a pattern containing '*' and '?' wildcards with similar - * semantics as the standard `glob()` function: '*' matches an arbitrary, - * possibly empty, string, '?' matches an arbitrary character. + * match a string against a pattern containing `*` and `?` wildcards with similar + * semantics as the standard `glob()` function: `*` matches an arbitrary, + * possibly empty, string, `?` matches an arbitrary character. * - * Note that in contrast to `glob()`, the '/' character can be matched by - * the wildcards, there are no '[...]' character ranges and '*' and '?' + * Note that in contrast to [`glob()`](man:glob(3)), the `/` character can be + * matched by the wildcards, there are no `[…]` character ranges and `*` and `?` * can not be escaped to include them literally in a pattern. * * When multiple strings must be matched against the same pattern, it is better @@ -154,28 +154,30 @@ g_pattern_ph_match (const gchar *match_pattern, /** * g_pattern_spec_match: * @pspec: a #GPatternSpec - * @string_length: the length of @string (in bytes, i.e. strlen(), - * not g_utf8_strlen()) + * @string_length: the length of @string (in bytes, i.e. `strlen()`, + * not [func@GLib.utf8_strlen]) * @string: the UTF-8 encoded string to match - * @string_reversed: (nullable): the reverse of @string or %NULL + * @string_reversed: (nullable): the reverse of @string * - * Matches a string against a compiled pattern. Passing the correct + * Matches a string against a compiled pattern. + * + * Passing the correct * length of the string given is mandatory. The reversed string can be - * omitted by passing %NULL, this is more efficient if the reversed + * omitted by passing `NULL`, this is more efficient if the reversed * version of the string to be matched is not at hand, as - * g_pattern_match() will only construct it if the compiled pattern + * [method@GLib.PatternSpec.match] will only construct it if the compiled pattern * requires reverse matches. * * Note that, if the user code will (possibly) match a string against a * multitude of patterns containing wildcards, chances are high that - * some patterns will require a reversed string. In this case, it's + * some patterns will require a reversed string. In this case, it’s * more efficient to provide the reversed string to avoid multiple - * constructions thereof in the various calls to g_pattern_match(). + * constructions thereof in the various calls to [method@GLib.PatternSpec.match]. * * Note also that the reverse of a UTF-8 encoded string can in general - * not be obtained by g_strreverse(). This works only if the string + * not be obtained by [func@GLib.strreverse]. This works only if the string * does not contain any multibyte characters. GLib offers the - * g_utf8_strreverse() function to reverse UTF-8 encoded strings. + * [func@GLib.utf8_strreverse] function to reverse UTF-8 encoded strings. * * Returns: %TRUE if @string matches @pspec * @@ -237,31 +239,33 @@ g_pattern_spec_match (GPatternSpec *pspec, /** * g_pattern_match: (skip) * @pspec: a #GPatternSpec - * @string_length: the length of @string (in bytes, i.e. strlen(), - * not g_utf8_strlen()) + * @string_length: the length of @string (in bytes, i.e. `strlen()`, + * not [func@GLib.utf8_strlen]) * @string: the UTF-8 encoded string to match - * @string_reversed: (nullable): the reverse of @string or %NULL + * @string_reversed: (nullable): the reverse of @string + * + * Matches a string against a compiled pattern. * - * Matches a string against a compiled pattern. Passing the correct + * Passing the correct * length of the string given is mandatory. The reversed string can be - * omitted by passing %NULL, this is more efficient if the reversed + * omitted by passing `NULL`, this is more efficient if the reversed * version of the string to be matched is not at hand, as - * g_pattern_match() will only construct it if the compiled pattern + * `g_pattern_match()` will only construct it if the compiled pattern * requires reverse matches. * * Note that, if the user code will (possibly) match a string against a * multitude of patterns containing wildcards, chances are high that - * some patterns will require a reversed string. In this case, it's + * some patterns will require a reversed string. In this case, it’s * more efficient to provide the reversed string to avoid multiple - * constructions thereof in the various calls to g_pattern_match(). + * constructions thereof in the various calls to `g_pattern_match()`. * * Note also that the reverse of a UTF-8 encoded string can in general - * not be obtained by g_strreverse(). This works only if the string + * not be obtained by [func@GLib.strreverse]. This works only if the string * does not contain any multibyte characters. GLib offers the - * g_utf8_strreverse() function to reverse UTF-8 encoded strings. + * [func@GLib.utf8_strreverse] function to reverse UTF-8 encoded strings. * * Returns: %TRUE if @string matches @pspec - * Deprecated: 2.70: Use g_pattern_spec_match() instead + * Deprecated: 2.70: Use [method@GLib.PatternSpec.match] instead **/ gboolean g_pattern_match (GPatternSpec *pspec, @@ -276,9 +280,9 @@ g_pattern_match (GPatternSpec *pspec, * g_pattern_spec_new: * @pattern: a zero-terminated UTF-8 encoded string * - * Compiles a pattern to a #GPatternSpec. + * Compiles a pattern to a [type@GLib.PatternSpec]. * - * Returns: a newly-allocated #GPatternSpec + * Returns: (transfer full): a newly-allocated [type@GLib.PatternSpec] **/ GPatternSpec* g_pattern_spec_new (const gchar *pattern) @@ -392,7 +396,7 @@ g_pattern_spec_new (const gchar *pattern) * g_pattern_spec_copy: * @pspec: a #GPatternSpec * - * Copies @pspec in a new #GPatternSpec. + * Copies @pspec in a new [type@GLib.PatternSpec]. * * Returns: (transfer full): a copy of @pspec. * @@ -416,7 +420,7 @@ g_pattern_spec_copy (GPatternSpec *pspec) * g_pattern_spec_free: * @pspec: a #GPatternSpec * - * Frees the memory allocated for the #GPatternSpec. + * Frees the memory allocated for the [type@GLib.PatternSpec]. **/ void g_pattern_spec_free (GPatternSpec *pspec) @@ -454,9 +458,11 @@ g_pattern_spec_equal (GPatternSpec *pspec1, * @pspec: a #GPatternSpec * @string: the UTF-8 encoded string to match * - * Matches a string against a compiled pattern. If the string is to be + * Matches a string against a compiled pattern. + * + * If the string is to be * matched against more than one pattern, consider using - * g_pattern_match() instead while supplying the reversed string. + * [method@GLib.PatternSpec.match] instead while supplying the reversed string. * * Returns: %TRUE if @string matches @pspec * @@ -477,12 +483,14 @@ g_pattern_spec_match_string (GPatternSpec *pspec, * @pspec: a #GPatternSpec * @string: the UTF-8 encoded string to match * - * Matches a string against a compiled pattern. If the string is to be + * Matches a string against a compiled pattern. + * + * If the string is to be * matched against more than one pattern, consider using - * g_pattern_match() instead while supplying the reversed string. + * [method@GLib.PatternSpec.match] instead while supplying the reversed string. * * Returns: %TRUE if @string matches @pspec - * Deprecated: 2.70: Use g_pattern_spec_match_string() instead + * Deprecated: 2.70: Use [method@GLib.PatternSpec.match_string] instead **/ gboolean g_pattern_match_string (GPatternSpec *pspec, @@ -496,10 +504,12 @@ g_pattern_match_string (GPatternSpec *pspec, * @pattern: the UTF-8 encoded pattern * @string: the UTF-8 encoded string to match * - * Matches a string against a pattern given as a string. If this - * function is to be called in a loop, it's more efficient to compile - * the pattern once with g_pattern_spec_new() and call - * g_pattern_match_string() repeatedly. + * Matches a string against a pattern given as a string. + * + * If this + * function is to be called in a loop, it’s more efficient to compile + * the pattern once with [ctor@GLib.PatternSpec.new] and call + * [method@GLib.PatternSpec.match_string] repeatedly. * * Returns: %TRUE if @string matches @pspec **/ diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c index 3688bea49..122de736c 100644 --- a/glib/gstrfuncs.c +++ b/glib/gstrfuncs.c @@ -2109,9 +2109,20 @@ g_strcanon (gchar *string, * g_strcompress: * @source: a string to compress * - * Replaces all escaped characters with their one byte equivalent. + * Makes a copy of a string replacing C string-style escape + * sequences with their one byte equivalent: * - * This function does the reverse conversion of [func@GLib.strescape]. + * - `\b` → [U+0008 Backspace](https://en.wikipedia.org/wiki/Backspace) + * - `\f` → [U+000C Form Feed](https://en.wikipedia.org/wiki/Form_feed) + * - `\n` → [U+000A Line Feed](https://en.wikipedia.org/wiki/Newline) + * - `\r` → [U+000D Carriage Return](https://en.wikipedia.org/wiki/Carriage_return) + * - `\t` → [U+0009 Horizontal Tabulation](https://en.wikipedia.org/wiki/Tab_character) + * - `\v` → [U+000B Vertical Tabulation](https://en.wikipedia.org/wiki/Vertical_Tab) + * - `\` followed by one to three octal digits → the numeric value (mod 255) + * - `\` followed by any other character → the character as is. + * For example, `\\` will turn into a backslash (`\`) and `\"` into a double quote (`"`). + * + * [func@GLib.strescape] does the reverse conversion. * * Returns: a newly-allocated copy of @source with all escaped * character compressed @@ -2188,11 +2199,22 @@ out: * @source: a string to escape * @exceptions: (nullable): a string of characters not to escape in @source * - * Escapes the special characters '\b', '\f', '\n', '\r', '\t', '\v', '\' - * and '"' in the string @source by inserting a '\' before - * them. Additionally all characters in the range 0x01-0x1F (everything + * It replaces the following special characters in the string @source + * with their corresponding C escape sequence: + * + * Symbol | Escape + * ---|--- + * [U+0008 Backspace](https://en.wikipedia.org/wiki/Backspace) | `\b` + * [U+000C Form Feed](https://en.wikipedia.org/wiki/Form_feed) | `\f` + * [U+000A Line Feed](https://en.wikipedia.org/wiki/Newline) | `\n` + * [U+000D Carriage Return](https://en.wikipedia.org/wiki/Carriage_return) | `\r` + * [U+0009 Horizontal Tabulation](https://en.wikipedia.org/wiki/Tab_character) | `\t` + * [U+000B Vertical Tabulation](https://en.wikipedia.org/wiki/Vertical_Tab) | `\v` + * + * It also inserts a backslash (`\`) before any backslash or a double quote (`"`). + * Additionally all characters in the range 0x01-0x1F (everything * below SPACE) and in the range 0x7F-0xFF (all non-ASCII chars) are - * replaced with a '\' followed by their octal representation. + * replaced with a backslash followed by their octal representation. * Characters supplied in @exceptions are not escaped. * * [func@GLib.strcompress] does the reverse conversion. diff --git a/glib/gstrfuncs.h b/glib/gstrfuncs.h index bd6a2c19b..838ceb9fe 100644 --- a/glib/gstrfuncs.h +++ b/glib/gstrfuncs.h @@ -327,21 +327,9 @@ g_strdup_inline (const char *str) #endif /* !defined (__GTK_DOC_IGNORE__) */ #endif /* G_GNUC_CHECK_VERSION (2, 0) */ -/* Make a copy of a string interpreting C string -style escape - * sequences. Inverse of g_strescape. The recognized sequences are \b - * \f \n \r \t \\ \" and the octal format. - */ GLIB_AVAILABLE_IN_ALL gchar* g_strcompress (const gchar *source) G_GNUC_MALLOC; -/* Copy a string escaping nonprintable characters like in C strings. - * Inverse of g_strcompress. The exceptions parameter, if non-NULL, points - * to a string containing characters that are not to be escaped. - * - * Deprecated API: gchar* g_strescape (const gchar *source); - * Luckily this function wasn't used much, using NULL as second parameter - * provides mostly identical semantics. - */ GLIB_AVAILABLE_IN_ALL gchar* g_strescape (const gchar *source, const gchar *exceptions) G_GNUC_MALLOC; diff --git a/glib/gtestutils.c b/glib/gtestutils.c index d241fc952..343d6cc96 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -30,6 +30,9 @@ #include <fcntl.h> #include <unistd.h> #endif +#ifdef HAVE_FTW_H +#include <ftw.h> +#endif #include <string.h> #include <stdlib.h> #include <stdio.h> @@ -1407,6 +1410,61 @@ parse_args (gint *argc_p, *argc_p = e; } +#ifdef HAVE_FTW_H +static int +rm_rf_nftw_visitor (const char *fpath, + const struct stat *sb, + int typeflag, + struct FTW *ftwbuf) +{ + switch (typeflag) + { + case FTW_DP: + case FTW_D: + case FTW_DNR: + if (g_rmdir (fpath) != 0) + { + int errsv = errno; + g_printerr ("Unable to clean up temporary directory %s: %s\n", + fpath, + g_strerror (errsv)); + } + break; + + default: + if (g_remove (fpath) != 0) + { + int errsv = errno; + g_printerr ("Unable to clean up temporary file %s: %s\n", + fpath, + g_strerror (errsv)); + } + break; + } + + return 0; +} + +static void +rm_rf (const gchar *path) +{ + /* nopenfd specifies the maximum number of directories that [n]ftw() will + * hold open simultaneously. Rather than attempt to determine how many file + * descriptors are available, we assume that 5 are available when tearing + * down a test case; if that assumption is invalid, the only harm is leaving + * a temporary directory on disk. + */ + const int nopenfd = 5; + int ret = nftw (path, rm_rf_nftw_visitor, nopenfd, FTW_DEPTH | FTW_MOUNT | FTW_PHYS); + if (ret != 0) + { + int errsv = errno; + g_printerr ("Unable to clean up temporary directory %s: %s\n", + path, + g_strerror (errsv)); + } +} +#else /* A fairly naive `rm -rf` implementation to clean up after unit tests. */ static void rm_rf (const gchar *path) @@ -1433,6 +1491,7 @@ rm_rf (const gchar *path) g_rmdir (path); } +#endif /* Implement the %G_TEST_OPTION_ISOLATE_DIRS option, iff it’s enabled. Create * a temporary directory for this unit test (disambiguated using @test_run_name) diff --git a/glib/tests/atomic.c b/glib/tests/atomic.c index 9d57d2114..dff493d27 100644 --- a/glib/tests/atomic.c +++ b/glib/tests/atomic.c @@ -136,6 +136,9 @@ test_types (void) * to make sure that we don’t warn when built against older third party code. */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wincompatible-pointer-types" +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wunknown-warning-option" +#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" g_atomic_pointer_set (&vp_str_vol, NULL); g_atomic_pointer_set (&vp_str, str); res = g_atomic_pointer_compare_and_exchange (&vp_str_vol, NULL, str); diff --git a/glib/tests/mem-overflow.c b/glib/tests/mem-overflow.c index f19534102..b8b65c17a 100644 --- a/glib/tests/mem-overflow.c +++ b/glib/tests/mem-overflow.c @@ -71,11 +71,11 @@ MEM_OVERFLOW_TEST (new0_b, p = g_new0 (X, b)) MEM_OVERFLOW_TEST (renew_a, p = g_malloc (1); p = g_renew (X, p, a)) MEM_OVERFLOW_TEST (renew_b, p = g_malloc (1); p = g_renew (X, p, b)) -MEM_OVERFLOW_TEST_FULL (aligned_alloc_a, p = g_aligned_alloc (sizeof(X), a, 16), g_aligned_free) -MEM_OVERFLOW_TEST_FULL (aligned_alloc_b, p = g_aligned_alloc (sizeof(X), b, 16), g_aligned_free) +MEM_OVERFLOW_TEST_FULL (aligned_alloc_a, p = g_aligned_alloc (a, sizeof(X), 16), g_aligned_free) +MEM_OVERFLOW_TEST_FULL (aligned_alloc_b, p = g_aligned_alloc (b, sizeof(X), 16), g_aligned_free) -MEM_OVERFLOW_TEST_FULL (aligned_alloc0_a, p = g_aligned_alloc0 (sizeof(X), a, 16), g_aligned_free) -MEM_OVERFLOW_TEST_FULL (aligned_alloc0_b, p = g_aligned_alloc0 (sizeof(X), b, 16), g_aligned_free) +MEM_OVERFLOW_TEST_FULL (aligned_alloc0_a, p = g_aligned_alloc0 (a, sizeof(X), 16), g_aligned_free) +MEM_OVERFLOW_TEST_FULL (aligned_alloc0_b, p = g_aligned_alloc0 (b, sizeof(X), 16), g_aligned_free) static void mem_overflow_malloc_0 (void) diff --git a/glib/tests/meson.build b/glib/tests/meson.build index 5fbaa854b..4d5667fcd 100644 --- a/glib/tests/meson.build +++ b/glib/tests/meson.build @@ -372,10 +372,12 @@ foreach test_name, extra_args : glib_tests '@0@-c-@1@'.format(test_name, std) : extra_args + { 'source' : extra_args.get('source', test_name + '.c'), 'suite' : ['cc'] + extra_args.get('suite', []), - 'c_args' : [ - c_standards.get(std), - '-D_G_EXPECTED_C_STANDARD="@0@"'.format(std) - ] + extra_args.get('c_args', []), + 'override_options' : extra_args.get('override_options', []) + [ + 'c_std=c@0@'.format(std), + ], + 'c_args' : extra_args.get('c_args', []) + [ + '-D_G_EXPECTED_C_STANDARD="@0@"'.format(std), + ], } } endif diff --git a/glib/tests/utils-isolated.c b/glib/tests/utils-isolated.c index 6ffb3424f..beb6e56ba 100644 --- a/glib/tests/utils-isolated.c +++ b/glib/tests/utils-isolated.c @@ -21,6 +21,11 @@ #include "config.h" #include <glib/glib.h> +#include <glib/gstdio.h> + +#ifdef G_OS_UNIX +#include <unistd.h> +#endif /* Test that all of the well-known directories returned by GLib * are returned as children of test_tmpdir when running with @@ -90,6 +95,96 @@ test_user_runtime_dir (void) g_assert_true (g_str_has_prefix (g_get_user_runtime_dir (), test_tmpdir)); } +static void +test_cleanup_handles_errors (void) +{ + const gchar *runtime_dir = g_get_user_runtime_dir (); + gchar *subdir = g_build_filename (runtime_dir, "b", NULL); + + if (g_test_subprocess ()) + { + + g_assert_no_errno (g_mkdir_with_parents (subdir, 0755)); + g_assert_no_errno (g_chmod (runtime_dir, 0)); + + g_clear_pointer (&subdir, g_free); + /* Now let the harness clean up. Not being able to delete part of the + * test's isolated temporary directory should not cause the test to + * fail. + */ + return; + } + + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_INHERIT_STDERR); + g_test_trap_assert_passed (); + /* No assertion about the test logging anything to stderr: we don't + * guarantee this, and one of the cleanup implementations doesn't log + * anything. + */ + + /* Now that we have verified that a failure to delete part of the isolated + * temporary directory hierarchy does not cause the test to fail, clean up + * after ourselves. + */ + g_assert_no_errno (g_chmod (runtime_dir, 0755)); + + g_free (subdir); +} + +static void +test_cleanup_doesnt_follow_symlinks (void) +{ +#ifdef G_OS_WIN32 + g_test_skip ("Symlinks not generally available on Windows"); +#else + const gchar *test_tmpdir = g_getenv ("G_TEST_TMPDIR"); + const gchar *runtime_dir = g_get_user_runtime_dir (); + g_assert_cmpstr (test_tmpdir, !=, runtime_dir); + g_assert_true (g_str_has_prefix (runtime_dir, test_tmpdir)); + gchar *symlink_path = g_build_filename (runtime_dir, "symlink", NULL); + gchar *target_path = g_build_filename (test_tmpdir, "target", NULL); + gchar *file_within_target = g_build_filename (target_path, "precious-data", NULL); + + if (g_test_subprocess ()) + { + g_assert_no_errno (g_mkdir_with_parents (runtime_dir, 0755)); + g_assert_no_errno (symlink (target_path, symlink_path)); + + g_free (symlink_path); + g_free (target_path); + g_free (file_within_target); + + return; + } + else + { + GError *error = NULL; + + g_assert_no_errno (g_mkdir_with_parents (target_path, 0755)); + g_file_set_contents (file_within_target, "Precious Data", -1, &error); + g_assert_no_error (error); + + g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_INHERIT_STDERR); + g_test_trap_assert_passed (); + + /* There was a symbolic link in the test's isolated directory which + * pointed to a directory outside it. That directory and its contents + * should not have been deleted: the symbolic link should not have been + * followed. + */ + g_assert_true (g_file_test (file_within_target, G_FILE_TEST_EXISTS)); + g_assert_true (g_file_test (target_path, G_FILE_TEST_IS_DIR)); + + /* The symlink itself should have been deleted. */ + g_assert_false (g_file_test (symlink_path, G_FILE_TEST_EXISTS)); + g_assert_false (g_file_test (symlink_path, G_FILE_TEST_IS_SYMLINK)); + + g_free (symlink_path); + g_free (target_path); + g_free (file_within_target); + } +#endif +} int main (int argc, @@ -110,5 +205,7 @@ main (int argc, g_test_add_func ("/utils-isolated/user-data-dir", test_user_data_dir); g_test_add_func ("/utils-isolated/user-state-dir", test_user_state_dir); g_test_add_func ("/utils-isolated/user-runtime-dir", test_user_runtime_dir); + g_test_add_func ("/utils-isolated/cleanup/handles-errors", test_cleanup_handles_errors); + g_test_add_func ("/utils-isolated/cleanup/doesnt-follow-symlinks", test_cleanup_doesnt_follow_symlinks); return g_test_run (); } diff --git a/gobject/gobject.c b/gobject/gobject.c index aeef71064..5a5b1cdc1 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -1020,7 +1020,7 @@ g_object_do_class_init (GObjectClass *class) * ]| * * It is important to note that you must use - * [canonical parameter names][canonical-parameter-names] as + * [canonical parameter names][class@GObject.ParamSpec#parameter-names] as * detail strings for the notify signal. */ gobject_signals[NOTIFY] = diff --git a/gobject/gparam.c b/gobject/gparam.c index be6de411a..7ad8e76ae 100644 --- a/gobject/gparam.c +++ b/gobject/gparam.c @@ -389,8 +389,8 @@ is_canonical (const gchar *key) * dynamically-generated properties which need to be validated at run-time * before actually trying to create them. * - * See [canonical parameter names][canonical-parameter-names] for details of - * the rules for valid names. + * See [canonical parameter names][class@GObject.ParamSpec#parameter-names] + * for details of the rules for valid names. * * Returns: %TRUE if @name is a valid property name, %FALSE otherwise. * Since: 2.66 @@ -429,9 +429,9 @@ g_param_spec_is_valid_name (const gchar *name) * * Creates a new #GParamSpec instance. * - * See [canonical parameter names][canonical-parameter-names] for details of - * the rules for @name. Names which violate these rules lead to undefined - * behaviour. + * See [canonical parameter names][class@GObject.ParamSpec#parameter-names] + * for details of the rules for @name. Names which violate these rules lead + * to undefined behaviour. * * Beyond the name, #GParamSpecs have two more descriptive strings, the * @nick and @blurb, which may be used as a localized label and description. diff --git a/gobject/gsignal.c b/gobject/gsignal.c index a5b471cb3..d4a1bb996 100644 --- a/gobject/gsignal.c +++ b/gobject/gsignal.c @@ -283,9 +283,8 @@ is_canonical (const gchar *key) * Validate a signal name. This can be useful for dynamically-generated signals * which need to be validated at run-time before actually trying to create them. * - * See [canonical parameter names][canonical-parameter-names] for details of - * the rules for valid names. The rules for signal names are the same as those - * for property names. + * See [func@GObject.signal_new] for details of the rules for valid names. + * The rules for signal names are the same as those for property names. * * Returns: %TRUE if @name is a valid signal name, %FALSE otherwise. * Since: 2.66 diff --git a/meson.build b/meson.build index aad78f574..2eeb59407 100644 --- a/meson.build +++ b/meson.build @@ -14,7 +14,7 @@ fs = import('fs') cc = meson.get_compiler('c') c_standards = {} -foreach std : ['90', '99', '11', '17'] +foreach std : ['89', '99', '11', '17'] arg = (cc.get_id() == 'msvc' ? '/std:' : '-std=') + 'c' + std if cc.has_argument(arg) c_standards += { std: arg } @@ -385,6 +385,7 @@ headers = [ 'dirent.h', # MSC does not come with this by default 'float.h', 'fstab.h', + 'ftw.h', 'grp.h', 'inttypes.h', 'libproc.h', @@ -2519,19 +2520,35 @@ elif host_system == 'cygwin' endif # Tracing: dtrace -want_dtrace = get_option('dtrace') -enable_dtrace = false +dtrace_option = get_option('dtrace') +enable_dtrace = dtrace_option.allowed() -# Since dtrace support is opt-in we just error out if it was requested but -# is not available. We don't bother with autodetection yet. -if want_dtrace - if glib_have_carbon +if glib_have_carbon + if dtrace_option.enabled() error('GLib dtrace support not yet compatible with macOS dtrace') + else + enable_dtrace = false endif - dtrace = find_program('dtrace', required : true) # error out if not found +endif + +if enable_dtrace + dtrace = find_program('dtrace', required : dtrace_option) + if not dtrace.found() + enable_dtrace = false + endif +endif + +if enable_dtrace if not cc.has_header('sys/sdt.h') - error('dtrace support needs sys/sdt.h header') + if dtrace_option.enabled() + error('dtrace support needs sys/sdt.h header') + else + enable_dtrace = false + endif endif +endif + +if enable_dtrace # FIXME: autotools build also passes -fPIC -DPIC but is it needed in this case? dtrace_obj_gen = generator(dtrace, output : '@BASENAME@.o', @@ -2552,7 +2569,6 @@ with open(output, "w") as f: f.write(contents) ''', dtrace.full_path(), '-h', '-s', '@INPUT@', '-o', '@OUTPUT@']) glib_conf.set('HAVE_DTRACE', 1) - enable_dtrace = true endif if cc.has_header_symbol('sys/ptrace.h', 'PTRACE_O_EXITKILL') @@ -2560,10 +2576,10 @@ if cc.has_header_symbol('sys/ptrace.h', 'PTRACE_O_EXITKILL') endif # systemtap -want_systemtap = get_option('systemtap') -enable_systemtap = false +systemtap = get_option('systemtap').require(enable_dtrace, error_message: 'Cannot enable systemtap because dtrace feature is disabled') +enable_systemtap = systemtap.allowed() -if want_systemtap and enable_dtrace +if enable_systemtap tapset_install_dir = get_option('tapset_install_dir') if tapset_install_dir == '' tapset_install_dir = join_paths(get_option('datadir'), 'systemtap/tapset', host_machine.cpu_family()) @@ -2572,7 +2588,6 @@ if want_systemtap and enable_dtrace stp_cdata.set('ABS_GLIB_RUNTIME_LIBDIR', glib_libdir) stp_cdata.set('LT_CURRENT', minor_version * 100) stp_cdata.set('LT_REVISION', micro_version) - enable_systemtap = true endif # introspection @@ -2633,9 +2648,11 @@ if rst2man.found() rst2man_flags = [ '--syntax-highlight=none', ] - man1_dir = join_paths(glib_prefix, get_option('mandir'), 'man1') + man1_dir = glib_prefix / get_option('mandir') / 'man1' endif +rst2html5 = find_program('rst2html5', 'rst2html5.py', required: get_option('documentation')) + gnome = import('gnome') subdir('docs/reference') @@ -2696,7 +2713,7 @@ endif summary({ 'xattr' : xattr_dep.length() > 0, 'man-pages' : get_option('man-pages'), - 'dtrace' : get_option('dtrace'), + 'dtrace' : enable_dtrace, 'systemtap' : enable_systemtap, 'sysprof' : libsysprof_capture_dep.found(), 'documentation' : get_option('documentation'), diff --git a/meson_options.txt b/meson_options.txt index 69a2135bc..14ece1039 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -50,13 +50,15 @@ option('man-pages', deprecated : { 'true': 'enabled', 'false': 'disabled' }) option('dtrace', - type : 'boolean', - value : false, + type : 'feature', + value : 'auto', + deprecated : { 'true': 'enabled', 'false': 'disabled' }, description : 'include tracing support for dtrace') option('systemtap', - type : 'boolean', - value : false, + type : 'feature', + value : 'auto', + deprecated : { 'true': 'enabled', 'false': 'disabled' }, description : 'include tracing support for systemtap') option('tapset_install_dir', @@ -66,7 +68,7 @@ option('tapset_install_dir', option('sysprof', type : 'feature', - value : 'disabled', + value : 'auto', description : 'include tracing support for sysprof') option('documentation', @@ -12,8 +12,8 @@ msgid "" msgstr "" "Project-Id-Version: glib 2.8\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/glib/issues/new\n" -"POT-Creation-Date: 2024-02-14 09:23+0000\n" -"PO-Revision-Date: 2024-02-19 11:48+0100\n" +"POT-Creation-Date: 2024-05-15 11:20+0000\n" +"PO-Revision-Date: 2024-05-26 00:17+0200\n" "Last-Translator: Jordi Mas i Hernàndez <jmas@softcatala.org>\n" "Language-Team: Catalan <tradgnome@softcatala.org>\n" "Language: ca\n" @@ -21,7 +21,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 3.0.1\n" +"X-Generator: Poedit 2.4.2\n" "X-Project-Style: gnome\n" #: gio/gappinfo.c:339 @@ -78,8 +78,7 @@ msgstr "Reemplaça la instància en execució" msgid "Print help" msgstr "Mostra l'ajuda" -#: gio/gapplication-tool.c:49 gio/gresource-tool.c:498 -#: gio/gresource-tool.c:566 +#: gio/gapplication-tool.c:49 gio/gresource-tool.c:498 gio/gresource-tool.c:566 msgid "[COMMAND]" msgstr "[ORDRE]" @@ -138,7 +137,7 @@ msgid "APPID" msgstr "APPID" #: gio/gapplication-tool.c:74 gio/gapplication-tool.c:137 gio/gdbus-tool.c:108 -#: gio/gio-tool.c:259 +#: gio/gio-tool.c:259 gio/glib-compile-resources.c:834 msgid "COMMAND" msgstr "ORDRE" @@ -151,16 +150,19 @@ msgid "Application identifier in D-Bus format (eg: org.example.viewer)" msgstr "" "Identificador de l'aplicació en format D-Bus (p. ex.: org.example.viewer)" +#. Translators: commandline placeholder #: gio/gapplication-tool.c:76 gio/glib-compile-resources.c:822 #: gio/glib-compile-resources.c:828 gio/glib-compile-resources.c:858 #: gio/gresource-tool.c:504 gio/gresource-tool.c:570 +#: girepository/compiler/compiler.c:148 girepository/compiler/compiler.c:149 +#: girepository/compiler/compiler.c:168 girepository/decompiler/decompiler.c:52 +#: girepository/decompiler/decompiler.c:65 msgid "FILE" msgstr "FITXER" #: gio/gapplication-tool.c:76 msgid "Optional relative or absolute filenames, or URIs to open" -msgstr "" -"Noms de fitxers relatius opcionals o relatius, o URI que s'han d'obrir" +msgstr "Noms de fitxers relatius opcionals o relatius, o URI que s'han d'obrir" #: gio/gapplication-tool.c:77 msgid "ACTION" @@ -320,7 +322,7 @@ msgstr "Ja està tancat el flux" msgid "Truncate not supported on base stream" msgstr "No es permet truncar en els fluxos base" -#: gio/gcancellable.c:326 gio/gdbusconnection.c:1844 gio/gdbusprivate.c:1434 +#: gio/gcancellable.c:326 gio/gdbusconnection.c:1994 gio/gdbusprivate.c:1434 #: gio/gsimpleasyncresult.c:871 gio/gsimpleasyncresult.c:897 #, c-format msgid "Operation was cancelled" @@ -421,8 +423,8 @@ msgid "" "Address “%s” is invalid (need exactly one of path, dir, tmpdir, or abstract " "keys)" msgstr "" -"L'adreça «%s» no és vàlida (ha de ser, o bé un camí, o bé un tmpdir " -"-directori temporal-, o bé unes claus abstractes)" +"L'adreça «%s» no és vàlida (ha de ser, o bé un camí, o bé un tmpdir -" +"directori temporal-, o bé unes claus abstractes)" #: gio/gdbusaddress.c:252 gio/gdbusaddress.c:263 gio/gdbusaddress.c:278 #: gio/gdbusaddress.c:339 gio/gdbusaddress.c:350 @@ -466,11 +468,11 @@ msgstr "" #: gio/gdbusaddress.c:519 #, c-format msgid "" -"Error unescaping key or value in Key/Value pair %d, “%s”, in address element" -" “%s”" +"Error unescaping key or value in Key/Value pair %d, “%s”, in address element " +"“%s”" msgstr "" -"S'ha produït un error en suprimir l'escapament d'una clau o d'un valor en la" -" parella clau/valor %d, «%s», de l'element d'adreça «%s»" +"S'ha produït un error en suprimir l'escapament d'una clau o d'un valor en la " +"parella clau/valor %d, «%s», de l'element d'adreça «%s»" #: gio/gdbusaddress.c:587 #, c-format @@ -497,8 +499,7 @@ msgstr "" #: gio/gdbusaddress.c:650 #, c-format -msgid "" -"Error in address “%s” — the noncefile attribute is missing or malformed" +msgid "Error in address “%s” — the noncefile attribute is missing or malformed" msgstr "" "Hi ha un error a l'adreça «%s»: l'atribut noncefile no existeix o està mal " "formatat" @@ -562,16 +563,16 @@ msgstr "" "No s'ha pogut determinar l'adreça del bus de sessió (no està implementat en " "aquest sistema operatiu)" -#: gio/gdbusaddress.c:1377 gio/gdbusconnection.c:7339 +#: gio/gdbusaddress.c:1377 gio/gdbusconnection.c:7787 #, c-format msgid "" -"Cannot determine bus address from DBUS_STARTER_BUS_TYPE environment variable" -" — unknown value “%s”" +"Cannot determine bus address from DBUS_STARTER_BUS_TYPE environment variable " +"— unknown value “%s”" msgstr "" "No es pot determinar l'adreça del bus a través de la variable d'entorn " "«DBUS_STARTER_BUS_TYPE»: conté un valor desconegut «%s»" -#: gio/gdbusaddress.c:1386 gio/gdbusconnection.c:7348 +#: gio/gdbusaddress.c:1386 gio/gdbusconnection.c:7796 msgid "" "Cannot determine bus address because the DBUS_STARTER_BUS_TYPE environment " "variable is not set" @@ -597,11 +598,10 @@ msgstr "" #: gio/gdbusauth.c:480 #, c-format msgid "" -"Exhausted all available authentication mechanisms (tried: %s) (available: " -"%s)" +"Exhausted all available authentication mechanisms (tried: %s) (available: %s)" msgstr "" -"S'han exhaurit tots els mecanismes d'autenticació disponibles (s'han provat:" -" %s) (hi ha disponibles: %s)" +"S'han exhaurit tots els mecanismes d'autenticació disponibles (s'han provat: " +"%s) (hi ha disponibles: %s)" #: gio/gdbusauth.c:1043 msgid "Unexpected lack of content trying to read a byte" @@ -648,8 +648,7 @@ msgstr "L'operació no està implementada" #: gio/gdbusauthmechanismsha1.c:411 #, c-format msgid "Error opening keyring “%s” for reading: " -msgstr "" -"S'ha produït un error en obrir l'anell de claus «%s» per a llegir-lo: " +msgstr "S'ha produït un error en obrir l'anell de claus «%s» per a llegir-lo: " #: gio/gdbusauthmechanismsha1.c:434 gio/gdbusauthmechanismsha1.c:775 #, c-format @@ -669,8 +668,7 @@ msgstr "" #: gio/gdbusauthmechanismsha1.c:462 gio/gdbusauthmechanismsha1.c:803 #, c-format msgid "" -"Second token of line %d of the keyring at “%s” with content “%s” is " -"malformed" +"Second token of line %d of the keyring at “%s” with content “%s” is malformed" msgstr "" "El segon testimoni de la línia %d de l'anell de claus a «%s» amb el " "contingut «%s» no està ben formatat" @@ -714,22 +712,22 @@ msgid "(Additionally, releasing the lock for “%s” also failed: %s) " msgstr "" "(A més a més, l'alliberació del blocatge per a «%s» també ha fallat: %s) " -#: gio/gdbusconnection.c:585 gio/gdbusconnection.c:2392 +#: gio/gdbusconnection.c:733 gio/gdbusconnection.c:2748 msgid "The connection is closed" msgstr "La connexió està tancada" -#: gio/gdbusconnection.c:1876 +#: gio/gdbusconnection.c:2026 msgid "Timeout was reached" msgstr "S'ha esgotat el temps d'espera" -#: gio/gdbusconnection.c:2515 +#: gio/gdbusconnection.c:2871 msgid "" "Unsupported flags encountered when constructing a client-side connection" msgstr "" "S'han trobat senyaladors no implementats en construir-se la part de la " "connexió del client" -#: gio/gdbusconnection.c:4277 gio/gdbusconnection.c:4631 +#: gio/gdbusconnection.c:4719 gio/gdbusconnection.c:5073 #, c-format msgid "" "No such interface “org.freedesktop.DBus.Properties” on object at path %s" @@ -737,80 +735,80 @@ msgstr "" "No existeix la interfície «org.freedesktop.DBus.Properties» en l'objecte al " "camí %s" -#: gio/gdbusconnection.c:4422 +#: gio/gdbusconnection.c:4864 #, c-format msgid "No such property “%s”" msgstr "No existeix la propietat «%s»" -#: gio/gdbusconnection.c:4434 +#: gio/gdbusconnection.c:4876 #, c-format msgid "Property “%s” is not readable" msgstr "La propietat «%s» no és de lectura" -#: gio/gdbusconnection.c:4445 +#: gio/gdbusconnection.c:4887 #, c-format msgid "Property “%s” is not writable" msgstr "La propietat «%s» no és d'escriptura" -#: gio/gdbusconnection.c:4465 +#: gio/gdbusconnection.c:4907 #, c-format msgid "Error setting property “%s”: Expected type “%s” but got “%s”" msgstr "" "S'ha produït un error en establir la propietat «%s»: s'esperava el tipus " "«%s», però s'ha obtingut el «%s»" -#: gio/gdbusconnection.c:4570 gio/gdbusconnection.c:4785 -#: gio/gdbusconnection.c:6762 +#: gio/gdbusconnection.c:5012 gio/gdbusconnection.c:5227 +#: gio/gdbusconnection.c:7207 #, c-format msgid "No such interface “%s”" msgstr "No existeix la interfície «%s»" -#: gio/gdbusconnection.c:5001 gio/gdbusconnection.c:7279 +#: gio/gdbusconnection.c:5443 gio/gdbusconnection.c:7727 #, c-format msgid "No such interface “%s” on object at path %s" msgstr "No existeix la interfície «%s» en l'objecte al camí %s" -#: gio/gdbusconnection.c:5102 +#: gio/gdbusconnection.c:5544 #, c-format msgid "No such method “%s”" msgstr "No existeix el mètode «%s»" -#: gio/gdbusconnection.c:5133 +#: gio/gdbusconnection.c:5575 #, c-format msgid "Type of message, “%s”, does not match expected type “%s”" msgstr "El tipus de missatge «%s» no correspon al tipus «%s» que s'esperava" -#: gio/gdbusconnection.c:5336 +#: gio/gdbusconnection.c:5778 #, c-format msgid "An object is already exported for the interface %s at %s" msgstr "Ja hi ha un objecte exportat per a la interfície %s a %s" -#: gio/gdbusconnection.c:5563 +#: gio/gdbusconnection.c:6008 #, c-format msgid "Unable to retrieve property %s.%s" msgstr "No s'ha pogut recuperar la propietat %s.%s" -#: gio/gdbusconnection.c:5619 +#: gio/gdbusconnection.c:6064 #, c-format msgid "Unable to set property %s.%s" msgstr "No s'ha pogut establir la propietat %s.%s" -#: gio/gdbusconnection.c:5798 +#: gio/gdbusconnection.c:6243 #, c-format msgid "Method “%s” returned type “%s”, but expected “%s”" msgstr "El mètode «%s» ha retornat un tipus «%s», però s'esperava «%s»" -#: gio/gdbusconnection.c:6874 +#: gio/gdbusconnection.c:7319 #, c-format msgid "Method “%s” on interface “%s” with signature “%s” does not exist" msgstr "No existeix el mètode «%s» a la interfície «%s» amb la signatura «%s»" -#: gio/gdbusconnection.c:6995 +#: gio/gdbusconnection.c:7440 #, c-format msgid "A subtree is already exported for %s" msgstr "Ja està exportat un subarbre per a %s" -#: gio/gdbusconnection.c:7287 +#: gio/gdbusconnection.c:7735 #, c-format msgid "Object does not exist at path “%s”" msgstr "L'objecte no existeix al camí «%s»" @@ -835,11 +833,11 @@ msgstr "Missatge %s: s'ha subministrat un camp de capçalera NO VÀLID" #: gio/gdbusmessage.c:1424 #, c-format msgid "" -"%s message: PATH header field is using the reserved value " -"/org/freedesktop/DBus/Local" +"%s message: PATH header field is using the reserved value /org/freedesktop/" +"DBus/Local" msgstr "" -"Missatge %s: el camp de capçalera PATH està utilitzant el valor reservat " -"/org/freedesktop/DBus/Local" +"Missatge %s: el camp de capçalera PATH està utilitzant el valor reservat /" +"org/freedesktop/DBus/Local" #: gio/gdbusmessage.c:1437 #, c-format @@ -852,8 +850,8 @@ msgstr "" #: gio/gdbusmessage.c:1446 #, c-format msgid "" -"%s message: INTERFACE header field is using the reserved value " -"org.freedesktop.DBus.Local" +"%s message: INTERFACE header field is using the reserved value org." +"freedesktop.DBus.Local" msgstr "" "Missatge %s: el camp de capçalera de la INTERFÍCIE està utilitzant el valor " "reservat org.freedesktop.DBus.Local" @@ -866,8 +864,7 @@ msgstr "" #: gio/gdbusmessage.c:1472 #, c-format -msgid "" -"%s message: ERROR_NAME header field does not contain a valid error name" +msgid "%s message: ERROR_NAME header field does not contain a valid error name" msgstr "" "Missatge %s: el camp de la capçalera ERRORNAME no conté un nom d'error vàlid" @@ -893,8 +890,7 @@ msgstr "" #, c-format msgid "" "Expected valid UTF-8 string but found invalid bytes at byte offset %d " -"(length of string is %d). The valid UTF-8 string up until that point was " -"“%s”" +"(length of string is %d). The valid UTF-8 string up until that point was “%s”" msgstr "" "S'esperava una cadena UTF-8 vàlida però s'han trobat bytes no vàlids a " "l'òfset %d (la llargada de la cadena és %d). La cadena UTF-8 vàlida fins " @@ -919,8 +915,7 @@ msgstr "El valor analitzat «%s» no és una signatura D-Bus vàlida" msgid "" "Encountered array of length %u byte. Maximum length is 2<<26 bytes (64 MiB)." msgid_plural "" -"Encountered array of length %u bytes. Maximum length is 2<<26 bytes (64 " -"MiB)." +"Encountered array of length %u bytes. Maximum length is 2<<26 bytes (64 MiB)." msgstr[0] "" "S'ha trobat una matriu de llargada %u byte. La llargada màxima és de 2<<26 " "bytes (64 MiB)." @@ -949,8 +944,7 @@ msgstr "El valor analitzat «%s» per variant no és una signatura D-Bus vàlida #: gio/gdbusmessage.c:2190 #, c-format msgid "" -"Error deserializing GVariant with type string “%s” from the D-Bus wire " -"format" +"Error deserializing GVariant with type string “%s” from the D-Bus wire format" msgstr "" "S'ha produït un error en convertir a estructura de dades la GVariant amb el " "tipus de cadena «%s» del format de cable D-Bus" @@ -1005,8 +999,8 @@ msgstr "No s'ha pogut tornar a convertir el missatge a estructura de dades: " msgid "" "Error serializing GVariant with type string “%s” to the D-Bus wire format" msgstr "" -"No s'ha pogut convertir a seqüència de bits la GVariant de tipus cadena «%s»" -" al format de cable D-Bus" +"No s'ha pogut convertir a seqüència de bits la GVariant de tipus cadena «%s» " +"al format de cable D-Bus" #: gio/gdbusmessage.c:3012 #, c-format @@ -1061,8 +1055,8 @@ msgstr "(Premeu qualsevol tecla per a tancar aquesta finestra)\n" #, c-format msgid "Session dbus not running, and autolaunch failed" msgstr "" -"El bus de sessió (D-Bus) no està en funcionament i l'arrencada automàtica no" -" ha funcionat" +"El bus de sessió (D-Bus) no està en funcionament i l'arrencada automàtica no " +"ha funcionat" #: gio/gdbusprivate.c:2410 #, c-format @@ -1141,7 +1135,8 @@ msgstr "" " emit Emet un senyal\n" " wait Espera que aparegui un nom de bus\n" "\n" -"Utilitzeu «%s ORDRE --help» per a veure l'ajuda de cada ordre en particular.\n" +"Utilitzeu «%s ORDRE --help» per a veure l'ajuda de cada ordre en " +"particular.\n" #: gio/gdbus-tool.c:204 gio/gdbus-tool.c:276 gio/gdbus-tool.c:347 #: gio/gdbus-tool.c:371 gio/gdbus-tool.c:861 gio/gdbus-tool.c:1246 @@ -1178,6 +1173,10 @@ msgstr "Connecta al bus de la sessió" msgid "Connect to given D-Bus address" msgstr "Connecta a l'adreça de D-Bus donada" +#: gio/gdbus-tool.c:407 +msgid "ADDRESS" +msgstr "ADREÇA" + #: gio/gdbus-tool.c:417 msgid "Connection Endpoint Options:" msgstr "Opcions del punt final de connexió:" @@ -1318,7 +1317,8 @@ msgstr "Error: el nom del mètode «%s» no és vàlid\n" #: gio/gdbus-tool.c:1169 #, c-format msgid "Error parsing parameter %d of type “%s”: %s\n" -msgstr "S'ha produït un error en analitzar el paràmetre %d del tipus «%s»: %s\n" +msgstr "" +"S'ha produït un error en analitzar el paràmetre %d del tipus «%s»: %s\n" #: gio/gdbus-tool.c:1195 #, c-format @@ -1373,8 +1373,8 @@ msgstr "Servei a activar abans d'esperar l'altre (nom conegut)" #: gio/gdbus-tool.c:2205 msgid "" -"Timeout to wait for before exiting with an error (seconds); 0 for no timeout" -" (default)" +"Timeout to wait for before exiting with an error (seconds); 0 for no timeout " +"(default)" msgstr "" "Temps d'espera abans de sortir amb un error (segons); 0 si no voleu temps " "d'espera (predeterminat)" @@ -1521,6 +1521,7 @@ msgstr "S'esperava un GEmblem per a un GEmblemedIcon" #. Translators: This is an error message when #. * trying to find the enclosing (user visible) #. * mount of a file, but none exists. +#. #: gio/gfile.c:1604 msgid "Containing mount does not exist" msgstr "No existeix el punt de muntatge contenidor" @@ -1562,8 +1563,7 @@ msgstr "" #: gio/gfile.c:3331 msgid "Copy (reflink/clone) is not supported or invalid" -msgstr "" -"No està implementada o no és vàlida la còpia (referències, clonacions)" +msgstr "No està implementada o no és vàlida la còpia (referències, clonacions)" #: gio/gfile.c:3336 msgid "Copy (reflink/clone) is not supported or didn’t work" @@ -1583,7 +1583,7 @@ msgstr "No es pot copiar el fitxer especial" msgid "Invalid symlink value given" msgstr "El valor donat per a l'enllaç simbòlic no és vàlid" -#: gio/gfile.c:4342 glib/gfileutils.c:2399 +#: gio/gfile.c:4342 glib/gfileutils.c:2409 msgid "Symbolic links not supported" msgstr "No es poden utilitzar els enllaços simbòlics" @@ -1911,8 +1911,7 @@ msgstr "Conserva tots els atributs" #: gio/gio-tool-copy.c:50 gio/gio-tool-move.c:43 gio/gio-tool-save.c:51 msgid "Backup existing destination files" msgstr "" -"Crea una còpia de seguretat dels fitxers existents al directori de " -"destinació" +"Crea una còpia de seguretat dels fitxers existents al directori de destinació" #: gio/gio-tool-copy.c:51 msgid "Never follow symbolic links" @@ -2058,8 +2057,10 @@ msgid "" msgstr "" "gio info és similar a l'eina tradicional ls, però usant ubicacions GIO\n" "en comptes de fitxers locals: per exemple, podeu usar quelcom com ara\n" -"smb://servidor/recurs/fitxer.txt com a ubicació. Els atributs de fitxer poden\n" -"especificar-se amb el seu nom GIO. Per exemple, standard::icon o usant només el\n" +"smb://servidor/recurs/fitxer.txt com a ubicació. Els atributs de fitxer " +"poden\n" +"especificar-se amb el seu nom GIO. Per exemple, standard::icon o usant només " +"el\n" "nom d'espais, p. ex. unix, o usant «*», que coincideix amb tots els atributs" #. Translators: commandline placeholder @@ -2127,7 +2128,8 @@ msgid "" msgstr "" "gio list és similar a l'eina tradicional ls, però usant ubicacions GIO\n" "en comptes de fitxers locals: per exemple, podeu usar quelcom com ara\n" -"smb://servidor/recurs/fitxer.txt com a ubicació. Els atributs de fitxer poden\n" +"smb://servidor/recurs/fitxer.txt com a ubicació. Els atributs de fitxer " +"poden\n" "especificar-se amb el seu nom GIO. Per exemple, standard::icon" #. Translators: commandline placeholder @@ -2192,8 +2194,7 @@ msgstr "No s'ha pogut carregar la informació del gestor «%s»" #, c-format msgid "Failed to set “%s” as the default handler for “%s”: %s\n" msgstr "" -"S'ha produït un error en establir «%s» com a gestor per defecte de «%s»: " -"%s\n" +"S'ha produït un error en establir «%s» com a gestor per defecte de «%s»: %s\n" #: gio/gio-tool-mkdir.c:33 msgid "Create parent directories" @@ -2410,14 +2411,12 @@ msgstr "En crear un fitxer, limita'n l'accés a només l'usuari actual" msgid "When replacing, replace as if the destination did not exist" msgstr "Quan es reemplaci, fes com si el destí no existís" -#. Translators: The "etag" is a token allowing to verify whether a file has -#. been modified +#. Translators: The "etag" is a token allowing to verify whether a file has been modified #: gio/gio-tool-save.c:57 msgid "Print new etag at end" msgstr "Mostra la nova etag al final" -#. Translators: The "etag" is a token allowing to verify whether a file has -#. been modified +#. Translators: The "etag" is a token allowing to verify whether a file has been modified #: gio/gio-tool-save.c:59 msgid "The etag of the file being overwritten" msgstr "L'etag del fitxer que s'està sobreescrivint" @@ -2430,8 +2429,7 @@ msgstr "ETAG" msgid "Error reading from standard input" msgstr "S'ha produït un error en llegir de l'entrada estàndard" -#. Translators: The "etag" is a token allowing to verify whether a file has -#. been modified +#. Translators: The "etag" is a token allowing to verify whether a file has been modified #: gio/gio-tool-save.c:141 msgid "Etag not available\n" msgstr "L'etag no està disponible\n" @@ -2498,8 +2496,8 @@ msgid "" "Restore a file from trash to its original location (possibly recreating the " "directory)" msgstr "" -"Restaura un fitxer de la paperera a la ubicació original (i torna a crear el" -" directori si cal)" +"Restaura un fitxer de la paperera a la ubicació original (i torna a crear el " +"directori si cal)" #: gio/gio-tool-trash.c:108 msgid "Unable to find original path" @@ -2570,6 +2568,7 @@ msgstr "Es desconeix l'opció de processament «%s»" #. Translators: the first %s is a gresource XML attribute, #. * the second %s is an environment variable, and the third #. * %s is a command line tool +#. #: gio/glib-compile-resources.c:312 gio/glib-compile-resources.c:369 #: gio/glib-compile-resources.c:426 #, c-format @@ -2610,7 +2609,8 @@ msgstr "" "directori actual)" #: gio/glib-compile-resources.c:823 gio/glib-compile-schemas.c:2173 -#: gio/glib-compile-schemas.c:2203 +#: gio/glib-compile-schemas.c:2203 girepository/compiler/compiler.c:147 +#: girepository/decompiler/decompiler.c:53 msgid "DIRECTORY" msgstr "DIRECTORI" @@ -2664,6 +2664,10 @@ msgid "C identifier name used for the generated source code" msgstr "" "El nom de l'identificador de C que s'utilitzarà en el codi font generat" +#: gio/glib-compile-resources.c:833 +msgid "IDENTIFIER" +msgstr "IDENTIFICADOR" + #: gio/glib-compile-resources.c:834 msgid "The target C compiler (default: the CC environment variable)" msgstr "El compilador C de destinació (per defecte: la variable d'entorn CC)" @@ -2861,8 +2865,7 @@ msgstr "" #: gio/glib-compile-schemas.c:828 #, c-format msgid "Invalid name “%s”: two successive hyphens (“--”) are not permitted" -msgstr "" -"El nom «%s» no és vàlid: no es poden posar dos guionets seguits («--»)" +msgstr "El nom «%s» no és vàlid: no es poden posar dos guionets seguits («--»)" #: gio/glib-compile-schemas.c:837 #, c-format @@ -2960,14 +2963,14 @@ msgstr "No es pot ampliar un esquema amb un camí" msgid "" "<schema id='%s'> is a list, extending <schema id='%s'> which is not a list" msgstr "" -"El <schema id='%s'> és una llista i amplia el <schema id='%s'> que no és una" -" llista" +"El <schema id='%s'> és una llista i amplia el <schema id='%s'> que no és una " +"llista" #: gio/glib-compile-schemas.c:1207 #, c-format msgid "" -"<schema id='%s' list-of='%s'> extends <schema id='%s' list-of='%s'> but “%s”" -" does not extend “%s”" +"<schema id='%s' list-of='%s'> extends <schema id='%s' list-of='%s'> but “%s” " +"does not extend “%s”" msgstr "" "El <schema id='%s' list-of='%s'> amplia el <schema id='%s' list-of='%s'> " "però «%s» no amplia «%s»" @@ -2985,11 +2988,11 @@ msgstr "El camí d'una llista ha d'acabar amb «:/»" #: gio/glib-compile-schemas.c:1240 #, c-format msgid "" -"Warning: Schema “%s” has path “%s”. Paths starting with “/apps/”, " -"“/desktop/” or “/system/” are deprecated." +"Warning: Schema “%s” has path “%s”. Paths starting with “/apps/”, “/" +"desktop/” or “/system/” are deprecated." msgstr "" -"Avís: l'esquema «%s» conté el camí «%s». Els camins que comencen amb " -"«/apps/», «/desktop/» o «/system/» estan obsolets." +"Avís: l'esquema «%s» conté el camí «%s». Els camins que comencen amb «/" +"apps/», «/desktop/» o «/system/» estan obsolets." #: gio/glib-compile-schemas.c:1270 #, c-format @@ -3036,8 +3039,8 @@ msgstr "S'està ignorant aquest fitxer." #: gio/glib-compile-schemas.c:1963 #, c-format msgid "" -"No such key “%s” in schema “%s” as specified in override file “%s”; ignoring" -" override for this key." +"No such key “%s” in schema “%s” as specified in override file “%s”; ignoring " +"override for this key." msgstr "" "No existeix la clau «%s» en l'esquema «%s» tal com especifica el fitxer de " "sobreescriptura «%s»; s'ignora la sobreescriptura d'aquesta clau." @@ -3046,8 +3049,8 @@ msgstr "" #: gio/glib-compile-schemas.c:1971 #, c-format msgid "" -"No such key “%s” in schema “%s” as specified in override file “%s” and " -"--strict was specified; exiting." +"No such key “%s” in schema “%s” as specified in override file “%s” and --" +"strict was specified; exiting." msgstr "" "No existeix la clau «%s» en l'esquema «%s» tal com especifica el fitxer de " "sobreescriptura «%s» i s'ha especificat --strict; se surt." @@ -3055,22 +3058,22 @@ msgstr "" #: gio/glib-compile-schemas.c:1993 #, c-format msgid "" -"Cannot provide per-desktop overrides for localized key “%s” in schema “%s” " -"(override file “%s”); ignoring override for this key." +"Cannot provide per-desktop overrides for localized key “%s” in schema " +"“%s” (override file “%s”); ignoring override for this key." msgstr "" -"No es pot proveir la sobreescriptura per escriptori de la clau traduïda «%s»" -" a l'esquema «%s» (fitxer de sobreescriptura «%s»); s'ignora la " +"No es pot proveir la sobreescriptura per escriptori de la clau traduïda «%s» " +"a l'esquema «%s» (fitxer de sobreescriptura «%s»); s'ignora la " "sobreescriptura d'aquesta clau." #: gio/glib-compile-schemas.c:2002 #, c-format msgid "" -"Cannot provide per-desktop overrides for localized key “%s” in schema “%s” " -"(override file “%s”) and --strict was specified; exiting." +"Cannot provide per-desktop overrides for localized key “%s” in schema " +"“%s” (override file “%s”) and --strict was specified; exiting." msgstr "" -"No es pot proveir la sobreescriptura per escriptori de la clau traduïda «%s»" -" a l'esquema «%s» (fitxer de sobreescriptura «%s») i s'ha especificat " -"--strict; se surt." +"No es pot proveir la sobreescriptura per escriptori de la clau traduïda «%s» " +"a l'esquema «%s» (fitxer de sobreescriptura «%s») i s'ha especificat --" +"strict; se surt." #: gio/glib-compile-schemas.c:2026 #, c-format @@ -3089,8 +3092,8 @@ msgid "" "%s. --strict was specified; exiting." msgstr "" "S'ha produït un error en analitzar la clau «%s» en l'esquema «%s» tal com " -"especifica el fitxer de sobreescriptura «%s»: %s. S'ha especificat --strict;" -" se surt." +"especifica el fitxer de sobreescriptura «%s»: %s. S'ha especificat --strict; " +"se surt." #: gio/glib-compile-schemas.c:2065 #, c-format @@ -3129,8 +3132,8 @@ msgid "" "list of valid choices and --strict was specified; exiting." msgstr "" "La sobreescriptura de la clau «%s» de l'esquema «%s» en el fitxer de " -"sobreescriptura «%s» no és a la llista de valors vàlids i s'ha especificat " -"--strict; se surt." +"sobreescriptura «%s» no és a la llista de valors vàlids i s'ha especificat --" +"strict; se surt." #: gio/glib-compile-schemas.c:2173 msgid "Where to store the gschemas.compiled file" @@ -3186,6 +3189,7 @@ msgstr "" #. Translators: This is an error message when trying to find #. * the enclosing (user visible) mount of a file, but none #. * exists. +#. #: gio/glocalfile.c:1150 #, c-format msgid "Containing mount for file %s not found" @@ -3989,7 +3993,8 @@ msgstr "" "Ordres:\n" " help Mostra aquesta informació\n" " list-schemas Llista els esquemes instal·lats\n" -" list-relocatable-schemas Llista els esquemes que es poden canviar de lloc\n" +" list-relocatable-schemas Llista els esquemes que es poden canviar de " +"lloc\n" " list-keys Llista les claus d'un esquema\n" " list-children Llista els fills d'un esquema\n" " list-recursively Llista les claus i els valors recursivament\n" @@ -4021,7 +4026,8 @@ msgstr "" #: gio/gsettings-tool.c:716 msgid " SCHEMADIR A directory to search for additional schemas\n" -msgstr " DIRECTORI_D'ESQUEMES Un directori on cercar-hi esquemes addicionals\n" +msgstr "" +" DIRECTORI_D'ESQUEMES Un directori on cercar-hi esquemes addicionals\n" #: gio/gsettings-tool.c:724 msgid "" @@ -4309,8 +4315,8 @@ msgstr "El servidor intermediari SOCKSv5 requereix autenticació." #: gio/gsocks5proxy.c:193 msgid "" -"The SOCKSv5 proxy requires an authentication method that is not supported by" -" GLib." +"The SOCKSv5 proxy requires an authentication method that is not supported by " +"GLib." msgstr "" "El servidor intermediari SOCKSv5 requereix un mètode d'autenticació que " "encara no està implementat a la GLib." @@ -4534,8 +4540,7 @@ msgstr "S'ha produït un error en habilitar «SO_PASSCRED»: %s" #: gio/gunixconnection.c:576 msgid "" -"Expecting to read a single byte for receiving credentials but read zero " -"bytes" +"Expecting to read a single byte for receiving credentials but read zero bytes" msgstr "" "S'esperava llegir un sol byte per a rebre les credencials però s'han llegit " "zero bytes" @@ -4561,7 +4566,7 @@ msgstr "S'ha produït un error en llegir del descriptor de fitxer: %s" msgid "Error closing file descriptor: %s" msgstr "S'ha produït un error en tancar el descriptor de fitxer: %s" -#: gio/gunixmounts.c:2890 gio/gunixmounts.c:2943 +#: gio/gunixmounts.c:2897 gio/gunixmounts.c:2950 msgid "Filesystem root" msgstr "Arrel del sistema de fitxers" @@ -4655,6 +4660,148 @@ msgstr "Executa un servei de D-Bus" msgid "Wrong args\n" msgstr "Els arguments no són vàlids\n" +#: girepository/compiler/compiler.c:93 +#, c-format +msgid "Failed to open ‘%s’: %s" +msgstr "No s'ha pogut obrir «%s»: %s" + +#: girepository/compiler/compiler.c:103 +#, c-format +msgid "Error: Could not write the whole output: %s" +msgstr "Error: No s'ha pogut escriure la sortida completa: %s" + +#: girepository/compiler/compiler.c:115 +#, c-format +msgid "Error: Failed to rename ‘%s’ to ‘%s’: %s" +msgstr "Error: No s'ha pogut canviar el nom de «%s» per «%s»: %s" + +#: girepository/compiler/compiler.c:147 girepository/decompiler/decompiler.c:53 +msgid "Include directories in GIR search path" +msgstr "" + +#: girepository/compiler/compiler.c:148 girepository/decompiler/decompiler.c:52 +msgid "Output file" +msgstr "Fitxer de sortida" + +#: girepository/compiler/compiler.c:149 +msgid "Shared library" +msgstr "Biblioteca compartida" + +#: girepository/compiler/compiler.c:150 +msgid "Show debug messages" +msgstr "Mostra els missatges de depuració" + +#: girepository/compiler/compiler.c:151 +msgid "Show verbose messages" +msgstr "Mostra missatges detallats" + +#: girepository/compiler/compiler.c:152 girepository/decompiler/decompiler.c:55 +msgid "Show program’s version number and exit" +msgstr "Mostra el número de versió del programa i surt" + +#: girepository/compiler/compiler.c:175 +#, c-format +msgid "Error parsing arguments: %s" +msgstr "S'ha produït un error en analitzar els paràmetres: %s" + +#: girepository/compiler/compiler.c:202 +msgid "Please specify exactly one input file" +msgstr "Especifiqueu exactament un únic fitxer d'entrada" + +#: girepository/compiler/compiler.c:218 +#, c-format +msgid "Error parsing file ‘%s’: %s" +msgstr "S'ha produït un error en analitzar el fitxer «%s»: %s" + +#: girepository/compiler/compiler.c:243 +#, fuzzy, c-format +#| msgid "Failed to load info for handler “%s”" +msgid "Failed to build typelib for module ‘%s’" +msgstr "No s'ha pogut carregar la informació del gestor «%s»" + +#: girepository/compiler/compiler.c:245 +#, fuzzy, c-format +#| msgid "Unable to load ‘%s‘: %s" +msgid "Invalid typelib for module ‘%s’: %s" +msgstr "No s'ha pogut carregar «%s»: %s" + +#: girepository/decompiler/decompiler.c:54 +msgid "Show all available information" +msgstr "Mostra tota la informació disponible" + +#: girepository/decompiler/decompiler.c:71 +#, c-format +msgid "Failed to parse: %s" +msgstr "No s'ha pogut analitzar: %s" + +#: girepository/decompiler/decompiler.c:87 +msgid "No input files" +msgstr "No hi ha cap fitxer d'entrada" + +#: girepository/decompiler/decompiler.c:113 +#, c-format +msgid "Failed to read ‘%s’: %s" +msgstr "No s'ha pogut llegir «%s»: %s" + +#: girepository/decompiler/decompiler.c:125 +#, fuzzy, c-format +#| msgid "Failed to create file “%s”: %s" +msgid "Failed to create typelib ‘%s’: %s" +msgstr "No s'ha pogut crear el fitxer «%s»: %s" + +#: girepository/decompiler/decompiler.c:129 +#: girepository/inspector/inspector.c:113 +#, fuzzy, c-format +#| msgid "Failed to allocate memory" +msgid "Failed to load typelib: %s" +msgstr "No s'ha pogut ubicar memòria" + +#: girepository/decompiler/decompiler.c:136 +#, c-format +msgid "Warning: %u modules omitted" +msgstr "Compte: s'han omès %u mòduls" + +#: girepository/inspector/inspector.c:72 +msgid "Typelib version to inspect" +msgstr "Versió de «typelib» per inspeccionar" + +#: girepository/inspector/inspector.c:72 +msgid "VERSION" +msgstr "VERSIÓ" + +#: girepository/inspector/inspector.c:73 +msgid "List the shared libraries the typelib requires" +msgstr "Llista les biblioteques compartides que requereix «typelib»" + +#: girepository/inspector/inspector.c:74 +msgid "List other typelibs the inspected typelib requires" +msgstr "Llista altres «typelibs» requerides per la «typelib» inspeccionada" + +#: girepository/inspector/inspector.c:75 +msgid "The typelib to inspect" +msgstr "La «typelib» per inspeccionar" + +#: girepository/inspector/inspector.c:75 +msgid "NAMESPACE" +msgstr "ESPAI DE NOMS" + +#: girepository/inspector/inspector.c:82 +msgid "- Inspect GI typelib" +msgstr "" + +#: girepository/inspector/inspector.c:86 +#, c-format +msgid "Failed to parse command line options: %s" +msgstr "No s'han pogut analitzar les opcions de la línia d'ordres: %s" + +#: girepository/inspector/inspector.c:96 +msgid "Please specify exactly one namespace" +msgstr "Especifiqueu un únic espai de noms" + +#: girepository/inspector/inspector.c:105 +msgid "Please specify --print-shlibs, --print-typelibs or both" +msgstr "" + #: glib/gbookmarkfile.c:816 #, c-format msgid "Unexpected attribute “%s” for element “%s”" @@ -4726,8 +4873,8 @@ msgstr "No hi ha cap grup establert a l'adreça d'interès per a l'URI «%s»" #, c-format msgid "No application with name “%s” registered a bookmark for “%s”" msgstr "" -"No hi ha cap aplicació amb el nom «%s» que hagi registrat l'adreça d'interès" -" «%s»" +"No hi ha cap aplicació amb el nom «%s» que hagi registrat l'adreça d'interès " +"«%s»" #: glib/gbookmarkfile.c:3818 #, c-format @@ -4782,8 +4929,7 @@ msgstr "L'URI «%s» conté caràcters d'escapada no vàlids" msgid "The pathname “%s” is not an absolute path" msgstr "El nom de camí «%s» no és un camí absolut" -#. Translators: this is the preferred format for expressing the date and the -#. time +#. Translators: this is the preferred format for expressing the date and the time #: glib/gdatetime.c:199 msgctxt "GDateTime" msgid "%a %b %e %H:%M:%S %Y" @@ -4822,6 +4968,7 @@ msgstr "%I:%M:%S %p" #. * paste here. Note that in most of the languages (western European, #. * non-European) there is no difference between the standalone and #. * complete date form. +#. #: glib/gdatetime.c:247 msgctxt "full month name" msgid "January" @@ -4898,6 +5045,7 @@ msgstr "desembre" #. * and paste here. Note that this feature is not yet supported by any #. * other platform. Here are abbreviated month names in a form #. * appropriate when they are used standalone. +#. #: glib/gdatetime.c:301 msgctxt "abbreviated month name" msgid "Jan" @@ -4906,7 +5054,7 @@ msgstr "gen." #: glib/gdatetime.c:303 msgctxt "abbreviated month name" msgid "Feb" -msgstr "febr." +msgstr "feb." #: glib/gdatetime.c:305 msgctxt "abbreviated month name" @@ -5044,6 +5192,7 @@ msgstr "dg." #. * incorrect in some languages. Note that in most of the languages #. * (western European, non-European) there is no difference between the #. * standalone and complete date form. +#. #: glib/gdatetime.c:441 msgctxt "full month name with day" msgid "January" @@ -5120,6 +5269,7 @@ msgstr "de desembre" #. * `locale abmon' in your native locale produces a complete list of #. * month names almost ready to copy and paste here. In other systems #. * due to a bug the result is incorrect in some languages. +#. #: glib/gdatetime.c:528 msgctxt "abbreviated month name with day" msgid "Jan" @@ -5128,7 +5278,7 @@ msgstr "de gen." #: glib/gdatetime.c:530 msgctxt "abbreviated month name with day" msgid "Feb" -msgstr "de febr." +msgstr "de feb." #: glib/gdatetime.c:532 msgctxt "abbreviated month name with day" @@ -5197,92 +5347,91 @@ msgstr "p. m." msgid "Error opening directory “%s”: %s" msgstr "S'ha produït un error en obrir el directori «%s»: %s" -#: glib/gfileutils.c:716 glib/gfileutils.c:820 -# -msgid "Could not allocate %" -msgid_plural "Could not allocate %" -msgstr[0] "No s'ha pogut assignar %" -msgstr[1] "No s'han pogut assignar %" +#. Translators: the first %s contains the file size +#. * (already formatted with units), and the second %s +#. * contains the file name +#: glib/gfileutils.c:720 glib/gfileutils.c:829 +#, c-format +msgid "Could not allocate %s to read file “%s”" +msgstr "No s'han pogut reservar %s per a llegir el fitxer «%s»" -#: glib/gfileutils.c:733 +#: glib/gfileutils.c:738 #, c-format msgid "Error reading file “%s”: %s" msgstr "S'ha produït un error en llegir el fitxer «%s»: %s" -#: glib/gfileutils.c:769 glib/gfileutils.c:803 +#: glib/gfileutils.c:774 glib/gfileutils.c:808 #, c-format msgid "File “%s” is too large" msgstr "El fitxer «%s» és massa gran" -#: glib/gfileutils.c:845 +#: glib/gfileutils.c:855 #, c-format msgid "Failed to read from file “%s”: %s" msgstr "No s'ha pogut llegir del fitxer «%s»: %s" -#: glib/gfileutils.c:895 glib/gfileutils.c:970 glib/gfileutils.c:1477 +#: glib/gfileutils.c:905 glib/gfileutils.c:980 glib/gfileutils.c:1487 #, c-format msgid "Failed to open file “%s”: %s" msgstr "No s'ha pogut obrir el fitxer «%s»: %s" -#: glib/gfileutils.c:908 +#: glib/gfileutils.c:918 #, c-format msgid "Failed to get attributes of file “%s”: fstat() failed: %s" msgstr "" "No s'han pogut obtenir els atributs del fitxer «%s»: ha fallat la funció " "fstat(): %s" -#: glib/gfileutils.c:939 +#: glib/gfileutils.c:949 #, c-format msgid "Failed to open file “%s”: fdopen() failed: %s" msgstr "No s'ha pogut obrir el fitxer «%s»: ha fallat la funció fdopen(): %s" -#: glib/gfileutils.c:1040 +#: glib/gfileutils.c:1050 #, c-format msgid "Failed to rename file “%s” to “%s”: g_rename() failed: %s" msgstr "" "No s'ha pogut canviar el nom del fitxer «%s» a «%s»: ha fallat la funció " "g_rename(): %s" -#: glib/gfileutils.c:1139 +#: glib/gfileutils.c:1149 #, c-format msgid "Failed to write file “%s”: ftruncate() failed: %s" msgstr "No s'ha pogut escriure el fitxer «%s»: ha fallat ftruncate(): %s" -#: glib/gfileutils.c:1184 +#: glib/gfileutils.c:1194 #, c-format msgid "Failed to write file “%s”: write() failed: %s" -msgstr "" -"No s'ha pogut escriure el fitxer «%s»: ha fallat la funció write(): %s" +msgstr "No s'ha pogut escriure el fitxer «%s»: ha fallat la funció write(): %s" -#: glib/gfileutils.c:1205 +#: glib/gfileutils.c:1215 #, c-format msgid "Failed to write file “%s”: fsync() failed: %s" -msgstr "" -"No s'ha pogut escriure el fitxer «%s»: ha fallat la funció fsync(): %s" +msgstr "No s'ha pogut escriure el fitxer «%s»: ha fallat la funció fsync(): %s" -#: glib/gfileutils.c:1366 glib/gfileutils.c:1783 +#: glib/gfileutils.c:1376 glib/gfileutils.c:1793 #, c-format msgid "Failed to create file “%s”: %s" msgstr "No s'ha pogut crear el fitxer «%s»: %s" -#: glib/gfileutils.c:1411 +#: glib/gfileutils.c:1421 #, c-format msgid "Existing file “%s” could not be removed: g_unlink() failed: %s" msgstr "" "No s'ha pogut suprimir el fitxer existent «%s»: ha fallat la funció " "g_unlink(): %s" -#: glib/gfileutils.c:1748 +#: glib/gfileutils.c:1758 #, c-format msgid "Template “%s” invalid, should not contain a “%s”" msgstr "La plantilla «%s» no és vàlida, no hauria de tenir cap «%s»" -#: glib/gfileutils.c:1761 +#: glib/gfileutils.c:1771 #, c-format msgid "Template “%s” doesn’t contain XXXXXX" msgstr "La plantilla «%s» no conté XXXXXX" -#: glib/gfileutils.c:2355 glib/gfileutils.c:2384 +#: glib/gfileutils.c:2365 glib/gfileutils.c:2394 #, c-format msgid "Failed to read the symbolic link “%s”: %s" msgstr "No s'ha pogut llegir l'enllaç simbòlic «%s»: %s" @@ -5298,8 +5447,7 @@ msgstr "No es pot fer una lectura bàsica a g_io_channel_read_line_string" #: glib/giochannel.c:1797 glib/giochannel.c:2055 glib/giochannel.c:2142 msgid "Leftover unconverted data in read buffer" -msgstr "" -"A la memòria intermèdia de lectura hi ha dades sobrants no convertides" +msgstr "A la memòria intermèdia de lectura hi ha dades sobrants no convertides" #: glib/giochannel.c:1878 glib/giochannel.c:1955 msgid "Channel terminates in a partial character" @@ -5311,8 +5459,7 @@ msgstr "No es pot fer una lectura bàsica a g_io_channel_read_to_end" #: glib/gkeyfile.c:791 msgid "Valid key file could not be found in search dirs" -msgstr "" -"No s'ha pogut trobar cap fitxer de claus vàlid als directoris de cerca" +msgstr "No s'ha pogut trobar cap fitxer de claus vàlid als directoris de cerca" #: glib/gkeyfile.c:828 msgid "Not a regular file" @@ -5486,8 +5633,8 @@ msgstr "El caràcter de referència «%-.*s» no codifica un caràcter permès" msgid "" "Empty entity “&;” seen; valid entities are: & " < > '" msgstr "" -"S'ha detectat una entitat buida «&;». Les entitats vàlides són: & "" -" < > '" +"S'ha detectat una entitat buida «&;». Les entitats vàlides són: & " " +"< > '" #: glib/gmarkup.c:720 #, c-format @@ -5510,8 +5657,8 @@ msgstr "El document ha de començar amb un element (p. ex. <book>)" #: glib/gmarkup.c:1179 #, c-format msgid "" -"“%s” is not a valid character following a “<” character; it may not begin an" -" element name" +"“%s” is not a valid character following a “<” character; it may not begin an " +"element name" msgstr "" "«%s» no és un caràcter vàlid després d'un caràcter «<»: no pot començar un " "nom d'element" @@ -5573,8 +5720,8 @@ msgid "" "“%s” is not a valid character following the close element name “%s”; the " "allowed character is “>”" msgstr "" -"«%s» no és un caràcter vàlid després del nom d'element de tancament «%s». El" -" caràcter permès és «>»" +"«%s» no és un caràcter vàlid després del nom d'element de tancament «%s». El " +"caràcter permès és «>»" #: glib/gmarkup.c:1583 #, c-format @@ -5979,8 +6126,7 @@ msgstr "La biblioteca PCRE ha estat compilada amb opcions incompatibles" #, c-format msgid "Error while compiling regular expression ‘%s’ at char %s: %s" msgstr "" -"S'ha produït un error en compilar l'expressió regular «%s» al caràcter %s: " -"%s" +"S'ha produït un error en compilar l'expressió regular «%s» al caràcter %s: %s" #: glib/gregex.c:2918 msgid "hexadecimal digit or “}” expected" @@ -6022,8 +6168,8 @@ msgstr "no es reconeix la seqüència d'escapament" #, c-format msgid "Error while parsing replacement text “%s” at char %lu: %s" msgstr "" -"S'ha produït un error en analitzar el text de reemplaçament «%s» al caràcter" -" %lu: %s" +"S'ha produït un error en analitzar el text de reemplaçament «%s» al caràcter " +"%lu: %s" #: glib/gshell.c:84 msgid "Quoted text doesn’t begin with a quotation mark" @@ -6032,8 +6178,8 @@ msgstr "El text citat no comença amb cometes" #: glib/gshell.c:174 msgid "Unmatched quotation mark in command line or other shell-quoted text" msgstr "" -"S'han trobat unes cometes desaparellades en una línia d'ordres o en un altre" -" text entre cometes" +"S'han trobat unes cometes desaparellades en una línia d'ordres o en un altre " +"text entre cometes" #: glib/gshell.c:580 #, c-format @@ -6092,55 +6238,55 @@ msgstr "El procés fill ha sortit inesperadament" msgid "Failed to read from child pipe (%s)" msgstr "No s'ha pogut llegir des del conducte fill (%s)" -#: glib/gspawn.c:2001 +#: glib/gspawn.c:2003 #, c-format msgid "Failed to spawn child process “%s” (%s)" msgstr "No s'ha pogut engendrar el procés fill «%s» (%s)" -#: glib/gspawn.c:2125 +#: glib/gspawn.c:2127 #, c-format msgid "Failed to fork (%s)" msgstr "No s'ha pogut bifurcar (%s)" -#: glib/gspawn.c:2286 glib/gspawn-win32.c:503 +#: glib/gspawn.c:2288 glib/gspawn-win32.c:503 #, c-format msgid "Failed to change to directory “%s” (%s)" msgstr "No s'ha pogut canviar al directori «%s» (%s)" -#: glib/gspawn.c:2296 +#: glib/gspawn.c:2298 #, c-format msgid "Failed to execute child process “%s” (%s)" msgstr "No s'ha pogut executar el procés fill «%s» (%s)" -#: glib/gspawn.c:2306 +#: glib/gspawn.c:2308 #, c-format msgid "Failed to open file to remap file descriptor (%s)" msgstr "" "No s'ha pogut obrir el fitxer per a tornar a assignar el descriptor de " "fitxers (%s)" -#: glib/gspawn.c:2314 +#: glib/gspawn.c:2316 #, c-format msgid "Failed to duplicate file descriptor for child process (%s)" msgstr "" "No s'ha pogut duplicar el descriptor de fitxers per al procés fill (%s)" -#: glib/gspawn.c:2323 +#: glib/gspawn.c:2325 #, c-format msgid "Failed to fork child process (%s)" msgstr "No s'ha pogut bifurcar el procés fill (%s)" -#: glib/gspawn.c:2331 +#: glib/gspawn.c:2333 #, c-format msgid "Failed to close file descriptor for child process (%s)" msgstr "No s'ha pogut tancar el descriptor de fitxers per al procés fill (%s)" -#: glib/gspawn.c:2339 +#: glib/gspawn.c:2341 #, c-format msgid "Unknown error executing child process “%s”" msgstr "S'ha produït un error desconegut en executar el procés fill «%s»" -#: glib/gspawn.c:2363 +#: glib/gspawn.c:2365 #, c-format msgid "Failed to read enough data from child pid pipe (%s)" msgstr "" @@ -6291,146 +6437,122 @@ msgstr "Seqüència no vàlida a l'entrada de la conversió" msgid "Character out of range for UTF-16" msgstr "El caràcter és fora de l'interval d'UTF-16" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. kB" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 kB" #: glib/gutils.c:2966 msgid "kB" msgstr "kB" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. MB" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 MB" #: glib/gutils.c:2968 msgid "MB" msgstr "MB" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. GB" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 GB" #: glib/gutils.c:2970 msgid "GB" msgstr "GB" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. TB" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 TB" #: glib/gutils.c:2972 msgid "TB" msgstr "TB" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. PB" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 PB" #: glib/gutils.c:2974 msgid "PB" msgstr "PB" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. EB" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 EB" #: glib/gutils.c:2976 msgid "EB" msgstr "EB" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. KiB" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 KiB" #: glib/gutils.c:2980 msgid "KiB" msgstr "KiB" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. MiB" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 MiB" #: glib/gutils.c:2982 msgid "MiB" msgstr "MiB" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. GiB" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 GiB" #: glib/gutils.c:2984 msgid "GiB" msgstr "GiB" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. TiB" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 TiB" #: glib/gutils.c:2986 msgid "TiB" msgstr "TiB" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. PiB" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 PiB" #: glib/gutils.c:2988 msgid "PiB" msgstr "PiB" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. EiB" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 EiB" #: glib/gutils.c:2990 msgid "EiB" msgstr "EiB" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. kbit" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 kbit" #: glib/gutils.c:2994 msgid "kbit" msgstr "kbit" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. Mbit" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 Mbit" #: glib/gutils.c:2996 msgid "Mbit" msgstr "Mbit" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. Gbit" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 Gbit" #: glib/gutils.c:2998 msgid "Gbit" msgstr "Gbit" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. Tbit" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 Tbit" #: glib/gutils.c:3000 msgid "Tbit" msgstr "Tbit" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. Pbit" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 Pbit" #: glib/gutils.c:3002 msgid "Pbit" msgstr "Pbit" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. Ebit" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 Ebit" #: glib/gutils.c:3004 msgid "Ebit" msgstr "Ebit" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. Kibit" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 Kibit" #: glib/gutils.c:3008 msgid "Kibit" msgstr "Kibit" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. Mibit" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 Mibit" #: glib/gutils.c:3010 msgid "Mibit" msgstr "Mibit" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. Gibit" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 Gibit" #: glib/gutils.c:3012 msgid "Gibit" msgstr "Gibit" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. Tibit" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 Tibit" #: glib/gutils.c:3014 msgid "Tibit" msgstr "Tibit" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. Pibit" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 Pibit" #: glib/gutils.c:3016 msgid "Pibit" msgstr "Pibit" -#. Translators: A unit symbol for size formatting, showing for example: "13.0 -#. Eibit" +#. Translators: A unit symbol for size formatting, showing for example: "13.0 Eibit" #: glib/gutils.c:3018 msgid "Eibit" msgstr "Eibit" @@ -6455,8 +6577,7 @@ msgctxt "format-size" msgid "%u" msgstr "%u" -#. Translators: The first "%u" is replaced with the value, the "%s" with a -#. unit of the value. +#. Translators: The first "%u" is replaced with the value, the "%s" with a unit of the value. #. * The order can be changed with "%$2s %$1u". An example: "13 bytes" #: glib/gutils.c:3073 #, c-format @@ -6464,8 +6585,7 @@ msgctxt "format-size" msgid "%u %s" msgstr "%u %s" -#. Translators: The "%.1f" is replaced with the size value, like "13.0"; it -#. could +#. Translators: The "%.1f" is replaced with the size value, like "13.0"; it could #. * be part of "13.0 MB", but only the number is requested this time. #: glib/gutils.c:3109 #, c-format @@ -6473,10 +6593,8 @@ msgctxt "format-size" msgid "%.1f" msgstr "%.1f" -#. Translators: The first "%.1f" is replaced with the value, the "%s" with a -#. unit of the value. -#. * The order can be changed with "%$2s %$1.1f". Keep the no-break space -#. between the value and +#. Translators: The first "%.1f" is replaced with the value, the "%s" with a unit of the value. +#. * The order can be changed with "%$2s %$1.1f". Keep the no-break space between the value and #. * the unit symbol. An example: "13.0 MB" #: glib/gutils.c:3115 #, c-format @@ -6507,13 +6625,11 @@ msgid_plural "%u bytes" msgstr[0] "%u byte" msgstr[1] "%u bytes" -#. Translators: this is from the deprecated function -#. g_format_size_for_display() which uses 'KB' to -#. * mean 1024 bytes. I am aware that 'KB' is not correct, but it has been -#. preserved for reasons of -#. * compatibility. Users will not see this string unless a program is using -#. this deprecated function. +#. Translators: this is from the deprecated function g_format_size_for_display() which uses 'KB' to +#. * mean 1024 bytes. I am aware that 'KB' is not correct, but it has been preserved for reasons of +#. * compatibility. Users will not see this string unless a program is using this deprecated function. #. * Please translate as literally as possible. +#. #: glib/gutils.c:3214 #, c-format msgid "%.1f KB" @@ -6544,17 +6660,18 @@ msgstr "%.1f PB" msgid "%.1f EB" msgstr "%.1f EB" -#~ msgid "METHOD_RETURN message: REPLY_SERIAL header field is missing or invalid" +# +#~ msgid "Could not allocate %" +#~ msgid_plural "Could not allocate %" +#~ msgstr[0] "No s'ha pogut assignar %" +#~ msgstr[1] "No s'han pogut assignar %" + +#~ msgid "" +#~ "METHOD_RETURN message: REPLY_SERIAL header field is missing or invalid" #~ msgstr "" #~ "Missatge «METHOD_RETURN»: el camp de capçalera «REPLY_SERIAL» manca o és " #~ "invàlid" -#, c-format -#~ msgid "Could not allocate %lu byte to read file “%s”" -#~ msgid_plural "Could not allocate %lu bytes to read file “%s”" -#~ msgstr[0] "No s'han pogut assignar %lu byte per a llegir el fitxer «%s»" -#~ msgstr[1] "No s'han pogut assignar %lu bytes per a llegir el fitxer «%s»" - #~ msgid "kb" #~ msgstr "kb" @@ -6629,7 +6746,9 @@ msgstr "%.1f EB" #~ msgstr "condició «(?(0)» no vàlida" #~ msgid "escapes \\L, \\l, \\N{name}, \\U, and \\u are not supported" -#~ msgstr "no s'admeten els caràcters d'escapada «\\L», «\\l», «\\N{nom}», «\\U» i «\\u»" +#~ msgstr "" +#~ "no s'admeten els caràcters d'escapada «\\L», «\\l», «\\N{nom}», «\\U» i " +#~ "«\\u»" #~ msgid "recursive call could loop indefinitely" #~ msgstr "la crida recursiva podria entrar en bucle indefinidament" @@ -6639,8 +6758,8 @@ msgstr "%.1f EB" #~ msgid "] is an invalid data character in JavaScript compatibility mode" #~ msgstr "" -#~ "el caràcter«]» no és un caràcter de dades vàlid en el mode de compatibilitat" -#~ " amb JavaScript" +#~ "el caràcter«]» no és un caràcter de dades vàlid en el mode de " +#~ "compatibilitat amb JavaScript" #~ msgid "too many forward references" #~ msgstr "hi ha massa referències cap endavant" @@ -6650,7 +6769,8 @@ msgstr "%.1f EB" #~ msgid "PCRE library is compiled without UTF8 properties support" #~ msgstr "" -#~ "La biblioteca PCRE no està compilada per a interpretar les propietats UTF-8" +#~ "La biblioteca PCRE no està compilada per a interpretar les propietats " +#~ "UTF-8" #, c-format #~ msgid "Error while optimizing regular expression %s: %s" @@ -10,8 +10,8 @@ msgid "" msgstr "" "Project-Id-Version: glib master\n" "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/glib/issues/new\n" -"POT-Creation-Date: 2024-03-01 12:22+0000\n" -"PO-Revision-Date: 2024-03-04 11:49+0100\n" +"POT-Creation-Date: 2024-05-13 05:14+0000\n" +"PO-Revision-Date: 2024-05-19 12:18+0200\n" "Last-Translator: Balázs Úr <ur.balazs at fsf dot hu>\n" "Language-Team: Hungarian <openscope at fsf dot hu>\n" "Language: hu\n" @@ -61,7 +61,6 @@ msgid "Override the application’s ID" msgstr "Alkalmazások azonosítójának felülbírálása" #: gio/gapplication.c:575 -#| msgid "List applications" msgid "Print the application version" msgstr "Az alkalmazás verziójának kiírása" @@ -281,8 +280,11 @@ msgstr "nem található desktop fájl a(z) %s alkalmazáshoz\n" #: gio/gapplication-tool.c:473 #, c-format +#| msgid "" +#| "unrecognised command: %s\n" +#| "\n" msgid "" -"unrecognised command: %s\n" +"unrecognized command: %s\n" "\n" msgstr "" "ismeretlen parancs: %s\n" @@ -314,7 +316,7 @@ msgstr "Az adatfolyam már le van zárva" msgid "Truncate not supported on base stream" msgstr "Az alap adatfolyam csonkítása nem engedélyezett" -#: gio/gcancellable.c:326 gio/gdbusconnection.c:1844 gio/gdbusprivate.c:1434 +#: gio/gcancellable.c:326 gio/gdbusconnection.c:1994 gio/gdbusprivate.c:1434 #: gio/gsimpleasyncresult.c:871 gio/gsimpleasyncresult.c:897 #, c-format msgid "Operation was cancelled" @@ -546,7 +548,7 @@ msgid "Cannot determine session bus address (not implemented for this OS)" msgstr "" "Nem határozható meg a munkamenetbusz címe (nincs megvalósítva erre az OS-re)" -#: gio/gdbusaddress.c:1377 gio/gdbusconnection.c:7339 +#: gio/gdbusaddress.c:1377 gio/gdbusconnection.c:7787 #, c-format msgid "" "Cannot determine bus address from DBUS_STARTER_BUS_TYPE environment variable " @@ -555,7 +557,7 @@ msgstr "" "Nem határozható meg a busz címe a DBUS_STARTER_BUS_TYPE környezeti " "változóból – ismeretlen „%s” érték" -#: gio/gdbusaddress.c:1386 gio/gdbusconnection.c:7348 +#: gio/gdbusaddress.c:1386 gio/gdbusconnection.c:7796 msgid "" "Cannot determine bus address because the DBUS_STARTER_BUS_TYPE environment " "variable is not set" @@ -621,10 +623,10 @@ msgstr "Hiba a(z) %s könyvtár létrehozásakor: %s" #: gio/gdbusauthmechanismsha1.c:368 gio/gfile.c:1105 gio/gfile.c:1343 #: gio/gfile.c:1481 gio/gfile.c:1718 gio/gfile.c:1773 gio/gfile.c:1831 #: gio/gfile.c:1915 gio/gfile.c:1972 gio/gfile.c:2036 gio/gfile.c:2091 -#: gio/gfile.c:3969 gio/gfile.c:4108 gio/gfile.c:4515 gio/gfile.c:4980 -#: gio/gfile.c:5392 gio/gfile.c:5477 gio/gfile.c:5567 gio/gfile.c:5664 -#: gio/gfile.c:5751 gio/gfile.c:5850 gio/gfile.c:9004 gio/gfile.c:9094 -#: gio/gfile.c:9178 gio/win32/gwinhttpfile.c:453 +#: gio/gfile.c:4086 gio/gfile.c:4261 gio/gfile.c:4668 gio/gfile.c:5133 +#: gio/gfile.c:5545 gio/gfile.c:5630 gio/gfile.c:5720 gio/gfile.c:5817 +#: gio/gfile.c:5904 gio/gfile.c:6003 gio/gfile.c:9157 gio/gfile.c:9247 +#: gio/gfile.c:9331 gio/win32/gwinhttpfile.c:453 msgid "Operation not supported" msgstr "A művelet nem támogatott" @@ -689,21 +691,21 @@ msgstr "Hiba a(z) „%s” kulcstartó írásra való megnyitásakor: " msgid "(Additionally, releasing the lock for “%s” also failed: %s) " msgstr "(Ezen kívül a(z) „%s” zárolásának feloldása is meghiúsult: %s) " -#: gio/gdbusconnection.c:585 gio/gdbusconnection.c:2392 +#: gio/gdbusconnection.c:733 gio/gdbusconnection.c:2748 msgid "The connection is closed" msgstr "A kapcsolat le van zárva" -#: gio/gdbusconnection.c:1876 +#: gio/gdbusconnection.c:2026 msgid "Timeout was reached" msgstr "Az időkorlát elérve" -#: gio/gdbusconnection.c:2515 +#: gio/gdbusconnection.c:2871 msgid "" "Unsupported flags encountered when constructing a client-side connection" msgstr "" "Nem támogatott jelzők találhatók a kliensoldali kapcsolat létrehozásakor" -#: gio/gdbusconnection.c:4277 gio/gdbusconnection.c:4631 +#: gio/gdbusconnection.c:4719 gio/gdbusconnection.c:5073 #, c-format msgid "" "No such interface “org.freedesktop.DBus.Properties” on object at path %s" @@ -711,80 +713,80 @@ msgstr "" "Nincs „org.freedesktop.DBus.Properties” interfész a(z) %s útvonalon lévő " "objektumon" -#: gio/gdbusconnection.c:4422 +#: gio/gdbusconnection.c:4864 #, c-format msgid "No such property “%s”" msgstr "Nincs „%s” tulajdonság" -#: gio/gdbusconnection.c:4434 +#: gio/gdbusconnection.c:4876 #, c-format msgid "Property “%s” is not readable" msgstr "A(z) „%s” tulajdonság nem olvasható" -#: gio/gdbusconnection.c:4445 +#: gio/gdbusconnection.c:4887 #, c-format msgid "Property “%s” is not writable" msgstr "A(z) „%s” tulajdonság nem írható" -#: gio/gdbusconnection.c:4465 +#: gio/gdbusconnection.c:4907 #, c-format msgid "Error setting property “%s”: Expected type “%s” but got “%s”" msgstr "" "Hiba a(z) „%s” tulajdonság beállításakor: a várt „%s” típus helyett „%s” " "érkezett" -#: gio/gdbusconnection.c:4570 gio/gdbusconnection.c:4785 -#: gio/gdbusconnection.c:6762 +#: gio/gdbusconnection.c:5012 gio/gdbusconnection.c:5227 +#: gio/gdbusconnection.c:7207 #, c-format msgid "No such interface “%s”" msgstr "Nincs ilyen interfész: „%s”" -#: gio/gdbusconnection.c:5001 gio/gdbusconnection.c:7279 +#: gio/gdbusconnection.c:5443 gio/gdbusconnection.c:7727 #, c-format msgid "No such interface “%s” on object at path %s" msgstr "Nincs „%s” interfész a(z) %s útvonalon lévő objektumon" -#: gio/gdbusconnection.c:5102 +#: gio/gdbusconnection.c:5544 #, c-format msgid "No such method “%s”" msgstr "Nincs „%s” metódus" -#: gio/gdbusconnection.c:5133 +#: gio/gdbusconnection.c:5575 #, c-format msgid "Type of message, “%s”, does not match expected type “%s”" msgstr "Az üzenet „%s” típusa nem felel meg a várt „%s” típusnak" -#: gio/gdbusconnection.c:5336 +#: gio/gdbusconnection.c:5778 #, c-format msgid "An object is already exported for the interface %s at %s" msgstr "Már exportálva van egy objektum a(z) %s interfészhez itt: %s" -#: gio/gdbusconnection.c:5563 +#: gio/gdbusconnection.c:6008 #, c-format msgid "Unable to retrieve property %s.%s" msgstr "Nem sikerült lekérni a tulajdonságot: %s.%s" -#: gio/gdbusconnection.c:5619 +#: gio/gdbusconnection.c:6064 #, c-format msgid "Unable to set property %s.%s" msgstr "Nem sikerült beállítani a tulajdonságot: %s.%s" -#: gio/gdbusconnection.c:5798 +#: gio/gdbusconnection.c:6243 #, c-format msgid "Method “%s” returned type “%s”, but expected “%s”" msgstr "A(z) „%s” metódus a(z) „%s” típust adta vissza a várt „%s” helyett" -#: gio/gdbusconnection.c:6874 +#: gio/gdbusconnection.c:7319 #, c-format msgid "Method “%s” on interface “%s” with signature “%s” does not exist" msgstr "A(z) „%s” metódus nem létezik a(z) „%s” interfészen „%s” aláírással" -#: gio/gdbusconnection.c:6995 +#: gio/gdbusconnection.c:7440 #, c-format msgid "A subtree is already exported for %s" msgstr "Egy részfa már exportálva van a következőhöz: %s" -#: gio/gdbusconnection.c:7287 +#: gio/gdbusconnection.c:7735 #, c-format msgid "Object does not exist at path “%s”" msgstr "Az objektum nem létezik a(z) „%s” útvonalon" @@ -796,8 +798,6 @@ msgstr "%s üzenet: a(z) %s fejlécmező érvénytelen, „%s” típusú érté #: gio/gdbusmessage.c:1374 #, c-format -#| msgid "" -#| "METHOD_CALL message: PATH or MEMBER header field is missing or invalid" msgid "%s message: %s header field is missing or invalid" msgstr "%s üzenet: a(z) %s fejlécmező hiányzik vagy érvénytelen" @@ -808,9 +808,6 @@ msgstr "%s üzenet: ÉRVÉNYTELEN fejlécmező lett megadva" #: gio/gdbusmessage.c:1424 #, c-format -#| msgid "" -#| "SIGNAL message: The PATH header field is using the reserved value /org/" -#| "freedesktop/DBus/Local" msgid "" "%s message: PATH header field is using the reserved value /org/freedesktop/" "DBus/Local" @@ -820,9 +817,6 @@ msgstr "" #: gio/gdbusmessage.c:1437 #, c-format -#| msgid "" -#| "SIGNAL message: PATH, INTERFACE or MEMBER header field is missing or " -#| "invalid" msgid "" "%s message: INTERFACE header field does not contain a valid interface name" msgstr "" @@ -830,9 +824,6 @@ msgstr "" #: gio/gdbusmessage.c:1446 #, c-format -#| msgid "" -#| "SIGNAL message: The INTERFACE header field is using the reserved value " -#| "org.freedesktop.DBus.Local" msgid "" "%s message: INTERFACE header field is using the reserved value org." "freedesktop.DBus.Local" @@ -842,16 +833,11 @@ msgstr "" #: gio/gdbusmessage.c:1459 #, c-format -#| msgid "" -#| "METHOD_CALL message: PATH or MEMBER header field is missing or invalid" msgid "%s message: MEMBER header field does not contain a valid member name" msgstr "%s üzenet: a MEMBER fejlécmező nem tartalmaz érvényes tagnevet" #: gio/gdbusmessage.c:1472 #, c-format -#| msgid "" -#| "ERROR message: REPLY_SERIAL or ERROR_NAME header field is missing or " -#| "invalid" msgid "%s message: ERROR_NAME header field does not contain a valid error name" msgstr "%s üzenet: az ERROR_NAME fejlécmező nem tartalmaz érvényes hibanevet" @@ -1526,7 +1512,6 @@ msgstr "A másolás (reflink/clone) nem támogatott vagy nem működött" #: gio/gfile.c:3384 gio/gfile.c:3395 #, c-format -#| msgid "Unset given attribute" msgid "Cannot retrieve attribute %s" msgstr "Nem sikerült lekérni a(z) %s attribútumot" @@ -1534,33 +1519,33 @@ msgstr "Nem sikerült lekérni a(z) %s attribútumot" msgid "Can’t copy special file" msgstr "A speciális fájl nem másolható" -#: gio/gfile.c:4332 +#: gio/gfile.c:4485 msgid "Invalid symlink value given" msgstr "Érvénytelen szimbolikus link érték került megadásra" -#: gio/gfile.c:4342 glib/gfileutils.c:2409 +#: gio/gfile.c:4495 glib/gfileutils.c:2409 msgid "Symbolic links not supported" msgstr "A szimbolikus linkek használata nem támogatott" -#: gio/gfile.c:4623 +#: gio/gfile.c:4776 msgid "Trash not supported" msgstr "A Kuka nem támogatott" -#: gio/gfile.c:4733 +#: gio/gfile.c:4886 #, c-format msgid "File names cannot contain “%c”" msgstr "A fájlnevek nem tartalmazhatnak „%c” karaktert" -#: gio/gfile.c:7159 gio/gfile.c:7285 +#: gio/gfile.c:7312 gio/gfile.c:7438 #, c-format msgid "Failed to create a temporary directory for template “%s”: %s" msgstr "Nem sikerült átmeneti könyvtárat létrehozni a(z) „%s” sablonhoz: %s" -#: gio/gfile.c:7603 gio/gvolume.c:362 +#: gio/gfile.c:7756 gio/gvolume.c:362 msgid "volume doesn’t implement mount" msgstr "a kötet nem valósítja meg a csatolást" -#: gio/gfile.c:7717 gio/gfile.c:7794 +#: gio/gfile.c:7870 gio/gfile.c:7947 msgid "No application is registered as handling this file" msgstr "Nincs alkalmazás regisztrálva a fájl kezeléséhez" @@ -1875,7 +1860,6 @@ msgid "Use default permissions for the destination" msgstr "Alapértelmezett jogosultságok használata a célnál" #: gio/gio-tool-copy.c:53 -#| msgid "Use default permissions for the destination" msgid "Use default file modification timestamps for the destination" msgstr "Alapértelmezett fájlmódosítási időbélyegek használata a célnál" @@ -3434,7 +3418,7 @@ msgid "Error truncating file: %s" msgstr "Hiba a fájl csonkításakor: %s" #: gio/glocalfileoutputstream.c:664 gio/glocalfileoutputstream.c:909 -#: gio/glocalfileoutputstream.c:1223 gio/gsubprocess.c:227 +#: gio/glocalfileoutputstream.c:1223 gio/gsubprocess.c:233 #, c-format msgid "Error opening file “%s”: %s" msgstr "Hiba a(z) %s fájl megnyitásakor: %s" @@ -3595,7 +3579,7 @@ msgstr "A(z) %s részére átadott vektorok összege túl nagy" msgid "Source stream is already closed" msgstr "A forrás adatfolyam már le van zárva" -#: gio/gproxyaddressenumerator.c:328 gio/gproxyaddressenumerator.c:348 +#: gio/gproxyaddressenumerator.c:324 gio/gproxyaddressenumerator.c:344 msgid "Unspecified proxy lookup failure" msgstr "Meghatározatlan proxykeresési hiba" @@ -3619,8 +3603,8 @@ msgid "Invalid domain" msgstr "Érvénytelen tartomány" #: gio/gresource.c:706 gio/gresource.c:968 gio/gresource.c:1008 -#: gio/gresource.c:1132 gio/gresource.c:1204 gio/gresource.c:1278 -#: gio/gresource.c:1359 gio/gresourcefile.c:482 gio/gresourcefile.c:606 +#: gio/gresource.c:1134 gio/gresource.c:1206 gio/gresource.c:1280 +#: gio/gresource.c:1361 gio/gresourcefile.c:482 gio/gresourcefile.c:606 #: gio/gresourcefile.c:757 #, c-format msgid "The resource at “%s” does not exist" @@ -4231,7 +4215,7 @@ msgstr "A kiszolgáló nem SOCKSv4 proxy kiszolgáló." msgid "Connection through SOCKSv4 server was rejected" msgstr "A SOCKSv4 kiszolgálón keresztüli kapcsolat visszautasítva" -#: gio/gsocks5proxy.c:155 gio/gsocks5proxy.c:340 gio/gsocks5proxy.c:350 +#: gio/gsocks5proxy.c:155 gio/gsocks5proxy.c:356 gio/gsocks5proxy.c:366 msgid "The server is not a SOCKSv5 proxy server." msgstr "A kiszolgáló nem SOCKSv5 proxy kiszolgáló." @@ -4245,53 +4229,53 @@ msgid "" "GLib." msgstr "A SOCKSv5 a GLib által nem támogatott hitelesítési módszert igényel." -#: gio/gsocks5proxy.c:222 +#: gio/gsocks5proxy.c:227 msgid "Username or password is too long for SOCKSv5 protocol." msgstr "A felhasználónév vagy jelszó túl hosszú a SOCKSv5 protokollhoz." -#: gio/gsocks5proxy.c:252 +#: gio/gsocks5proxy.c:260 msgid "SOCKSv5 authentication failed due to wrong username or password." msgstr "" "A SOCKSv5 hitelesítés hibás felhasználónév vagy jelszó miatt meghiúsult." -#: gio/gsocks5proxy.c:302 +#: gio/gsocks5proxy.c:315 #, c-format msgid "Hostname “%s” is too long for SOCKSv5 protocol" msgstr "A gépnév („%s”) túl hosszú a SOCKSv5 protokollhoz" -#: gio/gsocks5proxy.c:364 +#: gio/gsocks5proxy.c:380 msgid "The SOCKSv5 proxy server uses unknown address type." msgstr "A SOCKSv5 proxy kiszolgáló ismeretlen címtípust használ." -#: gio/gsocks5proxy.c:371 +#: gio/gsocks5proxy.c:387 msgid "Internal SOCKSv5 proxy server error." msgstr "Belső SOCKSv5 proxy kiszolgáló hiba." -#: gio/gsocks5proxy.c:377 +#: gio/gsocks5proxy.c:393 msgid "SOCKSv5 connection not allowed by ruleset." msgstr "A SOCKSv5 kapcsolatot a szabálykészlet nem engedélyezi." -#: gio/gsocks5proxy.c:384 +#: gio/gsocks5proxy.c:400 msgid "Host unreachable through SOCKSv5 server." msgstr "A gép nem érhető el a SOCKSv5 kiszolgálón keresztül." -#: gio/gsocks5proxy.c:390 +#: gio/gsocks5proxy.c:406 msgid "Network unreachable through SOCKSv5 proxy." msgstr "A hálózat nem érhető el a SOCKSv5 proxyn keresztül." -#: gio/gsocks5proxy.c:396 +#: gio/gsocks5proxy.c:412 msgid "Connection refused through SOCKSv5 proxy." msgstr "A kapcsolat visszautasítva a SOCKSv5 proxyn keresztül." -#: gio/gsocks5proxy.c:402 +#: gio/gsocks5proxy.c:418 msgid "SOCKSv5 proxy does not support “connect” command." msgstr "A SOCKSv5 proxy nem támogatja a „connect” parancsot." -#: gio/gsocks5proxy.c:408 +#: gio/gsocks5proxy.c:424 msgid "SOCKSv5 proxy does not support provided address type." msgstr "A SOCKSv5 proxy nem támogatja a megadott címtípust." -#: gio/gsocks5proxy.c:414 +#: gio/gsocks5proxy.c:430 msgid "Unknown SOCKSv5 proxy error." msgstr "Ismeretlen SOCKSv5 proxy hiba." @@ -4480,7 +4464,7 @@ msgstr "Hiba a fájlleíróból olvasáskor: %s" msgid "Error closing file descriptor: %s" msgstr "Hiba a fájlleíró lezárásakor: %s" -#: gio/gunixmounts.c:2890 gio/gunixmounts.c:2943 +#: gio/gunixmounts.c:2897 gio/gunixmounts.c:2950 msgid "Filesystem root" msgstr "Fájlrendszer gyökere" @@ -4579,19 +4563,16 @@ msgstr "Hibás argumentumok\n" #: girepository/compiler/compiler.c:93 #, c-format -#| msgid "Failed to open file “%s”: %s" msgid "Failed to open ‘%s’: %s" msgstr "Nem sikerült a(z) „%s” megnyitása: %s" #: girepository/compiler/compiler.c:103 #, c-format -#| msgid "Could not create network monitor: %s" msgid "Error: Could not write the whole output: %s" msgstr "Hiba: nem sikerült kiírni a teljes kimenetet: %s" #: girepository/compiler/compiler.c:115 #, c-format -#| msgid "Failed to rename file “%s” to “%s”: g_rename() failed: %s" msgid "Error: Failed to rename ‘%s’ to ‘%s’: %s" msgstr "Hiba: nem sikerült a(z) „%s” átnevezése erre: „%s”: %s" @@ -4616,13 +4597,11 @@ msgid "Show verbose messages" msgstr "Bőbeszédű üzenetek megjelenítése" #: girepository/compiler/compiler.c:152 girepository/decompiler/decompiler.c:55 -#| msgid "Show program version and exit" msgid "Show program’s version number and exit" msgstr "A program verziószámának megjelenítése és kilépés" #: girepository/compiler/compiler.c:175 #, c-format -#| msgid "Error parsing parameter %d: %s\n" msgid "Error parsing arguments: %s" msgstr "Hiba az argumentumok feldolgozásakor: %s" @@ -4632,54 +4611,45 @@ msgstr "Pontosan egy bemeneti fájlt adjon meg" #: girepository/compiler/compiler.c:218 #, c-format -#| msgid "Error opening file “%s”: %s" msgid "Error parsing file ‘%s’: %s" msgstr "Hiba a(z) „%s” fájl feldolgozásakor: %s" #: girepository/compiler/compiler.c:243 #, c-format -#| msgid "Failed to load info for handler “%s”" msgid "Failed to build typelib for module ‘%s’" msgstr "Nem sikerült a típuskönyvtár összeállítása a(z) „%s” modulhoz" #: girepository/compiler/compiler.c:245 #, c-format -#| msgid "Unable to load ‘%s‘: %s" msgid "Invalid typelib for module ‘%s’: %s" msgstr "Érvénytelen típuskönyvtár a(z) „%s” modulhoz: %s" #: girepository/decompiler/decompiler.c:54 -#| msgid "Show extra information" msgid "Show all available information" msgstr "Összes elérhető információ megjelenítése" #: girepository/decompiler/decompiler.c:71 #, c-format -#| msgid "Failed to fork (%s)" msgid "Failed to parse: %s" msgstr "Nem sikerült feldolgozni: %s" #: girepository/decompiler/decompiler.c:87 -#| msgid "Show hidden files" msgid "No input files" msgstr "Nincsenek bemeneti fájlok" #: girepository/decompiler/decompiler.c:113 #, c-format -#| msgid "Failed to create file “%s”: %s" msgid "Failed to read ‘%s’: %s" msgstr "Nem sikerült a(z) „%s” olvasása: %s" #: girepository/decompiler/decompiler.c:125 #, c-format -#| msgid "Failed to create file “%s”: %s" msgid "Failed to create typelib ‘%s’: %s" msgstr "Nem sikerült létrehozni a(z) „%s” típuskönyvtárat: %s" #: girepository/decompiler/decompiler.c:129 #: girepository/inspector/inspector.c:113 #, c-format -#| msgid "Failed to allocate memory" msgid "Failed to load typelib: %s" msgstr "Nem sikerült betölteni a típuskönyvtárat: %s" @@ -4706,12 +4676,10 @@ msgstr "" "A vizsgált típuskönyvtárhoz szükséges egyéb típuskönyvtárak felsorolása" #: girepository/inspector/inspector.c:75 -#| msgid "The attributes to get" msgid "The typelib to inspect" msgstr "A vizsgálandó típuskönyvtár" #: girepository/inspector/inspector.c:75 -#| msgid "NAME" msgid "NAMESPACE" msgstr "NÉVTÉR" @@ -4721,7 +4689,6 @@ msgstr "- GI típuskönyvtár vizsgálata" #: girepository/inspector/inspector.c:86 #, c-format -#| msgid "Failed to read from file “%s”: %s" msgid "Failed to parse command line options: %s" msgstr "Nem sikerült feldolgozni a parancssori kapcsolókat: %s" @@ -5283,8 +5250,6 @@ msgstr "Hiba a(z) „%s” könyvtár megnyitásakor: %s" #. * contains the file name #: glib/gfileutils.c:720 glib/gfileutils.c:829 #, c-format -#| msgid "Could not allocate %lu byte to read file “%s”" -#| msgid_plural "Could not allocate %lu bytes to read file “%s”" msgid "Could not allocate %s to read file “%s”" msgstr "Nem sikerült a(z) %s lefoglalása a(z) „%s” fájl olvasásához" @@ -5328,7 +5293,6 @@ msgstr "" #: glib/gfileutils.c:1149 #, c-format -#| msgid "Failed to write file “%s”: write() failed: %s" msgid "Failed to write file “%s”: ftruncate() failed: %s" msgstr "Nem sikerült írni a(z) „%s” fájlt: az ftruncate() sikertelen: %s" @@ -6160,52 +6124,52 @@ msgstr "A gyermekfolyamat abnormálisan lépett ki" msgid "Failed to read from child pipe (%s)" msgstr "Nem sikerült olvasni a gyermek csővezetékből (%s)" -#: glib/gspawn.c:2001 +#: glib/gspawn.c:2003 #, c-format msgid "Failed to spawn child process “%s” (%s)" msgstr "Nem sikerült a(z) „%s” gyermekfolyamat végrehajtása (%s)" -#: glib/gspawn.c:2125 +#: glib/gspawn.c:2127 #, c-format msgid "Failed to fork (%s)" msgstr "Nem sikerült folyamatot indítani (%s)" -#: glib/gspawn.c:2286 glib/gspawn-win32.c:503 +#: glib/gspawn.c:2288 glib/gspawn-win32.c:503 #, c-format msgid "Failed to change to directory “%s” (%s)" msgstr "Nem sikerült átváltani a(z) „%s” könyvtárra (%s)" -#: glib/gspawn.c:2296 +#: glib/gspawn.c:2298 #, c-format msgid "Failed to execute child process “%s” (%s)" msgstr "Nem sikerült a gyermekfolyamat („%s”) végrehajtása (%s)" -#: glib/gspawn.c:2306 +#: glib/gspawn.c:2308 #, c-format msgid "Failed to open file to remap file descriptor (%s)" msgstr "Nem sikerült megnyitni a fájlt a fájlleíró ismételt leképezéséhez (%s)" -#: glib/gspawn.c:2314 +#: glib/gspawn.c:2316 #, c-format msgid "Failed to duplicate file descriptor for child process (%s)" msgstr "Nem sikerült kettőzni a gyermekfolyamat fájlleíróját (%s)" -#: glib/gspawn.c:2323 +#: glib/gspawn.c:2325 #, c-format msgid "Failed to fork child process (%s)" msgstr "Nem sikerült a gyermekfolyamat elindítása (%s)" -#: glib/gspawn.c:2331 +#: glib/gspawn.c:2333 #, c-format msgid "Failed to close file descriptor for child process (%s)" msgstr "Nem sikerült lezárni a gyermekfolyamat fájlleíróját (%s)" -#: glib/gspawn.c:2339 +#: glib/gspawn.c:2341 #, c-format msgid "Unknown error executing child process “%s”" msgstr "Ismeretlen hiba a gyermekfolyamat („%s”) végrehajtásakor" -#: glib/gspawn.c:2363 +#: glib/gspawn.c:2365 #, c-format msgid "Failed to read enough data from child pid pipe (%s)" msgstr "Nem sikerült elég adatot kiolvasni a gyermek pid csővezetékből (%s)" @@ -6262,21 +6226,21 @@ msgstr "" "Váratlan hiba, miközben a g_io_channel_win32_poll() adatokat olvasott egy " "gyermekfolyamatból" -#: glib/gstrfuncs.c:3339 glib/gstrfuncs.c:3441 +#: glib/gstrfuncs.c:3351 glib/gstrfuncs.c:3453 msgid "Empty string is not a number" msgstr "Az üres karakterlánc nem szám" -#: glib/gstrfuncs.c:3363 +#: glib/gstrfuncs.c:3375 #, c-format msgid "“%s” is not a signed number" msgstr "„%s” nem érvényes név" -#: glib/gstrfuncs.c:3373 glib/gstrfuncs.c:3477 +#: glib/gstrfuncs.c:3385 glib/gstrfuncs.c:3489 #, c-format msgid "Number “%s” is out of bounds [%s, %s]" msgstr "A(z) „%s” a(z) [%s, %s] intervallumon kívül esik." -#: glib/gstrfuncs.c:3467 +#: glib/gstrfuncs.c:3479 #, c-format msgid "“%s” is not an unsigned number" msgstr "„%s” nem érvényes név" |