paths:
- _build/meson-logs
-freebsd-12-x86_64:
- # The FreeBSD 13 build is run on each commit, so the FreeBSD 12 build can be
- # run less regularly to save CI resources. The chance of a regression on
- # FreeBSD 12 and not FreeBSD 13 is tiny.
- extends: .only-schedules
- stage: build
- tags:
- # To run a FreeBSD builder, install gitlab-runner package and start both
- # gitlab-runner and dbus service because we need /var/lib/dbus/machine-id.
- # To compile GLib, you still have to install the following packages:
- # desktop-file-utils gettext libiconv meson pkgconf python3 shared-mime-info
- - freebsd-12
- needs: []
- variables:
- # CPPFLAGS is required because libintl doesn't use pkg-config.
- CPPFLAGS: -I/usr/local/include
- # FIXME: Workaround meson inability to set LD_LIBRARY_PATH.
- # https://github.com/mesonbuild/meson/issues/1383
- # https://github.com/mesonbuild/meson/issues/1635
- # https://github.com/mesonbuild/meson/issues/2881
- LDFLAGS: -L/usr/local/lib -Wl,--disable-new-dtags
- # FreeBSD supports C.UTF-8 locale since 12.1.
- LANG: C.UTF-8
- before_script:
- - bash .gitlab-ci/show-execution-environment.sh
- script:
- # We cannot use -Wl,--no-undefined because GLib uses 'environ' variable.
- # FreeBSD supports xattr, but its API is different from Linux xattr.
- # FIXME: extattr(2) support: https://gitlab.gnome.org/GNOME/glib/issues/1404
- # localstatedir is needed for access to /var/lib/dbus/machine-id
- - meson setup ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Dxattr=false _build
- - meson compile -C _build
- - bash -x ./.gitlab-ci/run-tests.sh
- artifacts:
- reports:
- junit:
- - _build/meson-logs/testlog.junit.xml
- - _build/meson-logs/testlog-*.junit.xml
- name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
- when: always
- expire_in: 1 week
- paths:
- - "_build/config.h"
- - "_build/glib/glibconfig.h"
- - "_build/meson-logs"
-
freebsd-13-x86_64:
- # FIXME: Temporarily only run the FreeBSD 13 CI on a schedule, rather than on
- # every commit to origin, because it’s broken:
- # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3740#note_1935427
- extends: .only-schedules
+ extends: .only-origin
stage: build
tags:
- freebsd-13
before_script:
- bash .gitlab-ci/show-execution-environment.sh
script:
- - meson setup ${MESON_COMMON_OPTIONS} --localstatedir=/var -Db_lundef=false -Dxattr=false _build
+ # FIXME: We can’t use ${MESON_COMMON_OPTIONS} here because the FreeBSD 13
+ # runner has Meson 1.3 installed. This has an API hole where previous
+ # methods of getting paths from files() objects are rejected as deprecated,
+ # but no replacements are available. Hence, we can’t build with
+ # --fatal-meson-warnings. This should be fixed in Meson 1.4. It’s also fine
+ # with Meson 1.2.3 (which is what we use on all the other CI runners).
+ # See https://github.com/GNOME/glib/commit/71061fdcb33b8c26f5f8467cb3ac10704d65c87d
+ - meson setup --buildtype debug --wrap-mode=nodownload --localstatedir=/var -Db_lundef=false -Dxattr=false _build
- meson compile -C _build
- bash -x ./.gitlab-ci/run-tests.sh
artifacts:
- meson subprojects download
- meson setup ${MESON_COMMON_OPTIONS} --buildtype release -Ddocumentation=true -Dman-pages=enabled _build
- meson dist -C _build
- - tar -c -J -f "glib-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/glib glib
- - tar -c -J -f "gmodule-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gmodule gmodule
- - tar -c -J -f "gobject-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gobject gobject
- - tar -c -J -f "gio-docs-$CI_COMMIT_TAG.tar.xz" -C docs/reference/gio gio
+ # Compile again to build the docs
+ - meson compile -C _build
+ - tar -c -J -f "glib-docs-$CI_COMMIT_TAG.tar.xz" -C _build/docs/reference/glib glib
+ - tar -c -J -f "gmodule-docs-$CI_COMMIT_TAG.tar.xz" -C _build/docs/reference/gmodule gmodule
+ - tar -c -J -f "gobject-docs-$CI_COMMIT_TAG.tar.xz" -C _build/docs/reference/gobject gobject
+ - tar -c -J -f "gio-docs-$CI_COMMIT_TAG.tar.xz" -C _build/docs/reference/gio gio
artifacts:
paths:
- "${CI_PROJECT_DIR}/_build/glib-docs-$CI_COMMIT_TAG.tar.xz"
# lcov and genhtml configuration
-# See http://ltp.sourceforge.net/coverage/lcov/lcovrc.5.php
+# See lcovrc(5)
# Always enable branch coverage
lcov_branch_coverage = 1
# Exclude precondition assertions, as we can never reasonably get full branch
# coverage of them, as they should never normally fail.
+# Similarly exclude g_clear_*() functions (such as g_clear_object(),
+# g_clear_pointer(), etc.) as it’s not useful to test both sides of the branch
+# in them.
# See https://github.com/linux-test-project/lcov/issues/44
-lcov_excl_br_line = LCOV_EXCL_BR_LINE|g_return_if_fail|g_return_val_if_fail|g_assert|g_assert_
+lcov_excl_br_line = LCOV_EXCL_BR_LINE|g_return_if_fail|g_return_val_if_fail|g_assert|g_assert_|g_clear_
# Similarly for unreachable assertions.
lcov_excl_line = LCOV_EXCL_LINE|g_return_if_reached|g_return_val_if_reached|g_assert_not_reached
\ No newline at end of file
+Overview of changes in GLib 2.79.1, 2024-01-22
+==============================================
+
+* Fix a race condition in `g_object_unref()` (#3064, work by Thomas Haller)
+
+* Various API and build changes to libgirepository as it is not yet API-stable
+ (#3216, !3780, !3805, !3823, !3833, !3840)
+
+* Build fixes on big-endian 64-bit systems and mips64el (#3225, #3226, work by
+ Simon McVittie)
+
+* Reduce contention on global locks within GObject (!3774, work by Thomas
+ Haller)
+
+* Allow building man pages without the reference documentation (!3817, work by
+ Simon McVittie)
+
+* Bugs fixed:
+ - #1010 g_get_num_processor does not respect cpuset/affinity
+ - #3064 Crash under g_object_unref()
+ - #3093 GDBusMessage: should validate the type of all known headers (Philip
+ Withnall)
+ - #3207 Add support for syslog to Structured Logging
+ - #3216 Feedback on gobject-introspection: Casting to and from GIBaseInfo*
+ (Philip Withnall)
+ - #3222 pthread_t usages lack type name (Emmanuele Bassi)
+ - #3223 CLang, GMutexLocker: error: unused variable 'locker'
+ [-Werror,-Wunused-variable]
+ - #3225 2.79 regression: gdatetime test failing on 64-bit big-endian since
+ #3119
+ - #3226 resource test fails on Debian mips64el: test5.gresource is not linked
+ but the test assumes it should be (Simon McVittie)
+ - !3774 [th/g-object-priv] add private data to GObject and use per-object
+ locking
+ - !3780 girepository: Use standard types instead of glib specific
+ - !3789 gdatetime: Fix title of documentation comment
+ - !3792 build: Tell gi-docgen where to find the GIR files
+ - !3793 Shorten the title for D-Bus interface docs
+ - !3794 Add boxed GType for GRand
+ - !3795 girepository: Skip GIRepository versions not matching GIRepository-3.0
+ - !3798 docs: Drop outdated .gitignore files
+ - !3799 tests: Fix a minor leak in the new GParamSpecPool test
+ - !3800 ci: Re-enable and fix FreeBSD CI
+ - !3801 gmessages: Port all doc comments to gi-docgen
+ - !3802 [th/g-pointer-bit-lock-ext] glib: add g_pointer_bit_unlock_and_set()
+ and g_pointer_bit_lock_mask_ptr()
+ - !3803 ci: Fix tarballing the docs on dist
+ - !3805 girepository: Various small API cleanups
+ - !3806 gsignal.c: drop an optimization that is undefined behaviour
+ - !3808 glib/deprecated: Skip all the deprecated gthread api
+ - !3809 docs: Fix links to symbols outside the allowed namsepace
+ - !3810 gstrfuncs: Improve and port g_set_str() docs to gi-docgen
+ - !3811 gvariant-parser: Mention annotated types
+ - !3812 brz.c: Use uintptr_t instead of a hardcoded list of 64-bit arches
+ - !3813 gobject: define HAVE_OPTIONAL_FLAGS for sizeof(void*) > 8
+ - !3814 Fix typo in GPOINTER_TO_SIZE documentation
+ - !3817 docs: Allow building man pages without the reference documentation
+ - !3818 docs: Clarify >=2.76 changes to g_module_open()
+ - !3821 tests: Fix a minor leak in the socket test
+ - !3823 girepository: Misc cleanups
+ - !3826 genums: use g_once_init_enter_pointer for GType initializers
+ - !3827 array-test: Don't assume sizeof(void*)==sizeof(gsize)
+ - !3831 gvariant-core: Don’t call posix_memalign() with size==0
+ - !3833 girepository: Change various alignments to use size_t
+ - !3835 build: Ignore branches in g_clear_*() functions under lcov
+ - !3837 tests: A couple of test isolation improvements
+ - !3839 gvarianttype: Fix typos
+ - !3840 girepository: Exclude private symbols from the ABI
+ - !3841 docs: Fix member names of GLib.LogLevelFlags
+ - !3842 gio, gmodule, gthread: compile windows resources only in shared build
+
+* Translation updates:
+ - Georgian (Ekaterine Papava)
+ - Russian (Artur S0)
+
+
Overview of changes in GLib 2.79.0, 2023-12-22
==============================================
+++ /dev/null
-*-decl-list.txt
-*-decl.txt
-*-unused.txt
-*-undocumented.txt
-*-undeclared.txt
-*.args
-*.hierarchy
-*.interfaces
-*.prerequisites
-*.signals
-*.stamp
-html
-xml
-*.bak
-version.xml
-*.1
+++ /dev/null
-*.1
-gio-overrides.txt
-tmpl
endforeach
endif
-expand_content_files = [
- 'dbus-error.md',
- 'dbus-introspection.md',
- 'dbus-name-owning.md',
- 'dbus-name-watching.md',
- 'dbus-utils.md',
- 'error.md',
- 'file-attributes.md',
- 'io-scheduler.md',
- 'menu-exporter.md',
- 'migrating-gconf.md',
- 'migrating-gdbus.md',
- 'migrating-gnome-vfs.md',
- 'migrating-posix.md',
- 'networking.md',
- 'overview.md',
- 'pollable-utils.md',
- 'tls-overview.md',
- 'unix-mounts.md',
-]
+if get_option('documentation') and enable_gir
+ expand_content_files = [
+ 'dbus-error.md',
+ 'dbus-introspection.md',
+ 'dbus-name-owning.md',
+ 'dbus-name-watching.md',
+ 'dbus-utils.md',
+ 'error.md',
+ 'file-attributes.md',
+ 'io-scheduler.md',
+ 'menu-exporter.md',
+ 'migrating-gconf.md',
+ 'migrating-gdbus.md',
+ 'migrating-gnome-vfs.md',
+ 'migrating-posix.md',
+ 'networking.md',
+ 'overview.md',
+ 'pollable-utils.md',
+ 'tls-overview.md',
+ 'unix-mounts.md',
+ ]
-gio_toml = configure_file(input: 'gio.toml.in', output: 'gio.toml', configuration: toml_conf)
+ gio_toml = configure_file(input: 'gio.toml.in', output: 'gio.toml', configuration: toml_conf)
-custom_target('gio-docs',
- input: [ gio_toml, gio_gir[0] ],
- output: 'gio',
- command: [
- gidocgen,
- 'generate',
- gidocgen_common_args,
- '--config=@INPUT0@',
- '--output-dir=@OUTPUT@',
- '--content-dir=@0@'.format(meson.current_source_dir()),
- '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gobject'),
- '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gmodule'),
- '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gio'),
- '@INPUT1@',
- ],
- build_by_default: true,
- depend_files: expand_content_files,
- install: true,
- install_dir: docs_dir,
- install_tag: 'doc',
-)
+ custom_target('gio-docs',
+ input: [ gio_toml, gio_gir[0] ],
+ output: 'gio',
+ command: [
+ gidocgen,
+ 'generate',
+ gidocgen_common_args,
+ '--config=@INPUT0@',
+ '--output-dir=@OUTPUT@',
+ '--content-dir=@0@'.format(meson.current_source_dir()),
+ '@INPUT1@',
+ ],
+ build_by_default: true,
+ depend_files: expand_content_files,
+ install: true,
+ install_dir: docs_dir,
+ install_tag: 'doc',
+ )
+endif
-girepository_toml = configure_file(
- input: 'girepository.toml.in',
- output: 'girepository.toml',
- configuration: toml_conf,
-)
+if get_option('documentation') and enable_gir
+ girepository_toml = configure_file(
+ input: 'girepository.toml.in',
+ output: 'girepository.toml',
+ configuration: toml_conf,
+ )
-custom_target('girepository-docs',
- input: [ girepository_toml, girepository_gir[0] ],
- output: 'girepository',
- command: [
- gidocgen,
- 'generate',
- gidocgen_common_args,
- '--config=@INPUT0@',
- '--output-dir=@OUTPUT@',
- '--content-dir=@0@'.format(meson.current_source_dir()),
- '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gobject'),
- '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gmodule'),
- '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gio'),
- '@INPUT1@',
- ],
- build_by_default: true,
-)
+ custom_target('girepository-docs',
+ input: [ girepository_toml, girepository_gir[0] ],
+ output: 'girepository',
+ command: [
+ gidocgen,
+ 'generate',
+ gidocgen_common_args,
+ '--config=@INPUT0@',
+ '--output-dir=@OUTPUT@',
+ '--content-dir=@0@'.format(meson.current_source_dir()),
+ '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gobject'),
+ '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gmodule'),
+ '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gio'),
+ '@INPUT1@',
+ ],
+ build_by_default: true,
+ )
+endif
converted to [type@GLib.Quark]s anyway.
Data lists are used for associating arbitrary data with
-[class@GObject.Object]s, using [method@GObject.Object.set_data] and related
+[`GObject`](../gobject/class.Object.html)s, using [`g_object_set_data()`](../gobject/method.Object.set_data.html) and related
functions. The data is stored inside opaque [type@GLib.Data] elements.
To create a datalist, use [func@GLib.datalist_init].
# File Utilities
Do not use these APIs unless you are porting a POSIX application to Windows.
-A more high-level file access API is provided as GIO — see the documentation
-for [iface@Gio.File].
+A more high-level file access API is provided as GIO; see the documentation
+for [`GFile`](../gio/iface.File.html).
## POSIX File Wrappers
endif
endif
-expand_content_files = [
- 'atomic.md',
- 'base64.md',
- 'building.md',
- 'character-set.md',
- 'checked-math.md',
- 'compiling.md',
- 'cross-compiling.md',
- 'datalist-and-dataset.md',
- 'error-reporting.md',
- 'file-utils.md',
- 'gvariant-format-strings.md',
- 'gvariant-text-format.md',
- 'i18n.md',
- 'logging.md',
- 'main-loop.md',
- 'memory.md',
- 'memory-slices.md',
- 'numerical.md',
- 'random.md',
- 'reference-counting.md',
- 'running.md',
- 'testing.md',
- 'threads.md',
- 'threads-deprecated.md',
- 'markup.md',
- 'misc-utils.md',
- 'goption.md',
- 'host-utils.md',
- 'data-structures.md',
- 'programming.md',
- 'resources.md',
- 'shell.md',
- 'spawn.md',
- 'string-utils.md',
- 'types.md',
- 'unicode.md',
- 'unix.md',
- 'uuid.md',
- 'version.md',
- 'warnings.md',
- 'windows.md',
-]
+if get_option('documentation') and enable_gir
+ expand_content_files = [
+ 'atomic.md',
+ 'base64.md',
+ 'building.md',
+ 'character-set.md',
+ 'checked-math.md',
+ 'compiling.md',
+ 'cross-compiling.md',
+ 'datalist-and-dataset.md',
+ 'error-reporting.md',
+ 'file-utils.md',
+ 'gvariant-format-strings.md',
+ 'gvariant-text-format.md',
+ 'i18n.md',
+ 'logging.md',
+ 'main-loop.md',
+ 'memory.md',
+ 'memory-slices.md',
+ 'numerical.md',
+ 'random.md',
+ 'reference-counting.md',
+ 'running.md',
+ 'testing.md',
+ 'threads.md',
+ 'threads-deprecated.md',
+ 'markup.md',
+ 'misc-utils.md',
+ 'goption.md',
+ 'host-utils.md',
+ 'data-structures.md',
+ 'programming.md',
+ 'resources.md',
+ 'shell.md',
+ 'spawn.md',
+ 'string-utils.md',
+ 'types.md',
+ 'unicode.md',
+ 'unix.md',
+ 'uuid.md',
+ 'version.md',
+ 'warnings.md',
+ 'windows.md',
+ ]
-glib_toml = configure_file(input: 'glib.toml.in', output: 'glib.toml', configuration: toml_conf)
+ glib_toml = configure_file(input: 'glib.toml.in', output: 'glib.toml', configuration: toml_conf)
-custom_target('glib-docs',
- input: [ glib_toml, glib_gir[0] ],
- output: 'glib',
- command: [
- gidocgen,
- 'generate',
- gidocgen_common_args,
- '--config=@INPUT0@',
- '--output-dir=@OUTPUT@',
- '--content-dir=@0@'.format(meson.current_source_dir()),
- '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gobject'),
- '@INPUT1@',
- ],
- build_by_default: true,
- depend_files: expand_content_files,
- install: true,
- install_dir: docs_dir,
- install_tag: 'doc',
-)
+ custom_target('glib-docs',
+ input: [ glib_toml, glib_gir[0] ],
+ output: 'glib',
+ command: [
+ gidocgen,
+ 'generate',
+ gidocgen_common_args,
+ '--config=@INPUT0@',
+ '--output-dir=@OUTPUT@',
+ '--content-dir=@0@'.format(meson.current_source_dir()),
+ '@INPUT1@',
+ ],
+ build_by_default: true,
+ depend_files: expand_content_files,
+ install: true,
+ install_dir: docs_dir,
+ install_tag: 'doc',
+ )
+endif
complete shell-like command line ([func@GLib.spawn_command_line_sync],
[func@GLib.spawn_command_line_async]).
-See [class@Gio.Subprocess] in GIO for a higher-level API that provides
-stream interfaces for communication with child processes.
+See [`GSubprocess`](../gio/class.Subprocess.html) in GIO for a higher-level API
+that provides stream interfaces for communication with child processes.
An example of using [func@GLib.spawn_async_with_pipes]:
```c
The standard C `void *` type should usually be preferred in
new code, but `gpointer` can be used in contexts where a type name
-must be a single word, such as in the [method@GObject.Type.name] of
-[const@GObject.TYPE_POINTER] or when generating a family of function names for
+must be a single word, such as in the `GType` name of
+`G_TYPE_POINTER` or when generating a family of function names for
multiple types using macros.
### `gconstpointer`
The standard C `unsigned char` type should usually be preferred in
new code, but `guchar` can be used in contexts where a type name
-must be a single word, such as in the [method@GObject.Type.name] of
-[const@GObject.TYPE_UCHAR] or when generating a family of function names for
+must be a single word, such as in the `GType` name of
+`G_TYPE_UCHAR` or when generating a family of function names for
multiple types using macros.
## Naturally Sized Integers
The standard C `unsigned int` type should usually be preferred in
new code, but `guint` can be used in contexts where a type name
-must be a single word, such as in the [method@GObject.Type.name] of
-[const@GObject.TYPE_UINT] or when generating a family of function names for
+must be a single word, such as in the `GType` name of
+`G_TYPE_UINT` or when generating a family of function names for
multiple types using macros.
`G_MAXUINT`
The standard C `unsigned long` type should usually be preferred in
new code, but `gulong` can be used in contexts where a type name
-must be a single word, such as in the [method@GObject.Type.name] of
-[const@GObject.TYPE_ULONG] or when generating a family of function names for
+must be a single word, such as in the `GType` name of
+`G_TYPE_ULONG` or when generating a family of function names for
multiple types using macros.
`G_MAXULONG`
-expand_content_files = [
- 'modules.md',
-]
+if get_option('documentation') and enable_gir
+ expand_content_files = [
+ 'modules.md',
+ ]
-gmodule_toml = configure_file(input: 'gmodule.toml.in', output: 'gmodule.toml', configuration: toml_conf)
+ gmodule_toml = configure_file(input: 'gmodule.toml.in', output: 'gmodule.toml', configuration: toml_conf)
-custom_target('gmodule-docs',
- input: [ gmodule_toml, gmodule_gir[0] ],
- output: 'gmodule',
- command: [
- gidocgen,
- 'generate',
- gidocgen_common_args,
- '--config=@INPUT0@',
- '--output-dir=@OUTPUT@',
- '--content-dir=@0@'.format(meson.current_source_dir()),
- '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gobject'),
- '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gmodule'),
- '@INPUT1@',
- ],
- build_by_default: true,
- depend_files: expand_content_files,
- install: true,
- install_dir: docs_dir,
- install_tag: 'doc',
-)
+ custom_target('gmodule-docs',
+ input: [ gmodule_toml, gmodule_gir[0] ],
+ output: 'gmodule',
+ command: [
+ gidocgen,
+ 'generate',
+ gidocgen_common_args,
+ '--config=@INPUT0@',
+ '--output-dir=@OUTPUT@',
+ '--content-dir=@0@'.format(meson.current_source_dir()),
+ '@INPUT1@',
+ ],
+ build_by_default: true,
+ depend_files: expand_content_files,
+ install: true,
+ install_dir: docs_dir,
+ install_tag: 'doc',
+ )
+endif
endforeach
endif
-expand_content_files = [
- 'boxed.md',
- 'concepts.md',
- 'enum-types.md',
- 'floating-refs.md',
- 'gvalue.md',
- 'tutorial.md',
- 'types.md',
- 'signals.md',
- 'value-collection.md',
-]
+if get_option('documentation') and enable_gir
+ expand_content_files = [
+ 'boxed.md',
+ 'concepts.md',
+ 'enum-types.md',
+ 'floating-refs.md',
+ 'gvalue.md',
+ 'tutorial.md',
+ 'types.md',
+ 'signals.md',
+ 'value-collection.md',
+ ]
-gobject_toml = configure_file(input: 'gobject.toml.in', output: 'gobject.toml', configuration: toml_conf)
+ gobject_toml = configure_file(input: 'gobject.toml.in', output: 'gobject.toml', configuration: toml_conf)
-custom_target('gobject-docs',
- input: [ gobject_toml, gobject_gir[0] ],
- output: 'gobject',
- command: [
- gidocgen,
- 'generate',
- gidocgen_common_args,
- '--config=@INPUT0@',
- '--output-dir=@OUTPUT@',
- '--content-dir=@0@'.format(meson.current_source_dir()),
- '--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gobject'),
- '@INPUT1@',
- ],
- build_by_default: true,
- depend_files: expand_content_files,
- install: true,
- install_dir: docs_dir,
- install_tag: 'doc',
-)
+ custom_target('gobject-docs',
+ input: [ gobject_toml, gobject_gir[0] ],
+ output: 'gobject',
+ command: [
+ gidocgen,
+ 'generate',
+ gidocgen_common_args,
+ '--config=@INPUT0@',
+ '--output-dir=@OUTPUT@',
+ '--content-dir=@0@'.format(meson.current_source_dir()),
+ '@INPUT1@',
+ ],
+ build_by_default: true,
+ depend_files: expand_content_files,
+ install: true,
+ install_dir: docs_dir,
+ install_tag: 'doc',
+ )
+endif
'--quiet',
'--no-namespace-dir',
'--fatal-warnings',
+ '--add-include-path=@0@'.format(meson.current_build_dir() / '../../introspection'),
]
docs_dir = glib_datadir / 'doc' / 'glib-2.0'
-
- subdir('glib')
- subdir('gmodule')
- subdir('gobject')
- subdir('gio')
- subdir('girepository')
endif
+
+subdir('glib')
+subdir('gmodule')
+subdir('gobject')
+subdir('gio')
+subdir('girepository')
* commandline to this process).
*
* The `GApplicationCommandLine` object can provide the @argc and @argv
- * parameters for use with the [struct@Glib.OptionContext] command-line parsing API,
+ * parameters for use with the [struct@GLib.OptionContext] command-line parsing API,
* with the [method@Gio.ApplicationCommandLine.get_arguments] function. See
* [gapplication-example-cmdline3.c][gapplication-example-cmdline3]
* for an example.
* `G_IO_ERROR_TIMED_OUT` if no progress was made. To know when a call would
* successfully run you can call [method@Gio.DatagramBased.condition_check] or
* [method@Gio.DatagramBased.condition_wait]. You can also use
- * [method@Gio.DatagramBased.create_source] and attach it to a [struct@Glib.MainContext]
+ * [method@Gio.DatagramBased.create_source] and attach it to a [struct@GLib.MainContext]
* to get callbacks when I/O is possible.
*
* When running a non-blocking operation applications should always be able to
f"Title: {iface.name} D-Bus Interface",
f"Slug: {iface.name}",
"",
- "# " + iface.name,
+ "# " + iface.name_without_prefix,
"",
"## Description",
"",
def _generate_header(self, iface):
"""Generates the header and preamble of the document."""
- header_len = len(iface.name)
+ iface_name = iface.name_without_prefix
+ header_len = len(iface_name)
res = [
f".. _{iface.name}:",
"",
"=" * header_len,
- iface.name,
+ iface_name,
"=" * header_len,
"",
"-----------",
}
}
+static const char *
+message_type_to_string (GDBusMessageType message_type)
+{
+ switch (message_type)
+ {
+ case G_DBUS_MESSAGE_TYPE_INVALID:
+ return "INVALID";
+ case G_DBUS_MESSAGE_TYPE_METHOD_CALL:
+ return "METHOD_CALL";
+ case G_DBUS_MESSAGE_TYPE_METHOD_RETURN:
+ return "METHOD_RETURN";
+ case G_DBUS_MESSAGE_TYPE_ERROR:
+ return "ERROR";
+ case G_DBUS_MESSAGE_TYPE_SIGNAL:
+ return "SIGNAL";
+ default:
+ return "unknown-type";
+ }
+}
+
+static const char *
+message_header_field_to_string (GDBusMessageHeaderField field)
+{
+ switch (field)
+ {
+ case G_DBUS_MESSAGE_HEADER_FIELD_INVALID:
+ return "INVALID";
+ case G_DBUS_MESSAGE_HEADER_FIELD_PATH:
+ return "PATH";
+ case G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE:
+ return "INTERFACE";
+ case G_DBUS_MESSAGE_HEADER_FIELD_MEMBER:
+ return "MEMBER";
+ case G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME:
+ return "ERROR_NAME";
+ case G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL:
+ return "REPLY_SERIAL";
+ case G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION:
+ return "DESTINATION";
+ case G_DBUS_MESSAGE_HEADER_FIELD_SENDER:
+ return "SENDER";
+ case G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE:
+ return "SIGNATURE";
+ case G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS:
+ return "NUM_UNIX_FDS";
+ default:
+ return "unknown-field";
+ }
+}
+
+static gboolean
+validate_header (GDBusMessage *message,
+ GDBusMessageHeaderField field,
+ GVariant *header_value,
+ const GVariantType *expected_type,
+ GError **error)
+{
+ g_assert (header_value != NULL);
+
+ if (!g_variant_is_of_type (header_value, expected_type))
+ {
+ char *expected_type_string = g_variant_type_dup_string (expected_type);
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_ARGUMENT,
+ _("%s message: %s header field is invalid; expected a value of type ‘%s’"),
+ message_type_to_string (message->type),
+ message_header_field_to_string (field),
+ expected_type_string);
+ g_free (expected_type_string);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+require_header (GDBusMessage *message,
+ GDBusMessageHeaderField field,
+ GError **error)
+{
+ GVariant *header_value = g_dbus_message_get_header (message, field);
+
+ if (header_value == NULL)
+ {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_ARGUMENT,
+ _("%s message: %s header field is missing or invalid"),
+ message_type_to_string (message->type),
+ message_header_field_to_string (field));
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Implement the validation rules given in
+ * https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-header-fields */
static gboolean
validate_headers (GDBusMessage *message,
GError **error)
{
gboolean ret;
+ GHashTableIter headers_iter;
+ gpointer key;
+ GVariant *header_value;
g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
ret = FALSE;
+ /* Validate the types of all known headers. */
+ g_hash_table_iter_init (&headers_iter, message->headers);
+ while (g_hash_table_iter_next (&headers_iter, &key, (gpointer) &header_value))
+ {
+ GDBusMessageHeaderField field_type = GPOINTER_TO_INT (key);
+
+ switch (field_type)
+ {
+ case G_DBUS_MESSAGE_HEADER_FIELD_INVALID:
+ /* The invalid header must be rejected as per
+ * https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-header-fields */
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_ARGUMENT,
+ _("%s message: INVALID header field supplied"),
+ message_type_to_string (message->type));
+ goto out;
+ 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)
+ {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_ARGUMENT,
+ _("%s message: PATH header field is using the reserved value /org/freedesktop/DBus/Local"),
+ message_type_to_string (message->type));
+ goto out;
+ }
+ break;
+ case G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE:
+ if (!validate_header (message, field_type, header_value, G_VARIANT_TYPE_STRING, error))
+ goto out;
+ if (!g_dbus_is_interface_name (g_variant_get_string (header_value, NULL)))
+ {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_ARGUMENT,
+ _("%s message: INTERFACE header field does not contain a valid interface name"),
+ message_type_to_string (message->type));
+ goto out;
+ }
+ if (g_strcmp0 (g_variant_get_string (header_value, NULL), "org.freedesktop.DBus.Local") == 0)
+ {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_ARGUMENT,
+ _("%s message: INTERFACE header field is using the reserved value org.freedesktop.DBus.Local"),
+ message_type_to_string (message->type));
+ goto out;
+ }
+ break;
+ case G_DBUS_MESSAGE_HEADER_FIELD_MEMBER:
+ if (!validate_header (message, field_type, header_value, G_VARIANT_TYPE_STRING, error))
+ goto out;
+ if (!g_dbus_is_member_name (g_variant_get_string (header_value, NULL)))
+ {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_ARGUMENT,
+ _("%s message: MEMBER header field does not contain a valid member name"),
+ message_type_to_string (message->type));
+ goto out;
+ }
+ break;
+ case G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME:
+ if (!validate_header (message, field_type, header_value, G_VARIANT_TYPE_STRING, error))
+ goto out;
+ if (!g_dbus_is_error_name (g_variant_get_string (header_value, NULL)))
+ {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_ARGUMENT,
+ _("%s message: ERROR_NAME header field does not contain a valid error name"),
+ message_type_to_string (message->type));
+ goto out;
+ }
+ break;
+ case G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL:
+ if (!validate_header (message, field_type, header_value, G_VARIANT_TYPE_UINT32, error))
+ goto out;
+ break;
+ case G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION:
+ if (!validate_header (message, field_type, header_value, G_VARIANT_TYPE_STRING, error))
+ goto out;
+ break;
+ case G_DBUS_MESSAGE_HEADER_FIELD_SENDER:
+ if (!validate_header (message, field_type, header_value, G_VARIANT_TYPE_STRING, error))
+ goto out;
+ break;
+ case G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE:
+ if (!validate_header (message, field_type, header_value, G_VARIANT_TYPE_SIGNATURE, error))
+ goto out;
+ break;
+ case G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS:
+ if (!validate_header (message, field_type, header_value, G_VARIANT_TYPE_UINT32, error))
+ goto out;
+ break;
+ default:
+ /* Ignore unknown fields as per
+ * https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-header-fields. */
+ continue;
+ }
+ }
+
+ /* Check for message-type-specific required headers. */
switch (message->type)
{
case G_DBUS_MESSAGE_TYPE_INVALID:
G_IO_ERROR_INVALID_ARGUMENT,
_("type is INVALID"));
goto out;
- break;
case G_DBUS_MESSAGE_TYPE_METHOD_CALL:
- {
- GVariant *path_variant = g_dbus_message_get_header (message, G_DBUS_MESSAGE_HEADER_FIELD_PATH);
- GVariant *member_variant = g_dbus_message_get_header (message, G_DBUS_MESSAGE_HEADER_FIELD_MEMBER);
-
- if (path_variant == NULL ||
- !g_variant_is_of_type (path_variant, G_VARIANT_TYPE_OBJECT_PATH) ||
- member_variant == NULL ||
- !g_variant_is_of_type (member_variant, G_VARIANT_TYPE_STRING) ||
- !g_dbus_is_member_name (g_variant_get_string (member_variant, NULL)))
- {
- g_set_error_literal (error,
- G_IO_ERROR,
- G_IO_ERROR_INVALID_ARGUMENT,
- _("METHOD_CALL message: PATH or MEMBER header field is missing or invalid"));
- goto out;
- }
- }
+ if (!require_header (message, G_DBUS_MESSAGE_HEADER_FIELD_PATH, error) ||
+ !require_header (message, G_DBUS_MESSAGE_HEADER_FIELD_MEMBER, error))
+ goto out;
break;
case G_DBUS_MESSAGE_TYPE_METHOD_RETURN:
- {
- GVariant *reply_serial_variant = g_dbus_message_get_header (message, G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL);
-
- if (reply_serial_variant == NULL ||
- !g_variant_is_of_type (reply_serial_variant, G_VARIANT_TYPE_UINT32))
- {
- g_set_error_literal (error,
- G_IO_ERROR,
- G_IO_ERROR_INVALID_ARGUMENT,
- _("METHOD_RETURN message: REPLY_SERIAL header field is missing or invalid"));
- goto out;
- }
- }
+ if (!require_header (message, G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL, error))
+ goto out;
break;
case G_DBUS_MESSAGE_TYPE_ERROR:
- {
- GVariant *error_name_variant = g_dbus_message_get_header (message, G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME);
- GVariant *reply_serial_variant = g_dbus_message_get_header (message, G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL);
-
- if (error_name_variant == NULL ||
- !g_variant_is_of_type (error_name_variant, G_VARIANT_TYPE_STRING) ||
- !g_dbus_is_error_name (g_variant_get_string (error_name_variant, NULL)) ||
- reply_serial_variant == NULL ||
- !g_variant_is_of_type (reply_serial_variant, G_VARIANT_TYPE_UINT32))
- {
- g_set_error_literal (error,
- G_IO_ERROR,
- G_IO_ERROR_INVALID_ARGUMENT,
- _("ERROR message: REPLY_SERIAL or ERROR_NAME header field is missing or invalid"));
- goto out;
- }
- }
+ if (!require_header (message, G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME, error) ||
+ !require_header (message, G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL, error))
+ goto out;
break;
case G_DBUS_MESSAGE_TYPE_SIGNAL:
- {
- GVariant *path_variant = g_dbus_message_get_header (message, G_DBUS_MESSAGE_HEADER_FIELD_PATH);
- GVariant *interface_variant = g_dbus_message_get_header (message, G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE);
- GVariant *member_variant = g_dbus_message_get_header (message, G_DBUS_MESSAGE_HEADER_FIELD_MEMBER);
-
- if (path_variant == NULL ||
- !g_variant_is_of_type (path_variant, G_VARIANT_TYPE_OBJECT_PATH) ||
- interface_variant == NULL ||
- !g_variant_is_of_type (interface_variant, G_VARIANT_TYPE_STRING) ||
- !g_dbus_is_interface_name (g_variant_get_string (interface_variant, NULL)) ||
- member_variant == NULL ||
- !g_variant_is_of_type (member_variant, G_VARIANT_TYPE_STRING) ||
- !g_dbus_is_member_name (g_variant_get_string (member_variant, NULL)))
- {
- g_set_error_literal (error,
- G_IO_ERROR,
- G_IO_ERROR_INVALID_ARGUMENT,
- _("SIGNAL message: PATH, INTERFACE or MEMBER header field is missing or invalid"));
- goto out;
- }
- if (g_strcmp0 (g_dbus_message_get_path (message), "/org/freedesktop/DBus/Local") == 0)
- {
- g_set_error_literal (error,
- G_IO_ERROR,
- G_IO_ERROR_INVALID_ARGUMENT,
- _("SIGNAL message: The PATH header field is using the reserved value /org/freedesktop/DBus/Local"));
- goto out;
- }
- if (g_strcmp0 (g_dbus_message_get_interface (message), "org.freedesktop.DBus.Local") == 0)
- {
- g_set_error_literal (error,
- G_IO_ERROR,
- G_IO_ERROR_INVALID_ARGUMENT,
- _("SIGNAL message: The INTERFACE header field is using the reserved value org.freedesktop.DBus.Local"));
- goto out;
- }
- }
+ if (!require_header (message, G_DBUS_MESSAGE_HEADER_FIELD_PATH, error) ||
+ !require_header (message, G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE, error) ||
+ !require_header (message, G_DBUS_MESSAGE_HEADER_FIELD_MEMBER, error))
+ goto out;
break;
default:
* stream to jump to arbitrary positions in the file, provided the
* filesystem of the file allows it. To find the position of a file
* input stream, use [method@Gio.Seekable.tell]. To find out if a file input
- * stream supports seeking, use [iface@Gio.Seekable.can_seek].
- * To position a file input stream, use [iface@Gio.Seekable.seek].
+ * stream supports seeking, use [vfunc@Gio.Seekable.can_seek].
+ * To position a file input stream, use [vfunc@Gio.Seekable.seek].
**/
static void g_file_input_stream_seekable_iface_init (GSeekableIface *iface);
* be prepared to handle at least the three following cases:
* [iface@Gio.LoadableIcon], [class@Gio.ThemedIcon] and [class@Gio.EmblemedIcon].
* It may also make sense to have fast-paths for other cases (like handling
- * [class@GdkPixbuf.Pixbuf] directly, for example) but all compliant `GIcon`
- * implementations outside of GIO must implement [iface@Gio.LoadableIcon].
+ * [`GdkPixbuf`](https://docs.gtk.org/gdk-pixbuf/class.Pixbuf.html) directly,
+ * for example) but all compliant `GIcon` implementations outside of GIO must
+ * implement [iface@Gio.LoadableIcon].
*
* If your application or library provides one or more `GIcon`
* implementations you need to ensure that your new implementation also
* identifies an action in an action group. Which action group(s) provide
* actions depends on the context in which the menu model is used.
* E.g. when the model is exported as the application menu of a
- * [class@Gtk.Application], actions can be application-wide or window-specific
- * (and thus come from two different action groups). By convention, the
- * application-wide actions have names that start with `app.`, while the
- * names of window-specific actions start with `win.`.
+ * [`GtkApplication`](https://docs.gtk.org/gtk4/class.Application.html),
+ * actions can be application-wide or window-specific (and thus come from
+ * two different action groups). By convention, the application-wide actions
+ * have names that start with `app.`, while the names of window-specific
+ * actions start with `win.`.
*
* While a wide variety of stateful actions is possible, the following
* is the minimum that is expected to be supported by all users of exported
*
* Users should instantiate a subclass of this that implements all the
* various callbacks to show the required dialogs, such as
- * [class@Gtk.MountOperation]. If no user interaction is desired (for example
- * when automounting filesystems at login time), usually `NULL` can be
- * passed, see each method taking a `GMountOperation` for details.
+ * [`GtkMountOperation`](https://docs.gtk.org/gtk4/class.MountOperation.html).
+ * If no user interaction is desired (for example when automounting
+ * filesystems at login time), usually `NULL` can be passed, see each method
+ * taking a `GMountOperation` for details.
*
* Throughout the API, the term ‘TCRYPT’ is used to mean ‘compatible with TrueCrypt and VeraCrypt’.
* [TrueCrypt](https://en.wikipedia.org/wiki/TrueCrypt) is a discontinued system for
* in sync with the property value — its state is the property value.
*
* For example, it might be useful to create a [iface@Gio.Action] corresponding
- * to the `visible-child-name` property of a [class@Gtk.Stack] so that the
- * current page can be switched from a menu. The active radio indication in the
- * menu is then directly determined from the active page of the
- * [class@Gtk.Stack].
+ * to the `visible-child-name` property of a [`GtkStack`](https://docs.gtk.org/gtk4/class.Stack.html)
+ * so that the current page can be switched from a menu. The active radio
+ * indication in the menu is then directly determined from the active page of
+ * the `GtkStack`.
*
* An anti-example would be binding the `active-id` property on a
- * [class@Gtk.ComboBox]. This is because the state of the combobox itself is
- * probably uninteresting and is actually being used to control
- * something else.
+ * [`GtkComboBox`](https://docs.gtk.org/gtk4/class.ComboBox.html). This is
+ * because the state of the combo box itself is probably uninteresting and is
+ * actually being used to control something else.
*
* Another anti-example would be to bind to the `visible-child-name`
- * property of a [class@Gtk.Stack] if this value is actually stored in
- * [class@Gio.Settings]. In that case, the real source of the value is
- * [class@Gio.Settings]. If you want a [iface@Gio.Action] to control a setting
- * stored in [class@Gio.Settings], see [method@Gio.Settings.create_action]
- * instead, and possibly combine its use with [method@Gio.Settings.bind].
+ * property of a [`GtkStack`](https://docs.gtk.org/gtk4/class.Stack.html) if
+ * this value is actually stored in [class@Gio.Settings]. In that case, the
+ * real source of the value is* [class@Gio.Settings]. If you want
+ * a [iface@Gio.Action] to control a setting stored in [class@Gio.Settings],
+ * see [method@Gio.Settings.create_action] instead, and possibly combine its
+ * use with [method@Gio.Settings.bind].
*
* Since: 2.38
**/
*
* Applications and libraries often contain binary or textual data that is
* really part of the application, rather than user data. For instance
- * [class@Gtk.Builder] `.ui` files, splashscreen images, [class@Gio.Menu] markup
- * XML, CSS files, icons, etc. These are often shipped as files in
- * `$datadir/appname`, or manually included as literal strings in the code.
+ * [`GtkBuilder`](https://docs.gtk.org/gtk4/class.Builder.html) `.ui` files,
+ * splashscreen images, [class@Gio.Menu] markup XML, CSS files, icons, etc.
+ * These are often shipped as files in `$datadir/appname`, or manually
+ * included as literal strings in the code.
*
* The `GResource` API and the
* [`glib-compile-resources`](glib-compile-resources.html) program provide a
* the preprocessing step is skipped.
*
* - `to-pixdata` (deprecated since gdk-pixbuf 2.32) which will use the
- * `gdk-pixbuf-pixdata` command to convert images to the [class@Gdk.Pixdata]
+ * `gdk-pixbuf-pixdata` command to convert images to the [`GdkPixdata`](https://docs.gtk.org/gdk-pixbuf/class.Pixdata.html)
* format, which allows you to create pixbufs directly using the data inside
* the resource file, rather than an (uncompressed) copy of it. For this, the
* `gdk-pixbuf-pixdata` program must be in the `PATH`, or the
* also use URIs like `resource:///org/gtk/Example/data/splashscreen.png` with
* [iface@Gio.File] to access the resource data.
*
- * Some higher-level APIs, such as [class@Gtk.Application], will automatically
- * load resources from certain well-known paths in the resource namespace as a
- * convenience. See the documentation for those APIs for details.
+ * Some higher-level APIs, such as [`GtkApplication`](https://docs.gtk.org/gtk4/class.Application.html),
+ * will automatically load resources from certain well-known paths in the
+ * resource namespace as a convenience. See the documentation for those APIs
+ * for details.
*
* There are two forms of the generated source, the default version uses the
* compiler support for constructor and destructor functions (where available)
* A `GSimpleAction` is the obvious simple implementation of the
* [iface@Gio.Action] interface. This is the easiest way to create an action for
* purposes of adding it to a [class@Gio.SimpleActionGroup].
- *
- * See also [class@Gtk.Action].
*/
struct _GSimpleAction
'gwin32sid.h',
)
- gio_win_rc = configure_file(
- input: 'gio.rc.in',
- output: 'gio.rc',
- configuration: glibconfig_conf,
- )
- gio_win_res = windows.compile_resources(gio_win_rc)
- win32_sources += [gio_win_res]
+ if glib_build_shared
+ gio_win_rc = configure_file(
+ input: 'gio.rc.in',
+ output: 'gio.rc',
+ configuration: glibconfig_conf,
+ )
+ gio_win_res = windows.compile_resources(gio_win_rc)
+ win32_sources += [gio_win_res]
+ endif
gio_win32_include_headers = files(
'gregistrysettingsbackend.h',
#include <gio/gio.h>
#include <gio/gdesktopappinfo.h>
+/* Should be called inside a #GTestDBus environment. */
static void
test_launch_for_app_info (GAppInfo *appinfo)
{
static void
test_launch (void)
{
+ GTestDBus *bus = NULL;
GAppInfo *appinfo;
const gchar *path;
+ /* Set up a test session bus to keep D-Bus traffic off the real session bus. */
+ bus = g_test_dbus_new (G_TEST_DBUS_NONE);
+ g_test_dbus_up (bus);
+
path = g_test_get_filename (G_TEST_BUILT, "appinfo-test.desktop", NULL);
appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path);
g_assert_true (G_IS_APP_INFO (appinfo));
test_launch_for_app_info (appinfo);
g_object_unref (appinfo);
+
+ g_test_dbus_down (bus);
+ g_clear_object (&bus);
}
static void
"Keywords=keyword1;test keyword;\n"
"Categories=GNOME;GTK;\n";
+ GTestDBus *bus = NULL;
gchar *exec_line_variants[2];
gsize i;
g_test_bug ("https://bugzilla.gnome.org/show_bug.cgi?id=791337");
+ /* Set up a test session bus to keep D-Bus traffic off the real session bus. */
+ bus = g_test_dbus_new (G_TEST_DBUS_NONE);
+ g_test_dbus_up (bus);
+
for (i = 0; i < G_N_ELEMENTS (exec_line_variants); i++)
{
gchar *desktop_file_contents;
g_key_file_unref (fake_desktop_file);
}
+ g_test_dbus_down (bus);
+ g_clear_object (&bus);
+
g_free (exec_line_variants[1]);
g_free (exec_line_variants[0]);
}
static void
test_launch_context_signals (void)
{
+ GTestDBus *bus = NULL;
GAppLaunchContext *context;
GAppInfo *appinfo;
GError *error = NULL;
gboolean success;
gchar *cmdline;
+ /* Set up a test session bus to keep D-Bus traffic off the real session bus. */
+ bus = g_test_dbus_new (G_TEST_DBUS_NONE);
+ g_test_dbus_up (bus);
+
cmdline = g_strconcat (g_test_get_dir (G_TEST_BUILT), "/appinfo-test --option", NULL);
context = g_app_launch_context_new ();
g_object_unref (context);
g_free (cmdline);
+
+ g_test_dbus_down (bus);
+ g_clear_object (&bus);
}
static void
static void
test_actions (void)
{
+ GTestDBus *bus = NULL;
const char *expected[] = { "frob", "tweak", "twiddle", "broken", NULL };
const gchar * const *actions;
GDesktopAppInfo *appinfo;
gchar *tweak_path;
gchar *twiddle_path;
+ /* Set up a test session bus to keep D-Bus traffic off the real session bus. */
+ bus = g_test_dbus_new (G_TEST_DBUS_NONE);
+ g_test_dbus_up (bus);
+
appinfo = g_desktop_app_info_new_from_filename (g_test_get_filename (G_TEST_DIST, "appinfo-test-actions.desktop", NULL));
g_assert_nonnull (appinfo);
g_free (tweak_path);
g_free (twiddle_path);
g_object_unref (appinfo);
+
+ g_test_dbus_down (bus);
+ g_clear_object (&bus);
}
static gchar *
g_object_unref (message);
/*
- * check that we can't serialize messages with SIGNATURE set to a non-signature-typed value
+ * check we can't serialize messages with an INVALID header
*/
message = g_dbus_message_new_signal ("/the/path", "The.Interface", "TheMember");
- g_dbus_message_set_header (message, G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE, g_variant_new_boolean (FALSE));
+ g_dbus_message_set_header (message, G_DBUS_MESSAGE_HEADER_FIELD_INVALID, g_variant_new_boolean (FALSE));
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, ==, "Signature header found but is not of type signature");
+ g_assert_cmpstr (error->message, ==, "Cannot serialize message: SIGNAL message: INVALID header field supplied");
g_assert_null (blob);
g_clear_error (&error);
g_clear_object (&message);
/*
+ * check that we can't serialize messages with various fields set to incorrectly typed values
+ */
+ const struct
+ {
+ GDBusMessageHeaderField field;
+ const char *invalid_value; /* as a GVariant in text form */
+ const char *expected_error_message;
+ }
+ field_type_tests[] =
+ {
+ {
+ G_DBUS_MESSAGE_HEADER_FIELD_PATH,
+ "'/correct/value/but/wrong/type'",
+ "Cannot serialize message: SIGNAL message: PATH header field is invalid; expected a value of type ‘o’"
+ },
+ {
+ G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE,
+ "@u 5",
+ "Cannot serialize message: SIGNAL message: INTERFACE header field is invalid; expected a value of type ‘s’"
+ },
+ {
+ G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE,
+ "'valid type, but not an interface name'",
+ "Cannot serialize message: SIGNAL message: INTERFACE header field does not contain a valid interface name"
+ },
+ {
+ G_DBUS_MESSAGE_HEADER_FIELD_MEMBER,
+ "@u 5",
+ "Cannot serialize message: SIGNAL message: MEMBER header field is invalid; expected a value of type ‘s’"
+ },
+ {
+ G_DBUS_MESSAGE_HEADER_FIELD_MEMBER,
+ "'valid type, but not a member name'",
+ "Cannot serialize message: SIGNAL message: MEMBER header field does not contain a valid member name"
+ },
+ {
+ G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME,
+ "@u 5",
+ "Cannot serialize message: SIGNAL message: ERROR_NAME header field is invalid; expected a value of type ‘s’"
+ },
+ {
+ G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME,
+ "'valid type, but not an error name'",
+ "Cannot serialize message: SIGNAL message: ERROR_NAME header field does not contain a valid error name"
+ },
+ {
+ G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL,
+ "'oops'",
+ "Cannot serialize message: SIGNAL message: REPLY_SERIAL header field is invalid; expected a value of type ‘u’"
+ },
+ {
+ G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION,
+ "@u 5",
+ "Cannot serialize message: SIGNAL message: DESTINATION header field is invalid; expected a value of type ‘s’"
+ },
+ {
+ G_DBUS_MESSAGE_HEADER_FIELD_SENDER,
+ "@u 5",
+ "Cannot serialize message: SIGNAL message: SENDER header field is invalid; expected a value of type ‘s’"
+ },
+ {
+ G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE,
+ "false",
+ "Cannot serialize message: SIGNAL message: SIGNATURE header field is invalid; expected a value of type ‘g’"
+ },
+ {
+ G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS,
+ "'five'",
+ "Cannot serialize message: SIGNAL message: NUM_UNIX_FDS header field is invalid; expected a value of type ‘u’"
+ },
+ };
+
+ for (size_t i = 0; i < G_N_ELEMENTS (field_type_tests); i++)
+ {
+ message = g_dbus_message_new_signal ("/the/path", "The.Interface", "TheMember");
+ g_dbus_message_set_header (message, field_type_tests[i].field, g_variant_new_parsed (field_type_tests[i].invalid_value));
+ 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, ==, field_type_tests[i].expected_error_message);
+ g_assert_null (blob);
+
+ g_clear_error (&error);
+ g_clear_object (&message);
+ }
+
+ /*
* check we can't serialize signal messages with INTERFACE, PATH or MEMBER unset / set to reserved value
*/
message = g_dbus_message_new_signal ("/the/path", "The.Interface", "TheMember");
g_dbus_message_set_interface (message, NULL);
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, INTERFACE or MEMBER header field is missing or invalid");
+ g_assert_cmpstr (error->message, ==, "Cannot serialize message: SIGNAL message: INTERFACE header field is missing or invalid");
g_clear_error (&error);
g_assert_null (blob);
/* interface reserved value => error */
g_dbus_message_set_interface (message, "org.freedesktop.DBus.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: The 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 org.freedesktop.DBus.Local");
g_clear_error (&error);
g_assert_null (blob);
/* reset interface */
g_dbus_message_set_path (message, NULL);
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, INTERFACE or MEMBER header field is missing or invalid");
+ g_assert_cmpstr (error->message, ==, "Cannot serialize message: SIGNAL message: PATH header field is missing or invalid");
g_clear_error (&error);
g_assert_null (blob);
/* path reserved value => error */
g_dbus_message_set_path (message, "/org/freedesktop/DBus/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: The 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 /org/freedesktop/DBus/Local");
g_clear_error (&error);
g_assert_null (blob);
/* reset path */
g_dbus_message_set_member (message, NULL);
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, INTERFACE or MEMBER header field is missing or invalid");
+ g_assert_cmpstr (error->message, ==, "Cannot serialize message: SIGNAL message: MEMBER header field is missing or invalid");
g_clear_error (&error);
g_assert_null (blob);
/* reset member */
g_dbus_message_set_path (message, NULL);
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: METHOD_CALL message: PATH or MEMBER header field is missing or invalid");
+ g_assert_cmpstr (error->message, ==, "Cannot serialize message: METHOD_CALL message: PATH header field is missing or invalid");
g_clear_error (&error);
g_assert_null (blob);
/* reset path */
g_dbus_message_set_member (message, NULL);
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: METHOD_CALL message: PATH or MEMBER header field is missing or invalid");
+ g_assert_cmpstr (error->message, ==, "Cannot serialize message: METHOD_CALL message: MEMBER header field is missing or invalid");
g_clear_error (&error);
g_assert_null (blob);
/* reset member */
g_dbus_message_set_error_name (reply, NULL);
blob = g_dbus_message_to_blob (reply, &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: ERROR message: REPLY_SERIAL or ERROR_NAME header field is missing or invalid");
+ g_assert_cmpstr (error->message, ==, "Cannot serialize message: ERROR message: ERROR_NAME header field is missing or invalid");
g_clear_error (&error);
g_assert_null (blob);
/* reset ERROR_NAME */
g_dbus_message_set_header (reply, G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL, NULL);
blob = g_dbus_message_to_blob (reply, &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: ERROR message: REPLY_SERIAL or ERROR_NAME header field is missing or invalid");
+ g_assert_cmpstr (error->message, ==, "Cannot serialize message: ERROR message: REPLY_SERIAL header field is missing or invalid");
g_clear_error (&error);
g_assert_null (blob);
g_object_unref (reply);
g_object_unref (message);
}
+static void
+test_message_serialize_header_checks_valid (void)
+{
+ GDBusMessage *message = NULL, *reply = NULL;
+ GError *local_error = NULL;
+ guchar *blob;
+ gsize blob_size;
+
+ g_test_summary ("Test that validation allows well-formed messages of all the different types");
+
+ /* Method call */
+ message = g_dbus_message_new_method_call ("Some.Name", "/the/path", "org.some.Interface", "TheMethod");
+ g_dbus_message_set_serial (message, 666);
+ blob = g_dbus_message_to_blob (message, &blob_size, G_DBUS_CAPABILITY_FLAGS_NONE, &local_error);
+ g_assert_no_error (local_error);
+ g_assert_nonnull (blob);
+ g_free (blob);
+
+ /* Method return */
+ reply = g_dbus_message_new_method_reply (message);
+ blob = g_dbus_message_to_blob (reply, &blob_size, G_DBUS_CAPABILITY_FLAGS_NONE, &local_error);
+ g_assert_no_error (local_error);
+ g_assert_nonnull (blob);
+ g_free (blob);
+ g_clear_object (&reply);
+
+ /* Error */
+ reply = g_dbus_message_new_method_error (message, "Error.Name", "Some error message");
+ blob = g_dbus_message_to_blob (reply, &blob_size, G_DBUS_CAPABILITY_FLAGS_NONE, &local_error);
+ g_assert_no_error (local_error);
+ g_assert_nonnull (blob);
+ g_free (blob);
+
+ g_clear_object (&reply);
+ g_clear_object (&message);
+
+ /* Signal */
+ message = g_dbus_message_new_signal ("/the/path", "org.some.Interface", "SignalName");
+ blob = g_dbus_message_to_blob (message, &blob_size, G_DBUS_CAPABILITY_FLAGS_NONE, &local_error);
+ g_assert_no_error (local_error);
+ g_assert_nonnull (blob);
+ g_free (blob);
+ g_clear_object (&message);
+
+ /* Also check that an unknown message type is allowed */
+ message = g_dbus_message_new ();
+ g_dbus_message_set_message_type (message, 123);
+ blob = g_dbus_message_to_blob (message, &blob_size, G_DBUS_CAPABILITY_FLAGS_NONE, &local_error);
+ g_assert_no_error (local_error);
+ g_assert_nonnull (blob);
+ g_free (blob);
+ g_clear_object (&message);
+
+ /* Even one with a well-defined field on it */
+ message = g_dbus_message_new ();
+ g_dbus_message_set_message_type (message, 123);
+ g_dbus_message_set_header (message, G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS, g_variant_new_uint32 (0));
+ blob = g_dbus_message_to_blob (message, &blob_size, G_DBUS_CAPABILITY_FLAGS_NONE, &local_error);
+ g_assert_no_error (local_error);
+ g_assert_nonnull (blob);
+ g_free (blob);
+ g_clear_object (&message);
+}
+
/* ---------------------------------------------------------------------------------------------------- */
static void
test_message_serialize_invalid);
g_test_add_func ("/gdbus/message-serialize/header-checks",
test_message_serialize_header_checks);
+ g_test_add_func ("/gdbus/message-serialize/header-checks/valid",
+ test_message_serialize_header_checks_valid);
g_test_add_func ("/gdbus/message-serialize/double-array",
test_message_serialize_double_array);
g_test_add_func ("/gdbus/message-serialize/empty-structure",
ld = find_program('ld', required : false)
- if build_machine.system() == 'linux' and \
- objcopy.found() and objcopy_supports_add_symbol and ld.found() and \
- build_machine.cpu_family() not in ['mips', 'mips64']
+ if build_machine.system() != 'linux'
+ why_no_external_data = 'only works on Linux'
+ elif not objcopy.found()
+ why_no_external_data = 'objcopy not found'
+ elif not objcopy_supports_add_symbol
+ why_no_external_data = 'objcopy does not support --add-symbol'
+ elif not ld.found()
+ why_no_external_data = 'ld not found'
+ elif build_machine.cpu_family() in ['mips', 'mips64']
+ why_no_external_data = 'cc -r can produce a mismatched MIPS ABI family, see GNOME/glib!3640'
+ else
+ why_no_external_data = ''
+
test_gresource_binary = custom_target('test5.gresource',
input : 'test5.gresource.xml',
output : 'test5.gresource',
]
endif
+ resources_c_args = []
+
+ if why_no_external_data != ''
+ resources_c_args += '-DNO_EXTERNAL_DATA="@0@"'.format(why_no_external_data)
+ endif
+
gio_tests += {
'resources' : {
+ 'c_args' : resources_c_args,
'extra_sources' : resources_extra_sources,
'depends' : resource_plugin,
# FIXME: musl: https://gitlab.gnome.org/GNOME/glib/-/issues/3160
static void
test_resource_binary_linked (void)
{
- #ifndef __linux__
- g_test_skip ("--external-data test only works on Linux");
+ #ifdef NO_EXTERNAL_DATA
+ g_test_skip ("--external-data cannot be tested: " NO_EXTERNAL_DATA);
return;
- #else /* if __linux__ */
+ #else /* !NO_EXTERNAL_DATA */
GError *error = NULL;
gboolean found;
gsize size;
g_assert_cmpint (size, ==, 6);
g_assert_cmpstr (g_bytes_get_data (data, NULL), ==, "test1\n");
g_bytes_unref (data);
- #endif /* if __linux__ */
+ #endif /* !NO_EXTERNAL_DATA */
}
/* Test resource whose xml file starts with more than one digit
g_socket_close (data->server, &error);
g_assert_no_error (error);
+ g_object_unref (dest_addr);
g_object_unref (client);
ip_test_data_free (data);
#include "bitbool.h"
#include <math.h>
#include <stdlib.h>
+#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
//#define DEBUG
#include "debug.h"
-#if defined (__ia64) || defined (__x86_64__) || defined (_WIN64)
-# define __brz_use_64bit__
-#endif
static int brz_gen_mphf(cmph_config_t *mph);
static cmph_uint32 brz_min_index(cmph_uint32 * vector, cmph_uint32 n);
cmph_uint8 * ptr = packed_mphf;
cmph_uint32 i,n;
CMPH_HASH h0_type, h1_type, h2_type;
-#ifdef __brz_use_64bit__
- cmph_uint64 * g_is_ptr;
-#else
- cmph_uint32 * g_is_ptr;
-#endif
+ uintptr_t *g_is_ptr;
cmph_uint8 * g_i;
// packing internal algo type
memcpy(ptr, data->offset, sizeof(cmph_uint32)*data->k);
ptr += sizeof(cmph_uint32)*data->k;
- #ifdef __brz_use_64bit__
- g_is_ptr = (cmph_uint64 *)ptr;
- #else
- g_is_ptr = (cmph_uint32 *)ptr;
- #endif
-
+ g_is_ptr = (uintptr_t *)ptr;
+
g_i = (cmph_uint8 *) (g_is_ptr + data->k);
for(i = 0; i < data->k; i++)
{
- #ifdef __brz_use_64bit__
- *g_is_ptr++ = (cmph_uint64)g_i;
- #else
- *g_is_ptr++ = (cmph_uint32)g_i;
- #endif
+ *g_is_ptr++ = (uintptr_t)g_i;
// packing h1[i]
hash_state_pack(data->h1[i], g_i);
g_i += hash_state_packed_size(h1_type);
size = (cmph_uint32)(2*sizeof(CMPH_ALGO) + 3*sizeof(CMPH_HASH) + hash_state_packed_size(h0_type) + sizeof(cmph_uint32) +
sizeof(double) + sizeof(cmph_uint8)*data->k + sizeof(cmph_uint32)*data->k);
// pointers to g_is
- #ifdef __brz_use_64bit__
- size += (cmph_uint32) sizeof(cmph_uint64)*data->k;
- #else
- size += (cmph_uint32) sizeof(cmph_uint32)*data->k;
- #endif
-
+ size += (cmph_uint32) sizeof(uintptr_t) * data->k;
size += hash_state_packed_size(h1_type) * data->k;
size += hash_state_packed_size(h2_type) * data->k;
register double c;
register CMPH_HASH h1_type, h2_type;
register cmph_uint8 * size;
-#ifdef __brz_use_64bit__
- register cmph_uint64 * g_is_ptr;
-#else
- register cmph_uint32 * g_is_ptr;
-#endif
+ register uintptr_t *g_is_ptr;
register cmph_uint8 *h1_ptr, *h2_ptr, *g;
register cmph_uint8 mphf_bucket;
m = size[h0];
n = (cmph_uint32)ceil(c * m);
- #ifdef __brz_use_64bit__
- g_is_ptr = (cmph_uint64 *)packed_mphf;
- #else
- g_is_ptr = packed_mphf;
- #endif
-
+ g_is_ptr = (uintptr_t *)packed_mphf;
+
h1_ptr = (cmph_uint8 *) g_is_ptr[h0];
h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
register CMPH_HASH h1_type, h2_type;
register cmph_uint8 *size, *h1_ptr, *h2_ptr, *g;
register cmph_uint32 *offset;
-#ifdef __brz_use_64bit__
- register cmph_uint64 * g_is_ptr;
-#else
- register cmph_uint32 * g_is_ptr;
-#endif
+ register uintptr_t *g_is_ptr;
register cmph_uint8 mphf_bucket;
packed_mphf = (cmph_uint32 *)(((cmph_uint8 *)packed_mphf) + hash_state_packed_size(h0_type));
p1 = fch_calc_p1(m);
p2 = fch_calc_p2(b);
- #ifdef __brz_use_64bit__
- g_is_ptr = (cmph_uint64 *)packed_mphf;
- #else
- g_is_ptr = packed_mphf;
- #endif
-
+ g_is_ptr = (uintptr_t *)packed_mphf;
+
h1_ptr = (cmph_uint8 *) g_is_ptr[h0];
h2_ptr = h1_ptr + hash_state_packed_size(h1_type);
+#include <stdint.h>
#include <glib.h>
#ifndef __CMPH_TYPES_H__
#define __CMPH_TYPES_H__
-typedef gint8 cmph_int8;
-typedef guint8 cmph_uint8;
+typedef int8_t cmph_int8;
+typedef uint8_t cmph_uint8;
-typedef gint16 cmph_int16;
-typedef guint16 cmph_uint16;
+typedef int16_t cmph_int16;
+typedef uint16_t cmph_uint16;
-typedef gint32 cmph_int32;
-typedef guint32 cmph_uint32;
+typedef int32_t cmph_int32;
+typedef uint32_t cmph_uint32;
-typedef gint64 cmph_int64;
-typedef guint64 cmph_uint64;
+typedef int64_t cmph_int64;
+typedef uint64_t cmph_uint64;
typedef enum { CMPH_HASH_JENKINS, CMPH_HASH_COUNT } CMPH_HASH;
extern const char *cmph_hash_names[];
sources: cmph_sources,
c_args: custom_c_args,
dependencies: cmph_deps,
+ gnu_symbol_visibility : 'hidden',
)
cmph_dep = declare_dependency(
'-Wno-type-limits',
])
endif
-
-test_env = environment()
-test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
-test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
-
-cmph_test = executable('cmph-bdz-test', '../cmph-bdz-test.c',
- dependencies: [
- cmph_dep,
- libglib_dep,
- libgobject_dep,
- ],
- c_args: custom_c_args + ['-UG_DISABLE_ASSERT'],
-)
-
-test('cmph-bdz-test', cmph_test,
- env: test_env,
- protocol: test_protocol,
- suite: ['girepository'],
- timeout: test_timeout,
-)
#include <gmodule.h>
#include <stdlib.h>
+#include <stdint.h>
#include <stdio.h>
#include <string.h>
static gboolean
write_all (FILE *out,
const void *buffer,
- gsize count,
- gsize *bytes_written,
+ size_t count,
+ size_t *bytes_written,
GError **error)
{
size_t ret;
size_t *len_out)
{
GByteArray *buffer = g_byte_array_new ();
- const guint8 nul = '\0';
+ const uint8_t nul = '\0';
while (TRUE)
{
size_t ret;
- guint8 byte;
+ uint8_t byte;
ret = fread (&byte, 1, 1, input);
if (ret == 0)
{
char *str;
va_list args;
- gsize written;
+ size_t written;
GError *error = NULL;
va_start (args, fmt);
static void
goutput_write (FILE *out, const char *str)
{
- gsize written;
+ size_t written;
GError *error = NULL;
if (!write_all (out, str, strlen (str), &written, &error))
{
if (!g_module_symbol (self, symbol, (void**)&sym))
{
g_set_error (error,
- G_FILE_ERROR,
- G_FILE_ERROR_FAILED,
- "Failed to find symbol '%s'", symbol);
+ G_FILE_ERROR,
+ G_FILE_ERROR_FAILED,
+ "Failed to find symbol '%s'", symbol);
return G_TYPE_INVALID;
}
if (ret == G_TYPE_INVALID)
{
g_set_error (error,
- G_FILE_ERROR,
- G_FILE_ERROR_FAILED,
- "Function '%s' returned G_TYPE_INVALID", symbol);
+ G_FILE_ERROR,
+ G_FILE_ERROR_FAILED,
+ "Function '%s' returned G_TYPE_INVALID", symbol);
}
return ret;
}
if (!g_module_symbol (self, symbol, (void**)&sym))
{
g_set_error (error,
- G_FILE_ERROR,
- G_FILE_ERROR_FAILED,
- "Failed to find symbol '%s'", symbol);
+ G_FILE_ERROR,
+ G_FILE_ERROR_FAILED,
+ "Failed to find symbol '%s'", symbol);
return G_TYPE_INVALID;
}
static void
dump_properties (GType type, FILE *out)
{
- guint i;
- guint n_properties = 0;
+ unsigned int i;
+ unsigned int n_properties = 0;
GParamSpec **props;
if (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT)
prop = props[i];
if (prop->owner_type != type)
- continue;
+ continue;
const GValue *v = g_param_spec_get_default_value (prop);
char *default_value = value_to_string (v);
static void
dump_signals (GType type, FILE *out)
{
- guint i;
- guint n_sigs;
- guint *sig_ids;
+ unsigned int i;
+ unsigned int n_sigs;
+ unsigned int *sig_ids;
sig_ids = g_signal_list_ids (type, &n_sigs);
for (i = 0; i < n_sigs; i++)
{
- guint sigid;
+ unsigned int sigid;
GSignalQuery query;
- guint j;
+ unsigned int j;
sigid = sig_ids[i];
g_signal_query (sigid, &query);
escaped_printf (out, " <signal name=\"%s\" return=\"%s\"",
- query.signal_name, g_type_name (query.return_type));
+ query.signal_name, g_type_name (query.return_type));
if (query.signal_flags & G_SIGNAL_RUN_FIRST)
escaped_printf (out, " when=\"first\"");
goutput_write (out, ">\n");
for (j = 0; j < query.n_params; j++)
- {
- escaped_printf (out, " <param type=\"%s\"/>\n",
- g_type_name (query.param_types[j]));
- }
+ {
+ escaped_printf (out, " <param type=\"%s\"/>\n",
+ g_type_name (query.param_types[j]));
+ }
goutput_write (out, " </signal>\n");
}
g_free (sig_ids);
static void
dump_object_type (GType type, const char *symbol, FILE *out)
{
- guint n_interfaces;
- guint i;
+ unsigned int n_interfaces;
+ unsigned int i;
GType *interfaces;
escaped_printf (out, " <class name=\"%s\" get-type=\"%s\"",
- g_type_name (type), symbol);
+ g_type_name (type), symbol);
if (type != G_TYPE_OBJECT)
{
GString *parent_str;
{
GType itype = interfaces[i];
escaped_printf (out, " <implements name=\"%s\"/>\n",
- g_type_name (itype));
+ g_type_name (itype));
}
g_free (interfaces);
static void
dump_interface_type (GType type, const char *symbol, FILE *out)
{
- guint n_interfaces;
- guint i;
+ unsigned int n_interfaces;
+ unsigned int i;
GType *interfaces;
escaped_printf (out, " <interface name=\"%s\" get-type=\"%s\">\n",
- g_type_name (type), symbol);
+ g_type_name (type), symbol);
interfaces = g_type_interface_prerequisites (type, &n_interfaces);
for (i = 0; i < n_interfaces; i++)
{
GType itype = interfaces[i];
if (itype == G_TYPE_OBJECT)
- {
- /* Treat this as implicit for now; in theory GInterfaces are
- * supported on things like GstMiniObject, but right now
- * the introspection system only supports GObject.
- * http://bugzilla.gnome.org/show_bug.cgi?id=559706
- */
- continue;
- }
+ {
+ /* Treat this as implicit for now; in theory GInterfaces are
+ * supported on things like GstMiniObject, but right now
+ * the introspection system only supports GObject.
+ * http://bugzilla.gnome.org/show_bug.cgi?id=559706
+ */
+ continue;
+ }
escaped_printf (out, " <prerequisite name=\"%s\"/>\n",
- g_type_name (itype));
+ g_type_name (itype));
}
g_free (interfaces);
dump_boxed_type (GType type, const char *symbol, FILE *out)
{
escaped_printf (out, " <boxed name=\"%s\" get-type=\"%s\"/>\n",
- g_type_name (type), symbol);
+ g_type_name (type), symbol);
}
static void
dump_flags_type (GType type, const char *symbol, FILE *out)
{
- guint i;
+ unsigned int i;
GFlagsClass *klass;
klass = g_type_class_ref (type);
escaped_printf (out, " <flags name=\"%s\" get-type=\"%s\">\n",
- g_type_name (type), symbol);
+ g_type_name (type), symbol);
for (i = 0; i < klass->n_values; i++)
{
GFlagsValue *value = &(klass->values[i]);
escaped_printf (out, " <member name=\"%s\" nick=\"%s\" value=\"%u\"/>\n",
- value->value_name, value->value_nick, value->value);
+ value->value_name, value->value_nick, value->value);
}
goutput_write (out, " </flags>\n");
}
static void
dump_enum_type (GType type, const char *symbol, FILE *out)
{
- guint i;
+ unsigned int i;
GEnumClass *klass;
klass = g_type_class_ref (type);
escaped_printf (out, " <enum name=\"%s\" get-type=\"%s\">\n",
- g_type_name (type), symbol);
+ g_type_name (type), symbol);
for (i = 0; i < klass->n_values; i++)
{
GEnumValue *value = &(klass->values[i]);
escaped_printf (out, " <member name=\"%s\" nick=\"%s\" value=\"%d\"/>\n",
- value->value_name, value->value_nick, value->value);
+ value->value_name, value->value_nick, value->value);
}
goutput_write (out, " </enum>");
}
static void
dump_fundamental_type (GType type, const char *symbol, FILE *out)
{
- guint n_interfaces;
- guint i;
+ unsigned int n_interfaces;
+ unsigned int i;
GType *interfaces;
GString *parent_str;
GType parent;
escaped_printf (out, " <fundamental name=\"%s\" get-type=\"%s\"",
- g_type_name (type), symbol);
+ g_type_name (type), symbol);
if (G_TYPE_IS_ABSTRACT (type))
escaped_printf (out, " abstract=\"1\"");
{
GType itype = interfaces[i];
escaped_printf (out, " <implements name=\"%s\"/>\n",
- g_type_name (itype));
+ g_type_name (itype));
}
g_free (interfaces);
goutput_write (out, " </fundamental>\n");
dump_error_quark (GQuark quark, const char *symbol, FILE *out)
{
escaped_printf (out, " <error-quark function=\"%s\" domain=\"%s\"/>\n",
- symbol, g_quark_to_string (quark));
+ symbol, g_quark_to_string (quark));
}
/**
if (!self)
{
g_set_error (error,
- G_FILE_ERROR,
- G_FILE_ERROR_FAILED,
- "failed to open self: %s",
- g_module_error ());
+ G_FILE_ERROR,
+ G_FILE_ERROR_FAILED,
+ "failed to open self: %s",
+ g_module_error ());
return FALSE;
}
while (TRUE)
{
- gsize len;
+ size_t len;
char *line = read_line (input, &len);
const char *function;
type = invoke_get_type (self, argv[i], &error);
if (!type)
- {
- g_printerr ("%s\n", error->message);
- g_clear_error (&error);
- }
+ {
+ g_printerr ("%s\n", error->message);
+ g_clear_error (&error);
+ }
else
- dump_type (type, argv[i], stdout);
+ dump_type (type, argv[i], stdout);
}
return 0;
/**
* gi_arg_info_get_closure_index:
* @info: a #GIArgInfo
+ * @out_closure_index: (out) (optional): return location for the closure index
*
* Obtain the index of the user data argument. This is only valid
* for arguments which are callbacks.
*
- * Returns: Index of the user data argument or `-1` if there is none
+ * Returns: `TRUE` if the argument has a user data argument
* Since: 2.80
*/
-gint
-gi_arg_info_get_closure_index (GIArgInfo *info)
+gboolean
+gi_arg_info_get_closure_index (GIArgInfo *info,
+ unsigned int *out_closure_index)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ArgBlob *blob;
+ gboolean has_closure_index;
- g_return_val_if_fail (info != NULL, -1);
- g_return_val_if_fail (GI_IS_ARG_INFO (info), -1);
+ g_return_val_if_fail (info != NULL, FALSE);
+ g_return_val_if_fail (GI_IS_ARG_INFO (info), FALSE);
blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
- return blob->closure;
+ has_closure_index = (blob->closure >= 0);
+
+ if (out_closure_index != NULL)
+ *out_closure_index = has_closure_index ? blob->closure : 0;
+ return has_closure_index;
}
/**
* gi_arg_info_get_destroy_index:
* @info: a #GIArgInfo
+ * @out_destroy_index: (out) (optional): return location for the destroy index
*
* Obtains the index of the [type@GLib.DestroyNotify] argument. This is only
* valid for arguments which are callbacks.
*
- * Returns: Index of the [type@GLib.DestroyNotify] argument or `-1` if there is
- * none
+ * Returns: `TRUE` if the argument has a [type@GLib.DestroyNotify] argument
* Since: 2.80
*/
-gint
-gi_arg_info_get_destroy_index (GIArgInfo *info)
+gboolean
+gi_arg_info_get_destroy_index (GIArgInfo *info,
+ unsigned int *out_destroy_index)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ArgBlob *blob;
+ gboolean has_destroy_index;
- g_return_val_if_fail (info != NULL, -1);
- g_return_val_if_fail (GI_IS_ARG_INFO (info), -1);
+ g_return_val_if_fail (info != NULL, FALSE);
+ g_return_val_if_fail (GI_IS_ARG_INFO (info), FALSE);
blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset];
- return blob->destroy;
+ has_destroy_index = (blob->destroy >= 0);
+
+ if (out_destroy_index != NULL)
+ *out_destroy_index = has_destroy_index ? blob->destroy : 0;
+ return has_destroy_index;
}
/**
G_BEGIN_DECLS
+#define GI_TYPE_ARG_INFO (gi_arg_info_get_type ())
+
+/**
+ * GI_ARG_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.ArgInfo] or derived pointer into a
+ * `(GIArgInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_ARG_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_ARG_INFO, GIArgInfo))
+
/**
* GI_IS_ARG_INFO:
* @info: an info structure
*
- * Checks if @info is a [class@GIRepository.ArgInfo].
+ * Checks if @info is a [class@GIRepository.ArgInfo] (or a derived type).
*
* Since: 2.80
*/
-#define GI_IS_ARG_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_ARG)
+#define GI_IS_ARG_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_ARG_INFO))
GI_AVAILABLE_IN_ALL
GIScopeType gi_arg_info_get_scope (GIArgInfo *info);
GI_AVAILABLE_IN_ALL
-gint gi_arg_info_get_closure_index (GIArgInfo *info);
+gboolean gi_arg_info_get_closure_index (GIArgInfo *info,
+ unsigned int *out_closure_index);
GI_AVAILABLE_IN_ALL
-gint gi_arg_info_get_destroy_index (GIArgInfo *info);
+gboolean gi_arg_info_get_destroy_index (GIArgInfo *info,
+ unsigned int *out_destroy_index);
GI_AVAILABLE_IN_ALL
GITypeInfo * gi_arg_info_get_type_info (GIArgInfo *info);
void gi_base_info_init_types (void);
GType gi_base_info_type_register_static (const char *type_name,
- gsize instance_size,
- GClassInitFunc class_init);
+ size_t instance_size,
+ GClassInitFunc class_init,
+ GType parent_type,
+ GTypeFlags type_flags);
G_END_DECLS
dst->data[0].v_pointer = NULL;
}
-static gpointer
+static void *
value_base_info_peek_pointer (const GValue *value)
{
return value->data[0].v_pointer;
return NULL;
}
-static gchar *
+static char *
value_base_info_lcopy_value (const GValue *value,
guint n_collect_values,
GTypeCValue *collect_values,
* @type_name: the name of the type
* @instance_size: size (in bytes) of the type’s instance struct
* @class_init: class init function for the type
+ * @parent_type: [type@GObject.Type] for the parent type; this will typically be
+ * `GI_TYPE_BASE_INFO`
+ * @type_flags: flags for the type
*
* Registers a new [type@GIRepository.BaseInfo] type for the given @type_name
* using the type information provided.
*/
GType
gi_base_info_type_register_static (const char *type_name,
- gsize instance_size,
- GClassInitFunc class_init)
+ size_t instance_size,
+ GClassInitFunc class_init,
+ GType parent_type,
+ GTypeFlags type_flags)
{
GTypeInfo info;
info.instance_init = NULL;
info.value_table = NULL;
- return g_type_register_static (GI_TYPE_BASE_INFO, type_name, &info, 0);
+ return g_type_register_static (parent_type, type_name, &info, type_flags);
}
static GType gi_base_info_types[GI_INFO_TYPE_N_TYPES];
GI_DEFINE_BASE_INFO_TYPE (gi_struct_info, GI_INFO_TYPE_STRUCT)
GI_DEFINE_BASE_INFO_TYPE (gi_union_info, GI_INFO_TYPE_UNION)
GI_DEFINE_BASE_INFO_TYPE (gi_enum_info, GI_INFO_TYPE_ENUM)
+GI_DEFINE_BASE_INFO_TYPE (gi_flags_info, GI_INFO_TYPE_FLAGS)
GI_DEFINE_BASE_INFO_TYPE (gi_object_info, GI_INFO_TYPE_OBJECT)
GI_DEFINE_BASE_INFO_TYPE (gi_interface_info, GI_INFO_TYPE_INTERFACE)
+GI_DEFINE_BASE_INFO_TYPE (gi_boxed_info, GI_INFO_TYPE_BOXED)
GI_DEFINE_BASE_INFO_TYPE (gi_constant_info, GI_INFO_TYPE_CONSTANT)
GI_DEFINE_BASE_INFO_TYPE (gi_value_info, GI_INFO_TYPE_VALUE)
GI_DEFINE_BASE_INFO_TYPE (gi_signal_info, GI_INFO_TYPE_SIGNAL)
void
gi_base_info_init_types (void)
{
- static gsize register_types_once = 0;
+ static size_t register_types_once = 0;
if (g_once_init_enter (®ister_types_once))
{
{
GIInfoType info_type;
const char *type_name;
- gsize instance_size;
+ size_t instance_size;
GClassInitFunc class_init;
+ GIInfoType parent_info_type; /* 0 for GIBaseInfo */
+ GTypeFlags type_flags;
}
types[] =
{
- { GI_INFO_TYPE_CALLABLE, "GICallableInfo", sizeof (GICallableInfo), gi_callable_info_class_init },
- { GI_INFO_TYPE_FUNCTION, "GIFunctionInfo", sizeof (GIFunctionInfo), gi_function_info_class_init },
- { GI_INFO_TYPE_CALLBACK, "GICallbackInfo", sizeof (GICallbackInfo), gi_callback_info_class_init },
- { GI_INFO_TYPE_REGISTERED_TYPE, "GIRegisteredTypeInfo", sizeof (GIRegisteredTypeInfo), gi_registered_type_info_class_init },
- { GI_INFO_TYPE_STRUCT, "GIStructInfo", sizeof (GIStructInfo), gi_struct_info_class_init },
- { GI_INFO_TYPE_UNION, "GIUnionInfo", sizeof (GIUnionInfo), gi_union_info_class_init },
- { GI_INFO_TYPE_ENUM, "GIEnumInfo", sizeof (GIEnumInfo), gi_enum_info_class_init },
- { GI_INFO_TYPE_OBJECT, "GIObjectInfo", sizeof (GIObjectInfo), gi_object_info_class_init },
- { GI_INFO_TYPE_INTERFACE, "GIInterfaceInfo", sizeof (GIInterfaceInfo), gi_interface_info_class_init },
- { GI_INFO_TYPE_CONSTANT, "GIConstantInfo", sizeof (GIConstantInfo), gi_constant_info_class_init },
- { GI_INFO_TYPE_VALUE, "GIValueInfo", sizeof (GIValueInfo), gi_value_info_class_init },
- { GI_INFO_TYPE_SIGNAL, "GISignalInfo", sizeof (GISignalInfo), gi_signal_info_class_init },
- { GI_INFO_TYPE_VFUNC, "GIVFuncInfo", sizeof (GIVFuncInfo), gi_vfunc_info_class_init },
- { GI_INFO_TYPE_PROPERTY, "GIPropertyInfo", sizeof (GIPropertyInfo), gi_property_info_class_init },
- { GI_INFO_TYPE_FIELD, "GIFieldInfo", sizeof (GIFieldInfo), gi_field_info_class_init },
- { GI_INFO_TYPE_ARG, "GIArgInfo", sizeof (GIArgInfo), gi_arg_info_class_init },
- { GI_INFO_TYPE_TYPE, "GITypeInfo", sizeof (GITypeInfo), gi_type_info_class_init },
- { GI_INFO_TYPE_UNRESOLVED, "GIUnresolvedInfo", sizeof (GIUnresolvedInfo), gi_unresolved_info_class_init },
+ { GI_INFO_TYPE_CALLABLE, "GICallableInfo", sizeof (GICallableInfo), gi_callable_info_class_init, 0, G_TYPE_FLAG_ABSTRACT },
+ { GI_INFO_TYPE_FUNCTION, "GIFunctionInfo", sizeof (GIFunctionInfo), gi_function_info_class_init, GI_INFO_TYPE_CALLABLE, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_CALLBACK, "GICallbackInfo", sizeof (GICallbackInfo), gi_callback_info_class_init, GI_INFO_TYPE_CALLABLE, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_REGISTERED_TYPE, "GIRegisteredTypeInfo", sizeof (GIRegisteredTypeInfo), gi_registered_type_info_class_init, 0, G_TYPE_FLAG_ABSTRACT },
+ { GI_INFO_TYPE_STRUCT, "GIStructInfo", sizeof (GIStructInfo), gi_struct_info_class_init, GI_INFO_TYPE_REGISTERED_TYPE, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_UNION, "GIUnionInfo", sizeof (GIUnionInfo), gi_union_info_class_init, GI_INFO_TYPE_REGISTERED_TYPE, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_ENUM, "GIEnumInfo", sizeof (GIEnumInfo), gi_enum_info_class_init, GI_INFO_TYPE_REGISTERED_TYPE, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_FLAGS, "GIFlagsInfo", sizeof (GIFlagsInfo), gi_flags_info_class_init, GI_INFO_TYPE_ENUM, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_OBJECT, "GIObjectInfo", sizeof (GIObjectInfo), gi_object_info_class_init, GI_INFO_TYPE_REGISTERED_TYPE, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_INTERFACE, "GIInterfaceInfo", sizeof (GIInterfaceInfo), gi_interface_info_class_init, GI_INFO_TYPE_REGISTERED_TYPE, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_BOXED, "GIBoxedInfo", sizeof (GIBoxedInfo), gi_boxed_info_class_init, GI_INFO_TYPE_REGISTERED_TYPE, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_CONSTANT, "GIConstantInfo", sizeof (GIConstantInfo), gi_constant_info_class_init, 0, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_VALUE, "GIValueInfo", sizeof (GIValueInfo), gi_value_info_class_init, 0, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_SIGNAL, "GISignalInfo", sizeof (GISignalInfo), gi_signal_info_class_init, GI_INFO_TYPE_CALLABLE, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_VFUNC, "GIVFuncInfo", sizeof (GIVFuncInfo), gi_vfunc_info_class_init, GI_INFO_TYPE_CALLABLE, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_PROPERTY, "GIPropertyInfo", sizeof (GIPropertyInfo), gi_property_info_class_init, 0, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_FIELD, "GIFieldInfo", sizeof (GIFieldInfo), gi_field_info_class_init, 0, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_ARG, "GIArgInfo", sizeof (GIArgInfo), gi_arg_info_class_init, 0, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_TYPE, "GITypeInfo", sizeof (GITypeInfo), gi_type_info_class_init, 0, G_TYPE_FLAG_NONE },
+ { GI_INFO_TYPE_UNRESOLVED, "GIUnresolvedInfo", sizeof (GIUnresolvedInfo), gi_unresolved_info_class_init, 0, G_TYPE_FLAG_NONE },
};
- for (gsize i = 0; i < G_N_ELEMENTS (types); i++)
+ for (size_t i = 0; i < G_N_ELEMENTS (types); i++)
{
- GType registered_type = gi_base_info_type_register_static (g_intern_static_string (types[i].type_name),
- types[i].instance_size,
- types[i].class_init);
+ GType registered_type, parent_type;
+
+ parent_type = (types[i].parent_info_type == 0) ? GI_TYPE_BASE_INFO : gi_base_info_types[types[i].parent_info_type];
+ g_assert (parent_type != G_TYPE_INVALID);
+
+ registered_type = gi_base_info_type_register_static (g_intern_static_string (types[i].type_name),
+ types[i].instance_size,
+ types[i].class_init,
+ parent_type,
+ types[i].type_flags);
gi_base_info_types[types[i].info_type] = registered_type;
}
GIRepository *repository,
GIBaseInfo *container,
GITypelib *typelib,
- guint32 offset)
+ uint32_t offset)
{
GIRealInfo *info;
g_return_val_if_fail (container != NULL || repository != NULL, NULL);
g_return_val_if_fail (GI_IS_REPOSITORY (repository), NULL);
+ g_return_val_if_fail (offset <= G_MAXUINT32, NULL);
gi_base_info_init_types ();
g_assert (gi_base_info_types[type] != G_TYPE_INVALID);
gi_info_new (GIInfoType type,
GIBaseInfo *container,
GITypelib *typelib,
- guint32 offset)
+ size_t offset)
{
return gi_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset);
}
GIRepository *repository,
GIBaseInfo *container,
GITypelib *typelib,
- guint32 offset)
+ uint32_t offset)
{
memset (info, 0, sizeof (GIRealInfo));
GIBaseInfo *
gi_info_from_entry (GIRepository *repository,
GITypelib *typelib,
- guint16 index)
+ uint16_t index)
{
GIBaseInfo *result;
DirEntry *entry = gi_typelib_get_dir_entry (typelib, index);
result = gi_info_new_full (entry->blob_type, repository, NULL, typelib, entry->offset);
else
{
- const gchar *namespace = gi_typelib_get_string (typelib, entry->offset);
- const gchar *name = gi_typelib_get_string (typelib, entry->name);
+ const char *namespace = gi_typelib_get_string (typelib, entry->offset);
+ const char *name = gi_typelib_get_string (typelib, entry->name);
result = gi_repository_find_by_name (repository, namespace, name);
if (result == NULL)
unresolved->namespace = namespace;
return (GIBaseInfo *)unresolved;
- }
+ }
return (GIBaseInfo *)result;
}
GITypeInfo *
gi_type_info_new (GIBaseInfo *container,
GITypelib *typelib,
- guint32 offset)
+ uint32_t offset)
{
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
gi_type_info_init (GIBaseInfo *info,
GIBaseInfo *container,
GITypelib *typelib,
- guint32 offset)
+ uint32_t offset)
{
GIRealInfo *rinfo = (GIRealInfo*)container;
SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
/**
* gi_base_info_ref:
- * @info: a #GIBaseInfo
+ * @info: (type GIRepository.BaseInfo): a #GIBaseInfo
*
* Increases the reference count of @info.
*
* Since: 2.80
*/
GIBaseInfo *
-gi_base_info_ref (GIBaseInfo *info)
+gi_base_info_ref (void *info)
{
GIRealInfo *rinfo = (GIRealInfo*)info;
+ g_return_val_if_fail (GI_IS_BASE_INFO (info), NULL);
+
g_assert (rinfo->ref_count != INVALID_REFCOUNT);
g_atomic_ref_count_inc (&rinfo->ref_count);
/**
* gi_base_info_unref:
- * @info: (transfer full): a #GIBaseInfo
+ * @info: (type GIRepository.BaseInfo) (transfer full): a #GIBaseInfo
*
* Decreases the reference count of @info. When its reference count
* drops to 0, the info is freed.
* Since: 2.80
*/
void
-gi_base_info_unref (GIBaseInfo *info)
+gi_base_info_unref (void *info)
{
GIRealInfo *rinfo = (GIRealInfo*)info;
+ g_return_if_fail (GI_IS_BASE_INFO (info));
+
g_assert (rinfo->ref_count > 0 && rinfo->ref_count != INVALID_REFCOUNT);
if (g_atomic_ref_count_dec (&rinfo->ref_count))
* Returns: (nullable): the name of @info or `NULL` if it lacks a name.
* Since: 2.80
*/
-const gchar *
+const char *
gi_base_info_get_name (GIBaseInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo*)info;
case GI_INFO_TYPE_OBJECT:
case GI_INFO_TYPE_INTERFACE:
case GI_INFO_TYPE_CONSTANT:
- case GI_INFO_TYPE_INVALID_0:
case GI_INFO_TYPE_UNION:
{
CommonBlob *blob = (CommonBlob *)&rinfo->typelib->data[rinfo->offset];
* Returns: the namespace
* Since: 2.80
*/
-const gchar *
+const char *
gi_base_info_get_namespace (GIBaseInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo*) info;
case GI_INFO_TYPE_OBJECT:
case GI_INFO_TYPE_INTERFACE:
case GI_INFO_TYPE_CONSTANT:
- case GI_INFO_TYPE_INVALID_0:
{
CommonBlob *blob = (CommonBlob *)&rinfo->typelib->data[rinfo->offset];
* attribute exists
* Since: 2.80
*/
-const gchar *
+const char *
gi_base_info_get_attribute (GIBaseInfo *info,
- const gchar *name)
+ const char *name)
{
- GIAttributeIter iter = { 0, };
+ GIAttributeIter iter = GI_ATTRIBUTE_ITER_INIT;
const char *curname, *curvalue;
while (gi_base_info_iterate_attributes (info, &iter, &curname, &curvalue))
{
if (strcmp (name, curname) == 0)
- return (const gchar*) curvalue;
+ return (const char *) curvalue;
}
return NULL;
*/
AttributeBlob *
_attribute_blob_find_first (GIBaseInfo *info,
- guint32 blob_offset)
+ uint32_t blob_offset)
{
GIRealInfo *rinfo = (GIRealInfo *) info;
Header *header = (Header *)rinfo->typelib->data;
* void
* print_attributes (GIBaseInfo *info)
* {
- * GIAttributeIter iter = { 0, };
+ * GIAttributeIter iter = GI_ATTRIBUTE_ITER_INIT;
* const char *name;
* const char *value;
* while (gi_base_info_iterate_attributes (info, &iter, &name, &value))
gboolean
gi_base_info_iterate_attributes (GIBaseInfo *info,
GIAttributeIter *iterator,
- const gchar **name,
- const gchar **value)
+ const char **name,
+ const char **value)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
*/
typedef struct {
/*< private >*/
- gpointer data;
- gpointer data2;
- gpointer data3;
- gpointer data4;
+ void *data;
+ void *_dummy[4];
} GIAttributeIter;
-#define GI_TYPE_BASE_INFO (gi_base_info_get_type ())
+/**
+ * GI_ATTRIBUTE_ITER_INIT:
+ *
+ * Initialise a stack-allocated [type@GIRepository.AttributeIter] to a value
+ * suitable for passing to the first call to an ‘iterate’ function.
+ *
+ * Since: 2.80
+ */
+#define GI_ATTRIBUTE_ITER_INIT { NULL, { NULL, } }
+
+#define GI_TYPE_BASE_INFO (gi_base_info_get_type ())
+
+/**
+ * GI_BASE_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.BaseInfo] or derived pointer into a
+ * `(GIBaseInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_BASE_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_BASE_INFO, GIBaseInfo))
+/**
+ * GI_IS_BASE_INFO:
+ * @info: Instance to check for being a `GI_TYPE_BASE_INFO`.
+ *
+ * Checks whether a valid [type@GObject.TypeInstance] pointer is of type
+ * `GI_TYPE_BASE_INFO` (or a derived type).
+ *
+ * Since: 2.80
+ */
+#define GI_IS_BASE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_BASE_INFO))
GI_AVAILABLE_IN_ALL
GType gi_base_info_get_type (void) G_GNUC_CONST;
GI_AVAILABLE_IN_ALL
-GIBaseInfo * gi_base_info_ref (GIBaseInfo *info);
+GIBaseInfo * gi_base_info_ref (void *info);
GI_AVAILABLE_IN_ALL
-void gi_base_info_unref (GIBaseInfo *info);
+void gi_base_info_unref (void *info);
GI_AVAILABLE_IN_ALL
GIInfoType gi_base_info_get_info_type (GIBaseInfo *info);
GI_AVAILABLE_IN_ALL
-const gchar * gi_base_info_get_name (GIBaseInfo *info);
+const char * gi_base_info_get_name (GIBaseInfo *info);
GI_AVAILABLE_IN_ALL
-const gchar * gi_base_info_get_namespace (GIBaseInfo *info);
+const char * gi_base_info_get_namespace (GIBaseInfo *info);
GI_AVAILABLE_IN_ALL
gboolean gi_base_info_is_deprecated (GIBaseInfo *info);
GI_AVAILABLE_IN_ALL
-const gchar * gi_base_info_get_attribute (GIBaseInfo *info,
- const gchar *name);
+const char * gi_base_info_get_attribute (GIBaseInfo *info,
+ const char *name);
GI_AVAILABLE_IN_ALL
gboolean gi_base_info_iterate_attributes (GIBaseInfo *info,
GIBaseInfo * gi_info_new (GIInfoType type,
GIBaseInfo *container,
GITypelib *typelib,
- guint32 offset);
+ size_t offset);
G_END_DECLS
--- /dev/null
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ * GObject introspection: Boxed type implementation
+ *
+ * Copyright 2024 GNOME Foundation, Inc.
+ *
+ * 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 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+
+#include <girepository/girepository.h>
+#include "gibaseinfo-private.h"
+#include "girepository-private.h"
+#include "gitypelib-internal.h"
+#include "giboxedinfo.h"
+
+/**
+ * GIBoxedInfo:
+ *
+ * A `GIBoxedInfo` represents a boxed type.
+ *
+ * There isn’t much you can do with a boxed type; `GIBoxedInfo` exists mainly to
+ * tag the type.
+ *
+ * Since: 2.80
+ */
+
+void
+gi_boxed_info_class_init (gpointer g_class,
+ gpointer class_data)
+{
+ GIBaseInfoClass *info_class = g_class;
+
+ info_class->info_type = GI_INFO_TYPE_BOXED;
+}
--- /dev/null
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ * GObject introspection: Boxed types
+ *
+ * Copyright 2024 GNOME Foundation, Inc.
+ *
+ * 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 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
+#error "Only <girepository.h> can be included directly."
+#endif
+
+#include <girepository/gitypes.h>
+
+G_BEGIN_DECLS
+
+#define GI_TYPE_BOXED_INFO (gi_boxed_info_get_type ())
+
+/**
+ * GI_BOXED_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.BoxedInfo] or derived pointer into a
+ * `(GIBoxedInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_BOXED_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_BOXED_INFO, GIBoxedInfo))
+
+/**
+ * GI_IS_BOXED_INFO:
+ * @info: an info structure
+ *
+ * Checks if @info is a [class@GIRepository.BoxedInfo] (or a derived type).
+ *
+ * Since: 2.80
+ */
+#define GI_IS_BOXED_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_BOXED_INFO))
+
+G_END_DECLS
* Since: 2.80
*/
-static guint32
+static uint32_t
signature_offset (GICallableInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo*)info;
g_assert_not_reached ();
}
if (sigoff >= 0)
- return *(guint32 *)&rinfo->typelib->data[rinfo->offset + sigoff];
+ return *(uint32_t *)&rinfo->typelib->data[rinfo->offset + sigoff];
return 0;
}
gi_callable_info_get_return_type (GICallableInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
- guint32 offset;
+ uint32_t offset;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), NULL);
GITypeInfo *type)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
- guint32 offset;
+ uint32_t offset;
g_return_if_fail (info != NULL);
g_return_if_fail (GI_IS_CALLABLE_INFO (info));
* Returns: The number of arguments this callable expects.
* Since: 2.80
*/
-guint
+unsigned int
gi_callable_info_get_n_args (GICallableInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
- gint offset;
+ uint32_t offset;
SignatureBlob *blob;
g_return_val_if_fail (info != NULL, -1);
*/
GIArgInfo *
gi_callable_info_get_arg (GICallableInfo *info,
- guint n)
+ unsigned int n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
- gint offset;
+ uint32_t offset;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
offset = signature_offset (info);
header = (Header *)rinfo->typelib->data;
*/
void
gi_callable_info_load_arg (GICallableInfo *info,
- guint n,
+ unsigned int n,
GIArgInfo *arg)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
- gint offset;
+ uint32_t offset;
g_return_if_fail (info != NULL);
g_return_if_fail (GI_IS_CALLABLE_INFO (info));
+ g_return_if_fail (n <= G_MAXUINT16);
offset = signature_offset (info);
header = (Header *)rinfo->typelib->data;
* attribute exists
* Since: 2.80
*/
-const gchar *
+const char *
gi_callable_info_get_return_attribute (GICallableInfo *info,
- const gchar *name)
+ const char *name)
{
- GIAttributeIter iter = { 0, };
+ GIAttributeIter iter = GI_ATTRIBUTE_ITER_INIT;
const char *curname, *curvalue;
while (gi_callable_info_iterate_return_attributes (info, &iter, &curname, &curvalue))
{
if (g_strcmp0 (name, curname) == 0)
- return (const gchar*) curvalue;
+ return (const char*) curvalue;
}
return NULL;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
AttributeBlob *next, *after;
- guint32 blob_offset;
+ uint32_t blob_offset;
after = (AttributeBlob *) &rinfo->typelib->data[header->attributes +
header->n_attributes * header->attribute_blob_size];
{
switch (return_tag) {
case GI_TYPE_TAG_INT8:
- arg->v_int8 = (gint8) ffi_value->v_long;
+ arg->v_int8 = (int8_t) ffi_value->v_long;
break;
case GI_TYPE_TAG_UINT8:
- arg->v_uint8 = (guint8) ffi_value->v_ulong;
+ arg->v_uint8 = (uint8_t) ffi_value->v_ulong;
break;
case GI_TYPE_TAG_INT16:
- arg->v_int16 = (gint16) ffi_value->v_long;
+ arg->v_int16 = (int16_t) ffi_value->v_long;
break;
case GI_TYPE_TAG_UINT16:
- arg->v_uint16 = (guint16) ffi_value->v_ulong;
+ arg->v_uint16 = (uint16_t) ffi_value->v_ulong;
break;
case GI_TYPE_TAG_INT32:
- arg->v_int32 = (gint32) ffi_value->v_long;
+ arg->v_int32 = (int32_t) ffi_value->v_long;
break;
case GI_TYPE_TAG_UINT32:
case GI_TYPE_TAG_BOOLEAN:
case GI_TYPE_TAG_UNICHAR:
- arg->v_uint32 = (guint32) ffi_value->v_ulong;
+ arg->v_uint32 = (uint32_t) ffi_value->v_ulong;
break;
case GI_TYPE_TAG_INT64:
- arg->v_int64 = (gint64) ffi_value->v_int64;
+ arg->v_int64 = (int64_t) ffi_value->v_int64;
break;
case GI_TYPE_TAG_UINT64:
- arg->v_uint64 = (guint64) ffi_value->v_uint64;
+ arg->v_uint64 = (uint64_t) ffi_value->v_uint64;
break;
case GI_TYPE_TAG_FLOAT:
arg->v_float = ffi_value->v_float;
switch(interface_type) {
case GI_INFO_TYPE_ENUM:
case GI_INFO_TYPE_FLAGS:
- arg->v_int32 = (gint32) ffi_value->v_long;
+ arg->v_int32 = (int32_t) ffi_value->v_long;
break;
default:
- arg->v_pointer = (gpointer) ffi_value->v_pointer;
+ arg->v_pointer = (void *) ffi_value->v_pointer;
break;
}
break;
default:
- arg->v_pointer = (gpointer) ffi_value->v_pointer;
+ arg->v_pointer = (void *) ffi_value->v_pointer;
break;
}
}
* @return_value: (out caller-allocates) (not optional) (nullable): return
* location for the return value from the callable; `NULL` may be returned if
* the callable returns that
- * @is_method: `TRUE` if @info is a method
- * @throws: `TRUE` if @info may throw a [type@GLib.Error]
* @error: return location for a [type@GLib.Error], or `NULL`
*
* Invoke the given `GICallableInfo` by calling the given @function pointer.
*
* The set of arguments passed to @function will be constructed according to the
- * introspected type of the `GICallableInfo`, using @in_args, @out_args,
- * @is_method, @throws and @error.
+ * introspected type of the `GICallableInfo`, using @in_args, @out_args
+ * and @error.
*
* Returns: `TRUE` if the callable was executed successfully and didn’t throw
* a [type@GLib.Error]; `FALSE` if @error is set
*/
gboolean
gi_callable_info_invoke (GICallableInfo *info,
- gpointer function,
+ void *function,
const GIArgument *in_args,
- gsize n_in_args,
- const GIArgument *out_args,
- gsize n_out_args,
+ size_t n_in_args,
+ GIArgument *out_args,
+ size_t n_out_args,
GIArgument *return_value,
- gboolean is_method,
- gboolean throws,
GError **error)
{
ffi_cif cif;
GITypeInfo *rinfo;
GITypeTag rtag;
GIArgInfo *ainfo;
- gsize n_args, n_invoke_args, in_pos, out_pos, i;
- gpointer *args;
+ size_t n_args, n_invoke_args, in_pos, out_pos, i;
+ void **args;
gboolean success = FALSE;
GError *local_error = NULL;
- gpointer error_address = &local_error;
+ void *error_address = &local_error;
GIFFIReturnValue ffi_return_value;
- gpointer return_value_p; /* Will point inside the union return_value */
+ void *return_value_p; /* Will point inside the union return_value */
+ gboolean is_method, throws;
rinfo = gi_callable_info_get_return_type ((GICallableInfo *)info);
rtype = gi_type_info_get_ffi_type (rinfo);
rtag = gi_type_info_get_tag(rinfo);
+ is_method = gi_callable_info_is_method (info);
+ throws = gi_callable_info_can_throw_gerror (info);
in_pos = 0;
out_pos = 0;
n_invoke_args ++;
atypes = g_alloca (sizeof (ffi_type*) * n_invoke_args);
- args = g_alloca (sizeof (gpointer) * n_invoke_args);
+ args = g_alloca (sizeof (void *) * n_invoke_args);
if (is_method)
{
atypes[0] = &ffi_type_pointer;
- args[0] = (gpointer) &in_args[0];
+ args[0] = (void *) &in_args[0];
}
for (i = 0; i < n_args; i++)
{
goto out;
}
- args[i+offset] = (gpointer)&in_args[in_pos];
+ args[i+offset] = (void *)&in_args[in_pos];
in_pos++;
break;
goto out;
}
- args[i+offset] = (gpointer)&out_args[out_pos];
+ args[i+offset] = (void *)&out_args[out_pos];
out_pos++;
break;
case GI_DIRECTION_INOUT:
goto out;
}
- args[i+offset] = (gpointer)&in_args[in_pos];
+ args[i+offset] = (void *)&in_args[in_pos];
in_pos++;
out_pos++;
break;
G_BEGIN_DECLS
+#define GI_TYPE_CALLABLE_INFO (gi_callable_info_get_type ())
+
+/**
+ * GI_CALLABLE_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.CallableInfo] or derived pointer into a
+ * `(GICallableInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_CALLABLE_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_CALLABLE_INFO, GICallableInfo))
+
/**
* GI_IS_CALLABLE_INFO:
* @info: an info structure
*
* Since: 2.80
*/
-#define GI_IS_CALLABLE_INFO(info) \
- ((gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FUNCTION) || \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CALLBACK) || \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_SIGNAL) || \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_VFUNC))
+#define GI_IS_CALLABLE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_CALLABLE_INFO))
GI_AVAILABLE_IN_ALL
GITypeInfo *type);
GI_AVAILABLE_IN_ALL
-const gchar * gi_callable_info_get_return_attribute (GICallableInfo *info,
- const gchar *name);
+const char * gi_callable_info_get_return_attribute (GICallableInfo *info,
+ const char *name);
GI_AVAILABLE_IN_ALL
gboolean gi_callable_info_iterate_return_attributes (GICallableInfo *info,
gboolean gi_callable_info_skip_return (GICallableInfo *info);
GI_AVAILABLE_IN_ALL
-guint gi_callable_info_get_n_args (GICallableInfo *info);
+unsigned int gi_callable_info_get_n_args (GICallableInfo *info);
GI_AVAILABLE_IN_ALL
GIArgInfo * gi_callable_info_get_arg (GICallableInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
void gi_callable_info_load_arg (GICallableInfo *info,
- guint n,
+ unsigned int n,
GIArgInfo *arg);
GI_AVAILABLE_IN_ALL
gboolean gi_callable_info_invoke (GICallableInfo *info,
- gpointer function,
+ void *function,
const GIArgument *in_args,
- gsize n_in_args,
- const GIArgument *out_args,
- gsize n_out_args,
+ size_t n_in_args,
+ GIArgument *out_args,
+ size_t n_out_args,
GIArgument *return_value,
- gboolean is_method,
- gboolean throws,
GError **error);
GI_AVAILABLE_IN_ALL
G_BEGIN_DECLS
+#define GI_TYPE_CALLBACK_INFO (gi_callback_info_get_type ())
+
+/**
+ * GI_CALLBACK_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.CallbackInfo] or derived pointer into a
+ * `(GICallbackInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_CALLBACK_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_CALLBACK_INFO, GICallbackInfo))
+
/**
* GI_IS_CALLBACK_INFO:
* @info: an info structure
*
* Since: 2.80
*/
-#define GI_IS_CALLBACK_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CALLBACK)
+#define GI_IS_CALLBACK_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_CALLBACK_INFO))
G_END_DECLS
* Returns: size of the constant, in bytes
* Since: 2.80
*/
-gsize
+size_t
gi_constant_info_get_value (GIConstantInfo *info,
GIArgument *value)
{
{
if (blob->type.flags.pointer)
{
- gsize blob_size = blob->size;
+ size_t blob_size = blob->size;
- value->v_pointer = g_memdup2 (&rinfo->typelib->data[blob->offset], blob_size);
+ value->v_pointer = g_memdup2 (&rinfo->typelib->data[blob->offset], blob_size);
}
else
- {
- switch (blob->type.flags.tag)
- {
- case GI_TYPE_TAG_BOOLEAN:
- value->v_boolean = *(gboolean*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_INT8:
- value->v_int8 = *(gint8*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_UINT8:
- value->v_uint8 = *(guint8*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_INT16:
- value->v_int16 = *(gint16*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_UINT16:
- value->v_uint16 = *(guint16*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_INT32:
- value->v_int32 = *(gint32*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_UINT32:
- value->v_uint32 = *(guint32*)&rinfo->typelib->data[blob->offset];
- break;
- case GI_TYPE_TAG_INT64:
- DO_ALIGNED_COPY(&value->v_int64, &rinfo->typelib->data[blob->offset], gint64);
- break;
- case GI_TYPE_TAG_UINT64:
- DO_ALIGNED_COPY(&value->v_uint64, &rinfo->typelib->data[blob->offset], guint64);
- break;
- case GI_TYPE_TAG_FLOAT:
- DO_ALIGNED_COPY(&value->v_float, &rinfo->typelib->data[blob->offset], gfloat);
- break;
- case GI_TYPE_TAG_DOUBLE:
- DO_ALIGNED_COPY(&value->v_double, &rinfo->typelib->data[blob->offset], gdouble);
- break;
- default:
- g_assert_not_reached ();
- }
- }
+ {
+ switch (blob->type.flags.tag)
+ {
+ case GI_TYPE_TAG_BOOLEAN:
+ value->v_boolean = *(gboolean*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_INT8:
+ value->v_int8 = *(int8_t*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_UINT8:
+ value->v_uint8 = *(uint8_t*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_INT16:
+ value->v_int16 = *(int16_t*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_UINT16:
+ value->v_uint16 = *(uint16_t*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_INT32:
+ value->v_int32 = *(int32_t*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_UINT32:
+ value->v_uint32 = *(uint32_t*)&rinfo->typelib->data[blob->offset];
+ break;
+ case GI_TYPE_TAG_INT64:
+ DO_ALIGNED_COPY (&value->v_int64, &rinfo->typelib->data[blob->offset], int64_t);
+ break;
+ case GI_TYPE_TAG_UINT64:
+ DO_ALIGNED_COPY (&value->v_uint64, &rinfo->typelib->data[blob->offset], uint64_t);
+ break;
+ case GI_TYPE_TAG_FLOAT:
+ DO_ALIGNED_COPY (&value->v_float, &rinfo->typelib->data[blob->offset], float);
+ break;
+ case GI_TYPE_TAG_DOUBLE:
+ DO_ALIGNED_COPY (&value->v_double, &rinfo->typelib->data[blob->offset], double);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ }
}
return blob->size;
G_BEGIN_DECLS
+#define GI_TYPE_CONSTANT_INFO (gi_constant_info_get_type ())
+
+/**
+ * GI_CONSTANT_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.ConstantInfo] or derived pointer into a
+ * `(GIConstantInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_CONSTANT_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_CONSTANT_INFO, GIConstantInfo))
+
/**
* GI_IS_CONSTANT_INFO:
* @info: an info structure
*
- * Checks if @info is a [class@GIRepository.ConstantInfo].
+ * Checks if @info is a [class@GIRepository.ConstantInfo] (or a derived type).
*
* Since: 2.80
*/
-#define GI_IS_CONSTANT_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_CONSTANT)
+#define GI_IS_CONSTANT_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_CONSTANT_INFO))
GI_AVAILABLE_IN_ALL
GIArgument *value);
GI_AVAILABLE_IN_ALL
-gsize gi_constant_info_get_value (GIConstantInfo *info,
+size_t gi_constant_info_get_value (GIConstantInfo *info,
GIArgument *value);
G_END_DECLS
* Returns: the number of enumeration values
* Since: 2.80
*/
-guint
+unsigned int
gi_enum_info_get_n_values (GIEnumInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
* associated with this enum, or `NULL`.
* Since: 2.80
*/
-const gchar *
+const char *
gi_enum_info_get_error_domain (GIEnumInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIValueInfo *
gi_enum_info_get_value (GIEnumInfo *info,
- guint n)
+ unsigned int n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
- gint offset;
+ size_t offset;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_ENUM_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
header = (Header *)rinfo->typelib->data;
offset = rinfo->offset + header->enum_blob_size
* Returns: number of methods
* Since: 2.80
*/
-guint
+unsigned int
gi_enum_info_get_n_methods (GIEnumInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIFunctionInfo *
gi_enum_info_get_method (GIEnumInfo *info,
- guint n)
+ unsigned int n)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
EnumBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_ENUM_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
header = (Header *)rinfo->typelib->data;
blob = (EnumBlob *)&rinfo->typelib->data[rinfo->offset];
info_class->info_type = GI_INFO_TYPE_ENUM;
}
-
-/**
- * GIValueInfo:
- *
- * A `GIValueInfo` represents a value in an enumeration.
- *
- * The `GIValueInfo` is fetched by calling
- * [method@GIRepository.EnumInfo.get_value] on a [class@GIRepository.EnumInfo].
- *
- * Since: 2.80
- */
-
-/**
- * gi_value_info_get_value:
- * @info: a #GIValueInfo
- *
- * Obtain the enumeration value of the `GIValueInfo`.
- *
- * Returns: the enumeration value. This will always be representable
- * as a 32-bit signed or unsigned value. The use of `gint64` as the
- * return type is to allow both.
- * Since: 2.80
- */
-gint64
-gi_value_info_get_value (GIValueInfo *info)
-{
- GIRealInfo *rinfo = (GIRealInfo *)info;
- ValueBlob *blob;
-
- g_return_val_if_fail (info != NULL, -1);
- g_return_val_if_fail (GI_IS_VALUE_INFO (info), -1);
-
- blob = (ValueBlob *)&rinfo->typelib->data[rinfo->offset];
-
- if (blob->unsigned_value)
- return (gint64)(guint32)blob->value;
- else
- return (gint64)blob->value;
-}
-
-void
-gi_value_info_class_init (gpointer g_class,
- gpointer class_data)
-{
- GIBaseInfoClass *info_class = g_class;
-
- info_class->info_type = GI_INFO_TYPE_VALUE;
-}
G_BEGIN_DECLS
+#define GI_TYPE_ENUM_INFO (gi_enum_info_get_type ())
+
/**
- * GI_IS_ENUM_INFO:
- * @info: an info structure
+ * GI_ENUM_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.EnumInfo] or derived pointer into a
+ * `(GIEnumInfo*)` pointer.
*
- * Checks if @info is a [class@GIRepository.EnumInfo].
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
*
* Since: 2.80
*/
-#define GI_IS_ENUM_INFO(info) \
- ((gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_ENUM) || \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FLAGS))
+#define GI_ENUM_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_ENUM_INFO, GIEnumInfo))
/**
- * GI_IS_VALUE_INFO:
+ * GI_IS_ENUM_INFO:
* @info: an info structure
*
- * Checks if @info is a [class@GIRepository.ValueInfo].
+ * Checks if @info is a [class@GIRepository.EnumInfo] (or a derived type).
*
* Since: 2.80
*/
-#define GI_IS_VALUE_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_VALUE)
+#define GI_IS_ENUM_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_ENUM_INFO))
GI_AVAILABLE_IN_ALL
-guint gi_enum_info_get_n_values (GIEnumInfo *info);
+unsigned int gi_enum_info_get_n_values (GIEnumInfo *info);
GI_AVAILABLE_IN_ALL
-GIValueInfo * gi_enum_info_get_value (GIEnumInfo *info,
- guint n);
+GIValueInfo * gi_enum_info_get_value (GIEnumInfo *info,
+ unsigned int n);
GI_AVAILABLE_IN_ALL
-guint gi_enum_info_get_n_methods (GIEnumInfo *info);
+unsigned int gi_enum_info_get_n_methods (GIEnumInfo *info);
GI_AVAILABLE_IN_ALL
-GIFunctionInfo * gi_enum_info_get_method (GIEnumInfo *info,
- guint n);
+GIFunctionInfo * gi_enum_info_get_method (GIEnumInfo *info,
+ unsigned int n);
GI_AVAILABLE_IN_ALL
GITypeTag gi_enum_info_get_storage_type (GIEnumInfo *info);
GI_AVAILABLE_IN_ALL
-const gchar * gi_enum_info_get_error_domain (GIEnumInfo *info);
-
-
-GI_AVAILABLE_IN_ALL
-gint64 gi_value_info_get_value (GIValueInfo *info);
+const char * gi_enum_info_get_error_domain (GIEnumInfo *info);
G_END_DECLS
* Returns: the field size, in bits
* Since: 2.80
*/
-gsize
+size_t
gi_field_info_get_size (GIFieldInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
* Returns: the field offset, in bytes
* Since: 2.80
*/
-gsize
+size_t
gi_field_info_get_offset (GIFieldInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
gboolean
gi_field_info_get_field (GIFieldInfo *field_info,
- gpointer mem,
+ void *mem,
GIArgument *value)
{
int offset;
if (gi_type_info_is_pointer (type_info))
{
- value->v_pointer = G_STRUCT_MEMBER (gpointer, mem, offset);
+ value->v_pointer = G_STRUCT_MEMBER (void *, mem, offset);
result = TRUE;
}
else
{
switch (gi_type_info_get_tag (type_info))
- {
- case GI_TYPE_TAG_VOID:
- g_warning("Field %s: should not be have void type",
- gi_base_info_get_name ((GIBaseInfo *)field_info));
- break;
- case GI_TYPE_TAG_BOOLEAN:
- value->v_boolean = G_STRUCT_MEMBER (gboolean, mem, offset) != FALSE;
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT8:
- case GI_TYPE_TAG_UINT8:
- value->v_uint8 = G_STRUCT_MEMBER (guint8, mem, offset);
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT16:
- case GI_TYPE_TAG_UINT16:
- value->v_uint16 = G_STRUCT_MEMBER (guint16, mem, offset);
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT32:
- case GI_TYPE_TAG_UINT32:
- case GI_TYPE_TAG_UNICHAR:
- value->v_uint32 = G_STRUCT_MEMBER (guint32, mem, offset);
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT64:
- case GI_TYPE_TAG_UINT64:
- value->v_uint64 = G_STRUCT_MEMBER (guint64, mem, offset);
- result = TRUE;
- break;
- case GI_TYPE_TAG_GTYPE:
- value->v_size = G_STRUCT_MEMBER (gsize, mem, offset);
- result = TRUE;
- break;
- case GI_TYPE_TAG_FLOAT:
- value->v_float = G_STRUCT_MEMBER (gfloat, mem, offset);
- result = TRUE;
- break;
- case GI_TYPE_TAG_DOUBLE:
- value->v_double = G_STRUCT_MEMBER (gdouble, mem, offset);
- result = TRUE;
- break;
- case GI_TYPE_TAG_ARRAY:
- /* We don't check the array type and that it is fixed-size,
- we trust g-ir-compiler to do the right thing */
- value->v_pointer = G_STRUCT_MEMBER_P (mem, offset);
- result = TRUE;
- break;
- case GI_TYPE_TAG_UTF8:
- case GI_TYPE_TAG_FILENAME:
- case GI_TYPE_TAG_GLIST:
- case GI_TYPE_TAG_GSLIST:
- case GI_TYPE_TAG_GHASH:
- g_warning("Field %s: type %s should have is_pointer set",
- gi_base_info_get_name ((GIBaseInfo *)field_info),
- gi_type_tag_to_string (gi_type_info_get_tag (type_info)));
- break;
- case GI_TYPE_TAG_ERROR:
- /* Needs to be handled by the language binding directly */
- break;
- case GI_TYPE_TAG_INTERFACE:
- {
- GIBaseInfo *interface = gi_type_info_get_interface (type_info);
- switch (gi_base_info_get_info_type (interface))
- {
- case GI_INFO_TYPE_STRUCT:
- case GI_INFO_TYPE_UNION:
- case GI_INFO_TYPE_BOXED:
- /* Needs to be handled by the language binding directly */
- break;
- case GI_INFO_TYPE_OBJECT:
- break;
- case GI_INFO_TYPE_ENUM:
- case GI_INFO_TYPE_FLAGS:
- {
- /* FIXME: there's a mismatch here between the value->v_int we use
- * here and the gint64 result returned from gi_value_info_get_value().
- * But to switch this to gint64, we'd have to make gi_function_info_invoke()
- * translate value->v_int64 to the proper ABI for an enum function
- * call parameter, which will usually be int, and then fix up language
- * bindings.
- */
- GITypeTag storage_type = gi_enum_info_get_storage_type ((GIEnumInfo *)interface);
- switch (storage_type)
- {
- case GI_TYPE_TAG_INT8:
- case GI_TYPE_TAG_UINT8:
- value->v_int = (gint)G_STRUCT_MEMBER (guint8, mem, offset);
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT16:
- case GI_TYPE_TAG_UINT16:
- value->v_int = (gint)G_STRUCT_MEMBER (guint16, mem, offset);
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT32:
- case GI_TYPE_TAG_UINT32:
- value->v_int = (gint)G_STRUCT_MEMBER (guint32, mem, offset);
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT64:
- case GI_TYPE_TAG_UINT64:
- value->v_int = (gint)G_STRUCT_MEMBER (guint64, mem, offset);
- result = TRUE;
- break;
- default:
- g_warning("Field %s: Unexpected enum storage type %s",
- gi_base_info_get_name ((GIBaseInfo *)field_info),
- gi_type_tag_to_string (storage_type));
- break;
- }
- break;
- }
- case GI_INFO_TYPE_VFUNC:
- case GI_INFO_TYPE_CALLBACK:
- g_warning("Field %s: Interface type %d should have is_pointer set",
- gi_base_info_get_name ((GIBaseInfo *)field_info),
- gi_base_info_get_info_type (interface));
- break;
- case GI_INFO_TYPE_INVALID:
- case GI_INFO_TYPE_INTERFACE:
- case GI_INFO_TYPE_FUNCTION:
- case GI_INFO_TYPE_CONSTANT:
- case GI_INFO_TYPE_INVALID_0:
- case GI_INFO_TYPE_VALUE:
- case GI_INFO_TYPE_SIGNAL:
- case GI_INFO_TYPE_PROPERTY:
- case GI_INFO_TYPE_FIELD:
- case GI_INFO_TYPE_ARG:
- case GI_INFO_TYPE_TYPE:
- case GI_INFO_TYPE_UNRESOLVED:
- g_warning("Field %s: Interface type %d not expected",
- gi_base_info_get_name ((GIBaseInfo *)field_info),
- gi_base_info_get_info_type (interface));
- break;
- default:
- break;
- }
-
- gi_base_info_unref ((GIBaseInfo *)interface);
- break;
- }
- break;
- default:
- break;
- }
+ {
+ case GI_TYPE_TAG_VOID:
+ g_warning("Field %s: should not be have void type",
+ gi_base_info_get_name ((GIBaseInfo *)field_info));
+ break;
+ case GI_TYPE_TAG_BOOLEAN:
+ value->v_boolean = G_STRUCT_MEMBER (gboolean, mem, offset) != FALSE;
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT8:
+ case GI_TYPE_TAG_UINT8:
+ value->v_uint8 = G_STRUCT_MEMBER (uint8_t, mem, offset);
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT16:
+ case GI_TYPE_TAG_UINT16:
+ value->v_uint16 = G_STRUCT_MEMBER (uint16_t, mem, offset);
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT32:
+ case GI_TYPE_TAG_UINT32:
+ case GI_TYPE_TAG_UNICHAR:
+ value->v_uint32 = G_STRUCT_MEMBER (uint32_t, mem, offset);
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT64:
+ case GI_TYPE_TAG_UINT64:
+ value->v_uint64 = G_STRUCT_MEMBER (uint64_t, mem, offset);
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_GTYPE:
+ value->v_size = G_STRUCT_MEMBER (size_t, mem, offset);
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_FLOAT:
+ value->v_float = G_STRUCT_MEMBER (float, mem, offset);
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_DOUBLE:
+ value->v_double = G_STRUCT_MEMBER (double, mem, offset);
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_ARRAY:
+ /* We don't check the array type and that it is fixed-size,
+ we trust g-ir-compiler to do the right thing */
+ value->v_pointer = G_STRUCT_MEMBER_P (mem, offset);
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_UTF8:
+ case GI_TYPE_TAG_FILENAME:
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
+ case GI_TYPE_TAG_GHASH:
+ g_warning("Field %s: type %s should have is_pointer set",
+ gi_base_info_get_name ((GIBaseInfo *)field_info),
+ gi_type_tag_to_string (gi_type_info_get_tag (type_info)));
+ break;
+ case GI_TYPE_TAG_ERROR:
+ /* Needs to be handled by the language binding directly */
+ break;
+ case GI_TYPE_TAG_INTERFACE:
+ {
+ GIBaseInfo *interface = gi_type_info_get_interface (type_info);
+ switch (gi_base_info_get_info_type (interface))
+ {
+ case GI_INFO_TYPE_STRUCT:
+ case GI_INFO_TYPE_UNION:
+ case GI_INFO_TYPE_BOXED:
+ /* Needs to be handled by the language binding directly */
+ break;
+ case GI_INFO_TYPE_OBJECT:
+ break;
+ case GI_INFO_TYPE_ENUM:
+ case GI_INFO_TYPE_FLAGS:
+ {
+ /* FIXME: there's a mismatch here between the value->v_int we use
+ * here and the int64_t result returned from gi_value_info_get_value().
+ * But to switch this to int64_t, we'd have to make gi_function_info_invoke()
+ * translate value->v_int64 to the proper ABI for an enum function
+ * call parameter, which will usually be int, and then fix up language
+ * bindings.
+ */
+ GITypeTag storage_type = gi_enum_info_get_storage_type ((GIEnumInfo *)interface);
+ switch (storage_type)
+ {
+ case GI_TYPE_TAG_INT8:
+ case GI_TYPE_TAG_UINT8:
+ value->v_int = (int)G_STRUCT_MEMBER (uint8_t, mem, offset);
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT16:
+ case GI_TYPE_TAG_UINT16:
+ value->v_int = (int)G_STRUCT_MEMBER (uint16_t, mem, offset);
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT32:
+ case GI_TYPE_TAG_UINT32:
+ value->v_int = (int)G_STRUCT_MEMBER (uint32_t, mem, offset);
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT64:
+ case GI_TYPE_TAG_UINT64:
+ value->v_int = (int)G_STRUCT_MEMBER (uint64_t, mem, offset);
+ result = TRUE;
+ break;
+ default:
+ g_warning("Field %s: Unexpected enum storage type %s",
+ gi_base_info_get_name ((GIBaseInfo *)field_info),
+ gi_type_tag_to_string (storage_type));
+ break;
+ }
+ break;
+ }
+ case GI_INFO_TYPE_VFUNC:
+ case GI_INFO_TYPE_CALLBACK:
+ g_warning("Field %s: Interface type %d should have is_pointer set",
+ gi_base_info_get_name ((GIBaseInfo *)field_info),
+ gi_base_info_get_info_type (interface));
+ break;
+ case GI_INFO_TYPE_INVALID:
+ case GI_INFO_TYPE_INTERFACE:
+ case GI_INFO_TYPE_FUNCTION:
+ case GI_INFO_TYPE_CONSTANT:
+ case GI_INFO_TYPE_VALUE:
+ case GI_INFO_TYPE_SIGNAL:
+ case GI_INFO_TYPE_PROPERTY:
+ case GI_INFO_TYPE_FIELD:
+ case GI_INFO_TYPE_ARG:
+ case GI_INFO_TYPE_TYPE:
+ case GI_INFO_TYPE_UNRESOLVED:
+ g_warning("Field %s: Interface type %d not expected",
+ gi_base_info_get_name ((GIBaseInfo *)field_info),
+ gi_base_info_get_info_type (interface));
+ break;
+ default:
+ break;
+ }
+
+ gi_base_info_unref ((GIBaseInfo *)interface);
+ break;
+ }
+ break;
+ default:
+ break;
+ }
}
gi_base_info_unref ((GIBaseInfo *)type_info);
*/
gboolean
gi_field_info_set_field (GIFieldInfo *field_info,
- gpointer mem,
+ void *mem,
const GIArgument *value)
{
int offset;
if (!gi_type_info_is_pointer (type_info))
{
switch (gi_type_info_get_tag (type_info))
- {
- case GI_TYPE_TAG_VOID:
- g_warning("Field %s: should not be have void type",
- gi_base_info_get_name ((GIBaseInfo *)field_info));
- break;
- case GI_TYPE_TAG_BOOLEAN:
- G_STRUCT_MEMBER (gboolean, mem, offset) = value->v_boolean != FALSE;
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT8:
- case GI_TYPE_TAG_UINT8:
- G_STRUCT_MEMBER (guint8, mem, offset) = value->v_uint8;
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT16:
- case GI_TYPE_TAG_UINT16:
- G_STRUCT_MEMBER (guint16, mem, offset) = value->v_uint16;
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT32:
- case GI_TYPE_TAG_UINT32:
- case GI_TYPE_TAG_UNICHAR:
- G_STRUCT_MEMBER (guint32, mem, offset) = value->v_uint32;
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT64:
- case GI_TYPE_TAG_UINT64:
- G_STRUCT_MEMBER (guint64, mem, offset) = value->v_uint64;
- result = TRUE;
- break;
- case GI_TYPE_TAG_GTYPE:
- G_STRUCT_MEMBER (gsize, mem, offset) = value->v_size;
- result = TRUE;
- break;
- case GI_TYPE_TAG_FLOAT:
- G_STRUCT_MEMBER (gfloat, mem, offset) = value->v_float;
- result = TRUE;
- break;
- case GI_TYPE_TAG_DOUBLE:
- G_STRUCT_MEMBER (gdouble, mem, offset)= value->v_double;
- result = TRUE;
- break;
- case GI_TYPE_TAG_UTF8:
- case GI_TYPE_TAG_FILENAME:
- case GI_TYPE_TAG_ARRAY:
- case GI_TYPE_TAG_GLIST:
- case GI_TYPE_TAG_GSLIST:
- case GI_TYPE_TAG_GHASH:
- g_warning("Field %s: type %s should have is_pointer set",
- gi_base_info_get_name ((GIBaseInfo *)field_info),
- gi_type_tag_to_string (gi_type_info_get_tag (type_info)));
- break;
- case GI_TYPE_TAG_ERROR:
- /* Needs to be handled by the language binding directly */
- break;
- case GI_TYPE_TAG_INTERFACE:
- {
- GIBaseInfo *interface = gi_type_info_get_interface (type_info);
- switch (gi_base_info_get_info_type (interface))
- {
- case GI_INFO_TYPE_STRUCT:
- case GI_INFO_TYPE_UNION:
- case GI_INFO_TYPE_BOXED:
- /* Needs to be handled by the language binding directly */
- break;
- case GI_INFO_TYPE_OBJECT:
- break;
- case GI_INFO_TYPE_ENUM:
- case GI_INFO_TYPE_FLAGS:
- {
- /* See FIXME above
- */
- GITypeTag storage_type = gi_enum_info_get_storage_type ((GIEnumInfo *)interface);
- switch (storage_type)
- {
- case GI_TYPE_TAG_INT8:
- case GI_TYPE_TAG_UINT8:
- G_STRUCT_MEMBER (guint8, mem, offset) = (guint8)value->v_int;
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT16:
- case GI_TYPE_TAG_UINT16:
- G_STRUCT_MEMBER (guint16, mem, offset) = (guint16)value->v_int;
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT32:
- case GI_TYPE_TAG_UINT32:
- G_STRUCT_MEMBER (guint32, mem, offset) = (guint32)value->v_int;
- result = TRUE;
- break;
- case GI_TYPE_TAG_INT64:
- case GI_TYPE_TAG_UINT64:
- G_STRUCT_MEMBER (guint64, mem, offset) = (guint64)value->v_int;
- result = TRUE;
- break;
- default:
- g_warning("Field %s: Unexpected enum storage type %s",
- gi_base_info_get_name ((GIBaseInfo *)field_info),
- gi_type_tag_to_string (storage_type));
- break;
- }
- break;
- }
- break;
- case GI_INFO_TYPE_VFUNC:
- case GI_INFO_TYPE_CALLBACK:
- g_warning("Field%s: Interface type %d should have is_pointer set",
- gi_base_info_get_name ((GIBaseInfo *)field_info),
- gi_base_info_get_info_type (interface));
- break;
- case GI_INFO_TYPE_INVALID:
- case GI_INFO_TYPE_INTERFACE:
- case GI_INFO_TYPE_FUNCTION:
- case GI_INFO_TYPE_CONSTANT:
- case GI_INFO_TYPE_INVALID_0:
- case GI_INFO_TYPE_VALUE:
- case GI_INFO_TYPE_SIGNAL:
- case GI_INFO_TYPE_PROPERTY:
- case GI_INFO_TYPE_FIELD:
- case GI_INFO_TYPE_ARG:
- case GI_INFO_TYPE_TYPE:
- case GI_INFO_TYPE_UNRESOLVED:
- g_warning("Field %s: Interface type %d not expected",
- gi_base_info_get_name ((GIBaseInfo *)field_info),
- gi_base_info_get_info_type (interface));
- break;
- default:
- break;
- }
-
- gi_base_info_unref ((GIBaseInfo *)interface);
- break;
- }
- break;
- default:
- break;
- }
+ {
+ case GI_TYPE_TAG_VOID:
+ g_warning("Field %s: should not be have void type",
+ gi_base_info_get_name ((GIBaseInfo *)field_info));
+ break;
+ case GI_TYPE_TAG_BOOLEAN:
+ G_STRUCT_MEMBER (gboolean, mem, offset) = value->v_boolean != FALSE;
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT8:
+ case GI_TYPE_TAG_UINT8:
+ G_STRUCT_MEMBER (uint8_t, mem, offset) = value->v_uint8;
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT16:
+ case GI_TYPE_TAG_UINT16:
+ G_STRUCT_MEMBER (uint16_t, mem, offset) = value->v_uint16;
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT32:
+ case GI_TYPE_TAG_UINT32:
+ case GI_TYPE_TAG_UNICHAR:
+ G_STRUCT_MEMBER (uint32_t, mem, offset) = value->v_uint32;
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT64:
+ case GI_TYPE_TAG_UINT64:
+ G_STRUCT_MEMBER (uint64_t, mem, offset) = value->v_uint64;
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_GTYPE:
+ G_STRUCT_MEMBER (size_t, mem, offset) = value->v_size;
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_FLOAT:
+ G_STRUCT_MEMBER (float, mem, offset) = value->v_float;
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_DOUBLE:
+ G_STRUCT_MEMBER (double, mem, offset)= value->v_double;
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_UTF8:
+ case GI_TYPE_TAG_FILENAME:
+ case GI_TYPE_TAG_ARRAY:
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
+ case GI_TYPE_TAG_GHASH:
+ g_warning("Field %s: type %s should have is_pointer set",
+ gi_base_info_get_name ((GIBaseInfo *)field_info),
+ gi_type_tag_to_string (gi_type_info_get_tag (type_info)));
+ break;
+ case GI_TYPE_TAG_ERROR:
+ /* Needs to be handled by the language binding directly */
+ break;
+ case GI_TYPE_TAG_INTERFACE:
+ {
+ GIBaseInfo *interface = gi_type_info_get_interface (type_info);
+ switch (gi_base_info_get_info_type (interface))
+ {
+ case GI_INFO_TYPE_STRUCT:
+ case GI_INFO_TYPE_UNION:
+ case GI_INFO_TYPE_BOXED:
+ /* Needs to be handled by the language binding directly */
+ break;
+ case GI_INFO_TYPE_OBJECT:
+ break;
+ case GI_INFO_TYPE_ENUM:
+ case GI_INFO_TYPE_FLAGS:
+ {
+ /* See FIXME above
+ */
+ GITypeTag storage_type = gi_enum_info_get_storage_type ((GIEnumInfo *)interface);
+ switch (storage_type)
+ {
+ case GI_TYPE_TAG_INT8:
+ case GI_TYPE_TAG_UINT8:
+ G_STRUCT_MEMBER (uint8_t, mem, offset) = (uint8_t)value->v_int;
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT16:
+ case GI_TYPE_TAG_UINT16:
+ G_STRUCT_MEMBER (uint16_t, mem, offset) = (uint16_t)value->v_int;
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT32:
+ case GI_TYPE_TAG_UINT32:
+ G_STRUCT_MEMBER (uint32_t, mem, offset) = (uint32_t)value->v_int;
+ result = TRUE;
+ break;
+ case GI_TYPE_TAG_INT64:
+ case GI_TYPE_TAG_UINT64:
+ G_STRUCT_MEMBER (uint64_t, mem, offset) = (uint64_t)value->v_int;
+ result = TRUE;
+ break;
+ default:
+ g_warning("Field %s: Unexpected enum storage type %s",
+ gi_base_info_get_name ((GIBaseInfo *)field_info),
+ gi_type_tag_to_string (storage_type));
+ break;
+ }
+ break;
+ }
+ break;
+ case GI_INFO_TYPE_VFUNC:
+ case GI_INFO_TYPE_CALLBACK:
+ g_warning("Field%s: Interface type %d should have is_pointer set",
+ gi_base_info_get_name ((GIBaseInfo *)field_info),
+ gi_base_info_get_info_type (interface));
+ break;
+ case GI_INFO_TYPE_INVALID:
+ case GI_INFO_TYPE_INTERFACE:
+ case GI_INFO_TYPE_FUNCTION:
+ case GI_INFO_TYPE_CONSTANT:
+ case GI_INFO_TYPE_VALUE:
+ case GI_INFO_TYPE_SIGNAL:
+ case GI_INFO_TYPE_PROPERTY:
+ case GI_INFO_TYPE_FIELD:
+ case GI_INFO_TYPE_ARG:
+ case GI_INFO_TYPE_TYPE:
+ case GI_INFO_TYPE_UNRESOLVED:
+ g_warning("Field %s: Interface type %d not expected",
+ gi_base_info_get_name ((GIBaseInfo *)field_info),
+ gi_base_info_get_info_type (interface));
+ break;
+ default:
+ break;
+ }
+
+ gi_base_info_unref ((GIBaseInfo *)interface);
+ break;
+ }
+ break;
+ default:
+ break;
+ }
} else {
switch (gi_type_info_get_tag (type_info))
{
case GI_TYPE_TAG_INTERFACE:
{
- GIBaseInfo *interface = gi_type_info_get_interface (type_info);
- switch (gi_base_info_get_info_type (interface))
+ GIBaseInfo *interface = gi_type_info_get_interface (type_info);
+ switch (gi_base_info_get_info_type (interface))
{
case GI_INFO_TYPE_OBJECT:
case GI_INFO_TYPE_INTERFACE:
- G_STRUCT_MEMBER (gpointer, mem, offset) = (gpointer)value->v_pointer;
+ G_STRUCT_MEMBER (void *, mem, offset) = (void *)value->v_pointer;
result = TRUE;
break;
- default:
- break;
+ default:
+ break;
}
gi_base_info_unref ((GIBaseInfo *)interface);
}
break;
- default:
- break;
+ default:
+ break;
}
}
G_BEGIN_DECLS
+#define GI_TYPE_FIELD_INFO (gi_field_info_get_type ())
+
+/**
+ * GI_FIELD_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.FieldInfo] or derived pointer into a
+ * `(GIFieldInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_FIELD_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_FIELD_INFO, GIFieldInfo))
+
/**
* GI_IS_FIELD_INFO:
* @info: an info structure
*
- * Checks if @info is a [class@GIRepository.FieldInfo].
+ * Checks if @info is a [class@GIRepository.FieldInfo] (or a derived type).
*
* Since: 2.80
*/
-#define GI_IS_FIELD_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FIELD)
+#define GI_IS_FIELD_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_FIELD_INFO))
GI_AVAILABLE_IN_ALL
GIFieldInfoFlags gi_field_info_get_flags (GIFieldInfo *info);
GI_AVAILABLE_IN_ALL
-gsize gi_field_info_get_size (GIFieldInfo *info);
+size_t gi_field_info_get_size (GIFieldInfo *info);
GI_AVAILABLE_IN_ALL
-gsize gi_field_info_get_offset (GIFieldInfo *info);
+size_t gi_field_info_get_offset (GIFieldInfo *info);
GI_AVAILABLE_IN_ALL
GITypeInfo * gi_field_info_get_type_info (GIFieldInfo *info);
GI_AVAILABLE_IN_ALL
gboolean gi_field_info_get_field (GIFieldInfo *field_info,
- gpointer mem,
+ void *mem,
GIArgument *value);
GI_AVAILABLE_IN_ALL
gboolean gi_field_info_set_field (GIFieldInfo *field_info,
- gpointer mem,
+ void *mem,
const GIArgument *value);
G_END_DECLS
--- /dev/null
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ * GObject introspection: Enum implementation
+ *
+ * Copyright 2024 GNOME Foundation, Inc.
+ *
+ * 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 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+
+#include <girepository/girepository.h>
+#include "gibaseinfo-private.h"
+#include "girepository-private.h"
+#include "gitypelib-internal.h"
+#include "giflagsinfo.h"
+
+/**
+ * GIFlagsInfo:
+ *
+ * A `GIFlagsInfo` represents an enumeration which defines flag values
+ * (independently set bits).
+ *
+ * The `GIFlagsInfo` contains a set of values (each a
+ * [class@GIRepository.ValueInfo]) and a type.
+ *
+ * The [class@GIRepository.ValueInfo] for a value is fetched by calling
+ * [method@GIRepository.EnumInfo.get_value] on a `GIFlagsInfo`.
+ *
+ * Since: 2.80
+ */
+
+void
+gi_flags_info_class_init (gpointer g_class,
+ gpointer class_data)
+{
+ GIBaseInfoClass *info_class = g_class;
+
+ info_class->info_type = GI_INFO_TYPE_FLAGS;
+}
--- /dev/null
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ * GObject introspection: Flags type
+ *
+ * Copyright 2024 GNOME Foundation, Inc.
+ *
+ * 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 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
+#error "Only <girepository.h> can be included directly."
+#endif
+
+#include <girepository/gitypes.h>
+
+G_BEGIN_DECLS
+
+#define GI_TYPE_FLAGS_INFO (gi_flags_info_get_type ())
+
+/**
+ * GI_FLAGS_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.FlagsInfo] or derived pointer into a
+ * `(GIFlagsInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_FLAGS_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_FLAGS_INFO, GIFlagsInfo))
+
+/**
+ * GI_IS_FLAGS_INFO:
+ * @info: an info structure
+ *
+ * Checks if @info is a [class@GIRepository.FlagsInfo] (or a derived type).
+ *
+ * Since: 2.80
+ */
+#define GI_IS_FLAGS_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_FLAGS_INFO))
+
+G_END_DECLS
GIFunctionInfo *
gi_base_info_find_method (GIBaseInfo *base,
- guint32 offset,
- guint n_methods,
- const gchar *name)
+ uint32_t offset,
+ uint16_t n_methods,
+ const char *name)
{
/* FIXME hash */
GIRealInfo *rinfo = (GIRealInfo*)base;
Header *header = (Header *)rinfo->typelib->data;
- for (guint i = 0; i < n_methods; i++)
+ for (uint16_t i = 0; i < n_methods; i++)
{
FunctionBlob *fblob = (FunctionBlob *)&rinfo->typelib->data[offset];
- const gchar *fname = (const gchar *)&rinfo->typelib->data[fblob->name];
+ const char *fname = (const char *)&rinfo->typelib->data[fblob->name];
if (strcmp (name, fname) == 0)
return (GIFunctionInfo *) gi_info_new (GI_INFO_TYPE_FUNCTION, base,
* Returns: the symbol
* Since: 2.80
*/
-const gchar *
+const char *
gi_function_info_get_symbol (GIFunctionInfo *info)
{
GIRealInfo *rinfo;
gboolean
gi_function_info_invoke (GIFunctionInfo *info,
const GIArgument *in_args,
- gsize n_in_args,
- const GIArgument *out_args,
- gsize n_out_args,
+ size_t n_in_args,
+ GIArgument *out_args,
+ size_t n_out_args,
GIArgument *return_value,
GError **error)
{
- const gchar *symbol;
- gpointer func;
- gboolean is_method;
- gboolean throws;
+ const char *symbol;
+ void *func;
symbol = gi_function_info_get_symbol (info);
return FALSE;
}
- is_method = (gi_function_info_get_flags (info) & GI_FUNCTION_IS_METHOD) != 0
- && (gi_function_info_get_flags (info) & GI_FUNCTION_IS_CONSTRUCTOR) == 0;
- throws = gi_function_info_get_flags (info) & GI_FUNCTION_THROWS;
-
return gi_callable_info_invoke ((GICallableInfo*) info,
func,
in_args,
out_args,
n_out_args,
return_value,
- is_method,
- throws,
error);
}
G_BEGIN_DECLS
+#define GI_TYPE_FUNCTION_INFO (gi_function_info_get_type ())
+
+/**
+ * GI_FUNCTION_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.FunctionInfo] or derived pointer into a
+ * `(GIFunctionInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_FUNCTION_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_FUNCTION_INFO, GIFunctionInfo))
+
/**
* GI_IS_FUNCTION_INFO:
* @info: an info structure
*
- * Checks if @info is a [class@GIRepository.FunctionInfo].
+ * Checks if @info is a [class@GIRepository.FunctionInfo] (or a derived type).
*
* Since: 2.80
*/
-#define GI_IS_FUNCTION_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FUNCTION)
+#define GI_IS_FUNCTION_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_FUNCTION_INFO))
GI_AVAILABLE_IN_ALL
-const gchar * gi_function_info_get_symbol (GIFunctionInfo *info);
+const char * gi_function_info_get_symbol (GIFunctionInfo *info);
GI_AVAILABLE_IN_ALL
GIFunctionInfoFlags gi_function_info_get_flags (GIFunctionInfo *info);
GI_AVAILABLE_IN_ALL
gboolean gi_function_info_invoke (GIFunctionInfo *info,
const GIArgument *in_args,
- gsize n_in_args,
- const GIArgument *out_args,
- gsize n_out_args,
+ size_t n_in_args,
+ GIArgument *out_args,
+ size_t n_out_args,
GIArgument *return_value,
GError **error);
* Returns: number of prerequisites
* Since: 2.80
*/
-guint
+unsigned int
gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIBaseInfo *
gi_interface_info_get_prerequisite (GIInterfaceInfo *info,
- guint n)
+ unsigned int n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
InterfaceBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
* Returns: number of properties
* Since: 2.80
*/
-guint
+unsigned int
gi_interface_info_get_n_properties (GIInterfaceInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIPropertyInfo *
gi_interface_info_get_property (GIInterfaceInfo *info,
- guint n)
+ unsigned int n)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
InterfaceBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
header = (Header *)rinfo->typelib->data;
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
* Returns: number of methods
* Since: 2.80
*/
-guint
+unsigned int
gi_interface_info_get_n_methods (GIInterfaceInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIFunctionInfo *
gi_interface_info_get_method (GIInterfaceInfo *info,
- guint n)
+ unsigned int n)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
InterfaceBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
header = (Header *)rinfo->typelib->data;
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
*/
GIFunctionInfo *
gi_interface_info_find_method (GIInterfaceInfo *info,
- const gchar *name)
+ const char *name)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
* Returns: number of signals
* Since: 2.80
*/
-guint
+unsigned int
gi_interface_info_get_n_signals (GIInterfaceInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GISignalInfo *
gi_interface_info_get_signal (GIInterfaceInfo *info,
- guint n)
+ unsigned int n)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
InterfaceBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
header = (Header *)rinfo->typelib->data;
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
*/
GISignalInfo *
gi_interface_info_find_signal (GIInterfaceInfo *info,
- const gchar *name)
+ const char *name)
{
- guint n_signals;
+ uint32_t n_signals;
n_signals = gi_interface_info_get_n_signals (info);
- for (guint i = 0; i < n_signals; i++)
+ for (uint32_t i = 0; i < n_signals; i++)
{
GISignalInfo *siginfo = gi_interface_info_get_signal (info, i);
* Returns: number of virtual functions
* Since: 2.80
*/
-guint
+unsigned int
gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIVFuncInfo *
gi_interface_info_get_vfunc (GIInterfaceInfo *info,
- guint n)
+ unsigned int n)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
InterfaceBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
header = (Header *)rinfo->typelib->data;
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
*/
GIVFuncInfo *
gi_interface_info_find_vfunc (GIInterfaceInfo *info,
- const gchar *name)
+ const char *name)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
InterfaceBlob *blob;
* Returns: number of constants
* Since: 2.80
*/
-guint
+unsigned int
gi_interface_info_get_n_constants (GIInterfaceInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIConstantInfo *
gi_interface_info_get_constant (GIInterfaceInfo *info,
- guint n)
+ unsigned int n)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
InterfaceBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
header = (Header *)rinfo->typelib->data;
blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];
G_BEGIN_DECLS
+#define GI_TYPE_INTERFACE_INFO (gi_interface_info_get_type ())
+
+/**
+ * GI_INTERFACE_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.InterfaceInfo] or derived pointer into a
+ * `(GIInterfaceInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_INTERFACE_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_INTERFACE_INFO, GIInterfaceInfo))
+
/**
* GI_IS_INTERFACE_INFO:
* @info: an info structure
*
- * Checks if @info is a [class@GIRepository.InterfaceInfo].
+ * Checks if @info is a [class@GIRepository.InterfaceInfo] (or a derived type).
*
* Since: 2.80
*/
-#define GI_IS_INTERFACE_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_INTERFACE)
+#define GI_IS_INTERFACE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_INTERFACE_INFO))
GI_AVAILABLE_IN_ALL
-guint gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info);
+unsigned int gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info);
GI_AVAILABLE_IN_ALL
GIBaseInfo * gi_interface_info_get_prerequisite (GIInterfaceInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
-guint gi_interface_info_get_n_properties (GIInterfaceInfo *info);
+unsigned int gi_interface_info_get_n_properties (GIInterfaceInfo *info);
GI_AVAILABLE_IN_ALL
GIPropertyInfo * gi_interface_info_get_property (GIInterfaceInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
-guint gi_interface_info_get_n_methods (GIInterfaceInfo *info);
+unsigned int gi_interface_info_get_n_methods (GIInterfaceInfo *info);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_interface_info_get_method (GIInterfaceInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_interface_info_find_method (GIInterfaceInfo *info,
- const gchar *name);
+ const char *name);
GI_AVAILABLE_IN_ALL
-guint gi_interface_info_get_n_signals (GIInterfaceInfo *info);
+unsigned int gi_interface_info_get_n_signals (GIInterfaceInfo *info);
GI_AVAILABLE_IN_ALL
GISignalInfo * gi_interface_info_get_signal (GIInterfaceInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
GISignalInfo * gi_interface_info_find_signal (GIInterfaceInfo *info,
- const gchar *name);
+ const char *name);
GI_AVAILABLE_IN_ALL
-guint gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info);
+unsigned int gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info);
GI_AVAILABLE_IN_ALL
GIVFuncInfo * gi_interface_info_get_vfunc (GIInterfaceInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
GIVFuncInfo * gi_interface_info_find_vfunc (GIInterfaceInfo *info,
- const gchar *name);
+ const char *name);
GI_AVAILABLE_IN_ALL
-guint gi_interface_info_get_n_constants (GIInterfaceInfo *info);
+unsigned int gi_interface_info_get_n_constants (GIInterfaceInfo *info);
GI_AVAILABLE_IN_ALL
GIConstantInfo * gi_interface_info_get_constant (GIInterfaceInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
* Since: 2.80
*/
static ffi_type *
-value_to_ffi_type (const GValue *gvalue, gpointer *value)
+value_to_ffi_type (const GValue *gvalue, void **value)
{
ffi_type *rettype = NULL;
GType type = g_type_fundamental (G_VALUE_TYPE (gvalue));
case G_TYPE_CHAR:
case G_TYPE_INT:
rettype = &ffi_type_sint;
- *value = (gpointer)&(gvalue->data[0].v_int);
+ *value = (void *) &(gvalue->data[0].v_int);
break;
case G_TYPE_UCHAR:
case G_TYPE_UINT:
rettype = &ffi_type_uint;
- *value = (gpointer)&(gvalue->data[0].v_uint);
+ *value = (void *) &(gvalue->data[0].v_uint);
break;
case G_TYPE_STRING:
case G_TYPE_OBJECT:
case G_TYPE_POINTER:
case G_TYPE_PARAM:
rettype = &ffi_type_pointer;
- *value = (gpointer)&(gvalue->data[0].v_pointer);
+ *value = (void *) &(gvalue->data[0].v_pointer);
break;
case G_TYPE_FLOAT:
rettype = &ffi_type_float;
- *value = (gpointer)&(gvalue->data[0].v_float);
+ *value = (void *) &(gvalue->data[0].v_float);
break;
case G_TYPE_DOUBLE:
rettype = &ffi_type_double;
- *value = (gpointer)&(gvalue->data[0].v_double);
+ *value = (void *) &(gvalue->data[0].v_double);
break;
case G_TYPE_LONG:
rettype = &ffi_type_slong;
- *value = (gpointer)&(gvalue->data[0].v_long);
+ *value = (void *) &(gvalue->data[0].v_long);
break;
case G_TYPE_ULONG:
rettype = &ffi_type_ulong;
- *value = (gpointer)&(gvalue->data[0].v_ulong);
+ *value = (void *) &(gvalue->data[0].v_ulong);
break;
case G_TYPE_INT64:
rettype = &ffi_type_sint64;
- *value = (gpointer)&(gvalue->data[0].v_int64);
+ *value = (void *) &(gvalue->data[0].v_int64);
break;
case G_TYPE_UINT64:
rettype = &ffi_type_uint64;
- *value = (gpointer)&(gvalue->data[0].v_uint64);
+ *value = (void *) &(gvalue->data[0].v_uint64);
break;
default:
rettype = &ffi_type_pointer;
*/
static ffi_type *
g_value_to_ffi_return_type (const GValue *gvalue,
- const GIArgument *ffi_value,
- gpointer *value)
+ const GIArgument *ffi_value,
+ void **value)
{
ffi_type *rettype = NULL;
GType type = g_type_fundamental (G_VALUE_TYPE (gvalue));
g_assert (type != G_TYPE_INVALID);
- *value = (gpointer)&(ffi_value->v_long);
+ *value = (void *) &(ffi_value->v_long);
switch (type) {
case G_TYPE_CHAR:
break;
case G_TYPE_FLOAT:
rettype = &ffi_type_float;
- *value = (gpointer)&(ffi_value->v_float);
+ *value = (void *) &(ffi_value->v_float);
break;
case G_TYPE_DOUBLE:
rettype = &ffi_type_double;
- *value = (gpointer)&(ffi_value->v_double);
+ *value = (void *) &(ffi_value->v_double);
break;
case G_TYPE_LONG:
rettype = &ffi_type_slong;
break;
case G_TYPE_INT64:
rettype = &ffi_type_sint64;
- *value = (gpointer)&(ffi_value->v_int64);
+ *value = (void *) &(ffi_value->v_int64);
break;
case G_TYPE_UINT64:
rettype = &ffi_type_uint64;
- *value = (gpointer)&(ffi_value->v_uint64);
+ *value = (void *) &(ffi_value->v_uint64);
break;
default:
rettype = &ffi_type_pointer;
g_value_set_boolean (gvalue, (gboolean)value->v_long);
break;
case G_TYPE_STRING:
- g_value_set_string (gvalue, (gchar*)value->v_pointer);
+ g_value_set_string (gvalue, (char*)value->v_pointer);
break;
case G_TYPE_CHAR:
- g_value_set_schar (gvalue, (gchar)value->v_long);
+ g_value_set_schar (gvalue, (char)value->v_long);
break;
case G_TYPE_UCHAR:
g_value_set_uchar (gvalue, (guchar)value->v_ulong);
break;
default:
g_warning ("Unsupported fundamental type: %s",
- g_type_name (g_type_fundamental (G_VALUE_TYPE (gvalue))));
+ g_type_name (g_type_fundamental (G_VALUE_TYPE (gvalue))));
}
}
void
gi_cclosure_marshal_generic (GClosure *closure,
GValue *return_gvalue,
- guint n_param_values,
+ unsigned int n_param_values,
const GValue *param_values,
- gpointer invocation_hint,
- gpointer marshal_data)
+ void *invocation_hint,
+ void *marshal_data)
{
GIArgument return_ffi_value = { 0, };
ffi_type *rtype;
void *rvalue;
- int n_args;
+ unsigned int n_args;
ffi_type **atypes;
void **args;
- int i;
+ unsigned int i;
ffi_cif cif;
GCClosure *cc = (GCClosure*) closure;
if (return_gvalue && G_VALUE_TYPE (return_gvalue))
{
rtype = g_value_to_ffi_return_type (return_gvalue, &return_ffi_value,
- &rvalue);
+ &rvalue);
}
else
{
n_args = n_param_values + 1;
atypes = g_alloca (sizeof (ffi_type *) * n_args);
- args = g_alloca (sizeof (gpointer) * n_args);
+ args = g_alloca (sizeof (void *) * n_args);
if (n_param_values > 0)
{
* Returns: field offset, in bytes
* Since: 2.80
*/
-static gint32
+static size_t
gi_object_info_get_field_offset (GIObjectInfo *info,
- guint n)
+ size_t n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
- guint32 offset;
+ uint32_t offset;
FieldBlob *field_blob;
offset = rinfo->offset + header->object_blob_size
+ (blob->n_interfaces + blob->n_interfaces % 2) * 2;
- for (guint i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
{
field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
offset += header->field_blob_size;
* Returns: name of the object’s type
* Since: 2.80
*/
-const gchar *
+const char *
gi_object_info_get_type_name (GIObjectInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
* Returns: the type init function name
* Since: 2.80
*/
-const gchar *
+const char *
gi_object_info_get_type_init_function_name (GIObjectInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
* Returns: number of interfaces
* Since: 2.80
*/
-guint
+unsigned int
gi_object_info_get_n_interfaces (GIObjectInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIInterfaceInfo *
gi_object_info_get_interface (GIObjectInfo *info,
- guint n)
+ unsigned int n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ObjectBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
* Returns: number of fields
* Since: 2.80
*/
-guint
+unsigned int
gi_object_info_get_n_fields (GIObjectInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIFieldInfo *
gi_object_info_get_field (GIObjectInfo *info,
- guint n)
+ unsigned int n)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
offset = gi_object_info_get_field_offset(info, n);
* Returns: number of properties
* Since: 2.80
*/
-guint
+unsigned int
gi_object_info_get_n_properties (GIObjectInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIPropertyInfo *
gi_object_info_get_property (GIObjectInfo *info,
- guint n)
+ unsigned int n)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
ObjectBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
header = (Header *)rinfo->typelib->data;
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
* Returns: number of methods
* Since: 2.80
*/
-guint
+unsigned int
gi_object_info_get_n_methods (GIObjectInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIFunctionInfo *
gi_object_info_get_method (GIObjectInfo *info,
- guint n)
+ unsigned int n)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
ObjectBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
header = (Header *)rinfo->typelib->data;
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
*/
GIFunctionInfo *
gi_object_info_find_method (GIObjectInfo *info,
- const gchar *name)
+ const char *name)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
ObjectBlob *blob;
*/
GIFunctionInfo *
gi_object_info_find_method_using_interfaces (GIObjectInfo *info,
- const gchar *name,
+ const char *name,
GIObjectInfo **implementor)
{
GIFunctionInfo *result = NULL;
n_interfaces = gi_object_info_get_n_interfaces (info);
for (i = 0; i < n_interfaces; ++i)
- {
- GIInterfaceInfo *iface_info;
+ {
+ GIInterfaceInfo *iface_info;
- iface_info = gi_object_info_get_interface (info, i);
+ iface_info = gi_object_info_get_interface (info, i);
- result = gi_interface_info_find_method (iface_info, name);
+ result = gi_interface_info_find_method (iface_info, name);
- if (result != NULL)
- {
- implementor_result = (GIObjectInfo *) iface_info;
- break;
- }
- gi_base_info_unref ((GIBaseInfo*) iface_info);
- }
+ if (result != NULL)
+ {
+ implementor_result = (GIObjectInfo *) iface_info;
+ break;
+ }
+ gi_base_info_unref ((GIBaseInfo*) iface_info);
+ }
}
if (implementor)
*implementor = implementor_result;
* Returns: number of signals
* Since: 2.80
*/
-guint
+unsigned int
gi_object_info_get_n_signals (GIObjectInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GISignalInfo *
gi_object_info_get_signal (GIObjectInfo *info,
- guint n)
+ unsigned int n)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
ObjectBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
header = (Header *)rinfo->typelib->data;
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
*/
GISignalInfo *
gi_object_info_find_signal (GIObjectInfo *info,
- const gchar *name)
+ const char *name)
{
- guint n_signals;
+ size_t n_signals;
n_signals = gi_object_info_get_n_signals (info);
- for (guint i = 0; i < n_signals; i++)
+ for (size_t i = 0; i < n_signals; i++)
{
GISignalInfo *siginfo = gi_object_info_get_signal (info, i);
if (g_strcmp0 (gi_base_info_get_name ((GIBaseInfo *) siginfo), name) != 0)
- {
- gi_base_info_unref ((GIBaseInfo*)siginfo);
- continue;
- }
+ {
+ gi_base_info_unref ((GIBaseInfo*)siginfo);
+ continue;
+ }
return siginfo;
}
* Returns: number of virtual functions
* Since: 2.80
*/
-guint
+unsigned int
gi_object_info_get_n_vfuncs (GIObjectInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIVFuncInfo *
gi_object_info_get_vfunc (GIObjectInfo *info,
- guint n)
+ unsigned int n)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
ObjectBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
header = (Header *)rinfo->typelib->data;
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
*/
GIVFuncInfo *
gi_object_info_find_vfunc (GIObjectInfo *info,
- const gchar *name)
+ const char *name)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
ObjectBlob *blob;
*/
GIVFuncInfo *
gi_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
- const gchar *name,
+ const char *name,
GIObjectInfo **implementor)
{
GIVFuncInfo *result = NULL;
n_interfaces = gi_object_info_get_n_interfaces (info);
for (i = 0; i < n_interfaces; ++i)
- {
- GIInterfaceInfo *iface_info;
+ {
+ GIInterfaceInfo *iface_info;
- iface_info = gi_object_info_get_interface (info, i);
+ iface_info = gi_object_info_get_interface (info, i);
- result = gi_interface_info_find_vfunc (iface_info, name);
+ result = gi_interface_info_find_vfunc (iface_info, name);
- if (result != NULL)
- {
- implementor_result = (GIObjectInfo *) iface_info;
- break;
- }
- gi_base_info_unref ((GIBaseInfo*) iface_info);
- }
+ if (result != NULL)
+ {
+ implementor_result = (GIObjectInfo *) iface_info;
+ break;
+ }
+ gi_base_info_unref ((GIBaseInfo*) iface_info);
+ }
}
if (implementor)
*implementor = implementor_result;
* Returns: number of constants
* Since: 2.80
*/
-guint
+unsigned int
gi_object_info_get_n_constants (GIObjectInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIConstantInfo *
gi_object_info_get_constant (GIObjectInfo *info,
- guint n)
+ unsigned int n)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header;
ObjectBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
header = (Header *)rinfo->typelib->data;
blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];
const char* symbol;
GSList *parents = NULL, *l;
GIObjectInfo *parent_info;
- gpointer func = NULL;
+ void *func = NULL;
parent_info = (GIObjectInfo *) gi_base_info_ref ((GIBaseInfo *) info);
while (parent_info != NULL)
*/
typedef void * (*GIObjectInfoGetValueFunction) (const GValue *value);
+#define GI_TYPE_OBJECT_INFO (gi_object_info_get_type ())
+
+/**
+ * GI_OBJECT_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.ObjectInfo] or derived pointer into a
+ * `(GIObjectInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_OBJECT_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_OBJECT_INFO, GIObjectInfo))
+
/**
* GI_IS_OBJECT_INFO:
* @info: an info structure
*
- * Checks if @info is a [class@GIRepository.ObjectInfo].
+ * Checks if @info is a [class@GIRepository.ObjectInfo] (or a derived type).
*
* Since: 2.80
*/
-#define GI_IS_OBJECT_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_OBJECT)
+#define GI_IS_OBJECT_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_OBJECT_INFO))
GI_AVAILABLE_IN_ALL
-const gchar * gi_object_info_get_type_name (GIObjectInfo *info);
+const char * gi_object_info_get_type_name (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
-const gchar * gi_object_info_get_type_init_function_name (GIObjectInfo *info);
+const char * gi_object_info_get_type_init_function_name (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
gboolean gi_object_info_get_abstract (GIObjectInfo *info);
GIObjectInfo * gi_object_info_get_parent (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
-guint gi_object_info_get_n_interfaces (GIObjectInfo *info);
+unsigned int gi_object_info_get_n_interfaces (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIInterfaceInfo * gi_object_info_get_interface (GIObjectInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
-guint gi_object_info_get_n_fields (GIObjectInfo *info);
+unsigned int gi_object_info_get_n_fields (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIFieldInfo * gi_object_info_get_field (GIObjectInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
-guint gi_object_info_get_n_properties (GIObjectInfo *info);
+unsigned int gi_object_info_get_n_properties (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIPropertyInfo * gi_object_info_get_property (GIObjectInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
-guint gi_object_info_get_n_methods (GIObjectInfo *info);
+unsigned int gi_object_info_get_n_methods (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_object_info_get_method (GIObjectInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_object_info_find_method (GIObjectInfo *info,
- const gchar *name);
+ const char *name);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_object_info_find_method_using_interfaces (GIObjectInfo *info,
- const gchar *name,
+ const char *name,
GIObjectInfo **implementor);
GI_AVAILABLE_IN_ALL
-guint gi_object_info_get_n_signals (GIObjectInfo *info);
+unsigned int gi_object_info_get_n_signals (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GISignalInfo * gi_object_info_get_signal (GIObjectInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
GISignalInfo * gi_object_info_find_signal (GIObjectInfo *info,
- const gchar *name);
+ const char *name);
GI_AVAILABLE_IN_ALL
-guint gi_object_info_get_n_vfuncs (GIObjectInfo *info);
+unsigned int gi_object_info_get_n_vfuncs (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIVFuncInfo * gi_object_info_get_vfunc (GIObjectInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
GIVFuncInfo * gi_object_info_find_vfunc (GIObjectInfo *info,
- const gchar *name);
+ const char *name);
GI_AVAILABLE_IN_ALL
GIVFuncInfo * gi_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
- const gchar *name,
+ const char *name,
GIObjectInfo **implementor);
GI_AVAILABLE_IN_ALL
-guint gi_object_info_get_n_constants (GIObjectInfo *info);
+unsigned int gi_object_info_get_n_constants (GIObjectInfo *info);
GI_AVAILABLE_IN_ALL
GIConstantInfo * gi_object_info_get_constant (GIObjectInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
GIStructInfo * gi_object_info_get_class_struct (GIObjectInfo *info);
G_BEGIN_DECLS
+#define GI_TYPE_PROPERTY_INFO (gi_property_info_get_type ())
+
+/**
+ * GI_PROPERTY_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.PropertyInfo] or derived pointer into a
+ * `(GIPropertyInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_PROPERTY_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_PROPERTY_INFO, GIPropertyInfo))
+
/**
* GI_IS_PROPERTY_INFO:
* @info: an info structure
*
- * Checks if @info is a [class@GIRepository.PropertyInfo].
+ * Checks if @info is a [class@GIRepository.PropertyInfo] (or a derived type).
*
* Since: 2.80
*/
-#define GI_IS_PROPERTY_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_PROPERTY)
+#define GI_IS_PROPERTY_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_PROPERTY_INFO))
GI_AVAILABLE_IN_ALL
* Returns: (nullable): the type name, or `NULL` if unknown
* Since: 2.80
*/
-const gchar *
+const char *
gi_registered_type_info_get_type_name (GIRegisteredTypeInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
* passing into [method@GModule.Module.symbol], or `NULL` if unknown
* Since: 2.80
*/
-const gchar *
+const char *
gi_registered_type_info_get_type_init_function_name (GIRegisteredTypeInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
G_BEGIN_DECLS
+#define GI_TYPE_REGISTERED_TYPE_INFO (gi_registered_type_info_get_type ())
+
+/**
+ * GI_REGISTERED_TYPE_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.RegisteredTypeInfo] or derived pointer into a
+ * `(GIRegisteredTypeInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_REGISTERED_TYPE_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_REGISTERED_TYPE_INFO, GIRegisteredTypeInfo))
+
/**
* GI_IS_REGISTERED_TYPE_INFO:
* @info: an info structure
*
* Since: 2.80
*/
-#define GI_IS_REGISTERED_TYPE_INFO(info) \
- ((gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_BOXED) || \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_ENUM) || \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_FLAGS) || \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_INTERFACE) || \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_OBJECT) || \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_STRUCT) || \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNION) || \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_BOXED))
+#define GI_IS_REGISTERED_TYPE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_OBJECT_INFO))
GI_AVAILABLE_IN_ALL
-const gchar * gi_registered_type_info_get_type_name (GIRegisteredTypeInfo *info);
+const char * gi_registered_type_info_get_type_name (GIRegisteredTypeInfo *info);
GI_AVAILABLE_IN_ALL
-const gchar * gi_registered_type_info_get_type_init_function_name (GIRegisteredTypeInfo *info);
+const char * gi_registered_type_info_get_type_init_function_name (GIRegisteredTypeInfo *info);
GI_AVAILABLE_IN_ALL
GType gi_registered_type_info_get_g_type (GIRegisteredTypeInfo *info);
* be removed. */
typedef struct _GIBaseInfo GIRealInfo;
-/* We changed a gint32 -> gint in the structure below, which should be
- * valid everywhere we care about.
- */
-G_STATIC_ASSERT (sizeof (int) == sizeof (gint32));
-
/*
* We just use one structure for all of the info object
* types; in general, we should be reading data directly
GIBaseInfo *container;
GITypelib *typelib;
- guint32 offset;
+ uint32_t offset;
- guint32 type_is_embedded : 1; /* Used by GITypeInfo */
+ uint32_t type_is_embedded : 1; /* Used by GITypeInfo */
};
/* Subtypes */
struct _GIFunctionInfo
{
- GIBaseInfo parent;
+ GICallableInfo parent;
};
void gi_function_info_class_init (gpointer g_class,
struct _GICallbackInfo
{
- GIBaseInfo parent;
+ GICallableInfo parent;
};
void gi_callback_info_class_init (gpointer g_class,
struct _GIStructInfo
{
- GIBaseInfo parent;
+ GIRegisteredTypeInfo parent;
};
void gi_struct_info_class_init (gpointer g_class,
struct _GIUnionInfo
{
- GIBaseInfo parent;
+ GIRegisteredTypeInfo parent;
};
void gi_union_info_class_init (gpointer g_class,
struct _GIEnumInfo
{
- GIBaseInfo parent;
+ GIRegisteredTypeInfo parent;
};
void gi_enum_info_class_init (gpointer g_class,
gpointer class_data);
+struct _GIFlagsInfo
+{
+ GIEnumInfo parent;
+};
+
+void gi_flags_info_class_init (gpointer g_class,
+ gpointer class_data);
+
struct _GIObjectInfo
{
- GIBaseInfo parent;
+ GIRegisteredTypeInfo parent;
};
void gi_object_info_class_init (gpointer g_class,
struct _GIInterfaceInfo
{
- GIBaseInfo parent;
+ GIRegisteredTypeInfo parent;
};
void gi_interface_info_class_init (gpointer g_class,
gpointer class_data);
+struct _GIBoxedInfo
+{
+ GIRegisteredTypeInfo parent;
+};
+
+void gi_boxed_info_class_init (gpointer g_class,
+ gpointer class_data);
+
struct _GIConstantInfo
{
GIBaseInfo parent;
struct _GISignalInfo
{
- GIBaseInfo parent;
+ GICallableInfo parent;
};
void gi_signal_info_class_init (gpointer g_class,
struct _GIVFuncInfo
{
- GIBaseInfo parent;
+ GICallableInfo parent;
};
void gi_vfunc_info_class_init (gpointer g_class,
{
GIBaseInfo parent;
- const gchar *name;
- const gchar *namespace;
+ const char *name;
+ const char *namespace;
};
void gi_unresolved_info_class_init (gpointer g_class,
GIRepository *repository,
GIBaseInfo *container,
GITypelib *typelib,
- guint32 offset);
+ uint32_t offset);
GIBaseInfo * gi_info_from_entry (GIRepository *repository,
GITypelib *typelib,
- guint16 index);
+ uint16_t index);
GIBaseInfo * gi_info_new_full (GIInfoType type,
GIRepository *repository,
GIBaseInfo *container,
GITypelib *typelib,
- guint32 offset);
+ uint32_t offset);
GITypeInfo * gi_type_info_new (GIBaseInfo *container,
GITypelib *typelib,
- guint32 offset);
+ uint32_t offset);
void gi_type_info_init (GIBaseInfo *info,
GIBaseInfo *container,
GITypelib *typelib,
- guint32 offset);
+ uint32_t offset);
GIFunctionInfo * gi_base_info_find_method (GIBaseInfo *base,
- guint32 offset,
- guint n_methods,
- const gchar *name);
+ uint32_t offset,
+ uint16_t n_methods,
+ const char *name);
GIVFuncInfo * gi_base_info_find_vfunc (GIRealInfo *rinfo,
- guint32 offset,
- guint n_vfuncs,
- const gchar *name);
+ uint32_t offset,
+ uint16_t n_vfuncs,
+ const char *name);
* Since: 2.80
*/
+/* The namespace and version corresponding to libgirepository itself, so
+ * that we can refuse to load typelibs corresponding to the older,
+ * incompatible version of this same library in gobject-introspection. */
+#define GIREPOSITORY_TYPELIB_NAME "GIRepository"
+#define GIREPOSITORY_TYPELIB_VERSION "3.0"
+#define GIREPOSITORY_TYPELIB_FILENAME \
+ GIREPOSITORY_TYPELIB_NAME "-" GIREPOSITORY_TYPELIB_VERSION ".typelib"
+
static GIRepository *default_repository = NULL;
static GPtrArray *typelib_search_path = NULL;
typedef struct {
- guint n_interfaces;
+ size_t n_interfaces;
GIBaseInfo *interfaces[];
} GTypeInterfaceCache;
gtype_interface_cache_free (gpointer data)
{
GTypeInterfaceCache *cache = data;
- guint i;
- for (i = 0; i < cache->n_interfaces; i++)
+ for (size_t i = 0; i < cache->n_interfaces; i++)
gi_base_info_unref ((GIBaseInfo*) cache->interfaces[i]);
g_free (cache);
}
GHashTable *info_by_error_domain; /* GQuark -> GIBaseInfo */
GHashTable *interfaces_for_gtype; /* GType -> GTypeInterfaceCache */
GHashTable *unknown_gtypes; /* hashset of GType */
+
+ char **cached_shared_libraries; /* (owned) (nullable) (array zero-terminated=1) */
+ size_t cached_n_shared_libraries; /* length of @cached_shared_libraries, not including NULL terminator */
};
G_DEFINE_TYPE_WITH_CODE (GIRepository, gi_repository, G_TYPE_OBJECT, G_ADD_PRIVATE (GIRepository));
BOOL WINAPI
DllMain (HINSTANCE hinstDLL,
- DWORD fdwReason,
- LPVOID lpvReserved)
+ DWORD fdwReason,
+ LPVOID lpvReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH)
girepository_dll = hinstDLL;
*/
#define GOBJECT_INTROSPECTION_LIBDIR \
g_build_filename (g_win32_get_package_installation_directory_of_module (girepository_dll), \
- "lib", \
- NULL)
+ "lib", \
+ NULL)
#endif
repository->priv = gi_repository_get_instance_private (repository);
repository->priv->typelibs
= g_hash_table_new_full (g_str_hash, g_str_equal,
- (GDestroyNotify) g_free,
- (GDestroyNotify) gi_typelib_free);
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) gi_typelib_free);
repository->priv->lazy_typelibs
= g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
g_hash_table_destroy (repository->priv->interfaces_for_gtype);
g_hash_table_destroy (repository->priv->unknown_gtypes);
+ g_clear_pointer (&repository->priv->cached_shared_libraries, g_strfreev);
+
(* G_OBJECT_CLASS (gi_repository_parent_class)->finalize) (G_OBJECT (repository));
}
{
const char *libdir;
char *typelib_dir;
- const gchar *type_lib_path_env;
+ const char *type_lib_path_env;
/* This variable is intended to take precedence over both:
* - the default search path;
if (type_lib_path_env)
{
- gchar **custom_dirs;
+ char **custom_dirs;
custom_dirs = g_strsplit (type_lib_path_env, G_SEARCHPATH_SEPARATOR_S, 0);
typelib_search_path =
static GITypelib *
check_version_conflict (GITypelib *typelib,
- const gchar *namespace,
- const gchar *expected_version,
- char **version_conflict)
+ const char *namespace,
+ const char *expected_version,
+ char **version_conflict)
{
Header *header;
const char *loaded_version;
if (expected_version == NULL)
{
if (version_conflict)
- *version_conflict = NULL;
+ *version_conflict = NULL;
return typelib;
}
if (strcmp (expected_version, loaded_version) != 0)
{
if (version_conflict)
- *version_conflict = (char*)loaded_version;
+ *version_conflict = (char*)loaded_version;
return NULL;
}
if (version_conflict)
static GITypelib *
get_registered_status (GIRepository *repository,
- const char *namespace,
- const char *version,
- gboolean allow_lazy,
- gboolean *lazy_status,
- char **version_conflict)
+ const char *namespace,
+ const char *version,
+ gboolean allow_lazy,
+ gboolean *lazy_status,
+ char **version_conflict)
{
GITypelib *typelib;
repository = get_repository (repository);
static GITypelib *
get_registered (GIRepository *repository,
- const char *namespace,
- const char *version)
+ const char *namespace,
+ const char *version)
{
return get_registered_status (repository, namespace, version, TRUE, NULL, NULL);
}
static gboolean
load_dependencies_recurse (GIRepository *repository,
- GITypelib *typelib,
- GError **error)
+ GITypelib *typelib,
+ GError **error)
{
char **dependencies;
int i;
for (i = 0; dependencies[i]; i++)
- {
- char *dependency = dependencies[i];
- const char *last_dash;
- char *dependency_namespace;
- const char *dependency_version;
-
- last_dash = strrchr (dependency, '-');
- dependency_namespace = g_strndup (dependency, last_dash - dependency);
- dependency_version = last_dash+1;
-
- if (!gi_repository_require (repository, dependency_namespace, dependency_version,
- 0, error))
- {
- g_free (dependency_namespace);
- g_strfreev (dependencies);
- return FALSE;
- }
- g_free (dependency_namespace);
- }
+ {
+ char *dependency = dependencies[i];
+ const char *last_dash;
+ char *dependency_namespace;
+ const char *dependency_version;
+
+ last_dash = strrchr (dependency, '-');
+ dependency_namespace = g_strndup (dependency, last_dash - dependency);
+ dependency_version = last_dash+1;
+
+ if (!gi_repository_require (repository, dependency_namespace, dependency_version,
+ 0, error))
+ {
+ g_free (dependency_namespace);
+ g_strfreev (dependencies);
+ return FALSE;
+ }
+ g_free (dependency_namespace);
+ }
g_strfreev (dependencies);
}
return TRUE;
static const char *
register_internal (GIRepository *repository,
- const char *source,
- gboolean lazy,
- GITypelib *typelib,
- GError **error)
+ const char *source,
+ gboolean lazy,
+ GITypelib *typelib,
+ GError **error)
{
Header *header;
- const gchar *namespace;
+ const char *namespace;
g_return_val_if_fail (typelib != NULL, FALSE);
if (lazy)
{
g_assert (!g_hash_table_lookup (repository->priv->lazy_typelibs,
- namespace));
+ namespace));
g_hash_table_insert (repository->priv->lazy_typelibs,
- build_typelib_key (namespace, source), (void *)typelib);
+ build_typelib_key (namespace, source), (void *)typelib);
}
else
{
/* First, try loading all the dependencies */
if (!load_dependencies_recurse (repository, typelib, error))
- return NULL;
+ return NULL;
/* Check if we are transitioning from lazily loaded state */
if (g_hash_table_lookup_extended (repository->priv->lazy_typelibs,
- namespace,
- (gpointer)&key, &value))
- g_hash_table_remove (repository->priv->lazy_typelibs, key);
+ namespace,
+ (gpointer)&key, &value))
+ g_hash_table_remove (repository->priv->lazy_typelibs, key);
else
- key = build_typelib_key (namespace, source);
+ key = build_typelib_key (namespace, source);
g_hash_table_insert (repository->priv->typelibs,
g_steal_pointer (&key),
const char *namespace)
{
GITypelib *typelib;
- gchar **deps;
+ char **deps;
g_return_val_if_fail (namespace != NULL, NULL);
GITypelib *typelib,
GHashTable *transitive_dependencies)
{
- gchar **immediate_dependencies;
- guint i;
+ char **immediate_dependencies;
immediate_dependencies = get_typelib_dependencies (typelib);
- for (i = 0; immediate_dependencies != NULL && immediate_dependencies[i]; i++)
+ for (size_t i = 0; immediate_dependencies != NULL && immediate_dependencies[i]; i++)
{
- gchar *dependency;
- const gchar *last_dash;
- gchar *dependency_namespace;
+ char *dependency;
+ const char *last_dash;
+ char *dependency_namespace;
dependency = immediate_dependencies[i];
*/
char **
gi_repository_get_dependencies (GIRepository *repository,
- const char *namespace)
+ const char *namespace)
{
GITypelib *typelib;
GHashTable *transitive_dependencies; /* set of owned utf8 */
GHashTableIter iter;
- gchar *dependency;
+ char *dependency;
GPtrArray *out; /* owned utf8 elements */
g_return_val_if_fail (namespace != NULL, NULL);
g_hash_table_unref (transitive_dependencies);
- return (gchar **) g_ptr_array_free (out, FALSE);
+ return (char **) g_ptr_array_free (out, FALSE);
}
/**
* Since: 2.80
*/
const char *
-gi_repository_load_typelib (GIRepository *repository,
- GITypelib *typelib,
- GIRepositoryLoadFlags flags,
- GError **error)
+gi_repository_load_typelib (GIRepository *repository,
+ GITypelib *typelib,
+ GIRepositoryLoadFlags flags,
+ GError **error)
{
Header *header;
const char *namespace;
nsversion = gi_typelib_get_string (typelib, header->nsversion);
if (get_registered_status (repository, namespace, nsversion, allow_lazy,
- &is_lazy, &version_conflict))
+ &is_lazy, &version_conflict))
{
if (version_conflict != NULL)
- {
- g_set_error (error, GI_REPOSITORY_ERROR,
- GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
- "Attempting to load namespace '%s', version '%s', but '%s' is already loaded",
- namespace, nsversion, version_conflict);
- return NULL;
- }
+ {
+ g_set_error (error, GI_REPOSITORY_ERROR,
+ GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
+ "Attempting to load namespace '%s', version '%s', but '%s' is already loaded",
+ namespace, nsversion, version_conflict);
+ return NULL;
+ }
return namespace;
}
return register_internal (repository, "<builtin>",
- allow_lazy, typelib, error);
+ allow_lazy, typelib, error);
}
/**
*/
gboolean
gi_repository_is_registered (GIRepository *repository,
- const gchar *namespace,
- const gchar *version)
+ const char *namespace,
+ const char *version)
{
repository = get_repository (repository);
return get_registered (repository, namespace, version) != NULL;
* Returns: number of metadata entries
* Since: 2.80
*/
-guint
+unsigned int
gi_repository_get_n_infos (GIRepository *repository,
- const gchar *namespace)
+ const char *namespace)
{
GITypelib *typelib;
- guint n_interfaces = 0;
+ unsigned int n_interfaces = 0;
g_return_val_if_fail (namespace != NULL, -1);
*
* The namespace must have already been loaded before calling this function.
* See [method@GIRepository.Repository.get_n_infos] to find the maximum number
- * of entries.
+ * of entries. It is an error to pass an invalid @idx to this function.
*
- * Returns: (transfer full) (nullable): [class@GIRepository.BaseInfo] containing
- * metadata, or `NULL` if @idx was too high
+ * Returns: (transfer full) (not nullable): [class@GIRepository.BaseInfo]
+ * containing metadata
* Since: 2.80
*/
GIBaseInfo *
gi_repository_get_info (GIRepository *repository,
- const gchar *namespace,
- guint idx)
+ const char *namespace,
+ unsigned int idx)
{
GITypelib *typelib;
DirEntry *entry;
g_return_val_if_fail (namespace != NULL, NULL);
+ g_return_val_if_fail (idx < G_MAXUINT16, NULL);
repository = get_repository (repository);
g_return_val_if_fail (typelib != NULL, NULL);
entry = gi_typelib_get_dir_entry (typelib, idx + 1);
- if (entry == NULL)
- return NULL;
+ g_return_val_if_fail (entry != NULL, NULL);
+
return gi_info_new_full (entry->blob_type,
repository,
NULL, typelib, entry->offset);
}
typedef struct {
- const gchar *gtype_name;
+ const char *gtype_name;
GITypelib *result_typelib;
} FindByGTypeData;
repository = get_repository (repository);
cached = g_hash_table_lookup (repository->priv->info_by_gtype,
- (gpointer)gtype);
+ (gpointer)gtype);
if (cached != NULL)
return gi_base_info_ref (cached);
NULL, data.result_typelib, entry->offset);
g_hash_table_insert (repository->priv->info_by_gtype,
- (gpointer) gtype,
- gi_base_info_ref (cached));
+ (gpointer) gtype,
+ gi_base_info_ref (cached));
return cached;
}
else
*/
GIBaseInfo *
gi_repository_find_by_name (GIRepository *repository,
- const gchar *namespace,
- const gchar *name)
+ const char *namespace,
+ const char *name)
{
GITypelib *typelib;
DirEntry *entry;
static void
find_by_error_domain_foreach (gpointer key,
- gpointer value,
- gpointer datap)
+ gpointer value,
+ gpointer datap)
{
GITypelib *typelib = (GITypelib*)value;
FindByErrorDomainData *data = datap;
*/
GIEnumInfo *
gi_repository_find_by_error_domain (GIRepository *repository,
- GQuark domain)
+ GQuark domain)
{
FindByErrorDomainData data;
GIEnumInfo *cached;
repository = get_repository (repository);
cached = g_hash_table_lookup (repository->priv->info_by_error_domain,
- GUINT_TO_POINTER (domain));
+ GUINT_TO_POINTER (domain));
if (cached != NULL)
return (GIEnumInfo *) gi_base_info_ref ((GIBaseInfo *)cached);
NULL, data.result_typelib, data.result->offset);
g_hash_table_insert (repository->priv->info_by_error_domain,
- GUINT_TO_POINTER (domain),
- gi_base_info_ref ((GIBaseInfo *) cached));
+ GUINT_TO_POINTER (domain),
+ gi_base_info_ref ((GIBaseInfo *) cached));
return cached;
}
return NULL;
void
gi_repository_get_object_gtype_interfaces (GIRepository *repository,
GType gtype,
- gsize *n_interfaces_out,
+ size_t *n_interfaces_out,
GIInterfaceInfo ***interfaces_out)
{
GTypeInterfaceCache *cache;
repository = get_repository (repository);
cache = g_hash_table_lookup (repository->priv->interfaces_for_gtype,
- (gpointer) gtype);
+ (void *) gtype);
if (cache == NULL)
{
GType *interfaces;
- guint n_interfaces;
- guint i;
+ unsigned int i;
+ unsigned int n_interfaces;
GList *interface_infos = NULL, *iter;
interfaces = g_type_interfaces (gtype, &n_interfaces);
static void
collect_namespaces (gpointer key,
- gpointer value,
- gpointer data)
+ gpointer value,
+ gpointer data)
{
GList **list = data;
* list of namespaces
* Since: 2.80
*/
-gchar **
+char **
gi_repository_get_loaded_namespaces (GIRepository *repository)
{
GList *l, *list = NULL;
- gchar **names;
- gint i;
+ char **names;
+ size_t i;
repository = get_repository (repository);
g_hash_table_foreach (repository->priv->typelibs, collect_namespaces, &list);
g_hash_table_foreach (repository->priv->lazy_typelibs, collect_namespaces, &list);
- names = g_malloc0 (sizeof (gchar *) * (g_list_length (list) + 1));
+ names = g_malloc0 (sizeof (char *) * (g_list_length (list) + 1));
i = 0;
for (l = list; l; l = l->next)
names[i++] = g_strdup (l->data);
* Returns: Loaded version
* Since: 2.80
*/
-const gchar *
+const char *
gi_repository_get_version (GIRepository *repository,
- const gchar *namespace)
+ const char *namespace)
{
GITypelib *typelib;
Header *header;
}
/**
- * gi_repository_get_shared_library:
+ * gi_repository_get_shared_libraries:
* @repository: (nullable): A #GIRepository, or `NULL` for the singleton
* process-global default #GIRepository
* @namespace_: Namespace to inspect
+ * @out_n_elements: (out) (optional): Return location for the number of elements
+ * in the returned array
*
- * This function returns a comma-separated list of paths to the
+ * This function returns an array of paths to the
* shared C libraries associated with the given namespace @namespace_.
*
* There may be no shared library path associated, in which case this
* such as [method@GIRepository.Repository.require] before calling this
* function.
*
- * Returns: (nullable): Comma-separated list of paths to shared libraries,
- * or `NULL` if none are associated
+ * The list is internal to [class@GIRepository.Repository] and should not be
+ * freed, nor should its string elements.
+ *
+ * Returns: (nullable) (array length=out_n_elements) (transfer none): Array of
+ * paths to shared libraries, or `NULL` if none are associated
* Since: 2.80
*/
-const gchar *
-gi_repository_get_shared_library (GIRepository *repository,
- const gchar *namespace)
+const char * const *
+gi_repository_get_shared_libraries (GIRepository *repository,
+ const char *namespace,
+ size_t *out_n_elements)
{
GITypelib *typelib;
Header *header;
g_return_val_if_fail (typelib != NULL, NULL);
header = (Header *) typelib->data;
- if (header->shared_library)
- return gi_typelib_get_string (typelib, header->shared_library);
- else
- return NULL;
+ if (!header->shared_library)
+ {
+ if (out_n_elements != NULL)
+ *out_n_elements = 0;
+ return NULL;
+ }
+
+ /* Populate the cache. */
+ if (repository->priv->cached_shared_libraries == NULL)
+ {
+ const char *comma_separated = gi_typelib_get_string (typelib, header->shared_library);
+
+ if (comma_separated != NULL && *comma_separated != '\0')
+ {
+ repository->priv->cached_shared_libraries = g_strsplit (comma_separated, ",", -1);
+ repository->priv->cached_n_shared_libraries = g_strv_length (repository->priv->cached_shared_libraries);
+ }
+ }
+
+ if (out_n_elements != NULL)
+ *out_n_elements = repository->priv->cached_n_shared_libraries;
+
+ return (const char * const *) repository->priv->cached_shared_libraries;
}
/**
* Returns: (nullable): C namespace prefix, or `NULL` if none associated
* Since: 2.80
*/
-const gchar *
+const char *
gi_repository_get_c_prefix (GIRepository *repository,
- const gchar *namespace_)
+ const char *namespace_)
{
GITypelib *typelib;
Header *header;
* successful, `NULL` if namespace is not loaded
* Since: 2.80
*/
-const gchar *
+const char *
gi_repository_get_typelib_path (GIRepository *repository,
- const gchar *namespace)
+ const char *namespace)
{
gpointer orig_key, value;
repository = get_repository (repository);
if (!g_hash_table_lookup_extended (repository->priv->typelibs, namespace,
- &orig_key, &value))
+ &orig_key, &value))
{
if (!g_hash_table_lookup_extended (repository->priv->lazy_typelibs, namespace,
- &orig_key, &value))
+ &orig_key, &value))
- return NULL;
+ return NULL;
}
return ((char*)orig_key) + strlen ((char *) orig_key) + 1;
}
GMappedFile *mfile = NULL;
char *fname;
+ if (g_str_equal (namespace, GIREPOSITORY_TYPELIB_NAME) &&
+ !g_str_equal (version, GIREPOSITORY_TYPELIB_VERSION))
+ {
+ g_debug ("Ignoring %s-%s.typelib because this libgirepository "
+ "corresponds to %s-%s",
+ namespace, version,
+ namespace, GIREPOSITORY_TYPELIB_VERSION);
+ return NULL;
+ }
+
fname = g_strdup_printf ("%s-%s.typelib", namespace, version);
for (size_t i = 0; i < n_search_paths; ++i)
mfile = g_mapped_file_new (path, FALSE, &error);
if (error)
- {
- g_free (path);
- g_clear_error (&error);
- continue;
- }
+ {
+ g_free (path);
+ g_clear_error (&error);
+ continue;
+ }
*path_ret = path;
break;
}
static gboolean
parse_version (const char *version,
- int *major,
- int *minor)
+ int *major,
+ int *minor)
{
const char *dot;
char *end;
static int
compare_version (const char *v1,
- const char *v2)
+ const char *v2)
{
gboolean success;
int v1_major, v1_minor;
static int
compare_candidate_reverse (struct NamespaceVersionCandidadate *c1,
- struct NamespaceVersionCandidadate *c2)
+ struct NamespaceVersionCandidadate *c2)
{
int result = compare_version (c1->version, c2->version);
/* First, check the version */
* pick the earlier one.
*/
if (c1->path_index == c2->path_index)
- return 0;
+ return 0;
else if (c1->path_index > c2->path_index)
- return 1;
+ return 1;
else
- return -1;
+ return -1;
}
}
dirname = search_paths[i];
dir = g_dir_open (dirname, 0, NULL);
if (dir == NULL)
- continue;
+ continue;
while ((entry = g_dir_read_name (dir)) != NULL)
- {
- GMappedFile *mfile;
- char *path, *version;
- struct NamespaceVersionCandidadate *candidate;
-
- if (!g_str_has_suffix (entry, ".typelib"))
- continue;
-
- if (g_str_has_prefix (entry, namespace_dash))
- {
- const char *last_dash;
- const char *name_end;
- int major, minor;
-
- name_end = strrchr (entry, '.');
- last_dash = strrchr (entry, '-');
- version = g_strndup (last_dash+1, name_end-(last_dash+1));
- if (!parse_version (version, &major, &minor))
- {
- g_free (version);
- continue;
- }
- }
- else
- continue;
-
- if (g_hash_table_lookup (found_versions, version) != NULL)
- {
- g_free (version);
- continue;
- }
-
- path = g_build_filename (dirname, entry, NULL);
- mfile = g_mapped_file_new (path, FALSE, &error);
- if (mfile == NULL)
- {
- g_free (path);
- g_free (version);
- g_clear_error (&error);
- continue;
- }
- candidate = g_slice_new0 (struct NamespaceVersionCandidadate);
- candidate->mfile = mfile;
- candidate->path_index = index;
- candidate->path = path;
- candidate->version = version;
- candidates = g_slist_prepend (candidates, candidate);
- g_hash_table_add (found_versions, version);
- }
+ {
+ GMappedFile *mfile;
+ char *path, *version;
+ struct NamespaceVersionCandidadate *candidate;
+
+ if (!g_str_has_suffix (entry, ".typelib"))
+ continue;
+
+ if (g_str_has_prefix (entry, namespace_dash))
+ {
+ const char *last_dash;
+ const char *name_end;
+ int major, minor;
+
+ if (g_str_equal (namespace, GIREPOSITORY_TYPELIB_NAME) &&
+ !g_str_equal (entry, GIREPOSITORY_TYPELIB_FILENAME))
+ {
+ g_debug ("Ignoring %s because this libgirepository "
+ "corresponds to %s",
+ entry, GIREPOSITORY_TYPELIB_FILENAME);
+ continue;
+ }
+
+ name_end = strrchr (entry, '.');
+ last_dash = strrchr (entry, '-');
+ version = g_strndup (last_dash+1, name_end-(last_dash+1));
+ if (!parse_version (version, &major, &minor))
+ {
+ g_free (version);
+ continue;
+ }
+ }
+ else
+ continue;
+
+ if (g_hash_table_lookup (found_versions, version) != NULL)
+ {
+ g_free (version);
+ continue;
+ }
+
+ path = g_build_filename (dirname, entry, NULL);
+ mfile = g_mapped_file_new (path, FALSE, &error);
+ if (mfile == NULL)
+ {
+ g_free (path);
+ g_free (version);
+ g_clear_error (&error);
+ continue;
+ }
+ candidate = g_slice_new0 (struct NamespaceVersionCandidadate);
+ candidate->mfile = mfile;
+ candidate->path_index = index;
+ candidate->path = path;
+ candidate->version = version;
+ candidates = g_slist_prepend (candidates, candidate);
+ g_hash_table_add (found_versions, version);
+ }
g_dir_close (dir);
index++;
}
*/
char **
gi_repository_enumerate_versions (GIRepository *repository,
- const gchar *namespace_,
+ const char *namespace_,
size_t *n_versions_out)
{
GPtrArray *versions;
GSList *candidates, *link;
- const gchar *loaded_version;
+ const char *loaded_version;
char **ret;
init_globals ();
GITypelib *ret = NULL;
Header *header;
GITypelib *typelib = NULL;
- const gchar *typelib_namespace, *typelib_version;
+ const char *typelib_namespace, *typelib_version;
gboolean allow_lazy = (flags & GI_REPOSITORY_LOAD_FLAG_LAZY) > 0;
gboolean is_lazy;
char *version_conflict = NULL;
if (version_conflict != NULL)
{
g_set_error (error, GI_REPOSITORY_ERROR,
- GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
- "Requiring namespace '%s' version '%s', but '%s' is already loaded",
- namespace, version, version_conflict);
+ GI_REPOSITORY_ERROR_NAMESPACE_VERSION_CONFLICT,
+ "Requiring namespace '%s' version '%s', but '%s' is already loaded",
+ namespace, version, version_conflict);
return NULL;
}
if (mfile == NULL)
{
if (version != NULL)
- g_set_error (error, GI_REPOSITORY_ERROR,
- GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
- "Typelib file for namespace '%s', version '%s' not found",
- namespace, version);
+ g_set_error (error, GI_REPOSITORY_ERROR,
+ GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
+ "Typelib file for namespace '%s', version '%s' not found",
+ namespace, version);
else
- g_set_error (error, GI_REPOSITORY_ERROR,
- GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
- "Typelib file for namespace '%s' (any version) not found",
- namespace);
+ g_set_error (error, GI_REPOSITORY_ERROR,
+ GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
+ "Typelib file for namespace '%s' (any version) not found",
+ namespace);
goto out;
}
typelib = gi_typelib_new_from_mapped_file (mfile, &temp_error);
if (!typelib)
{
- g_set_error (error, GI_REPOSITORY_ERROR,
- GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
- "Failed to load typelib file '%s' for namespace '%s': %s",
- path, namespace, temp_error->message);
- g_clear_error (&temp_error);
- goto out;
+ g_set_error (error, GI_REPOSITORY_ERROR,
+ GI_REPOSITORY_ERROR_TYPELIB_NOT_FOUND,
+ "Failed to load typelib file '%s' for namespace '%s': %s",
+ path, namespace, temp_error->message);
+ g_clear_error (&temp_error);
+ goto out;
}
}
header = (Header *) typelib->data;
if (strcmp (typelib_namespace, namespace) != 0)
{
g_set_error (error, GI_REPOSITORY_ERROR,
- GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH,
- "Typelib file %s for namespace '%s' contains "
- "namespace '%s' which doesn't match the file name",
- path, namespace, typelib_namespace);
+ GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH,
+ "Typelib file %s for namespace '%s' contains "
+ "namespace '%s' which doesn't match the file name",
+ path, namespace, typelib_namespace);
gi_typelib_free (typelib);
goto out;
}
if (version != NULL && strcmp (typelib_version, version) != 0)
{
g_set_error (error, GI_REPOSITORY_ERROR,
- GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH,
- "Typelib file %s for namespace '%s' contains "
- "version '%s' which doesn't match the expected version '%s'",
- path, namespace, typelib_version, version);
+ GI_REPOSITORY_ERROR_NAMESPACE_MISMATCH,
+ "Typelib file %s for namespace '%s' contains "
+ "version '%s' which doesn't match the expected version '%s'",
+ path, namespace, typelib_version, version);
gi_typelib_free (typelib);
goto out;
}
if (!register_internal (repository, path, allow_lazy,
- typelib, error))
+ typelib, error))
{
gi_typelib_free (typelib);
goto out;
*/
GITypelib *
gi_repository_require (GIRepository *repository,
- const gchar *namespace,
- const gchar *version,
- GIRepositoryLoadFlags flags,
- GError **error)
+ const char *namespace,
+ const char *version,
+ GIRepositoryLoadFlags flags,
+ GError **error)
{
GITypelib *typelib;
* Since: 2.80
*/
GITypelib *
-gi_repository_require_private (GIRepository *repository,
- const gchar *typelib_dir,
- const gchar *namespace,
- const gchar *version,
- GIRepositoryLoadFlags flags,
- GError **error)
+gi_repository_require_private (GIRepository *repository,
+ const char *typelib_dir,
+ const char *namespace,
+ const char *version,
+ GIRepositoryLoadFlags flags,
+ GError **error)
{
const char * const search_path[] = { typelib_dir, NULL };
static gboolean
gi_repository_introspect_cb (const char *option_name,
- const char *value,
- gpointer data,
- GError **error)
+ const char *value,
+ gpointer data,
+ GError **error)
{
GError *tmp_error = NULL;
char **args;
if (!gi_repository_dump (args[0], args[1], &tmp_error))
{
g_error ("Failed to extract GType data: %s",
- tmp_error->message);
+ tmp_error->message);
exit (1);
}
exit (0);
* Returns: the string
* Since: 2.80
*/
-const gchar*
+const char *
gi_type_tag_to_string (GITypeTag type)
{
switch (type)
* Returns: the string
* Since: 2.80
*/
-const gchar*
+const char *
gi_info_type_to_string (GIInfoType type)
{
switch (type)
#include <girepository/giarginfo.h>
#include <girepository/gibaseinfo.h>
+#include <girepository/giboxedinfo.h>
#include <girepository/gicallableinfo.h>
#include <girepository/gicallbackinfo.h>
#include <girepository/giconstantinfo.h>
#include <girepository/gienuminfo.h>
#include <girepository/gifieldinfo.h>
+#include <girepository/giflagsinfo.h>
#include <girepository/gifunctioninfo.h>
#include <girepository/giinterfaceinfo.h>
#include <girepository/giobjectinfo.h>
#include <girepository/gitypes.h>
#include <girepository/giunioninfo.h>
#include <girepository/giunresolvedinfo.h>
+#include <girepository/givalueinfo.h>
#include <girepository/givfuncinfo.h>
G_BEGIN_DECLS
GI_AVAILABLE_IN_ALL
gboolean gi_repository_is_registered (GIRepository *repository,
- const gchar *namespace_,
- const gchar *version);
+ const char *namespace_,
+ const char *version);
GI_AVAILABLE_IN_ALL
GIBaseInfo * gi_repository_find_by_name (GIRepository *repository,
- const gchar *namespace_,
- const gchar *name);
+ const char *namespace_,
+ const char *name);
GI_AVAILABLE_IN_ALL
char ** gi_repository_enumerate_versions (GIRepository *repository,
- const gchar *namespace_,
+ const char *namespace_,
size_t *n_versions_out);
GI_AVAILABLE_IN_ALL
GITypelib * gi_repository_require (GIRepository *repository,
- const gchar *namespace_,
- const gchar *version,
+ const char *namespace_,
+ const char *version,
GIRepositoryLoadFlags flags,
GError **error);
GI_AVAILABLE_IN_ALL
GITypelib * gi_repository_require_private (GIRepository *repository,
- const gchar *typelib_dir,
- const gchar *namespace_,
- const gchar *version,
+ const char *typelib_dir,
+ const char *namespace_,
+ const char *version,
GIRepositoryLoadFlags flags,
GError **error);
GI_AVAILABLE_IN_ALL
-gchar ** gi_repository_get_immediate_dependencies (GIRepository *repository,
- const gchar *namespace_);
+char ** gi_repository_get_immediate_dependencies (GIRepository *repository,
+ const char *namespace_);
GI_AVAILABLE_IN_ALL
-gchar ** gi_repository_get_dependencies (GIRepository *repository,
- const gchar *namespace_);
+char ** gi_repository_get_dependencies (GIRepository *repository,
+ const char *namespace_);
GI_AVAILABLE_IN_ALL
-gchar ** gi_repository_get_loaded_namespaces (GIRepository *repository);
+char ** gi_repository_get_loaded_namespaces (GIRepository *repository);
GI_AVAILABLE_IN_ALL
GIBaseInfo * gi_repository_find_by_gtype (GIRepository *repository,
GI_AVAILABLE_IN_ALL
void gi_repository_get_object_gtype_interfaces (GIRepository *repository,
GType gtype,
- gsize *n_interfaces_out,
+ size_t *n_interfaces_out,
GIInterfaceInfo ***interfaces_out);
GI_AVAILABLE_IN_ALL
-guint gi_repository_get_n_infos (GIRepository *repository,
- const gchar *namespace_);
+unsigned int gi_repository_get_n_infos (GIRepository *repository,
+ const char *namespace_);
GI_AVAILABLE_IN_ALL
GIBaseInfo * gi_repository_get_info (GIRepository *repository,
- const gchar *namespace_,
- guint idx);
+ const char *namespace_,
+ unsigned int idx);
GI_AVAILABLE_IN_ALL
GIEnumInfo * gi_repository_find_by_error_domain (GIRepository *repository,
GQuark domain);
GI_AVAILABLE_IN_ALL
-const gchar * gi_repository_get_typelib_path (GIRepository *repository,
- const gchar *namespace_);
+const char * gi_repository_get_typelib_path (GIRepository *repository,
+ const char *namespace_);
GI_AVAILABLE_IN_ALL
-const gchar * gi_repository_get_shared_library (GIRepository *repository,
- const gchar *namespace_);
+const char * const *gi_repository_get_shared_libraries (GIRepository *repository,
+ const char *namespace_,
+ size_t *out_n_elements);
GI_AVAILABLE_IN_ALL
-const gchar * gi_repository_get_c_prefix (GIRepository *repository,
- const gchar *namespace_);
+const char * gi_repository_get_c_prefix (GIRepository *repository,
+ const char *namespace_);
GI_AVAILABLE_IN_ALL
-const gchar * gi_repository_get_version (GIRepository *repository,
- const gchar *namespace_);
+const char * gi_repository_get_version (GIRepository *repository,
+ const char *namespace_);
GI_AVAILABLE_IN_ALL
GI_AVAILABLE_IN_ALL
void gi_cclosure_marshal_generic (GClosure *closure,
GValue *return_gvalue,
- guint n_param_values,
+ unsigned int n_param_values,
const GValue *param_values,
- gpointer invocation_hint,
- gpointer marshal_data);
+ void *invocation_hint,
+ void *marshal_data);
G_END_DECLS
static ffi_type *
gi_type_tag_get_ffi_type_internal (GITypeTag tag,
gboolean is_pointer,
- gboolean is_enum)
+ gboolean is_enum)
{
switch (tag)
{
return &ffi_type_pointer;
case GI_TYPE_TAG_INTERFACE:
{
- /* We need to handle enums specially:
- * https://bugzilla.gnome.org/show_bug.cgi?id=665150
- */
+ /* We need to handle enums specially:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=665150
+ */
if (!is_enum)
return &ffi_type_pointer;
- else
- return &ffi_type_sint32;
+ else
+ return &ffi_type_sint32;
}
case GI_TYPE_TAG_VOID:
if (is_pointer)
*/
ffi_type *
gi_type_tag_get_ffi_type (GITypeTag type_tag,
- gboolean is_pointer)
+ gboolean is_pointer)
{
return gi_type_tag_get_ffi_type_internal (type_tag, is_pointer, FALSE);
}
*/
static ffi_type **
gi_callable_info_get_ffi_arg_types (GICallableInfo *callable_info,
- int *n_args_p)
+ size_t *n_args_p)
{
ffi_type **arg_types;
gboolean is_method, throws;
- gint n_args, n_invoke_args, i, offset;
+ size_t n_args, n_invoke_args, i, offset;
g_return_val_if_fail (callable_info != NULL, NULL);
GError **error)
{
const char *symbol;
- gpointer addr;
+ void *addr;
g_return_val_if_fail (info != NULL, FALSE);
g_return_val_if_fail (invoker != NULL, FALSE);
* Since: 2.80
*/
gboolean
-gi_function_invoker_new_for_address (gpointer addr,
+gi_function_invoker_new_for_address (void *addr,
GICallableInfo *info,
GIFunctionInvoker *invoker,
GError **error)
{
ffi_type **atypes;
- gint n_args;
+ size_t n_args;
g_return_val_if_fail (info != NULL, FALSE);
g_return_val_if_fail (invoker != NULL, FALSE);
typedef struct {
ffi_closure ffi_closure;
- gpointer writable_self;
- gpointer native_address;
+ void *writable_self;
+ void *native_address;
} GIClosureWrapper;
/**
gi_callable_info_create_closure (GICallableInfo *callable_info,
ffi_cif *cif,
GIFFIClosureCallback callback,
- gpointer user_data)
+ void *user_data)
{
- gpointer exec_ptr;
- int n_args;
+ void *exec_ptr;
+ size_t n_args;
ffi_type **atypes;
GIClosureWrapper *closure;
ffi_status status;
closure = ffi_closure_alloc (sizeof (GIClosureWrapper), &exec_ptr);
if (!closure)
{
- g_warning ("could not allocate closure\n");
+ g_warning ("could not allocate closure");
return NULL;
}
closure->writable_self = closure;
atypes);
if (status != FFI_OK)
{
- g_warning ("ffi_prep_cif failed: %d\n", status);
+ g_warning ("ffi_prep_cif failed: %d", status);
ffi_closure_free (closure);
return NULL;
}
status = ffi_prep_closure_loc (&closure->ffi_closure, cif, callback, user_data, exec_ptr);
if (status != FFI_OK)
{
- g_warning ("ffi_prep_closure failed: %d\n", status);
+ g_warning ("ffi_prep_closure failed: %d", status);
ffi_closure_free (closure);
return NULL;
}
* Returns: (transfer none): native address
* Since: 2.80
*/
-gpointer *
+void **
gi_callable_info_get_closure_native_address (GICallableInfo *callable_info,
ffi_closure *closure)
{
*/
typedef struct {
ffi_cif cif;
- gpointer native_address;
+ void *native_address;
/*< private >*/
- gpointer padding[3];
+ void *padding[3];
} GIFunctionInvoker;
/**
GError **error);
GI_AVAILABLE_IN_ALL
-gboolean gi_function_invoker_new_for_address (gpointer addr,
+gboolean gi_function_invoker_new_for_address (void *addr,
GICallableInfo *info,
GIFunctionInvoker *invoker,
GError **error);
ffi_closure * gi_callable_info_create_closure (GICallableInfo *callable_info,
ffi_cif *cif,
GIFFIClosureCallback callback,
- gpointer user_data);
+ void *user_data);
GI_AVAILABLE_IN_ALL
-gpointer * gi_callable_info_get_closure_native_address (GICallableInfo *callable_info,
+void ** gi_callable_info_get_closure_native_address (GICallableInfo *callable_info,
ffi_closure *closure);
GI_AVAILABLE_IN_ALL
GHashTable *strings;
GHashTable *types;
GList *nodes_with_attributes;
- guint32 n_attributes;
- guchar *data;
- GList *stack;
+ uint32_t n_attributes;
+ uint8_t *data;
+ GList *stack;
};
struct _GIIrModule
{
- gchar *name;
- gchar *version;
- gchar *shared_library;
- gchar *c_prefix;
+ char *name;
+ char *version;
+ char *shared_library;
+ char *c_prefix;
GList *dependencies;
GList *entries;
GHashTable *disguised_structures;
};
-GIIrModule *gi_ir_module_new (const gchar *name,
- const gchar *nsversion,
- const gchar *module_filename,
- const gchar *c_prefix);
+GIIrModule *gi_ir_module_new (const char *name,
+ const char *nsversion,
+ const char *module_filename,
+ const char *c_prefix);
void gi_ir_module_free (GIIrModule *module);
void gi_ir_module_add_include_module (GIIrModule *module,
GITypelib * gi_ir_module_build_typelib (GIIrModule *module);
-void gi_ir_module_fatal (GIIrTypelibBuild *build, guint line, const char *msg, ...) G_GNUC_PRINTF (3, 4) G_GNUC_NORETURN;
+void gi_ir_module_fatal (GIIrTypelibBuild *build,
+ unsigned int line,
+ const char *msg,
+ ...) G_GNUC_PRINTF (3, 4) G_GNUC_NORETURN;
void gi_ir_node_init_stats (void);
void gi_ir_node_dump_stats (void);
#define NUM_SECTIONS 2
GIIrModule *
-gi_ir_module_new (const gchar *name,
- const gchar *version,
- const gchar *shared_library,
- const gchar *c_prefix)
+gi_ir_module_new (const char *name,
+ const char *version,
+ const char *shared_library,
+ const char *c_prefix)
{
GIIrModule *module;
*/
void
gi_ir_module_fatal (GIIrTypelibBuild *build,
- guint line,
+ unsigned int line,
const char *msg,
...)
{
context = g_string_new ("");
if (line > 0)
- g_string_append_printf (context, "%d: ", line);
+ g_string_append_printf (context, "%u: ", line);
if (build->stack)
g_string_append (context, "In ");
for (link = g_list_last (build->stack); link; link = link->prev)
GIIrNode *node = link->data;
const char *name = node->name;
if (name)
- g_string_append (context, name);
+ g_string_append (context, name);
if (link->prev)
- g_string_append (context, ".");
+ g_string_append (context, ".");
}
if (build->stack)
g_string_append (context, ": ");
g_printerr ("%s-%s.gir:%serror: %s\n", build->module->name,
- build->module->version,
- context->str, formatted);
+ build->module->version,
+ context->str, formatted);
g_string_free (context, TRUE);
exit (1);
static void
add_alias_foreach (gpointer key,
- gpointer value,
- gpointer data)
+ gpointer value,
+ gpointer data)
{
GIIrModule *module = data;
static void
add_disguised_structure_foreach (gpointer key,
- gpointer value,
- gpointer data)
+ gpointer value,
+ gpointer data)
{
GIIrModule *module = data;
GIIrModule *include_module)
{
module->include_modules = g_list_prepend (module->include_modules,
- include_module);
+ include_module);
g_hash_table_foreach (include_module->aliases,
- add_alias_foreach,
- module);
+ add_alias_foreach,
+ module);
g_hash_table_foreach (include_module->pointer_structures,
- add_pointer_structure_foreach,
- module);
+ add_pointer_structure_foreach,
+ module);
g_hash_table_foreach (include_module->disguised_structures,
- add_disguised_structure_foreach,
- module);
+ add_disguised_structure_foreach,
+ module);
}
struct AttributeWriteData
{
- guint count;
- guchar *databuf;
+ unsigned int count;
+ uint8_t *databuf;
GIIrNode *node;
GHashTable *strings;
- guint32 *offset;
- guint32 *offset2;
+ uint32_t *offset;
+ uint32_t *offset2;
};
static void
write_attribute (gpointer key, gpointer value, gpointer datap)
{
struct AttributeWriteData *data = datap;
- guint32 old_offset = *(data->offset);
+ uint32_t old_offset = *(data->offset);
AttributeBlob *blob = (AttributeBlob*)&(data->databuf[old_offset]);
*(data->offset) += sizeof (AttributeBlob);
data->count++;
}
-static guint
+static unsigned
write_attributes (GIIrModule *module,
GIIrNode *node,
GHashTable *strings,
- guchar *data,
- guint32 *offset,
- guint32 *offset2)
+ uint8_t *data,
+ uint32_t *offset,
+ uint32_t *offset2)
{
struct AttributeWriteData wdata;
wdata.count = 0;
return wdata.count;
}
-static gint
-node_cmp_offset_func (gconstpointer a,
- gconstpointer b)
+static int
+node_cmp_offset_func (const void *a,
+ const void *b)
{
const GIIrNode *na = a;
const GIIrNode *nb = b;
}
static void
-alloc_section (guint8 *data, SectionType section_id, guint32 offset)
+alloc_section (uint8_t *data, SectionType section_id, uint32_t offset)
{
int i;
Header *header = (Header*)data;
for (i = 0; i < NUM_SECTIONS; i++)
{
if (section_data->id == GI_SECTION_END)
- {
- section_data->id = section_id;
- section_data->offset = offset;
- return;
- }
+ {
+ section_data->id = section_id;
+ section_data->offset = offset;
+ return;
+ }
section_data++;
}
g_assert_not_reached ();
}
-static guint8*
-add_directory_index_section (guint8 *data, GIIrModule *module, guint32 *offset2)
+static uint8_t *
+add_directory_index_section (uint8_t *data, GIIrModule *module, uint32_t *offset2)
{
DirEntry *entry;
Header *header = (Header*)data;
GITypelibHashBuilder *dirindex_builder;
- guint i, n_interfaces;
- guint16 required_size;
- guint32 new_offset;
+ uint16_t n_interfaces;
+ uint16_t required_size;
+ uint32_t new_offset;
dirindex_builder = gi_typelib_hash_builder_new ();
n_interfaces = ((Header *)data)->n_local_entries;
- for (i = 0; i < n_interfaces; i++)
+ for (uint16_t i = 0; i < n_interfaces; i++)
{
const char *str;
entry = (DirEntry *)&data[header->directory + (i * header->entry_blob_size)];
data = g_realloc (data, new_offset);
- gi_typelib_hash_builder_pack (dirindex_builder, ((guint8*)data) + *offset2, required_size);
+ gi_typelib_hash_builder_pack (dirindex_builder, ((uint8_t*)data) + *offset2, required_size);
*offset2 = new_offset;
{
GError *error = NULL;
GITypelib *typelib;
- gsize length;
- guint i;
+ size_t length;
+ size_t i;
GList *e;
Header *header;
DirEntry *entry;
- guint32 header_size;
- guint32 dir_size;
- guint32 n_entries;
- guint32 n_local_entries;
- guint32 size, offset, offset2, old_offset;
+ uint32_t header_size;
+ uint32_t dir_size;
+ uint32_t n_entries;
+ uint32_t n_local_entries;
+ uint32_t size, offset, offset2, old_offset;
GHashTable *strings;
GHashTable *types;
GList *nodes_with_attributes;
char *dependencies;
- guchar *data;
+ uint8_t *data;
Section *section;
header_size = ALIGN_VALUE (sizeof (Header), 4);
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, '|');
+ 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;
+ g_free (dependencies);
+ dependencies = NULL;
}
}
nodes_with_attributes = NULL;
n_entries = g_list_length (module->entries);
- g_message ("%d entries (%d local), %d dependencies\n", n_entries, n_local_entries,
- g_list_length (module->dependencies));
+ g_message ("%d entries (%d local), %d dependencies", n_entries, n_local_entries,
+ g_list_length (module->dependencies));
dir_size = n_entries * sizeof (DirEntry);
size = header_size + dir_size;
size += sizeof (Section) * NUM_SECTIONS;
- g_message ("allocating %d bytes (%d header, %d directory, %d entries)\n",
- size, header_size, dir_size, size - header_size - dir_size);
+ g_message ("allocating %d bytes (%d header, %d directory, %d entries)",
+ size, header_size, dir_size, size - header_size - dir_size);
data = g_malloc0 (size);
if (strchr (node->name, '.'))
{
- g_error ("Names may not contain '.'");
- }
+ g_error ("Names may not contain '.'");
+ }
/* we picked up implicit xref nodes, start over */
if (i == n_entries)
- {
- GList *link;
- g_message ("Found implicit cross references, starting over");
+ {
+ GList *link;
+ g_message ("Found implicit cross references, starting over");
- g_hash_table_destroy (strings);
- g_hash_table_destroy (types);
+ g_hash_table_destroy (strings);
+ g_hash_table_destroy (types);
- /* Reset the cached offsets */
- for (link = nodes_with_attributes; link; link = link->next)
- ((GIIrNode *) link->data)->offset = 0;
+ /* Reset the cached offsets */
+ for (link = nodes_with_attributes; link; link = link->next)
+ ((GIIrNode *) link->data)->offset = 0;
- g_list_free (nodes_with_attributes);
- strings = NULL;
+ g_list_free (nodes_with_attributes);
+ strings = NULL;
- g_free (data);
- data = NULL;
+ g_free (data);
+ data = NULL;
- goto restart;
- }
+ goto restart;
+ }
offset = offset2;
if (node->type == GI_IR_NODE_XREF)
- {
- const char *namespace = ((GIIrNodeXRef*)node)->namespace;
-
- entry->blob_type = 0;
- entry->local = FALSE;
- entry->offset = gi_ir_write_string (namespace, strings, data, &offset2);
- entry->name = gi_ir_write_string (node->name, strings, data, &offset2);
- }
+ {
+ const char *namespace = ((GIIrNodeXRef*)node)->namespace;
+
+ entry->blob_type = 0;
+ entry->local = FALSE;
+ entry->offset = gi_ir_write_string (namespace, strings, data, &offset2);
+ entry->name = gi_ir_write_string (node->name, strings, data, &offset2);
+ }
else
- {
- old_offset = offset;
- offset2 = offset + gi_ir_node_get_size (node);
-
- entry->blob_type = node->type;
- entry->local = TRUE;
- 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;
- build.nodes_with_attributes = nodes_with_attributes;
- build.n_attributes = header->n_attributes;
- build.data = data;
- gi_ir_node_build_typelib (node, NULL, &build, &offset, &offset2, NULL);
-
- nodes_with_attributes = build.nodes_with_attributes;
- header->n_attributes = build.n_attributes;
-
- if (offset2 > old_offset + gi_ir_node_get_full_size (node))
- g_error ("left a hole of %d bytes\n", offset2 - old_offset - gi_ir_node_get_full_size (node));
- }
+ {
+ old_offset = offset;
+ offset2 = offset + gi_ir_node_get_size (node);
+
+ entry->blob_type = node->type;
+ entry->local = TRUE;
+ 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;
+ build.nodes_with_attributes = nodes_with_attributes;
+ build.n_attributes = header->n_attributes;
+ build.data = data;
+ gi_ir_node_build_typelib (node, NULL, &build, &offset, &offset2, NULL);
+
+ nodes_with_attributes = build.nodes_with_attributes;
+ header->n_attributes = build.n_attributes;
+
+ if (offset2 > old_offset + gi_ir_node_get_full_size (node))
+ g_error ("left a hole of %d bytes", offset2 - old_offset - gi_ir_node_get_full_size (node));
+ }
entry++;
}
if (!typelib)
{
g_error ("error building typelib: %s",
- error->message);
+ error->message);
}
g_hash_table_destroy (strings);
GI_IR_NODE_XREF = 19
} GIIrNodeTypeId;
+/**
+ * GIIrOffsetsState:
+ * @GI_IR_OFFSETS_UNKNOWN: offsets have not been calculated yet
+ * @GI_IR_OFFSETS_COMPUTED: offsets have been successfully calculated
+ * @GI_IR_OFFSETS_FAILED: calculating the offsets failed
+ * @GI_IR_OFFSETS_IN_PROGRESS: offsets are currently being calculated (used to
+ * detect type recursion)
+ *
+ * State tracking for calculating size and alignment of
+ * [type@GIRepository.IrNode]s.
+ *
+ * Since: 2.80
+ */
+typedef enum
+{
+ GI_IR_OFFSETS_UNKNOWN,
+ GI_IR_OFFSETS_COMPUTED,
+ GI_IR_OFFSETS_FAILED,
+ GI_IR_OFFSETS_IN_PROGRESS,
+} GIIrOffsetsState;
+
struct _GIIrNode
{
GIIrNodeTypeId type;
- gchar *name;
+ char *name;
GIIrModule *module;
- guint32 offset; /* Assigned as we build the typelib */
+ uint32_t offset; /* Assigned as we build the typelib */
GHashTable *attributes;
};
{
GIIrNode node;
- gchar *namespace;
+ char *namespace;
};
struct _GIIrNodeFunction
{
GIIrNode node;
- gboolean deprecated;
- gboolean is_varargs; /* Not in typelib yet */
+ uint8_t deprecated : 1;
+ uint8_t is_varargs : 1; /* Not in typelib yet */
- gboolean is_method;
- gboolean is_setter;
- gboolean is_getter;
- gboolean is_constructor;
- gboolean wraps_vfunc;
- gboolean throws;
- gboolean instance_transfer_full;
+ uint8_t is_method : 1;
+ uint8_t is_setter : 1;
+ uint8_t is_getter : 1;
+ uint8_t is_constructor : 1;
+ uint8_t wraps_vfunc : 1;
+ uint8_t throws : 1;
+ uint8_t instance_transfer_full : 1;
- gchar *symbol;
+ char *symbol;
char *property;
GIIrNodeParam *result;
{
GIIrNode node;
- gboolean is_pointer;
- gboolean is_basic;
- gboolean is_array;
- gboolean is_glist;
- gboolean is_gslist;
- gboolean is_ghashtable;
- gboolean is_interface;
- gboolean is_error;
- gint tag;
-
- gchar *unparsed;
-
- gboolean zero_terminated;
- gboolean has_length;
- gint length;
- gboolean has_size;
- gint size;
- gint array_type;
+ uint8_t is_pointer : 1;
+ uint8_t is_basic : 1;
+ uint8_t is_array : 1;
+ uint8_t is_glist : 1;
+ uint8_t is_gslist : 1;
+ uint8_t is_ghashtable : 1;
+ uint8_t is_interface : 1;
+ uint8_t is_error : 1;
+ int tag;
+
+ char *unparsed;
+
+ uint8_t zero_terminated : 1;
+ uint8_t has_length : 1;
+ int length;
+ uint8_t has_size : 1;
+ int size;
+ int array_type;
GIIrNodeType *parameter_type1;
GIIrNodeType *parameter_type2;
- gchar *giinterface;
- gchar **errors;
+ char *giinterface;
+ char **errors;
};
struct _GIIrNodeParam
{
GIIrNode node;
- gboolean in;
- gboolean out;
- gboolean caller_allocates;
- gboolean optional;
- gboolean retval;
- gboolean nullable;
- gboolean skip;
- gboolean transfer;
- gboolean shallow_transfer;
- GIScopeType scope;
+ uint8_t in : 1;
+ uint8_t out : 1;
+ uint8_t caller_allocates : 1;
+ uint8_t optional : 1;
+ uint8_t retval : 1;
+ uint8_t nullable : 1;
+ uint8_t skip : 1;
+ uint8_t transfer : 1;
+ uint8_t shallow_transfer : 1;
+ GIScopeType scope : 3;
- gint8 closure;
- gint8 destroy;
+ int8_t closure;
+ int8_t destroy;
GIIrNodeType *type;
};
{
GIIrNode node;
- gboolean deprecated;
+ uint8_t deprecated : 1;
- gchar *name;
- gboolean readable;
- gboolean writable;
- gboolean construct;
- gboolean construct_only;
- gboolean transfer;
- gboolean shallow_transfer;
+ char *name;
+ uint8_t readable : 1;
+ uint8_t writable : 1;
+ uint8_t construct : 1;
+ uint8_t construct_only : 1;
+ uint8_t transfer : 1;
+ uint8_t shallow_transfer : 1;
char *setter;
char *getter;
{
GIIrNode node;
- gboolean deprecated;
+ uint8_t deprecated : 1;
- gboolean run_first;
- gboolean run_last;
- gboolean run_cleanup;
- gboolean no_recurse;
- gboolean detailed;
- gboolean action;
- gboolean no_hooks;
- gboolean instance_transfer_full;
+ uint8_t run_first : 1;
+ uint8_t run_last : 1;
+ uint8_t run_cleanup : 1;
+ uint8_t no_recurse : 1;
+ uint8_t detailed : 1;
+ uint8_t action : 1;
+ uint8_t no_hooks : 1;
+ uint8_t instance_transfer_full : 1;
- gboolean has_class_closure;
- gboolean true_stops_emit;
+ uint8_t has_class_closure : 1;
+ uint8_t true_stops_emit : 1;
- gint class_closure;
+ int class_closure;
GList *parameters;
GIIrNodeParam *result;
{
GIIrNode node;
- gboolean is_varargs; /* Not in typelib yet */
- gboolean must_chain_up;
- gboolean must_be_implemented;
- gboolean must_not_be_implemented;
- gboolean is_class_closure;
- gboolean throws;
- gboolean instance_transfer_full;
+ uint8_t is_varargs : 1; /* Not in typelib yet */
+ uint8_t must_chain_up : 1;
+ uint8_t must_be_implemented : 1;
+ uint8_t must_not_be_implemented : 1;
+ uint8_t is_class_closure : 1;
+ uint8_t throws : 1;
+ uint8_t instance_transfer_full : 1;
char *invoker;
GList *parameters;
GIIrNodeParam *result;
- gint offset;
+ int offset;
};
struct _GIIrNodeField
{
GIIrNode node;
- gboolean readable;
- gboolean writable;
- gint bits;
- gint offset;
+ uint8_t readable : 1;
+ uint8_t writable : 1;
+ int bits;
+ int offset;
GIIrNodeFunction *callback;
GIIrNodeType *type;
{
GIIrNode node;
- gboolean abstract;
- gboolean deprecated;
- gboolean fundamental;
- gboolean final_;
+ uint8_t abstract : 1;
+ uint8_t deprecated : 1;
+ uint8_t fundamental : 1;
+ uint8_t final_ : 1;
- gchar *gtype_name;
- gchar *gtype_init;
+ char *gtype_name;
+ char *gtype_init;
- gchar *ref_func;
- gchar *unref_func;
- gchar *set_value_func;
- gchar *get_value_func;
+ char *ref_func;
+ char *unref_func;
+ char *set_value_func;
+ char *get_value_func;
- gchar *parent;
- gchar *glib_type_struct;
+ char *parent;
+ char *glib_type_struct;
GList *interfaces;
GList *prerequisites;
- gint alignment;
- gint size;
+ size_t alignment;
+ size_t size;
+ GIIrOffsetsState offsets_state;
GList *members;
};
{
GIIrNode node;
- gboolean deprecated;
+ uint8_t deprecated : 1;
- gint64 value;
+ int64_t value;
};
struct _GIIrNodeConstant
{
GIIrNode node;
- gboolean deprecated;
+ uint8_t deprecated : 1;
GIIrNodeType *type;
- gchar *value;
+ char *value;
};
struct _GIIrNodeEnum
{
GIIrNode node;
- gboolean deprecated;
- gint storage_type;
+ uint8_t deprecated : 1;
+ int storage_type;
- gchar *gtype_name;
- gchar *gtype_init;
- gchar *error_domain;
+ char *gtype_name;
+ char *gtype_init;
+ char *error_domain;
GList *values;
GList *methods;
{
GIIrNode node;
- gboolean deprecated;
+ uint8_t deprecated : 1;
- gchar *gtype_name;
- gchar *gtype_init;
+ char *gtype_name;
+ char *gtype_init;
- gint alignment;
- gint size;
+ size_t alignment;
+ size_t size;
+ GIIrOffsetsState offsets_state;
GList *members;
};
{
GIIrNode node;
- gboolean deprecated;
- gboolean disguised;
- gboolean opaque;
- gboolean pointer;
- gboolean is_gtype_struct;
- gboolean foreign;
+ uint8_t deprecated : 1;
+ uint8_t disguised : 1;
+ uint8_t opaque : 1;
+ uint8_t pointer : 1;
+ uint8_t is_gtype_struct : 1;
+ uint8_t foreign : 1;
- gchar *gtype_name;
- gchar *gtype_init;
+ char *gtype_name;
+ char *gtype_init;
- gchar *copy_func;
- gchar *free_func;
+ char *copy_func;
+ char *free_func;
- gint alignment;
- gint size;
+ size_t alignment;
+ size_t size;
+ GIIrOffsetsState offsets_state;
GList *members;
};
{
GIIrNode node;
- gboolean deprecated;
+ uint8_t deprecated : 1;
GList *members;
GList *discriminators;
- gchar *gtype_name;
- gchar *gtype_init;
+ char *gtype_name;
+ char *gtype_init;
- gchar *copy_func;
- gchar *free_func;
+ char *copy_func;
+ char *free_func;
- gint alignment;
- gint size;
+ size_t alignment;
+ size_t size;
+ GIIrOffsetsState offsets_state;
- gint discriminator_offset;
+ int discriminator_offset;
GIIrNodeType *discriminator_type;
};
GIIrNode *gi_ir_node_new (GIIrNodeTypeId type,
GIIrModule *module);
void gi_ir_node_free (GIIrNode *node);
-guint32 gi_ir_node_get_size (GIIrNode *node);
-guint32 gi_ir_node_get_full_size (GIIrNode *node);
+uint32_t gi_ir_node_get_size (GIIrNode *node);
+uint32_t gi_ir_node_get_full_size (GIIrNode *node);
void gi_ir_node_build_typelib (GIIrNode *node,
GIIrNode *parent,
GIIrTypelibBuild *build,
- guint32 *offset,
- guint32 *offset2,
- guint16 *count2);
+ uint32_t *offset,
+ uint32_t *offset2,
+ uint16_t *count2);
int gi_ir_node_cmp (GIIrNode *node,
GIIrNode *other);
gboolean gi_ir_node_can_have_member (GIIrNode *node);
void gi_ir_node_add_member (GIIrNode *node,
GIIrNodeFunction *member);
-guint32 gi_ir_write_string (const gchar *str,
+uint32_t gi_ir_write_string (const char *str,
GHashTable *strings,
- guchar *data,
- guint32 *offset);
+ uint8_t *data,
+ uint32_t *offset);
-const gchar * gi_ir_node_param_direction_string (GIIrNodeParam * node);
-const gchar * gi_ir_node_type_to_string (GIIrNodeTypeId type);
+const char * gi_ir_node_param_direction_string (GIIrNodeParam * node);
+const char * gi_ir_node_type_to_string (GIIrNodeTypeId type);
GIIrNode *gi_ir_find_node (GIIrTypelibBuild *build,
GIIrModule *module,
gi_ir_node_dump_stats (void)
{
g_message ("%lu strings (%lu before sharing), %lu bytes (%lu before sharing)",
- unique_string_count, string_count, unique_string_size, string_size);
+ unique_string_count, string_count, unique_string_size, string_size);
g_message ("%lu types (%lu before sharing)", unique_types_count, types_count);
}
#define DO_ALIGNED_COPY(dest_addr, value, type) \
do { \
- type tmp_var; \
- tmp_var = value; \
- memcpy(dest_addr, &tmp_var, sizeof(type)); \
+ type tmp_var; \
+ tmp_var = value; \
+ memcpy(dest_addr, &tmp_var, sizeof(type)); \
} while(0)
#define ALIGN_VALUE(this, boundary) \
(( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
-const gchar *
+const char *
gi_ir_node_type_to_string (GIIrNodeTypeId type)
{
switch (type)
break;
default:
- g_error ("Unhandled node type %d\n", type);
+ g_error ("Unhandled node type %d", type);
break;
}
case GI_IR_NODE_FUNCTION:
case GI_IR_NODE_CALLBACK:
{
- GIIrNodeFunction *function = (GIIrNodeFunction *)node;
+ GIIrNodeFunction *function = (GIIrNodeFunction *)node;
- g_free (node->name);
- g_free (function->symbol);
+ g_free (node->name);
+ g_free (function->symbol);
g_free (function->property);
- gi_ir_node_free ((GIIrNode *)function->result);
- for (l = function->parameters; l; l = l->next)
- gi_ir_node_free ((GIIrNode *)l->data);
- g_list_free (function->parameters);
+ gi_ir_node_free ((GIIrNode *)function->result);
+ for (l = function->parameters; l; l = l->next)
+ gi_ir_node_free ((GIIrNode *)l->data);
+ g_list_free (function->parameters);
}
break;
case GI_IR_NODE_TYPE:
{
- GIIrNodeType *type = (GIIrNodeType *)node;
+ GIIrNodeType *type = (GIIrNodeType *)node;
- g_free (node->name);
- gi_ir_node_free ((GIIrNode *)type->parameter_type1);
- gi_ir_node_free ((GIIrNode *)type->parameter_type2);
+ g_free (node->name);
+ gi_ir_node_free ((GIIrNode *)type->parameter_type1);
+ gi_ir_node_free ((GIIrNode *)type->parameter_type2);
- g_free (type->giinterface);
- g_strfreev (type->errors);
+ g_free (type->giinterface);
+ g_strfreev (type->errors);
}
break;
case GI_IR_NODE_PARAM:
{
- GIIrNodeParam *param = (GIIrNodeParam *)node;
+ GIIrNodeParam *param = (GIIrNodeParam *)node;
- g_free (node->name);
- gi_ir_node_free ((GIIrNode *)param->type);
+ g_free (node->name);
+ gi_ir_node_free ((GIIrNode *)param->type);
}
break;
case GI_IR_NODE_PROPERTY:
{
- GIIrNodeProperty *property = (GIIrNodeProperty *)node;
+ GIIrNodeProperty *property = (GIIrNodeProperty *)node;
- g_free (node->name);
+ g_free (node->name);
g_free (property->setter);
g_free (property->getter);
- gi_ir_node_free ((GIIrNode *)property->type);
+ gi_ir_node_free ((GIIrNode *)property->type);
}
break;
case GI_IR_NODE_SIGNAL:
{
- GIIrNodeSignal *signal = (GIIrNodeSignal *)node;
+ GIIrNodeSignal *signal = (GIIrNodeSignal *)node;
- g_free (node->name);
- for (l = signal->parameters; l; l = l->next)
- gi_ir_node_free ((GIIrNode *)l->data);
- g_list_free (signal->parameters);
- gi_ir_node_free ((GIIrNode *)signal->result);
+ g_free (node->name);
+ for (l = signal->parameters; l; l = l->next)
+ gi_ir_node_free ((GIIrNode *)l->data);
+ g_list_free (signal->parameters);
+ gi_ir_node_free ((GIIrNode *)signal->result);
}
break;
case GI_IR_NODE_VFUNC:
{
- GIIrNodeVFunc *vfunc = (GIIrNodeVFunc *)node;
-
- g_free (node->name);
- g_free (vfunc->invoker);
- for (l = vfunc->parameters; l; l = l->next)
- gi_ir_node_free ((GIIrNode *)l->data);
- g_list_free (vfunc->parameters);
- gi_ir_node_free ((GIIrNode *)vfunc->result);
+ GIIrNodeVFunc *vfunc = (GIIrNodeVFunc *)node;
+
+ g_free (node->name);
+ g_free (vfunc->invoker);
+ for (l = vfunc->parameters; l; l = l->next)
+ gi_ir_node_free ((GIIrNode *)l->data);
+ g_list_free (vfunc->parameters);
+ gi_ir_node_free ((GIIrNode *)vfunc->result);
}
break;
case GI_IR_NODE_FIELD:
{
- GIIrNodeField *field = (GIIrNodeField *)node;
+ GIIrNodeField *field = (GIIrNodeField *)node;
- g_free (node->name);
- gi_ir_node_free ((GIIrNode *)field->type);
- gi_ir_node_free ((GIIrNode *)field->callback);
+ g_free (node->name);
+ gi_ir_node_free ((GIIrNode *)field->type);
+ gi_ir_node_free ((GIIrNode *)field->callback);
}
break;
case GI_IR_NODE_OBJECT:
case GI_IR_NODE_INTERFACE:
{
- GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
+ GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
- g_free (node->name);
- g_free (iface->gtype_name);
- g_free (iface->gtype_init);
- g_free (iface->ref_func);
- g_free (iface->unref_func);
- g_free (iface->set_value_func);
- g_free (iface->get_value_func);
+ g_free (node->name);
+ g_free (iface->gtype_name);
+ g_free (iface->gtype_init);
+ g_free (iface->ref_func);
+ g_free (iface->unref_func);
+ g_free (iface->set_value_func);
+ g_free (iface->get_value_func);
- g_free (iface->glib_type_struct);
- g_free (iface->parent);
+ g_free (iface->glib_type_struct);
+ g_free (iface->parent);
- for (l = iface->interfaces; l; l = l->next)
- g_free ((GIIrNode *)l->data);
- g_list_free (iface->interfaces);
+ for (l = iface->interfaces; l; l = l->next)
+ g_free ((GIIrNode *)l->data);
+ g_list_free (iface->interfaces);
- for (l = iface->members; l; l = l->next)
- gi_ir_node_free ((GIIrNode *)l->data);
- g_list_free (iface->members);
+ for (l = iface->members; l; l = l->next)
+ gi_ir_node_free ((GIIrNode *)l->data);
+ g_list_free (iface->members);
}
break;
case GI_IR_NODE_VALUE:
{
- g_free (node->name);
+ g_free (node->name);
}
break;
case GI_IR_NODE_ENUM:
case GI_IR_NODE_FLAGS:
{
- GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node;
+ GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node;
- g_free (node->name);
- g_free (enum_->gtype_name);
- g_free (enum_->gtype_init);
- g_free (enum_->error_domain);
+ g_free (node->name);
+ g_free (enum_->gtype_name);
+ g_free (enum_->gtype_init);
+ g_free (enum_->error_domain);
- for (l = enum_->values; l; l = l->next)
- gi_ir_node_free ((GIIrNode *)l->data);
- g_list_free (enum_->values);
+ for (l = enum_->values; l; l = l->next)
+ gi_ir_node_free ((GIIrNode *)l->data);
+ g_list_free (enum_->values);
- for (l = enum_->methods; l; l = l->next)
- gi_ir_node_free ((GIIrNode *)l->data);
- g_list_free (enum_->methods);
+ for (l = enum_->methods; l; l = l->next)
+ gi_ir_node_free ((GIIrNode *)l->data);
+ g_list_free (enum_->methods);
}
break;
case GI_IR_NODE_BOXED:
{
- GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
+ GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
- g_free (node->name);
- g_free (boxed->gtype_name);
- g_free (boxed->gtype_init);
+ g_free (node->name);
+ g_free (boxed->gtype_name);
+ g_free (boxed->gtype_init);
- for (l = boxed->members; l; l = l->next)
- gi_ir_node_free ((GIIrNode *)l->data);
- g_list_free (boxed->members);
+ for (l = boxed->members; l; l = l->next)
+ gi_ir_node_free ((GIIrNode *)l->data);
+ g_list_free (boxed->members);
}
break;
case GI_IR_NODE_STRUCT:
{
- GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
+ GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
- g_free (node->name);
- g_free (struct_->gtype_name);
- g_free (struct_->gtype_init);
+ g_free (node->name);
+ g_free (struct_->gtype_name);
+ g_free (struct_->gtype_init);
g_free (struct_->copy_func);
g_free (struct_->free_func);
- for (l = struct_->members; l; l = l->next)
- gi_ir_node_free ((GIIrNode *)l->data);
- g_list_free (struct_->members);
+ for (l = struct_->members; l; l = l->next)
+ gi_ir_node_free ((GIIrNode *)l->data);
+ g_list_free (struct_->members);
}
break;
case GI_IR_NODE_CONSTANT:
{
- GIIrNodeConstant *constant = (GIIrNodeConstant *)node;
+ GIIrNodeConstant *constant = (GIIrNodeConstant *)node;
- g_free (node->name);
- g_free (constant->value);
- gi_ir_node_free ((GIIrNode *)constant->type);
+ g_free (node->name);
+ g_free (constant->value);
+ gi_ir_node_free ((GIIrNode *)constant->type);
}
break;
case GI_IR_NODE_XREF:
{
- GIIrNodeXRef *xref = (GIIrNodeXRef *)node;
+ GIIrNodeXRef *xref = (GIIrNodeXRef *)node;
- g_free (node->name);
- g_free (xref->namespace);
+ g_free (node->name);
+ g_free (xref->namespace);
}
break;
case GI_IR_NODE_UNION:
{
- GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
+ GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
- g_free (node->name);
- g_free (union_->gtype_name);
- g_free (union_->gtype_init);
+ g_free (node->name);
+ g_free (union_->gtype_name);
+ g_free (union_->gtype_init);
g_free (union_->copy_func);
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);
+ 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);
}
break;
default:
- g_error ("Unhandled node type %d\n", node->type);
+ g_error ("Unhandled node type %d", node->type);
break;
}
}
/* returns the fixed size of the blob */
-guint32
+uint32_t
gi_ir_node_get_size (GIIrNode *node)
{
GList *l;
- gint size, n;
+ size_t size, n;
switch (node->type)
{
case GI_IR_NODE_OBJECT:
{
- GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
+ GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
- n = g_list_length (iface->interfaces);
- size = sizeof (ObjectBlob) + 2 * (n + (n % 2));
+ n = g_list_length (iface->interfaces);
+ size = sizeof (ObjectBlob) + 2 * (n + (n % 2));
- for (l = iface->members; l; l = l->next)
- size += gi_ir_node_get_size ((GIIrNode *)l->data);
+ for (l = iface->members; l; l = l->next)
+ size += gi_ir_node_get_size ((GIIrNode *)l->data);
}
break;
case GI_IR_NODE_INTERFACE:
{
- GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
+ GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
- n = g_list_length (iface->prerequisites);
- size = sizeof (InterfaceBlob) + 2 * (n + (n % 2));
+ n = g_list_length (iface->prerequisites);
+ size = sizeof (InterfaceBlob) + 2 * (n + (n % 2));
- for (l = iface->members; l; l = l->next)
- size += gi_ir_node_get_size ((GIIrNode *)l->data);
+ for (l = iface->members; l; l = l->next)
+ size += gi_ir_node_get_size ((GIIrNode *)l->data);
}
break;
case GI_IR_NODE_ENUM:
case GI_IR_NODE_FLAGS:
{
- GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node;
+ GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node;
- size = sizeof (EnumBlob);
- for (l = enum_->values; l; l = l->next)
- size += gi_ir_node_get_size ((GIIrNode *)l->data);
- for (l = enum_->methods; l; l = l->next)
- size += gi_ir_node_get_size ((GIIrNode *)l->data);
+ size = sizeof (EnumBlob);
+ for (l = enum_->values; l; l = l->next)
+ size += gi_ir_node_get_size ((GIIrNode *)l->data);
+ for (l = enum_->methods; l; l = l->next)
+ size += gi_ir_node_get_size ((GIIrNode *)l->data);
}
break;
case GI_IR_NODE_STRUCT:
{
- GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
+ GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
- size = sizeof (StructBlob);
- for (l = struct_->members; l; l = l->next)
- size += gi_ir_node_get_size ((GIIrNode *)l->data);
+ size = sizeof (StructBlob);
+ for (l = struct_->members; l; l = l->next)
+ size += gi_ir_node_get_size ((GIIrNode *)l->data);
}
break;
case GI_IR_NODE_BOXED:
{
- GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
+ GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
- size = sizeof (StructBlob);
- for (l = boxed->members; l; l = l->next)
- size += gi_ir_node_get_size ((GIIrNode *)l->data);
+ size = sizeof (StructBlob);
+ for (l = boxed->members; l; l = l->next)
+ size += gi_ir_node_get_size ((GIIrNode *)l->data);
}
break;
case GI_IR_NODE_FIELD:
{
- GIIrNodeField *field = (GIIrNodeField *)node;
+ GIIrNodeField *field = (GIIrNodeField *)node;
size = sizeof (FieldBlob);
if (field->callback)
case GI_IR_NODE_UNION:
{
- GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
+ GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
- size = sizeof (UnionBlob);
- for (l = union_->members; l; l = l->next)
- size += gi_ir_node_get_size ((GIIrNode *)l->data);
- for (l = union_->discriminators; l; l = l->next)
- size += gi_ir_node_get_size ((GIIrNode *)l->data);
+ size = sizeof (UnionBlob);
+ for (l = union_->members; l; l = l->next)
+ size += gi_ir_node_get_size ((GIIrNode *)l->data);
+ for (l = union_->discriminators; l; l = l->next)
+ size += gi_ir_node_get_size ((GIIrNode *)l->data);
}
break;
default:
- g_error ("Unhandled node type '%s'\n",
- gi_ir_node_type_to_string (node->type));
+ g_error ("Unhandled node type '%s'", gi_ir_node_type_to_string (node->type));
size = 0;
}
- g_debug ("node %p type '%s' size %d", node,
- gi_ir_node_type_to_string (node->type), size);
+ g_debug ("node %p type '%s' size %zu", node,
+ gi_ir_node_type_to_string (node->type), size);
+
+ g_assert (size <= G_MAXUINT32);
return size;
}
static void
add_attribute_size (gpointer key, gpointer value, gpointer data)
{
- const gchar *key_str = key;
- const gchar *value_str = value;
- gint *size_p = data;
+ const char *key_str = key;
+ const char *value_str = value;
+ size_t *size_p = data;
*size_p += sizeof (AttributeBlob);
*size_p += ALIGN_VALUE (strlen (key_str) + 1, 4);
}
/* returns the full size of the blob including variable-size parts (including attributes) */
-static guint32
+static uint32_t
gi_ir_node_get_full_size_internal (GIIrNode *parent,
GIIrNode *node)
{
GList *l;
- gint size, n;
+ size_t size, n;
if (node == NULL && parent != NULL)
g_error ("Caught NULL node, parent=%s", parent->name);
g_debug ("node %p type '%s'", node,
- gi_ir_node_type_to_string (node->type));
+ gi_ir_node_type_to_string (node->type));
switch (node->type)
{
case GI_IR_NODE_CALLBACK:
{
- GIIrNodeFunction *function = (GIIrNodeFunction *)node;
- size = sizeof (CallbackBlob);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- for (l = function->parameters; l; l = l->next)
- {
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
- }
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)function->result);
+ GIIrNodeFunction *function = (GIIrNodeFunction *)node;
+ size = sizeof (CallbackBlob);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ for (l = function->parameters; l; l = l->next)
+ {
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
+ }
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)function->result);
}
break;
case GI_IR_NODE_FUNCTION:
{
- GIIrNodeFunction *function = (GIIrNodeFunction *)node;
- size = sizeof (FunctionBlob);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- size += ALIGN_VALUE (strlen (function->symbol) + 1, 4);
- for (l = function->parameters; l; l = l->next)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)function->result);
+ GIIrNodeFunction *function = (GIIrNodeFunction *)node;
+ size = sizeof (FunctionBlob);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ size += ALIGN_VALUE (strlen (function->symbol) + 1, 4);
+ for (l = function->parameters; l; l = l->next)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)function->result);
}
break;
case GI_IR_NODE_PARAM:
{
- GIIrNodeParam *param = (GIIrNodeParam *)node;
+ GIIrNodeParam *param = (GIIrNodeParam *)node;
- /* See the comment in the GI_IR_NODE_PARAM/ArgBlob writing below */
- size = sizeof (ArgBlob) - sizeof (SimpleTypeBlob);
- if (node->name)
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)param->type);
+ /* See the comment in the GI_IR_NODE_PARAM/ArgBlob writing below */
+ size = sizeof (ArgBlob) - sizeof (SimpleTypeBlob);
+ if (node->name)
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)param->type);
}
break;
case GI_IR_NODE_TYPE:
{
- GIIrNodeType *type = (GIIrNodeType *)node;
+ GIIrNodeType *type = (GIIrNodeType *)node;
size = sizeof (SimpleTypeBlob);
if (!GI_TYPE_TAG_IS_BASIC (type->tag))
- {
- g_debug ("node %p type tag '%s'", node,
- gi_type_tag_to_string (type->tag));
-
- switch (type->tag)
- {
- case GI_TYPE_TAG_ARRAY:
- size = sizeof (ArrayTypeBlob);
- if (type->parameter_type1)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)type->parameter_type1);
- break;
- case GI_TYPE_TAG_INTERFACE:
- size += sizeof (InterfaceTypeBlob);
- break;
- case GI_TYPE_TAG_GLIST:
- case GI_TYPE_TAG_GSLIST:
- size += sizeof (ParamTypeBlob);
- if (type->parameter_type1)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)type->parameter_type1);
- break;
- case GI_TYPE_TAG_GHASH:
- size += sizeof (ParamTypeBlob) * 2;
- if (type->parameter_type1)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)type->parameter_type1);
- if (type->parameter_type2)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)type->parameter_type2);
- break;
- case GI_TYPE_TAG_ERROR:
- size += sizeof (ErrorTypeBlob);
- break;
- default:
- g_error ("Unknown type tag %d\n", type->tag);
- break;
- }
- }
+ {
+ g_debug ("node %p type tag '%s'", node,
+ gi_type_tag_to_string (type->tag));
+
+ switch (type->tag)
+ {
+ case GI_TYPE_TAG_ARRAY:
+ size = sizeof (ArrayTypeBlob);
+ if (type->parameter_type1)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)type->parameter_type1);
+ break;
+ case GI_TYPE_TAG_INTERFACE:
+ size += sizeof (InterfaceTypeBlob);
+ break;
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
+ size += sizeof (ParamTypeBlob);
+ if (type->parameter_type1)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)type->parameter_type1);
+ break;
+ case GI_TYPE_TAG_GHASH:
+ size += sizeof (ParamTypeBlob) * 2;
+ if (type->parameter_type1)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)type->parameter_type1);
+ if (type->parameter_type2)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)type->parameter_type2);
+ break;
+ case GI_TYPE_TAG_ERROR:
+ size += sizeof (ErrorTypeBlob);
+ break;
+ default:
+ g_error ("Unknown type tag %d", type->tag);
+ break;
+ }
+ }
}
break;
case GI_IR_NODE_OBJECT:
{
- GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
+ GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
- n = g_list_length (iface->interfaces);
- size = sizeof(ObjectBlob);
- if (iface->parent)
- size += ALIGN_VALUE (strlen (iface->parent) + 1, 4);
+ n = g_list_length (iface->interfaces);
+ size = sizeof(ObjectBlob);
+ if (iface->parent)
+ size += ALIGN_VALUE (strlen (iface->parent) + 1, 4);
if (iface->glib_type_struct)
size += ALIGN_VALUE (strlen (iface->glib_type_struct) + 1, 4);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- size += ALIGN_VALUE (strlen (iface->gtype_name) + 1, 4);
- if (iface->gtype_init)
- size += ALIGN_VALUE (strlen (iface->gtype_init) + 1, 4);
- if (iface->ref_func)
- size += ALIGN_VALUE (strlen (iface->ref_func) + 1, 4);
- if (iface->unref_func)
- size += ALIGN_VALUE (strlen (iface->unref_func) + 1, 4);
- if (iface->set_value_func)
- size += ALIGN_VALUE (strlen (iface->set_value_func) + 1, 4);
- if (iface->get_value_func)
- size += ALIGN_VALUE (strlen (iface->get_value_func) + 1, 4);
- size += 2 * (n + (n % 2));
-
- for (l = iface->members; l; l = l->next)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ size += ALIGN_VALUE (strlen (iface->gtype_name) + 1, 4);
+ if (iface->gtype_init)
+ size += ALIGN_VALUE (strlen (iface->gtype_init) + 1, 4);
+ if (iface->ref_func)
+ size += ALIGN_VALUE (strlen (iface->ref_func) + 1, 4);
+ if (iface->unref_func)
+ size += ALIGN_VALUE (strlen (iface->unref_func) + 1, 4);
+ if (iface->set_value_func)
+ size += ALIGN_VALUE (strlen (iface->set_value_func) + 1, 4);
+ if (iface->get_value_func)
+ size += ALIGN_VALUE (strlen (iface->get_value_func) + 1, 4);
+ size += 2 * (n + (n % 2));
+
+ for (l = iface->members; l; l = l->next)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
}
break;
case GI_IR_NODE_INTERFACE:
{
- GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
+ GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
- n = g_list_length (iface->prerequisites);
- size = sizeof (InterfaceBlob);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- size += ALIGN_VALUE (strlen (iface->gtype_name) + 1, 4);
- size += ALIGN_VALUE (strlen (iface->gtype_init) + 1, 4);
- size += 2 * (n + (n % 2));
+ n = g_list_length (iface->prerequisites);
+ size = sizeof (InterfaceBlob);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ size += ALIGN_VALUE (strlen (iface->gtype_name) + 1, 4);
+ size += ALIGN_VALUE (strlen (iface->gtype_init) + 1, 4);
+ size += 2 * (n + (n % 2));
- for (l = iface->members; l; l = l->next)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
+ for (l = iface->members; l; l = l->next)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
}
break;
case GI_IR_NODE_ENUM:
case GI_IR_NODE_FLAGS:
{
- GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node;
-
- size = sizeof (EnumBlob);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- if (enum_->gtype_name)
- {
- size += ALIGN_VALUE (strlen (enum_->gtype_name) + 1, 4);
- size += ALIGN_VALUE (strlen (enum_->gtype_init) + 1, 4);
- }
- if (enum_->error_domain)
- size += ALIGN_VALUE (strlen (enum_->error_domain) + 1, 4);
-
- for (l = enum_->values; l; l = l->next)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
- for (l = enum_->methods; l; l = l->next)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
+ GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node;
+
+ size = sizeof (EnumBlob);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ if (enum_->gtype_name)
+ {
+ size += ALIGN_VALUE (strlen (enum_->gtype_name) + 1, 4);
+ size += ALIGN_VALUE (strlen (enum_->gtype_init) + 1, 4);
+ }
+ if (enum_->error_domain)
+ size += ALIGN_VALUE (strlen (enum_->error_domain) + 1, 4);
+
+ for (l = enum_->values; l; l = l->next)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
+ for (l = enum_->methods; l; l = l->next)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
}
break;
case GI_IR_NODE_VALUE:
{
- size = sizeof (ValueBlob);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ size = sizeof (ValueBlob);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
}
break;
case GI_IR_NODE_STRUCT:
{
- GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
-
- size = sizeof (StructBlob);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- if (struct_->gtype_name)
- size += ALIGN_VALUE (strlen (struct_->gtype_name) + 1, 4);
- if (struct_->gtype_init)
- size += ALIGN_VALUE (strlen (struct_->gtype_init) + 1, 4);
- if (struct_->copy_func)
- size += ALIGN_VALUE (strlen (struct_->copy_func) + 1, 4);
- if (struct_->free_func)
- size += ALIGN_VALUE (strlen (struct_->free_func) + 1, 4);
- for (l = struct_->members; l; l = l->next)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
+ GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
+
+ size = sizeof (StructBlob);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ if (struct_->gtype_name)
+ size += ALIGN_VALUE (strlen (struct_->gtype_name) + 1, 4);
+ if (struct_->gtype_init)
+ size += ALIGN_VALUE (strlen (struct_->gtype_init) + 1, 4);
+ if (struct_->copy_func)
+ size += ALIGN_VALUE (strlen (struct_->copy_func) + 1, 4);
+ if (struct_->free_func)
+ size += ALIGN_VALUE (strlen (struct_->free_func) + 1, 4);
+ for (l = struct_->members; l; l = l->next)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
}
break;
case GI_IR_NODE_BOXED:
{
- GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
-
- size = sizeof (StructBlob);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- if (boxed->gtype_name)
- {
- size += ALIGN_VALUE (strlen (boxed->gtype_name) + 1, 4);
- size += ALIGN_VALUE (strlen (boxed->gtype_init) + 1, 4);
- }
- for (l = boxed->members; l; l = l->next)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
+ GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
+
+ size = sizeof (StructBlob);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ if (boxed->gtype_name)
+ {
+ size += ALIGN_VALUE (strlen (boxed->gtype_name) + 1, 4);
+ size += ALIGN_VALUE (strlen (boxed->gtype_init) + 1, 4);
+ }
+ for (l = boxed->members; l; l = l->next)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
}
break;
case GI_IR_NODE_PROPERTY:
{
- GIIrNodeProperty *prop = (GIIrNodeProperty *)node;
+ GIIrNodeProperty *prop = (GIIrNodeProperty *)node;
- size = sizeof (PropertyBlob);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)prop->type);
+ size = sizeof (PropertyBlob);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)prop->type);
}
break;
case GI_IR_NODE_SIGNAL:
{
- GIIrNodeSignal *signal = (GIIrNodeSignal *)node;
+ GIIrNodeSignal *signal = (GIIrNodeSignal *)node;
- size = sizeof (SignalBlob);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- for (l = signal->parameters; l; l = l->next)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)signal->result);
+ size = sizeof (SignalBlob);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ for (l = signal->parameters; l; l = l->next)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)signal->result);
}
break;
case GI_IR_NODE_VFUNC:
{
- GIIrNodeVFunc *vfunc = (GIIrNodeVFunc *)node;
+ GIIrNodeVFunc *vfunc = (GIIrNodeVFunc *)node;
- size = sizeof (VFuncBlob);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- for (l = vfunc->parameters; l; l = l->next)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)vfunc->result);
+ size = sizeof (VFuncBlob);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ for (l = vfunc->parameters; l; l = l->next)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)vfunc->result);
}
break;
case GI_IR_NODE_FIELD:
{
- GIIrNodeField *field = (GIIrNodeField *)node;
+ GIIrNodeField *field = (GIIrNodeField *)node;
- size = sizeof (FieldBlob);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- if (field->callback)
+ size = sizeof (FieldBlob);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ if (field->callback)
size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)field->callback);
- else
+ else
size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)field->type);
}
break;
case GI_IR_NODE_CONSTANT:
{
- GIIrNodeConstant *constant = (GIIrNodeConstant *)node;
+ GIIrNodeConstant *constant = (GIIrNodeConstant *)node;
- size = sizeof (ConstantBlob);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- /* FIXME non-string values */
- size += ALIGN_VALUE (strlen (constant->value) + 1, 4);
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)constant->type);
+ size = sizeof (ConstantBlob);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ /* FIXME non-string values */
+ size += ALIGN_VALUE (strlen (constant->value) + 1, 4);
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)constant->type);
}
break;
case GI_IR_NODE_XREF:
{
- GIIrNodeXRef *xref = (GIIrNodeXRef *)node;
+ GIIrNodeXRef *xref = (GIIrNodeXRef *)node;
- size = 0;
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- size += ALIGN_VALUE (strlen (xref->namespace) + 1, 4);
+ size = 0;
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ size += ALIGN_VALUE (strlen (xref->namespace) + 1, 4);
}
break;
case GI_IR_NODE_UNION:
{
- GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
-
- size = sizeof (UnionBlob);
- size += ALIGN_VALUE (strlen (node->name) + 1, 4);
- if (union_->gtype_name)
- size += ALIGN_VALUE (strlen (union_->gtype_name) + 1, 4);
- if (union_->gtype_init)
- size += ALIGN_VALUE (strlen (union_->gtype_init) + 1, 4);
- if (union_->copy_func)
- size += ALIGN_VALUE (strlen (union_->copy_func) + 1, 4);
- if (union_->free_func)
- size += ALIGN_VALUE (strlen (union_->free_func) + 1, 4);
- for (l = union_->members; l; l = l->next)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
- for (l = union_->discriminators; l; l = l->next)
- size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
+ GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
+
+ size = sizeof (UnionBlob);
+ size += ALIGN_VALUE (strlen (node->name) + 1, 4);
+ if (union_->gtype_name)
+ size += ALIGN_VALUE (strlen (union_->gtype_name) + 1, 4);
+ if (union_->gtype_init)
+ size += ALIGN_VALUE (strlen (union_->gtype_init) + 1, 4);
+ if (union_->copy_func)
+ size += ALIGN_VALUE (strlen (union_->copy_func) + 1, 4);
+ if (union_->free_func)
+ size += ALIGN_VALUE (strlen (union_->free_func) + 1, 4);
+ for (l = union_->members; l; l = l->next)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
+ for (l = union_->discriminators; l; l = l->next)
+ size += gi_ir_node_get_full_size_internal (node, (GIIrNode *)l->data);
}
break;
default:
- g_error ("Unknown type tag %d\n", node->type);
+ g_error ("Unknown type tag %d", node->type);
size = 0;
}
- g_debug ("node %s%s%s%p type '%s' full size %d",
- node->name ? "'" : "",
- node->name ? node->name : "",
- node->name ? "' " : "",
- node, gi_ir_node_type_to_string (node->type), size);
+ g_debug ("node %s%s%s%p type '%s' full size %zu",
+ node->name ? "'" : "",
+ node->name ? node->name : "",
+ node->name ? "' " : "",
+ node, gi_ir_node_type_to_string (node->type), size);
g_hash_table_foreach (node->attributes, add_attribute_size, &size);
+ g_assert (size <= G_MAXUINT32);
+
return size;
}
-guint32
+uint32_t
gi_ir_node_get_full_size (GIIrNode *node)
{
return gi_ir_node_get_full_size_internal (NULL, node);
case GI_IR_NODE_OBJECT:
case GI_IR_NODE_INTERFACE:
{
- GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
- iface->members =
- g_list_insert_sorted (iface->members, member,
- (GCompareFunc) gi_ir_node_cmp);
- break;
+ GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
+ iface->members =
+ g_list_insert_sorted (iface->members, member,
+ (GCompareFunc) gi_ir_node_cmp);
+ break;
}
case GI_IR_NODE_BOXED:
{
- GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
- boxed->members =
- g_list_insert_sorted (boxed->members, member,
- (GCompareFunc) gi_ir_node_cmp);
- break;
+ GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
+ boxed->members =
+ g_list_insert_sorted (boxed->members, member,
+ (GCompareFunc) gi_ir_node_cmp);
+ break;
}
case GI_IR_NODE_STRUCT:
{
- GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
- struct_->members =
- g_list_insert_sorted (struct_->members, member,
- (GCompareFunc) gi_ir_node_cmp);
- break;
+ GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
+ struct_->members =
+ g_list_insert_sorted (struct_->members, member,
+ (GCompareFunc) gi_ir_node_cmp);
+ break;
}
case GI_IR_NODE_UNION:
{
- GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
- union_->members =
- g_list_insert_sorted (union_->members, member,
- (GCompareFunc) gi_ir_node_cmp);
- break;
+ GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
+ union_->members =
+ g_list_insert_sorted (union_->members, member,
+ (GCompareFunc) gi_ir_node_cmp);
+ break;
}
default:
- g_error ("Cannot add a member to unknown type tag type %d\n",
- node->type);
+ g_error ("Cannot add a member to unknown type tag type %d",
+ node->type);
break;
}
}
-const gchar *
+const char *
gi_ir_node_param_direction_string (GIIrNodeParam * node)
{
if (node->out)
{
if (node->in)
- return "in-out";
+ return "in-out";
else
- return "out";
+ return "out";
}
return "in";
}
-static gint64
-parse_int_value (const gchar *str)
+static int64_t
+parse_int_value (const char *str)
{
return g_ascii_strtoll (str, NULL, 0);
}
-static guint64
-parse_uint_value (const gchar *str)
+static uint64_t
+parse_uint_value (const char *str)
{
return g_ascii_strtoull (str, NULL, 0);
}
-static gdouble
-parse_float_value (const gchar *str)
+static double
+parse_float_value (const char *str)
{
return g_ascii_strtod (str, NULL);
}
static gboolean
-parse_boolean_value (const gchar *str)
+parse_boolean_value (const char *str)
{
if (g_ascii_strcasecmp (str, "TRUE") == 0)
return TRUE;
static GIIrNode *
find_entry_node (GIIrTypelibBuild *build,
- const gchar *name,
- guint16 *idx)
+ const char *name,
+ uint16_t *idx)
{
GIIrModule *module = build->module;
GList *l;
- gint i;
- gchar **names;
- gint n_names;
+ size_t i;
+ unsigned int n_names;
+ char **names;
GIIrNode *result = NULL;
g_assert (name != NULL);
GIIrNode *node = (GIIrNode *)l->data;
if (n_names > 1)
- {
- if (node->type != GI_IR_NODE_XREF)
- continue;
+ {
+ if (node->type != GI_IR_NODE_XREF)
+ continue;
- if (((GIIrNodeXRef *)node)->namespace == NULL ||
- strcmp (((GIIrNodeXRef *)node)->namespace, names[0]) != 0)
- continue;
- }
+ if (((GIIrNodeXRef *)node)->namespace == NULL ||
+ strcmp (((GIIrNodeXRef *)node)->namespace, names[0]) != 0)
+ continue;
+ }
if (strcmp (node->name, names[n_names - 1]) == 0)
- {
- if (idx)
- *idx = i;
+ {
+ if (idx)
+ *idx = i;
- result = node;
- goto out;
- }
+ result = node;
+ goto out;
+ }
}
if (n_names > 1)
module->entries = g_list_append (module->entries, node);
if (idx)
- *idx = g_list_length (module->entries);
+ *idx = g_list_length (module->entries);
result = node;
}
- gi_ir_module_fatal (build, -1, "type reference '%s' not found", name);
+ gi_ir_module_fatal (build, 0, "type reference '%s' not found", name);
out:
g_strfreev (names);
return result;
}
-static guint16
+static uint16_t
find_entry (GIIrTypelibBuild *build,
- const gchar *name)
+ const char *name)
{
- guint16 idx = 0;
+ uint16_t idx = 0;
find_entry_node (build, name, &idx);
GList *l;
GIIrNode *return_node = NULL;
char **names = g_strsplit (name, ".", 0);
- gint n_names = g_strv_length (names);
+ unsigned n_names = g_strv_length (names);
const char *target_name;
GIIrModule *target_module;
GIIrNode *node = (GIIrNode *)l->data;
if (strcmp (node->name, target_name) == 0)
- {
- return_node = node;
- break;
- }
+ {
+ return_node = node;
+ break;
+ }
}
done:
GIIrNodeTypeId type,
const char *name)
{
- guint index = -1;
+ int index = -1;
GList *l;
for (l = node->members; l; l = l->next)
GIIrNodeType *node,
GString *str)
{
- gint i;
+ size_t i;
if (GI_TYPE_TAG_IS_BASIC (node->tag))
{
g_string_append_printf (str, "%s%s", gi_type_tag_to_string (node->tag),
- node->is_pointer ? "*" : "");
+ node->is_pointer ? "*" : "");
}
else if (node->tag == GI_TYPE_TAG_ARRAY)
{
if (node->array_type == GI_ARRAY_TYPE_C)
- {
- serialize_type (build, node->parameter_type1, str);
- g_string_append (str, "[");
-
- if (node->has_length)
- g_string_append_printf (str, "length=%d", node->length);
- else if (node->has_size)
- g_string_append_printf (str, "fixed-size=%d", node->size);
-
- if (node->zero_terminated)
- g_string_append_printf (str, "%szero-terminated=1",
- node->has_length ? "," : "");
-
- g_string_append (str, "]");
- if (node->is_pointer)
- g_string_append (str, "*");
- }
+ {
+ serialize_type (build, node->parameter_type1, str);
+ g_string_append (str, "[");
+
+ if (node->has_length)
+ g_string_append_printf (str, "length=%d", node->length);
+ else if (node->has_size)
+ g_string_append_printf (str, "fixed-size=%d", node->size);
+
+ if (node->zero_terminated)
+ g_string_append_printf (str, "%szero-terminated=1",
+ node->has_length ? "," : "");
+
+ g_string_append (str, "]");
+ if (node->is_pointer)
+ g_string_append (str, "*");
+ }
else if (node->array_type == GI_ARRAY_TYPE_BYTE_ARRAY)
- {
- /* We on purpose skip serializing parameter_type1, which should
- always be void*
- */
- g_string_append (str, "GByteArray");
- }
+ {
+ /* We on purpose skip serializing parameter_type1, which should
+ always be void*
+ */
+ g_string_append (str, "GByteArray");
+ }
else
- {
- if (node->array_type == GI_ARRAY_TYPE_ARRAY)
- g_string_append (str, "GArray");
- else
- g_string_append (str, "GPtrArray");
- if (node->parameter_type1)
- {
- g_string_append (str, "<");
- serialize_type (build, node->parameter_type1, str);
- g_string_append (str, ">");
- }
- }
+ {
+ if (node->array_type == GI_ARRAY_TYPE_ARRAY)
+ g_string_append (str, "GArray");
+ else
+ g_string_append (str, "GPtrArray");
+ if (node->parameter_type1)
+ {
+ g_string_append (str, "<");
+ serialize_type (build, node->parameter_type1, str);
+ g_string_append (str, ">");
+ }
+ }
}
else if (node->tag == GI_TYPE_TAG_INTERFACE)
{
GIIrNode *iface;
- gchar *name;
+ char *name;
iface = find_entry_node (build, node->giinterface, NULL);
if (iface)
name = iface->name;
}
else
- {
- g_warning ("Interface for type reference %s not found", node->giinterface);
- name = node->giinterface;
- }
+ {
+ g_warning ("Interface for type reference %s not found", node->giinterface);
+ name = node->giinterface;
+ }
g_string_append_printf (str, "%s%s", name,
- node->is_pointer ? "*" : "");
+ node->is_pointer ? "*" : "");
}
else if (node->tag == GI_TYPE_TAG_GLIST)
{
g_string_append (str, "GList");
if (node->parameter_type1)
- {
- g_string_append (str, "<");
- serialize_type (build, node->parameter_type1, str);
- g_string_append (str, ">");
- }
+ {
+ g_string_append (str, "<");
+ serialize_type (build, node->parameter_type1, str);
+ g_string_append (str, ">");
+ }
}
else if (node->tag == GI_TYPE_TAG_GSLIST)
{
g_string_append (str, "GSList");
if (node->parameter_type1)
- {
- g_string_append (str, "<");
- serialize_type (build, node->parameter_type1, str);
- g_string_append (str, ">");
- }
+ {
+ g_string_append (str, "<");
+ serialize_type (build, node->parameter_type1, str);
+ g_string_append (str, ">");
+ }
}
else if (node->tag == GI_TYPE_TAG_GHASH)
{
g_string_append (str, "GHashTable");
if (node->parameter_type1)
- {
- g_string_append (str, "<");
- serialize_type (build, node->parameter_type1, str);
- g_string_append (str, ",");
- serialize_type (build, node->parameter_type2, str);
- g_string_append (str, ">");
- }
+ {
+ g_string_append (str, "<");
+ serialize_type (build, node->parameter_type1, str);
+ g_string_append (str, ",");
+ serialize_type (build, node->parameter_type2, str);
+ g_string_append (str, ">");
+ }
}
else if (node->tag == GI_TYPE_TAG_ERROR)
{
g_string_append (str, "GError");
if (node->errors)
- {
- g_string_append (str, "<");
- for (i = 0; node->errors[i]; i++)
- {
- if (i > 0)
- g_string_append (str, ",");
- g_string_append (str, node->errors[i]);
- }
- g_string_append (str, ">");
- }
+ {
+ g_string_append (str, "<");
+ for (i = 0; node->errors[i]; i++)
+ {
+ if (i > 0)
+ g_string_append (str, ",");
+ g_string_append (str, node->errors[i]);
+ }
+ g_string_append (str, ">");
+ }
}
}
static void
gi_ir_node_build_members (GList **members,
GIIrNodeTypeId type,
- guint16 *count,
+ uint16_t *count,
GIIrNode *parent,
GIIrTypelibBuild *build,
- guint32 *offset,
- guint32 *offset2,
- guint16 *count2)
+ uint32_t *offset,
+ uint32_t *offset2,
+ uint16_t *count2)
{
GList *l = *members;
GList *next = l->next;
if (member->type == type)
- {
- (*count)++;
- gi_ir_node_build_typelib (member, parent, build, offset, offset2, count2);
- *members = g_list_delete_link (*members, l);
- }
+ {
+ (*count)++;
+ gi_ir_node_build_typelib (member, parent, build, offset, offset2, count2);
+ *members = g_list_delete_link (*members, l);
+ }
l = next;
}
}
GList *l;
for (l = *members; l; l = l->next)
- {
- GIIrNode *member = (GIIrNode *)l->data;
- g_printerr ("Unhandled '%s' member '%s' type '%s'\n",
- gi_ir_node_type_to_string (container_type),
- member->name,
- gi_ir_node_type_to_string (member->type));
- }
+ {
+ GIIrNode *member = (GIIrNode *)l->data;
+ g_printerr ("Unhandled '%s' member '%s' type '%s'\n",
+ gi_ir_node_type_to_string (container_type),
+ member->name,
+ gi_ir_node_type_to_string (member->type));
+ }
g_list_free (*members);
*members = NULL;
gi_ir_node_build_typelib (GIIrNode *node,
GIIrNode *parent,
GIIrTypelibBuild *build,
- guint32 *offset,
- guint32 *offset2,
- guint16 *count2)
+ uint32_t *offset,
+ uint32_t *offset2,
+ uint16_t *count2)
{
gboolean appended_stack;
GHashTable *strings = build->strings;
GHashTable *types = build->types;
- guchar *data = build->data;
+ uint8_t *data = build->data;
GList *l;
- guint32 old_offset = *offset;
- guint32 old_offset2 = *offset2;
+ uint32_t old_offset = *offset;
+ uint32_t old_offset2 = *offset2;
g_assert (node != NULL);
g_debug ("build_typelib: %s%s(%s)",
- node->name ? node->name : "",
- node->name ? " " : "",
- gi_ir_node_type_to_string (node->type));
+ node->name ? node->name : "",
+ node->name ? " " : "",
+ gi_ir_node_type_to_string (node->type));
if (build->stack)
appended_stack = node != (GIIrNode*)build->stack->data;
{
case GI_IR_NODE_TYPE:
{
- GIIrNodeType *type = (GIIrNodeType *)node;
- SimpleTypeBlob *blob = (SimpleTypeBlob *)&data[*offset];
-
- *offset += sizeof (SimpleTypeBlob);
-
- if (GI_TYPE_TAG_IS_BASIC (type->tag))
- {
- blob->flags.reserved = 0;
- blob->flags.reserved2 = 0;
- blob->flags.pointer = type->is_pointer;
- blob->flags.reserved3 = 0;
- blob->flags.tag = type->tag;
- }
- else
- {
- GString *str;
- gchar *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);
- if (value)
- {
- blob->offset = GPOINTER_TO_UINT (value);
- g_free (s);
- }
- else
- {
- unique_types_count += 1;
- g_hash_table_insert (types, s, GUINT_TO_POINTER(*offset2));
-
- blob->offset = *offset2;
- switch (type->tag)
- {
- case GI_TYPE_TAG_ARRAY:
- {
- ArrayTypeBlob *array = (ArrayTypeBlob *)&data[*offset2];
- guint32 pos;
-
- array->pointer = type->is_pointer;
- array->reserved = 0;
- array->tag = type->tag;
- array->zero_terminated = type->zero_terminated;
- array->has_length = type->has_length;
+ GIIrNodeType *type = (GIIrNodeType *)node;
+ SimpleTypeBlob *blob = (SimpleTypeBlob *)&data[*offset];
+
+ *offset += sizeof (SimpleTypeBlob);
+
+ if (GI_TYPE_TAG_IS_BASIC (type->tag))
+ {
+ blob->flags.reserved = 0;
+ blob->flags.reserved2 = 0;
+ blob->flags.pointer = type->is_pointer;
+ blob->flags.reserved3 = 0;
+ blob->flags.tag = type->tag;
+ }
+ 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);
+ if (value)
+ {
+ blob->offset = GPOINTER_TO_UINT (value);
+ g_free (s);
+ }
+ else
+ {
+ unique_types_count += 1;
+ g_hash_table_insert (types, s, GUINT_TO_POINTER(*offset2));
+
+ blob->offset = *offset2;
+ switch (type->tag)
+ {
+ case GI_TYPE_TAG_ARRAY:
+ {
+ ArrayTypeBlob *array = (ArrayTypeBlob *)&data[*offset2];
+ uint32_t pos;
+
+ array->pointer = type->is_pointer;
+ array->reserved = 0;
+ array->tag = type->tag;
+ array->zero_terminated = type->zero_terminated;
+ array->has_length = type->has_length;
array->has_size = type->has_size;
array->array_type = type->array_type;
- array->reserved2 = 0;
+ array->reserved2 = 0;
if (array->has_length)
array->dimensions.length = type->length;
else if (array->has_size)
else
array->dimensions.length = -1;
- pos = *offset2 + G_STRUCT_OFFSET (ArrayTypeBlob, type);
- *offset2 += sizeof (ArrayTypeBlob);
+ pos = *offset2 + G_STRUCT_OFFSET (ArrayTypeBlob, type);
+ *offset2 += sizeof (ArrayTypeBlob);
- gi_ir_node_build_typelib ((GIIrNode *)type->parameter_type1,
+ gi_ir_node_build_typelib ((GIIrNode *)type->parameter_type1,
node, build, &pos, offset2, NULL);
- }
- break;
-
- case GI_TYPE_TAG_INTERFACE:
- {
- InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&data[*offset2];
- *offset2 += sizeof (InterfaceTypeBlob);
-
- iface->pointer = type->is_pointer;
- iface->reserved = 0;
- iface->tag = type->tag;
- iface->reserved2 = 0;
- iface->interface = find_entry (build, type->giinterface);
-
- }
- break;
-
- case GI_TYPE_TAG_GLIST:
- case GI_TYPE_TAG_GSLIST:
- {
- ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
- guint32 pos;
-
- param->pointer = 1;
- param->reserved = 0;
- param->tag = type->tag;
- param->reserved2 = 0;
- param->n_types = 1;
-
- pos = *offset2 + G_STRUCT_OFFSET (ParamTypeBlob, type);
- *offset2 += sizeof (ParamTypeBlob) + sizeof (SimpleTypeBlob);
-
- gi_ir_node_build_typelib ((GIIrNode *)type->parameter_type1,
+ }
+ break;
+
+ case GI_TYPE_TAG_INTERFACE:
+ {
+ InterfaceTypeBlob *iface = (InterfaceTypeBlob *)&data[*offset2];
+ *offset2 += sizeof (InterfaceTypeBlob);
+
+ iface->pointer = type->is_pointer;
+ iface->reserved = 0;
+ iface->tag = type->tag;
+ iface->reserved2 = 0;
+ iface->interface = find_entry (build, type->giinterface);
+
+ }
+ break;
+
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
+ {
+ ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
+ uint32_t pos;
+
+ param->pointer = 1;
+ param->reserved = 0;
+ param->tag = type->tag;
+ param->reserved2 = 0;
+ param->n_types = 1;
+
+ pos = *offset2 + G_STRUCT_OFFSET (ParamTypeBlob, type);
+ *offset2 += sizeof (ParamTypeBlob) + sizeof (SimpleTypeBlob);
+
+ gi_ir_node_build_typelib ((GIIrNode *)type->parameter_type1,
node, build, &pos, offset2, NULL);
- }
- break;
+ }
+ break;
- case GI_TYPE_TAG_GHASH:
- {
- ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
- guint32 pos;
+ case GI_TYPE_TAG_GHASH:
+ {
+ ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2];
+ uint32_t pos;
- param->pointer = 1;
- param->reserved = 0;
- param->tag = type->tag;
- param->reserved2 = 0;
- param->n_types = 2;
+ param->pointer = 1;
+ param->reserved = 0;
+ param->tag = type->tag;
+ param->reserved2 = 0;
+ param->n_types = 2;
- pos = *offset2 + G_STRUCT_OFFSET (ParamTypeBlob, type);
- *offset2 += sizeof (ParamTypeBlob) + sizeof (SimpleTypeBlob)*2;
+ pos = *offset2 + G_STRUCT_OFFSET (ParamTypeBlob, type);
+ *offset2 += sizeof (ParamTypeBlob) + sizeof (SimpleTypeBlob)*2;
- gi_ir_node_build_typelib ((GIIrNode *)type->parameter_type1,
+ gi_ir_node_build_typelib ((GIIrNode *)type->parameter_type1,
node, build, &pos, offset2, NULL);
- gi_ir_node_build_typelib ((GIIrNode *)type->parameter_type2,
+ gi_ir_node_build_typelib ((GIIrNode *)type->parameter_type2,
node, build, &pos, offset2, NULL);
- }
- break;
-
- case GI_TYPE_TAG_ERROR:
- {
- ErrorTypeBlob *error_blob = (ErrorTypeBlob *)&data[*offset2];
-
- error_blob->pointer = 1;
- error_blob->reserved = 0;
- error_blob->tag = type->tag;
- error_blob->reserved2 = 0;
- error_blob->n_domains = 0;
-
- *offset2 += sizeof (ErrorTypeBlob);
- }
- break;
-
- default:
- g_error ("Unknown type tag %d\n", type->tag);
- break;
- }
- }
- }
+ }
+ break;
+
+ case GI_TYPE_TAG_ERROR:
+ {
+ ErrorTypeBlob *error_blob = (ErrorTypeBlob *)&data[*offset2];
+
+ error_blob->pointer = 1;
+ error_blob->reserved = 0;
+ error_blob->tag = type->tag;
+ error_blob->reserved2 = 0;
+ error_blob->n_domains = 0;
+
+ *offset2 += sizeof (ErrorTypeBlob);
+ }
+ break;
+
+ default:
+ g_error ("Unknown type tag %d", type->tag);
+ break;
+ }
+ }
+ }
}
break;
case GI_IR_NODE_FIELD:
{
- GIIrNodeField *field = (GIIrNodeField *)node;
- FieldBlob *blob;
-
- blob = (FieldBlob *)&data[*offset];
-
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- blob->readable = field->readable;
- blob->writable = field->writable;
- blob->reserved = 0;
- blob->bits = 0;
- if (field->offset >= 0)
- blob->struct_offset = field->offset;
- else
- blob->struct_offset = 0xFFFF; /* mark as unknown */
+ GIIrNodeField *field = (GIIrNodeField *)node;
+ FieldBlob *blob;
+
+ blob = (FieldBlob *)&data[*offset];
+
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ blob->readable = field->readable;
+ blob->writable = field->writable;
+ blob->reserved = 0;
+ blob->bits = 0;
+ if (field->offset >= 0)
+ blob->struct_offset = field->offset;
+ else
+ blob->struct_offset = 0xFFFF; /* mark as unknown */
if (field->callback)
{
blob->has_embedded_type = TRUE;
blob->type.offset = GI_INFO_TYPE_CALLBACK;
- *offset += sizeof (FieldBlob);
+ *offset += sizeof (FieldBlob);
gi_ir_node_build_typelib ((GIIrNode *)field->callback,
node, build, offset, offset2, NULL);
/* Fields with callbacks are bigger than normal, update count2
{
blob->has_embedded_type = FALSE;
/* We handle the size member specially below, so subtract it */
- *offset += sizeof (FieldBlob) - sizeof (SimpleTypeBlob);
+ *offset += sizeof (FieldBlob) - sizeof (SimpleTypeBlob);
gi_ir_node_build_typelib ((GIIrNode *)field->type,
node, build, offset, offset2, NULL);
}
case GI_IR_NODE_PROPERTY:
{
- GIIrNodeProperty *prop = (GIIrNodeProperty *)node;
- PropertyBlob *blob = (PropertyBlob *)&data[*offset];
+ GIIrNodeProperty *prop = (GIIrNodeProperty *)node;
+ PropertyBlob *blob = (PropertyBlob *)&data[*offset];
/* We handle the size member specially below, so subtract it */
- *offset += sizeof (PropertyBlob) - sizeof (SimpleTypeBlob);
-
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- blob->deprecated = prop->deprecated;
- blob->readable = prop->readable;
- blob->writable = prop->writable;
- blob->construct = prop->construct;
- blob->construct_only = prop->construct_only;
- blob->transfer_ownership = prop->transfer;
- blob->transfer_container_ownership = prop->shallow_transfer;
- blob->reserved = 0;
+ *offset += sizeof (PropertyBlob) - sizeof (SimpleTypeBlob);
+
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ blob->deprecated = prop->deprecated;
+ blob->readable = prop->readable;
+ blob->writable = prop->writable;
+ blob->construct = prop->construct;
+ blob->construct_only = prop->construct_only;
+ blob->transfer_ownership = prop->transfer;
+ blob->transfer_container_ownership = prop->shallow_transfer;
+ blob->reserved = 0;
if (prop->setter != NULL)
{
g_error ("Unknown setter %s for property %s:%s", prop->setter, parent->name, node->name);
}
- blob->setter = (guint) index;
+ blob->setter = (uint16_t) index;
}
else
blob->setter = ACCESSOR_SENTINEL;
g_error ("Unknown getter %s for property %s:%s", prop->getter, parent->name, node->name);
}
- blob->getter = (guint) index;
+ blob->getter = (uint16_t) index;
}
else
blob->getter = ACCESSOR_SENTINEL;
case GI_IR_NODE_FUNCTION:
{
- FunctionBlob *blob = (FunctionBlob *)&data[*offset];
- SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
- GIIrNodeFunction *function = (GIIrNodeFunction *)node;
- guint32 signature;
- gint n;
+ FunctionBlob *blob = (FunctionBlob *)&data[*offset];
+ SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
+ GIIrNodeFunction *function = (GIIrNodeFunction *)node;
+ uint32_t signature;
+ unsigned int n;
- signature = *offset2;
- n = g_list_length (function->parameters);
+ signature = *offset2;
+ n = g_list_length (function->parameters);
- *offset += sizeof (FunctionBlob);
- *offset2 += sizeof (SignatureBlob) + n * sizeof (ArgBlob);
+ *offset += sizeof (FunctionBlob);
+ *offset2 += sizeof (SignatureBlob) + n * sizeof (ArgBlob);
- blob->blob_type = BLOB_TYPE_FUNCTION;
- blob->deprecated = function->deprecated;
+ blob->blob_type = BLOB_TYPE_FUNCTION;
+ blob->deprecated = function->deprecated;
blob->is_static = !function->is_method;
- blob->setter = FALSE;
- blob->getter = FALSE;
- blob->constructor = function->is_constructor;
- blob->wraps_vfunc = function->wraps_vfunc;
- blob->throws = function->throws; /* Deprecated. Also stored in SignatureBlob. */
- blob->index = 0;
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- blob->symbol = gi_ir_write_string (function->symbol, strings, data, offset2);
- blob->signature = signature;
+ blob->setter = FALSE;
+ blob->getter = FALSE;
+ blob->constructor = function->is_constructor;
+ blob->wraps_vfunc = function->wraps_vfunc;
+ blob->throws = function->throws; /* Deprecated. Also stored in SignatureBlob. */
+ blob->index = 0;
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ blob->symbol = gi_ir_write_string (function->symbol, strings, data, offset2);
+ blob->signature = signature;
if (function->is_setter || function->is_getter)
{
blob->setter = function->is_setter;
blob->getter = function->is_getter;
- blob->index = (guint) index;
+ blob->index = (uint16_t) index;
}
/* function->result is special since it doesn't appear in the serialized format but
g_assert (((GIIrNode *) function->result)->offset == 0);
((GIIrNode *) function->result)->offset = signature;
- g_debug ("building function '%s'", function->symbol);
+ g_debug ("building function '%s'", function->symbol);
gi_ir_node_build_typelib ((GIIrNode *)function->result->type,
node, build, &signature, offset2, NULL);
- blob2->may_return_null = function->result->nullable;
- blob2->caller_owns_return_value = function->result->transfer;
- blob2->caller_owns_return_container = function->result->shallow_transfer;
- blob2->skip_return = function->result->skip;
+ blob2->may_return_null = function->result->nullable;
+ blob2->caller_owns_return_value = function->result->transfer;
+ blob2->caller_owns_return_container = function->result->shallow_transfer;
+ blob2->skip_return = function->result->skip;
blob2->instance_transfer_ownership = function->instance_transfer_full;
- blob2->reserved = 0;
- blob2->n_arguments = n;
- blob2->throws = function->throws;
+ blob2->reserved = 0;
+ blob2->n_arguments = n;
+ blob2->throws = function->throws;
- signature += 4;
+ signature += 4;
- for (l = function->parameters; l; l = l->next)
- {
- GIIrNode *param = (GIIrNode *)l->data;
+ for (l = function->parameters; l; l = l->next)
+ {
+ GIIrNode *param = (GIIrNode *)l->data;
- gi_ir_node_build_typelib (param, node, build, &signature, offset2, NULL);
- }
+ gi_ir_node_build_typelib (param, node, build, &signature, offset2, NULL);
+ }
}
break;
case GI_IR_NODE_CALLBACK:
{
- CallbackBlob *blob = (CallbackBlob *)&data[*offset];
- SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
- GIIrNodeFunction *function = (GIIrNodeFunction *)node;
- guint32 signature;
- gint n;
+ CallbackBlob *blob = (CallbackBlob *)&data[*offset];
+ SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
+ GIIrNodeFunction *function = (GIIrNodeFunction *)node;
+ uint32_t signature;
+ unsigned int n;
- signature = *offset2;
- n = g_list_length (function->parameters);
+ signature = *offset2;
+ n = g_list_length (function->parameters);
- *offset += sizeof (CallbackBlob);
- *offset2 += sizeof (SignatureBlob) + n * sizeof (ArgBlob);
+ *offset += sizeof (CallbackBlob);
+ *offset2 += sizeof (SignatureBlob) + n * sizeof (ArgBlob);
- blob->blob_type = BLOB_TYPE_CALLBACK;
- blob->deprecated = function->deprecated;
- blob->reserved = 0;
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- blob->signature = signature;
+ blob->blob_type = BLOB_TYPE_CALLBACK;
+ blob->deprecated = function->deprecated;
+ blob->reserved = 0;
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ blob->signature = signature;
gi_ir_node_build_typelib ((GIIrNode *)function->result->type,
node, build, &signature, offset2, NULL);
- blob2->may_return_null = function->result->nullable;
- blob2->caller_owns_return_value = function->result->transfer;
- blob2->caller_owns_return_container = function->result->shallow_transfer;
- blob2->reserved = 0;
- blob2->n_arguments = n;
- blob2->throws = function->throws;
+ blob2->may_return_null = function->result->nullable;
+ blob2->caller_owns_return_value = function->result->transfer;
+ blob2->caller_owns_return_container = function->result->shallow_transfer;
+ blob2->reserved = 0;
+ blob2->n_arguments = n;
+ blob2->throws = function->throws;
- signature += 4;
+ signature += 4;
- for (l = function->parameters; l; l = l->next)
- {
- GIIrNode *param = (GIIrNode *)l->data;
+ for (l = function->parameters; l; l = l->next)
+ {
+ GIIrNode *param = (GIIrNode *)l->data;
- gi_ir_node_build_typelib (param, node, build, &signature, offset2, NULL);
- }
+ gi_ir_node_build_typelib (param, node, build, &signature, offset2, NULL);
+ }
}
break;
case GI_IR_NODE_SIGNAL:
{
- SignalBlob *blob = (SignalBlob *)&data[*offset];
- SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
- GIIrNodeSignal *signal = (GIIrNodeSignal *)node;
- guint32 signature;
- gint n;
-
- signature = *offset2;
- n = g_list_length (signal->parameters);
-
- *offset += sizeof (SignalBlob);
- *offset2 += sizeof (SignatureBlob) + n * sizeof (ArgBlob);
-
- blob->deprecated = signal->deprecated;
- blob->run_first = signal->run_first;
- blob->run_last = signal->run_last;
- blob->run_cleanup = signal->run_cleanup;
- blob->no_recurse = signal->no_recurse;
- blob->detailed = signal->detailed;
- blob->action = signal->action;
- blob->no_hooks = signal->no_hooks;
- blob->has_class_closure = 0; /* FIXME */
- blob->true_stops_emit = 0; /* FIXME */
- blob->reserved = 0;
- blob->class_closure = 0; /* FIXME */
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- blob->signature = signature;
+ SignalBlob *blob = (SignalBlob *)&data[*offset];
+ SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
+ GIIrNodeSignal *signal = (GIIrNodeSignal *)node;
+ uint32_t signature;
+ unsigned int n;
+
+ signature = *offset2;
+ n = g_list_length (signal->parameters);
+
+ *offset += sizeof (SignalBlob);
+ *offset2 += sizeof (SignatureBlob) + n * sizeof (ArgBlob);
+
+ blob->deprecated = signal->deprecated;
+ blob->run_first = signal->run_first;
+ blob->run_last = signal->run_last;
+ blob->run_cleanup = signal->run_cleanup;
+ blob->no_recurse = signal->no_recurse;
+ blob->detailed = signal->detailed;
+ blob->action = signal->action;
+ blob->no_hooks = signal->no_hooks;
+ blob->has_class_closure = 0; /* FIXME */
+ blob->true_stops_emit = 0; /* FIXME */
+ blob->reserved = 0;
+ blob->class_closure = 0; /* FIXME */
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ blob->signature = signature;
/* signal->result is special since it doesn't appear in the serialized format but
* we do want the attributes for it to appear
gi_ir_node_build_typelib ((GIIrNode *)signal->result->type,
node, build, &signature, offset2, NULL);
- blob2->may_return_null = signal->result->nullable;
- blob2->caller_owns_return_value = signal->result->transfer;
- blob2->caller_owns_return_container = signal->result->shallow_transfer;
+ blob2->may_return_null = signal->result->nullable;
+ blob2->caller_owns_return_value = signal->result->transfer;
+ blob2->caller_owns_return_container = signal->result->shallow_transfer;
blob2->instance_transfer_ownership = signal->instance_transfer_full;
- blob2->reserved = 0;
- blob2->n_arguments = n;
+ blob2->reserved = 0;
+ blob2->n_arguments = n;
- signature += 4;
+ signature += 4;
- for (l = signal->parameters; l; l = l->next)
- {
- GIIrNode *param = (GIIrNode *)l->data;
+ for (l = signal->parameters; l; l = l->next)
+ {
+ GIIrNode *param = (GIIrNode *)l->data;
- gi_ir_node_build_typelib (param, node, build, &signature, offset2, NULL);
- }
+ gi_ir_node_build_typelib (param, node, build, &signature, offset2, NULL);
+ }
}
break;
case GI_IR_NODE_VFUNC:
{
- VFuncBlob *blob = (VFuncBlob *)&data[*offset];
- SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
- GIIrNodeVFunc *vfunc = (GIIrNodeVFunc *)node;
- guint32 signature;
- gint n;
-
- signature = *offset2;
- n = g_list_length (vfunc->parameters);
-
- *offset += sizeof (VFuncBlob);
- *offset2 += sizeof (SignatureBlob) + n * sizeof (ArgBlob);
-
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- blob->must_chain_up = 0; /* FIXME */
- blob->must_be_implemented = 0; /* FIXME */
- blob->must_not_be_implemented = 0; /* FIXME */
- blob->class_closure = 0; /* FIXME */
- blob->throws = vfunc->throws; /* Deprecated. Also stored in SignatureBlob. */
- blob->reserved = 0;
-
- if (vfunc->invoker)
- {
- int index = get_index_of_member_type ((GIIrNodeInterface*)parent, GI_IR_NODE_FUNCTION, vfunc->invoker);
- if (index == -1)
- {
- g_error ("Unknown member function %s for vfunc %s", vfunc->invoker, node->name);
- }
- blob->invoker = (guint) index;
- }
- else
- blob->invoker = 0x3ff; /* max of 10 bits */
-
- blob->struct_offset = vfunc->offset;
- blob->reserved2 = 0;
- blob->signature = signature;
+ VFuncBlob *blob = (VFuncBlob *)&data[*offset];
+ SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2];
+ GIIrNodeVFunc *vfunc = (GIIrNodeVFunc *)node;
+ uint32_t signature;
+ unsigned int n;
+
+ signature = *offset2;
+ n = g_list_length (vfunc->parameters);
+
+ *offset += sizeof (VFuncBlob);
+ *offset2 += sizeof (SignatureBlob) + n * sizeof (ArgBlob);
+
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ blob->must_chain_up = 0; /* FIXME */
+ blob->must_be_implemented = 0; /* FIXME */
+ blob->must_not_be_implemented = 0; /* FIXME */
+ blob->class_closure = 0; /* FIXME */
+ blob->throws = vfunc->throws; /* Deprecated. Also stored in SignatureBlob. */
+ blob->reserved = 0;
+
+ if (vfunc->invoker)
+ {
+ int index = get_index_of_member_type ((GIIrNodeInterface*)parent, GI_IR_NODE_FUNCTION, vfunc->invoker);
+ if (index == -1)
+ {
+ g_error ("Unknown member function %s for vfunc %s", vfunc->invoker, node->name);
+ }
+ blob->invoker = (uint16_t) index;
+ }
+ else
+ blob->invoker = 0x3ff; /* max of 10 bits */
+
+ blob->struct_offset = vfunc->offset;
+ blob->reserved2 = 0;
+ blob->signature = signature;
gi_ir_node_build_typelib ((GIIrNode *)vfunc->result->type,
node, build, &signature, offset2, NULL);
- blob2->may_return_null = vfunc->result->nullable;
- blob2->caller_owns_return_value = vfunc->result->transfer;
- blob2->caller_owns_return_container = vfunc->result->shallow_transfer;
+ blob2->may_return_null = vfunc->result->nullable;
+ blob2->caller_owns_return_value = vfunc->result->transfer;
+ blob2->caller_owns_return_container = vfunc->result->shallow_transfer;
blob2->instance_transfer_ownership = vfunc->instance_transfer_full;
- blob2->reserved = 0;
- blob2->n_arguments = n;
- blob2->throws = vfunc->throws;
+ blob2->reserved = 0;
+ blob2->n_arguments = n;
+ blob2->throws = vfunc->throws;
- signature += 4;
+ signature += 4;
- for (l = vfunc->parameters; l; l = l->next)
- {
- GIIrNode *param = (GIIrNode *)l->data;
+ for (l = vfunc->parameters; l; l = l->next)
+ {
+ GIIrNode *param = (GIIrNode *)l->data;
- gi_ir_node_build_typelib (param, node, build, &signature, offset2, NULL);
- }
+ gi_ir_node_build_typelib (param, node, build, &signature, offset2, NULL);
+ }
}
break;
case GI_IR_NODE_PARAM:
{
- ArgBlob *blob = (ArgBlob *)&data[*offset];
- GIIrNodeParam *param = (GIIrNodeParam *)node;
-
- /* The offset for this one is smaller than the struct because
- * we recursively build the simple type inline here below.
- */
- *offset += sizeof (ArgBlob) - sizeof (SimpleTypeBlob);
-
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- blob->in = param->in;
- blob->out = param->out;
- blob->caller_allocates = param->caller_allocates;
- blob->nullable = param->nullable;
- blob->skip = param->skip;
- blob->optional = param->optional;
- blob->transfer_ownership = param->transfer;
- blob->transfer_container_ownership = param->shallow_transfer;
- blob->return_value = param->retval;
+ ArgBlob *blob = (ArgBlob *)&data[*offset];
+ GIIrNodeParam *param = (GIIrNodeParam *)node;
+
+ /* The offset for this one is smaller than the struct because
+ * we recursively build the simple type inline here below.
+ */
+ *offset += sizeof (ArgBlob) - sizeof (SimpleTypeBlob);
+
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ blob->in = param->in;
+ blob->out = param->out;
+ blob->caller_allocates = param->caller_allocates;
+ blob->nullable = param->nullable;
+ blob->skip = param->skip;
+ blob->optional = param->optional;
+ blob->transfer_ownership = param->transfer;
+ blob->transfer_container_ownership = param->shallow_transfer;
+ blob->return_value = param->retval;
blob->scope = param->scope;
- blob->reserved = 0;
+ blob->reserved = 0;
blob->closure = param->closure;
blob->destroy = param->destroy;
case GI_IR_NODE_STRUCT:
{
- StructBlob *blob = (StructBlob *)&data[*offset];
- GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
- GList *members;
+ StructBlob *blob = (StructBlob *)&data[*offset];
+ GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
+ GList *members;
- blob->blob_type = BLOB_TYPE_STRUCT;
+ blob->blob_type = BLOB_TYPE_STRUCT;
blob->foreign = struct_->foreign;
- blob->deprecated = struct_->deprecated;
- blob->is_gtype_struct = struct_->is_gtype_struct;
- blob->reserved = 0;
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- blob->alignment = struct_->alignment;
- blob->size = struct_->size;
-
- if (struct_->gtype_name)
- {
- blob->unregistered = FALSE;
- blob->gtype_name = gi_ir_write_string (struct_->gtype_name, strings, data, offset2);
- blob->gtype_init = gi_ir_write_string (struct_->gtype_init, strings, data, offset2);
- }
- else
- {
- blob->unregistered = TRUE;
- blob->gtype_name = 0;
- blob->gtype_init = 0;
- }
+ blob->deprecated = struct_->deprecated;
+ blob->is_gtype_struct = struct_->is_gtype_struct;
+ blob->reserved = 0;
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ blob->alignment = struct_->alignment;
+ blob->size = struct_->size;
+
+ if (struct_->gtype_name)
+ {
+ blob->unregistered = FALSE;
+ blob->gtype_name = gi_ir_write_string (struct_->gtype_name, strings, data, offset2);
+ blob->gtype_init = gi_ir_write_string (struct_->gtype_init, strings, data, offset2);
+ }
+ else
+ {
+ blob->unregistered = TRUE;
+ blob->gtype_name = 0;
+ blob->gtype_init = 0;
+ }
if (struct_->copy_func)
blob->copy_func = gi_ir_write_string (struct_->copy_func, strings, data, offset2);
if (struct_->free_func)
blob->free_func = gi_ir_write_string (struct_->free_func, strings, data, offset2);
- blob->n_fields = 0;
- blob->n_methods = 0;
+ blob->n_fields = 0;
+ blob->n_methods = 0;
- *offset += sizeof (StructBlob);
+ *offset += sizeof (StructBlob);
- members = g_list_copy (struct_->members);
+ members = g_list_copy (struct_->members);
- gi_ir_node_build_members (&members, GI_IR_NODE_FIELD, &blob->n_fields,
+ gi_ir_node_build_members (&members, GI_IR_NODE_FIELD, &blob->n_fields,
node, build, offset, offset2, NULL);
- gi_ir_node_build_members (&members, GI_IR_NODE_FUNCTION, &blob->n_methods,
+ gi_ir_node_build_members (&members, GI_IR_NODE_FUNCTION, &blob->n_methods,
node, build, offset, offset2, NULL);
- gi_ir_node_check_unhandled_members (&members, node->type);
+ gi_ir_node_check_unhandled_members (&members, node->type);
- g_assert (members == NULL);
+ g_assert (members == NULL);
}
break;
case GI_IR_NODE_BOXED:
{
- StructBlob *blob = (StructBlob *)&data[*offset];
- GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
- GList *members;
+ StructBlob *blob = (StructBlob *)&data[*offset];
+ GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
+ GList *members;
- blob->blob_type = BLOB_TYPE_BOXED;
- blob->deprecated = boxed->deprecated;
- blob->unregistered = FALSE;
- blob->reserved = 0;
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- blob->gtype_name = gi_ir_write_string (boxed->gtype_name, strings, data, offset2);
- blob->gtype_init = gi_ir_write_string (boxed->gtype_init, strings, data, offset2);
- blob->alignment = boxed->alignment;
- blob->size = boxed->size;
+ blob->blob_type = BLOB_TYPE_BOXED;
+ blob->deprecated = boxed->deprecated;
+ blob->unregistered = FALSE;
+ blob->reserved = 0;
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ blob->gtype_name = gi_ir_write_string (boxed->gtype_name, strings, data, offset2);
+ blob->gtype_init = gi_ir_write_string (boxed->gtype_init, strings, data, offset2);
+ blob->alignment = boxed->alignment;
+ blob->size = boxed->size;
- blob->n_fields = 0;
- blob->n_methods = 0;
+ blob->n_fields = 0;
+ blob->n_methods = 0;
- *offset += sizeof (StructBlob);
+ *offset += sizeof (StructBlob);
- members = g_list_copy (boxed->members);
+ members = g_list_copy (boxed->members);
- gi_ir_node_build_members (&members, GI_IR_NODE_FIELD, &blob->n_fields,
+ gi_ir_node_build_members (&members, GI_IR_NODE_FIELD, &blob->n_fields,
node, build, offset, offset2, NULL);
- gi_ir_node_build_members (&members, GI_IR_NODE_FUNCTION, &blob->n_methods,
+ gi_ir_node_build_members (&members, GI_IR_NODE_FUNCTION, &blob->n_methods,
node, build, offset, offset2, NULL);
- gi_ir_node_check_unhandled_members (&members, node->type);
+ gi_ir_node_check_unhandled_members (&members, node->type);
- g_assert (members == NULL);
+ g_assert (members == NULL);
}
break;
case GI_IR_NODE_UNION:
{
- UnionBlob *blob = (UnionBlob *)&data[*offset];
- GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
- GList *members;
-
- blob->blob_type = BLOB_TYPE_UNION;
- blob->deprecated = union_->deprecated;
- blob->reserved = 0;
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- blob->alignment = union_->alignment;
- blob->size = union_->size;
- if (union_->gtype_name)
- {
- blob->unregistered = FALSE;
- blob->gtype_name = gi_ir_write_string (union_->gtype_name, strings, data, offset2);
- blob->gtype_init = gi_ir_write_string (union_->gtype_init, strings, data, offset2);
- }
- else
- {
- blob->unregistered = TRUE;
- blob->gtype_name = 0;
- blob->gtype_init = 0;
- }
-
- blob->n_fields = 0;
- blob->n_functions = 0;
-
- blob->discriminator_offset = union_->discriminator_offset;
+ UnionBlob *blob = (UnionBlob *)&data[*offset];
+ GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
+ GList *members;
+
+ blob->blob_type = BLOB_TYPE_UNION;
+ blob->deprecated = union_->deprecated;
+ blob->reserved = 0;
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ blob->alignment = union_->alignment;
+ blob->size = union_->size;
+ if (union_->gtype_name)
+ {
+ blob->unregistered = FALSE;
+ blob->gtype_name = gi_ir_write_string (union_->gtype_name, strings, data, offset2);
+ blob->gtype_init = gi_ir_write_string (union_->gtype_init, strings, data, offset2);
+ }
+ else
+ {
+ blob->unregistered = TRUE;
+ blob->gtype_name = 0;
+ blob->gtype_init = 0;
+ }
+
+ blob->n_fields = 0;
+ blob->n_functions = 0;
+
+ blob->discriminator_offset = union_->discriminator_offset;
if (union_->copy_func)
blob->copy_func = gi_ir_write_string (union_->copy_func, strings, data, offset2);
if (union_->free_func)
blob->free_func = gi_ir_write_string (union_->free_func, strings, data, offset2);
- /* We don't support Union discriminators right now. */
- /*
- if (union_->discriminator_type)
- {
- *offset += 28;
- blob->discriminated = TRUE;
- gi_ir_node_build_typelib ((GIIrNode *)union_->discriminator_type,
+ /* We don't support Union discriminators right now. */
+ /*
+ if (union_->discriminator_type)
+ {
+ *offset += 28;
+ blob->discriminated = TRUE;
+ gi_ir_node_build_typelib ((GIIrNode *)union_->discriminator_type,
build, offset, offset2, NULL);
- }
- else
- {
+ }
+ else
+ {
*/
- *offset += sizeof (UnionBlob);
- blob->discriminated = FALSE;
- blob->discriminator_type.offset = 0;
+ *offset += sizeof (UnionBlob);
+ blob->discriminated = FALSE;
+ blob->discriminator_type.offset = 0;
- members = g_list_copy (union_->members);
+ members = g_list_copy (union_->members);
- gi_ir_node_build_members (&members, GI_IR_NODE_FIELD, &blob->n_fields,
+ gi_ir_node_build_members (&members, GI_IR_NODE_FIELD, &blob->n_fields,
node, build, offset, offset2, NULL);
- gi_ir_node_build_members (&members, GI_IR_NODE_FUNCTION, &blob->n_functions,
+ gi_ir_node_build_members (&members, GI_IR_NODE_FUNCTION, &blob->n_functions,
node, build, offset, offset2, NULL);
- gi_ir_node_check_unhandled_members (&members, node->type);
+ gi_ir_node_check_unhandled_members (&members, node->type);
- g_assert (members == NULL);
+ g_assert (members == NULL);
- if (union_->discriminator_type)
- {
- for (l = union_->discriminators; l; l = l->next)
- {
- GIIrNode *member = (GIIrNode *)l->data;
+ if (union_->discriminator_type)
+ {
+ for (l = union_->discriminators; l; l = l->next)
+ {
+ GIIrNode *member = (GIIrNode *)l->data;
- gi_ir_node_build_typelib (member, node, build, offset, offset2, NULL);
- }
- }
+ gi_ir_node_build_typelib (member, node, build, offset, offset2, NULL);
+ }
+ }
}
break;
case GI_IR_NODE_ENUM:
case GI_IR_NODE_FLAGS:
{
- EnumBlob *blob = (EnumBlob *)&data[*offset];
- GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node;
-
- *offset += sizeof (EnumBlob);
-
- if (node->type == GI_IR_NODE_ENUM)
- blob->blob_type = BLOB_TYPE_ENUM;
- else
- blob->blob_type = BLOB_TYPE_FLAGS;
-
- blob->deprecated = enum_->deprecated;
- blob->reserved = 0;
- blob->storage_type = enum_->storage_type;
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- if (enum_->gtype_name)
- {
- blob->unregistered = FALSE;
- blob->gtype_name = gi_ir_write_string (enum_->gtype_name, strings, data, offset2);
- blob->gtype_init = gi_ir_write_string (enum_->gtype_init, strings, data, offset2);
- }
- else
- {
- blob->unregistered = TRUE;
- blob->gtype_name = 0;
- blob->gtype_init = 0;
- }
- if (enum_->error_domain)
- blob->error_domain = gi_ir_write_string (enum_->error_domain, strings, data, offset2);
- else
- blob->error_domain = 0;
-
- blob->n_values = 0;
- blob->n_methods = 0;
-
- for (l = enum_->values; l; l = l->next)
- {
- GIIrNode *value = (GIIrNode *)l->data;
-
- blob->n_values++;
- gi_ir_node_build_typelib (value, node, build, offset, offset2, NULL);
- }
-
- for (l = enum_->methods; l; l = l->next)
- {
- GIIrNode *method = (GIIrNode *)l->data;
-
- blob->n_methods++;
- gi_ir_node_build_typelib (method, node, build, offset, offset2, NULL);
- }
+ EnumBlob *blob = (EnumBlob *)&data[*offset];
+ GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node;
+
+ *offset += sizeof (EnumBlob);
+
+ if (node->type == GI_IR_NODE_ENUM)
+ blob->blob_type = BLOB_TYPE_ENUM;
+ else
+ blob->blob_type = BLOB_TYPE_FLAGS;
+
+ blob->deprecated = enum_->deprecated;
+ blob->reserved = 0;
+ blob->storage_type = enum_->storage_type;
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ if (enum_->gtype_name)
+ {
+ blob->unregistered = FALSE;
+ blob->gtype_name = gi_ir_write_string (enum_->gtype_name, strings, data, offset2);
+ blob->gtype_init = gi_ir_write_string (enum_->gtype_init, strings, data, offset2);
+ }
+ else
+ {
+ blob->unregistered = TRUE;
+ blob->gtype_name = 0;
+ blob->gtype_init = 0;
+ }
+ if (enum_->error_domain)
+ blob->error_domain = gi_ir_write_string (enum_->error_domain, strings, data, offset2);
+ else
+ blob->error_domain = 0;
+
+ blob->n_values = 0;
+ blob->n_methods = 0;
+
+ for (l = enum_->values; l; l = l->next)
+ {
+ GIIrNode *value = (GIIrNode *)l->data;
+
+ blob->n_values++;
+ gi_ir_node_build_typelib (value, node, build, offset, offset2, NULL);
+ }
+
+ for (l = enum_->methods; l; l = l->next)
+ {
+ GIIrNode *method = (GIIrNode *)l->data;
+
+ blob->n_methods++;
+ gi_ir_node_build_typelib (method, node, build, offset, offset2, NULL);
+ }
}
break;
case GI_IR_NODE_OBJECT:
{
- ObjectBlob *blob = (ObjectBlob *)&data[*offset];
- GIIrNodeInterface *object = (GIIrNodeInterface *)node;
- GList *members;
+ ObjectBlob *blob = (ObjectBlob *)&data[*offset];
+ GIIrNodeInterface *object = (GIIrNodeInterface *)node;
+ GList *members;
- blob->blob_type = BLOB_TYPE_OBJECT;
- blob->abstract = object->abstract;
+ blob->blob_type = BLOB_TYPE_OBJECT;
+ blob->abstract = object->abstract;
blob->fundamental = object->fundamental;
blob->final_ = object->final_;
- blob->deprecated = object->deprecated;
- blob->reserved = 0;
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- blob->gtype_name = gi_ir_write_string (object->gtype_name, strings, data, offset2);
- blob->gtype_init = gi_ir_write_string (object->gtype_init, strings, data, offset2);
+ blob->deprecated = object->deprecated;
+ blob->reserved = 0;
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ blob->gtype_name = gi_ir_write_string (object->gtype_name, strings, data, offset2);
+ blob->gtype_init = gi_ir_write_string (object->gtype_init, strings, data, offset2);
if (object->ref_func)
blob->ref_func = gi_ir_write_string (object->ref_func, strings, data, offset2);
if (object->unref_func)
blob->set_value_func = gi_ir_write_string (object->set_value_func, strings, data, offset2);
if (object->get_value_func)
blob->get_value_func = gi_ir_write_string (object->get_value_func, strings, data, offset2);
- if (object->parent)
- blob->parent = find_entry (build, object->parent);
- else
- blob->parent = 0;
- if (object->glib_type_struct)
- blob->gtype_struct = find_entry (build, object->glib_type_struct);
- else
- blob->gtype_struct = 0;
-
- blob->n_interfaces = 0;
- blob->n_fields = 0;
- blob->n_properties = 0;
- blob->n_methods = 0;
- blob->n_signals = 0;
- blob->n_vfuncs = 0;
- blob->n_constants = 0;
- blob->n_field_callbacks = 0;
-
- *offset += sizeof(ObjectBlob);
- for (l = object->interfaces; l; l = l->next)
- {
- blob->n_interfaces++;
- *(guint16*)&data[*offset] = find_entry (build, (gchar *)l->data);
- *offset += 2;
- }
-
- members = g_list_copy (object->members);
-
- *offset = ALIGN_VALUE (*offset, 4);
- gi_ir_node_build_members (&members, GI_IR_NODE_FIELD, &blob->n_fields,
+ if (object->parent)
+ blob->parent = find_entry (build, object->parent);
+ else
+ blob->parent = 0;
+ if (object->glib_type_struct)
+ blob->gtype_struct = find_entry (build, object->glib_type_struct);
+ else
+ blob->gtype_struct = 0;
+
+ blob->n_interfaces = 0;
+ blob->n_fields = 0;
+ blob->n_properties = 0;
+ blob->n_methods = 0;
+ blob->n_signals = 0;
+ blob->n_vfuncs = 0;
+ blob->n_constants = 0;
+ blob->n_field_callbacks = 0;
+
+ *offset += sizeof(ObjectBlob);
+ for (l = object->interfaces; l; l = l->next)
+ {
+ blob->n_interfaces++;
+ *(uint16_t *)&data[*offset] = find_entry (build, (char *)l->data);
+ *offset += 2;
+ }
+
+ members = g_list_copy (object->members);
+
+ *offset = ALIGN_VALUE (*offset, 4);
+ gi_ir_node_build_members (&members, GI_IR_NODE_FIELD, &blob->n_fields,
node, build, offset, offset2, &blob->n_field_callbacks);
- *offset = ALIGN_VALUE (*offset, 4);
- gi_ir_node_build_members (&members, GI_IR_NODE_PROPERTY, &blob->n_properties,
+ *offset = ALIGN_VALUE (*offset, 4);
+ gi_ir_node_build_members (&members, GI_IR_NODE_PROPERTY, &blob->n_properties,
node, build, offset, offset2, NULL);
- *offset = ALIGN_VALUE (*offset, 4);
- gi_ir_node_build_members (&members, GI_IR_NODE_FUNCTION, &blob->n_methods,
+ *offset = ALIGN_VALUE (*offset, 4);
+ gi_ir_node_build_members (&members, GI_IR_NODE_FUNCTION, &blob->n_methods,
node, build, offset, offset2, NULL);
- *offset = ALIGN_VALUE (*offset, 4);
- gi_ir_node_build_members (&members, GI_IR_NODE_SIGNAL, &blob->n_signals,
+ *offset = ALIGN_VALUE (*offset, 4);
+ gi_ir_node_build_members (&members, GI_IR_NODE_SIGNAL, &blob->n_signals,
node, build, offset, offset2, NULL);
- *offset = ALIGN_VALUE (*offset, 4);
- gi_ir_node_build_members (&members, GI_IR_NODE_VFUNC, &blob->n_vfuncs,
+ *offset = ALIGN_VALUE (*offset, 4);
+ gi_ir_node_build_members (&members, GI_IR_NODE_VFUNC, &blob->n_vfuncs,
node, build, offset, offset2, NULL);
- *offset = ALIGN_VALUE (*offset, 4);
- gi_ir_node_build_members (&members, GI_IR_NODE_CONSTANT, &blob->n_constants,
+ *offset = ALIGN_VALUE (*offset, 4);
+ gi_ir_node_build_members (&members, GI_IR_NODE_CONSTANT, &blob->n_constants,
node, build, offset, offset2, NULL);
- gi_ir_node_check_unhandled_members (&members, node->type);
+ gi_ir_node_check_unhandled_members (&members, node->type);
- g_assert (members == NULL);
+ g_assert (members == NULL);
}
break;
case GI_IR_NODE_INTERFACE:
{
- InterfaceBlob *blob = (InterfaceBlob *)&data[*offset];
- GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
- GList *members;
-
- blob->blob_type = BLOB_TYPE_INTERFACE;
- blob->deprecated = iface->deprecated;
- blob->reserved = 0;
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- blob->gtype_name = gi_ir_write_string (iface->gtype_name, strings, data, offset2);
- blob->gtype_init = gi_ir_write_string (iface->gtype_init, strings, data, offset2);
- if (iface->glib_type_struct)
- blob->gtype_struct = find_entry (build, iface->glib_type_struct);
- else
- blob->gtype_struct = 0;
- blob->n_prerequisites = 0;
- blob->n_properties = 0;
- blob->n_methods = 0;
- blob->n_signals = 0;
- blob->n_vfuncs = 0;
- blob->n_constants = 0;
-
- *offset += sizeof (InterfaceBlob);
- for (l = iface->prerequisites; l; l = l->next)
- {
- blob->n_prerequisites++;
- *(guint16*)&data[*offset] = find_entry (build, (gchar *)l->data);
- *offset += 2;
- }
-
- members = g_list_copy (iface->members);
-
- *offset = ALIGN_VALUE (*offset, 4);
- gi_ir_node_build_members (&members, GI_IR_NODE_PROPERTY, &blob->n_properties,
+ InterfaceBlob *blob = (InterfaceBlob *)&data[*offset];
+ GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
+ GList *members;
+
+ blob->blob_type = BLOB_TYPE_INTERFACE;
+ blob->deprecated = iface->deprecated;
+ blob->reserved = 0;
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ blob->gtype_name = gi_ir_write_string (iface->gtype_name, strings, data, offset2);
+ blob->gtype_init = gi_ir_write_string (iface->gtype_init, strings, data, offset2);
+ if (iface->glib_type_struct)
+ blob->gtype_struct = find_entry (build, iface->glib_type_struct);
+ else
+ blob->gtype_struct = 0;
+ blob->n_prerequisites = 0;
+ blob->n_properties = 0;
+ blob->n_methods = 0;
+ blob->n_signals = 0;
+ blob->n_vfuncs = 0;
+ blob->n_constants = 0;
+
+ *offset += sizeof (InterfaceBlob);
+ for (l = iface->prerequisites; l; l = l->next)
+ {
+ blob->n_prerequisites++;
+ *(uint16_t *)&data[*offset] = find_entry (build, (char *)l->data);
+ *offset += 2;
+ }
+
+ members = g_list_copy (iface->members);
+
+ *offset = ALIGN_VALUE (*offset, 4);
+ gi_ir_node_build_members (&members, GI_IR_NODE_PROPERTY, &blob->n_properties,
node, build, offset, offset2, NULL);
- *offset = ALIGN_VALUE (*offset, 4);
- gi_ir_node_build_members (&members, GI_IR_NODE_FUNCTION, &blob->n_methods,
+ *offset = ALIGN_VALUE (*offset, 4);
+ gi_ir_node_build_members (&members, GI_IR_NODE_FUNCTION, &blob->n_methods,
node, build, offset, offset2, NULL);
- *offset = ALIGN_VALUE (*offset, 4);
- gi_ir_node_build_members (&members, GI_IR_NODE_SIGNAL, &blob->n_signals,
+ *offset = ALIGN_VALUE (*offset, 4);
+ gi_ir_node_build_members (&members, GI_IR_NODE_SIGNAL, &blob->n_signals,
node, build, offset, offset2, NULL);
- *offset = ALIGN_VALUE (*offset, 4);
- gi_ir_node_build_members (&members, GI_IR_NODE_VFUNC, &blob->n_vfuncs,
+ *offset = ALIGN_VALUE (*offset, 4);
+ gi_ir_node_build_members (&members, GI_IR_NODE_VFUNC, &blob->n_vfuncs,
node, build, offset, offset2, NULL);
- *offset = ALIGN_VALUE (*offset, 4);
- gi_ir_node_build_members (&members, GI_IR_NODE_CONSTANT, &blob->n_constants,
+ *offset = ALIGN_VALUE (*offset, 4);
+ gi_ir_node_build_members (&members, GI_IR_NODE_CONSTANT, &blob->n_constants,
node, build, offset, offset2, NULL);
- gi_ir_node_check_unhandled_members (&members, node->type);
+ gi_ir_node_check_unhandled_members (&members, node->type);
- g_assert (members == NULL);
+ g_assert (members == NULL);
}
break;
case GI_IR_NODE_VALUE:
{
- GIIrNodeValue *value = (GIIrNodeValue *)node;
- ValueBlob *blob = (ValueBlob *)&data[*offset];
- *offset += sizeof (ValueBlob);
-
- blob->deprecated = value->deprecated;
- blob->reserved = 0;
- blob->unsigned_value = value->value >= 0 ? 1 : 0;
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
- blob->value = (gint32)value->value;
+ GIIrNodeValue *value = (GIIrNodeValue *)node;
+ ValueBlob *blob = (ValueBlob *)&data[*offset];
+ *offset += sizeof (ValueBlob);
+
+ blob->deprecated = value->deprecated;
+ blob->reserved = 0;
+ blob->unsigned_value = value->value >= 0 ? 1 : 0;
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+ blob->value = (int32_t) value->value;
}
break;
case GI_IR_NODE_CONSTANT:
{
- GIIrNodeConstant *constant = (GIIrNodeConstant *)node;
- ConstantBlob *blob = (ConstantBlob *)&data[*offset];
- guint32 pos;
-
- pos = *offset + G_STRUCT_OFFSET (ConstantBlob, type);
- *offset += sizeof (ConstantBlob);
-
- blob->blob_type = BLOB_TYPE_CONSTANT;
- blob->deprecated = constant->deprecated;
- blob->reserved = 0;
- blob->name = gi_ir_write_string (node->name, strings, data, offset2);
-
- blob->offset = *offset2;
- switch (constant->type->tag)
- {
- case GI_TYPE_TAG_BOOLEAN:
- blob->size = 4;
- *(gboolean*)&data[blob->offset] = parse_boolean_value (constant->value);
- break;
- case GI_TYPE_TAG_INT8:
- blob->size = 1;
- *(gint8*)&data[blob->offset] = (gint8) parse_int_value (constant->value);
- break;
- case GI_TYPE_TAG_UINT8:
- blob->size = 1;
- *(guint8*)&data[blob->offset] = (guint8) parse_uint_value (constant->value);
- break;
- case GI_TYPE_TAG_INT16:
- blob->size = 2;
- *(gint16*)&data[blob->offset] = (gint16) parse_int_value (constant->value);
- break;
- case GI_TYPE_TAG_UINT16:
- blob->size = 2;
- *(guint16*)&data[blob->offset] = (guint16) parse_uint_value (constant->value);
- break;
- case GI_TYPE_TAG_INT32:
- blob->size = 4;
- *(gint32*)&data[blob->offset] = (gint32) parse_int_value (constant->value);
- break;
- case GI_TYPE_TAG_UINT32:
- blob->size = 4;
- *(guint32*)&data[blob->offset] = (guint32) parse_uint_value (constant->value);
- break;
- case GI_TYPE_TAG_INT64:
- blob->size = 8;
- DO_ALIGNED_COPY(&data[blob->offset], parse_int_value (constant->value), gint64);
- break;
- case GI_TYPE_TAG_UINT64:
- blob->size = 8;
- DO_ALIGNED_COPY(&data[blob->offset], parse_uint_value (constant->value), guint64);
- break;
- case GI_TYPE_TAG_FLOAT:
- blob->size = sizeof (gfloat);
- DO_ALIGNED_COPY(&data[blob->offset], parse_float_value (constant->value), gfloat);
- break;
- case GI_TYPE_TAG_DOUBLE:
- blob->size = sizeof (gdouble);
- DO_ALIGNED_COPY(&data[blob->offset], parse_float_value (constant->value), gdouble);
- break;
- case GI_TYPE_TAG_UTF8:
- case GI_TYPE_TAG_FILENAME:
- blob->size = strlen (constant->value) + 1;
- memcpy (&data[blob->offset], constant->value, blob->size);
- break;
- default:
- break;
- }
- *offset2 += ALIGN_VALUE (blob->size, 4);
-
- gi_ir_node_build_typelib ((GIIrNode *)constant->type, node, build, &pos, offset2, NULL);
+ GIIrNodeConstant *constant = (GIIrNodeConstant *)node;
+ ConstantBlob *blob = (ConstantBlob *)&data[*offset];
+ uint32_t pos;
+
+ pos = *offset + G_STRUCT_OFFSET (ConstantBlob, type);
+ *offset += sizeof (ConstantBlob);
+
+ blob->blob_type = BLOB_TYPE_CONSTANT;
+ blob->deprecated = constant->deprecated;
+ blob->reserved = 0;
+ blob->name = gi_ir_write_string (node->name, strings, data, offset2);
+
+ blob->offset = *offset2;
+ switch (constant->type->tag)
+ {
+ case GI_TYPE_TAG_BOOLEAN:
+ blob->size = 4;
+ *(gboolean*)&data[blob->offset] = parse_boolean_value (constant->value);
+ break;
+ case GI_TYPE_TAG_INT8:
+ blob->size = 1;
+ *(int8_t *)&data[blob->offset] = (int8_t) parse_int_value (constant->value);
+ break;
+ case GI_TYPE_TAG_UINT8:
+ blob->size = 1;
+ *(uint8_t *)&data[blob->offset] = (uint8_t) parse_uint_value (constant->value);
+ break;
+ case GI_TYPE_TAG_INT16:
+ blob->size = 2;
+ *(int16_t *)&data[blob->offset] = (int16_t) parse_int_value (constant->value);
+ break;
+ case GI_TYPE_TAG_UINT16:
+ blob->size = 2;
+ *(uint16_t *)&data[blob->offset] = (uint16_t) parse_uint_value (constant->value);
+ break;
+ case GI_TYPE_TAG_INT32:
+ blob->size = 4;
+ *(int32_t *)&data[blob->offset] = (int32_t) parse_int_value (constant->value);
+ break;
+ case GI_TYPE_TAG_UINT32:
+ blob->size = 4;
+ *(uint32_t*)&data[blob->offset] = (uint32_t) parse_uint_value (constant->value);
+ break;
+ case GI_TYPE_TAG_INT64:
+ blob->size = 8;
+ DO_ALIGNED_COPY (&data[blob->offset], parse_int_value (constant->value), int64_t);
+ break;
+ case GI_TYPE_TAG_UINT64:
+ blob->size = 8;
+ DO_ALIGNED_COPY (&data[blob->offset], parse_uint_value (constant->value), uint64_t);
+ break;
+ case GI_TYPE_TAG_FLOAT:
+ blob->size = sizeof (float);
+ DO_ALIGNED_COPY (&data[blob->offset], parse_float_value (constant->value), float);
+ break;
+ case GI_TYPE_TAG_DOUBLE:
+ blob->size = sizeof (double);
+ DO_ALIGNED_COPY (&data[blob->offset], parse_float_value (constant->value), double);
+ break;
+ case GI_TYPE_TAG_UTF8:
+ case GI_TYPE_TAG_FILENAME:
+ blob->size = strlen (constant->value) + 1;
+ memcpy (&data[blob->offset], constant->value, blob->size);
+ break;
+ default:
+ break;
+ }
+ *offset2 += ALIGN_VALUE (blob->size, 4);
+
+ gi_ir_node_build_typelib ((GIIrNode *)constant->type, node, build, &pos, offset2, NULL);
}
break;
default:
}
g_debug ("node %s%s%s%p type '%s', offset %d -> %d, offset2 %d -> %d",
- node->name ? "'" : "",
- node->name ? node->name : "",
- node->name ? "' " : "",
- node, gi_ir_node_type_to_string (node->type),
- old_offset, *offset, old_offset2, *offset2);
+ node->name ? "'" : "",
+ node->name ? node->name : "",
+ node->name ? "' " : "",
+ node, gi_ir_node_type_to_string (node->type),
+ old_offset, *offset, old_offset2, *offset2);
if (*offset2 - old_offset2 + *offset - old_offset > gi_ir_node_get_full_size (node))
g_error ("exceeding space reservation; offset: %d (prev %d) offset2: %d (prev %d) nodesize: %d",
* to the typelib at offset, put it in the pool and update offset. If the
* typelib is not large enough to hold the string, reallocate it.
*/
-guint32
-gi_ir_write_string (const gchar *str,
+uint32_t
+gi_ir_write_string (const char *str,
GHashTable *strings,
- guchar *data,
- guint32 *offset)
+ uint8_t *data,
+ uint32_t *offset)
{
- gpointer value;
- guint32 start;
+ uint32_t start;
+ void *value;
string_count += 1;
string_size += strlen (str);
unique_string_count += 1;
unique_string_size += strlen (str);
- g_hash_table_insert (strings, (gpointer)str, GUINT_TO_POINTER (*offset));
+ g_hash_table_insert (strings, (void *)str, GUINT_TO_POINTER (*offset));
start = *offset;
*offset = ALIGN_VALUE (start + strlen (str) + 1, 4);
- strcpy ((gchar*)&data[start], str);
+ strcpy ((char *)&data[start], str);
return start;
}
} Enum5;
typedef enum {
- ENUM_6 = ((guint)G_MAXINT) + 1 /* compiler could use uint32 */
+ ENUM_6 = ((unsigned int)G_MAXINT) + 1 /* compiler could use uint32 */
} Enum6;
typedef enum {
compute_enum_storage_type (GIIrNodeEnum *enum_node)
{
GList *l;
- gint64 max_value = 0;
- gint64 min_value = 0;
+ int64_t max_value = 0;
+ int64_t min_value = 0;
int width;
gboolean signed_type;
signed_type = TRUE;
if (min_value > -128 && max_value <= 127)
- width = sizeof(Enum7);
+ width = sizeof(Enum7);
else if (min_value >= G_MINSHORT && max_value <= G_MAXSHORT)
- width = sizeof(Enum8);
+ width = sizeof(Enum8);
else
- width = sizeof(Enum9);
+ width = sizeof(Enum9);
}
else
{
if (max_value <= 127)
- {
- width = sizeof (Enum1);
- signed_type = (gint64)(Enum1)(-1) < 0;
- }
+ {
+ width = sizeof (Enum1);
+ signed_type = (int64_t)(Enum1)(-1) < 0;
+ }
else if (max_value <= 255)
- {
- width = sizeof (Enum2);
- signed_type = (gint64)(Enum2)(-1) < 0;
- }
+ {
+ width = sizeof (Enum2);
+ signed_type = (int64_t)(Enum2)(-1) < 0;
+ }
else if (max_value <= G_MAXSHORT)
- {
- width = sizeof (Enum3);
- signed_type = (gint64)(Enum3)(-1) < 0;
- }
+ {
+ width = sizeof (Enum3);
+ signed_type = (int64_t)(Enum3)(-1) < 0;
+ }
else if (max_value <= G_MAXUSHORT)
- {
- width = sizeof (Enum4);
- signed_type = (gint64)(Enum4)(-1) < 0;
- }
+ {
+ width = sizeof (Enum4);
+ signed_type = (int64_t)(Enum4)(-1) < 0;
+ }
else if (max_value <= G_MAXINT)
- {
- width = sizeof (Enum5);
- signed_type = (gint64)(Enum5)(-1) < 0;
- }
+ {
+ width = sizeof (Enum5);
+ signed_type = (int64_t)(Enum5)(-1) < 0;
+ }
else
- {
- width = sizeof (Enum6);
- signed_type = (gint64)(Enum6)(-1) < 0;
- }
+ {
+ width = sizeof (Enum6);
+ signed_type = (int64_t)(Enum6)(-1) < 0;
+ }
}
if (width == 1)
}
static gboolean
-get_enum_size_alignment (GIIrNodeEnum *enum_node,
- gint *size,
- gint *alignment)
+get_enum_size_alignment (GIIrNodeEnum *enum_node,
+ size_t *size,
+ size_t *alignment)
{
ffi_type *type_ffi;
break;
default:
g_error ("Unexpected enum storage type %s",
- gi_type_tag_to_string (enum_node->storage_type));
+ gi_type_tag_to_string (enum_node->storage_type));
}
*size = type_ffi->size;
static gboolean
get_interface_size_alignment (GIIrTypelibBuild *build,
GIIrNodeType *type,
- gint *size,
- gint *alignment,
+ size_t *size,
+ size_t *alignment,
const char *who)
{
GIIrNode *iface;
if (!iface)
{
gi_ir_module_fatal (build, 0, "Can't resolve type '%s' for %s", type->giinterface, who);
- *size = -1;
- *alignment = -1;
+ *size = 0;
+ *alignment = 0;
return FALSE;
}
{
case GI_IR_NODE_BOXED:
{
- GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)iface;
- *size = boxed->size;
- *alignment = boxed->alignment;
- break;
+ GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)iface;
+ *size = boxed->size;
+ *alignment = boxed->alignment;
+ break;
}
case GI_IR_NODE_STRUCT:
{
- GIIrNodeStruct *struct_ = (GIIrNodeStruct *)iface;
- *size = struct_->size;
- *alignment = struct_->alignment;
- break;
+ GIIrNodeStruct *struct_ = (GIIrNodeStruct *)iface;
+ *size = struct_->size;
+ *alignment = struct_->alignment;
+ break;
}
case GI_IR_NODE_OBJECT:
case GI_IR_NODE_INTERFACE:
{
- GIIrNodeInterface *interface = (GIIrNodeInterface *)iface;
- *size = interface->size;
- *alignment = interface->alignment;
- break;
+ GIIrNodeInterface *interface = (GIIrNodeInterface *)iface;
+ *size = interface->size;
+ *alignment = interface->alignment;
+ break;
}
case GI_IR_NODE_UNION:
{
- GIIrNodeUnion *union_ = (GIIrNodeUnion *)iface;
- *size = union_->size;
- *alignment = union_->alignment;
- break;
+ GIIrNodeUnion *union_ = (GIIrNodeUnion *)iface;
+ *size = union_->size;
+ *alignment = union_->alignment;
+ break;
}
case GI_IR_NODE_ENUM:
case GI_IR_NODE_FLAGS:
{
- return get_enum_size_alignment ((GIIrNodeEnum *)iface,
- size, alignment);
+ return get_enum_size_alignment ((GIIrNodeEnum *)iface,
+ size, alignment);
}
case GI_IR_NODE_CALLBACK:
{
- *size = ffi_type_pointer.size;
- *alignment = ffi_type_pointer.alignment;
- break;
+ *size = ffi_type_pointer.size;
+ *alignment = ffi_type_pointer.alignment;
+ break;
}
default:
{
- g_warning ("%s has is not a pointer and is of type %s",
+ g_warning ("%s has is not a pointer and is of type %s",
who,
- gi_ir_node_type_to_string (iface->type));
- *size = -1;
- *alignment = -1;
- break;
+ gi_ir_node_type_to_string (iface->type));
+ *size = 0;
+ *alignment = 0;
+ return FALSE;
}
}
static gboolean
get_type_size_alignment (GIIrTypelibBuild *build,
GIIrNodeType *type,
- gint *size,
- gint *alignment,
+ size_t *size,
+ size_t *alignment,
const char *who)
{
ffi_type *type_ffi;
}
else if (type->tag == GI_TYPE_TAG_ARRAY)
{
- gint elt_size, elt_alignment;
+ size_t elt_size;
+ size_t elt_alignment;
if (!type->has_size
|| !get_type_size_alignment(build, type->parameter_type1,
&elt_size, &elt_alignment, who))
{
- *size = -1;
- *alignment = -1;
+ *size = 0;
+ *alignment = 0;
return FALSE;
}
else
{
if (type->tag == GI_TYPE_TAG_INTERFACE)
- {
- return get_interface_size_alignment (build, type, size, alignment, who);
- }
+ {
+ return get_interface_size_alignment (build, type, size, alignment, who);
+ }
else
- {
- type_ffi = gi_type_tag_get_ffi_type (type->tag, type->is_pointer);
-
- if (type_ffi == &ffi_type_void)
- {
- g_warning ("%s has void type", who);
- *size = -1;
- *alignment = -1;
- return FALSE;
- }
- else if (type_ffi == &ffi_type_pointer)
- {
- g_warning ("%s has is not a pointer and is of type %s",
+ {
+ type_ffi = gi_type_tag_get_ffi_type (type->tag, type->is_pointer);
+
+ if (type_ffi == &ffi_type_void)
+ {
+ g_warning ("%s has void type", who);
+ *size = 0;
+ *alignment = 0;
+ return FALSE;
+ }
+ else if (type_ffi == &ffi_type_pointer)
+ {
+ g_warning ("%s has is not a pointer and is of type %s",
who,
- gi_type_tag_to_string (type->tag));
- *size = -1;
- *alignment = -1;
- return FALSE;
- }
- }
+ gi_type_tag_to_string (type->tag));
+ *size = 0;
+ *alignment = 0;
+ return FALSE;
+ }
+ }
}
g_assert (type_ffi);
get_field_size_alignment (GIIrTypelibBuild *build,
GIIrNodeField *field,
GIIrNode *parent_node,
- gint *size,
- gint *alignment)
+ size_t *size,
+ size_t *alignment)
{
GIIrModule *module = build->module;
- gchar *who;
+ char *who;
gboolean success;
who = g_strdup_printf ("field %s.%s.%s", module->name, parent_node->name, ((GIIrNode *)field)->name);
compute_struct_field_offsets (GIIrTypelibBuild *build,
GIIrNode *node,
GList *members,
- gint *size_out,
- gint *alignment_out)
+ size_t *size_out,
+ size_t *alignment_out,
+ GIIrOffsetsState *offsets_state_out)
{
- int size = 0;
- int alignment = 1;
+ size_t size = 0;
+ size_t alignment = 1;
GList *l;
gboolean have_error = FALSE;
- *alignment_out = -2; /* mark to detect recursion */
+ *offsets_state_out = GI_IR_OFFSETS_IN_PROGRESS; /* mark to detect recursion */
for (l = members; l; l = l->next)
{
GIIrNode *member = (GIIrNode *)l->data;
if (member->type == GI_IR_NODE_FIELD)
- {
- GIIrNodeField *field = (GIIrNodeField *)member;
-
- if (!have_error)
- {
- int member_size;
- int member_alignment;
-
- if (get_field_size_alignment (build, field, node,
- &member_size, &member_alignment))
- {
- size = GI_ALIGN (size, member_alignment);
- alignment = MAX (alignment, member_alignment);
- field->offset = size;
- size += member_size;
- }
- else
- have_error = TRUE;
- }
-
- if (have_error)
- field->offset = -1;
- }
+ {
+ GIIrNodeField *field = (GIIrNodeField *)member;
+
+ if (!have_error)
+ {
+ size_t member_size;
+ size_t member_alignment;
+
+ if (get_field_size_alignment (build, field, node,
+ &member_size, &member_alignment))
+ {
+ size = GI_ALIGN (size, member_alignment);
+ alignment = MAX (alignment, member_alignment);
+ field->offset = size;
+ size += member_size;
+ }
+ else
+ have_error = TRUE;
+ }
+
+ if (have_error)
+ field->offset = -1;
+ }
else if (member->type == GI_IR_NODE_CALLBACK)
- {
+ {
size = GI_ALIGN (size, ffi_type_pointer.alignment);
alignment = MAX (alignment, ffi_type_pointer.alignment);
- size += ffi_type_pointer.size;
- }
+ size += ffi_type_pointer.size;
+ }
}
/* Structs are tail-padded out to a multiple of their alignment */
{
*size_out = size;
*alignment_out = alignment;
+ *offsets_state_out = GI_IR_OFFSETS_COMPUTED;
}
else
{
- *size_out = -1;
- *alignment_out = -1;
+ *size_out = 0;
+ *alignment_out = 0;
+ *offsets_state_out = GI_IR_OFFSETS_FAILED;
}
return !have_error;
compute_union_field_offsets (GIIrTypelibBuild *build,
GIIrNode *node,
GList *members,
- gint *size_out,
- gint *alignment_out)
+ size_t *size_out,
+ size_t *alignment_out,
+ GIIrOffsetsState *offsets_state_out)
{
- int size = 0;
- int alignment = 1;
+ size_t size = 0;
+ size_t alignment = 1;
GList *l;
gboolean have_error = FALSE;
- *alignment_out = -2; /* mark to detect recursion */
+ *offsets_state_out = GI_IR_OFFSETS_IN_PROGRESS; /* mark to detect recursion */
for (l = members; l; l = l->next)
{
GIIrNode *member = (GIIrNode *)l->data;
if (member->type == GI_IR_NODE_FIELD)
- {
- GIIrNodeField *field = (GIIrNodeField *)member;
-
- if (!have_error)
- {
- int member_size;
- int member_alignment;
-
- if (get_field_size_alignment (build,field, node,
- &member_size, &member_alignment))
- {
- size = MAX (size, member_size);
- alignment = MAX (alignment, member_alignment);
- }
- else
- have_error = TRUE;
- }
- }
+ {
+ GIIrNodeField *field = (GIIrNodeField *)member;
+
+ if (!have_error)
+ {
+ size_t member_size;
+ size_t member_alignment;
+
+ if (get_field_size_alignment (build,field, node,
+ &member_size, &member_alignment))
+ {
+ size = MAX (size, member_size);
+ alignment = MAX (alignment, member_alignment);
+ }
+ else
+ have_error = TRUE;
+ }
+ }
}
/* Unions are tail-padded out to a multiple of their alignment */
{
*size_out = size;
*alignment_out = alignment;
+ *offsets_state_out = GI_IR_OFFSETS_COMPUTED;
}
else
{
- *size_out = -1;
- *alignment_out = -1;
+ *size_out = 0;
+ *alignment_out = 0;
+ *offsets_state_out = GI_IR_OFFSETS_FAILED;
}
return !have_error;
static gboolean
check_needs_computation (GIIrTypelibBuild *build,
GIIrNode *node,
- gint alignment)
+ GIIrOffsetsState offsets_state)
{
GIIrModule *module = build->module;
- /*
- * 0: Not yet computed
- * >0: Previously succeeded
- * -1: Previously failed
- * -2: In progress
- */
- if (alignment == -2)
+
+ if (offsets_state == GI_IR_OFFSETS_IN_PROGRESS)
{
g_warning ("Recursion encountered when computing the size of %s.%s",
- module->name, node->name);
+ module->name, node->name);
}
- return alignment == 0;
+ return offsets_state == GI_IR_OFFSETS_UNKNOWN;
}
/*
{
case GI_IR_NODE_BOXED:
{
- GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
+ GIIrNodeBoxed *boxed = (GIIrNodeBoxed *)node;
- if (!check_needs_computation (build, node, boxed->alignment))
- return;
+ if (!check_needs_computation (build, node, boxed->offsets_state))
+ return;
- compute_struct_field_offsets (build, node, boxed->members,
- &boxed->size, &boxed->alignment);
- break;
+ compute_struct_field_offsets (build, node, boxed->members,
+ &boxed->size, &boxed->alignment, &boxed->offsets_state);
+ break;
}
case GI_IR_NODE_STRUCT:
{
- GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
+ GIIrNodeStruct *struct_ = (GIIrNodeStruct *)node;
- if (!check_needs_computation (build, node, struct_->alignment))
- return;
+ if (!check_needs_computation (build, node, struct_->offsets_state))
+ return;
- compute_struct_field_offsets (build, node, struct_->members,
- &struct_->size, &struct_->alignment);
- break;
+ compute_struct_field_offsets (build, node, struct_->members,
+ &struct_->size, &struct_->alignment, &struct_->offsets_state);
+ break;
}
case GI_IR_NODE_OBJECT:
case GI_IR_NODE_INTERFACE:
{
- GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
+ GIIrNodeInterface *iface = (GIIrNodeInterface *)node;
- if (!check_needs_computation (build, node, iface->alignment))
- return;
+ if (!check_needs_computation (build, node, iface->offsets_state))
+ return;
- compute_struct_field_offsets (build, node, iface->members,
- &iface->size, &iface->alignment);
- break;
+ compute_struct_field_offsets (build, node, iface->members,
+ &iface->size, &iface->alignment, &iface->offsets_state);
+ break;
}
case GI_IR_NODE_UNION:
{
- GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
+ GIIrNodeUnion *union_ = (GIIrNodeUnion *)node;
- if (!check_needs_computation (build, node, union_->alignment))
- return;
+ if (!check_needs_computation (build, node, union_->offsets_state))
+ return;
- compute_union_field_offsets (build, (GIIrNode*)union_, union_->members,
- &union_->size, &union_->alignment);
- break;
+ compute_union_field_offsets (build, (GIIrNode*)union_, union_->members,
+ &union_->size, &union_->alignment, &union_->offsets_state);
+ break;
}
case GI_IR_NODE_ENUM:
case GI_IR_NODE_FLAGS:
{
- GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node;
+ GIIrNodeEnum *enum_ = (GIIrNodeEnum *)node;
- if (enum_->storage_type != GI_TYPE_TAG_VOID) /* already done */
- return;
+ if (enum_->storage_type != GI_TYPE_TAG_VOID) /* already done */
+ return;
- compute_enum_storage_type (enum_);
+ compute_enum_storage_type (enum_);
- break;
+ break;
}
default:
break;
GIIrParser *gi_ir_parser_new (void);
void gi_ir_parser_free (GIIrParser *parser);
void gi_ir_parser_set_includes (GIIrParser *parser,
- const gchar *const *includes);
+ const char *const *includes);
GIIrModule *gi_ir_parser_parse_string (GIIrParser *parser,
- const gchar *namespace,
- const gchar *filename,
- const gchar *buffer,
+ const char *namespace,
+ const char *filename,
+ const char *buffer,
gssize length,
GError **error);
GIIrModule *gi_ir_parser_parse_file (GIIrParser *parser,
- const gchar *filename,
+ const char *filename,
GError **error);
G_END_DECLS
struct _GIIrParser
{
- gchar **includes;
- gchar **gi_gir_path;
+ char **includes;
+ char **gi_gir_path;
GList *parsed_modules; /* All previously parsed modules */
};
};
#define CURRENT_NODE(ctx) ((GIIrNode *)((ctx)->node_stack->data))
-static void start_element_handler (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- gpointer user_data,
- GError **error);
-static void end_element_handler (GMarkupParseContext *context,
- const gchar *element_name,
- gpointer user_data,
- GError **error);
-static void text_handler (GMarkupParseContext *context,
- const gchar *text,
- gsize text_len,
- gpointer user_data,
- GError **error);
+static void start_element_handler (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ void *user_data,
+ GError **error);
+static void end_element_handler (GMarkupParseContext *context,
+ const char *element_name,
+ void *user_data,
+ GError **error);
+static void text_handler (GMarkupParseContext *context,
+ const char *text,
+ gsize text_len,
+ void *user_data,
+ GError **error);
static void cleanup (GMarkupParseContext *context,
- GError *error,
- gpointer user_data);
+ GError *error,
+ void *user_data);
static void state_switch (ParseContext *ctx, ParseState newstate);
};
static gboolean
-start_alias (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error);
+start_alias (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error);
static gboolean
-start_type (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error);
+start_type (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error);
-static const gchar *find_attribute (const gchar *name,
- const gchar **attribute_names,
- const gchar **attribute_values);
+static const char *find_attribute (const char *name,
+ const char **attribute_names,
+ const char **attribute_values);
GIIrParser *
void
gi_ir_parser_set_includes (GIIrParser *parser,
- const gchar *const *includes)
+ const char *const *includes)
{
g_strfreev (parser->includes);
}
static void
-firstpass_start_element_handler (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- gpointer user_data,
- GError **error)
+firstpass_start_element_handler (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ void *user_data,
+ GError **error)
{
ParseContext *ctx = user_data;
if (strcmp (element_name, "alias") == 0)
{
start_alias (context, element_name, attribute_names, attribute_values,
- ctx, error);
+ ctx, error);
}
else if (ctx->state == STATE_ALIAS && strcmp (element_name, "type") == 0)
{
start_type (context, element_name, attribute_names, attribute_values,
- ctx, error);
+ ctx, error);
}
else if (strcmp (element_name, "record") == 0)
{
- const gchar *name;
- const gchar *disguised;
- const gchar *pointer;
+ const char *name;
+ const char *disguised;
+ const char *pointer;
name = find_attribute ("name", attribute_names, attribute_values);
disguised = find_attribute ("disguised", attribute_names, attribute_values);
char *key;
key = g_strdup_printf ("%s.%s", ctx->namespace, name);
- g_hash_table_replace (ctx->pointer_structures, key, GINT_TO_POINTER (1));
+ g_hash_table_replace (ctx->pointer_structures, key, GINT_TO_POINTER (1));
}
else if (g_strcmp0 (disguised, "1") == 0)
- {
- char *key;
+ {
+ char *key;
- key = g_strdup_printf ("%s.%s", ctx->namespace, name);
- g_hash_table_replace (ctx->disguised_structures, key, GINT_TO_POINTER (1));
- }
+ key = g_strdup_printf ("%s.%s", ctx->namespace, name);
+ g_hash_table_replace (ctx->disguised_structures, key, GINT_TO_POINTER (1));
+ }
}
}
static void
-firstpass_end_element_handler (GMarkupParseContext *context,
- const gchar *element_name,
- gpointer user_data,
- GError **error)
+firstpass_end_element_handler (GMarkupParseContext *context,
+ const char *element_name,
+ gpointer user_data,
+ GError **error)
{
ParseContext *ctx = user_data;
if (strcmp (element_name, "alias") == 0)
locate_gir (GIIrParser *parser,
const char *girname)
{
- const gchar *const *datadirs;
- const gchar *const *dir;
+ const char *const *datadirs;
+ const char *const *dir;
char *path = NULL;
g_debug ("Looking for %s", girname);
if (parser->includes != NULL)
{
- for (dir = (const gchar *const *)parser->includes; *dir; dir++)
- {
- path = g_build_filename (*dir, girname, NULL);
- g_debug ("Trying %s from includes", path);
- if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
- return g_steal_pointer (&path);
- g_clear_pointer (&path, g_free);
- }
+ for (dir = (const char *const *)parser->includes; *dir; dir++)
+ {
+ path = g_build_filename (*dir, girname, NULL);
+ g_debug ("Trying %s from includes", path);
+ if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
+ return g_steal_pointer (&path);
+ g_clear_pointer (&path, g_free);
+ }
}
if (parser->gi_gir_path != NULL)
{
- for (dir = (const gchar *const *) parser->gi_gir_path; *dir; dir++)
+ for (dir = (const char *const *) parser->gi_gir_path; *dir; dir++)
{
if (**dir == '\0')
continue;
return NULL;
}
-#define MISSING_ATTRIBUTE(context,error,element,attribute) \
+#define MISSING_ATTRIBUTE(context,error,element,attribute) \
do { \
int line_number, char_number; \
g_markup_parse_context_get_position (context, &line_number, &char_number); \
g_set_error (error, \
- G_MARKUP_ERROR, \
- G_MARKUP_ERROR_INVALID_CONTENT, \
- "Line %d, character %d: The attribute '%s' on the element '%s' must be specified", \
- line_number, char_number, attribute, element); \
+ G_MARKUP_ERROR, \
+ G_MARKUP_ERROR_INVALID_CONTENT, \
+ "Line %d, character %d: The attribute '%s' on the element '%s' must be specified", \
+ line_number, char_number, attribute, element); \
} while (0)
-static const gchar *
-find_attribute (const gchar *name,
- const gchar **attribute_names,
- const gchar **attribute_values)
+static const char *
+find_attribute (const char *name,
+ const char **attribute_names,
+ const char **attribute_values)
{
- gint i;
+ size_t i;
for (i = 0; attribute_names[i] != NULL; i++)
if (strcmp (attribute_names[i], name) == 0)
}
static GIIrNodeType * parse_type_internal (GIIrModule *module,
- const gchar *str, gchar **next, gboolean in_glib,
+ const char *str,
+ char **next,
+ gboolean in_glib,
gboolean in_gobject);
typedef struct {
- const gchar *str;
- guint size;
- guint is_signed : 1;
+ const char *str;
+ size_t size;
+ unsigned int is_signed : 1;
} IntegerAliasInfo;
static IntegerAliasInfo integer_aliases[] = {
};
typedef struct {
- const gchar *str;
- gint tag;
+ const char *str;
+ int tag;
gboolean pointer;
} BasicTypeInfo;
static const BasicTypeInfo *
parse_basic (const char *str)
{
- guint i;
- guint n_basic = G_N_ELEMENTS (basic_types);
+ size_t i;
+ size_t n_basic = G_N_ELEMENTS (basic_types);
for (i = 0; i < n_basic; i++)
{
if (strcmp (str, basic_types[i].str) == 0)
- return &(basic_types[i]);
+ return &(basic_types[i]);
}
for (i = 0; i < G_N_ELEMENTS (integer_aliases); i++)
{
if (strcmp (str, integer_aliases[i].str) == 0)
- {
- switch (integer_aliases[i].size)
- {
- case sizeof(guint8):
- if (integer_aliases[i].is_signed)
- return &basic_types[BASIC_TYPE_FIXED_OFFSET];
- else
- return &basic_types[BASIC_TYPE_FIXED_OFFSET+1];
- break;
- case sizeof(guint16):
- if (integer_aliases[i].is_signed)
- return &basic_types[BASIC_TYPE_FIXED_OFFSET+2];
- else
- return &basic_types[BASIC_TYPE_FIXED_OFFSET+3];
- break;
- case sizeof(guint32):
- if (integer_aliases[i].is_signed)
- return &basic_types[BASIC_TYPE_FIXED_OFFSET+4];
- else
- return &basic_types[BASIC_TYPE_FIXED_OFFSET+5];
- break;
- case sizeof(guint64):
- if (integer_aliases[i].is_signed)
- return &basic_types[BASIC_TYPE_FIXED_OFFSET+6];
- else
- return &basic_types[BASIC_TYPE_FIXED_OFFSET+7];
- break;
- default:
- g_assert_not_reached ();
- }
- }
+ {
+ switch (integer_aliases[i].size)
+ {
+ case sizeof (uint8_t):
+ if (integer_aliases[i].is_signed)
+ return &basic_types[BASIC_TYPE_FIXED_OFFSET];
+ else
+ return &basic_types[BASIC_TYPE_FIXED_OFFSET+1];
+ break;
+ case sizeof (uint16_t):
+ if (integer_aliases[i].is_signed)
+ return &basic_types[BASIC_TYPE_FIXED_OFFSET+2];
+ else
+ return &basic_types[BASIC_TYPE_FIXED_OFFSET+3];
+ break;
+ case sizeof (uint32_t):
+ if (integer_aliases[i].is_signed)
+ return &basic_types[BASIC_TYPE_FIXED_OFFSET+4];
+ else
+ return &basic_types[BASIC_TYPE_FIXED_OFFSET+5];
+ break;
+ case sizeof (uint64_t):
+ if (integer_aliases[i].is_signed)
+ return &basic_types[BASIC_TYPE_FIXED_OFFSET+6];
+ else
+ return &basic_types[BASIC_TYPE_FIXED_OFFSET+7];
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ }
}
return NULL;
}
static GIIrNodeType *
parse_type_internal (GIIrModule *module,
- const gchar *str,
+ const char *str,
char **next,
gboolean in_glib,
gboolean in_gobject)
* special.
*/
if (g_str_has_prefix (str, "List<") ||
- strcmp (str, "List") == 0)
- {
- temporary_type = g_strdup_printf ("GLib.List%s", str + 4);
- str = temporary_type;
- }
+ strcmp (str, "List") == 0)
+ {
+ temporary_type = g_strdup_printf ("GLib.List%s", str + 4);
+ str = temporary_type;
+ }
else if (g_str_has_prefix (str, "SList<") ||
- strcmp (str, "SList") == 0)
- {
- temporary_type = g_strdup_printf ("GLib.SList%s", str + 5);
- str = temporary_type;
- }
+ strcmp (str, "SList") == 0)
+ {
+ temporary_type = g_strdup_printf ("GLib.SList%s", str + 5);
+ str = temporary_type;
+ }
else if (g_str_has_prefix (str, "HashTable<") ||
- strcmp (str, "HashTable") == 0)
- {
- temporary_type = g_strdup_printf ("GLib.HashTable%s", str + 9);
- str = temporary_type;
- }
+ strcmp (str, "HashTable") == 0)
+ {
+ temporary_type = g_strdup_printf ("GLib.HashTable%s", str + 9);
+ str = temporary_type;
+ }
else if (g_str_has_prefix (str, "Error<") ||
- strcmp (str, "Error") == 0)
- {
- temporary_type = g_strdup_printf ("GLib.Error%s", str + 5);
- str = temporary_type;
- }
+ strcmp (str, "Error") == 0)
+ {
+ temporary_type = g_strdup_printf ("GLib.Error%s", str + 5);
+ str = temporary_type;
+ }
}
if (basic != NULL)
/* found a basic type */;
else if (g_str_has_prefix (str, "GLib.List") ||
- g_str_has_prefix (str, "GLib.SList"))
+ g_str_has_prefix (str, "GLib.SList"))
{
str += strlen ("GLib.");
if (g_str_has_prefix (str, "List"))
- {
- type->tag = GI_TYPE_TAG_GLIST;
- type->is_glist = TRUE;
- type->is_pointer = TRUE;
- str += strlen ("List");
- }
+ {
+ type->tag = GI_TYPE_TAG_GLIST;
+ type->is_glist = TRUE;
+ type->is_pointer = TRUE;
+ str += strlen ("List");
+ }
else
- {
- type->tag = GI_TYPE_TAG_GSLIST;
- type->is_gslist = TRUE;
- type->is_pointer = TRUE;
- str += strlen ("SList");
- }
+ {
+ type->tag = GI_TYPE_TAG_GSLIST;
+ type->is_gslist = TRUE;
+ type->is_pointer = TRUE;
+ str += strlen ("SList");
+ }
}
else if (g_str_has_prefix (str, "GLib.HashTable"))
{
str += strlen ("Error");
if (*str == '<')
- {
- char *tmp, *end;
- (str)++;
+ {
+ char *tmp, *end;
+ (str)++;
- end = strchr (str, '>');
- tmp = g_strndup (str, end - str);
- type->errors = g_strsplit (tmp, ",", 0);
- g_free (tmp);
+ end = strchr (str, '>');
+ tmp = g_strndup (str, end - str);
+ type->errors = g_strsplit (tmp, ",", 0);
+ g_free (tmp);
- str = end;
- }
+ str = end;
+ }
}
else
{
/* must be an interface type */
while (g_ascii_isalnum (*str) ||
- *str == '.' ||
- *str == '-' ||
- *str == '_' ||
- *str == ':')
- (str)++;
+ *str == '.' ||
+ *str == '-' ||
+ *str == '_' ||
+ *str == ':')
+ (str)++;
type->giinterface = g_strndup (start, str - start);
}
}
static const char *
-resolve_aliases (ParseContext *ctx, const gchar *type)
+resolve_aliases (ParseContext *ctx, const char *type)
{
- gpointer orig;
- gpointer value;
+ void *orig;
+ void *value;
GSList *seen_values = NULL;
- const gchar *lookup;
- gchar *prefixed;
+ const char *lookup;
+ char *prefixed;
if (strchr (type, '.') == NULL)
{
seen_values = g_slist_prepend (seen_values, (char*)lookup);
while (g_hash_table_lookup_extended (ctx->current_module->aliases, lookup, &orig, &value))
{
- g_debug ("Resolved: %s => %s\n", lookup, (char*)value);
+ g_debug ("Resolved: %s => %s", lookup, (char*)value);
lookup = value;
if (g_slist_find_custom (seen_values, lookup,
- (GCompareFunc)strcmp) != NULL)
- break;
- seen_values = g_slist_prepend (seen_values, (gchar*)lookup);
+ (GCompareFunc)strcmp) != NULL)
+ break;
+ seen_values = g_slist_prepend (seen_values, (char*) lookup);
}
g_slist_free (seen_values);
static void
is_pointer_or_disguised_structure (ParseContext *ctx,
- const gchar *type,
+ const char *type,
gboolean *is_pointer,
gboolean *is_disguised)
{
- const gchar *lookup;
- gchar *prefixed;
+ const char *lookup;
+ char *prefixed;
if (strchr (type, '.') == NULL)
{
}
static GIIrNodeType *
-parse_type (ParseContext *ctx, const gchar *type)
+parse_type (ParseContext *ctx, const char *type)
{
GIIrNodeType *node;
const BasicTypeInfo *basic;
}
static gboolean
-introspectable_prelude (GMarkupParseContext *context,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- ParseState new_state)
+introspectable_prelude (GMarkupParseContext *context,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ ParseState new_state)
{
- const gchar *introspectable_arg;
- const gchar *shadowed_by;
+ const char *introspectable_arg;
+ const char *shadowed_by;
gboolean introspectable;
g_assert (ctx->state != STATE_PASSTHROUGH);
}
static gboolean
-start_glib_boxed (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_glib_boxed (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *typename;
- const gchar *typeinit;
- const gchar *deprecated;
+ const char *name;
+ const char *typename;
+ const char *typeinit;
+ const char *deprecated;
GIIrNodeBoxed *boxed;
if (!(strcmp (element_name, "glib:boxed") == 0 &&
- ctx->state == STATE_NAMESPACE))
+ ctx->state == STATE_NAMESPACE))
return FALSE;
if (!introspectable_prelude (context, attribute_names, attribute_values, ctx, STATE_BOXED))
}
static gboolean
-start_function (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_function (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *shadows;
- const gchar *symbol;
- const gchar *deprecated;
- const gchar *throws;
- const gchar *set_property;
- const gchar *get_property;
+ const char *name;
+ const char *shadows;
+ const char *symbol;
+ const char *deprecated;
+ const char *throws;
+ const char *set_property;
+ const char *get_property;
GIIrNodeFunction *function;
gboolean found = FALSE;
ParseState in_embedded_state = STATE_NONE;
{
case STATE_NAMESPACE:
found = (strcmp (element_name, "function") == 0 ||
- strcmp (element_name, "callback") == 0);
+ strcmp (element_name, "callback") == 0);
break;
case STATE_CLASS:
case STATE_BOXED:
G_GNUC_FALLTHROUGH;
case STATE_INTERFACE:
found = (found ||
- strcmp (element_name, "function") == 0 ||
- strcmp (element_name, "method") == 0 ||
- strcmp (element_name, "callback") == 0);
+ strcmp (element_name, "function") == 0 ||
+ strcmp (element_name, "method") == 0 ||
+ strcmp (element_name, "callback") == 0);
break;
case STATE_ENUM:
found = strcmp (element_name, "function") == 0;
function->is_method = TRUE;
if (strcmp (element_name, "constructor") == 0)
- function->is_constructor = TRUE;
+ function->is_constructor = TRUE;
else
- function->is_constructor = FALSE;
+ function->is_constructor = FALSE;
if (set_property != NULL)
{
if (ctx->node_stack == NULL)
{
ctx->current_module->entries =
- g_list_append (ctx->current_module->entries, function);
+ g_list_append (ctx->current_module->entries, function);
}
else if (ctx->current_typed)
{
{
case GI_IR_NODE_INTERFACE:
case GI_IR_NODE_OBJECT:
- {
- GIIrNodeInterface *iface;
+ {
+ GIIrNodeInterface *iface;
- iface = (GIIrNodeInterface *)CURRENT_NODE (ctx);
- iface->members = g_list_append (iface->members, function);
- }
- break;
+ iface = (GIIrNodeInterface *)CURRENT_NODE (ctx);
+ iface->members = g_list_append (iface->members, function);
+ }
+ break;
case GI_IR_NODE_BOXED:
- {
- GIIrNodeBoxed *boxed;
+ {
+ GIIrNodeBoxed *boxed;
- boxed = (GIIrNodeBoxed *)CURRENT_NODE (ctx);
- boxed->members = g_list_append (boxed->members, function);
- }
- break;
+ boxed = (GIIrNodeBoxed *)CURRENT_NODE (ctx);
+ boxed->members = g_list_append (boxed->members, function);
+ }
+ break;
case GI_IR_NODE_STRUCT:
- {
- GIIrNodeStruct *struct_;
+ {
+ GIIrNodeStruct *struct_;
- struct_ = (GIIrNodeStruct *)CURRENT_NODE (ctx);
- struct_->members = g_list_append (struct_->members, function); }
- break;
+ struct_ = (GIIrNodeStruct *)CURRENT_NODE (ctx);
+ struct_->members = g_list_append (struct_->members, function); }
+ break;
case GI_IR_NODE_UNION:
- {
- GIIrNodeUnion *union_;
+ {
+ GIIrNodeUnion *union_;
- union_ = (GIIrNodeUnion *)CURRENT_NODE (ctx);
- union_->members = g_list_append (union_->members, function);
- }
- break;
+ union_ = (GIIrNodeUnion *)CURRENT_NODE (ctx);
+ union_->members = g_list_append (union_->members, function);
+ }
+ break;
case GI_IR_NODE_ENUM:
case GI_IR_NODE_FLAGS:
- {
- GIIrNodeEnum *enum_;
+ {
+ GIIrNodeEnum *enum_;
- enum_ = (GIIrNodeEnum *)CURRENT_NODE (ctx);
- enum_->methods = g_list_append (enum_->methods, function);
- }
- break;
+ enum_ = (GIIrNodeEnum *)CURRENT_NODE (ctx);
+ enum_->methods = g_list_append (enum_->methods, function);
+ }
+ break;
default:
- g_assert_not_reached ();
+ g_assert_not_reached ();
}
push_node(ctx, (GIIrNode *)function);
static void
parse_property_transfer (GIIrNodeProperty *property,
- const gchar *transfer,
+ const char *transfer,
ParseContext *ctx)
{
if (transfer == NULL)
GIIrNodeInterface *iface = (GIIrNodeInterface *)CURRENT_NODE (ctx);
g_debug ("required attribute 'transfer-ownership' is missing from "
- "property '%s' in type '%s.%s'. Assuming 'none'\n",
+ "property '%s' in type '%s.%s'. Assuming 'none'",
property->node.name, ctx->namespace, iface->node.name);
#endif
transfer = "none";
}
static gboolean
-parse_param_transfer (GIIrNodeParam *param, const gchar *transfer, const gchar *name,
- GError **error)
+parse_param_transfer (GIIrNodeParam *param, const char *transfer, const char *name,
+ GError **error)
{
if (transfer == NULL)
{
g_set_error (error, G_MARKUP_ERROR,
- G_MARKUP_ERROR_INVALID_CONTENT,
- "required attribute 'transfer-ownership' missing");
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ "required attribute 'transfer-ownership' missing");
return FALSE;
}
else if (strcmp (transfer, "none") == 0)
else
{
g_set_error (error, G_MARKUP_ERROR,
- G_MARKUP_ERROR_INVALID_CONTENT,
- "invalid value for 'transfer-ownership': %s", transfer);
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ "invalid value for 'transfer-ownership': %s", transfer);
return FALSE;
}
return TRUE;
}
static gboolean
-start_instance_parameter (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_instance_parameter (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *transfer;
+ const char *transfer;
gboolean transfer_full;
if (!(strcmp (element_name, "instance-parameter") == 0 &&
- ctx->state == STATE_FUNCTION_PARAMETERS))
+ ctx->state == STATE_FUNCTION_PARAMETERS))
return FALSE;
transfer = find_attribute ("transfer-ownership", attribute_names, attribute_values);
else
{
g_set_error (error, G_MARKUP_ERROR,
- G_MARKUP_ERROR_INVALID_CONTENT,
- "invalid value for 'transfer-ownership' for instance parameter: %s", transfer);
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ "invalid value for 'transfer-ownership' for instance parameter: %s", transfer);
return FALSE;
}
case GI_IR_NODE_FUNCTION:
case GI_IR_NODE_CALLBACK:
{
- GIIrNodeFunction *func;
+ GIIrNodeFunction *func;
- func = (GIIrNodeFunction *)CURRENT_NODE (ctx);
+ func = (GIIrNodeFunction *)CURRENT_NODE (ctx);
func->instance_transfer_full = transfer_full;
}
break;
case GI_IR_NODE_SIGNAL:
{
- GIIrNodeSignal *signal;
+ GIIrNodeSignal *signal;
- signal = (GIIrNodeSignal *)CURRENT_NODE (ctx);
+ signal = (GIIrNodeSignal *)CURRENT_NODE (ctx);
signal->instance_transfer_full = transfer_full;
}
break;
case GI_IR_NODE_VFUNC:
{
- GIIrNodeVFunc *vfunc;
+ GIIrNodeVFunc *vfunc;
- vfunc = (GIIrNodeVFunc *)CURRENT_NODE (ctx);
+ vfunc = (GIIrNodeVFunc *)CURRENT_NODE (ctx);
vfunc->instance_transfer_full = transfer_full;
}
break;
}
static gboolean
-start_parameter (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_parameter (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *direction;
- const gchar *retval;
- const gchar *optional;
- const gchar *caller_allocates;
- const gchar *allow_none;
- const gchar *transfer;
- const gchar *scope;
- const gchar *closure;
- const gchar *destroy;
- const gchar *skip;
- const gchar *nullable;
+ const char *name;
+ const char *direction;
+ const char *retval;
+ const char *optional;
+ const char *caller_allocates;
+ const char *allow_none;
+ const char *transfer;
+ const char *scope;
+ const char *closure;
+ const char *destroy;
+ const char *skip;
+ const char *nullable;
GIIrNodeParam *param;
if (!(strcmp (element_name, "parameter") == 0 &&
- ctx->state == STATE_FUNCTION_PARAMETERS))
+ ctx->state == STATE_FUNCTION_PARAMETERS))
return FALSE;
name = find_attribute ("name", attribute_names, attribute_values);
param->in = FALSE;
param->out = TRUE;
if (caller_allocates == NULL)
- param->caller_allocates = FALSE;
+ param->caller_allocates = FALSE;
else
- param->caller_allocates = strcmp (caller_allocates, "1") == 0;
+ param->caller_allocates = strcmp (caller_allocates, "1") == 0;
}
else if (direction && strcmp (direction, "inout") == 0)
{
case GI_IR_NODE_FUNCTION:
case GI_IR_NODE_CALLBACK:
{
- GIIrNodeFunction *func;
+ GIIrNodeFunction *func;
- func = (GIIrNodeFunction *)CURRENT_NODE (ctx);
- func->parameters = g_list_append (func->parameters, param);
+ func = (GIIrNodeFunction *)CURRENT_NODE (ctx);
+ func->parameters = g_list_append (func->parameters, param);
}
break;
case GI_IR_NODE_SIGNAL:
{
- GIIrNodeSignal *signal;
+ GIIrNodeSignal *signal;
- signal = (GIIrNodeSignal *)CURRENT_NODE (ctx);
- signal->parameters = g_list_append (signal->parameters, param);
+ signal = (GIIrNodeSignal *)CURRENT_NODE (ctx);
+ signal->parameters = g_list_append (signal->parameters, param);
}
break;
case GI_IR_NODE_VFUNC:
{
- GIIrNodeVFunc *vfunc;
+ GIIrNodeVFunc *vfunc;
- vfunc = (GIIrNodeVFunc *)CURRENT_NODE (ctx);
- vfunc->parameters = g_list_append (vfunc->parameters, param);
+ vfunc = (GIIrNodeVFunc *)CURRENT_NODE (ctx);
+ vfunc->parameters = g_list_append (vfunc->parameters, param);
}
break;
default:
}
static gboolean
-start_field (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_field (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *readable;
- const gchar *writable;
- const gchar *bits;
- const gchar *branch;
+ const char *name;
+ const char *readable;
+ const char *writable;
+ const char *bits;
+ const char *branch;
GIIrNodeField *field;
ParseState target_state;
gboolean introspectable;
{
case GI_IR_NODE_OBJECT:
{
- GIIrNodeInterface *iface;
+ GIIrNodeInterface *iface;
- iface = (GIIrNodeInterface *)CURRENT_NODE (ctx);
- iface->members = g_list_append (iface->members, field);
+ iface = (GIIrNodeInterface *)CURRENT_NODE (ctx);
+ iface->members = g_list_append (iface->members, field);
}
break;
case GI_IR_NODE_INTERFACE:
{
- GIIrNodeInterface *iface;
+ GIIrNodeInterface *iface;
- iface = (GIIrNodeInterface *)CURRENT_NODE (ctx);
- iface->members = g_list_append (iface->members, field);
+ iface = (GIIrNodeInterface *)CURRENT_NODE (ctx);
+ iface->members = g_list_append (iface->members, field);
}
break;
case GI_IR_NODE_BOXED:
{
- GIIrNodeBoxed *boxed;
+ GIIrNodeBoxed *boxed;
- boxed = (GIIrNodeBoxed *)CURRENT_NODE (ctx);
- boxed->members = g_list_append (boxed->members, field);
+ boxed = (GIIrNodeBoxed *)CURRENT_NODE (ctx);
+ boxed->members = g_list_append (boxed->members, field);
}
break;
case GI_IR_NODE_STRUCT:
{
- GIIrNodeStruct *struct_;
+ GIIrNodeStruct *struct_;
- struct_ = (GIIrNodeStruct *)CURRENT_NODE (ctx);
- struct_->members = g_list_append (struct_->members, field);
+ struct_ = (GIIrNodeStruct *)CURRENT_NODE (ctx);
+ struct_->members = g_list_append (struct_->members, field);
}
break;
case GI_IR_NODE_UNION:
{
- GIIrNodeUnion *union_;
+ GIIrNodeUnion *union_;
- union_ = (GIIrNodeUnion *)CURRENT_NODE (ctx);
- union_->members = g_list_append (union_->members, field);
- if (branch)
- {
- GIIrNodeConstant *constant;
+ union_ = (GIIrNodeUnion *)CURRENT_NODE (ctx);
+ union_->members = g_list_append (union_->members, field);
+ if (branch)
+ {
+ GIIrNodeConstant *constant;
- constant = (GIIrNodeConstant *) gi_ir_node_new (GI_IR_NODE_CONSTANT,
+ constant = (GIIrNodeConstant *) gi_ir_node_new (GI_IR_NODE_CONSTANT,
ctx->current_module);
- ((GIIrNode *)constant)->name = g_strdup (name);
- constant->value = g_strdup (branch);
- constant->type = union_->discriminator_type;
- constant->deprecated = FALSE;
+ ((GIIrNode *)constant)->name = g_strdup (name);
+ constant->value = g_strdup (branch);
+ constant->type = union_->discriminator_type;
+ constant->deprecated = FALSE;
- union_->discriminators = g_list_append (union_->discriminators, constant);
- }
+ union_->discriminators = g_list_append (union_->discriminators, constant);
+ }
}
break;
default:
}
static gboolean
-start_alias (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_alias (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
+ const char *name;
name = find_attribute ("name", attribute_names, attribute_values);
if (name == NULL)
}
static gboolean
-start_enum (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_enum (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *typename;
- const gchar *typeinit;
- const gchar *deprecated;
- const gchar *error_domain;
+ const char *name;
+ const char *typename;
+ const char *typeinit;
+ const char *deprecated;
+ const char *error_domain;
GIIrNodeEnum *enum_;
if (!((strcmp (element_name, "enumeration") == 0 && ctx->state == STATE_NAMESPACE) ||
- (strcmp (element_name, "bitfield") == 0 && ctx->state == STATE_NAMESPACE)))
+ (strcmp (element_name, "bitfield") == 0 && ctx->state == STATE_NAMESPACE)))
return FALSE;
if (!introspectable_prelude (context, attribute_names, attribute_values, ctx, STATE_ENUM))
}
static gboolean
-start_property (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_property (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
ParseState target_state;
- const gchar *name;
- const gchar *readable;
- const gchar *writable;
- const gchar *construct;
- const gchar *construct_only;
- const gchar *transfer;
- const gchar *setter;
- const gchar *getter;
+ const char *name;
+ const char *readable;
+ const char *writable;
+ const char *construct;
+ const char *construct_only;
+ const char *transfer;
+ const char *setter;
+ const char *getter;
GIIrNodeProperty *property;
GIIrNodeInterface *iface;
if (!(strcmp (element_name, "property") == 0 &&
- (ctx->state == STATE_CLASS ||
- ctx->state == STATE_INTERFACE)))
+ (ctx->state == STATE_CLASS ||
+ ctx->state == STATE_INTERFACE)))
return FALSE;
if (ctx->state == STATE_CLASS)
return TRUE;
}
-static gint64
-parse_value (const gchar *str)
+static int64_t
+parse_value (const char *str)
{
- gchar *shift_op;
+ char *shift_op;
/* FIXME just a quick hack */
shift_op = strstr (str, "<<");
if (shift_op)
{
- gint64 base, shift;
+ int64_t base, shift;
base = g_ascii_strtoll (str, NULL, 10);
shift = g_ascii_strtoll (shift_op + 3, NULL, 10);
}
static gboolean
-start_member (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_member (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *value;
- const gchar *deprecated;
- const gchar *c_identifier;
+ const char *name;
+ const char *value;
+ const char *deprecated;
+ const char *c_identifier;
GIIrNodeEnum *enum_;
GIIrNodeValue *value_;
if (!(strcmp (element_name, "member") == 0 &&
- ctx->state == STATE_ENUM))
+ ctx->state == STATE_ENUM))
return FALSE;
name = find_attribute ("name", attribute_names, attribute_values);
}
static gboolean
-start_constant (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_constant (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
ParseState prev_state;
ParseState target_state;
- const gchar *name;
- const gchar *value;
- const gchar *deprecated;
+ const char *name;
+ const char *value;
+ const char *deprecated;
GIIrNodeConstant *constant;
if (!(strcmp (element_name, "constant") == 0 &&
- (ctx->state == STATE_NAMESPACE ||
- ctx->state == STATE_CLASS ||
- ctx->state == STATE_INTERFACE)))
+ (ctx->state == STATE_NAMESPACE ||
+ ctx->state == STATE_CLASS ||
+ ctx->state == STATE_INTERFACE)))
return FALSE;
switch (ctx->state)
{
push_node (ctx, (GIIrNode *) constant);
ctx->current_module->entries =
- g_list_append (ctx->current_module->entries, constant);
+ g_list_append (ctx->current_module->entries, constant);
}
else
{
}
static gboolean
-start_interface (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_interface (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *typename;
- const gchar *typeinit;
- const gchar *deprecated;
- const gchar *glib_type_struct;
+ const char *name;
+ const char *typename;
+ const char *typeinit;
+ const char *deprecated;
+ const char *glib_type_struct;
GIIrNodeInterface *iface;
if (!(strcmp (element_name, "interface") == 0 &&
- ctx->state == STATE_NAMESPACE))
+ ctx->state == STATE_NAMESPACE))
return FALSE;
if (!introspectable_prelude (context, attribute_names, attribute_values, ctx, STATE_INTERFACE))
}
static gboolean
-start_class (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_class (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *parent;
- const gchar *glib_type_struct;
- const gchar *typename;
- const gchar *typeinit;
- const gchar *deprecated;
- const gchar *abstract;
- const gchar *fundamental;
- const gchar *final;
- const gchar *ref_func;
- const gchar *unref_func;
- const gchar *set_value_func;
- const gchar *get_value_func;
+ const char *name;
+ const char *parent;
+ const char *glib_type_struct;
+ const char *typename;
+ const char *typeinit;
+ const char *deprecated;
+ const char *abstract;
+ const char *fundamental;
+ const char *final;
+ const char *ref_func;
+ const char *unref_func;
+ const char *set_value_func;
+ const char *get_value_func;
GIIrNodeInterface *iface;
if (!(strcmp (element_name, "class") == 0 &&
- ctx->state == STATE_NAMESPACE))
+ ctx->state == STATE_NAMESPACE))
return FALSE;
if (!introspectable_prelude (context, attribute_names, attribute_values, ctx, STATE_CLASS))
}
static gboolean
-start_type (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_type (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *ctype;
+ const char *name;
+ const char *ctype;
gboolean in_alias = FALSE;
gboolean is_array;
gboolean is_varargs;
ctx->type_parameters = NULL;
}
else if (ctx->state == STATE_FUNCTION_PARAMETER ||
- ctx->state == STATE_FUNCTION_RETURN ||
- ctx->state == STATE_STRUCT_FIELD ||
- ctx->state == STATE_UNION_FIELD ||
- ctx->state == STATE_CLASS_PROPERTY ||
- ctx->state == STATE_CLASS_FIELD ||
- ctx->state == STATE_INTERFACE_FIELD ||
- ctx->state == STATE_INTERFACE_PROPERTY ||
- ctx->state == STATE_BOXED_FIELD ||
- ctx->state == STATE_NAMESPACE_CONSTANT ||
- ctx->state == STATE_CLASS_CONSTANT ||
- ctx->state == STATE_INTERFACE_CONSTANT ||
- ctx->state == STATE_ALIAS
- )
+ ctx->state == STATE_FUNCTION_RETURN ||
+ ctx->state == STATE_STRUCT_FIELD ||
+ ctx->state == STATE_UNION_FIELD ||
+ ctx->state == STATE_CLASS_PROPERTY ||
+ ctx->state == STATE_CLASS_FIELD ||
+ ctx->state == STATE_INTERFACE_FIELD ||
+ ctx->state == STATE_INTERFACE_PROPERTY ||
+ ctx->state == STATE_BOXED_FIELD ||
+ ctx->state == STATE_NAMESPACE_CONSTANT ||
+ ctx->state == STATE_CLASS_CONSTANT ||
+ ctx->state == STATE_INTERFACE_CONSTANT ||
+ ctx->state == STATE_ALIAS
+ )
{
if (ctx->state == STATE_ALIAS)
- in_alias = TRUE;
+ in_alias = TRUE;
state_switch (ctx, STATE_TYPE);
ctx->type_depth = 1;
ctx->type_stack = NULL;
char *value;
if (name == NULL)
- {
- MISSING_ATTRIBUTE (context, error, element_name, "name");
- return FALSE;
- }
+ {
+ MISSING_ATTRIBUTE (context, error, element_name, "name");
+ return FALSE;
+ }
key = g_strdup_printf ("%s.%s", ctx->namespace, ctx->current_alias);
if (!strchr (name, '.'))
- {
- const BasicTypeInfo *basic = parse_basic (name);
- if (!basic)
- {
- /* For non-basic types, re-qualify the interface */
- value = g_strdup_printf ("%s.%s", ctx->namespace, name);
- }
- else
- {
- value = g_strdup (name);
- }
- }
+ {
+ const BasicTypeInfo *basic = parse_basic (name);
+ if (!basic)
+ {
+ /* For non-basic types, re-qualify the interface */
+ value = g_strdup_printf ("%s.%s", ctx->namespace, name);
+ }
+ else
+ {
+ value = g_strdup (name);
+ }
+ }
else
- value = g_strdup (name);
+ value = g_strdup (name);
g_hash_table_replace (ctx->aliases, key, value);
if (!ctx->current_typed)
{
g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_INVALID_CONTENT,
- "The element <type> is invalid here");
+ G_MARKUP_ERROR,
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ "The element <type> is invalid here");
return FALSE;
}
int pointer_depth;
if (name == NULL)
- {
- MISSING_ATTRIBUTE (context, error, element_name, "name");
- return FALSE;
- }
+ {
+ MISSING_ATTRIBUTE (context, error, element_name, "name");
+ return FALSE;
+ }
pointer_depth = 0;
ctype = find_attribute ("c:type", attribute_names, attribute_values);
while (cp > ctype && *cp-- == '*')
pointer_depth++;
- if (g_str_has_prefix (ctype, "gpointer")
- || g_str_has_prefix (ctype, "gconstpointer"))
- pointer_depth++;
+ if (g_str_has_prefix (ctype, "gpointer")
+ || g_str_has_prefix (ctype, "gconstpointer"))
+ pointer_depth++;
}
if (ctx->current_typed->type == GI_IR_NODE_PARAM &&
&is_disguised);
if (is_pointer || is_disguised)
- pointer_depth++;
+ pointer_depth++;
}
if (pointer_depth > 0)
- typenode->is_pointer = TRUE;
+ typenode->is_pointer = TRUE;
}
ctx->type_parameters = g_list_append (ctx->type_parameters, typenode);
typenode->tag == GI_TYPE_TAG_GSLIST)
{
if (typenode->parameter_type1 == NULL)
- typenode->parameter_type1 = parse_type (ctx, "gpointer");
+ typenode->parameter_type1 = parse_type (ctx, "gpointer");
}
else if (typenode->tag == GI_TYPE_TAG_GHASH)
{
if (typenode->parameter_type1 == NULL)
- {
- typenode->parameter_type1 = parse_type (ctx, "gpointer");
- typenode->parameter_type2 = parse_type (ctx, "gpointer");
- }
+ {
+ typenode->parameter_type1 = parse_type (ctx, "gpointer");
+ typenode->parameter_type2 = parse_type (ctx, "gpointer");
+ }
}
switch (ctx->current_typed->type)
{
case GI_IR_NODE_PARAM:
{
- GIIrNodeParam *param = (GIIrNodeParam *)ctx->current_typed;
- param->type = typenode;
+ GIIrNodeParam *param = (GIIrNodeParam *)ctx->current_typed;
+ param->type = typenode;
}
break;
case GI_IR_NODE_FIELD:
{
- GIIrNodeField *field = (GIIrNodeField *)ctx->current_typed;
- field->type = typenode;
+ GIIrNodeField *field = (GIIrNodeField *)ctx->current_typed;
+ field->type = typenode;
}
break;
case GI_IR_NODE_PROPERTY:
{
- GIIrNodeProperty *property = (GIIrNodeProperty *) ctx->current_typed;
- property->type = typenode;
+ GIIrNodeProperty *property = (GIIrNodeProperty *) ctx->current_typed;
+ property->type = typenode;
}
break;
case GI_IR_NODE_CONSTANT:
{
- GIIrNodeConstant *constant = (GIIrNodeConstant *)ctx->current_typed;
- constant->type = typenode;
+ GIIrNodeConstant *constant = (GIIrNodeConstant *)ctx->current_typed;
+ constant->type = typenode;
}
break;
default:
}
static gboolean
-start_attribute (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_attribute (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *value;
+ const char *name;
+ const char *value;
GIIrNode *curnode;
if (strcmp (element_name, "attribute") != 0 || ctx->node_stack == NULL)
}
static gboolean
-start_return_value (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_return_value (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
GIIrNodeParam *param;
- const gchar *transfer;
- const gchar *skip;
- const gchar *nullable;
+ const char *transfer;
+ const char *skip;
+ const char *nullable;
if (!(strcmp (element_name, "return-value") == 0 &&
- ctx->state == STATE_FUNCTION))
+ ctx->state == STATE_FUNCTION))
return FALSE;
param = (GIIrNodeParam *)gi_ir_node_new (GI_IR_NODE_PARAM,
case GI_IR_NODE_FUNCTION:
case GI_IR_NODE_CALLBACK:
{
- GIIrNodeFunction *func = (GIIrNodeFunction *)CURRENT_NODE (ctx);
- func->result = param;
+ GIIrNodeFunction *func = (GIIrNodeFunction *)CURRENT_NODE (ctx);
+ func->result = param;
}
break;
case GI_IR_NODE_SIGNAL:
{
- GIIrNodeSignal *signal = (GIIrNodeSignal *)CURRENT_NODE (ctx);
- signal->result = param;
+ GIIrNodeSignal *signal = (GIIrNodeSignal *)CURRENT_NODE (ctx);
+ signal->result = param;
}
break;
case GI_IR_NODE_VFUNC:
{
- GIIrNodeVFunc *vfunc = (GIIrNodeVFunc *)CURRENT_NODE (ctx);
- vfunc->result = param;
+ GIIrNodeVFunc *vfunc = (GIIrNodeVFunc *)CURRENT_NODE (ctx);
+ vfunc->result = param;
}
break;
default:
}
static gboolean
-start_implements (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_implements (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
GIIrNodeInterface *iface;
const char *name;
}
static gboolean
-start_glib_signal (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_glib_signal (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *when;
- const gchar *no_recurse;
- const gchar *detailed;
- const gchar *action;
- const gchar *no_hooks;
- const gchar *has_class_closure;
+ const char *name;
+ const char *when;
+ const char *no_recurse;
+ const char *detailed;
+ const char *action;
+ const char *no_hooks;
+ const char *has_class_closure;
GIIrNodeInterface *iface;
GIIrNodeSignal *signal;
if (!(strcmp (element_name, "glib:signal") == 0 &&
- (ctx->state == STATE_CLASS ||
- ctx->state == STATE_INTERFACE)))
+ (ctx->state == STATE_CLASS ||
+ ctx->state == STATE_INTERFACE)))
return FALSE;
if (!introspectable_prelude (context, attribute_names, attribute_values, ctx, STATE_FUNCTION))
}
static gboolean
-start_vfunc (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_vfunc (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *must_chain_up;
- const gchar *override;
- const gchar *is_class_closure;
- const gchar *offset;
- const gchar *invoker;
- const gchar *throws;
+ const char *name;
+ const char *must_chain_up;
+ const char *override;
+ const char *is_class_closure;
+ const char *offset;
+ const char *invoker;
+ const char *throws;
GIIrNodeInterface *iface;
GIIrNodeVFunc *vfunc;
if (!(strcmp (element_name, "virtual-method") == 0 &&
- (ctx->state == STATE_CLASS ||
- ctx->state == STATE_INTERFACE)))
+ (ctx->state == STATE_CLASS ||
+ ctx->state == STATE_INTERFACE)))
return FALSE;
if (!introspectable_prelude (context, attribute_names, attribute_values, ctx, STATE_FUNCTION))
}
static gboolean
-start_struct (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_struct (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *deprecated;
- const gchar *disguised;
- const gchar *opaque;
- const gchar *pointer;
- const gchar *gtype_name;
- const gchar *gtype_init;
- const gchar *gtype_struct;
- const gchar *foreign;
- const gchar *copy_func;
- const gchar *free_func;
+ const char *name;
+ const char *deprecated;
+ const char *disguised;
+ const char *opaque;
+ const char *pointer;
+ const char *gtype_name;
+ const char *gtype_init;
+ const char *gtype_struct;
+ const char *foreign;
+ const char *copy_func;
+ const char *free_func;
GIIrNodeStruct *struct_;
if (!(strcmp (element_name, "record") == 0 &&
- (ctx->state == STATE_NAMESPACE ||
- ctx->state == STATE_UNION ||
- ctx->state == STATE_STRUCT ||
- ctx->state == STATE_CLASS)))
+ (ctx->state == STATE_NAMESPACE ||
+ ctx->state == STATE_UNION ||
+ ctx->state == STATE_STRUCT ||
+ ctx->state == STATE_CLASS)))
return FALSE;
if (!introspectable_prelude (context, attribute_names, attribute_values, ctx, STATE_STRUCT))
}
static gboolean
-start_union (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_union (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *name;
- const gchar *deprecated;
- const gchar *typename;
- const gchar *typeinit;
- const gchar *copy_func;
- const gchar *free_func;
+ const char *name;
+ const char *deprecated;
+ const char *typename;
+ const char *typeinit;
+ const char *copy_func;
+ const char *free_func;
GIIrNodeUnion *union_;
if (!(strcmp (element_name, "union") == 0 &&
- (ctx->state == STATE_NAMESPACE ||
- ctx->state == STATE_UNION ||
- ctx->state == STATE_STRUCT ||
- ctx->state == STATE_CLASS)))
+ (ctx->state == STATE_NAMESPACE ||
+ ctx->state == STATE_UNION ||
+ ctx->state == STATE_STRUCT ||
+ ctx->state == STATE_CLASS)))
return FALSE;
if (!introspectable_prelude (context, attribute_names, attribute_values, ctx, STATE_UNION))
}
static gboolean
-start_discriminator (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- ParseContext *ctx,
- GError **error)
+start_discriminator (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ ParseContext *ctx,
+ GError **error)
{
- const gchar *type;
- const gchar *offset;
+ const char *type;
+ const char *offset;
if (!(strcmp (element_name, "discriminator") == 0 &&
- ctx->state == STATE_UNION))
+ ctx->state == STATE_UNION))
return FALSE;
type = find_attribute ("type", attribute_names, attribute_values);
static gboolean
parse_include (GMarkupParseContext *context,
- ParseContext *ctx,
- const char *name,
- const char *version)
+ ParseContext *ctx,
+ const char *name,
+ const char *version)
{
GError *error = NULL;
- gchar *buffer;
+ char *buffer;
gsize length;
- gchar *girpath, *girname;
+ char *girpath, *girname;
GIIrModule *module;
GList *l;
GIIrModule *m = l->data;
if (strcmp (m->name, name) == 0)
- {
- if (strcmp (m->version, version) == 0)
- {
- ctx->include_modules = g_list_prepend (ctx->include_modules, m);
-
- return TRUE;
- }
- else
- {
- g_printerr ("Module '%s' imported with conflicting versions '%s' and '%s'\n",
- name, m->version, version);
- return FALSE;
- }
- }
+ {
+ if (strcmp (m->version, version) == 0)
+ {
+ ctx->include_modules = g_list_prepend (ctx->include_modules, m);
+
+ return TRUE;
+ }
+ else
+ {
+ g_printerr ("Module '%s' imported with conflicting versions '%s' and '%s'\n",
+ name, m->version, version);
+ return FALSE;
+ }
+ }
}
girname = g_strdup_printf ("%s-%s.gir", name, version);
if (girpath == NULL)
{
g_printerr ("Could not find GIR file '%s'; check XDG_DATA_DIRS or use --includedir\n",
- girname);
+ girname);
g_free (girname);
return FALSE;
}
g_free (girname);
- g_debug ("Parsing include %s\n", girpath);
+ g_debug ("Parsing include %s", girpath);
if (!g_file_get_contents (girpath, &buffer, &length, &error))
{
g_free (girpath);
ctx->include_modules = g_list_append (ctx->include_modules,
- module);
+ module);
return TRUE;
}
extern GLogLevelFlags logged_levels;
static void
-start_element_handler (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- gpointer user_data,
- GError **error)
+start_element_handler (GMarkupParseContext *context,
+ const char *element_name,
+ const char **attribute_names,
+ const char **attribute_values,
+ gpointer user_data,
+ GError **error)
{
ParseContext *ctx = user_data;
int i;
for (i = 0; attribute_names[i]; i++)
g_string_append_printf (tags, "%s=\"%s\" ",
- attribute_names[i],
- attribute_values[i]);
+ attribute_names[i],
+ attribute_values[i]);
if (i)
{
{
case 'a':
if (ctx->state == STATE_NAMESPACE && strcmp (element_name, "alias") == 0)
- {
- state_switch (ctx, STATE_ALIAS);
- goto out;
- }
+ {
+ state_switch (ctx, STATE_ALIAS);
+ goto out;
+ }
if (start_type (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
else if (start_attribute (context, element_name,
attribute_names, attribute_values,
ctx, error))
break;
case 'b':
if (start_enum (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
break;
case 'c':
if (start_function (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
else if (start_constant (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
else if (start_class (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
break;
case 'd':
if (start_discriminator (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
+ attribute_names, attribute_values,
+ ctx, error))
goto out;
if (strcmp ("doc", element_name) == 0 || strcmp ("doc-deprecated", element_name) == 0 ||
strcmp ("doc-stability", element_name) == 0 || strcmp ("doc-version", element_name) == 0 ||
case 'e':
if (start_enum (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
break;
case 'f':
goto out;
}
else if (start_function (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
else if (start_field (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
break;
case 'g':
if (start_glib_boxed (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
else if (start_glib_signal (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
break;
case 'i':
if (strcmp (element_name, "include") == 0 &&
- ctx->state == STATE_REPOSITORY)
- {
- const gchar *name;
- const gchar *version;
-
- name = find_attribute ("name", attribute_names, attribute_values);
- version = find_attribute ("version", attribute_names, attribute_values);
-
- if (name == NULL)
- {
- MISSING_ATTRIBUTE (context, error, element_name, "name");
- break;
- }
- if (version == NULL)
- {
- MISSING_ATTRIBUTE (context, error, element_name, "version");
- break;
- }
-
- if (!parse_include (context, ctx, name, version))
- {
- g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_INVALID_CONTENT,
- "Failed to parse included gir %s-%s",
- name,
- version);
- return;
- }
-
- ctx->dependencies = g_list_prepend (ctx->dependencies,
- g_strdup_printf ("%s-%s", name, version));
-
-
- state_switch (ctx, STATE_INCLUDE);
- goto out;
- }
+ ctx->state == STATE_REPOSITORY)
+ {
+ const char *name;
+ const char *version;
+
+ name = find_attribute ("name", attribute_names, attribute_values);
+ version = find_attribute ("version", attribute_names, attribute_values);
+
+ if (name == NULL)
+ {
+ MISSING_ATTRIBUTE (context, error, element_name, "name");
+ break;
+ }
+ if (version == NULL)
+ {
+ MISSING_ATTRIBUTE (context, error, element_name, "version");
+ break;
+ }
+
+ if (!parse_include (context, ctx, name, version))
+ {
+ g_set_error (error,
+ G_MARKUP_ERROR,
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ "Failed to parse included gir %s-%s",
+ name,
+ version);
+ return;
+ }
+
+ ctx->dependencies = g_list_prepend (ctx->dependencies,
+ g_strdup_printf ("%s-%s", name, version));
+
+
+ state_switch (ctx, STATE_INCLUDE);
+ goto out;
+ }
if (start_interface (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
else if (start_implements (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
else if (start_instance_parameter (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
else if (strcmp (element_name, "c:include") == 0)
- {
- state_switch (ctx, STATE_C_INCLUDE);
- goto out;
- }
+ {
+ state_switch (ctx, STATE_C_INCLUDE);
+ goto out;
+ }
break;
case 'm':
if (start_function (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
else if (start_member (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
break;
case 'n':
if (strcmp (element_name, "namespace") == 0 && ctx->state == STATE_REPOSITORY)
- {
- const gchar *name, *version, *shared_library, *cprefix;
-
- if (ctx->current_module != NULL)
- {
- g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_INVALID_CONTENT,
- "Only one <namespace/> element is currently allowed per <repository/>");
- goto out;
- }
-
- name = find_attribute ("name", attribute_names, attribute_values);
- version = find_attribute ("version", attribute_names, attribute_values);
- shared_library = find_attribute ("shared-library", attribute_names, attribute_values);
- cprefix = find_attribute ("c:identifier-prefixes", attribute_names, attribute_values);
+ {
+ const char *name, *version, *shared_library, *cprefix;
+
+ if (ctx->current_module != NULL)
+ {
+ g_set_error (error,
+ G_MARKUP_ERROR,
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ "Only one <namespace/> element is currently allowed per <repository/>");
+ goto out;
+ }
+
+ name = find_attribute ("name", attribute_names, attribute_values);
+ version = find_attribute ("version", attribute_names, attribute_values);
+ shared_library = find_attribute ("shared-library", attribute_names, attribute_values);
+ cprefix = find_attribute ("c:identifier-prefixes", attribute_names, attribute_values);
/* Backwards compatibility; vala currently still generates this */
if (cprefix == NULL)
cprefix = find_attribute ("c:prefix", attribute_names, attribute_values);
- if (name == NULL)
- MISSING_ATTRIBUTE (context, error, element_name, "name");
- else if (version == NULL)
- MISSING_ATTRIBUTE (context, error, element_name, "version");
- else
- {
- GList *l;
+ if (name == NULL)
+ MISSING_ATTRIBUTE (context, error, element_name, "name");
+ else if (version == NULL)
+ MISSING_ATTRIBUTE (context, error, element_name, "version");
+ else
+ {
+ GList *l;
- if (strcmp (name, ctx->namespace) != 0)
- g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_INVALID_CONTENT,
- "<namespace/> name element '%s' doesn't match file name '%s'",
- name, ctx->namespace);
+ if (strcmp (name, ctx->namespace) != 0)
+ g_set_error (error,
+ G_MARKUP_ERROR,
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ "<namespace/> name element '%s' doesn't match file name '%s'",
+ name, ctx->namespace);
- ctx->current_module = gi_ir_module_new (name, version, shared_library, cprefix);
+ ctx->current_module = gi_ir_module_new (name, version, shared_library, cprefix);
- ctx->current_module->aliases = ctx->aliases;
- ctx->aliases = NULL;
- ctx->current_module->disguised_structures = ctx->disguised_structures;
- ctx->current_module->pointer_structures = ctx->pointer_structures;
- ctx->disguised_structures = NULL;
- ctx->pointer_structures = NULL;
+ ctx->current_module->aliases = ctx->aliases;
+ ctx->aliases = NULL;
+ ctx->current_module->disguised_structures = ctx->disguised_structures;
+ ctx->current_module->pointer_structures = ctx->pointer_structures;
+ ctx->disguised_structures = NULL;
+ ctx->pointer_structures = NULL;
- for (l = ctx->include_modules; l; l = l->next)
- gi_ir_module_add_include_module (ctx->current_module, l->data);
+ for (l = ctx->include_modules; l; l = l->next)
+ gi_ir_module_add_include_module (ctx->current_module, l->data);
- g_list_free (ctx->include_modules);
- ctx->include_modules = NULL;
+ g_list_free (ctx->include_modules);
+ ctx->include_modules = NULL;
- ctx->modules = g_list_append (ctx->modules, ctx->current_module);
- ctx->current_module->dependencies = ctx->dependencies;
+ ctx->modules = g_list_append (ctx->modules, ctx->current_module);
+ ctx->current_module->dependencies = ctx->dependencies;
- state_switch (ctx, STATE_NAMESPACE);
- goto out;
- }
- }
+ state_switch (ctx, STATE_NAMESPACE);
+ goto out;
+ }
+ }
break;
case 'p':
if (start_property (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
else if (strcmp (element_name, "parameters") == 0 &&
- ctx->state == STATE_FUNCTION)
- {
- state_switch (ctx, STATE_FUNCTION_PARAMETERS);
+ ctx->state == STATE_FUNCTION)
+ {
+ state_switch (ctx, STATE_FUNCTION_PARAMETERS);
- goto out;
- }
+ goto out;
+ }
else if (start_parameter (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
else if (strcmp (element_name, "prerequisite") == 0 &&
- ctx->state == STATE_INTERFACE)
- {
- const gchar *name;
+ ctx->state == STATE_INTERFACE)
+ {
+ const char *name;
- name = find_attribute ("name", attribute_names, attribute_values);
+ name = find_attribute ("name", attribute_names, attribute_values);
- state_switch (ctx, STATE_PREREQUISITE);
+ state_switch (ctx, STATE_PREREQUISITE);
- if (name == NULL)
- MISSING_ATTRIBUTE (context, error, element_name, "name");
- else
- {
- GIIrNodeInterface *iface;
+ if (name == NULL)
+ MISSING_ATTRIBUTE (context, error, element_name, "name");
+ else
+ {
+ GIIrNodeInterface *iface;
- iface = (GIIrNodeInterface *)CURRENT_NODE(ctx);
- iface->prerequisites = g_list_append (iface->prerequisites, g_strdup (name));
- }
- goto out;
- }
+ iface = (GIIrNodeInterface *)CURRENT_NODE(ctx);
+ iface->prerequisites = g_list_append (iface->prerequisites, g_strdup (name));
+ }
+ goto out;
+ }
else if (strcmp (element_name, "package") == 0 &&
ctx->state == STATE_REPOSITORY)
{
case 'r':
if (strcmp (element_name, "repository") == 0 && ctx->state == STATE_START)
- {
- const gchar *version;
-
- version = find_attribute ("version", attribute_names, attribute_values);
-
- if (version == NULL)
- MISSING_ATTRIBUTE (context, error, element_name, "version");
- else if (strcmp (version, SUPPORTED_GIR_VERSION) != 0)
- g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_INVALID_CONTENT,
- "Unsupported version '%s'",
- version);
- else
- state_switch (ctx, STATE_REPOSITORY);
-
- goto out;
- }
+ {
+ const char *version;
+
+ version = find_attribute ("version", attribute_names, attribute_values);
+
+ if (version == NULL)
+ MISSING_ATTRIBUTE (context, error, element_name, "version");
+ else if (strcmp (version, SUPPORTED_GIR_VERSION) != 0)
+ g_set_error (error,
+ G_MARKUP_ERROR,
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ "Unsupported version '%s'",
+ version);
+ else
+ state_switch (ctx, STATE_REPOSITORY);
+
+ goto out;
+ }
else if (start_return_value (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
else if (start_struct (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
break;
case 's':
break;
case 'u':
if (start_union (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
break;
case 't':
if (start_type (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
break;
case 'v':
if (start_vfunc (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
if (start_type (context, element_name,
- attribute_names, attribute_values,
- ctx, error))
- goto out;
+ attribute_names, attribute_values,
+ ctx, error))
+ goto out;
break;
default:
break;
if (*error == NULL && ctx->state != STATE_PASSTHROUGH)
{
- gint line_number, char_number;
+ int line_number, char_number;
g_markup_parse_context_get_position (context, &line_number, &char_number);
if (!g_str_has_prefix (element_name, "c:"))
- g_printerr ("%s:%d:%d: warning: element %s from state %d is unknown, ignoring\n",
- ctx->file_path, line_number, char_number, element_name,
- ctx->state);
+ g_printerr ("%s:%d:%d: warning: element %s from state %d is unknown, ignoring\n",
+ ctx->file_path, line_number, char_number, element_name,
+ ctx->state);
state_switch (ctx, STATE_PASSTHROUGH);
}
out:
if (*error)
{
- gint line_number, char_number;
+ int line_number, char_number;
g_markup_parse_context_get_position (context, &line_number, &char_number);
g_printerr ("%s:%d:%d: error: %s\n", ctx->file_path, line_number, char_number, (*error)->message);
}
static gboolean
-require_one_of_end_elements (GMarkupParseContext *context,
- ParseContext *ctx,
- const char *actual_name,
- GError **error,
- ...)
+require_one_of_end_elements (GMarkupParseContext *context,
+ ParseContext *ctx,
+ const char *actual_name,
+ GError **error,
+ ...)
{
va_list args;
int line_number, char_number;
while ((expected = va_arg (args, const char*)) != NULL)
{
if (strcmp (expected, actual_name) == 0)
- {
- matched = TRUE;
- break;
- }
+ {
+ matched = TRUE;
+ break;
+ }
}
va_end (args);
g_markup_parse_context_get_position (context, &line_number, &char_number);
g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_INVALID_CONTENT,
- "Unexpected end tag '%s' on line %d char %d; current state=%d (prev=%d)",
- actual_name,
- line_number, char_number, ctx->state, ctx->prev_state);
+ G_MARKUP_ERROR,
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ "Unexpected end tag '%s' on line %d char %d; current state=%d (prev=%d)",
+ actual_name,
+ line_number, char_number, ctx->state, ctx->prev_state);
return FALSE;
}
static gboolean
-state_switch_end_struct_or_union (GMarkupParseContext *context,
- ParseContext *ctx,
- const gchar *element_name,
- GError **error)
+state_switch_end_struct_or_union (GMarkupParseContext *context,
+ ParseContext *ctx,
+ const char *element_name,
+ GError **error)
{
pop_node (ctx);
if (ctx->node_stack == NULL)
}
static gboolean
-require_end_element (GMarkupParseContext *context,
- ParseContext *ctx,
- const char *expected_name,
- const char *actual_name,
- GError **error)
+require_end_element (GMarkupParseContext *context,
+ ParseContext *ctx,
+ const char *expected_name,
+ const char *actual_name,
+ GError **error)
{
return require_one_of_end_elements (context, ctx, actual_name, error, expected_name, NULL);
}
static void
-end_element_handler (GMarkupParseContext *context,
- const gchar *element_name,
- gpointer user_data,
- GError **error)
+end_element_handler (GMarkupParseContext *context,
+ const char *element_name,
+ gpointer user_data,
+ GError **error)
{
ParseContext *ctx = user_data;
case STATE_INCLUDE:
if (require_end_element (context, ctx, "include", element_name, error))
- {
+ {
state_switch (ctx, STATE_REPOSITORY);
}
break;
case STATE_C_INCLUDE:
if (require_end_element (context, ctx, "c:include", element_name, error))
- {
+ {
state_switch (ctx, STATE_REPOSITORY);
}
break;
case STATE_NAMESPACE:
if (require_end_element (context, ctx, "namespace", element_name, error))
- {
+ {
ctx->current_module = NULL;
state_switch (ctx, STATE_REPOSITORY);
}
case STATE_ALIAS:
if (require_end_element (context, ctx, "alias", element_name, error))
- {
- g_free (ctx->current_alias);
- ctx->current_alias = NULL;
- state_switch (ctx, STATE_NAMESPACE);
- }
+ {
+ g_free (ctx->current_alias);
+ ctx->current_alias = NULL;
+ state_switch (ctx, STATE_NAMESPACE);
+ }
break;
case STATE_FUNCTION_RETURN:
if (strcmp ("type", element_name) == 0)
- break;
+ break;
if (require_end_element (context, ctx, "return-value", element_name, error))
- {
- state_switch (ctx, STATE_FUNCTION);
- }
+ {
+ state_switch (ctx, STATE_FUNCTION);
+ }
break;
case STATE_FUNCTION_PARAMETERS:
if (require_end_element (context, ctx, "parameters", element_name, error))
- {
- state_switch (ctx, STATE_FUNCTION);
- }
+ {
+ state_switch (ctx, STATE_FUNCTION);
+ }
break;
case STATE_FUNCTION_PARAMETER:
if (strcmp ("type", element_name) == 0)
- break;
+ break;
if (require_end_element (context, ctx, "parameter", element_name, error))
- {
- state_switch (ctx, STATE_FUNCTION_PARAMETERS);
- }
+ {
+ state_switch (ctx, STATE_FUNCTION_PARAMETERS);
+ }
break;
case STATE_FUNCTION:
{
pop_node (ctx);
- if (ctx->node_stack == NULL)
- {
- state_switch (ctx, STATE_NAMESPACE);
- }
- else
- {
+ if (ctx->node_stack == NULL)
+ {
+ state_switch (ctx, STATE_NAMESPACE);
+ }
+ else
+ {
g_debug("case STATE_FUNCTION %d", CURRENT_NODE (ctx)->type);
if (ctx->in_embedded_state != STATE_NONE)
{
state_switch (ctx, ctx->in_embedded_state);
ctx->in_embedded_state = STATE_NONE;
}
- else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_INTERFACE)
- state_switch (ctx, STATE_INTERFACE);
- else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_OBJECT)
- state_switch (ctx, STATE_CLASS);
- else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_BOXED)
- state_switch (ctx, STATE_BOXED);
- else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_STRUCT)
- state_switch (ctx, STATE_STRUCT);
- else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_UNION)
- state_switch (ctx, STATE_UNION);
- else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_ENUM ||
- CURRENT_NODE (ctx)->type == GI_IR_NODE_FLAGS)
- state_switch (ctx, STATE_ENUM);
- else
- {
- int line_number, char_number;
- g_markup_parse_context_get_position (context, &line_number, &char_number);
- g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_INVALID_CONTENT,
- "Unexpected end tag '%s' on line %d char %d",
- element_name,
- line_number, char_number);
- }
- }
+ else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_INTERFACE)
+ state_switch (ctx, STATE_INTERFACE);
+ else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_OBJECT)
+ state_switch (ctx, STATE_CLASS);
+ else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_BOXED)
+ state_switch (ctx, STATE_BOXED);
+ else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_STRUCT)
+ state_switch (ctx, STATE_STRUCT);
+ else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_UNION)
+ state_switch (ctx, STATE_UNION);
+ else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_ENUM ||
+ CURRENT_NODE (ctx)->type == GI_IR_NODE_FLAGS)
+ state_switch (ctx, STATE_ENUM);
+ else
+ {
+ int line_number, char_number;
+ g_markup_parse_context_get_position (context, &line_number, &char_number);
+ g_set_error (error,
+ G_MARKUP_ERROR,
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ "Unexpected end tag '%s' on line %d char %d",
+ element_name,
+ line_number, char_number);
+ }
+ }
}
break;
case STATE_CLASS_FIELD:
if (strcmp ("type", element_name) == 0)
- break;
+ break;
if (require_end_element (context, ctx, "field", element_name, error))
- {
- state_switch (ctx, STATE_CLASS);
- }
+ {
+ state_switch (ctx, STATE_CLASS);
+ }
break;
case STATE_CLASS_PROPERTY:
if (strcmp ("type", element_name) == 0)
- break;
+ break;
if (require_end_element (context, ctx, "property", element_name, error))
- {
- state_switch (ctx, STATE_CLASS);
- }
+ {
+ state_switch (ctx, STATE_CLASS);
+ }
break;
case STATE_CLASS:
if (require_end_element (context, ctx, "class", element_name, error))
- {
- pop_node (ctx);
- state_switch (ctx, STATE_NAMESPACE);
- }
+ {
+ pop_node (ctx);
+ state_switch (ctx, STATE_NAMESPACE);
+ }
break;
case STATE_INTERFACE_PROPERTY:
if (strcmp ("type", element_name) == 0)
- break;
+ break;
if (require_end_element (context, ctx, "property", element_name, error))
- {
- state_switch (ctx, STATE_INTERFACE);
- }
+ {
+ state_switch (ctx, STATE_INTERFACE);
+ }
break;
case STATE_INTERFACE_FIELD:
if (strcmp ("type", element_name) == 0)
- break;
+ break;
if (require_end_element (context, ctx, "field", element_name, error))
- {
- state_switch (ctx, STATE_INTERFACE);
- }
+ {
+ state_switch (ctx, STATE_INTERFACE);
+ }
break;
case STATE_INTERFACE:
if (require_end_element (context, ctx, "interface", element_name, error))
- {
- pop_node (ctx);
- state_switch (ctx, STATE_NAMESPACE);
- }
+ {
+ pop_node (ctx);
+ state_switch (ctx, STATE_NAMESPACE);
+ }
break;
case STATE_ENUM:
if (strcmp ("member", element_name) == 0)
- break;
+ break;
else if (strcmp ("function", element_name) == 0)
- break;
+ break;
else if (require_one_of_end_elements (context, ctx,
- element_name, error, "enumeration",
- "bitfield", NULL))
- {
- pop_node (ctx);
- state_switch (ctx, STATE_NAMESPACE);
- }
+ element_name, error, "enumeration",
+ "bitfield", NULL))
+ {
+ pop_node (ctx);
+ state_switch (ctx, STATE_NAMESPACE);
+ }
break;
case STATE_BOXED:
if (require_end_element (context, ctx, "glib:boxed", element_name, error))
- {
- pop_node (ctx);
- state_switch (ctx, STATE_NAMESPACE);
- }
+ {
+ pop_node (ctx);
+ state_switch (ctx, STATE_NAMESPACE);
+ }
break;
case STATE_BOXED_FIELD:
if (strcmp ("type", element_name) == 0)
- break;
+ break;
if (require_end_element (context, ctx, "field", element_name, error))
- {
- state_switch (ctx, STATE_BOXED);
- }
+ {
+ state_switch (ctx, STATE_BOXED);
+ }
break;
case STATE_STRUCT_FIELD:
if (strcmp ("type", element_name) == 0)
- break;
+ break;
if (require_end_element (context, ctx, "field", element_name, error))
- {
- state_switch (ctx, STATE_STRUCT);
- }
+ {
+ state_switch (ctx, STATE_STRUCT);
+ }
break;
case STATE_STRUCT:
if (require_end_element (context, ctx, "record", element_name, error))
- {
- state_switch_end_struct_or_union (context, ctx, element_name, error);
- }
+ {
+ state_switch_end_struct_or_union (context, ctx, element_name, error);
+ }
break;
case STATE_UNION_FIELD:
if (strcmp ("type", element_name) == 0)
- break;
+ break;
if (require_end_element (context, ctx, "field", element_name, error))
- {
- state_switch (ctx, STATE_UNION);
- }
+ {
+ state_switch (ctx, STATE_UNION);
+ }
break;
case STATE_UNION:
if (require_end_element (context, ctx, "union", element_name, error))
- {
- state_switch_end_struct_or_union (context, ctx, element_name, error);
- }
+ {
+ state_switch_end_struct_or_union (context, ctx, element_name, error);
+ }
break;
case STATE_IMPLEMENTS:
if (strcmp ("interface", element_name) == 0)
- break;
+ break;
if (require_end_element (context, ctx, "implements", element_name, error))
state_switch (ctx, STATE_CLASS);
break;
case STATE_CLASS_CONSTANT:
case STATE_INTERFACE_CONSTANT:
if (strcmp ("type", element_name) == 0)
- break;
+ break;
if (require_end_element (context, ctx, "constant", element_name, error))
- {
- switch (ctx->state)
- {
- case STATE_NAMESPACE_CONSTANT:
- pop_node (ctx);
- state_switch (ctx, STATE_NAMESPACE);
- break;
- case STATE_CLASS_CONSTANT:
- state_switch (ctx, STATE_CLASS);
- break;
- case STATE_INTERFACE_CONSTANT:
- state_switch (ctx, STATE_INTERFACE);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
- }
+ {
+ switch (ctx->state)
+ {
+ case STATE_NAMESPACE_CONSTANT:
+ pop_node (ctx);
+ state_switch (ctx, STATE_NAMESPACE);
+ break;
+ case STATE_CLASS_CONSTANT:
+ state_switch (ctx, STATE_CLASS);
+ break;
+ case STATE_INTERFACE_CONSTANT:
+ state_switch (ctx, STATE_INTERFACE);
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+ }
break;
case STATE_TYPE:
if ((strcmp ("type", element_name) == 0) || (strcmp ("array", element_name) == 0) ||
- (strcmp ("varargs", element_name) == 0))
- {
- end_type (ctx);
- }
+ (strcmp ("varargs", element_name) == 0))
+ {
+ end_type (ctx);
+ }
break;
case STATE_ATTRIBUTE:
if (strcmp ("attribute", element_name) == 0)
state_switch (ctx, ctx->prev_state);
break;
default:
- g_error ("Unhandled state %d in end_element_handler\n", ctx->state);
+ g_error ("Unhandled state %d in end_element_handler", ctx->state);
}
}
static void
-text_handler (GMarkupParseContext *context,
- const gchar *text,
- gsize text_len,
- gpointer user_data,
- GError **error)
+text_handler (GMarkupParseContext *context,
+ const char *text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error)
{
/* FIXME warn about non-whitespace text */
}
static void
cleanup (GMarkupParseContext *context,
- GError *error,
- gpointer user_data)
+ GError *error,
+ void *user_data)
{
ParseContext *ctx = user_data;
GList *m;
*/
GIIrModule *
gi_ir_parser_parse_string (GIIrParser *parser,
- const gchar *namespace,
- const gchar *filename,
- const gchar *buffer,
+ const char *namespace,
+ const char *filename,
+ const char *buffer,
gssize length,
GError **error)
{
goto out;
parser->parsed_modules = g_list_concat (g_list_copy (ctx.modules),
- parser->parsed_modules);
+ parser->parsed_modules);
out:
*/
GIIrModule *
gi_ir_parser_parse_file (GIIrParser *parser,
- const gchar *filename,
+ const char *filename,
GError **error)
{
- gchar *buffer;
+ char *buffer;
gsize length;
GIIrModule *module;
char *dash;
if (!g_str_has_suffix (filename, ".gir"))
{
g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_INVALID_CONTENT,
- "Expected filename to end with '.gir'");
+ G_MARKUP_ERROR,
+ G_MARKUP_ERROR_INVALID_CONTENT,
+ "Expected filename to end with '.gir'");
return NULL;
}
typedef struct {
char *name;
- guint has_children : 1;
+ unsigned has_children : 1;
} XmlElement;
static XmlElement *
if (gi_base_info_get_info_type (info) != GI_INFO_TYPE_UNRESOLVED)
return;
- g_critical ("Found unresolved type '%s' '%s'\n",
- gi_base_info_get_name (info), gi_base_info_get_namespace (info));
+ g_critical ("Found unresolved type '%s' '%s'",
+ gi_base_info_get_name (info), gi_base_info_get_namespace (info));
}
static void
-write_type_name (const gchar *ns,
- GIBaseInfo *info,
- Xml *file)
+write_type_name (const char *ns,
+ GIBaseInfo *info,
+ Xml *file)
{
if (strcmp (ns, gi_base_info_get_namespace (info)) != 0)
xml_printf (file, "%s.", gi_base_info_get_namespace (info));
}
static void
-write_type_name_attribute (const gchar *ns,
- GIBaseInfo *info,
- const char *attr_name,
- Xml *file)
+write_type_name_attribute (const char *ns,
+ GIBaseInfo *info,
+ const char *attr_name,
+ Xml *file)
{
xml_printf (file, " %s=\"", attr_name);
write_type_name (ns, info, file);
}
static void
-write_type_info (const gchar *ns,
- GITypeInfo *info,
- Xml *file)
+write_type_info (const char *ns,
+ GITypeInfo *info,
+ Xml *file)
{
- gint tag;
+ int tag;
GITypeInfo *type;
gboolean is_pointer;
}
else if (tag == GI_TYPE_TAG_ARRAY)
{
- gint length;
- gssize size;
+ unsigned int length_index;
+ size_t size;
const char *name = NULL;
xml_start_element (file, "array");
type = gi_type_info_get_param_type (info, 0);
- length = gi_type_info_get_array_length_index (info);
- if (length >= 0)
- xml_printf (file, " length=\"%d\"", length);
+ if (gi_type_info_get_array_length_index (info, &length_index))
+ xml_printf (file, " length=\"%u\"", length_index);
- size = gi_type_info_get_array_fixed_size (info);
- if (size >= 0)
- xml_printf (file, " fixed-size=\"%" G_GSSIZE_FORMAT "\"", size);
+ if (gi_type_info_get_array_fixed_size (info, &size))
+ xml_printf (file, " fixed-size=\"%zu\"", size);
if (gi_type_info_is_zero_terminated (info))
- xml_printf (file, " zero-terminated=\"1\"");
+ xml_printf (file, " zero-terminated=\"1\"");
write_type_info (ns, type, file);
xml_printf (file, " name=\"GLib.List\"");
type = gi_type_info_get_param_type (info, 0);
if (type)
- {
- write_type_info (ns, type, file);
- gi_base_info_unref ((GIBaseInfo *)type);
- }
+ {
+ write_type_info (ns, type, file);
+ gi_base_info_unref ((GIBaseInfo *)type);
+ }
xml_end_element (file, "type");
}
else if (tag == GI_TYPE_TAG_GSLIST)
xml_printf (file, " name=\"GLib.SList\"");
type = gi_type_info_get_param_type (info, 0);
if (type)
- {
- write_type_info (ns, type, file);
- gi_base_info_unref ((GIBaseInfo *)type);
- }
+ {
+ write_type_info (ns, type, file);
+ gi_base_info_unref ((GIBaseInfo *)type);
+ }
xml_end_element (file, "type");
}
else if (tag == GI_TYPE_TAG_GHASH)
xml_printf (file, " name=\"GLib.HashTable\"");
type = gi_type_info_get_param_type (info, 0);
if (type)
- {
- write_type_info (ns, type, file);
- gi_base_info_unref ((GIBaseInfo *)type);
- type = gi_type_info_get_param_type (info, 1);
- write_type_info (ns, type, file);
- gi_base_info_unref ((GIBaseInfo *)type);
- }
+ {
+ write_type_info (ns, type, file);
+ gi_base_info_unref ((GIBaseInfo *)type);
+ type = gi_type_info_get_param_type (info, 1);
+ write_type_info (ns, type, file);
+ gi_base_info_unref ((GIBaseInfo *)type);
+ }
xml_end_element (file, "type");
}
else if (tag == GI_TYPE_TAG_ERROR)
write_attributes (Xml *file,
GIBaseInfo *info)
{
- GIAttributeIter iter = { 0, };
+ GIAttributeIter iter = GI_ATTRIBUTE_ITER_INIT;
const char *name, *value;
while (gi_base_info_iterate_attributes (info, &iter, &name, &value))
write_return_value_attributes (Xml *file,
GICallableInfo *info)
{
- GIAttributeIter iter = { 0, };
+ GIAttributeIter iter = GI_ATTRIBUTE_ITER_INIT;
const char *name, *value;
while (gi_callable_info_iterate_return_attributes (info, &iter, &name, &value))
}
static void
-write_constant_value (const gchar *ns,
- GITypeInfo *info,
- GIArgument *argument,
- Xml *file);
+write_constant_value (const char *ns,
+ GITypeInfo *info,
+ GIArgument *argument,
+ Xml *file);
static void
-write_callback_info (const gchar *ns,
- GICallbackInfo *info,
- Xml *file);
+write_callback_info (const char *ns,
+ GICallbackInfo *info,
+ Xml *file);
static void
-write_field_info (const gchar *ns,
- GIFieldInfo *info,
- GIConstantInfo *branch,
- Xml *file)
+write_field_info (const char *ns,
+ GIFieldInfo *info,
+ GIConstantInfo *branch,
+ Xml *file)
{
- const gchar *name;
+ const char *name;
GIFieldInfoFlags flags;
- gint size;
- gint offset;
+ size_t size;
+ size_t offset;
GITypeInfo *type;
GIBaseInfo *interface;
GIArgument value;
xml_printf (file, " writable=\"1\"");
if (size)
- xml_printf (file, " bits=\"%d\"", size);
+ xml_printf (file, " bits=\"%zu\"", size);
write_attributes (file, (GIBaseInfo*) info);
if (file->show_all)
{
- if (offset >= 0)
- xml_printf (file, "offset=\"%d\"", offset);
+ xml_printf (file, "offset=\"%zu\"", offset);
}
interface = gi_type_info_get_interface (type);
}
static void
-write_callable_info (const gchar *ns,
- GICallableInfo *info,
- Xml *file)
+write_callable_info (const char *ns,
+ GICallableInfo *info,
+ Xml *file)
{
GITypeInfo *type;
return;
xml_start_element (file, "parameters");
- for (guint i = 0; i < gi_callable_info_get_n_args (info); i++)
+ for (unsigned int i = 0; i < gi_callable_info_get_n_args (info); i++)
{
GIArgInfo *arg = gi_callable_info_get_arg (info, i);
+ unsigned int closure_index, destroy_index;
xml_start_element (file, "parameter");
xml_printf (file, " name=\"%s\"",
write_ownership_transfer (gi_arg_info_get_ownership_transfer (arg), file);
switch (gi_arg_info_get_direction (arg))
- {
- case GI_DIRECTION_IN:
- break;
- case GI_DIRECTION_OUT:
- xml_printf (file, " direction=\"out\" caller-allocates=\"%s\"",
- gi_arg_info_is_caller_allocates (arg) ? "1" : "0");
- break;
- case GI_DIRECTION_INOUT:
- xml_printf (file, " direction=\"inout\"");
- break;
- default:
- g_assert_not_reached ();
- }
+ {
+ case GI_DIRECTION_IN:
+ break;
+ case GI_DIRECTION_OUT:
+ xml_printf (file, " direction=\"out\" caller-allocates=\"%s\"",
+ gi_arg_info_is_caller_allocates (arg) ? "1" : "0");
+ break;
+ case GI_DIRECTION_INOUT:
+ xml_printf (file, " direction=\"inout\"");
+ break;
+ default:
+ g_assert_not_reached ();
+ }
if (gi_arg_info_may_be_null (arg))
- xml_printf (file, " allow-none=\"1\"");
+ xml_printf (file, " allow-none=\"1\"");
if (gi_arg_info_is_return_value (arg))
- xml_printf (file, " retval=\"1\"");
+ xml_printf (file, " retval=\"1\"");
if (gi_arg_info_is_optional (arg))
- xml_printf (file, " optional=\"1\"");
+ xml_printf (file, " optional=\"1\"");
switch (gi_arg_info_get_scope (arg))
{
g_assert_not_reached ();
}
- if (gi_arg_info_get_closure_index (arg) >= 0)
- xml_printf (file, " closure=\"%d\"", gi_arg_info_get_closure_index (arg));
+ if (gi_arg_info_get_closure_index (arg, &closure_index))
+ xml_printf (file, " closure=\"%u\"", closure_index);
- if (gi_arg_info_get_destroy_index (arg) >= 0)
- xml_printf (file, " destroy=\"%d\"", gi_arg_info_get_destroy_index (arg));
+ if (gi_arg_info_get_destroy_index (arg, &destroy_index))
+ xml_printf (file, " destroy=\"%u\"", destroy_index);
if (gi_arg_info_is_skip (arg))
xml_printf (file, " skip=\"1\"");
}
static void
-write_function_info (const gchar *ns,
- GIFunctionInfo *info,
- Xml *file)
+write_function_info (const char *ns,
+ GIFunctionInfo *info,
+ Xml *file)
{
GIFunctionInfoFlags flags;
- const gchar *tag;
- const gchar *name;
- const gchar *symbol;
+ const char *tag;
+ const char *name;
+ const char *symbol;
gboolean deprecated;
flags = gi_function_info_get_flags (info);
}
static void
-write_callback_info (const gchar *ns,
- GICallbackInfo *info,
- Xml *file)
+write_callback_info (const char *ns,
+ GICallbackInfo *info,
+ Xml *file)
{
- const gchar *name;
+ const char *name;
gboolean deprecated;
name = gi_base_info_get_name ((GIBaseInfo *)info);
}
static void
-write_struct_info (const gchar *ns,
- GIStructInfo *info,
- Xml *file)
+write_struct_info (const char *ns,
+ GIStructInfo *info,
+ Xml *file)
{
- const gchar *name;
- const gchar *type_name;
- const gchar *type_init;
- const gchar *func;
+ const char *name;
+ const char *type_name;
+ const char *type_init;
+ const char *func;
gboolean deprecated;
gboolean is_gtype_struct;
gboolean foreign;
- gint size;
- guint n_elts;
+ size_t size;
+ unsigned int n_elts;
name = gi_base_info_get_name ((GIBaseInfo *)info);
deprecated = gi_base_info_is_deprecated ((GIBaseInfo *)info);
write_attributes (file, (GIBaseInfo*) info);
size = gi_struct_info_get_size (info);
- if (file->show_all && size >= 0)
- xml_printf (file, " size=\"%d\"", size);
+ if (file->show_all)
+ xml_printf (file, " size=\"%zu\"", size);
foreign = gi_struct_info_is_foreign (info);
if (foreign)
n_elts = gi_struct_info_get_n_fields (info) + gi_struct_info_get_n_methods (info);
if (n_elts > 0)
{
- for (guint i = 0; i < gi_struct_info_get_n_fields (info); i++)
- {
- GIFieldInfo *field = gi_struct_info_get_field (info, i);
- write_field_info (ns, field, NULL, file);
- gi_base_info_unref ((GIBaseInfo *)field);
- }
-
- for (guint i = 0; i < gi_struct_info_get_n_methods (info); i++)
- {
- GIFunctionInfo *function = gi_struct_info_get_method (info, i);
- write_function_info (ns, function, file);
- gi_base_info_unref ((GIBaseInfo *)function);
- }
+ for (unsigned int i = 0; i < gi_struct_info_get_n_fields (info); i++)
+ {
+ GIFieldInfo *field = gi_struct_info_get_field (info, i);
+ write_field_info (ns, field, NULL, file);
+ gi_base_info_unref ((GIBaseInfo *)field);
+ }
+
+ for (unsigned int i = 0; i < gi_struct_info_get_n_methods (info); i++)
+ {
+ GIFunctionInfo *function = gi_struct_info_get_method (info, i);
+ write_function_info (ns, function, file);
+ gi_base_info_unref ((GIBaseInfo *)function);
+ }
}
}
static void
-write_value_info (const gchar *ns,
- GIValueInfo *info,
- Xml *file)
+write_value_info (const char *ns,
+ GIValueInfo *info,
+ Xml *file)
{
- const gchar *name;
- gint64 value;
- gchar *value_str;
+ const char *name;
+ int64_t value;
+ char *value_str;
gboolean deprecated;
name = gi_base_info_get_name ((GIBaseInfo *)info);
}
static void
-write_constant_value (const gchar *ns,
- GITypeInfo *type,
- GIArgument *value,
- Xml *file)
+write_constant_value (const char *ns,
+ GITypeInfo *type,
+ GIArgument *value,
+ Xml *file)
{
switch (gi_type_info_get_tag (type))
{
}
static void
-write_constant_info (const gchar *ns,
- GIConstantInfo *info,
- Xml *file)
+write_constant_info (const char *ns,
+ GIConstantInfo *info,
+ Xml *file)
{
GITypeInfo *type;
- const gchar *name;
+ const char *name;
GIArgument value;
name = gi_base_info_get_name ((GIBaseInfo *)info);
static void
-write_enum_info (const gchar *ns,
- GIEnumInfo *info,
- Xml *file)
+write_enum_info (const char *ns,
+ GIEnumInfo *info,
+ Xml *file)
{
- const gchar *name;
- const gchar *type_name;
- const gchar *type_init;
- const gchar *error_domain;
+ const char *name;
+ const char *type_name;
+ const char *type_init;
+ const char *error_domain;
gboolean deprecated;
name = gi_base_info_get_name ((GIBaseInfo *)info);
write_attributes (file, (GIBaseInfo*) info);
- for (guint i = 0; i < gi_enum_info_get_n_values (info); i++)
+ for (unsigned int i = 0; i < gi_enum_info_get_n_values (info); i++)
{
GIValueInfo *value = gi_enum_info_get_value (info, i);
write_value_info (ns, value, file);
}
static void
-write_signal_info (const gchar *ns,
- GISignalInfo *info,
- Xml *file)
+write_signal_info (const char *ns,
+ GISignalInfo *info,
+ Xml *file)
{
GSignalFlags flags;
- const gchar *name;
+ const char *name;
gboolean deprecated;
name = gi_base_info_get_name ((GIBaseInfo *)info);
}
static void
-write_vfunc_info (const gchar *ns,
- GIVFuncInfo *info,
- Xml *file)
+write_vfunc_info (const char *ns,
+ GIVFuncInfo *info,
+ Xml *file)
{
GIVFuncInfoFlags flags;
- const gchar *name;
+ const char *name;
GIFunctionInfo *invoker;
gboolean deprecated;
- gint offset;
+ size_t offset;
name = gi_base_info_get_name ((GIBaseInfo *)info);
flags = gi_vfunc_info_get_flags (info);
else if (flags & GI_VFUNC_MUST_NOT_OVERRIDE)
xml_printf (file, " override=\"never\"");
- xml_printf (file, " offset=\"%d\"", offset);
+ xml_printf (file, " offset=\"%zu\"", offset);
if (invoker)
{
}
static void
-write_property_info (const gchar *ns,
- GIPropertyInfo *info,
- Xml *file)
+write_property_info (const char *ns,
+ GIPropertyInfo *info,
+ Xml *file)
{
GParamFlags flags;
- const gchar *name;
+ const char *name;
gboolean deprecated;
GITypeInfo *type;
}
static void
-write_object_info (const gchar *ns,
- GIObjectInfo *info,
- Xml *file)
+write_object_info (const char *ns,
+ GIObjectInfo *info,
+ Xml *file)
{
- const gchar *name;
- const gchar *type_name;
- const gchar *type_init;
- const gchar *func;
+ const char *name;
+ const char *type_name;
+ const char *type_init;
+ const char *func;
gboolean deprecated;
gboolean is_abstract;
gboolean is_fundamental;
if (gi_object_info_get_n_interfaces (info) > 0)
{
- for (guint i = 0; i < gi_object_info_get_n_interfaces (info); i++)
- {
- GIInterfaceInfo *imp = gi_object_info_get_interface (info, i);
+ for (unsigned int i = 0; i < gi_object_info_get_n_interfaces (info); i++)
+ {
+ GIInterfaceInfo *imp = gi_object_info_get_interface (info, i);
xml_start_element (file, "implements");
- write_type_name_attribute (ns, (GIBaseInfo *)imp, "name", file);
+ write_type_name_attribute (ns, (GIBaseInfo *)imp, "name", file);
xml_end_element (file, "implements");
- gi_base_info_unref ((GIBaseInfo*)imp);
- }
+ gi_base_info_unref ((GIBaseInfo*)imp);
+ }
}
- for (guint i = 0; i < gi_object_info_get_n_fields (info); i++)
+ for (unsigned int i = 0; i < gi_object_info_get_n_fields (info); i++)
{
GIFieldInfo *field = gi_object_info_get_field (info, i);
write_field_info (ns, field, NULL, file);
gi_base_info_unref ((GIBaseInfo *)field);
}
- for (guint i = 0; i < gi_object_info_get_n_methods (info); i++)
+ for (unsigned int i = 0; i < gi_object_info_get_n_methods (info); i++)
{
GIFunctionInfo *function = gi_object_info_get_method (info, i);
write_function_info (ns, function, file);
gi_base_info_unref ((GIBaseInfo *)function);
}
- for (guint i = 0; i < gi_object_info_get_n_properties (info); i++)
+ for (unsigned int i = 0; i < gi_object_info_get_n_properties (info); i++)
{
GIPropertyInfo *prop = gi_object_info_get_property (info, i);
write_property_info (ns, prop, file);
gi_base_info_unref ((GIBaseInfo *)prop);
}
- for (guint i = 0; i < gi_object_info_get_n_signals (info); i++)
+ for (unsigned int i = 0; i < gi_object_info_get_n_signals (info); i++)
{
GISignalInfo *signal = gi_object_info_get_signal (info, i);
write_signal_info (ns, signal, file);
gi_base_info_unref ((GIBaseInfo *)signal);
}
- for (guint i = 0; i < gi_object_info_get_n_vfuncs (info); i++)
+ for (unsigned int i = 0; i < gi_object_info_get_n_vfuncs (info); i++)
{
GIVFuncInfo *vfunc = gi_object_info_get_vfunc (info, i);
write_vfunc_info (ns, vfunc, file);
gi_base_info_unref ((GIBaseInfo *)vfunc);
}
- for (guint i = 0; i < gi_object_info_get_n_constants (info); i++)
+ for (unsigned int i = 0; i < gi_object_info_get_n_constants (info); i++)
{
GIConstantInfo *constant = gi_object_info_get_constant (info, i);
write_constant_info (ns, constant, file);
}
static void
-write_interface_info (const gchar *ns,
- GIInterfaceInfo *info,
- Xml *file)
+write_interface_info (const char *ns,
+ GIInterfaceInfo *info,
+ Xml *file)
{
- const gchar *name;
- const gchar *type_name;
- const gchar *type_init;
+ const char *name;
+ const char *type_name;
+ const char *type_init;
GIStructInfo *class_struct;
gboolean deprecated;
type_init = gi_registered_type_info_get_type_init_function_name ((GIRegisteredTypeInfo*)info);
xml_start_element (file, "interface");
xml_printf (file, " name=\"%s\" glib:type-name=\"%s\" glib:get-type=\"%s\"",
- name, type_name, type_init);
+ name, type_name, type_init);
class_struct = gi_interface_info_get_iface_struct (info);
if (class_struct)
if (gi_interface_info_get_n_prerequisites (info) > 0)
{
- for (guint i = 0; i < gi_interface_info_get_n_prerequisites (info); i++)
- {
- GIBaseInfo *req = gi_interface_info_get_prerequisite (info, i);
+ for (unsigned int i = 0; i < gi_interface_info_get_n_prerequisites (info); i++)
+ {
+ GIBaseInfo *req = gi_interface_info_get_prerequisite (info, i);
- xml_start_element (file, "prerequisite");
- write_type_name_attribute (ns, req, "name", file);
+ xml_start_element (file, "prerequisite");
+ write_type_name_attribute (ns, req, "name", file);
xml_end_element_unchecked (file);
- gi_base_info_unref (req);
- }
+ gi_base_info_unref (req);
+ }
}
- for (guint i = 0; i < gi_interface_info_get_n_methods (info); i++)
+ for (unsigned int i = 0; i < gi_interface_info_get_n_methods (info); i++)
{
GIFunctionInfo *function = gi_interface_info_get_method (info, i);
write_function_info (ns, function, file);
gi_base_info_unref ((GIBaseInfo *)function);
}
- for (guint i = 0; i < gi_interface_info_get_n_properties (info); i++)
+ for (unsigned int i = 0; i < gi_interface_info_get_n_properties (info); i++)
{
GIPropertyInfo *prop = gi_interface_info_get_property (info, i);
write_property_info (ns, prop, file);
gi_base_info_unref ((GIBaseInfo *)prop);
}
- for (guint i = 0; i < gi_interface_info_get_n_signals (info); i++)
+ for (unsigned int i = 0; i < gi_interface_info_get_n_signals (info); i++)
{
GISignalInfo *signal = gi_interface_info_get_signal (info, i);
write_signal_info (ns, signal, file);
gi_base_info_unref ((GIBaseInfo *)signal);
}
- for (guint i = 0; i < gi_interface_info_get_n_vfuncs (info); i++)
+ for (unsigned int i = 0; i < gi_interface_info_get_n_vfuncs (info); i++)
{
GIVFuncInfo *vfunc = gi_interface_info_get_vfunc (info, i);
write_vfunc_info (ns, vfunc, file);
gi_base_info_unref ((GIBaseInfo *)vfunc);
}
- for (guint i = 0; i < gi_interface_info_get_n_constants (info); i++)
+ for (unsigned int i = 0; i < gi_interface_info_get_n_constants (info); i++)
{
GIConstantInfo *constant = gi_interface_info_get_constant (info, i);
write_constant_info (ns, constant, file);
}
static void
-write_union_info (const gchar *ns,
- GIUnionInfo *info,
- Xml *file)
+write_union_info (const char *ns,
+ GIUnionInfo *info,
+ Xml *file)
{
- const gchar *name;
- const gchar *type_name;
- const gchar *type_init;
- const gchar *func;
+ const char *name;
+ const char *type_name;
+ const char *type_init;
+ const char *func;
gboolean deprecated;
- gsize size;
+ size_t size;
name = gi_base_info_get_name ((GIBaseInfo *)info);
deprecated = gi_base_info_is_deprecated ((GIBaseInfo *)info);
if (gi_union_info_is_discriminated (info))
{
- guint offset;
+ size_t offset;
GITypeInfo *type;
offset = gi_union_info_get_discriminator_offset (info);
type = gi_union_info_get_discriminator_type (info);
xml_start_element (file, "discriminator");
- xml_printf (file, " offset=\"%d\" type=\"", offset);
+ xml_printf (file, " offset=\"%zu\" type=\"", offset);
write_type_info (ns, type, file);
xml_end_element (file, "discriminator");
gi_base_info_unref ((GIBaseInfo *)type);
}
- for (guint i = 0; i < gi_union_info_get_n_fields (info); i++)
+ for (unsigned int i = 0; i < gi_union_info_get_n_fields (info); i++)
{
GIFieldInfo *field = gi_union_info_get_field (info, i);
GIConstantInfo *constant = gi_union_info_get_discriminator (info, i);
write_field_info (ns, field, constant, file);
gi_base_info_unref ((GIBaseInfo *)field);
if (constant)
- gi_base_info_unref ((GIBaseInfo *)constant);
+ gi_base_info_unref ((GIBaseInfo *)constant);
}
- for (guint i = 0; i < gi_union_info_get_n_methods (info); i++)
+ for (unsigned int i = 0; i < gi_union_info_get_n_methods (info); i++)
{
GIFunctionInfo *function = gi_union_info_get_method (info, i);
write_function_info (ns, function, file);
gboolean show_all)
{
FILE *ofile;
- gint i, j;
+ size_t i, j;
char **dependencies;
GIRepository *repository;
Xml *xml;
ofile = stdout;
else
{
- gchar *full_filename;
+ char *full_filename;
if (needs_prefix)
- full_filename = g_strdup_printf ("%s-%s", ns, filename);
+ full_filename = g_strdup_printf ("%s-%s", ns, filename);
else
- full_filename = g_strdup (filename);
+ full_filename = g_strdup (filename);
ofile = g_fopen (filename, "w");
if (ofile == NULL)
- {
- g_fprintf (stderr, "failed to open '%s': %s\n",
- full_filename, g_strerror (errno));
- g_free (full_filename);
+ {
+ g_fprintf (stderr, "failed to open '%s': %s\n",
+ full_filename, g_strerror (errno));
+ g_free (full_filename);
- return;
- }
+ return;
+ }
g_free (full_filename);
}
xml_printf (xml, "<?xml version=\"1.0\"?>\n");
xml_start_element (xml, "repository");
xml_printf (xml, " version=\"1.0\"\n"
- " xmlns=\"http://www.gtk.org/introspection/core/1.0\"\n"
- " xmlns:c=\"http://www.gtk.org/introspection/c/1.0\"\n"
- " xmlns:glib=\"http://www.gtk.org/introspection/glib/1.0\"");
+ " xmlns=\"http://www.gtk.org/introspection/core/1.0\"\n"
+ " xmlns:c=\"http://www.gtk.org/introspection/c/1.0\"\n"
+ " xmlns:glib=\"http://www.gtk.org/introspection/glib/1.0\"");
dependencies = gi_repository_get_immediate_dependencies (repository, ns);
if (dependencies != NULL)
{
for (i = 0; dependencies[i]; i++)
- {
- char **parts = g_strsplit (dependencies[i], "-", 2);
- xml_start_element (xml, "include");
- xml_printf (xml, " name=\"%s\" version=\"%s\"", parts[0], parts[1]);
- xml_end_element (xml, "include");
- g_strfreev (parts);
- }
+ {
+ char **parts = g_strsplit (dependencies[i], "-", 2);
+ xml_start_element (xml, "include");
+ xml_printf (xml, " name=\"%s\" version=\"%s\"", parts[0], parts[1]);
+ xml_end_element (xml, "include");
+ g_strfreev (parts);
+ }
}
if (TRUE)
{
- const gchar *shared_library;
- const gchar *c_prefix;
+ const char * const *shared_libraries;
+ const char *c_prefix;
const char *cur_ns = ns;
const char *cur_version;
- gint n_infos;
+ unsigned int n_infos;
cur_version = gi_repository_get_version (repository, cur_ns);
- shared_library = gi_repository_get_shared_library (repository, cur_ns);
+ shared_libraries = gi_repository_get_shared_libraries (repository, cur_ns, NULL);
c_prefix = gi_repository_get_c_prefix (repository, cur_ns);
xml_start_element (xml, "namespace");
xml_printf (xml, " name=\"%s\" version=\"%s\"", cur_ns, cur_version);
- if (shared_library)
- xml_printf (xml, " shared-library=\"%s\"", shared_library);
+ if (shared_libraries != NULL)
+ {
+ char *shared_libraries_str = g_strjoinv (",", (char **) shared_libraries);
+ xml_printf (xml, " shared-library=\"%s\"", shared_libraries_str);
+ g_free (shared_libraries_str);
+ }
if (c_prefix)
xml_printf (xml, " c:prefix=\"%s\"", c_prefix);
n_infos = gi_repository_get_n_infos (repository, cur_ns);
for (j = 0; j < n_infos; j++)
- {
- GIBaseInfo *info = gi_repository_get_info (repository, cur_ns, j);
- switch (gi_base_info_get_info_type (info))
- {
- case GI_INFO_TYPE_FUNCTION:
- write_function_info (ns, (GIFunctionInfo *)info, xml);
- break;
-
- case GI_INFO_TYPE_CALLBACK:
- write_callback_info (ns, (GICallbackInfo *)info, xml);
- break;
-
- case GI_INFO_TYPE_STRUCT:
- case GI_INFO_TYPE_BOXED:
- write_struct_info (ns, (GIStructInfo *)info, xml);
- break;
-
- case GI_INFO_TYPE_UNION:
- write_union_info (ns, (GIUnionInfo *)info, xml);
- break;
-
- case GI_INFO_TYPE_ENUM:
- case GI_INFO_TYPE_FLAGS:
- write_enum_info (ns, (GIEnumInfo *)info, xml);
- break;
-
- case GI_INFO_TYPE_CONSTANT:
- write_constant_info (ns, (GIConstantInfo *)info, xml);
- break;
-
- case GI_INFO_TYPE_OBJECT:
- write_object_info (ns, (GIObjectInfo *)info, xml);
- break;
-
- case GI_INFO_TYPE_INTERFACE:
- write_interface_info (ns, (GIInterfaceInfo *)info, xml);
- break;
-
- default:
- g_error ("unknown info type %d\n", gi_base_info_get_info_type (info));
- }
-
- gi_base_info_unref (info);
- }
+ {
+ GIBaseInfo *info = gi_repository_get_info (repository, cur_ns, j);
+ switch (gi_base_info_get_info_type (info))
+ {
+ case GI_INFO_TYPE_FUNCTION:
+ write_function_info (ns, (GIFunctionInfo *)info, xml);
+ break;
+
+ case GI_INFO_TYPE_CALLBACK:
+ write_callback_info (ns, (GICallbackInfo *)info, xml);
+ break;
+
+ case GI_INFO_TYPE_STRUCT:
+ case GI_INFO_TYPE_BOXED:
+ write_struct_info (ns, (GIStructInfo *)info, xml);
+ break;
+
+ case GI_INFO_TYPE_UNION:
+ write_union_info (ns, (GIUnionInfo *)info, xml);
+ break;
+
+ case GI_INFO_TYPE_ENUM:
+ case GI_INFO_TYPE_FLAGS:
+ write_enum_info (ns, (GIEnumInfo *)info, xml);
+ break;
+
+ case GI_INFO_TYPE_CONSTANT:
+ write_constant_info (ns, (GIConstantInfo *)info, xml);
+ break;
+
+ case GI_INFO_TYPE_OBJECT:
+ write_object_info (ns, (GIObjectInfo *)info, xml);
+ break;
+
+ case GI_INFO_TYPE_INTERFACE:
+ write_interface_info (ns, (GIInterfaceInfo *)info, xml);
+ break;
+
+ default:
+ g_error ("unknown info type %d", gi_base_info_get_info_type (info));
+ }
+
+ gi_base_info_unref (info);
+ }
xml_end_element (xml, "namespace");
}
G_BEGIN_DECLS
+#define GI_TYPE_SIGNAL_INFO (gi_signal_info_get_type ())
+
+/**
+ * GI_SIGNAL_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.SignalInfo] or derived pointer into a
+ * `(GISignalInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_SIGNAL_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_SIGNAL_INFO, GISignalInfo))
+
/**
* GI_IS_SIGNAL_INFO:
* @info: an info structure
*
- * Checks if @info is a [class@GIRepository.SignalInfo].
+ * Checks if @info is a [class@GIRepository.SignalInfo] (or a derived type).
*
* Since: 2.80
*/
-#define GI_IS_SIGNAL_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_SIGNAL)
+#define GI_IS_SIGNAL_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_SIGNAL_INFO))
GI_AVAILABLE_IN_ALL
* Returns: number of fields
* Since: 2.80
*/
-guint
+unsigned int
gi_struct_info_get_n_fields (GIStructInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
* Returns: field offset, in bytes
* Since: 2.80
*/
-static gint32
+static size_t
gi_struct_get_field_offset (GIStructInfo *info,
- guint n)
+ uint16_t n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
- guint32 offset = rinfo->offset + header->struct_blob_size;
+ size_t offset = rinfo->offset + header->struct_blob_size;
FieldBlob *field_blob;
- for (guint i = 0; i < n; i++)
+ for (uint16_t i = 0; i < n; i++)
{
field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
offset += header->field_blob_size;
*/
GIFieldInfo *
gi_struct_info_get_field (GIStructInfo *info,
- guint n)
+ unsigned int n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
+
return (GIFieldInfo *) gi_info_new (GI_INFO_TYPE_FIELD, (GIBaseInfo*)info, rinfo->typelib,
gi_struct_get_field_offset (info, n));
}
*/
GIFieldInfo *
gi_struct_info_find_field (GIStructInfo *info,
- const gchar *name)
+ const char *name)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
Header *header = (Header *)rinfo->typelib->data;
- guint32 offset = rinfo->offset + header->struct_blob_size;
- gint i;
+ size_t offset = rinfo->offset + header->struct_blob_size;
- for (i = 0; i < blob->n_fields; i++)
+ for (size_t i = 0; i < blob->n_fields; i++)
{
FieldBlob *field_blob = (FieldBlob *)&rinfo->typelib->data[offset];
- const gchar *fname = (const gchar *)&rinfo->typelib->data[field_blob->name];
+ const char *fname = (const char *)&rinfo->typelib->data[field_blob->name];
if (strcmp (name, fname) == 0)
{
* Returns: number of methods
* Since: 2.80
*/
-guint
+unsigned int
gi_struct_info_get_n_methods (GIStructInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIFunctionInfo *
gi_struct_info_get_method (GIStructInfo *info,
- guint n)
+ unsigned int n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
Header *header = (Header *)rinfo->typelib->data;
- gint offset;
+ size_t offset;
+
+ g_return_val_if_fail (n <= G_MAXUINT16, NULL);
offset = gi_struct_get_field_offset (info, blob->n_fields) + n * header->function_blob_size;
return (GIFunctionInfo *) gi_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
*/
GIFunctionInfo *
gi_struct_info_find_method (GIStructInfo *info,
- const gchar *name)
+ const char *name)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset];
* Returns: size of the structure, in bytes
* Since: 2.80
*/
-gsize
+size_t
gi_struct_info_get_size (GIStructInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
* Returns: required alignment, in bytes
* Since: 2.80
*/
-gsize
+size_t
gi_struct_info_get_alignment (GIStructInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
G_BEGIN_DECLS
+#define GI_TYPE_STRUCT_INFO (gi_struct_info_get_type ())
+
+/**
+ * GI_STRUCT_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.StructInfo] or derived pointer into a
+ * `(GIStructInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_STRUCT_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_STRUCT_INFO, GIStructInfo))
+
/**
* GI_IS_STRUCT_INFO:
* @info: an info structure
*
- * Checks if @info is a [class@GIRepository.StructInfo].
+ * Checks if @info is a [class@GIRepository.StructInfo] (or a derived type).
*
* Since: 2.80
*/
-#define GI_IS_STRUCT_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_STRUCT)
+#define GI_IS_STRUCT_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_STRUCT_INFO))
GI_AVAILABLE_IN_ALL
-guint gi_struct_info_get_n_fields (GIStructInfo *info);
+unsigned int gi_struct_info_get_n_fields (GIStructInfo *info);
GI_AVAILABLE_IN_ALL
GIFieldInfo * gi_struct_info_get_field (GIStructInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
GIFieldInfo * gi_struct_info_find_field (GIStructInfo *info,
- const gchar *name);
+ const char *name);
GI_AVAILABLE_IN_ALL
-guint gi_struct_info_get_n_methods (GIStructInfo *info);
+unsigned int gi_struct_info_get_n_methods (GIStructInfo *info);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_struct_info_get_method (GIStructInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_struct_info_find_method (GIStructInfo *info,
- const gchar *name);
+ const char *name);
GI_AVAILABLE_IN_ALL
-gsize gi_struct_info_get_size (GIStructInfo *info);
+size_t gi_struct_info_get_size (GIStructInfo *info);
GI_AVAILABLE_IN_ALL
-gsize gi_struct_info_get_alignment (GIStructInfo *info);
+size_t gi_struct_info_get_alignment (GIStructInfo *info);
GI_AVAILABLE_IN_ALL
gboolean gi_struct_info_is_gtype_struct (GIStructInfo *info);
* Since: 2.80
*/
GITypeInfo *
-gi_type_info_get_param_type (GITypeInfo *info,
- guint n)
+gi_type_info_get_param_type (GITypeInfo *info,
+ unsigned int n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
SimpleTypeBlob *type;
/**
* gi_type_info_get_array_length_index:
* @info: a #GITypeInfo
+ * @out_length_index: (out) (optional): return location for the length argument
*
* Obtain the position of the argument which gives the array length of the type.
*
- * The type tag must be a `GI_TYPE_TAG_ARRAY` or `-1` will be returned.
+ * The type tag must be a `GI_TYPE_TAG_ARRAY` with a length argument, or `FALSE`
+ * will be returned.
*
- * Returns: the array length argument index, or `-1` if the type is not an array
- * or it has no length argument
+ * Returns: `TRUE` if the type is an array and has a length argument
* Since: 2.80
*/
-gint
-gi_type_info_get_array_length_index (GITypeInfo *info)
+gboolean
+gi_type_info_get_array_length_index (GITypeInfo *info,
+ unsigned int *out_length_index)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
SimpleTypeBlob *type;
- g_return_val_if_fail (info != NULL, -1);
- g_return_val_if_fail (GI_IS_TYPE_INFO (info), -1);
+ g_return_val_if_fail (info != NULL, FALSE);
+ g_return_val_if_fail (GI_IS_TYPE_INFO (info), FALSE);
type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (blob->tag == GI_TYPE_TAG_ARRAY)
- {
- if (blob->has_length)
- return blob->dimensions.length;
- }
+ {
+ if (blob->has_length)
+ {
+ if (out_length_index != NULL)
+ *out_length_index = blob->dimensions.length;
+ return TRUE;
+ }
+ }
}
- return -1;
+ if (out_length_index != NULL)
+ *out_length_index = 0;
+ return FALSE;
}
/**
* gi_type_info_get_array_fixed_size:
* @info: a #GITypeInfo
+ * @out_size: (out) (optional): return location for the array size
*
* Obtain the fixed array size of the type, in number of elements (not bytes).
*
- * The type tag must be a `GI_TYPE_TAG_ARRAY` or `-1` will be returned.
+ * The type tag must be a `GI_TYPE_TAG_ARRAY` with a fixed size, or `FALSE` will
+ * be returned.
*
- * Returns: the size or `-1` if the type is not an array or it has no fixed size
+ * Returns: `TRUE` if the type is an array and has a fixed size
* Since: 2.80
*/
-gssize
-gi_type_info_get_array_fixed_size (GITypeInfo *info)
+gboolean
+gi_type_info_get_array_fixed_size (GITypeInfo *info,
+ size_t *out_size)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
SimpleTypeBlob *type;
- g_return_val_if_fail (info != NULL, -1);
- g_return_val_if_fail (GI_IS_TYPE_INFO (info), -1);
+ g_return_val_if_fail (info != NULL, FALSE);
+ g_return_val_if_fail (GI_IS_TYPE_INFO (info), FALSE);
type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset];
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (blob->tag == GI_TYPE_TAG_ARRAY)
- {
- if (blob->has_size)
- return blob->dimensions.size;
- }
+ {
+ if (blob->has_size)
+ {
+ if (out_size != NULL)
+ *out_size = blob->dimensions.size;
+ return TRUE;
+ }
+ }
}
- return -1;
+ if (out_size != NULL)
+ *out_size = 0;
+ return FALSE;
}
/**
ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset];
if (blob->tag == GI_TYPE_TAG_ARRAY)
- return blob->zero_terminated;
+ return blob->zero_terminated;
}
return FALSE;
*
* Obtain the array type for this type.
*
- * See [enum@GIRepository.ArrayType] for a list of possible values. If the type
- * tag of this type is not array, `-1` will be returned.
+ * See [enum@GIRepository.ArrayType] for a list of possible values.
+ *
+ * It is an error to call this on an @info which is not an array type. Use
+ * [method@GIRepository.TypeInfo.get_tag] to check.
*
- * Returns: the array type or `-1`
+ * Returns: the array type
* Since: 2.80
*/
GIArrayType
return blob->array_type;
}
- return -1;
+ /* Not an array type */
+ g_assert_not_reached ();
}
/**
*/
void
gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type,
- gpointer hash_pointer,
+ void *hash_pointer,
GIArgument *arg)
{
switch (storage_type)
arg->v_boolean = !!GPOINTER_TO_INT (hash_pointer);
break;
case GI_TYPE_TAG_INT8:
- arg->v_int8 = (gint8)GPOINTER_TO_INT (hash_pointer);
+ arg->v_int8 = (int8_t) GPOINTER_TO_INT (hash_pointer);
break;
case GI_TYPE_TAG_UINT8:
- arg->v_uint8 = (guint8)GPOINTER_TO_UINT (hash_pointer);
+ arg->v_uint8 = (uint8_t) GPOINTER_TO_UINT (hash_pointer);
break;
case GI_TYPE_TAG_INT16:
- arg->v_int16 = (gint16)GPOINTER_TO_INT (hash_pointer);
+ arg->v_int16 = (int16_t) GPOINTER_TO_INT (hash_pointer);
break;
case GI_TYPE_TAG_UINT16:
- arg->v_uint16 = (guint16)GPOINTER_TO_UINT (hash_pointer);
+ arg->v_uint16 = (uint16_t) GPOINTER_TO_UINT (hash_pointer);
break;
case GI_TYPE_TAG_INT32:
- arg->v_int32 = (gint32)GPOINTER_TO_INT (hash_pointer);
+ arg->v_int32 = (int32_t) GPOINTER_TO_INT (hash_pointer);
break;
case GI_TYPE_TAG_UINT32:
case GI_TYPE_TAG_UNICHAR:
- arg->v_uint32 = (guint32)GPOINTER_TO_UINT (hash_pointer);
+ arg->v_uint32 = (uint32_t) GPOINTER_TO_UINT (hash_pointer);
break;
case GI_TYPE_TAG_GTYPE:
arg->v_size = GPOINTER_TO_SIZE (hash_pointer);
*/
void
gi_type_info_argument_from_hash_pointer (GITypeInfo *info,
- gpointer hash_pointer,
+ void *hash_pointer,
GIArgument *arg)
{
GITypeTag storage_type = gi_type_info_get_storage_type (info);
* for example
* Since: 2.80
*/
-gpointer
+void *
gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
GIArgument *arg)
{
* for example
* Since: 2.80
*/
-gpointer
+void *
gi_type_info_hash_pointer_from_argument (GITypeInfo *info,
GIArgument *arg)
{
G_BEGIN_DECLS
+#define GI_TYPE_TYPE_INFO (gi_type_info_get_type ())
+
+/**
+ * GI_TYPE_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.TypeInfo] or derived pointer into a
+ * `(GITypeInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_TYPE_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_TYPE_INFO, GITypeInfo))
+
/**
* GI_IS_TYPE_INFO:
* @info: an info structure
*
- * Checks if @info is a [alias@GIRepository.TypeInfo].
+ * Checks if @info is a [alias@GIRepository.TypeInfo] (or a derived type).
*
* Since: 2.80
*/
-#define GI_IS_TYPE_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_TYPE)
+#define GI_IS_TYPE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_TYPE_INFO))
/**
* GI_TYPE_TAG_IS_BASIC:
((tag) >= GI_TYPE_TAG_GLIST && (tag) <= GI_TYPE_TAG_GHASH))
GI_AVAILABLE_IN_ALL
-const gchar* gi_type_tag_to_string (GITypeTag type);
+const char * gi_type_tag_to_string (GITypeTag type);
GI_AVAILABLE_IN_ALL
-const gchar* gi_info_type_to_string (GIInfoType type);
+const char * gi_info_type_to_string (GIInfoType type);
GI_AVAILABLE_IN_ALL
GITypeTag gi_type_info_get_tag (GITypeInfo *info);
GI_AVAILABLE_IN_ALL
-GITypeInfo * gi_type_info_get_param_type (GITypeInfo *info,
- guint n);
+GITypeInfo * gi_type_info_get_param_type (GITypeInfo *info,
+ unsigned int n);
GI_AVAILABLE_IN_ALL
GIBaseInfo * gi_type_info_get_interface (GITypeInfo *info);
GI_AVAILABLE_IN_ALL
-gint gi_type_info_get_array_length_index (GITypeInfo *info);
+gboolean gi_type_info_get_array_length_index (GITypeInfo *info,
+ unsigned int *out_length_index);
GI_AVAILABLE_IN_ALL
-gssize gi_type_info_get_array_fixed_size (GITypeInfo *info);
+gboolean gi_type_info_get_array_fixed_size (GITypeInfo *info,
+ size_t *out_size);
GI_AVAILABLE_IN_ALL
gboolean gi_type_info_is_zero_terminated (GITypeInfo *info);
GI_AVAILABLE_IN_ALL
void gi_type_info_argument_from_hash_pointer (GITypeInfo *info,
- gpointer hash_pointer,
+ void *hash_pointer,
GIArgument *arg);
GI_AVAILABLE_IN_ALL
-gpointer gi_type_info_hash_pointer_from_argument (GITypeInfo *info,
+void * gi_type_info_hash_pointer_from_argument (GITypeInfo *info,
GIArgument *arg);
GI_AVAILABLE_IN_ALL
void gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type,
- gpointer hash_pointer,
+ void *hash_pointer,
GIArgument *arg);
GI_AVAILABLE_IN_ALL
-gpointer gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
+void * gi_type_tag_hash_pointer_from_argument (GITypeTag storage_type,
GIArgument *arg);
G_END_DECLS
* Since: 2.80
*/
typedef struct {
- gchar magic[16];
- guint8 major_version;
- guint8 minor_version;
- guint16 reserved;
- guint16 n_entries;
- guint16 n_local_entries;
- guint32 directory;
- guint32 n_attributes;
- guint32 attributes;
-
- guint32 dependencies;
-
- guint32 size;
- guint32 namespace;
- guint32 nsversion;
- guint32 shared_library;
- guint32 c_prefix;
-
- guint16 entry_blob_size;
- guint16 function_blob_size;
- guint16 callback_blob_size;
- guint16 signal_blob_size;
- guint16 vfunc_blob_size;
- guint16 arg_blob_size;
- guint16 property_blob_size;
- guint16 field_blob_size;
- guint16 value_blob_size;
- guint16 attribute_blob_size;
- guint16 constant_blob_size;
- guint16 error_domain_blob_size;
-
- guint16 signature_blob_size;
- guint16 enum_blob_size;
- guint16 struct_blob_size;
- guint16 object_blob_size;
- guint16 interface_blob_size;
- guint16 union_blob_size;
-
- guint32 sections;
-
- guint16 padding[6];
+ char magic[16];
+ uint8_t major_version;
+ uint8_t minor_version;
+ uint16_t reserved;
+ uint16_t n_entries;
+ uint16_t n_local_entries;
+ uint32_t directory;
+ uint32_t n_attributes;
+ uint32_t attributes;
+
+ uint32_t dependencies;
+
+ uint32_t size;
+ uint32_t namespace;
+ uint32_t nsversion;
+ uint32_t shared_library;
+ uint32_t c_prefix;
+
+ uint16_t entry_blob_size;
+ uint16_t function_blob_size;
+ uint16_t callback_blob_size;
+ uint16_t signal_blob_size;
+ uint16_t vfunc_blob_size;
+ uint16_t arg_blob_size;
+ uint16_t property_blob_size;
+ uint16_t field_blob_size;
+ uint16_t value_blob_size;
+ uint16_t attribute_blob_size;
+ uint16_t constant_blob_size;
+ uint16_t error_domain_blob_size;
+
+ uint16_t signature_blob_size;
+ uint16_t enum_blob_size;
+ uint16_t struct_blob_size;
+ uint16_t object_blob_size;
+ uint16_t interface_blob_size;
+ uint16_t union_blob_size;
+
+ uint32_t sections;
+
+ uint16_t padding[6];
} Header;
/**
* Since: 2.80
*/
typedef struct {
- guint32 id;
- guint32 offset;
+ uint32_t id;
+ uint32_t offset;
} Section;
* Since: 2.80
*/
typedef struct {
- guint16 blob_type;
+ uint16_t blob_type;
- guint16 local : 1;
- guint16 reserved :15;
- guint32 name;
- guint32 offset;
+ uint16_t local : 1;
+ uint16_t reserved :15;
+ uint32_t name;
+ uint32_t offset;
} DirEntry;
/**
* Since: 2.80
*/
typedef struct {
- guint reserved : 8;
- guint reserved2 :16;
- guint pointer : 1;
- guint reserved3 : 2;
- guint tag : 5;
+ unsigned reserved : 8;
+ unsigned reserved2 :16;
+ unsigned pointer : 1;
+ unsigned reserved3 : 2;
+ unsigned tag : 5;
} SimpleTypeBlobFlags;
union _SimpleTypeBlob
{
SimpleTypeBlobFlags flags;
- guint32 offset;
+ uint32_t offset;
};
/**
* Since: 2.80
*/
typedef struct {
- guint32 name;
-
- guint in : 1;
- guint out : 1;
- guint caller_allocates : 1;
- guint nullable : 1;
- guint optional : 1;
- guint transfer_ownership : 1;
- guint transfer_container_ownership : 1;
- guint return_value : 1;
- guint scope : 3;
- guint skip : 1;
- guint reserved :20;
- gint8 closure;
- gint8 destroy;
-
- guint16 padding;
+ uint32_t name;
+
+ unsigned in : 1;
+ unsigned out : 1;
+ unsigned caller_allocates : 1;
+ unsigned nullable : 1;
+ unsigned optional : 1;
+ unsigned transfer_ownership : 1;
+ unsigned transfer_container_ownership : 1;
+ unsigned return_value : 1;
+ unsigned scope : 3;
+ unsigned skip : 1;
+ unsigned reserved :20;
+ int8_t closure;
+ int8_t destroy;
+
+ uint16_t padding;
SimpleTypeBlob arg_type;
} ArgBlob;
typedef struct {
SimpleTypeBlob return_type;
- guint16 may_return_null : 1;
- guint16 caller_owns_return_value : 1;
- guint16 caller_owns_return_container : 1;
- guint16 skip_return : 1;
- guint16 instance_transfer_ownership : 1;
- guint16 throws : 1;
- guint16 reserved :10;
+ uint16_t may_return_null : 1;
+ uint16_t caller_owns_return_value : 1;
+ uint16_t caller_owns_return_container : 1;
+ uint16_t skip_return : 1;
+ uint16_t instance_transfer_ownership : 1;
+ uint16_t throws : 1;
+ uint16_t reserved :10;
- guint16 n_arguments;
+ uint16_t n_arguments;
ArgBlob arguments[];
} SignatureBlob;
* Since: 2.80
*/
typedef struct {
- guint16 blob_type; /* 1 */
+ uint16_t blob_type; /* 1 */
- guint16 deprecated : 1;
- guint16 reserved :15;
- guint32 name;
+ uint16_t deprecated : 1;
+ uint16_t reserved :15;
+ uint32_t name;
} CommonBlob;
/**
* Since: 2.80
*/
typedef struct {
- guint16 blob_type; /* 1 */
-
- guint16 deprecated : 1;
- guint16 setter : 1;
- guint16 getter : 1;
- guint16 constructor : 1;
- guint16 wraps_vfunc : 1;
- guint16 throws : 1;
- guint16 index :10;
+ uint16_t blob_type; /* 1 */
+
+ uint16_t deprecated : 1;
+ uint16_t setter : 1;
+ uint16_t getter : 1;
+ uint16_t constructor : 1;
+ uint16_t wraps_vfunc : 1;
+ uint16_t throws : 1;
+ uint16_t index :10;
/* Note the bits above need to match CommonBlob
* and are thus exhausted, extend things using
* the reserved block below. */
- guint32 name;
- guint32 symbol;
- guint32 signature;
+ uint32_t name;
+ uint32_t symbol;
+ uint32_t signature;
- guint16 is_static : 1;
- guint16 reserved : 15;
- guint16 reserved2 : 16;
+ uint16_t is_static : 1;
+ uint16_t reserved : 15;
+ uint16_t reserved2 : 16;
} FunctionBlob;
/**
* Since: 2.80
*/
typedef struct {
- guint16 blob_type; /* 2 */
+ uint16_t blob_type; /* 2 */
- guint16 deprecated : 1;
- guint16 reserved :15;
- guint32 name;
- guint32 signature;
+ uint16_t deprecated : 1;
+ uint16_t reserved :15;
+ uint32_t name;
+ uint32_t signature;
} CallbackBlob;
/**
* Since: 2.80
*/
typedef struct {
- guint8 pointer :1;
- guint8 reserved :2;
- guint8 tag :5;
- guint8 reserved2;
- guint16 interface;
+ uint8_t pointer :1;
+ uint8_t reserved :2;
+ uint8_t tag :5;
+ uint8_t reserved2;
+ uint16_t interface;
} InterfaceTypeBlob;
/**
* Since: 2.80
*/
typedef union {
- guint16 length;
- guint16 size;
+ uint16_t length;
+ uint16_t size;
} ArrayTypeDimension;
/**
* Since: 2.80
*/
typedef struct {
- guint16 pointer :1;
- guint16 reserved :2;
- guint16 tag :5;
+ uint16_t pointer :1;
+ uint16_t reserved :2;
+ uint16_t tag :5;
- guint16 zero_terminated :1;
- guint16 has_length :1;
- guint16 has_size :1;
- guint16 array_type :2;
- guint16 reserved2 :3;
+ uint16_t zero_terminated :1;
+ uint16_t has_length :1;
+ uint16_t has_size :1;
+ uint16_t array_type :2;
+ uint16_t reserved2 :3;
ArrayTypeDimension dimensions;
* Since: 2.80
*/
typedef struct {
- guint8 pointer :1;
- guint8 reserved :2;
- guint8 tag :5;
+ uint8_t pointer :1;
+ uint8_t reserved :2;
+ uint8_t tag :5;
- guint8 reserved2;
- guint16 n_types;
+ uint8_t reserved2;
+ uint16_t n_types;
SimpleTypeBlob type[];
} ParamTypeBlob;
* Since: 2.80
*/
typedef struct {
- guint8 pointer :1;
- guint8 reserved :2;
- guint8 tag :5;
+ uint8_t pointer :1;
+ uint8_t reserved :2;
+ uint8_t tag :5;
- guint8 reserved2;
+ uint8_t reserved2;
- guint16 n_domains; /* Must be 0 */
- guint16 domains[];
+ uint16_t n_domains; /* Must be 0 */
+ uint16_t domains[];
} ErrorTypeBlob;
/**
* ValueBlob:
* @deprecated: Whether this value is deprecated
- * @unsigned_value: if set, value is a 32-bit unsigned integer cast to gint32
+ * @unsigned_value: if set, value is a 32-bit unsigned integer cast to int32_t
* @reserved: Reserved for future use.
* @name: Name of blob
* @value: The numerical value
* Since: 2.80
*/
typedef struct {
- guint32 deprecated : 1;
- guint32 unsigned_value : 1;
- guint32 reserved :30;
- guint32 name;
- gint32 value;
+ uint32_t deprecated : 1;
+ uint32_t unsigned_value : 1;
+ uint32_t reserved :30;
+ uint32_t name;
+ int32_t value;
} ValueBlob;
/**
* Since: 2.80
*/
typedef struct {
- guint32 name;
+ uint32_t name;
- guint8 readable :1;
- guint8 writable :1;
- guint8 has_embedded_type :1;
- guint8 reserved :5;
- guint8 bits;
+ uint8_t readable :1;
+ uint8_t writable :1;
+ uint8_t has_embedded_type :1;
+ uint8_t reserved :5;
+ uint8_t bits;
- guint16 struct_offset;
+ uint16_t struct_offset;
- guint32 reserved2;
+ uint32_t reserved2;
SimpleTypeBlob type;
} FieldBlob;
* Since: 2.80
*/
typedef struct {
- guint16 blob_type;
- guint16 deprecated : 1;
- guint16 unregistered : 1;
- guint16 reserved :14;
- guint32 name;
-
- guint32 gtype_name;
- guint32 gtype_init;
+ uint16_t blob_type;
+ uint16_t deprecated : 1;
+ uint16_t unregistered : 1;
+ uint16_t reserved :14;
+ uint32_t name;
+
+ uint32_t gtype_name;
+ uint32_t gtype_init;
} RegisteredTypeBlob;
/**
* Since: 2.80
*/
typedef struct {
- guint16 blob_type;
+ uint16_t blob_type;
- guint16 deprecated : 1;
- guint16 unregistered : 1;
- guint16 is_gtype_struct : 1;
- guint16 alignment : 6;
- guint16 foreign : 1;
- guint16 reserved : 6;
+ uint16_t deprecated : 1;
+ uint16_t unregistered : 1;
+ uint16_t is_gtype_struct : 1;
+ uint16_t alignment : 6;
+ uint16_t foreign : 1;
+ uint16_t reserved : 6;
- guint32 name;
+ uint32_t name;
- guint32 gtype_name;
- guint32 gtype_init;
+ uint32_t gtype_name;
+ uint32_t gtype_init;
- guint32 size;
+ uint32_t size;
- guint16 n_fields;
- guint16 n_methods;
+ uint16_t n_fields;
+ uint16_t n_methods;
- guint32 copy_func;
- guint32 free_func;
+ uint32_t copy_func;
+ uint32_t free_func;
} StructBlob;
/**
* Since: 2.80
*/
typedef struct {
- guint16 blob_type;
- guint16 deprecated : 1;
- guint16 unregistered : 1;
- guint16 discriminated : 1;
- guint16 alignment : 6;
- guint16 reserved : 7;
- guint32 name;
+ uint16_t blob_type;
+ uint16_t deprecated : 1;
+ uint16_t unregistered : 1;
+ uint16_t discriminated : 1;
+ uint16_t alignment : 6;
+ uint16_t reserved : 7;
+ uint32_t name;
- guint32 gtype_name;
- guint32 gtype_init;
+ uint32_t gtype_name;
+ uint32_t gtype_init;
- guint32 size;
+ uint32_t size;
- guint16 n_fields;
- guint16 n_functions;
+ uint16_t n_fields;
+ uint16_t n_functions;
- guint32 copy_func;
- guint32 free_func;
+ uint32_t copy_func;
+ uint32_t free_func;
- gint32 discriminator_offset;
+ int32_t discriminator_offset;
SimpleTypeBlob discriminator_type;
} UnionBlob;
* Since: 2.80
*/
typedef struct {
- guint16 blob_type;
+ uint16_t blob_type;
- guint16 deprecated : 1;
- guint16 unregistered : 1;
- guint16 storage_type : 5;
- guint16 reserved : 9;
+ uint16_t deprecated : 1;
+ uint16_t unregistered : 1;
+ uint16_t storage_type : 5;
+ uint16_t reserved : 9;
- guint32 name;
+ uint32_t name;
- guint32 gtype_name;
- guint32 gtype_init;
+ uint32_t gtype_name;
+ uint32_t gtype_init;
- guint16 n_values;
- guint16 n_methods;
+ uint16_t n_values;
+ uint16_t n_methods;
- guint32 error_domain;
+ uint32_t error_domain;
ValueBlob values[];
} EnumBlob;
* Since: 2.80
*/
typedef struct {
- guint32 name;
+ uint32_t name;
- guint32 deprecated : 1;
- guint32 readable : 1;
- guint32 writable : 1;
- guint32 construct : 1;
- guint32 construct_only : 1;
- guint32 transfer_ownership : 1;
- guint32 transfer_container_ownership : 1;
- guint32 setter :10;
- guint32 getter :10;
- guint32 reserved : 5;
+ uint32_t deprecated : 1;
+ uint32_t readable : 1;
+ uint32_t writable : 1;
+ uint32_t construct : 1;
+ uint32_t construct_only : 1;
+ uint32_t transfer_ownership : 1;
+ uint32_t transfer_container_ownership : 1;
+ uint32_t setter :10;
+ uint32_t getter :10;
+ uint32_t reserved : 5;
- guint32 reserved2;
+ uint32_t reserved2;
SimpleTypeBlob type;
} PropertyBlob;
* Since: 2.80
*/
typedef struct {
- guint16 deprecated : 1;
- guint16 run_first : 1;
- guint16 run_last : 1;
- guint16 run_cleanup : 1;
- guint16 no_recurse : 1;
- guint16 detailed : 1;
- guint16 action : 1;
- guint16 no_hooks : 1;
- guint16 has_class_closure : 1;
- guint16 true_stops_emit : 1;
- guint16 reserved : 6;
+ uint16_t deprecated : 1;
+ uint16_t run_first : 1;
+ uint16_t run_last : 1;
+ uint16_t run_cleanup : 1;
+ uint16_t no_recurse : 1;
+ uint16_t detailed : 1;
+ uint16_t action : 1;
+ uint16_t no_hooks : 1;
+ uint16_t has_class_closure : 1;
+ uint16_t true_stops_emit : 1;
+ uint16_t reserved : 6;
- guint16 class_closure;
+ uint16_t class_closure;
- guint32 name;
+ uint32_t name;
- guint32 reserved2;
+ uint32_t reserved2;
- guint32 signature;
+ uint32_t signature;
} SignalBlob;
/**
* Since: 2.80
*/
typedef struct {
- guint32 name;
-
- guint16 must_chain_up : 1;
- guint16 must_be_implemented : 1;
- guint16 must_not_be_implemented : 1;
- guint16 class_closure : 1;
- guint16 throws : 1;
- guint16 reserved :11;
- guint16 signal;
-
- guint16 struct_offset;
- guint16 invoker : 10; /* Number of bits matches @index in FunctionBlob */
- guint16 reserved2 : 6;
-
- guint32 reserved3;
- guint32 signature;
+ uint32_t name;
+
+ uint16_t must_chain_up : 1;
+ uint16_t must_be_implemented : 1;
+ uint16_t must_not_be_implemented : 1;
+ uint16_t class_closure : 1;
+ uint16_t throws : 1;
+ uint16_t reserved :11;
+ uint16_t signal;
+
+ uint16_t struct_offset;
+ uint16_t invoker : 10; /* Number of bits matches @index in FunctionBlob */
+ uint16_t reserved2 : 6;
+
+ uint32_t reserved3;
+ uint32_t signature;
} VFuncBlob;
/**
* Since: 2.80
*/
typedef struct {
- guint16 blob_type; /* 7 */
- guint16 deprecated : 1;
- guint16 abstract : 1;
- guint16 fundamental : 1;
- guint16 final_ : 1;
- guint16 reserved :12;
- guint32 name;
-
- guint32 gtype_name;
- guint32 gtype_init;
-
- guint16 parent;
- guint16 gtype_struct;
-
- guint16 n_interfaces;
- guint16 n_fields;
- guint16 n_properties;
- guint16 n_methods;
- guint16 n_signals;
- guint16 n_vfuncs;
- guint16 n_constants;
- guint16 n_field_callbacks;
-
- guint32 ref_func;
- guint32 unref_func;
- guint32 set_value_func;
- guint32 get_value_func;
-
- guint32 reserved3;
- guint32 reserved4;
-
- guint16 interfaces[];
+ uint16_t blob_type; /* 7 */
+ uint16_t deprecated : 1;
+ uint16_t abstract : 1;
+ uint16_t fundamental : 1;
+ uint16_t final_ : 1;
+ uint16_t reserved :12;
+ uint32_t name;
+
+ uint32_t gtype_name;
+ uint32_t gtype_init;
+
+ uint16_t parent;
+ uint16_t gtype_struct;
+
+ uint16_t n_interfaces;
+ uint16_t n_fields;
+ uint16_t n_properties;
+ uint16_t n_methods;
+ uint16_t n_signals;
+ uint16_t n_vfuncs;
+ uint16_t n_constants;
+ uint16_t n_field_callbacks;
+
+ uint32_t ref_func;
+ uint32_t unref_func;
+ uint32_t set_value_func;
+ uint32_t get_value_func;
+
+ uint32_t reserved3;
+ uint32_t reserved4;
+
+ uint16_t interfaces[];
} ObjectBlob;
/**
* Since: 2.80
*/
typedef struct {
- guint16 blob_type;
- guint16 deprecated : 1;
- guint16 reserved :15;
- guint32 name;
+ uint16_t blob_type;
+ uint16_t deprecated : 1;
+ uint16_t reserved :15;
+ uint32_t name;
- guint32 gtype_name;
- guint32 gtype_init;
- guint16 gtype_struct;
+ uint32_t gtype_name;
+ uint32_t gtype_init;
+ uint16_t gtype_struct;
- guint16 n_prerequisites;
- guint16 n_properties;
- guint16 n_methods;
- guint16 n_signals;
- guint16 n_vfuncs;
- guint16 n_constants;
+ uint16_t n_prerequisites;
+ uint16_t n_properties;
+ uint16_t n_methods;
+ uint16_t n_signals;
+ uint16_t n_vfuncs;
+ uint16_t n_constants;
- guint16 padding;
+ uint16_t padding;
- guint32 reserved2;
- guint32 reserved3;
+ uint32_t reserved2;
+ uint32_t reserved3;
- guint16 prerequisites[];
+ uint16_t prerequisites[];
} InterfaceBlob;
/**
* Since: 2.80
*/
typedef struct {
- guint16 blob_type;
- guint16 deprecated : 1;
- guint16 reserved :15;
- guint32 name;
+ uint16_t blob_type;
+ uint16_t deprecated : 1;
+ uint16_t reserved :15;
+ uint32_t name;
SimpleTypeBlob type;
- guint32 size;
- guint32 offset;
+ uint32_t size;
+ uint32_t offset;
- guint32 reserved2;
+ uint32_t reserved2;
} ConstantBlob;
/**
* Since: 2.80
*/
typedef struct {
- guint32 offset;
- guint32 name;
- guint32 value;
+ uint32_t offset;
+ uint32_t name;
+ uint32_t value;
} AttributeBlob;
struct _GITypelib {
/*< private >*/
- guchar *data;
- gsize len;
+ uint8_t *data;
+ size_t len;
gboolean owns_memory;
GMappedFile *mfile;
GList *modules;
};
DirEntry *gi_typelib_get_dir_entry (GITypelib *typelib,
- guint16 index);
+ uint16_t index);
DirEntry *gi_typelib_get_dir_entry_by_name (GITypelib *typelib,
const char *name);
DirEntry *gi_typelib_get_dir_entry_by_gtype_name (GITypelib *typelib,
- const gchar *gtype_name);
+ const char *gtype_name);
DirEntry *gi_typelib_get_dir_entry_by_error_domain (GITypelib *typelib,
GQuark error_domain);
gboolean gi_typelib_matches_gtype_name_prefix (GITypelib *typelib,
- const gchar *gtype_name);
+ const char *gtype_name);
-GI_AVAILABLE_IN_ALL
-void gi_typelib_check_sanity (void);
-
/**
* gi_typelib_get_string:
* @typelib: TODO
* Returns: TODO
* Since: 2.80
*/
-#define gi_typelib_get_string(typelib,offset) ((const gchar*)&(typelib->data)[(offset)])
+#define gi_typelib_get_string(typelib,offset) ((const char*)&(typelib->data)[(offset)])
/**
/* defined in gibaseinfo.c */
AttributeBlob *_attribute_blob_find_first (GIBaseInfo *info,
- guint32 blob_offset);
+ uint32_t blob_offset);
/**
* GITypelibHashBuilder:
GITypelibHashBuilder * gi_typelib_hash_builder_new (void);
-void gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder, const char *str, guint16 value);
+void gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder, const char *str, uint16_t value);
gboolean gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder);
-guint32 gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder);
+uint32_t gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder);
-void gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint32 size);
+void gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, uint8_t* mem, uint32_t size);
void gi_typelib_hash_builder_destroy (GITypelibHashBuilder *builder);
-guint16 gi_typelib_hash_search (guint8* memory, const char *str, guint n_entries);
+uint16_t gi_typelib_hash_search (uint8_t* memory, const char *str, uint32_t n_entries);
G_END_DECLS
{
g_assert (ctx->context_stack != NULL);
ctx->context_stack = g_slist_delete_link (ctx->context_stack,
- ctx->context_stack);
+ ctx->context_stack);
}
static gboolean
validate_interface_blob (ValidateContext *ctx,
- guint32 offset,
- GError **error);
+ uint32_t offset,
+ GError **error);
static DirEntry *
get_dir_entry_checked (GITypelib *typelib,
- guint16 index,
- GError **error)
+ uint16_t index,
+ GError **error)
{
Header *header = (Header *)typelib->data;
- guint32 offset;
+ uint32_t offset;
if (index == 0 || index > header->n_entries)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Invalid directory index %d", index);
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Invalid directory index %d", index);
return FALSE;
}
if (typelib->len < offset + sizeof (DirEntry))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
static CommonBlob *
get_blob (GITypelib *typelib,
- guint32 offset,
- GError **error)
+ uint32_t offset,
+ GError **error)
{
if (typelib->len < offset + sizeof (CommonBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
return (CommonBlob *)&typelib->data[offset];
static InterfaceTypeBlob *
get_type_blob (GITypelib *typelib,
- SimpleTypeBlob *simple,
- GError **error)
+ SimpleTypeBlob *simple,
+ GError **error)
{
if (simple->offset == 0)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "Expected blob for type");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "Expected blob for type");
return FALSE;
}
if (simple->flags.reserved == 0 && simple->flags.reserved2 == 0)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "Expected non-basic type but got %d",
- simple->flags.tag);
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "Expected non-basic type but got %d",
+ simple->flags.tag);
return FALSE;
}
*/
DirEntry *
gi_typelib_get_dir_entry (GITypelib *typelib,
- guint16 index)
+ uint16_t index)
{
Header *header = (Header *)typelib->data;
static Section *
get_section_by_id (GITypelib *typelib,
- SectionType section_type)
+ SectionType section_type)
{
Header *header = (Header *)typelib->data;
Section *section;
section++)
{
if (section->id == section_type)
- return section;
+ return section;
}
return NULL;
}
const char *name)
{
Section *dirindex;
- gint i, n_entries;
+ size_t i, n_entries;
const char *entry_name;
DirEntry *entry;
if (dirindex == NULL)
{
for (i = 1; i <= n_entries; i++)
- {
- entry = gi_typelib_get_dir_entry (typelib, i);
- entry_name = gi_typelib_get_string (typelib, entry->name);
- if (strcmp (name, entry_name) == 0)
- return entry;
- }
+ {
+ entry = gi_typelib_get_dir_entry (typelib, i);
+ entry_name = gi_typelib_get_string (typelib, entry->name);
+ if (strcmp (name, entry_name) == 0)
+ return entry;
+ }
return NULL;
}
else
{
- guint8 *hash = (guint8*) &typelib->data[dirindex->offset];
- guint16 index;
+ uint8_t *hash = (uint8_t *) &typelib->data[dirindex->offset];
+ uint16_t index;
index = gi_typelib_hash_search (hash, name, n_entries);
entry = gi_typelib_get_dir_entry (typelib, index + 1);
entry_name = gi_typelib_get_string (typelib, entry->name);
if (strcmp (name, entry_name) == 0)
- return entry;
+ return entry;
return NULL;
}
}
*/
DirEntry *
gi_typelib_get_dir_entry_by_gtype_name (GITypelib *typelib,
- const gchar *gtype_name)
+ const char *gtype_name)
{
Header *header = (Header *)typelib->data;
- guint i;
- for (i = 1; i <= header->n_local_entries; i++)
+ for (size_t i = 1; i <= header->n_local_entries; i++)
{
RegisteredTypeBlob *blob;
const char *type;
DirEntry *entry = gi_typelib_get_dir_entry (typelib, i);
if (!BLOB_IS_REGISTERED_TYPE (entry))
- continue;
+ continue;
blob = (RegisteredTypeBlob *)(&typelib->data[entry->offset]);
if (!blob->gtype_name)
- continue;
+ continue;
type = gi_typelib_get_string (typelib, blob->gtype_name);
if (strcmp (type, gtype_name) == 0)
- return entry;
+ return entry;
}
return NULL;
}
typedef struct {
const char *s;
const char *separator;
- gsize sep_len;
+ size_t sep_len;
GString buf;
} StrSplitIter;
{
const char *s = iter->s;
const char *next;
- gsize len;
+ size_t len;
if (!s)
return FALSE;
*/
gboolean
gi_typelib_matches_gtype_name_prefix (GITypelib *typelib,
- const gchar *gtype_name)
+ const char *gtype_name)
{
Header *header = (Header *)typelib->data;
const char *c_prefix;
- const gchar *prefix;
+ const char *prefix;
gboolean ret = FALSE;
StrSplitIter split_iter;
- gsize gtype_name_len;
+ size_t gtype_name_len;
c_prefix = gi_typelib_get_string (typelib, header->c_prefix);
if (c_prefix == NULL || strlen (c_prefix) == 0)
GQuark error_domain)
{
Header *header = (Header *)typelib->data;
- guint n_entries = header->n_local_entries;
+ size_t n_entries = header->n_local_entries;
const char *domain_string = g_quark_to_string (error_domain);
DirEntry *entry;
- guint i;
- for (i = 1; i <= n_entries; i++)
+ for (size_t i = 1; i <= n_entries; i++)
{
EnumBlob *blob;
const char *enum_domain_string;
entry = gi_typelib_get_dir_entry (typelib, i);
if (entry->blob_type != BLOB_TYPE_ENUM)
- continue;
+ continue;
blob = (EnumBlob *)(&typelib->data[entry->offset]);
if (!blob->error_domain)
- continue;
+ continue;
enum_domain_string = gi_typelib_get_string (typelib, blob->error_domain);
if (strcmp (domain_string, enum_domain_string) == 0)
- return entry;
+ return entry;
}
return NULL;
}
-/**
- * gi_typelib_check_sanity:
+/* When changing the size of a typelib structure, you are required to update
+ * the hardcoded size here. Do NOT change these to use sizeof(); these
+ * should match whatever is defined in the text specification and serve as
+ * a sanity check on structure modifications.
*
- * Check compile-time sizes of various typelib file format types are as
- * expected.
- *
- * Since: 2.80
+ * Everything else in the code however should be using sizeof().
*/
-void
-gi_typelib_check_sanity (void)
-{
-#ifndef G_DISABLE_ASSERT
- /* Check that struct layout is as we expect */
-
- gboolean size_check_ok = TRUE;
-
-#define CHECK_SIZE(s,n) \
- if (sizeof(s) != n) \
- { \
- g_printerr ("sizeof("#s") is expected to be %d but is %"G_GSIZE_FORMAT".\n", \
- n, sizeof (s)); \
- size_check_ok = FALSE; \
- }
-
- /* When changing the size of a typelib structure, you are required to update
- * the hardcoded size here. Do NOT change these to use sizeof(); these
- * should match whatever is defined in the text specification and serve as
- * a sanity check on structure modifications.
- *
- * Everything else in the code however should be using sizeof().
- */
-
- CHECK_SIZE (Header, 112);
- CHECK_SIZE (DirEntry, 12);
- CHECK_SIZE (SimpleTypeBlob, 4);
- CHECK_SIZE (ArgBlob, 16);
- CHECK_SIZE (SignatureBlob, 8);
- CHECK_SIZE (CommonBlob, 8);
- CHECK_SIZE (FunctionBlob, 20);
- CHECK_SIZE (CallbackBlob, 12);
- CHECK_SIZE (InterfaceTypeBlob, 4);
- CHECK_SIZE (ArrayTypeBlob, 8);
- CHECK_SIZE (ParamTypeBlob, 4);
- CHECK_SIZE (ErrorTypeBlob, 4);
- CHECK_SIZE (ValueBlob, 12);
- CHECK_SIZE (FieldBlob, 16);
- CHECK_SIZE (RegisteredTypeBlob, 16);
- CHECK_SIZE (StructBlob, 32);
- CHECK_SIZE (EnumBlob, 24);
- CHECK_SIZE (PropertyBlob, 16);
- CHECK_SIZE (SignalBlob, 16);
- CHECK_SIZE (VFuncBlob, 20);
- CHECK_SIZE (ObjectBlob, 60);
- CHECK_SIZE (InterfaceBlob, 40);
- CHECK_SIZE (ConstantBlob, 24);
- CHECK_SIZE (AttributeBlob, 12);
- CHECK_SIZE (UnionBlob, 40);
-#undef CHECK_SIZE
-
- g_assert (size_check_ok);
-#endif /* !G_DISABLE_ASSERT */
-}
+G_STATIC_ASSERT (sizeof (Header) == 112);
+G_STATIC_ASSERT (sizeof (DirEntry) == 12);
+G_STATIC_ASSERT (sizeof (SimpleTypeBlob) == 4);
+G_STATIC_ASSERT (sizeof (ArgBlob) == 16);
+G_STATIC_ASSERT (sizeof (SignatureBlob) == 8);
+G_STATIC_ASSERT (sizeof (CommonBlob) == 8);
+G_STATIC_ASSERT (sizeof (FunctionBlob) == 20);
+G_STATIC_ASSERT (sizeof (CallbackBlob) == 12);
+G_STATIC_ASSERT (sizeof (InterfaceTypeBlob) == 4);
+G_STATIC_ASSERT (sizeof (ArrayTypeBlob) == 8);
+G_STATIC_ASSERT (sizeof (ParamTypeBlob) == 4);
+G_STATIC_ASSERT (sizeof (ErrorTypeBlob) == 4);
+G_STATIC_ASSERT (sizeof (ValueBlob) == 12);
+G_STATIC_ASSERT (sizeof (FieldBlob) == 16);
+G_STATIC_ASSERT (sizeof (RegisteredTypeBlob) == 16);
+G_STATIC_ASSERT (sizeof (StructBlob) == 32);
+G_STATIC_ASSERT (sizeof (EnumBlob) == 24);
+G_STATIC_ASSERT (sizeof (PropertyBlob) == 16);
+G_STATIC_ASSERT (sizeof (SignalBlob) == 16);
+G_STATIC_ASSERT (sizeof (VFuncBlob) == 20);
+G_STATIC_ASSERT (sizeof (ObjectBlob) == 60);
+G_STATIC_ASSERT (sizeof (InterfaceBlob) == 40);
+G_STATIC_ASSERT (sizeof (ConstantBlob) == 24);
+G_STATIC_ASSERT (sizeof (AttributeBlob) == 12);
+G_STATIC_ASSERT (sizeof (UnionBlob) == 40);
static gboolean
-is_aligned (guint32 offset)
+is_aligned (uint32_t offset)
{
return offset == ALIGN_VALUE (offset, 4);
}
#define MAX_NAME_LEN 2048
static const char *
-get_string (GITypelib *typelib, guint32 offset, GError **error)
+get_string (GITypelib *typelib, uint32_t offset, GError **error)
{
if (typelib->len < offset)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "Buffer is too short while looking up name");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "Buffer is too short while looking up name");
return NULL;
}
}
static const char *
-get_string_nofail (GITypelib *typelib, guint32 offset)
+get_string_nofail (GITypelib *typelib, uint32_t offset)
{
const char *ret = get_string (typelib, offset, NULL);
g_assert (ret);
static gboolean
validate_name (GITypelib *typelib,
- const char *msg,
- const guchar *data, guint32 offset,
- GError **error)
+ const char *msg,
+ const uint8_t *data,
+ uint32_t offset,
+ GError **error)
{
const char *name;
if (!memchr (name, '\0', MAX_NAME_LEN))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The %s is too long: %s",
- msg, name);
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The %s is too long: %s",
+ msg, name);
return FALSE;
}
if (strspn (name, G_CSET_a_2_z G_CSET_A_2_Z G_CSET_DIGITS "-_") < strlen (name))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The %s contains invalid characters: '%s'",
- msg, name);
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The %s contains invalid characters: '%s'",
+ msg, name);
return FALSE;
}
/* Fast path sanity check, operates on a memory blob */
static gboolean
-validate_header_basic (const guint8 *memory,
- gsize len,
- GError **error)
+validate_header_basic (const uint8_t *memory,
+ size_t len,
+ GError **error)
{
Header *header = (Header *)memory;
if (len < sizeof (Header))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The specified typelib length %" G_GSIZE_FORMAT " is too short",
- len);
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The specified typelib length %zu is too short", len);
return FALSE;
}
if (strncmp (header->magic, GI_IR_MAGIC, 16) != 0)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_HEADER,
- "Invalid magic header");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_HEADER,
+ "Invalid magic header");
return FALSE;
}
if (header->major_version != 4)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_HEADER,
- "Typelib version mismatch; expected 4, found %d",
- header->major_version);
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_HEADER,
+ "Typelib version mismatch; expected 4, found %d",
+ header->major_version);
return FALSE;
}
if (header->n_entries < header->n_local_entries)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_HEADER,
- "Inconsistent entry counts");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_HEADER,
+ "Inconsistent entry counts");
return FALSE;
}
if (header->size != len)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_HEADER,
- "Typelib size %" G_GSIZE_FORMAT " does not match %" G_GSIZE_FORMAT,
- (gsize) header->size, len);
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_HEADER,
+ "Typelib size %zu does not match %zu",
+ (size_t) header->size, len);
return FALSE;
}
/* This is a sanity check for a specific typelib; it
* prevents us from loading an incompatible typelib.
*
- * The hardcoded checks in gi_typelib_check_sanity to
- * protect against inadvertent or buggy changes to the typelib format
- * itself.
+ * The hardcoded static checks to protect against inadvertent
+ * or buggy changes to the typelib format itself.
*/
if (header->entry_blob_size != sizeof (DirEntry) ||
header->union_blob_size != sizeof (UnionBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_HEADER,
- "Blob size mismatch");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_HEADER,
+ "Blob size mismatch");
return FALSE;
}
if (!is_aligned (header->directory))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_HEADER,
- "Misaligned directory");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_HEADER,
+ "Misaligned directory");
return FALSE;
}
if (!is_aligned (header->attributes))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_HEADER,
- "Misaligned attributes");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_HEADER,
+ "Misaligned attributes");
return FALSE;
}
if (header->attributes == 0 && header->n_attributes > 0)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_HEADER,
- "Wrong number of attributes");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_HEADER,
+ "Wrong number of attributes");
return FALSE;
}
static gboolean
validate_header (ValidateContext *ctx,
- GError **error)
+ GError **error)
{
GITypelib *typelib = ctx->typelib;
}
static gboolean validate_type_blob (GITypelib *typelib,
- guint32 offset,
- guint32 signature_offset,
- gboolean return_type,
- GError **error);
+ uint32_t offset,
+ uint32_t signature_offset,
+ gboolean return_type,
+ GError **error);
static gboolean
validate_array_type_blob (GITypelib *typelib,
- guint32 offset,
- guint32 signature_offset,
- gboolean return_type,
- GError **error)
+ uint32_t offset,
+ uint32_t signature_offset,
+ gboolean return_type,
+ GError **error)
{
/* FIXME validate length */
if (!validate_type_blob (typelib,
- offset + G_STRUCT_OFFSET (ArrayTypeBlob, type),
- 0, FALSE, error))
+ offset + G_STRUCT_OFFSET (ArrayTypeBlob, type),
+ 0, FALSE, error))
return FALSE;
return TRUE;
static gboolean
validate_iface_type_blob (GITypelib *typelib,
- guint32 offset,
- guint32 signature_offset,
- gboolean return_type,
- GError **error)
+ uint32_t offset,
+ uint32_t signature_offset,
+ gboolean return_type,
+ GError **error)
{
InterfaceTypeBlob *blob;
InterfaceBlob *target;
static gboolean
validate_param_type_blob (GITypelib *typelib,
- guint32 offset,
- guint32 signature_offset,
- gboolean return_type,
- gint n_params,
- GError **error)
+ uint32_t offset,
+ uint32_t signature_offset,
+ gboolean return_type,
+ size_t n_params,
+ GError **error)
{
ParamTypeBlob *blob;
- gint i;
blob = (ParamTypeBlob*)&typelib->data[offset];
if (!blob->pointer)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Pointer type exected for tag %d", blob->tag);
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Pointer type exected for tag %d", blob->tag);
return FALSE;
}
if (blob->n_types != n_params)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Parameter type number mismatch");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Parameter type number mismatch");
return FALSE;
}
- for (i = 0; i < n_params; i++)
+ for (size_t i = 0; i < n_params; i++)
{
if (!validate_type_blob (typelib,
- offset + sizeof (ParamTypeBlob) +
- i * sizeof (SimpleTypeBlob),
- 0, FALSE, error))
- return FALSE;
+ offset + sizeof (ParamTypeBlob) +
+ i * sizeof (SimpleTypeBlob),
+ 0, FALSE, error))
+ return FALSE;
}
return TRUE;
static gboolean
validate_error_type_blob (GITypelib *typelib,
- guint32 offset,
- guint32 signature_offset,
- gboolean return_type,
- GError **error)
+ uint32_t offset,
+ uint32_t signature_offset,
+ gboolean return_type,
+ GError **error)
{
ErrorTypeBlob *blob;
if (!blob->pointer)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Pointer type exected for tag %d", blob->tag);
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Pointer type exected for tag %d", blob->tag);
return FALSE;
}
static gboolean
validate_type_blob (GITypelib *typelib,
- guint32 offset,
- guint32 signature_offset,
- gboolean return_type,
- GError **error)
+ uint32_t offset,
+ uint32_t signature_offset,
+ gboolean return_type,
+ GError **error)
{
SimpleTypeBlob *simple;
InterfaceTypeBlob *iface;
simple->flags.reserved2 == 0)
{
if (!GI_TYPE_TAG_IS_BASIC(simple->flags.tag))
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Invalid non-basic tag %d in simple type", simple->flags.tag);
- return FALSE;
- }
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Invalid non-basic tag %d in simple type", simple->flags.tag);
+ return FALSE;
+ }
if (simple->flags.tag >= GI_TYPE_TAG_UTF8 &&
- simple->flags.tag != GI_TYPE_TAG_UNICHAR &&
- !simple->flags.pointer)
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Pointer type exected for tag %d", simple->flags.tag);
- return FALSE;
- }
+ simple->flags.tag != GI_TYPE_TAG_UNICHAR &&
+ !simple->flags.pointer)
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Pointer type exected for tag %d", simple->flags.tag);
+ return FALSE;
+ }
return TRUE;
}
{
case GI_TYPE_TAG_ARRAY:
if (!validate_array_type_blob (typelib, simple->offset,
- signature_offset, return_type, error))
- return FALSE;
+ signature_offset, return_type, error))
+ return FALSE;
break;
case GI_TYPE_TAG_INTERFACE:
if (!validate_iface_type_blob (typelib, simple->offset,
- signature_offset, return_type, error))
- return FALSE;
+ signature_offset, return_type, error))
+ return FALSE;
break;
case GI_TYPE_TAG_GLIST:
case GI_TYPE_TAG_GSLIST:
if (!validate_param_type_blob (typelib, simple->offset,
- signature_offset, return_type, 1, error))
- return FALSE;
+ signature_offset, return_type, 1, error))
+ return FALSE;
break;
case GI_TYPE_TAG_GHASH:
if (!validate_param_type_blob (typelib, simple->offset,
- signature_offset, return_type, 2, error))
- return FALSE;
+ signature_offset, return_type, 2, error))
+ return FALSE;
break;
case GI_TYPE_TAG_ERROR:
if (!validate_error_type_blob (typelib, simple->offset,
- signature_offset, return_type, error))
- return FALSE;
+ signature_offset, return_type, error))
+ return FALSE;
break;
default:
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Wrong tag in complex type");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Wrong tag in complex type");
return FALSE;
}
static gboolean
validate_arg_blob (GITypelib *typelib,
- guint32 offset,
- guint32 signature_offset,
- GError **error)
+ uint32_t offset,
+ uint32_t signature_offset,
+ GError **error)
{
ArgBlob *blob;
if (typelib->len < offset + sizeof (ArgBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
return FALSE;
if (!validate_type_blob (typelib,
- offset + G_STRUCT_OFFSET (ArgBlob, arg_type),
- signature_offset, FALSE, error))
+ offset + G_STRUCT_OFFSET (ArgBlob, arg_type),
+ signature_offset, FALSE, error))
return FALSE;
return TRUE;
static SimpleTypeBlob *
return_type_from_signature (GITypelib *typelib,
- guint32 offset,
- GError **error)
+ uint32_t offset,
+ GError **error)
{
SignatureBlob *blob;
if (typelib->len < offset + sizeof (SignatureBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return NULL;
}
if (blob->return_type.offset == 0)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "No return type found in signature");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "No return type found in signature");
return NULL;
}
static gboolean
validate_signature_blob (GITypelib *typelib,
- guint32 offset,
- GError **error)
+ uint32_t offset,
+ GError **error)
{
SignatureBlob *blob;
- gint i;
if (typelib->len < offset + sizeof (SignatureBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
if (blob->return_type.offset != 0)
{
if (!validate_type_blob (typelib,
- offset + G_STRUCT_OFFSET (SignatureBlob, return_type),
- offset, TRUE, error))
- return FALSE;
+ offset + G_STRUCT_OFFSET (SignatureBlob, return_type),
+ offset, TRUE, error))
+ return FALSE;
}
- for (i = 0; i < blob->n_arguments; i++)
+ for (size_t i = 0; i < blob->n_arguments; i++)
{
if (!validate_arg_blob (typelib,
- offset + sizeof (SignatureBlob) +
- i * sizeof (ArgBlob),
- offset,
- error))
- return FALSE;
+ offset + sizeof (SignatureBlob) +
+ i * sizeof (ArgBlob),
+ offset,
+ error))
+ return FALSE;
}
/* FIXME check constraints on return_value */
static gboolean
validate_function_blob (ValidateContext *ctx,
- guint32 offset,
- guint16 container_type,
- GError **error)
+ uint32_t offset,
+ uint16_t container_type,
+ GError **error)
{
GITypelib *typelib = ctx->typelib;
FunctionBlob *blob;
if (typelib->len < offset + sizeof (FunctionBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
if (blob->blob_type != BLOB_TYPE_FUNCTION)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Wrong blob type %d, expected function", blob->blob_type);
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Wrong blob type %d, expected function", blob->blob_type);
return FALSE;
}
if (blob->constructor)
{
switch (container_type)
- {
- case BLOB_TYPE_BOXED:
- case BLOB_TYPE_STRUCT:
- case BLOB_TYPE_UNION:
- case BLOB_TYPE_OBJECT:
- case BLOB_TYPE_INTERFACE:
- break;
- default:
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Constructor not allowed");
- return FALSE;
- }
+ {
+ case BLOB_TYPE_BOXED:
+ case BLOB_TYPE_STRUCT:
+ case BLOB_TYPE_UNION:
+ case BLOB_TYPE_OBJECT:
+ case BLOB_TYPE_INTERFACE:
+ break;
+ default:
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Constructor not allowed");
+ return FALSE;
+ }
}
if (blob->setter || blob->getter || blob->wraps_vfunc)
{
switch (container_type)
- {
- case BLOB_TYPE_OBJECT:
- case BLOB_TYPE_INTERFACE:
- break;
- default:
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Setter, getter or wrapper not allowed");
- return FALSE;
- }
+ {
+ case BLOB_TYPE_OBJECT:
+ case BLOB_TYPE_INTERFACE:
+ break;
+ default:
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Setter, getter or wrapper not allowed");
+ return FALSE;
+ }
}
if (blob->index)
{
if (!(blob->setter || blob->getter || blob->wraps_vfunc))
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Must be setter, getter or wrapper");
- return FALSE;
- }
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Must be setter, getter or wrapper");
+ return FALSE;
+ }
}
/* FIXME: validate index range */
if (blob->constructor)
{
SimpleTypeBlob *simple = return_type_from_signature (typelib,
- blob->signature,
- error);
+ blob->signature,
+ error);
InterfaceTypeBlob *iface_type;
if (!simple)
- return FALSE;
+ return FALSE;
iface_type = get_type_blob (typelib, simple, error);
if (!iface_type)
- return FALSE;
+ return FALSE;
if (iface_type->tag != GI_TYPE_TAG_INTERFACE &&
(container_type == BLOB_TYPE_OBJECT ||
container_type == BLOB_TYPE_INTERFACE))
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "Invalid return type '%s' for constructor '%s'",
- gi_type_tag_to_string (iface_type->tag),
- get_string_nofail (typelib, blob->symbol));
- return FALSE;
- }
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "Invalid return type '%s' for constructor '%s'",
+ gi_type_tag_to_string (iface_type->tag),
+ get_string_nofail (typelib, blob->symbol));
+ return FALSE;
+ }
}
pop_context (ctx);
static gboolean
validate_callback_blob (ValidateContext *ctx,
- guint32 offset,
- GError **error)
+ uint32_t offset,
+ GError **error)
{
GITypelib *typelib = ctx->typelib;
CallbackBlob *blob;
if (typelib->len < offset + sizeof (CallbackBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
if (blob->blob_type != BLOB_TYPE_CALLBACK)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Wrong blob type");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Wrong blob type");
return FALSE;
}
static gboolean
validate_constant_blob (GITypelib *typelib,
- guint32 offset,
- GError **error)
+ uint32_t offset,
+ GError **error)
{
- guint value_size[] = {
+ size_t value_size[] = {
0, /* VOID */
4, /* BOOLEAN */
1, /* INT8 */
4, /* UINT32 */
8, /* INT64 */
8, /* UINT64 */
- sizeof (gfloat),
- sizeof (gdouble),
+ sizeof (float),
+ sizeof (double),
0, /* GTYPE */
0, /* UTF8 */
0, /* FILENAME */
if (typelib->len < offset + sizeof (ConstantBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
if (blob->blob_type != BLOB_TYPE_CONSTANT)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Wrong blob type");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Wrong blob type");
return FALSE;
}
return FALSE;
if (!validate_type_blob (typelib, offset + G_STRUCT_OFFSET (ConstantBlob, type),
- 0, FALSE, error))
+ 0, FALSE, error))
return FALSE;
if (!is_aligned (blob->offset))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Misaligned constant value");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Misaligned constant value");
return FALSE;
}
if (type->flags.reserved == 0 && type->flags.reserved2 == 0)
{
if (type->flags.tag == 0)
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Constant value type void");
- return FALSE;
- }
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Constant value type void");
+ return FALSE;
+ }
if (value_size[type->flags.tag] != 0 &&
- blob->size != value_size[type->flags.tag])
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Constant value size mismatch");
- return FALSE;
- }
+ blob->size != value_size[type->flags.tag])
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Constant value size mismatch");
+ return FALSE;
+ }
/* FIXME check string values */
}
static gboolean
validate_value_blob (GITypelib *typelib,
- guint32 offset,
- GError **error)
+ uint32_t offset,
+ GError **error)
{
ValueBlob *blob;
if (typelib->len < offset + sizeof (ValueBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
static gboolean
validate_field_blob (ValidateContext *ctx,
- guint32 offset,
- GError **error)
+ uint32_t offset,
+ GError **error)
{
GITypelib *typelib = ctx->typelib;
Header *header = (Header *)typelib->data;
if (typelib->len < offset + sizeof (FieldBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
return FALSE;
}
else if (!validate_type_blob (typelib,
- offset + G_STRUCT_OFFSET (FieldBlob, type),
- 0, FALSE, error))
+ offset + G_STRUCT_OFFSET (FieldBlob, type),
+ 0, FALSE, error))
return FALSE;
return TRUE;
static gboolean
validate_property_blob (GITypelib *typelib,
- guint32 offset,
- GError **error)
+ uint32_t offset,
+ GError **error)
{
PropertyBlob *blob;
if (typelib->len < offset + sizeof (PropertyBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
return FALSE;
if (!validate_type_blob (typelib,
- offset + G_STRUCT_OFFSET (PropertyBlob, type),
- 0, FALSE, error))
+ offset + G_STRUCT_OFFSET (PropertyBlob, type),
+ 0, FALSE, error))
return FALSE;
return TRUE;
static gboolean
validate_signal_blob (GITypelib *typelib,
- guint32 offset,
- guint32 container_offset,
- GError **error)
+ uint32_t offset,
+ uint32_t container_offset,
+ GError **error)
{
SignalBlob *blob;
- gint n_signals;
+ size_t n_signals;
if (typelib->len < offset + sizeof (SignalBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
(blob->run_cleanup != 0) != 1)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Invalid signal run flags");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Invalid signal run flags");
return FALSE;
}
if (blob->has_class_closure)
{
if (((CommonBlob*)&typelib->data[container_offset])->blob_type == BLOB_TYPE_OBJECT)
- {
- ObjectBlob *object;
+ {
+ ObjectBlob *object;
- object = (ObjectBlob*)&typelib->data[container_offset];
+ object = (ObjectBlob*)&typelib->data[container_offset];
- n_signals = object->n_signals;
- }
+ n_signals = object->n_signals;
+ }
else
- {
- InterfaceBlob *iface;
+ {
+ InterfaceBlob *iface;
- iface = (InterfaceBlob*)&typelib->data[container_offset];
+ iface = (InterfaceBlob*)&typelib->data[container_offset];
- n_signals = iface->n_signals;
- }
+ n_signals = iface->n_signals;
+ }
if (blob->class_closure >= n_signals)
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Invalid class closure index");
- return FALSE;
- }
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Invalid class closure index");
+ return FALSE;
+ }
}
if (!validate_signature_blob (typelib, blob->signature, error))
static gboolean
validate_vfunc_blob (GITypelib *typelib,
- guint32 offset,
- guint32 container_offset,
- GError **error)
+ uint32_t offset,
+ uint32_t container_offset,
+ GError **error)
{
VFuncBlob *blob;
- gint n_vfuncs;
+ size_t n_vfuncs;
if (typelib->len < offset + sizeof (VFuncBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
if (blob->class_closure)
{
if (((CommonBlob*)&typelib->data[container_offset])->blob_type == BLOB_TYPE_OBJECT)
- {
- ObjectBlob *object;
+ {
+ ObjectBlob *object;
- object = (ObjectBlob*)&typelib->data[container_offset];
+ object = (ObjectBlob*)&typelib->data[container_offset];
- n_vfuncs = object->n_vfuncs;
- }
+ n_vfuncs = object->n_vfuncs;
+ }
else
- {
- InterfaceBlob *iface;
+ {
+ InterfaceBlob *iface;
- iface = (InterfaceBlob*)&typelib->data[container_offset];
+ iface = (InterfaceBlob*)&typelib->data[container_offset];
- n_vfuncs = iface->n_vfuncs;
- }
+ n_vfuncs = iface->n_vfuncs;
+ }
if (blob->class_closure >= n_vfuncs)
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Invalid class closure index");
- return FALSE;
- }
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Invalid class closure index");
+ return FALSE;
+ }
}
if (!validate_signature_blob (typelib, blob->signature, error))
static gboolean
validate_struct_blob (ValidateContext *ctx,
- guint32 offset,
- guint16 blob_type,
- GError **error)
+ uint32_t offset,
+ uint16_t blob_type,
+ GError **error)
{
GITypelib *typelib = ctx->typelib;
StructBlob *blob;
- gint i;
- guint32 field_offset;
+ size_t i;
+ uint32_t field_offset;
if (typelib->len < offset + sizeof (StructBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
if (blob->blob_type != blob_type)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Wrong blob type");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Wrong blob type");
return FALSE;
}
if (!blob->unregistered)
{
if (!validate_name (typelib, "boxed", typelib->data, blob->gtype_name, error))
- return FALSE;
+ return FALSE;
if (!validate_name (typelib, "boxed", typelib->data, blob->gtype_init, error))
- return FALSE;
+ return FALSE;
}
else
{
if (blob->gtype_name || blob->gtype_init)
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Gtype data in struct");
- return FALSE;
- }
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Gtype data in struct");
+ return FALSE;
+ }
}
if (typelib->len < offset + sizeof (StructBlob) +
blob->n_methods * sizeof (FunctionBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
FieldBlob *field_blob = (FieldBlob*) &typelib->data[field_offset];
if (!validate_field_blob (ctx,
- field_offset,
- error))
- return FALSE;
+ field_offset,
+ error))
+ return FALSE;
field_offset += sizeof (FieldBlob);
if (field_blob->has_embedded_type)
for (i = 0; i < blob->n_methods; i++)
{
if (!validate_function_blob (ctx,
- field_offset +
- i * sizeof (FunctionBlob),
- blob_type,
- error))
- return FALSE;
+ field_offset +
+ i * sizeof (FunctionBlob),
+ blob_type,
+ error))
+ return FALSE;
}
pop_context (ctx);
static gboolean
validate_enum_blob (ValidateContext *ctx,
- guint32 offset,
- guint16 blob_type,
- GError **error)
+ uint32_t offset,
+ uint16_t blob_type,
+ GError **error)
{
GITypelib *typelib = ctx->typelib;
EnumBlob *blob;
- gint i;
- guint32 offset2;
+ uint32_t offset2;
if (typelib->len < offset + sizeof (EnumBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
if (blob->blob_type != blob_type)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Wrong blob type");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Wrong blob type");
return FALSE;
}
if (!blob->unregistered)
{
if (!validate_name (typelib, "enum", typelib->data, blob->gtype_name, error))
- return FALSE;
+ return FALSE;
if (!validate_name (typelib, "enum", typelib->data, blob->gtype_init, error))
- return FALSE;
+ return FALSE;
}
else
{
if (blob->gtype_name || blob->gtype_init)
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Gtype data in unregistered enum");
- return FALSE;
- }
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Gtype data in unregistered enum");
+ return FALSE;
+ }
}
if (!validate_name (typelib, "enum", typelib->data, blob->name, error))
blob->n_methods * sizeof (FunctionBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
push_context (ctx, get_string_nofail (typelib, blob->name));
- for (i = 0; i < blob->n_values; i++, offset2 += sizeof (ValueBlob))
+ for (size_t i = 0; i < blob->n_values; i++, offset2 += sizeof (ValueBlob))
{
if (!validate_value_blob (typelib,
- offset2,
- error))
- return FALSE;
+ offset2,
+ error))
+ return FALSE;
#if 0
v1 = (ValueBlob *)&typelib->data[offset2];
for (j = 0; j < i; j++)
- {
- v2 = (ValueBlob *)&typelib->data[offset2 +
+ {
+ v2 = (ValueBlob *)&typelib->data[offset2 +
j * sizeof (ValueBlob)];
- if (v1->value == v2->value)
- {
-
- /* FIXME should this be an error ? */
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Duplicate enum value");
- return FALSE;
- }
- }
+ if (v1->value == v2->value)
+ {
+
+ /* FIXME should this be an error ? */
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Duplicate enum value");
+ return FALSE;
+ }
+ }
#endif
}
- for (i = 0; i < blob->n_methods; i++, offset2 += sizeof (FunctionBlob))
+ for (size_t i = 0; i < blob->n_methods; i++, offset2 += sizeof (FunctionBlob))
{
if (!validate_function_blob (ctx, offset2, BLOB_TYPE_ENUM, error))
- return FALSE;
+ return FALSE;
}
pop_context (ctx);
static gboolean
validate_object_blob (ValidateContext *ctx,
- guint32 offset,
- GError **error)
+ uint32_t offset,
+ GError **error)
{
GITypelib *typelib = ctx->typelib;
Header *header;
ObjectBlob *blob;
- gint i;
- guint32 offset2;
- guint16 n_field_callbacks;
+ size_t i;
+ uint32_t offset2;
+ uint16_t n_field_callbacks;
header = (Header *)typelib->data;
if (typelib->len < offset + sizeof (ObjectBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
if (blob->blob_type != BLOB_TYPE_OBJECT)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Wrong blob type");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Wrong blob type");
return FALSE;
}
if (blob->parent > header->n_entries)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Invalid parent index");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Invalid parent index");
return FALSE;
}
if (!entry)
return FALSE;
if (entry->blob_type != BLOB_TYPE_OBJECT &&
- (entry->local || entry->blob_type != 0))
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Parent not object");
- return FALSE;
- }
+ (entry->local || entry->blob_type != 0))
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Parent not object");
+ return FALSE;
+ }
}
if (blob->gtype_struct != 0)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
for (i = 0; i < blob->n_interfaces; i++, offset2 += 2)
{
- guint16 iface;
+ uint16_t iface;
DirEntry *entry;
- iface = *(guint16*)&typelib->data[offset2];
+ iface = *(uint16_t *)&typelib->data[offset2];
if (iface == 0 || iface > header->n_entries)
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Invalid interface index");
- return FALSE;
- }
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Invalid interface index");
+ return FALSE;
+ }
entry = get_dir_entry_checked (typelib, iface, error);
if (!entry)
return FALSE;
if (entry->blob_type != BLOB_TYPE_INTERFACE &&
- (entry->local || entry->blob_type != 0))
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Not an interface");
- return FALSE;
- }
+ (entry->local || entry->blob_type != 0))
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Not an interface");
+ return FALSE;
+ }
}
offset2 += 2 * (blob->n_interfaces %2);
FieldBlob *field_blob = (FieldBlob*) &typelib->data[offset2];
if (!validate_field_blob (ctx, offset2, error))
- return FALSE;
+ return FALSE;
offset2 += sizeof (FieldBlob);
/* Special case fields which are callbacks. */
for (i = 0; i < blob->n_properties; i++, offset2 += sizeof (PropertyBlob))
{
if (!validate_property_blob (typelib, offset2, error))
- return FALSE;
+ return FALSE;
}
for (i = 0; i < blob->n_methods; i++, offset2 += sizeof (FunctionBlob))
{
if (!validate_function_blob (ctx, offset2, BLOB_TYPE_OBJECT, error))
- return FALSE;
+ return FALSE;
}
for (i = 0; i < blob->n_signals; i++, offset2 += sizeof (SignalBlob))
{
if (!validate_signal_blob (typelib, offset2, offset, error))
- return FALSE;
+ return FALSE;
}
for (i = 0; i < blob->n_vfuncs; i++, offset2 += sizeof (VFuncBlob))
{
if (!validate_vfunc_blob (typelib, offset2, offset, error))
- return FALSE;
+ return FALSE;
}
for (i = 0; i < blob->n_constants; i++, offset2 += sizeof (ConstantBlob))
{
if (!validate_constant_blob (typelib, offset2, error))
- return FALSE;
+ return FALSE;
}
pop_context (ctx);
static gboolean
validate_interface_blob (ValidateContext *ctx,
- guint32 offset,
- GError **error)
+ uint32_t offset,
+ GError **error)
{
GITypelib *typelib = ctx->typelib;
Header *header;
InterfaceBlob *blob;
- gint i;
- guint32 offset2;
+ size_t i;
+ uint32_t offset2;
header = (Header *)typelib->data;
if (typelib->len < offset + sizeof (InterfaceBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
if (blob->blob_type != BLOB_TYPE_INTERFACE)
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Wrong blob type; expected interface, got %d", blob->blob_type);
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Wrong blob type; expected interface, got %d", blob->blob_type);
return FALSE;
}
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
for (i = 0; i < blob->n_prerequisites; i++, offset2 += 2)
{
DirEntry *entry;
- guint16 req;
+ uint16_t req;
- req = *(guint16*)&typelib->data[offset2];
+ req = *(uint16_t *)&typelib->data[offset2];
if (req == 0 || req > header->n_entries)
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Invalid prerequisite index");
- return FALSE;
- }
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Invalid prerequisite index");
+ return FALSE;
+ }
entry = gi_typelib_get_dir_entry (typelib, req);
if (entry->blob_type != BLOB_TYPE_INTERFACE &&
- entry->blob_type != BLOB_TYPE_OBJECT &&
- (entry->local || entry->blob_type != 0))
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_BLOB,
- "Not an interface or object");
- return FALSE;
- }
+ entry->blob_type != BLOB_TYPE_OBJECT &&
+ (entry->local || entry->blob_type != 0))
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_BLOB,
+ "Not an interface or object");
+ return FALSE;
+ }
}
offset2 += 2 * (blob->n_prerequisites % 2);
for (i = 0; i < blob->n_properties; i++, offset2 += sizeof (PropertyBlob))
{
if (!validate_property_blob (typelib, offset2, error))
- return FALSE;
+ return FALSE;
}
for (i = 0; i < blob->n_methods; i++, offset2 += sizeof (FunctionBlob))
{
if (!validate_function_blob (ctx, offset2, BLOB_TYPE_INTERFACE, error))
- return FALSE;
+ return FALSE;
}
for (i = 0; i < blob->n_signals; i++, offset2 += sizeof (SignalBlob))
{
if (!validate_signal_blob (typelib, offset2, offset, error))
- return FALSE;
+ return FALSE;
}
for (i = 0; i < blob->n_vfuncs; i++, offset2 += sizeof (VFuncBlob))
{
if (!validate_vfunc_blob (typelib, offset2, offset, error))
- return FALSE;
+ return FALSE;
}
for (i = 0; i < blob->n_constants; i++, offset2 += sizeof (ConstantBlob))
{
if (!validate_constant_blob (typelib, offset2, error))
- return FALSE;
+ return FALSE;
}
pop_context (ctx);
static gboolean
validate_union_blob (GITypelib *typelib,
- guint32 offset,
- GError **error)
+ uint32_t offset,
+ GError **error)
{
return TRUE;
}
static gboolean
validate_blob (ValidateContext *ctx,
- guint32 offset,
- GError **error)
+ uint32_t offset,
+ GError **error)
{
GITypelib *typelib = ctx->typelib;
CommonBlob *common;
if (typelib->len < offset + sizeof (CommonBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
{
case BLOB_TYPE_FUNCTION:
if (!validate_function_blob (ctx, offset, 0, error))
- return FALSE;
+ return FALSE;
break;
case BLOB_TYPE_CALLBACK:
if (!validate_callback_blob (ctx, offset, error))
- return FALSE;
+ return FALSE;
break;
case BLOB_TYPE_STRUCT:
case BLOB_TYPE_BOXED:
if (!validate_struct_blob (ctx, offset, common->blob_type, error))
- return FALSE;
+ return FALSE;
break;
case BLOB_TYPE_ENUM:
case BLOB_TYPE_FLAGS:
if (!validate_enum_blob (ctx, offset, common->blob_type, error))
- return FALSE;
+ return FALSE;
break;
case BLOB_TYPE_OBJECT:
if (!validate_object_blob (ctx, offset, error))
- return FALSE;
+ return FALSE;
break;
case BLOB_TYPE_INTERFACE:
if (!validate_interface_blob (ctx, offset, error))
- return FALSE;
+ return FALSE;
break;
case BLOB_TYPE_CONSTANT:
if (!validate_constant_blob (typelib, offset, error))
- return FALSE;
+ return FALSE;
break;
case BLOB_TYPE_UNION:
if (!validate_union_blob (typelib, offset, error))
- return FALSE;
+ return FALSE;
break;
default:
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_ENTRY,
- "Invalid blob type");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_ENTRY,
+ "Invalid blob type");
return FALSE;
}
static gboolean
validate_directory (ValidateContext *ctx,
- GError **error)
+ GError **error)
{
GITypelib *typelib = ctx->typelib;
Header *header = (Header *)typelib->data;
DirEntry *entry;
- gint i;
+ size_t i;
if (typelib->len < header->directory + header->n_entries * sizeof (DirEntry))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
entry = gi_typelib_get_dir_entry (typelib, i + 1);
if (!validate_name (typelib, "entry", typelib->data, entry->name, error))
- return FALSE;
+ return FALSE;
if ((entry->local && entry->blob_type == BLOB_TYPE_INVALID) ||
- entry->blob_type > BLOB_TYPE_UNION)
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_DIRECTORY,
- "Invalid entry type");
- return FALSE;
- }
+ entry->blob_type > BLOB_TYPE_UNION)
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_DIRECTORY,
+ "Invalid entry type");
+ return FALSE;
+ }
if (i < header->n_local_entries)
- {
- if (!entry->local)
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_DIRECTORY,
- "Too few local directory entries");
- return FALSE;
- }
-
- if (!is_aligned (entry->offset))
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_DIRECTORY,
- "Misaligned entry");
- return FALSE;
- }
-
- if (!validate_blob (ctx, entry->offset, error))
- return FALSE;
- }
+ {
+ if (!entry->local)
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_DIRECTORY,
+ "Too few local directory entries");
+ return FALSE;
+ }
+
+ if (!is_aligned (entry->offset))
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_DIRECTORY,
+ "Misaligned entry");
+ return FALSE;
+ }
+
+ if (!validate_blob (ctx, entry->offset, error))
+ return FALSE;
+ }
else
- {
- if (entry->local)
- {
- g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID_DIRECTORY,
- "Too many local directory entries");
- return FALSE;
- }
+ {
+ if (entry->local)
+ {
+ g_set_error (error,
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID_DIRECTORY,
+ "Too many local directory entries");
+ return FALSE;
+ }
- if (!validate_name (typelib, "namespace", typelib->data, entry->offset, error))
- return FALSE;
- }
+ if (!validate_name (typelib, "namespace", typelib->data, entry->offset, error))
+ return FALSE;
+ }
}
return TRUE;
static gboolean
validate_attributes (ValidateContext *ctx,
- GError **error)
+ GError **error)
{
GITypelib *typelib = ctx->typelib;
Header *header = (Header *)typelib->data;
if (header->size < header->attributes + header->n_attributes * sizeof (AttributeBlob))
{
g_set_error (error,
- GI_TYPELIB_ERROR,
- GI_TYPELIB_ERROR_INVALID,
- "The buffer is too short");
+ GI_TYPELIB_ERROR,
+ GI_TYPELIB_ERROR_INVALID,
+ "The buffer is too short");
return FALSE;
}
static void
prefix_with_context (GError **error,
- const char *section,
- ValidateContext *ctx)
+ const char *section,
+ ValidateContext *ctx)
{
GString *str;
GSList *link;
{
g_string_append (str, link->data);
if (link->next)
- g_string_append_c (str, '/');
+ g_string_append_c (str, '/');
}
g_string_append_c (str, ')');
buf = g_string_free (str, FALSE);
if (shlib_str != NULL && shlib_str[0] != '\0')
{
- gchar **shlibs;
- gint i;
+ char **shlibs;
/* shared-library is a comma-separated list of libraries */
shlibs = g_strsplit (shlib_str, ",", 0);
* again with g_module_open(), the same file handle will be returned. See bug:
* http://bugzilla.gnome.org/show_bug.cgi?id=555294
*/
- for (i = 0; shlibs[i]; i++)
+ for (size_t i = 0; shlibs[i]; i++)
{
GModule *module;
* Since: 2.80
*/
GITypelib *
-gi_typelib_new_from_memory (guint8 *memory,
- gsize len,
+gi_typelib_new_from_memory (uint8_t *memory,
+ size_t len,
GError **error)
{
GITypelib *meta;
* Since: 2.80
*/
GITypelib *
-gi_typelib_new_from_const_memory (const guchar *memory,
- gsize len,
- GError **error)
+gi_typelib_new_from_const_memory (const uint8_t *memory,
+ size_t len,
+ GError **error)
{
GITypelib *meta;
return NULL;
meta = g_slice_new0 (GITypelib);
- meta->data = (guchar *) memory;
+ meta->data = (uint8_t *) memory;
meta->len = len;
meta->owns_memory = FALSE;
meta->modules = NULL;
GError **error)
{
GITypelib *meta;
- guint8 *data = (guint8 *) g_mapped_file_get_contents (mfile);
- gsize len = g_mapped_file_get_length (mfile);
+ uint8_t *data = (uint8_t *) g_mapped_file_get_contents (mfile);
+ size_t len = g_mapped_file_get_length (mfile);
if (!validate_header_basic (data, len, error))
return NULL;
* Returns: name of the namespace represented by @typelib
* Since: 2.80
*/
-const gchar *
+const char *
gi_typelib_get_namespace (GITypelib *typelib)
{
return gi_typelib_get_string (typelib, ((Header *) typelib->data)->namespace);
* Since: 2.80
*/
gboolean
-gi_typelib_symbol (GITypelib *typelib, const char *symbol_name, gpointer *symbol)
+gi_typelib_symbol (GITypelib *typelib, const char *symbol_name, void **symbol)
{
GList *l;
typedef struct _GITypelib GITypelib;
GI_AVAILABLE_IN_ALL
-GITypelib * gi_typelib_new_from_memory (guint8 *memory,
- gsize len,
+GITypelib * gi_typelib_new_from_memory (uint8_t *memory,
+ size_t len,
GError **error);
GI_AVAILABLE_IN_ALL
-GITypelib * gi_typelib_new_from_const_memory (const guint8 *memory,
- gsize len,
+GITypelib * gi_typelib_new_from_const_memory (const uint8_t *memory,
+ size_t len,
GError **error);
GI_AVAILABLE_IN_ALL
GI_AVAILABLE_IN_ALL
gboolean gi_typelib_symbol (GITypelib *typelib,
- const gchar *symbol_name,
- gpointer *symbol);
+ const char *symbol_name,
+ void **symbol);
GI_AVAILABLE_IN_ALL
-const gchar * gi_typelib_get_namespace (GITypelib *typelib);
+const char * gi_typelib_get_namespace (GITypelib *typelib);
G_END_DECLS
#error "Only <girepository.h> can be included directly."
#endif
+#include <stdint.h>
+
#include <glib.h>
#include <glib-object.h>
typedef struct _GIEnumInfo GIEnumInfo;
GI_AVAILABLE_IN_ALL GType gi_enum_info_get_type (void);
+/* Documented in giflagsinfo.c */
+typedef struct _GIFlagsInfo GIFlagsInfo;
+GI_AVAILABLE_IN_ALL GType gi_flags_info_get_type (void);
+
/* Documented in giobjectinfo.c */
typedef struct _GIObjectInfo GIObjectInfo;
GI_AVAILABLE_IN_ALL GType gi_object_info_get_type (void);
typedef struct _GIInterfaceInfo GIInterfaceInfo;
GI_AVAILABLE_IN_ALL GType gi_interface_info_get_type (void);
+/* Documented in giboxedinfo.c */
+typedef struct _GIBoxedInfo GIBoxedInfo;
+GI_AVAILABLE_IN_ALL GType gi_boxed_info_get_type (void);
+
/* Documented in giconstantinfo.c */
typedef struct _GIConstantInfo GIConstantInfo;
GI_AVAILABLE_IN_ALL GType gi_constant_info_get_type (void);
union _GIArgument
{
- gboolean v_boolean;
- gint8 v_int8;
- guint8 v_uint8;
- gint16 v_int16;
- guint16 v_uint16;
- gint32 v_int32;
- guint32 v_uint32;
- gint64 v_int64;
- guint64 v_uint64;
- gfloat v_float;
- gdouble v_double;
- gshort v_short;
- gushort v_ushort;
- gint v_int;
- guint v_uint;
- glong v_long;
- gulong v_ulong;
- gssize v_ssize;
- gsize v_size;
- gchar * v_string;
- gpointer v_pointer;
+ gboolean v_boolean;
+ int8_t v_int8;
+ uint8_t v_uint8;
+ int16_t v_int16;
+ uint16_t v_uint16;
+ int32_t v_int32;
+ uint32_t v_uint32;
+ int64_t v_int64;
+ uint64_t v_uint64;
+ float v_float;
+ double v_double;
+ short v_short;
+ unsigned short v_ushort;
+ int v_int;
+ unsigned int v_uint;
+ long v_long;
+ unsigned long v_ulong;
+ gssize v_ssize;
+ size_t v_size;
+ char *v_string;
+ void *v_pointer;
};
/**
* @GI_INFO_TYPE_OBJECT: object, see [class@GIRepository.ObjectInfo]
* @GI_INFO_TYPE_INTERFACE: interface, see [class@GIRepository.InterfaceInfo]
* @GI_INFO_TYPE_CONSTANT: constant, see [class@GIRepository.ConstantInfo]
- * @GI_INFO_TYPE_INVALID_0: deleted, used to be `GI_INFO_TYPE_ERROR_DOMAIN`.
* @GI_INFO_TYPE_UNION: union, see [class@GIRepository.UnionInfo]
* @GI_INFO_TYPE_VALUE: enum value, see [class@GIRepository.ValueInfo]
* @GI_INFO_TYPE_SIGNAL: signal, see [class@GIRepository.SignalInfo]
GI_INFO_TYPE_CALLBACK,
GI_INFO_TYPE_STRUCT,
GI_INFO_TYPE_BOXED,
- GI_INFO_TYPE_ENUM, /* 5 */
+ GI_INFO_TYPE_ENUM, /* 5 */
GI_INFO_TYPE_FLAGS,
GI_INFO_TYPE_OBJECT,
GI_INFO_TYPE_INTERFACE,
GI_INFO_TYPE_CONSTANT,
- GI_INFO_TYPE_INVALID_0, /* 10 */
- GI_INFO_TYPE_UNION,
+ GI_INFO_TYPE_UNION, /* 10 */
GI_INFO_TYPE_VALUE,
GI_INFO_TYPE_SIGNAL,
GI_INFO_TYPE_VFUNC,
- GI_INFO_TYPE_PROPERTY, /* 15 */
- GI_INFO_TYPE_FIELD,
+ GI_INFO_TYPE_PROPERTY,
+ GI_INFO_TYPE_FIELD, /* 15 */
GI_INFO_TYPE_ARG,
GI_INFO_TYPE_TYPE,
GI_INFO_TYPE_UNRESOLVED,
- GI_INFO_TYPE_CALLABLE, /* 20 */
- GI_INFO_TYPE_REGISTERED_TYPE,
+ GI_INFO_TYPE_CALLABLE,
+ GI_INFO_TYPE_REGISTERED_TYPE, /* 20 */
/* keep GI_INFO_TYPE_N_TYPES in sync with this */
} GIInfoType;
* Returns: number of fields
* Since: 2.80
*/
-guint
+unsigned int
gi_union_info_get_n_fields (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIFieldInfo *
gi_union_info_get_field (GIUnionInfo *info,
- guint n)
+ unsigned int n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
* Returns: number of methods
* Since: 2.80
*/
-guint
+unsigned int
gi_union_info_get_n_methods (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIFunctionInfo *
gi_union_info_get_method (GIUnionInfo *info,
- guint n)
+ unsigned int n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
Header *header = (Header *)rinfo->typelib->data;
- gint offset;
+ size_t offset;
offset = rinfo->offset + header->union_blob_size
+ blob->n_fields * header->field_blob_size
* Returns: offset, in bytes, of the discriminator
* Since: 2.80
*/
-guint
+size_t
gi_union_info_get_discriminator_offset (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
*/
GIConstantInfo *
gi_union_info_get_discriminator (GIUnionInfo *info,
- guint n)
+ size_t n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
if (blob->discriminated)
{
Header *header = (Header *)rinfo->typelib->data;
- gint offset;
+ size_t offset;
offset = rinfo->offset + header->union_blob_size
- + blob->n_fields * header->field_blob_size
- + blob->n_functions * header->function_blob_size
- + n * header->constant_blob_size;
+ + blob->n_fields * header->field_blob_size
+ + blob->n_functions * header->function_blob_size
+ + n * header->constant_blob_size;
return (GIConstantInfo *) gi_info_new (GI_INFO_TYPE_CONSTANT, (GIBaseInfo*)info,
rinfo->typelib, offset);
*/
GIFunctionInfo *
gi_union_info_find_method (GIUnionInfo *info,
- const gchar *name)
+ const char *name)
{
- gint offset;
+ size_t offset;
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
* Returns: size of the union, in bytes
* Since: 2.80
*/
-gsize
+size_t
gi_union_info_get_size (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
* Returns: required alignment, in bytes
* Since: 2.80
*/
-gsize
+size_t
gi_union_info_get_alignment (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
G_BEGIN_DECLS
+#define GI_TYPE_UNION_INFO (gi_union_info_get_type ())
+
+/**
+ * GI_UNION_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.UnionInfo] or derived pointer into a
+ * `(GIUnionInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_UNION_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_UNION_INFO, GIUnionInfo))
+
/**
* GI_IS_UNION_INFO:
* @info: an info structure
*
- * Checks if @info is a [struct@GIRepository.UnionInfo].
+ * Checks if @info is a [struct@GIRepository.UnionInfo] (or a derived type).
*
* Since: 2.80
*/
-#define GI_IS_UNION_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNION)
+#define GI_IS_UNION_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_UNION_INFO))
GI_AVAILABLE_IN_ALL
-guint gi_union_info_get_n_fields (GIUnionInfo *info);
+unsigned int gi_union_info_get_n_fields (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
GIFieldInfo * gi_union_info_get_field (GIUnionInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
-guint gi_union_info_get_n_methods (GIUnionInfo *info);
+unsigned int gi_union_info_get_n_methods (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_union_info_get_method (GIUnionInfo *info,
- guint n);
+ unsigned int n);
GI_AVAILABLE_IN_ALL
gboolean gi_union_info_is_discriminated (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
-guint gi_union_info_get_discriminator_offset (GIUnionInfo *info);
+size_t gi_union_info_get_discriminator_offset (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
GITypeInfo * gi_union_info_get_discriminator_type (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
GIConstantInfo * gi_union_info_get_discriminator (GIUnionInfo *info,
- guint n);
+ size_t n);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_union_info_find_method (GIUnionInfo *info,
- const gchar *name);
+ const char *name);
GI_AVAILABLE_IN_ALL
-gsize gi_union_info_get_size (GIUnionInfo *info);
+size_t gi_union_info_get_size (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
-gsize gi_union_info_get_alignment (GIUnionInfo *info);
+size_t gi_union_info_get_alignment (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
const char * gi_union_info_get_copy_function_name (GIUnionInfo *info);
G_BEGIN_DECLS
+#define GI_TYPE_UNRESOLVED_INFO (gi_unresolved_info_get_type ())
+
+/**
+ * GI_UNRESOLVED_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.UnresolvedInfo] or derived pointer into a
+ * `(GIUnresolvedInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_UNRESOLVED_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_UNRESOLVED_INFO, GIUnresolvedInfo))
+
/**
* GI_IS_UNRESOLVED_INFO:
* @info: an info structure
*
* Since: 2.80
*/
-#define GI_IS_UNRESOLVED_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNRESOLVED)
+#define GI_IS_UNRESOLVED_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_UNRESOLVED_INFO))
G_END_DECLS
--- /dev/null
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ * GObject introspection: Enum implementation
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+
+#include <girepository/girepository.h>
+#include "gibaseinfo-private.h"
+#include "girepository-private.h"
+#include "gitypelib-internal.h"
+#include "givalueinfo.h"
+
+/**
+ * GIValueInfo:
+ *
+ * A `GIValueInfo` represents a value in an enumeration.
+ *
+ * The `GIValueInfo` is fetched by calling
+ * [method@GIRepository.EnumInfo.get_value] on a [class@GIRepository.EnumInfo].
+ *
+ * Since: 2.80
+ */
+
+/**
+ * gi_value_info_get_value:
+ * @info: a #GIValueInfo
+ *
+ * Obtain the enumeration value of the `GIValueInfo`.
+ *
+ * Returns: the enumeration value. This will always be representable
+ * as a 32-bit signed or unsigned value. The use of `int64_t` as the
+ * return type is to allow both.
+ * Since: 2.80
+ */
+int64_t
+gi_value_info_get_value (GIValueInfo *info)
+{
+ GIRealInfo *rinfo = (GIRealInfo *)info;
+ ValueBlob *blob;
+
+ g_return_val_if_fail (info != NULL, -1);
+ g_return_val_if_fail (GI_IS_VALUE_INFO (info), -1);
+
+ blob = (ValueBlob *)&rinfo->typelib->data[rinfo->offset];
+
+ if (blob->unsigned_value)
+ return (int64_t)(uint32_t)blob->value;
+ else
+ return (int64_t)blob->value;
+}
+
+void
+gi_value_info_class_init (gpointer g_class,
+ gpointer class_data)
+{
+ GIBaseInfoClass *info_class = g_class;
+
+ info_class->info_type = GI_INFO_TYPE_VALUE;
+}
--- /dev/null
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ * GObject introspection: Enum and Enum values
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ * Copyright (C) 2008,2009 Red Hat, Inc.
+ *
+ * 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 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
+#error "Only <girepository.h> can be included directly."
+#endif
+
+#include <girepository/gitypes.h>
+
+G_BEGIN_DECLS
+
+#define GI_TYPE_VALUE_INFO (gi_value_info_get_type ())
+
+/**
+ * GI_VALUE_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.ValueInfo] or derived pointer into a
+ * `(GIValueInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_VALUE_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_VALUE_INFO, GIValueInfo))
+
+/**
+ * GI_IS_VALUE_INFO:
+ * @info: an info structure
+ *
+ * Checks if @info is a [class@GIRepository.ValueInfo] (or a derived type).
+ *
+ * Since: 2.80
+ */
+#define GI_IS_VALUE_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_VALUE_INFO))
+
+
+GI_AVAILABLE_IN_ALL
+int64_t gi_value_info_get_value (GIValueInfo *info);
+
+G_END_DECLS
GIVFuncInfo *
gi_base_info_find_vfunc (GIRealInfo *rinfo,
- guint32 offset,
- guint n_vfuncs,
- const gchar *name)
+ uint32_t offset,
+ uint16_t n_vfuncs,
+ const char *name)
{
/* FIXME hash */
Header *header = (Header *)rinfo->typelib->data;
- for (guint i = 0; i < n_vfuncs; i++)
+ for (uint16_t i = 0; i < n_vfuncs; i++)
{
VFuncBlob *fblob = (VFuncBlob *)&rinfo->typelib->data[offset];
- const gchar *fname = (const gchar *)&rinfo->typelib->data[fblob->name];
+ const char *fname = (const char *)&rinfo->typelib->data[fblob->name];
if (strcmp (name, fname) == 0)
return (GIVFuncInfo *) gi_info_new (GI_INFO_TYPE_VFUNC, (GIBaseInfo*) rinfo,
- rinfo->typelib, offset);
+ rinfo->typelib, offset);
offset += header->vfunc_blob_size;
}
* Returns: the struct offset or `0xFFFF` if it’s unknown
* Since: 2.80
*/
-guint
+size_t
gi_vfunc_info_get_offset (GIVFuncInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
* Returns: address to a function
* Since: 2.80
*/
-gpointer
+void *
gi_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
GType implementor_gtype,
GError **error)
GIStructInfo *struct_info;
GIFieldInfo *field_info = NULL;
int length, i, offset;
- gpointer implementor_class, implementor_vtable;
- gpointer func = NULL;
+ void *implementor_class, *implementor_vtable;
+ void *func = NULL;
g_return_val_if_fail (vfunc_info != NULL, NULL);
g_return_val_if_fail (GI_IS_VFUNC_INFO (vfunc_info), NULL);
}
offset = gi_field_info_get_offset (field_info);
- func = *(gpointer*) G_STRUCT_MEMBER_P (implementor_vtable, offset);
+ func = *(void**) G_STRUCT_MEMBER_P (implementor_vtable, offset);
g_type_class_unref (implementor_class);
gi_base_info_unref ((GIBaseInfo *) field_info);
gi_vfunc_info_invoke (GIVFuncInfo *info,
GType implementor,
const GIArgument *in_args,
- gsize n_in_args,
- const GIArgument *out_args,
- gsize n_out_args,
+ size_t n_in_args,
+ GIArgument *out_args,
+ size_t n_out_args,
GIArgument *return_value,
GError **error)
{
- gpointer func;
+ void *func;
GError *local_error = NULL;
g_return_val_if_fail (info != NULL, FALSE);
out_args,
n_out_args,
return_value,
- TRUE,
- FALSE,
error);
}
G_BEGIN_DECLS
+#define GI_TYPE_VFUNC_INFO (gi_vfunc_info_get_type ())
+
+/**
+ * GI_VFUNC_INFO:
+ * @info: Info object which is subject to casting.
+ *
+ * Casts a [type@GIRepository.VFuncInfo] or derived pointer into a
+ * `(GIVFuncInfo*)` pointer.
+ *
+ * Depending on the current debugging level, this function may invoke
+ * certain runtime checks to identify invalid casts.
+ *
+ * Since: 2.80
+ */
+#define GI_VFUNC_INFO(info) (G_TYPE_CHECK_INSTANCE_CAST ((info), GI_TYPE_VFUNC_INFO, GIVFuncInfo))
+
/**
* GI_IS_VFUNC_INFO:
* @info: an info structure
*
- * Checks if @info is a [struct@GIRepository.VFuncInfo].
+ * Checks if @info is a [struct@GIRepository.VFuncInfo] (or a derived type).
*
* Since: 2.80
*/
-#define GI_IS_VFUNC_INFO(info) \
- (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_VFUNC)
+#define GI_IS_VFUNC_INFO(info) (G_TYPE_CHECK_INSTANCE_TYPE ((info), GI_TYPE_VFUNC_INFO))
GI_AVAILABLE_IN_ALL
GIVFuncInfoFlags gi_vfunc_info_get_flags (GIVFuncInfo *info);
GI_AVAILABLE_IN_ALL
-guint gi_vfunc_info_get_offset (GIVFuncInfo *info);
+size_t gi_vfunc_info_get_offset (GIVFuncInfo *info);
GI_AVAILABLE_IN_ALL
GISignalInfo * gi_vfunc_info_get_signal (GIVFuncInfo *info);
GIFunctionInfo * gi_vfunc_info_get_invoker (GIVFuncInfo *info);
GI_AVAILABLE_IN_ALL
-gpointer gi_vfunc_info_get_address (GIVFuncInfo *info,
+void * gi_vfunc_info_get_address (GIVFuncInfo *info,
GType implementor_gtype,
GError **error);
gboolean gi_vfunc_info_invoke (GIVFuncInfo *info,
GType implementor,
const GIArgument *in_args,
- gsize n_in_args,
- const GIArgument *out_args,
- gsize n_out_args,
+ size_t n_in_args,
+ GIArgument *out_args,
+ size_t n_out_args,
GIArgument *return_value,
GError **error);
* INT32 mph_size
* MPH (mph_size bytes)
* (padding for alignment to uint32 if necessary)
- * INDEX (array of guint16)
+ * INDEX (array of uint16_t)
*
* Because BDZ is not order preserving, we need a lookaside table which
* maps the hash value into the directory index.
gboolean buildable;
cmph_t *c;
GHashTable *strings;
- guint32 dirmap_offset;
- guint32 packed_size;
+ uint32_t dirmap_offset;
+ uint32_t packed_size;
};
GITypelibHashBuilder *
void
gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder,
const char *str,
- guint16 value)
+ uint16_t value)
{
g_return_if_fail (builder->c == NULL);
- g_hash_table_insert (builder->strings, g_strdup (str), GUINT_TO_POINTER ((guint) value));
+ g_hash_table_insert (builder->strings, g_strdup (str), GUINT_TO_POINTER (value));
}
gboolean
{
char **strs;
GHashTableIter hashiter;
- gpointer key, value;
+ void *key, *value;
cmph_io_adapter_t *io;
cmph_config_t *config;
- guint32 num_elts;
- guint32 offset;
- guint i;
+ uint32_t num_elts;
+ uint32_t offset;
+ unsigned i;
if (builder->prepared)
return builder->buildable;
g_assert (cmph_size (builder->c) == num_elts);
/* Pack a size counter at front */
- offset = sizeof(guint32) + cmph_packed_size (builder->c);
+ offset = sizeof (uint32_t) + cmph_packed_size (builder->c);
builder->dirmap_offset = ALIGN_VALUE (offset, 4);
- builder->packed_size = builder->dirmap_offset + (num_elts * sizeof(guint16));
+ builder->packed_size = builder->dirmap_offset + (num_elts * sizeof (uint16_t));
out:
+ g_strfreev (strs);
cmph_config_destroy (config);
cmph_io_vector_adapter_destroy (io);
return builder->buildable;
}
-guint32
+uint32_t
gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder)
{
g_return_val_if_fail (builder != NULL, 0);
}
void
-gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint32 len)
+gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, uint8_t* mem, uint32_t len)
{
- guint16 *table;
+ uint16_t *table;
GHashTableIter hashiter;
- gpointer key, value;
+ void *key, *value;
#ifndef G_DISABLE_ASSERT
- guint32 num_elts;
+ uint32_t num_elts;
#endif
- guint8 *packed_mem;
+ uint8_t *packed_mem;
g_return_if_fail (builder != NULL);
g_return_if_fail (builder->prepared);
memset (mem, 0, len);
- *((guint32*) mem) = builder->dirmap_offset;
- packed_mem = (guint8*)(mem + sizeof(guint32));
+ *((uint32_t*) mem) = builder->dirmap_offset;
+ packed_mem = (uint8_t*)(mem + sizeof (uint32_t));
cmph_pack (builder->c, packed_mem);
- table = (guint16*) (mem + builder->dirmap_offset);
+ table = (uint16_t*) (mem + builder->dirmap_offset);
#ifndef G_DISABLE_ASSERT
num_elts = g_hash_table_size (builder->strings);
while (g_hash_table_iter_next (&hashiter, &key, &value))
{
const char *str = key;
- guint16 strval = (guint16)GPOINTER_TO_UINT(value);
- guint32 hashv;
+ uint16_t strval = (uint16_t)GPOINTER_TO_UINT(value);
+ uint32_t hashv;
hashv = cmph_search_packed (packed_mem, str, strlen (str));
g_assert (hashv < num_elts);
g_slice_free (GITypelibHashBuilder, builder);
}
-guint16
-gi_typelib_hash_search (guint8* memory, const char *str, guint n_entries)
+uint16_t
+gi_typelib_hash_search (uint8_t* memory, const char *str, uint32_t n_entries)
{
- guint32 *mph;
- guint16 *table;
- guint32 dirmap_offset;
- guint32 offset;
+ uint32_t *mph;
+ uint16_t *table;
+ uint32_t dirmap_offset;
+ uint32_t offset;
g_assert ((((size_t)memory) & 0x3) == 0);
- mph = ((guint32*)memory)+1;
+ mph = ((uint32_t*)memory)+1;
offset = cmph_search_packed (mph, str, strlen (str));
if (offset >= n_entries)
offset = 0;
- dirmap_offset = *((guint32*)memory);
- table = (guint16*) (memory + dirmap_offset);
+ dirmap_offset = *((uint32_t*)memory);
+ table = (uint16_t*) (memory + dirmap_offset);
return table[offset];
}
girepo_headers = files(
'giarginfo.h',
'gibaseinfo.h',
+ 'giboxedinfo.h',
'gicallableinfo.h',
'gicallbackinfo.h',
'giconstantinfo.h',
'gienuminfo.h',
'gifieldinfo.h',
+ 'giflagsinfo.h',
'gifunctioninfo.h',
'giinterfaceinfo.h',
'giobjectinfo.h',
'gitypes.h',
'giunioninfo.h',
'giunresolvedinfo.h',
+ 'givalueinfo.h',
'givfuncinfo.h',
)
libgmodule_dep,
libgobject_dep,
],
+ gnu_symbol_visibility : 'hidden',
)
girepo_gthash_dep = declare_dependency(
gi_visibility_h,
],
c_args: gir_c_args + custom_c_args,
+ gnu_symbol_visibility : 'hidden',
include_directories : [configinc, girepoinc],
dependencies: [girepo_gthash_dep, libffi_dep],
)
'gdump.c',
'giarginfo.c',
'gibaseinfo.c',
+ 'giboxedinfo.c',
'gicallableinfo.c',
'gicallbackinfo.c',
'giconstantinfo.c',
'gienuminfo.c',
'gifieldinfo.c',
+ 'giflagsinfo.c',
'gifunctioninfo.c',
'ginvoke.c',
'giinterfaceinfo.c',
'gitypelib.c',
'giunioninfo.c',
'giunresolvedinfo.c',
+ 'givalueinfo.c',
'givfuncinfo.c',
)
cmph_io_adapter_t *io;
char **strings;
cmph_t *c;
- guint32 size;
+ uint32_t size;
strings = g_strsplit ("foo,bar,baz", ",", -1);
}
static void
-assert_hashes_unique (guint n_hashes,
- guint32* hashes)
+assert_hashes_unique (size_t n_hashes,
+ uint32_t* hashes)
{
- guint i;
+ size_t i;
for (i = 0; i < n_hashes; i++)
{
- guint j = 0;
- for (j = 0; j < n_hashes; j++)
+ for (size_t j = 0; j < n_hashes; j++)
{
if (j != i)
g_assert_cmpuint (hashes[i], !=, hashes[j]);
test_search (void)
{
cmph_t *c = build();
- guint i;
- guint32 hash;
- guint32 hashes[3];
- guint32 size;
+ size_t i;
+ uint32_t hash;
+ uint32_t hashes[3];
+ uint32_t size;
size = cmph_size (c);
test_search_packed (void)
{
cmph_t *c = build();
- guint32 bufsize;
- guint i;
- guint32 hash;
- guint32 hashes[3];
- guint32 size;
- guint8 *buf;
+ size_t i;
+ uint32_t bufsize;
+ uint32_t hash;
+ uint32_t hashes[3];
+ uint32_t size;
+ uint8_t *buf;
bufsize = cmph_packed_size (c);
buf = g_malloc (bufsize);
int
main(int argc, char **argv)
{
- gint ret;
-
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/cmph-bdz/search", test_search);
g_test_add_func ("/cmph-bdz/search-packed", test_search_packed);
- ret = g_test_run ();
-
- return ret;
+ return g_test_run ();
}
* Boston, MA 02111-1307, USA.
*/
+#include <stdint.h>
#include <glib-object.h>
#include "gitypelib-internal.h"
test_build_retrieve (void)
{
GITypelibHashBuilder *builder;
- guint32 bufsize;
- guint8* buf;
+ uint32_t bufsize;
+ uint8_t* buf;
builder = gi_typelib_hash_builder_new ();
gi_typelib_hash_builder_add_string (builder, "VolumeMonitor", 9);
gi_typelib_hash_builder_add_string (builder, "FileMonitorFlags", 31);
- if (!gi_typelib_hash_builder_prepare (builder))
- g_assert_not_reached ();
+ g_assert_true (gi_typelib_hash_builder_prepare (builder));
bufsize = gi_typelib_hash_builder_get_buffer_size (builder);
gi_typelib_hash_builder_destroy (builder);
- g_assert (gi_typelib_hash_search (buf, "Action", 4) == 0);
- g_assert (gi_typelib_hash_search (buf, "ZLibDecompressor", 4) == 42);
- g_assert (gi_typelib_hash_search (buf, "VolumeMonitor", 4) == 9);
- g_assert (gi_typelib_hash_search (buf, "FileMonitorFlags", 4) == 31);
+ g_assert_cmpuint (gi_typelib_hash_search (buf, "Action", 4), ==, 0);
+ g_assert_cmpuint (gi_typelib_hash_search (buf, "ZLibDecompressor", 4), ==, 42);
+ g_assert_cmpuint (gi_typelib_hash_search (buf, "VolumeMonitor", 4), ==, 9);
+ g_assert_cmpuint (gi_typelib_hash_search (buf, "FileMonitorFlags", 4), ==, 31);
+
+ g_free (buf);
}
int
# Some GIR files are needed to test against
if enable_gir
girepository_tests += {
+ 'cmph-bdz': {
+ 'dependencies': [cmph_dep],
+ },
+ 'gthash' : {
+ 'dependencies': [girepo_gthash_dep],
+ },
'repository' : {
'depends': [glib_gir, gobject_gir],
},
#include "glib.h"
#include "girepository.h"
+static GIRepository *
+load_typelib_from_builddir (const char *name,
+ const char *version)
+{
+ GIRepository *repository;
+ char *gobject_typelib_dir = NULL;
+ GITypelib *typelib = NULL;
+ GError *local_error = NULL;
+
+ gobject_typelib_dir = g_test_build_filename (G_TEST_BUILT, "..", "..", "introspection", NULL);
+ g_test_message ("Using GI_TYPELIB_DIR = %s", gobject_typelib_dir);
+ gi_repository_prepend_search_path (gobject_typelib_dir);
+ g_free (gobject_typelib_dir);
+
+ repository = gi_repository_new ();
+ g_assert_nonnull (repository);
+
+ typelib = gi_repository_require (repository, name, version, 0, &local_error);
+ g_assert_no_error (local_error);
+ g_assert_nonnull (typelib);
+
+ return g_steal_pointer (&repository);
+}
+
static void
test_repository_basic (void)
{
GITypelib *typelib = NULL;
GIObjectInfo *object_info = NULL;
GISignalInfo *signal_info = NULL;
+ GIFunctionInfo *method_info = NULL;
GError *local_error = NULL;
g_test_summary ("Test retrieving some basic info blobs from a typelib");
g_assert_cmpint (gi_signal_info_get_flags (signal_info), ==,
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED | G_SIGNAL_NO_HOOKS | G_SIGNAL_ACTION);
- gi_base_info_unref ((GIBaseInfo *) signal_info);
- gi_base_info_unref ((GIBaseInfo *) object_info);
+ g_assert_cmpuint (gi_object_info_get_n_methods (object_info), >, 2);
+
+ method_info = gi_object_info_find_method (object_info, "get_property");
+ g_assert_nonnull (method_info);
+ g_assert_true (gi_callable_info_is_method ((GICallableInfo *) method_info));
+ g_assert_cmpuint (gi_callable_info_get_n_args ((GICallableInfo *) method_info), ==, 2);
+ g_clear_pointer (&method_info, gi_base_info_unref);
+
+ method_info = gi_object_info_get_method (object_info,
+ gi_object_info_get_n_methods (object_info) - 1);
+ g_assert_true (gi_callable_info_is_method ((GICallableInfo *) method_info));
+ g_assert_cmpuint (gi_callable_info_get_n_args ((GICallableInfo *) method_info), >, 0);
+ g_clear_pointer (&method_info, gi_base_info_unref);
+
+ gi_base_info_unref (signal_info);
+ gi_base_info_unref (object_info);
g_clear_object (&repository);
}
g_clear_pointer (&dependencies, g_strfreev);
}
+static void
+test_repository_arg_info (void)
+{
+ GIRepository *repository;
+ GIObjectInfo *object_info = NULL;
+ GIStructInfo *struct_info = NULL;
+ GIFunctionInfo *method_info = NULL;
+ GIArgInfo *arg_info = NULL;
+ GITypeInfo *type_info = NULL;
+ unsigned int idx;
+
+ g_test_summary ("Test retrieving GIArgInfos from a typelib");
+
+ repository = load_typelib_from_builddir ("GObject", "2.0");
+
+ /* Test all the methods of GIArgInfo. Here we’re looking at the
+ * `const char *property_name` argument of g_object_get_property(). (The
+ * ‘self’ argument is not exposed through gi_callable_info_get_arg().) */
+ object_info = (GIObjectInfo *) gi_repository_find_by_name (repository, "GObject", "Object");
+ g_assert_nonnull (object_info);
+
+ method_info = gi_object_info_find_method (object_info, "get_property");
+ g_assert_nonnull (method_info);
+
+ arg_info = gi_callable_info_get_arg (GI_CALLABLE_INFO (method_info), 0);
+ g_assert_nonnull (arg_info);
+
+ g_assert_cmpint (gi_arg_info_get_direction (arg_info), ==, GI_DIRECTION_IN);
+ g_assert_false (gi_arg_info_is_return_value (arg_info));
+ g_assert_false (gi_arg_info_is_optional (arg_info));
+ g_assert_false (gi_arg_info_is_caller_allocates (arg_info));
+ g_assert_false (gi_arg_info_may_be_null (arg_info));
+ g_assert_false (gi_arg_info_is_skip (arg_info));
+ g_assert_cmpint (gi_arg_info_get_ownership_transfer (arg_info), ==, GI_TRANSFER_NOTHING);
+ g_assert_cmpint (gi_arg_info_get_scope (arg_info), ==, GI_SCOPE_TYPE_INVALID);
+ g_assert_false (gi_arg_info_get_closure_index (arg_info, NULL));
+ g_assert_false (gi_arg_info_get_closure_index (arg_info, &idx));
+ g_assert_cmpuint (idx, ==, 0);
+ g_assert_false (gi_arg_info_get_destroy_index (arg_info, NULL));
+ g_assert_false (gi_arg_info_get_destroy_index (arg_info, &idx));
+ g_assert_cmpuint (idx, ==, 0);
+
+ type_info = gi_arg_info_get_type_info (arg_info);
+ g_assert_nonnull (type_info);
+ g_assert_true (gi_type_info_is_pointer (type_info));
+ g_assert_cmpint (gi_type_info_get_tag (type_info), ==, GI_TYPE_TAG_UTF8);
+
+ g_clear_pointer (&type_info, gi_base_info_unref);
+ g_clear_pointer (&arg_info, gi_base_info_unref);
+ g_clear_pointer (&method_info, gi_base_info_unref);
+ g_clear_pointer (&object_info, gi_base_info_unref);
+
+ /* Test an (out) argument. Here it’s the `guint *n_properties` from
+ * g_object_class_list_properties(). */
+ struct_info = (GIStructInfo *) gi_repository_find_by_name (repository, "GObject", "ObjectClass");
+ g_assert_nonnull (struct_info);
+
+ method_info = gi_struct_info_find_method (struct_info, "list_properties");
+ g_assert_nonnull (method_info);
+
+ arg_info = gi_callable_info_get_arg (GI_CALLABLE_INFO (method_info), 0);
+ g_assert_nonnull (arg_info);
+
+ g_assert_cmpint (gi_arg_info_get_direction (arg_info), ==, GI_DIRECTION_OUT);
+ g_assert_false (gi_arg_info_is_optional (arg_info));
+ g_assert_false (gi_arg_info_is_caller_allocates (arg_info));
+ g_assert_cmpint (gi_arg_info_get_ownership_transfer (arg_info), ==, GI_TRANSFER_EVERYTHING);
+
+ g_clear_pointer (&arg_info, gi_base_info_unref);
+ g_clear_pointer (&method_info, gi_base_info_unref);
+ g_clear_pointer (&struct_info, gi_base_info_unref);
+
+ g_clear_object (&repository);
+}
+
+static void
+test_repository_boxed_info (void)
+{
+ GIRepository *repository;
+ GIBoxedInfo *boxed_info = NULL;
+
+ g_test_summary ("Test retrieving GIBoxedInfos from a typelib");
+
+ repository = load_typelib_from_builddir ("GObject", "2.0");
+
+ /* Test all the methods of GIBoxedInfo. This is simple, because there are none. */
+ boxed_info = (GIBoxedInfo *) gi_repository_find_by_name (repository, "GObject", "BookmarkFile");
+ g_assert_nonnull (boxed_info);
+
+ g_clear_pointer (&boxed_info, gi_base_info_unref);
+
+ g_clear_object (&repository);
+}
+
+static void
+test_repository_callable_info (void)
+{
+ GIRepository *repository;
+ GIObjectInfo *object_info = NULL;
+ GIFunctionInfo *method_info = NULL;
+ GICallableInfo *callable_info;
+ GITypeInfo *type_info = NULL;
+ GIAttributeIter iter = GI_ATTRIBUTE_ITER_INIT;
+ const char *name, *value;
+ GIArgInfo *arg_info = NULL;
+
+ g_test_summary ("Test retrieving GICallableInfos from a typelib");
+
+ repository = load_typelib_from_builddir ("GObject", "2.0");
+
+ /* Test all the methods of GICallableInfo. Here we’re looking at
+ * g_object_get_qdata(). */
+ object_info = (GIObjectInfo *) gi_repository_find_by_name (repository, "GObject", "Object");
+ g_assert_nonnull (object_info);
+
+ method_info = gi_object_info_find_method (object_info, "get_qdata");
+ g_assert_nonnull (method_info);
+
+ callable_info = GI_CALLABLE_INFO (method_info);
+
+ g_assert_true (gi_callable_info_is_method (callable_info));
+ g_assert_false (gi_callable_info_can_throw_gerror (callable_info));
+
+ type_info = gi_callable_info_get_return_type (callable_info);
+ g_assert_nonnull (type_info);
+ g_assert_true (gi_type_info_is_pointer (type_info));
+ g_assert_cmpint (gi_type_info_get_tag (type_info), ==, GI_TYPE_TAG_VOID);
+ g_clear_pointer (&type_info, gi_base_info_unref);
+
+ /* This method has no attributes */
+ g_assert_false (gi_callable_info_iterate_return_attributes (callable_info, &iter, &name, &value));
+
+ g_assert_null (gi_callable_info_get_return_attribute (callable_info, "doesnt-exist"));
+
+ g_assert_false (gi_callable_info_get_caller_owns (callable_info));
+ g_assert_true (gi_callable_info_may_return_null (callable_info));
+ g_assert_false (gi_callable_info_skip_return (callable_info));
+
+ g_assert_cmpuint (gi_callable_info_get_n_args (callable_info), ==, 1);
+
+ arg_info = gi_callable_info_get_arg (callable_info, 0);
+ g_assert_nonnull (arg_info);
+ g_clear_pointer (&arg_info, gi_base_info_unref);
+
+ g_assert_cmpint (gi_callable_info_get_instance_ownership_transfer (callable_info), ==, GI_TRANSFER_NOTHING);
+
+ g_clear_pointer (&method_info, gi_base_info_unref);
+ g_clear_pointer (&object_info, gi_base_info_unref);
+
+ g_clear_object (&repository);
+}
+
+static void
+test_repository_callback_info (void)
+{
+ GIRepository *repository;
+ GICallbackInfo *callback_info = NULL;
+
+ g_test_summary ("Test retrieving GICallbackInfos from a typelib");
+
+ repository = load_typelib_from_builddir ("GObject", "2.0");
+
+ /* Test all the methods of GICallbackInfo. This is simple, because there are none. */
+ callback_info = (GICallbackInfo *) gi_repository_find_by_name (repository, "GObject", "ObjectFinalizeFunc");
+ g_assert_nonnull (callback_info);
+
+ g_clear_pointer (&callback_info, gi_base_info_unref);
+
+ g_clear_object (&repository);
+}
+
int
main (int argc,
char *argv[])
g_test_add_func ("/repository/basic", test_repository_basic);
g_test_add_func ("/repository/info", test_repository_info);
g_test_add_func ("/repository/dependencies", test_repository_dependencies);
+ g_test_add_func ("/repository/arg-info", test_repository_arg_info);
+ g_test_add_func ("/repository/boxed-info", test_repository_boxed_info);
+ g_test_add_func ("/repository/callable-info", test_repository_callable_info);
+ g_test_add_func ("/repository/callback-info", test_repository_callback_info);
return g_test_run ();
}
--- /dev/null
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ * GObject introspection: Typelib compiler
+ *
+ * Copyright (C) 2005 Matthias Clasen
+ *
+ * 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 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <errno.h>
+#include <locale.h>
+#include <string.h>
+
+#include <glib.h>
+#include <glib/gstdio.h>
+#include <gio/gio.h>
+
+#ifdef G_OS_WIN32
+#include <io.h>
+#include <fcntl.h>
+#endif
+
+#include "girmodule.h"
+#include "girnode.h"
+#include "girparser.h"
+#include "gitypelib-internal.h"
+
+gchar **includedirs = NULL;
+gchar **input = NULL;
+gchar *output = NULL;
+gchar *mname = NULL;
+gchar **shlibs = NULL;
+gboolean include_cwd = FALSE;
+gboolean debug = FALSE;
+gboolean verbose = FALSE;
+gboolean show_version = FALSE;
+
+static gboolean
+write_out_typelib (gchar *prefix,
+ GITypelib *typelib)
+{
+ FILE *file;
+ gsize written;
+ GFile *file_obj;
+ gchar *filename;
+ GFile *tmp_file_obj;
+ gchar *tmp_filename;
+ GError *error = NULL;
+ gboolean success = FALSE;
+
+ if (output == NULL)
+ {
+ file = stdout;
+ file_obj = NULL;
+ filename = NULL;
+ tmp_filename = NULL;
+ tmp_file_obj = NULL;
+#ifdef G_OS_WIN32
+ setmode (fileno (file), _O_BINARY);
+#endif
+ }
+ else
+ {
+ if (prefix)
+ filename = g_strdup_printf ("%s-%s", prefix, output);
+ else
+ filename = g_strdup (output);
+ file_obj = g_file_new_for_path (filename);
+ tmp_filename = g_strdup_printf ("%s.tmp", filename);
+ tmp_file_obj = g_file_new_for_path (tmp_filename);
+ file = g_fopen (tmp_filename, "wb");
+
+ if (file == NULL)
+ {
+ g_fprintf (stderr, "failed to open '%s': %s\n",
+ tmp_filename, g_strerror (errno));
+ goto out;
+ }
+ }
+
+ written = fwrite (typelib->data, 1, typelib->len, file);
+ if (written < typelib->len) {
+ g_fprintf (stderr, "ERROR: Could not write the whole output: %s",
+ strerror(errno));
+ goto out;
+ }
+
+ if (output != NULL)
+ fclose (file);
+ if (tmp_filename != NULL)
+ {
+ if (!g_file_move (tmp_file_obj, file_obj, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error))
+ {
+ g_fprintf (stderr, "ERROR: failed to rename %s to %s: %s", tmp_filename, filename, error->message);
+ g_clear_error (&error);
+ goto out;
+ }
+ }
+ success = TRUE;
+out:
+ g_clear_object (&file_obj);
+ g_clear_object (&tmp_file_obj);
+ g_free (filename);
+ g_free (tmp_filename);
+
+ return success;
+}
+
+GLogLevelFlags logged_levels;
+
+static void log_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data)
+{
+
+ if (log_level & logged_levels)
+ g_log_default_handler (log_domain, log_level, message, user_data);
+}
+
+static GOptionEntry options[] =
+{
+ { "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, "include directories in GIR search path", NULL },
+ { "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" },
+ { "module", 'm', 0, G_OPTION_ARG_STRING, &mname, "module to compile", "NAME" },
+ { "shared-library", 'l', 0, G_OPTION_ARG_FILENAME_ARRAY, &shlibs, "shared library", "FILE" },
+ { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, "show debug messages", NULL },
+ { "verbose", 0, 0, G_OPTION_ARG_NONE, &verbose, "show verbose messages", NULL },
+ { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, "show program's version number and exit", NULL },
+ { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input, NULL, NULL },
+ { NULL, }
+};
+
+int
+main (int argc, char ** argv)
+{
+ GOptionContext *context;
+ GError *error = NULL;
+ GIrParser *parser;
+ GIrModule *module;
+ gint i;
+ g_typelib_check_sanity ();
+
+ setlocale (LC_ALL, "");
+
+ context = g_option_context_new ("");
+ g_option_context_add_main_entries (context, options, NULL);
+ g_option_context_parse (context, &argc, &argv, &error);
+ g_option_context_free (context);
+
+ if (error)
+ {
+ g_fprintf (stderr, "error parsing arguments: %s\n", error->message);
+
+ g_error_free (error);
+
+ return 1;
+ }
+
+ logged_levels = G_LOG_LEVEL_MASK & ~(G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_DEBUG);
+ if (debug)
+ logged_levels = logged_levels | G_LOG_LEVEL_DEBUG;
+ if (verbose)
+ logged_levels = logged_levels | G_LOG_LEVEL_MESSAGE;
+ g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL);
+
+ g_log_set_default_handler (log_handler, NULL);
+
+ if (show_version)
+ {
+ g_printf ("g-ir-compiler %u.%u.%u\n",
+ GI_MAJOR_VERSION, GI_MINOR_VERSION, GI_MICRO_VERSION);
+ return 0;
+ }
+
+ if (!input)
+ {
+ g_fprintf (stderr, "no input files\n");
+
+ return 1;
+ }
+
+ g_debug ("[parsing] start, %d includes",
+ includedirs ? g_strv_length (includedirs) : 0);
+
+ if (includedirs != NULL)
+ for (i = 0; includedirs[i]; i++)
+ g_irepository_prepend_search_path (includedirs[i]);
+
+ parser = _g_ir_parser_new ();
+
+ _g_ir_parser_set_includes (parser, (const char*const*) includedirs);
+
+ module = _g_ir_parser_parse_file (parser, input[0], &error);
+ if (module == NULL)
+ {
+ g_fprintf (stderr, "error parsing file %s: %s\n",
+ input[0], error->message);
+
+ return 1;
+ }
+
+ g_debug ("[parsing] done");
+
+ g_debug ("[building] start");
+
+ {
+ GITypelib *typelib;
+
+ if (shlibs)
+ {
+ if (module->shared_library)
+ g_free (module->shared_library);
+ module->shared_library = g_strjoinv (",", shlibs);
+ }
+
+ g_debug ("[building] module %s", module->name);
+
+ typelib = _g_ir_module_build_typelib (module);
+ if (typelib == NULL)
+ g_error ("Failed to build typelib for module '%s'\n", module->name);
+ if (!g_typelib_validate (typelib, &error))
+ g_error ("Invalid typelib for module '%s': %s",
+ module->name, error->message);
+
+ if (!write_out_typelib (NULL, typelib))
+ return 1;
+ g_typelib_free (typelib);
+ typelib = NULL;
+ }
+
+ g_debug ("[building] done");
+
+#if 0
+ /* No point */
+ _g_ir_parser_free (parser);
+#endif
+
+ return 0;
+}
/* {{{1 Documentation */
/**
- * GThreadPriority:
+ * GThreadPriority: (skip):
* @G_THREAD_PRIORITY_LOW: a priority lower than normal
* @G_THREAD_PRIORITY_NORMAL: the default priority
* @G_THREAD_PRIORITY_HIGH: a priority higher than normal
*/
/**
- * GThreadFunctions:
+ * GThreadFunctions: (skip):
* @mutex_new: virtual function pointer for g_mutex_new()
* @mutex_lock: virtual function pointer for g_mutex_lock()
* @mutex_trylock: virtual function pointer for g_mutex_trylock()
*/
/**
- * G_THREADS_IMPL_POSIX:
+ * G_THREADS_IMPL_POSIX: (skip):
*
* This macro is defined if POSIX style threads are used.
*
*/
/**
- * G_THREADS_IMPL_WIN32:
+ * G_THREADS_IMPL_WIN32: (skip):
*
* This macro is defined if Windows style threads are used.
*
gboolean g_threads_got_initialized = TRUE;
/**
- * g_thread_init:
+ * g_thread_init: (skip):
* @vtable: a function table of type #GThreadFunctions, that provides
* the entry points to the thread system to be used. Since 2.32,
* this parameter is ignored and should always be %NULL
*/
/**
- * g_thread_get_initialized:
+ * g_thread_init_with_errorcheck_mutexes: (skip):
+ */
+
+/**
+ * g_thread_get_initialized: (skip):
*
* Indicates if g_thread_init() has been called.
*
/* Misc. GThread functions {{{1 */
/**
- * g_thread_set_priority:
+ * g_thread_set_priority: (skip):
* @thread: a #GThread.
* @priority: ignored
*
}
/**
- * g_thread_foreach:
+ * g_thread_foreach: (skip):
* @thread_func: (scope call): function to call for all #GThread structures
* @user_data: second argument to @thread_func
*
}
/**
- * g_thread_create:
+ * g_thread_create: (skip):
* @func: a function to execute in the new thread
* @data: an argument to supply to the new thread
* @joinable: should this thread be joinable?
}
/**
- * g_thread_create_full:
+ * g_thread_create_full: (skip):
* @func: a function to execute in the new thread.
* @data: an argument to supply to the new thread.
* @stack_size: a stack size for the new thread.
/* GStaticMutex {{{1 ------------------------------------------------------ */
/**
- * GStaticMutex:
+ * GStaticMutex: (skip):
*
* A #GStaticMutex works like a #GMutex.
*
*/
/**
- * G_STATIC_MUTEX_INIT:
+ * G_STATIC_MUTEX_INIT: (skip):
*
* A #GStaticMutex must be initialized with this macro, before it can
* be used. This macro can used be to initialize a variable, but it
**/
/**
- * g_static_mutex_init:
+ * g_static_mutex_init: (skip):
* @mutex: a #GStaticMutex to be initialized.
*
* Initializes @mutex.
*/
/**
- * g_static_mutex_get_mutex:
+ * g_static_mutex_get_mutex: (skip):
* @mutex: a #GStaticMutex.
*
* For some operations (like g_cond_wait()) you must have a #GMutex
*/
/**
- * g_static_mutex_lock:
+ * g_static_mutex_lock: (skip):
* @mutex: a #GStaticMutex.
*
* Works like g_mutex_lock(), but for a #GStaticMutex.
*/
/**
- * g_static_mutex_trylock:
+ * g_static_mutex_trylock: (skip):
* @mutex: a #GStaticMutex.
*
* Works like g_mutex_trylock(), but for a #GStaticMutex.
*/
/**
- * g_static_mutex_unlock:
+ * g_static_mutex_unlock: (skip):
* @mutex: a #GStaticMutex.
*
* Works like g_mutex_unlock(), but for a #GStaticMutex.
*/
/**
- * g_static_mutex_free:
+ * g_static_mutex_free: (skip):
* @mutex: a #GStaticMutex to be freed.
*
* Releases all resources allocated to @mutex.
/* {{{1 GStaticRecMutex */
/**
- * GStaticRecMutex:
+ * GStaticRecMutex: (skip):
*
* A #GStaticRecMutex works like a #GStaticMutex, but it can be locked
* multiple times by one thread. If you enter it n times, you have to
*/
/**
- * G_STATIC_REC_MUTEX_INIT:
+ * G_STATIC_REC_MUTEX_INIT: (skip):
*
* A #GStaticRecMutex must be initialized with this macro before it can
* be used. This macro can used be to initialize a variable, but it
*/
/**
- * g_static_rec_mutex_init:
+ * g_static_rec_mutex_init: (skip):
* @mutex: a #GStaticRecMutex to be initialized.
*
* A #GStaticRecMutex must be initialized with this function before it
}
/**
- * g_static_rec_mutex_lock:
+ * g_static_rec_mutex_lock: (skip):
* @mutex: a #GStaticRecMutex to lock.
*
* Locks @mutex. If @mutex is already locked by another thread, the
}
/**
- * g_static_rec_mutex_trylock:
+ * g_static_rec_mutex_trylock: (skip):
* @mutex: a #GStaticRecMutex to lock.
*
* Tries to lock @mutex. If @mutex is already locked by another thread,
}
/**
- * g_static_rec_mutex_unlock:
+ * g_static_rec_mutex_unlock: (skip):
* @mutex: a #GStaticRecMutex to unlock.
*
* Unlocks @mutex. Another thread will be allowed to lock @mutex only
}
/**
- * g_static_rec_mutex_lock_full:
+ * g_static_rec_mutex_lock_full: (skip):
* @mutex: a #GStaticRecMutex to lock.
* @depth: number of times this mutex has to be unlocked to be
* completely unlocked.
}
/**
- * g_static_rec_mutex_unlock_full:
+ * g_static_rec_mutex_unlock_full: (skip):
* @mutex: a #GStaticRecMutex to completely unlock.
*
* Completely unlocks @mutex. If another thread is blocked in a
}
/**
- * g_static_rec_mutex_free:
+ * g_static_rec_mutex_free: (skip):
* @mutex: a #GStaticRecMutex to be freed.
*
* Releases all resources allocated to a #GStaticRecMutex.
/* GStaticRWLock {{{1 ----------------------------------------------------- */
/**
- * GStaticRWLock:
+ * GStaticRWLock: (skip):
*
* The #GStaticRWLock struct represents a read-write lock. A read-write
* lock can be used for protecting data that some portions of code only
**/
/**
- * G_STATIC_RW_LOCK_INIT:
+ * G_STATIC_RW_LOCK_INIT: (skip):
*
* A #GStaticRWLock must be initialized with this macro before it can
* be used. This macro can used be to initialize a variable, but it
*/
/**
- * g_static_rw_lock_init:
+ * g_static_rw_lock_init: (skip):
* @lock: a #GStaticRWLock to be initialized.
*
* A #GStaticRWLock must be initialized with this function before it
}
/**
- * g_static_rw_lock_reader_lock:
+ * g_static_rw_lock_reader_lock: (skip):
* @lock: a #GStaticRWLock to lock for reading.
*
* Locks @lock for reading. There may be unlimited concurrent locks for
}
/**
- * g_static_rw_lock_reader_trylock:
+ * g_static_rw_lock_reader_trylock: (skip):
* @lock: a #GStaticRWLock to lock for reading
*
* Tries to lock @lock for reading. If @lock is already locked for
}
/**
- * g_static_rw_lock_reader_unlock:
+ * g_static_rw_lock_reader_unlock: (skip):
* @lock: a #GStaticRWLock to unlock after reading
*
* Unlocks @lock. If a thread waits to lock @lock for writing and all
}
/**
- * g_static_rw_lock_writer_lock:
+ * g_static_rw_lock_writer_lock: (skip):
* @lock: a #GStaticRWLock to lock for writing
*
* Locks @lock for writing. If @lock is already locked for writing or
}
/**
- * g_static_rw_lock_writer_trylock:
+ * g_static_rw_lock_writer_trylock: (skip):
* @lock: a #GStaticRWLock to lock for writing
*
* Tries to lock @lock for writing. If @lock is already locked (for
}
/**
- * g_static_rw_lock_writer_unlock:
+ * g_static_rw_lock_writer_unlock: (skip):
* @lock: a #GStaticRWLock to unlock after writing.
*
* Unlocks @lock. If a thread is waiting to lock @lock for writing and
}
/**
- * g_static_rw_lock_free:
+ * g_static_rw_lock_free: (skip):
* @lock: a #GStaticRWLock to be freed.
*
* Releases all resources allocated to @lock.
/* GPrivate {{{1 ------------------------------------------------------ */
/**
- * g_private_new:
+ * g_private_new: (skip):
* @notify: a #GDestroyNotify
*
* Creates a new #GPrivate.
GPrivate static_private_private = G_PRIVATE_INIT (g_static_private_cleanup);
/**
- * GStaticPrivate:
+ * GStaticPrivate: (skip):
*
* A #GStaticPrivate works almost like a #GPrivate, but it has one
* significant advantage. It doesn't need to be created at run-time
*/
/**
- * G_STATIC_PRIVATE_INIT:
+ * G_STATIC_PRIVATE_INIT: (skip):
*
* Every #GStaticPrivate must be initialized with this macro, before it
* can be used.
*/
/**
- * g_static_private_init:
+ * g_static_private_init: (skip):
* @private_key: a #GStaticPrivate to be initialized
*
* Initializes @private_key. Alternatively you can initialize it with
}
/**
- * g_static_private_get:
+ * g_static_private_get: (skip):
* @private_key: a #GStaticPrivate
*
* Works like g_private_get() only for a #GStaticPrivate.
}
/**
- * g_static_private_set:
+ * g_static_private_set: (skip):
* @private_key: a #GStaticPrivate
* @data: the new pointer
* @notify: a function to be called with the pointer whenever the
}
/**
- * g_static_private_free:
+ * g_static_private_free: (skip):
* @private_key: a #GStaticPrivate to be freed
*
* Releases all resources allocated to @private_key.
/* GMutex {{{1 ------------------------------------------------------ */
/**
- * g_mutex_new:
+ * g_mutex_new: (skip):
*
* Allocates and initializes a new #GMutex.
*
}
/**
- * g_mutex_free:
+ * g_mutex_free: (skip):
* @mutex: a #GMutex
*
* Destroys a @mutex that has been created with g_mutex_new().
/* GCond {{{1 ------------------------------------------------------ */
/**
- * g_cond_new:
+ * g_cond_new: (skip):
*
* Allocates and initializes a new #GCond.
*
}
/**
- * g_cond_free:
+ * g_cond_free: (skip):
* @cond: a #GCond
*
* Destroys a #GCond that has been created with g_cond_new().
}
/**
- * g_cond_timed_wait:
+ * g_cond_timed_wait: (skip):
* @cond: a #GCond
* @mutex: a #GMutex that is currently locked
* @abs_time: a #GTimeVal, determining the final time
typedef struct
{
GMutex *mutex;
-#ifndef G_OS_WIN32
+#ifndef __GI_SCANNER__
+# ifndef G_OS_WIN32
/* only for ABI compatibility reasons */
pthread_mutex_t unused;
-#endif
+# endif /* !G_OS_WIN32 */
+#endif /* !__GI_SCANNER__ */
} GStaticMutex GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GMutex);
#define g_static_mutex_lock(mutex) \
GStaticMutex mutex;
guint depth;
+#ifndef __GI_SCANNER__
/* ABI compat only */
union {
-#ifdef G_OS_WIN32
+# ifdef G_OS_WIN32
void *owner;
-#else
+# else
pthread_t owner;
-#endif
+# endif /* !G_OS_WIN32 */
gdouble dummy;
} unused;
+#endif /* !__GI_SCANNER__ */
} GLIB_DEPRECATED_TYPE_IN_2_32_FOR(GRecMutex);
#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT, 0, { 0 } } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_rec_mutex_init)
* The only types that can store pointers as well as integers are #guintptr
* and #gintptr.
*
- * See also GPOINTER_TO_TYPE() for #gsize.
+ * See also GPOINTER_TO_TYPE() for #GType.
*/
/* Byte order {{{1 */
#define CONTENTION_CLASSES 11
static gint g_bit_lock_contended[CONTENTION_CLASSES]; /* (atomic) */
+G_ALWAYS_INLINE static inline guint
+bit_lock_contended_class (gpointer address)
+{
+ return ((gsize) address) % G_N_ELEMENTS (g_bit_lock_contended);
+}
+
#if (defined (i386) || defined (__amd64__))
#if G_GNUC_CHECK_VERSION(4, 5)
#define USE_ASM_GOTO 1
v = (guint) g_atomic_int_get (address_nonvolatile);
if (v & mask)
{
- guint class = ((gsize) address_nonvolatile) % G_N_ELEMENTS (g_bit_lock_contended);
+ guint class = bit_lock_contended_class (address_nonvolatile);
g_atomic_int_add (&g_bit_lock_contended[class], +1);
g_futex_wait (address_nonvolatile, v);
if (v & mask)
/* already locked */
{
- guint class = ((gsize) address_nonvolatile) % G_N_ELEMENTS (g_bit_lock_contended);
+ guint class = bit_lock_contended_class (address_nonvolatile);
g_atomic_int_add (&g_bit_lock_contended[class], +1);
g_futex_wait (address_nonvolatile, v);
#endif
{
- guint class = ((gsize) address_nonvolatile) % G_N_ELEMENTS (g_bit_lock_contended);
+ guint class = bit_lock_contended_class (address_nonvolatile);
if (g_atomic_int_get (&g_bit_lock_contended[class]))
g_futex_wake (address_nonvolatile);
return int_address;
}
+G_ALWAYS_INLINE static inline gpointer
+pointer_bit_lock_mask_ptr (gpointer ptr, guint lock_bit, gboolean set, guintptr preserve_mask, gpointer preserve_ptr)
+{
+ guintptr x_ptr;
+ guintptr x_preserve_ptr;
+ guintptr lock_mask;
+
+ x_ptr = (guintptr) ptr;
+
+ if (preserve_mask != 0)
+ {
+ x_preserve_ptr = (guintptr) preserve_ptr;
+ x_ptr = (x_preserve_ptr & preserve_mask) | (x_ptr & ~preserve_mask);
+ }
+
+ if (lock_bit == G_MAXUINT)
+ return (gpointer) x_ptr;
+
+ lock_mask = (guintptr) (1u << lock_bit);
+ if (set)
+ return (gpointer) (x_ptr | lock_mask);
+ else
+ return (gpointer) (x_ptr & ~lock_mask);
+}
+
/**
- * g_pointer_bit_lock:
+ * g_pointer_bit_lock_and_get:
* @address: (not nullable): a pointer to a #gpointer-sized value
* @lock_bit: a bit value between 0 and 31
+ * @out_ptr: (out) (optional): returns the set pointer atomically.
+ * This is the value after setting the lock, it thus always has the
+ * lock bit set, while previously @address had the lockbit unset.
+ * You may also use g_pointer_bit_lock_mask_ptr() to clear the lock bit.
*
* This is equivalent to g_bit_lock, but working on pointers (or other
* pointer-sized values).
* For portability reasons, you may only lock on the bottom 32 bits of
* the pointer.
*
- * While @address has a `volatile` qualifier, this is a historical
- * artifact and the argument passed to it should not be `volatile`.
- *
- * Since: 2.30
+ * Since: 2.80
**/
void
-(g_pointer_bit_lock) (volatile void *address,
- gint lock_bit)
+(g_pointer_bit_lock_and_get) (gpointer address,
+ guint lock_bit,
+ guintptr *out_ptr)
{
- void *address_nonvolatile = (void *) address;
+ guint class = bit_lock_contended_class (address);
+ guintptr mask;
+ guintptr v;
g_return_if_fail (lock_bit < 32);
- {
-#ifdef USE_ASM_GOTO
- retry:
- __asm__ volatile goto ("lock bts %1, (%0)\n"
- "jc %l[contended]"
- : /* no output */
- : "r" (address), "r" ((gsize) lock_bit)
- : "cc", "memory"
- : contended);
- return;
+ mask = 1u << lock_bit;
- contended:
+#ifdef USE_ASM_GOTO
+ if (G_LIKELY (!out_ptr))
{
- gpointer *pointer_address = address_nonvolatile;
- gsize mask = 1u << lock_bit;
- gsize v;
-
- v = (gsize) g_atomic_pointer_get (pointer_address);
- if (v & mask)
+ while (TRUE)
{
- guint class = ((gsize) address_nonvolatile) % G_N_ELEMENTS (g_bit_lock_contended);
-
- g_atomic_int_add (&g_bit_lock_contended[class], +1);
- g_futex_wait (g_futex_int_address (address_nonvolatile), v);
- g_atomic_int_add (&g_bit_lock_contended[class], -1);
+ __asm__ volatile goto ("lock bts %1, (%0)\n"
+ "jc %l[contended]"
+ : /* no output */
+ : "r"(address), "r"((gsize) lock_bit)
+ : "cc", "memory"
+ : contended);
+ return;
+
+ contended:
+ v = (guintptr) g_atomic_pointer_get ((gpointer *) address);
+ if (v & mask)
+ {
+ g_atomic_int_add (&g_bit_lock_contended[class], +1);
+ g_futex_wait (g_futex_int_address (address), v);
+ g_atomic_int_add (&g_bit_lock_contended[class], -1);
+ }
}
}
- goto retry;
-#else
- gpointer *pointer_address = address_nonvolatile;
- gsize mask = 1u << lock_bit;
- guintptr v;
+#endif
- retry:
- v = g_atomic_pointer_or (pointer_address, mask);
+retry:
+ v = g_atomic_pointer_or ((gpointer *) address, mask);
if (v & mask)
/* already locked */
{
- guint class = ((gsize) address_nonvolatile) % G_N_ELEMENTS (g_bit_lock_contended);
-
g_atomic_int_add (&g_bit_lock_contended[class], +1);
- g_futex_wait (g_futex_int_address (address_nonvolatile), (guint) v);
+ g_futex_wait (g_futex_int_address (address), (guint) v);
g_atomic_int_add (&g_bit_lock_contended[class], -1);
-
goto retry;
}
-#endif
- }
+
+ if (out_ptr)
+ *out_ptr = (v | mask);
+}
+
+/**
+ * g_pointer_bit_lock:
+ * @address: (not nullable): a pointer to a #gpointer-sized value
+ * @lock_bit: a bit value between 0 and 31
+ *
+ * This is equivalent to g_bit_lock, but working on pointers (or other
+ * pointer-sized values).
+ *
+ * For portability reasons, you may only lock on the bottom 32 bits of
+ * the pointer.
+ *
+ * While @address has a `volatile` qualifier, this is a historical
+ * artifact and the argument passed to it should not be `volatile`.
+ *
+ * Since: 2.30
+ **/
+void
+(g_pointer_bit_lock) (volatile void *address,
+ gint lock_bit)
+{
+ g_pointer_bit_lock_and_get ((gpointer *) address, (guint) lock_bit, NULL);
}
/**
#endif
{
- guint class = ((gsize) address_nonvolatile) % G_N_ELEMENTS (g_bit_lock_contended);
+ guint class = bit_lock_contended_class (address_nonvolatile);
+
if (g_atomic_int_get (&g_bit_lock_contended[class]))
g_futex_wake (g_futex_int_address (address_nonvolatile));
}
}
}
+
+/**
+ * g_pointer_bit_lock_mask_ptr:
+ * @ptr: (nullable): the pointer to mask
+ * @lock_bit: the bit to set/clear. If set to `G_MAXUINT`, the
+ * lockbit is taken from @preserve_ptr or @ptr (depending on @preserve_mask).
+ * @set: whether to set (lock) the bit or unset (unlock). This
+ * has no effect, if @lock_bit is set to `G_MAXUINT`.
+ * @preserve_mask: if non-zero, a bit-mask for @preserve_ptr. The
+ * @preserve_mask bits from @preserve_ptr are set in the result.
+ * Note that the @lock_bit bit will be always set according to @set,
+ * regardless of @preserve_mask and @preserve_ptr (unless @lock_bit is
+ * `G_MAXUINT`).
+ * @preserve_ptr: (nullable): if @preserve_mask is non-zero, the bits
+ * from this pointer are set in the result.
+ *
+ * This mangles @ptr as g_pointer_bit_lock() and g_pointer_bit_unlock()
+ * do.
+ *
+ * Returns: the mangled pointer.
+ *
+ * Since: 2.80
+ **/
+gpointer
+g_pointer_bit_lock_mask_ptr (gpointer ptr, guint lock_bit, gboolean set, guintptr preserve_mask, gpointer preserve_ptr)
+{
+ g_return_val_if_fail (lock_bit < 32u || lock_bit == G_MAXUINT, ptr);
+
+ return pointer_bit_lock_mask_ptr (ptr, lock_bit, set, preserve_mask, preserve_ptr);
+}
+
+/**
+ * g_pointer_bit_unlock_and_set:
+ * @address: (not nullable): a pointer to a #gpointer-sized value
+ * @lock_bit: a bit value between 0 and 31
+ * @ptr: the new pointer value to set
+ * @preserve_mask: if non-zero, those bits of the current pointer in @address
+ * are preserved.
+ * Note that the @lock_bit bit will be always set according to @set,
+ * regardless of @preserve_mask and the currently set value in @address.
+ *
+ * This is equivalent to g_pointer_bit_unlock() and atomically setting
+ * the pointer value.
+ *
+ * Note that the lock bit will be cleared from the pointer. If the unlocked
+ * pointer that was set is not identical to @ptr, an assertion fails. In other
+ * words, @ptr must have @lock_bit unset. This also means, you usually can
+ * only use this on the lowest bits.
+ *
+ * Since: 2.80
+ **/
+void (g_pointer_bit_unlock_and_set) (void *address,
+ guint lock_bit,
+ gpointer ptr,
+ guintptr preserve_mask)
+{
+ gpointer *pointer_address = address;
+ guint class = bit_lock_contended_class (address);
+ gpointer ptr2;
+
+ g_return_if_fail (lock_bit < 32u);
+
+ if (preserve_mask != 0)
+ {
+ gpointer old_ptr = g_atomic_pointer_get ((gpointer *) address);
+
+ again:
+ ptr2 = pointer_bit_lock_mask_ptr (ptr, lock_bit, FALSE, preserve_mask, old_ptr);
+ if (!g_atomic_pointer_compare_and_exchange_full (pointer_address, old_ptr, ptr2, &old_ptr))
+ goto again;
+ }
+ else
+ {
+ ptr2 = pointer_bit_lock_mask_ptr (ptr, lock_bit, FALSE, 0, NULL);
+ g_atomic_pointer_set (pointer_address, ptr2);
+ }
+
+ if (g_atomic_int_get (&g_bit_lock_contended[class]) > 0)
+ g_futex_wake (g_futex_int_address (address));
+
+ /* It makes no sense, if unlocking mangles the pointer. Assert against
+ * that.
+ *
+ * Note that based on @preserve_mask, the pointer also gets mangled, which
+ * can make sense for the caller. We don't assert for that. */
+ g_return_if_fail (ptr == pointer_bit_lock_mask_ptr (ptr, lock_bit, FALSE, 0, NULL));
+}
GLIB_AVAILABLE_IN_ALL
void g_pointer_bit_lock (volatile void *address,
gint lock_bit);
+
+GLIB_AVAILABLE_IN_2_80
+void g_pointer_bit_lock_and_get (gpointer address,
+ guint lock_bit,
+ guintptr *out_ptr);
+
GLIB_AVAILABLE_IN_ALL
gboolean g_pointer_bit_trylock (volatile void *address,
gint lock_bit);
void g_pointer_bit_unlock (volatile void *address,
gint lock_bit);
+GLIB_AVAILABLE_IN_2_80
+gpointer g_pointer_bit_lock_mask_ptr (gpointer ptr,
+ guint lock_bit,
+ gboolean set,
+ guintptr preserve_mask,
+ gpointer preserve_ptr);
+
+GLIB_AVAILABLE_IN_2_80
+void g_pointer_bit_unlock_and_set (void *address,
+ guint lock_bit,
+ gpointer ptr,
+ guintptr preserve_mask);
+
#ifdef __GNUC__
#define g_pointer_bit_lock(address, lock_bit) \
g_pointer_bit_lock ((address), (lock_bit)); \
}))
+#define g_pointer_bit_lock_and_get(address, lock_bit, out_ptr) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
+ g_pointer_bit_lock_and_get ((address), (lock_bit), (out_ptr)); \
+ }))
+
#define g_pointer_bit_trylock(address, lock_bit) \
(G_GNUC_EXTENSION ({ \
G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
g_pointer_bit_unlock ((address), (lock_bit)); \
}))
+#define g_pointer_bit_unlock_and_set(address, lock_bit, ptr, preserve_mask) \
+ (G_GNUC_EXTENSION ({ \
+ G_STATIC_ASSERT (sizeof *(address) == sizeof (gpointer)); \
+ g_pointer_bit_unlock_and_set ((address), (lock_bit), (ptr), (preserve_mask)); \
+ }))
+
#endif
G_END_DECLS
#define G_DATALIST_FLAGS_MASK_INTERNAL 0x7
+#define G_DATALIST_CLEAN_POINTER(ptr) \
+ ((GData *) ((gpointer) (((guintptr) (ptr)) & ~((guintptr) G_DATALIST_FLAGS_MASK_INTERNAL))))
+
/* datalist pointer accesses have to be carried out atomically */
-#define G_DATALIST_GET_POINTER(datalist) \
- ((GData*) ((guintptr) g_atomic_pointer_get (datalist) & ~(gsize) G_DATALIST_FLAGS_MASK_INTERNAL))
+#define G_DATALIST_GET_POINTER(datalist) \
+ G_DATALIST_CLEAN_POINTER (g_atomic_pointer_get (datalist))
#define G_DATALIST_SET_POINTER(datalist, pointer) G_STMT_START { \
gpointer _oldv = g_atomic_pointer_get (datalist); \
gpointer _newv; \
do { \
- _newv = (gpointer) (((gsize) _oldv & G_DATALIST_FLAGS_MASK_INTERNAL) | (guintptr) pointer); \
+ _newv = (gpointer) (((guintptr) _oldv & ((guintptr) G_DATALIST_FLAGS_MASK_INTERNAL)) | (guintptr) pointer); \
} while (!g_atomic_pointer_compare_and_exchange_full ((void**) datalist, _oldv, \
_newv, &_oldv)); \
} G_STMT_END
/* --- prototypes --- */
static inline GDataset* g_dataset_lookup (gconstpointer dataset_location);
-static inline void g_datalist_clear_i (GData **datalist);
static void g_dataset_destroy_internal (GDataset *dataset);
static inline gpointer g_data_set_internal (GData **datalist,
GQuark key_id,
#define DATALIST_LOCK_BIT 2
-static void
-g_datalist_lock (GData **datalist)
+G_ALWAYS_INLINE static inline GData *
+g_datalist_lock_and_get (GData **datalist)
{
- g_pointer_bit_lock ((void **)datalist, DATALIST_LOCK_BIT);
+ guintptr ptr;
+
+ g_pointer_bit_lock_and_get ((void **) datalist, DATALIST_LOCK_BIT, &ptr);
+ return G_DATALIST_CLEAN_POINTER (ptr);
}
static void
g_pointer_bit_unlock ((void **)datalist, DATALIST_LOCK_BIT);
}
-/* Called with the datalist lock held, or the dataset global
- * lock for dataset lists
- */
static void
-g_datalist_clear_i (GData **datalist)
+g_datalist_unlock_and_set (GData **datalist, gpointer ptr)
{
- GData *data;
- guint i;
+ g_pointer_bit_unlock_and_set ((void **) datalist, DATALIST_LOCK_BIT, ptr, G_DATALIST_FLAGS_MASK_INTERNAL);
+}
+
+static gboolean
+datalist_append (GData **data, GQuark key_id, gpointer new_data, GDestroyNotify destroy_func)
+{
+ gboolean reallocated;
+ GData *d;
+
+ d = *data;
- data = G_DATALIST_GET_POINTER (datalist);
- G_DATALIST_SET_POINTER (datalist, NULL);
+ if (!d)
+ {
+ d = g_malloc (sizeof (GData));
+ d->len = 0;
+ d->alloc = 1;
+ *data = d;
+ reallocated = TRUE;
+ }
+ else if (d->len == d->alloc)
+ {
+ d->alloc = d->alloc * 2u;
+ d = g_realloc (d, G_STRUCT_OFFSET (GData, data) + d->alloc * sizeof (GDataElt));
+ *data = d;
+ reallocated = TRUE;
+ }
+ else
+ reallocated = FALSE;
+
+ d->data[d->len] = (GDataElt){
+ .key = key_id,
+ .data = new_data,
+ .destroy = destroy_func,
+ };
+ d->len++;
+
+ return reallocated;
+}
+
+static GDataElt *
+datalist_find (GData *data, GQuark key_id, guint32 *out_idx)
+{
+ guint32 i;
if (data)
{
- G_UNLOCK (g_dataset_global);
for (i = 0; i < data->len; i++)
{
- if (data->data[i].data && data->data[i].destroy)
- data->data[i].destroy (data->data[i].data);
- }
- G_LOCK (g_dataset_global);
+ GDataElt *data_elt = &data->data[i];
- g_free (data);
+ if (data_elt->key == key_id)
+ {
+ if (out_idx)
+ *out_idx = i;
+ return data_elt;
+ }
+ }
}
-
+ if (out_idx)
+ *out_idx = G_MAXUINT32;
+ return NULL;
}
/**
g_return_if_fail (datalist != NULL);
- g_datalist_lock (datalist);
-
- data = G_DATALIST_GET_POINTER (datalist);
- G_DATALIST_SET_POINTER (datalist, NULL);
-
- g_datalist_unlock (datalist);
+ data = g_datalist_lock_and_get (datalist);
+ g_datalist_unlock_and_set (datalist, NULL);
if (data)
{
dataset_location = dataset->location;
while (dataset)
{
- if (G_DATALIST_GET_POINTER(&dataset->datalist) == NULL)
+ GData *data;
+ guint i;
+
+ data = G_DATALIST_GET_POINTER (&dataset->datalist);
+
+ if (!data)
{
if (dataset == g_dataset_cached)
g_dataset_cached = NULL;
g_slice_free (GDataset, dataset);
break;
}
-
- g_datalist_clear_i (&dataset->datalist);
+
+ G_DATALIST_SET_POINTER (&dataset->datalist, NULL);
+
+ G_UNLOCK (g_dataset_global);
+
+ for (i = 0; i < data->len; i++)
+ {
+ if (data->data[i].data && data->data[i].destroy)
+ data->data[i].destroy (data->data[i].data);
+ }
+ g_free (data);
+
+ G_LOCK (g_dataset_global);
dataset = g_dataset_lookup (dataset_location);
}
}
GDestroyNotify new_destroy_func,
GDataset *dataset)
{
- GData *d, *old_d;
- GDataElt old, *data, *data_last, *data_end;
+ GData *d;
+ GData *new_d = NULL;
+ GDataElt old, *data;
+ guint32 idx;
- g_datalist_lock (datalist);
+ d = g_datalist_lock_and_get (datalist);
- d = G_DATALIST_GET_POINTER (datalist);
+ data = datalist_find (d, key_id, &idx);
if (new_data == NULL) /* remove */
{
- if (d)
- {
- data = d->data;
- data_last = data + d->len - 1;
- while (data <= data_last)
- {
- if (data->key == key_id)
- {
- old = *data;
- if (data != data_last)
- *data = *data_last;
- d->len--;
-
- /* We don't bother to shrink, but if all data are now gone
- * we at least free the memory
- */
- if (d->len == 0)
- {
- G_DATALIST_SET_POINTER (datalist, NULL);
- g_free (d);
- /* datalist may be situated in dataset, so must not be
- * unlocked after we free it
- */
- g_datalist_unlock (datalist);
-
- /* the dataset destruction *must* be done
- * prior to invocation of the data destroy function
- */
- if (dataset)
- g_dataset_destroy_internal (dataset);
- }
- else
- {
- g_datalist_unlock (datalist);
- }
-
- /* We found and removed an old value
- * the GData struct *must* already be unlinked
- * when invoking the destroy function.
- * we use (new_data==NULL && new_destroy_func!=NULL) as
- * a special hint combination to "steal"
- * data without destroy notification
- */
- if (old.destroy && !new_destroy_func)
- {
- if (dataset)
- G_UNLOCK (g_dataset_global);
- old.destroy (old.data);
- if (dataset)
- G_LOCK (g_dataset_global);
- old.data = NULL;
- }
-
- return old.data;
- }
- data++;
- }
- }
+ if (data)
+ {
+ old = *data;
+ if (idx != d->len - 1u)
+ *data = d->data[d->len - 1u];
+ d->len--;
+
+ /* We don't bother to shrink, but if all data are now gone
+ * we at least free the memory
+ */
+ if (d->len == 0)
+ {
+ /* datalist may be situated in dataset, so must not be
+ * unlocked when we free it
+ */
+ g_datalist_unlock_and_set (datalist, NULL);
+
+ g_free (d);
+
+ /* the dataset destruction *must* be done
+ * prior to invocation of the data destroy function
+ */
+ if (dataset)
+ g_dataset_destroy_internal (dataset);
+ }
+ else
+ {
+ g_datalist_unlock (datalist);
+ }
+
+ /* We found and removed an old value
+ * the GData struct *must* already be unlinked
+ * when invoking the destroy function.
+ * we use (new_data==NULL && new_destroy_func!=NULL) as
+ * a special hint combination to "steal"
+ * data without destroy notification
+ */
+ if (old.destroy && !new_destroy_func)
+ {
+ if (dataset)
+ G_UNLOCK (g_dataset_global);
+ old.destroy (old.data);
+ if (dataset)
+ G_LOCK (g_dataset_global);
+ old.data = NULL;
+ }
+
+ return old.data;
+ }
}
else
{
- old.data = NULL;
- if (d)
- {
- data = d->data;
- data_end = data + d->len;
- while (data < data_end)
- {
- if (data->key == key_id)
- {
- if (!data->destroy)
- {
- data->data = new_data;
- data->destroy = new_destroy_func;
- g_datalist_unlock (datalist);
- }
- else
- {
- old = *data;
- data->data = new_data;
- data->destroy = new_destroy_func;
-
- g_datalist_unlock (datalist);
-
- /* We found and replaced an old value
- * the GData struct *must* already be unlinked
- * when invoking the destroy function.
- */
- if (dataset)
- G_UNLOCK (g_dataset_global);
- old.destroy (old.data);
- if (dataset)
- G_LOCK (g_dataset_global);
- }
- return NULL;
- }
- data++;
- }
- }
+ if (data)
+ {
+ if (!data->destroy)
+ {
+ data->data = new_data;
+ data->destroy = new_destroy_func;
+ g_datalist_unlock (datalist);
+ }
+ else
+ {
+ old = *data;
+ data->data = new_data;
+ data->destroy = new_destroy_func;
- /* The key was not found, insert it */
- old_d = d;
- if (d == NULL)
- {
- d = g_malloc (sizeof (GData));
- d->len = 0;
- d->alloc = 1;
- }
- else if (d->len == d->alloc)
- {
- d->alloc = d->alloc * 2;
- d = g_realloc (d, sizeof (GData) + (d->alloc - 1) * sizeof (GDataElt));
- }
- if (old_d != d)
- G_DATALIST_SET_POINTER (datalist, d);
+ g_datalist_unlock (datalist);
+
+ /* We found and replaced an old value
+ * the GData struct *must* already be unlinked
+ * when invoking the destroy function.
+ */
+ if (dataset)
+ G_UNLOCK (g_dataset_global);
+ old.destroy (old.data);
+ if (dataset)
+ G_LOCK (g_dataset_global);
+ }
+ return NULL;
+ }
- d->data[d->len].key = key_id;
- d->data[d->len].data = new_data;
- d->data[d->len].destroy = new_destroy_func;
- d->len++;
+ /* The key was not found, insert it */
+ if (datalist_append (&d, key_id, new_data, new_destroy_func))
+ new_d = d;
}
- g_datalist_unlock (datalist);
+ if (new_d)
+ g_datalist_unlock_and_set (datalist, new_d);
+ else
+ g_datalist_unlock (datalist);
return NULL;
gsize n_keys)
{
GData *d;
+ GDataElt *old;
+ GDataElt *old_to_free = NULL;
+ GDataElt *data;
+ GDataElt *data_end;
+ gsize found_keys;
+ gboolean free_d = FALSE;
- g_datalist_lock (datalist);
+ d = g_datalist_lock_and_get (datalist);
- d = G_DATALIST_GET_POINTER (datalist);
+ if (!d)
+ {
+ g_datalist_unlock (datalist);
+ return;
+ }
- if (d)
+ /* Allocate an array of GDataElt to hold copies of the elements
+ * that are removed from the datalist. Allow enough space for all
+ * the keys; if a key is not found, the corresponding element of
+ * old is not populated, so we initialize them all to NULL to
+ * detect that case.
+ *
+ * At most allocate 400 bytes on the stack. Especially since we call
+ * out to external code, we don't know how much stack we can use. */
+ if (n_keys <= 400u / sizeof (GDataElt))
+ old = g_newa0 (GDataElt, n_keys);
+ else
{
- GDataElt *old, *data, *data_end;
- gsize found_keys;
+ old_to_free = g_new0 (GDataElt, n_keys);
+ old = old_to_free;
+ }
- /* Allocate an array of GDataElt to hold copies of the elements
- * that are removed from the datalist. Allow enough space for all
- * the keys; if a key is not found, the corresponding element of
- * old is not populated, so we initialize them all to NULL to
- * detect that case. */
- old = g_newa0 (GDataElt, n_keys);
+ data = d->data;
+ data_end = data + d->len;
+ found_keys = 0;
- data = d->data;
- data_end = data + d->len;
- found_keys = 0;
+ while (data < data_end && found_keys < n_keys)
+ {
+ gboolean remove = FALSE;
- while (data < data_end && found_keys < n_keys)
+ for (gsize i = 0; i < n_keys; i++)
{
- gboolean remove = FALSE;
-
- for (gsize i = 0; i < n_keys; i++)
+ if (data->key == keys[i])
{
- if (data->key == keys[i])
- {
- old[i] = *data;
- remove = TRUE;
- break;
- }
+ old[i] = *data;
+ remove = TRUE;
+ break;
}
+ }
- if (remove)
- {
- GDataElt *data_last = data_end - 1;
+ if (remove)
+ {
+ GDataElt *data_last = data_end - 1;
- found_keys++;
+ found_keys++;
- if (data < data_last)
- *data = *data_last;
+ if (data < data_last)
+ *data = *data_last;
- data_end--;
- d->len--;
+ data_end--;
+ d->len--;
- /* We don't bother to shrink, but if all data are now gone
- * we at least free the memory
- */
- if (d->len == 0)
- {
- G_DATALIST_SET_POINTER (datalist, NULL);
- g_free (d);
- break;
- }
- }
- else
+ /* We don't bother to shrink, but if all data are now gone
+ * we at least free the memory
+ */
+ if (d->len == 0)
{
- data++;
+ free_d = TRUE;
+ break;
}
}
-
- if (found_keys > 0)
+ else
{
- g_datalist_unlock (datalist);
+ data++;
+ }
+ }
- for (gsize i = 0; i < n_keys; i++)
- {
- /* If keys[i] was not found, then old[i].destroy is NULL.
- * Call old[i].destroy() only if keys[i] was found, and
- * is associated with a destroy notifier: */
- if (old[i].destroy)
- old[i].destroy (old[i].data);
- }
+ if (free_d)
+ {
+ g_datalist_unlock_and_set (datalist, NULL);
+ g_free (d);
+ }
+ else
+ g_datalist_unlock (datalist);
- return;
+ if (found_keys > 0)
+ {
+ for (gsize i = 0; i < n_keys; i++)
+ {
+ /* If keys[i] was not found, then old[i].destroy is NULL.
+ * Call old[i].destroy() only if keys[i] was found, and
+ * is associated with a destroy notifier: */
+ if (old[i].destroy)
+ old[i].destroy (old[i].data);
}
}
- g_datalist_unlock (datalist);
+ if (G_UNLIKELY (old_to_free))
+ g_free (old_to_free);
}
/**
gpointer val = NULL;
gpointer retval = NULL;
GData *d;
- GDataElt *data, *data_end;
+ GDataElt *data;
- g_datalist_lock (datalist);
+ d = g_datalist_lock_and_get (datalist);
- d = G_DATALIST_GET_POINTER (datalist);
- if (d)
- {
- data = d->data;
- data_end = data + d->len;
- do
- {
- if (data->key == key_id)
- {
- val = data->data;
- break;
- }
- data++;
- }
- while (data < data_end);
- }
+ data = datalist_find (d, key_id, NULL);
+ if (data)
+ val = data->data;
if (dup_func)
retval = dup_func (val, user_data);
{
gpointer val = NULL;
GData *d;
- GDataElt *data, *data_end;
+ GData *new_d = NULL;
+ GDataElt *data;
+ gboolean free_d = FALSE;
+ gboolean set_new_d = FALSE;
+ guint32 idx;
g_return_val_if_fail (datalist != NULL, FALSE);
g_return_val_if_fail (key_id != 0, FALSE);
if (old_destroy)
*old_destroy = NULL;
- g_datalist_lock (datalist);
+ d = g_datalist_lock_and_get (datalist);
- d = G_DATALIST_GET_POINTER (datalist);
- if (d)
+ data = datalist_find (d, key_id, &idx);
+ if (data)
{
- data = d->data;
- data_end = data + d->len - 1;
- while (data <= data_end)
+ val = data->data;
+ if (val == oldval)
{
- if (data->key == key_id)
+ if (old_destroy)
+ *old_destroy = data->destroy;
+ if (newval != NULL)
{
- val = data->data;
- if (val == oldval)
+ data->data = newval;
+ data->destroy = destroy;
+ }
+ else
+ {
+ if (idx != d->len - 1u)
+ *data = d->data[d->len - 1u];
+ d->len--;
+
+ /* We don't bother to shrink, but if all data are now gone
+ * we at least free the memory
+ */
+ if (d->len == 0)
{
- if (old_destroy)
- *old_destroy = data->destroy;
- if (newval != NULL)
- {
- data->data = newval;
- data->destroy = destroy;
- }
- else
- {
- if (data != data_end)
- *data = *data_end;
- d->len--;
-
- /* We don't bother to shrink, but if all data are now gone
- * we at least free the memory
- */
- if (d->len == 0)
- {
- G_DATALIST_SET_POINTER (datalist, NULL);
- g_free (d);
- }
- }
+ set_new_d = TRUE;
+ free_d = TRUE;
}
- break;
}
- data++;
}
}
if (val == NULL && oldval == NULL && newval != NULL)
{
- GData *old_d;
-
- /* insert newval */
- old_d = d;
- if (d == NULL)
- {
- d = g_malloc (sizeof (GData));
- d->len = 0;
- d->alloc = 1;
- }
- else if (d->len == d->alloc)
+ if (datalist_append (&d, key_id, newval, destroy))
{
- d->alloc = d->alloc * 2;
- d = g_realloc (d, sizeof (GData) + (d->alloc - 1) * sizeof (GDataElt));
+ new_d = d;
+ set_new_d = TRUE;
}
- if (old_d != d)
- G_DATALIST_SET_POINTER (datalist, d);
-
- d->data[d->len].key = key_id;
- d->data[d->len].data = newval;
- d->data[d->len].destroy = destroy;
- d->len++;
}
- g_datalist_unlock (datalist);
+ if (set_new_d)
+ g_datalist_unlock_and_set (datalist, new_d);
+ else
+ g_datalist_unlock (datalist);
+
+ if (free_d)
+ g_free (d);
return val == oldval;
}
g_return_val_if_fail (datalist != NULL, NULL);
- g_datalist_lock (datalist);
-
- d = G_DATALIST_GET_POINTER (datalist);
+ d = g_datalist_lock_and_get (datalist);
if (d)
{
data = d->data;
#endif /* HAVE_LANGINFO_ABALTMON */
-#ifdef HAVE_LANGINFO_ERA
+/* FIXME: It doesn’t seem to be possible to use ERA on 64-bit big-endian platforms with glibc
+ * in a POSIX-compliant way right now.
+ * See https://gitlab.gnome.org/GNOME/glib/-/issues/3225 */
+#if defined(HAVE_LANGINFO_ERA) && (G_BYTE_ORDER == G_LITTLE_ENDIAN || GLIB_SIZEOF_VOID_P == 4)
#define PREFERRED_ERA_DATE_TIME_FMT nl_langinfo (ERA_D_T_FMT)
#define PREFERRED_ERA_DATE_FMT nl_langinfo (ERA_D_FMT)
}
/**
- * g_date_time_new_from_unix_utc: (constructor)
+ * g_date_time_new_from_unix_utc_usec: (constructor)
* @usecs: the Unix time in microseconds
*
* Creates a [struct@GLib.DateTime] corresponding to the given Unix time @t in UTC.
gboolean g_uint_equal (gconstpointer v1, gconstpointer v2);
guint g_uint_hash (gconstpointer v);
+#if defined(__GNUC__)
+#define G_THREAD_LOCAL __thread
+#else
+#undef G_THREAD_LOCAL
+#endif
+
#endif /* __GLIB_PRIVATE_H__ */
#include "gthreadprivate.h"
#include "gutilsprivate.h"
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
#if defined(__linux__) && !defined(__BIONIC__)
#include "gjournal-private.h"
#endif
* GLib log levels that are considered fatal by default.
*
* This is not used if structured logging is enabled; see
- * [Using Structured Logging][using-structured-logging].
+ * [Using Structured Logging](logging.html#using-structured-logging).
*/
/**
* GLogFunc:
* @log_domain: the log domain of the message
* @log_level: the log level of the message (including the
- * fatal and recursion flags)
+ * fatal and recursion flags)
* @message: the message to process
- * @user_data: user data, set in g_log_set_handler()
+ * @user_data: user data, set in [func@GLib.log_set_handler]
*
* Specifies the prototype of log handler functions.
*
- * The default log handler, g_log_default_handler(), automatically appends a
+ * The default log handler, [func@GLib.log_default_handler], automatically appends a
* new-line character to @message when printing it. It is advised that any
* custom log handler functions behave similarly, so that logging calls in user
* code do not need modifying to add a new-line character to the message if the
* log handler is changed.
*
* This is not used if structured logging is enabled; see
- * [Using Structured Logging][using-structured-logging].
+ * [Using Structured Logging](logging.html#using-structured-logging).
*/
/**
* GLogLevelFlags:
* @G_LOG_FLAG_RECURSION: internal flag
* @G_LOG_FLAG_FATAL: internal flag
- * @G_LOG_LEVEL_ERROR: log level for errors, see g_error().
- * This level is also used for messages produced by g_assert().
+ * @G_LOG_LEVEL_ERROR: log level for errors, see [func@GLib.error].
+ * This level is also used for messages produced by [func@GLib.assert].
* @G_LOG_LEVEL_CRITICAL: log level for critical warning messages, see
- * g_critical().
- * This level is also used for messages produced by g_return_if_fail()
- * and g_return_val_if_fail().
- * @G_LOG_LEVEL_WARNING: log level for warnings, see g_warning()
- * @G_LOG_LEVEL_MESSAGE: log level for messages, see g_message()
- * @G_LOG_LEVEL_INFO: log level for informational messages, see g_info()
- * @G_LOG_LEVEL_DEBUG: log level for debug messages, see g_debug()
+ * [func@GLib.critical]. This level is also used for messages produced by
+ * [func@GLib.return_if_fail] and [func@GLib.return_val_if_fail].
+ * @G_LOG_LEVEL_WARNING: log level for warnings, see [func@GLib.warning]
+ * @G_LOG_LEVEL_MESSAGE: log level for messages, see [func@GLib.message]
+ * @G_LOG_LEVEL_INFO: log level for informational messages, see [func@GLib.info]
+ * @G_LOG_LEVEL_DEBUG: log level for debug messages, see [func@GLib.debug]
* @G_LOG_LEVEL_MASK: a mask including all log levels
*
* Flags specifying the level of log messages.
*
* It is possible to change how GLib treats messages of the various
- * levels using g_log_set_handler() and g_log_set_fatal_mask().
+ * levels using [func@GLib.log_set_handler] and [func@GLib.log_set_fatal_mask].
*/
/**
* G_LOG_LEVEL_USER_SHIFT:
*
- * Log levels below 1<<G_LOG_LEVEL_USER_SHIFT are used by GLib.
+ * Log levels below `1<<G_LOG_LEVEL_USER_SHIFT` are used by GLib.
* Higher bits can be used for user-defined log levels.
*/
/**
* g_message:
- * @...: format string, followed by parameters to insert
- * into the format string (as with printf())
+ * @...: format string, followed by parameters to insert into the format string
+ * (as with `printf()`)
*
* A convenience function/macro to log a normal message.
*
- * If g_log_default_handler() is used as the log handler function, a new-line
+ * If [func@GLib.log_default_handler] is used as the log handler function, a new-line
* character will automatically be appended to @..., and need not be entered
* manually.
*
- * If structured logging is enabled, this will use g_log_structured();
- * otherwise it will use g_log(). See
- * [Using Structured Logging][using-structured-logging].
+ * If structured logging is enabled, this will use [func@GLib.log_structured];
+ * otherwise it will use [func@GLib.log]. See
+ * [Using Structured Logging](logging.html#using-structured-logging).
*/
/**
* g_warning:
- * @...: format string, followed by parameters to insert
- * into the format string (as with printf())
+ * @...: format string, followed by parameters to insert into the format string
+ * (as with `printf()`)
*
- * A convenience function/macro to log a warning message. The message should
- * typically *not* be translated to the user's language.
+ * A convenience function/macro to log a warning message.
*
- * This is not intended for end user error reporting. Use of #GError is
+ * The message should typically *not* be translated to the user’s language.
+ *
+ * This is not intended for end user error reporting. Use of [type@GLib.Error] is
* preferred for that instead, as it allows calling functions to perform actions
* conditional on the type of error.
*
* trusted files, etc.)
*
* If attempting to deal with programmer errors (for example, incorrect function
- * parameters) then you should use %G_LOG_LEVEL_CRITICAL instead.
+ * parameters) then you should use [flags@GLib.LogLevelFlags.LEVEL_CRITICAL] instead.
*
- * g_warn_if_reached() and g_warn_if_fail() log at %G_LOG_LEVEL_WARNING.
+ * [func@GLib.warn_if_reached] and func@GLib.warn_if_fail] log at [flags@GLib.LogLevelFlags.LEVEL_WARNING].
*
* You can make warnings fatal at runtime by setting the `G_DEBUG`
* environment variable (see
* [Running GLib Applications](glib-running.html)):
*
- * |[
- * G_DEBUG=fatal-warnings gdb ./my-program
- * ]|
+ * ```
+ * G_DEBUG=fatal-warnings gdb ./my-program
+ * ```
*
* Any unrelated failures can be skipped over in
* [gdb](https://www.gnu.org/software/gdb/) using the `continue` command.
*
- * If g_log_default_handler() is used as the log handler function,
+ * If [func@GLib.log_default_handler] is used as the log handler function,
* a newline character will automatically be appended to @..., and
* need not be entered manually.
*
- * If structured logging is enabled, this will use g_log_structured();
- * otherwise it will use g_log(). See
- * [Using Structured Logging][using-structured-logging].
+ * If structured logging is enabled, this will use [func@GLib.log_structured];
+ * otherwise it will use [func@GLib.log]. See
+ * [Using Structured Logging](logging.html#using-structured-logging).
*/
/**
* g_critical:
- * @...: format string, followed by parameters to insert
- * into the format string (as with printf())
+ * @...: format string, followed by parameters to insert into the format string
+ * (as with `printf()`)
*
- * Logs a "critical warning" (%G_LOG_LEVEL_CRITICAL).
+ * Logs a ‘critical warning’ ([flags@GLib.LogLevelFlags.LEVEL_CRITICAL]).
*
* Critical warnings are intended to be used in the event of an error
* that originated in the current process (a programmer error).
* Logging of a critical error is by definition an indication of a bug
* somewhere in the current program (or its libraries).
*
- * g_return_if_fail(), g_return_val_if_fail(), g_return_if_reached() and
- * g_return_val_if_reached() log at %G_LOG_LEVEL_CRITICAL.
+ * [func@GLib.return_if_fail], [func@GLib.return_val_if_fail], [func@GLib.return_if_reached] and
+ * [func@GLib.return_val_if_reached] log at [flags@GLib.LogLevelFlags.LEVEL_CRITICAL].
*
* You can make critical warnings fatal at runtime by
* setting the `G_DEBUG` environment variable (see
* [Running GLib Applications](glib-running.html)):
*
- * |[
- * G_DEBUG=fatal-warnings gdb ./my-program
- * ]|
+ * ```
+ * G_DEBUG=fatal-warnings gdb ./my-program
+ * ```
*
- * You can also use g_log_set_always_fatal().
+ * You can also use [func@GLib.log_set_always_fatal].
*
* Any unrelated failures can be skipped over in
* [gdb](https://www.gnu.org/software/gdb/) using the `continue` command.
*
* The message should typically *not* be translated to the
- * user's language.
+ * user’s language.
*
- * If g_log_default_handler() is used as the log handler function, a new-line
+ * If [func@GLib.log_default_handler] is used as the log handler function, a new-line
* character will automatically be appended to @..., and need not be entered
* manually.
*
- * If structured logging is enabled, this will use g_log_structured();
- * otherwise it will use g_log(). See
- * [Using Structured Logging][using-structured-logging].
+ * If structured logging is enabled, this will use [func@GLib.log_structured];
+ * otherwise it will use [func@GLib.log]. See
+ * [Using Structured Logging](logging.html#using-structured-logging).
*/
/**
* g_error:
- * @...: format string, followed by parameters to insert
- * into the format string (as with printf())
+ * @...: format string, followed by parameters to insert into the format string
+ * (as with `printf()`)
+ *
+ * A convenience function/macro to log an error message.
*
- * A convenience function/macro to log an error message. The message should
- * typically *not* be translated to the user's language.
+ * The message should typically *not* be translated to the user’s language.
*
- * This is not intended for end user error reporting. Use of #GError is
+ * This is not intended for end user error reporting. Use of [type@GLib.Error] is
* preferred for that instead, as it allows calling functions to perform actions
* conditional on the type of error.
*
- * Error messages are always fatal, resulting in a call to G_BREAKPOINT()
+ * Error messages are always fatal, resulting in a call to [func@GLib.BREAKPOINT]
* to terminate the application. This function will
- * result in a core dump; don't use it for errors you expect.
+ * result in a core dump; don’t use it for errors you expect.
* Using this function indicates a bug in your program, i.e.
* an assertion failure.
*
- * If g_log_default_handler() is used as the log handler function, a new-line
+ * If [func@GLib.log_default_handler] is used as the log handler function, a new-line
* character will automatically be appended to @..., and need not be entered
* manually.
*
- * If structured logging is enabled, this will use g_log_structured();
- * otherwise it will use g_log(). See
- * [Using Structured Logging][using-structured-logging].
+ * If structured logging is enabled, this will use [func@GLib.log_structured];
+ * otherwise it will use [func@GLib.log]. See
+ * [Using Structured Logging](logging.html#using-structured-logging).
*/
/**
* g_info:
- * @...: format string, followed by parameters to insert
- * into the format string (as with printf())
+ * @...: format string, followed by parameters to insert into the format string
+ * (as with `printf()`)
*
- * A convenience function/macro to log an informational message. Seldom used.
+ * A convenience function/macro to log an informational message.
*
- * If g_log_default_handler() is used as the log handler function, a new-line
+ * Seldom used.
+ *
+ * If [func@GLib.log_default_handler] is used as the log handler function, a new-line
* character will automatically be appended to @..., and need not be entered
* manually.
*
- * Such messages are suppressed by the g_log_default_handler() and
- * g_log_writer_default() unless the `G_MESSAGES_DEBUG` environment variable is
+ * Such messages are suppressed by the [func@GLib.log_default_handler] and
+ * [func@GLib.log_writer_default] unless the `G_MESSAGES_DEBUG` environment variable is
* set appropriately. If you need to set the allowed domains at runtime, use
- * g_log_writer_default_set_debug_domains().
+ * [func@GLib.log_writer_default_set_debug_domains].
*
- * If structured logging is enabled, this will use g_log_structured();
- * otherwise it will use g_log(). See
- * [Using Structured Logging][using-structured-logging].
+ * If structured logging is enabled, this will use [func@GLib.log_structured];
+ * otherwise it will use [func@GLib.log]. See
+ * [Using Structured Logging](logging.html#using-structured-logging).
*
* Since: 2.40
*/
/**
* g_debug:
- * @...: format string, followed by parameters to insert
- * into the format string (as with printf())
+ * @...: format string, followed by parameters to insert into the format string
+ * (as with `printf()`)
+ *
+ * A convenience function/macro to log a debug message.
*
- * A convenience function/macro to log a debug message. The message should
- * typically *not* be translated to the user's language.
+ * The message should typically *not* be translated to the user’s language.
*
- * If g_log_default_handler() is used as the log handler function, a new-line
+ * If [func@GLib.log_default_handler] is used as the log handler function, a new-line
* character will automatically be appended to @..., and need not be entered
* manually.
*
- * Such messages are suppressed by the g_log_default_handler() and
- * g_log_writer_default() unless the `G_MESSAGES_DEBUG` environment variable is
+ * Such messages are suppressed by the [func@GLib.log_default_handler] and
+ * [func@GLib.log_writer_default] unless the `G_MESSAGES_DEBUG` environment variable is
* set appropriately. If you need to set the allowed domains at runtime, use
- * g_log_writer_default_set_debug_domains().
+ * [func@GLib.log_writer_default_set_debug_domains].
*
- * If structured logging is enabled, this will use g_log_structured();
- * otherwise it will use g_log(). See
- * [Using Structured Logging][using-structured-logging].
+ * If structured logging is enabled, this will use [func@GLib.log_structured];
+ * otherwise it will use [func@GLib.log]. See
+ * [Using Structured Logging](logging.html#using-structured-logging).
*
* Since: 2.6
*/
/**
* g_log_set_always_fatal:
- * @fatal_mask: the mask containing bits set for each level
- * of error which is to be fatal
+ * @fatal_mask: the mask containing bits set for each level of error which is
+ * to be fatal
*
* Sets the message levels which are always fatal, in any log domain.
+ *
* When a message with any of these levels is logged the program terminates.
* You can only set the levels defined by GLib to be fatal.
- * %G_LOG_LEVEL_ERROR is always fatal.
+ * [flags@GLib.LogLevelFlags.LEVEL_ERROR] is always fatal.
*
* You can also make some message levels fatal at runtime by setting
* the `G_DEBUG` environment variable (see
* Libraries should not call this function, as it affects all messages logged
* by a process, including those from other libraries.
*
- * Structured log messages (using g_log_structured() and
- * g_log_structured_array()) are fatal only if the default log writer is used;
+ * Structured log messages (using [func@GLib.log_structured] and
+ * [func@GLib.log_structured_array]) are fatal only if the default log writer is used;
* otherwise it is up to the writer function to determine which log messages
- * are fatal. See [Using Structured Logging][using-structured-logging].
+ * are fatal. See [Using Structured Logging](logging.html#using-structured-logging).
*
* Returns: the old fatal mask
*/
* @fatal_mask: the new fatal mask
*
* Sets the log levels which are fatal in the given domain.
- * %G_LOG_LEVEL_ERROR is always fatal.
*
- * This has no effect on structured log messages (using g_log_structured() or
- * g_log_structured_array()). To change the fatal behaviour for specific log
+ * [flags@GLib.LogLevelFlags.LEVEL_ERROR] is always fatal.
+ *
+ * This has no effect on structured log messages (using [func@GLib.log_structured] or
+ * [func@GLib.log_structured_array]). To change the fatal behaviour for specific log
* messages, programs must install a custom log writer function using
- * g_log_set_writer_func(). See
- * [Using Structured Logging][using-structured-logging].
+ * [func@GLib.log_set_writer_func]. See
+ * [Using Structured Logging](logging.html#using-structured-logging).
*
* This function is mostly intended to be used with
- * %G_LOG_LEVEL_CRITICAL. You should typically not set
- * %G_LOG_LEVEL_WARNING, %G_LOG_LEVEL_MESSAGE, %G_LOG_LEVEL_INFO or
- * %G_LOG_LEVEL_DEBUG as fatal except inside of test programs.
+ * [flags@GLib.LogLevelFlags.LEVEL_CRITICAL]. You should typically not set
+ * [flags@GLib.LogLevelFlags.LEVEL_WARNING], [flags@GLib.LogLevelFlags.LEVEL_MESSAGE], [flags@GLib.LogLevelFlags.LEVEL_INFO] or
+ * [flags@GLib.LogLevelFlags.LEVEL_DEBUG] as fatal except inside of test programs.
*
* Returns: the old fatal mask for the log domain
*/
/**
* g_log_set_handler:
- * @log_domain: (nullable): the log domain, or %NULL for the default ""
+ * @log_domain: (nullable): the log domain, or `NULL` for the default `""`
* application domain
* @log_levels: the log levels to apply the log handler for.
* To handle fatal and recursive messages as well, combine
- * the log levels with the %G_LOG_FLAG_FATAL and
- * %G_LOG_FLAG_RECURSION bit flags.
+ * the log levels with the [flags@GLib.LogLevelFlags.FLAG_FATAL] and
+ * [flags@GLib.LogLevelFlags.FLAG_RECURSION] bit flags.
* @log_func: the log handler function
* @user_data: data passed to the log handler
*
* Sets the log handler for a domain and a set of log levels.
*
* To handle fatal and recursive messages the @log_levels parameter
- * must be combined with the %G_LOG_FLAG_FATAL and %G_LOG_FLAG_RECURSION
+ * must be combined with the [flags@GLib.LogLevelFlags.FLAG_FATAL] and [flags@GLib.LogLevelFlags.FLAG_RECURSION]
* bit flags.
*
- * Note that since the %G_LOG_LEVEL_ERROR log level is always fatal, if
+ * Note that since the [flags@GLib.LogLevelFlags.LEVEL_ERROR] log level is always fatal, if
* you want to set a handler for this log level you must combine it with
- * %G_LOG_FLAG_FATAL.
+ * [flags@GLib.LogLevelFlags.FLAG_FATAL].
*
* This has no effect if structured logging is enabled; see
- * [Using Structured Logging][using-structured-logging].
+ * [Using Structured Logging](logging.html#using-structured-logging).
*
* Here is an example for adding a log handler for all warning messages
* in the default domain:
*
- * |[<!-- language="C" -->
+ * ```c
* g_log_set_handler (NULL, G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
* | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
- * ]|
+ * ```
*
* This example adds a log handler for all critical messages from GTK:
*
- * |[<!-- language="C" -->
+ * ```c
* g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL
* | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
- * ]|
+ * ```
*
* This example adds a log handler for all messages from GLib:
*
- * |[<!-- language="C" -->
+ * ```c
* g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
* | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
- * ]|
+ * ```
*
* Returns: the id of the new handler
*/
/**
* g_log_set_handler_full: (rename-to g_log_set_handler)
- * @log_domain: (nullable): the log domain, or %NULL for the default ""
+ * @log_domain: (nullable): the log domain, or `NULL` for the default `""`
* application domain
* @log_levels: the log levels to apply the log handler for.
* To handle fatal and recursive messages as well, combine
- * the log levels with the %G_LOG_FLAG_FATAL and
- * %G_LOG_FLAG_RECURSION bit flags.
+ * the log levels with the [flags@GLib.LogLevelFlags.FLAG_FATAL] and
+ * [flags@GLib.LogLevelFlags.FLAG_RECURSION] bit flags.
* @log_func: the log handler function
* @user_data: data passed to the log handler
- * @destroy: destroy notify for @user_data, or %NULL
+ * @destroy: destroy notify for @user_data, or `NULL`
*
- * Like g_log_set_handler(), but takes a destroy notify for the @user_data.
+ * Like [func@GLib.log_set_handler], but takes a destroy notify for the @user_data.
*
* This has no effect if structured logging is enabled; see
- * [Using Structured Logging][using-structured-logging].
+ * [Using Structured Logging](logging.html#using-structured-logging).
*
- * Returns: the id of the new handler
+ * Returns: the ID of the new handler
*
* Since: 2.46
*/
*
* Installs a default log handler which is used if no
* log handler has been set for the particular log domain
- * and log level combination. By default, GLib uses
- * g_log_default_handler() as default log handler.
+ * and log level combination.
+ *
+ * By default, GLib uses [func@GLib.log_default_handler] as default log handler.
*
* This has no effect if structured logging is enabled; see
- * [Using Structured Logging][using-structured-logging].
+ * [Using Structured Logging](logging.html#using-structured-logging).
*
* Returns: the previous default log handler
*
* This handler has no effect on g_error messages.
*
* This handler also has no effect on structured log messages (using
- * g_log_structured() or g_log_structured_array()). To change the fatal
+ * [func@GLib.log_structured] or [func@GLib.log_structured_array]). To change the fatal
* behaviour for specific log messages, programs must install a custom log
- * writer function using g_log_set_writer_func().See
- * [Using Structured Logging][using-structured-logging].
+ * writer function using [func@GLib.log_set_writer_func].See
+ * [Using Structured Logging](logging.html#using-structured-logging).
*
* Since: 2.22
**/
/**
* g_log_remove_handler:
* @log_domain: the log domain
- * @handler_id: the id of the handler, which was returned
- * in g_log_set_handler()
+ * @handler_id: the ID of the handler, which was returned
+ * in [func@GLib.log_set_handler]
*
* Removes the log handler.
*
* This has no effect if structured logging is enabled; see
- * [Using Structured Logging][using-structured-logging].
+ * [Using Structured Logging](logging.html#using-structured-logging).
*/
void
g_log_remove_handler (const gchar *log_domain,
/**
* g_log_writer_default_set_use_stderr:
- * @use_stderr: If %TRUE, use `stderr` for log messages that would
+ * @use_stderr: If `TRUE`, use `stderr` for log messages that would
* normally have appeared on `stdout`
*
- * Configure whether the built-in log functions
- * (g_log_default_handler() for the old-style API, and both
- * g_log_writer_default() and g_log_writer_standard_streams() for the
- * structured API) will output all log messages to `stderr`.
+ * Configure whether the built-in log functions will output all log messages to
+ * `stderr`.
+ *
+ * The built-in log functions are [func@GLib.log_default_handler] for the
+ * old-style API, and both [func@GLib.log_writer_default] and
+ * [func@GLib.log_writer_standard_streams] for the structured API.
*
- * By default, log messages of levels %G_LOG_LEVEL_INFO and
- * %G_LOG_LEVEL_DEBUG are sent to `stdout`, and other log messages are
+ * By default, log messages of levels [flags@GLib.LogLevelFlags.LEVEL_INFO] and
+ * [flags@GLib.LogLevelFlags.LEVEL_DEBUG] are sent to `stdout`, and other log messages are
* sent to `stderr`. This is problematic for applications that intend
* to reserve `stdout` for structured output such as JSON or XML.
*
/**
* g_logv:
- * @log_domain: (nullable): the log domain, or %NULL for the default ""
- * application domain
+ * @log_domain: (nullable): the log domain, or `NULL` for the default `""`
+ * application domain
* @log_level: the log level
- * @format: the message format. See the printf() documentation
+ * @format: the message format. See the `printf()` documentation
* @args: the parameters to insert into the format string
*
* Logs an error or debugging message.
*
- * If the log level has been set as fatal, G_BREAKPOINT() is called
- * to terminate the program. See the documentation for G_BREAKPOINT() for
+ * If the log level has been set as fatal, [func@GLib.BREAKPOINT] is called
+ * to terminate the program. See the documentation for [func@GLib.BREAKPOINT] for
* details of the debugging options this provides.
*
- * If g_log_default_handler() is used as the log handler function, a new-line
+ * If [func@GLib.log_default_handler] is used as the log handler function, a new-line
* character will automatically be appended to @..., and need not be entered
* manually.
*
- * If [structured logging is enabled][using-structured-logging] this will
- * output via the structured log writer function (see g_log_set_writer_func()).
+ * If [structured logging is enabled](logging.html#using-structured-logging) this will
+ * output via the structured log writer function (see [func@GLib.log_set_writer_func]).
*/
void
g_logv (const gchar *log_domain,
/**
* g_log:
- * @log_domain: (nullable): the log domain, usually %G_LOG_DOMAIN, or %NULL
+ * @log_domain: (nullable): the log domain, usually `G_LOG_DOMAIN`, or `NULL`
* for the default
- * @log_level: the log level, either from #GLogLevelFlags
+ * @log_level: the log level, either from [type@GLib.LogLevelFlags]
* or a user-defined level
* @format: the message format. See the `printf()` documentation
* @...: the parameters to insert into the format string
*
* Logs an error or debugging message.
*
- * If the log level has been set as fatal, G_BREAKPOINT() is called
- * to terminate the program. See the documentation for G_BREAKPOINT() for
+ * If the log level has been set as fatal, [func@GLib.BREAKPOINT] is called
+ * to terminate the program. See the documentation for [func@GLib.BREAKPOINT] for
* details of the debugging options this provides.
*
- * If g_log_default_handler() is used as the log handler function, a new-line
+ * If [func@GLib.log_default_handler] is used as the log handler function, a new-line
* character will automatically be appended to @..., and need not be entered
* manually.
*
- * If [structured logging is enabled][using-structured-logging] this will
- * output via the structured log writer function (see g_log_set_writer_func()).
+ * If [structured logging is enabled](logging.html#using-structured-logging) this will
+ * output via the structured log writer function (see [func@GLib.log_set_writer_func]).
*/
void
g_log (const gchar *log_domain,
return "5";
}
+#ifdef HAVE_SYSLOG_H
+static int
+str_to_syslog_facility (const gchar *syslog_facility_str)
+{
+ int syslog_facility = LOG_USER;
+
+ if (g_strcmp0 (syslog_facility_str, "auth") == 0)
+ {
+ syslog_facility = LOG_AUTH;
+ }
+ else if (g_strcmp0 (syslog_facility_str, "daemon") == 0)
+ {
+ syslog_facility = LOG_DAEMON;
+ }
+
+ return syslog_facility;
+}
+#endif
+
static inline FILE *
log_level_to_file (GLogLevelFlags log_level)
{
/**
* g_log_structured:
- * @log_domain: log domain, usually %G_LOG_DOMAIN
- * @log_level: log level, either from #GLogLevelFlags, or a user-defined
+ * @log_domain: log domain, usually `G_LOG_DOMAIN`
+ * @log_level: log level, either from [type@GLib.LogLevelFlags], or a user-defined
* level
* @...: key-value pairs of structured data to add to the log entry, followed
- * by the key "MESSAGE", followed by a printf()-style message format,
+ * by the key `MESSAGE`, followed by a `printf()`-style message format,
* followed by parameters to insert in the format string
*
* Log a message with structured data.
*
* The message will be passed through to the log writer set by the application
- * using g_log_set_writer_func(). If the message is fatal (i.e. its log level
- * is %G_LOG_LEVEL_ERROR), the program will be aborted by calling
- * G_BREAKPOINT() at the end of this function. If the log writer returns
- * %G_LOG_WRITER_UNHANDLED (failure), no other fallback writers will be tried.
- * See the documentation for #GLogWriterFunc for information on chaining
+ * using [func@GLib.log_set_writer_func]. If the message is fatal (i.e. its log level
+ * is [flags@GLib.LogLevelFlags.LEVEL_ERROR]), the program will be aborted by calling
+ * [func@GLib.BREAKPOINT] at the end of this function. If the log writer returns
+ * [enum@GLib.LogWriterOutput.UNHANDLED] (failure), no other fallback writers will be tried.
+ * See the documentation for [type@GLib.LogWriterFunc] for information on chaining
* writers.
*
* The structured data is provided as key–value pairs, where keys are UTF-8
* strings, and values are arbitrary pointers — typically pointing to UTF-8
* strings, but that is not a requirement. To pass binary (non-nul-terminated)
- * structured data, use g_log_structured_array(). The keys for structured data
+ * structured data, use [func@GLib.log_structured_array]. The keys for structured data
* should follow the [systemd journal
* fields](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html)
* specification. It is suggested that custom keys are namespaced according to
* `GLIB_` prefix.
*
* Note that keys that expect UTF-8 strings (specifically `"MESSAGE"` and
- * `"GLIB_DOMAIN"`) must be passed as NUL-terminated UTF-8 strings until GLib
+ * `"GLIB_DOMAIN"`) must be passed as nul-terminated UTF-8 strings until GLib
* version 2.74.1 because the default log handler did not consider the length of
* the `GLogField`. Starting with GLib 2.74.1 this is fixed and
- * non-NUL-terminated UTF-8 strings can be passed with their correct length.
+ * non-nul-terminated UTF-8 strings can be passed with their correct length.
*
* The @log_domain will be converted into a `GLIB_DOMAIN` field. @log_level will
* be converted into a
* * [`ERRNO`](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#ERRNO=)
*
* Note that `CODE_FILE`, `CODE_LINE` and `CODE_FUNC` are automatically set by
- * the logging macros, G_DEBUG_HERE(), g_message(), g_warning(), g_critical(),
- * g_error(), etc, if the symbols `G_LOG_USE_STRUCTURED` is defined before including
+ * the logging macros, [func@GLib.DEBUG_HERE], [func@GLib.message], [func@GLib.warning], [func@GLib.critical],
+ * [func@GLib.error], etc, if the symbol `G_LOG_USE_STRUCTURED` is defined before including
* `glib.h`.
*
* For example:
*
- * |[<!-- language="C" -->
+ * ```c
* g_log_structured (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
* "MESSAGE_ID", "06d4df59e6c24647bfe69d2c27ef0b4e",
* "MY_APPLICATION_CUSTOM_FIELD", "some debug string",
* "MESSAGE", "This is a debug message about pointer %p and integer %u.",
* some_pointer, some_integer);
- * ]|
+ * ```
*
* Note that each `MESSAGE_ID` must be [uniquely and randomly
* generated](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#MESSAGE_ID=).
* your software.
*
* To pass a user data pointer to the log writer function which is specific to
- * this logging call, you must use g_log_structured_array() and pass the pointer
- * as a field with #GLogField.length set to zero, otherwise it will be
+ * this logging call, you must use [func@GLib.log_structured_array] and pass the pointer
+ * as a field with `GLogField.length` set to zero, otherwise it will be
* interpreted as a string.
*
* For example:
*
- * |[<!-- language="C" -->
+ * ```c
* const GLogField fields[] = {
* { "MESSAGE", "This is a debug message.", -1 },
* { "MESSAGE_ID", "fcfb2e1e65c3494386b74878f1abf893", -1 },
* { "MY_APPLICATION_STATE", state_object, 0 },
* };
* g_log_structured_array (G_LOG_LEVEL_DEBUG, fields, G_N_ELEMENTS (fields));
- * ]|
+ * ```
*
* Note also that, even if no other structured fields are specified, there
* must always be a `MESSAGE` key before the format string. The `MESSAGE`-format
* pair has to be the last of the key-value pairs, and `MESSAGE` is the only
- * field for which printf()-style formatting is supported.
+ * field for which `printf()`-style formatting is supported.
*
* The default writer function for `stdout` and `stderr` will automatically
* append a new-line character after the message, so you should not add one
/**
* g_log_variant:
- * @log_domain: (nullable): log domain, usually %G_LOG_DOMAIN
- * @log_level: log level, either from #GLogLevelFlags, or a user-defined
+ * @log_domain: (nullable): log domain, usually `G_LOG_DOMAIN`
+ * @log_level: log level, either from [type@GLib.LogLevelFlags], or a user-defined
* level
- * @fields: a dictionary (#GVariant of the type %G_VARIANT_TYPE_VARDICT)
+ * @fields: a dictionary ([type@GLib.Variant] of the type `G_VARIANT_TYPE_VARDICT`)
* containing the key-value pairs of message data.
*
- * Log a message with structured data, accepting the data within a #GVariant. This
- * version is especially useful for use in other languages, via introspection.
+ * Log a message with structured data, accepting the data within a [type@GLib.Variant].
+ *
+ * This version is especially useful for use in other languages, via introspection.
*
- * The only mandatory item in the @fields dictionary is the "MESSAGE" which must
+ * The only mandatory item in the @fields dictionary is the `"MESSAGE"` which must
* contain the text shown to the user.
*
- * The values in the @fields dictionary are likely to be of type String
- * (%G_VARIANT_TYPE_STRING). Array of bytes (%G_VARIANT_TYPE_BYTESTRING) is also
+ * The values in the @fields dictionary are likely to be of type `G_VARIANT_TYPE_STRING`.
+ * Array of bytes (`G_VARIANT_TYPE_BYTESTRING`) is also
* supported. In this case the message is handled as binary and will be forwarded
* to the log writer as such. The size of the array should not be higher than
- * %G_MAXSSIZE. Otherwise it will be truncated to this size. For other types
- * g_variant_print() will be used to convert the value into a string.
+ * `G_MAXSSIZE`. Otherwise it will be truncated to this size. For other types
+ * [method@GLib.Variant.print] will be used to convert the value into a string.
*
- * For more details on its usage and about the parameters, see g_log_structured().
+ * For more details on its usage and about the parameters, see [func@GLib.log_structured].
*
* Since: 2.50
*/
-
void
g_log_variant (const gchar *log_domain,
GLogLevelFlags log_level,
/**
* g_log_structured_array:
- * @log_level: log level, either from #GLogLevelFlags, or a user-defined
+ * @log_level: log level, either from [type@GLib.LogLevelFlags], or a user-defined
* level
* @fields: (array length=n_fields): key–value pairs of structured data to add
* to the log message
* @n_fields: number of elements in the @fields array
*
- * Log a message with structured data. The message will be passed through to the
- * log writer set by the application using g_log_set_writer_func(). If the
- * message is fatal (i.e. its log level is %G_LOG_LEVEL_ERROR), the program will
+ * Log a message with structured data.
+ *
+ * The message will be passed through to the log writer set by the application
+ * using [func@GLib.log_set_writer_func]. If the
+ * message is fatal (i.e. its log level is [flags@GLib.LogLevelFlags.LEVEL_ERROR]), the program will
* be aborted at the end of this function.
*
- * See g_log_structured() for more documentation.
+ * See [func@GLib.log_structured] for more documentation.
*
* This assumes that @log_level is already present in @fields (typically as the
* `PRIORITY` field).
/**
* g_log_set_writer_func:
- * @func: log writer function, which must not be %NULL
+ * @func: log writer function, which must not be `NULL`
* @user_data: (closure func): user data to pass to @func
* @user_data_free: (destroy func): function to free @user_data once it’s
- * finished with, if non-%NULL
+ * finished with, if non-`NULL`
*
* Set a writer function which will be called to format and write out each log
- * message. Each program should set a writer function, or the default writer
- * (g_log_writer_default()) will be used.
+ * message.
+ *
+ * Each program should set a writer function, or the default writer
+ * ([func@GLib.log_writer_default]) will be used.
*
* Libraries **must not** call this function — only programs are allowed to
* install a writer function, as there must be a single, central point where
* g_log_writer_supports_color:
* @output_fd: output file descriptor to check
*
- * Check whether the given @output_fd file descriptor supports ANSI color
- * escape sequences. If so, they can safely be used when formatting log
- * messages.
+ * Check whether the given @output_fd file descriptor supports
+ * [ANSI color escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code).
+ *
+ * If so, they can safely be used when formatting log messages.
*
- * Returns: %TRUE if ANSI color escapes are supported, %FALSE otherwise
+ * Returns: `TRUE` if ANSI color escapes are supported, `FALSE` otherwise
* Since: 2.50
*/
gboolean
#endif
}
+#ifdef HAVE_SYSLOG_H
+static gboolean syslog_opened = FALSE;
+#ifndef __linux__
+G_LOCK_DEFINE_STATIC (syslog_opened);
+#endif
+#endif
+
#if defined(__linux__) && !defined(__BIONIC__)
static int journal_fd = -1;
* systemd journal, or something else (like a log file or `stdout` or
* `stderr`).
*
- * Invalid file descriptors are accepted and return %FALSE, which allows for
+ * Invalid file descriptors are accepted and return `FALSE`, which allows for
* the following construct without needing any additional error handling:
- * |[<!-- language="C" -->
- * is_journald = g_log_writer_is_journald (fileno (stderr));
- * ]|
+ * ```c
+ * is_journald = g_log_writer_is_journald (fileno (stderr));
+ * ```
*
- * Returns: %TRUE if @output_fd points to the journal, %FALSE otherwise
+ * Returns: `TRUE` if @output_fd points to the journal, `FALSE` otherwise
* Since: 2.50
*/
gboolean
/**
* g_log_writer_format_fields:
- * @log_level: log level, either from #GLogLevelFlags, or a user-defined
+ * @log_level: log level, either from [type@GLib.LogLevelFlags], or a user-defined
* level
* @fields: (array length=n_fields): key–value pairs of structured data forming
* the log message
* @n_fields: number of elements in the @fields array
- * @use_color: %TRUE to use ANSI color escape sequences when formatting the
- * message, %FALSE to not
+ * @use_color: `TRUE` to use
+ * [ANSI color escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code)
+ * when formatting the message, `FALSE` to not
*
* Format a structured log message as a string suitable for outputting to the
- * terminal (or elsewhere). This will include the values of all fields it knows
+ * terminal (or elsewhere).
+ *
+ * This will include the values of all fields it knows
* how to interpret, which includes `MESSAGE` and `GLIB_DOMAIN` (see the
- * documentation for g_log_structured()). It does not include values from
+ * documentation for [func@GLib.log_structured]). It does not include values from
* unknown fields.
*
* The returned string does **not** have a trailing new-line character. It is
return g_string_free (gstring, FALSE);
}
+/**
+ * g_log_writer_syslog:
+ * @log_level: log level, either from [type@GLib.LogLevelFlags], or a user-defined
+ * level
+ * @fields: (array length=n_fields): key–value pairs of structured data forming
+ * the log message
+ * @n_fields: number of elements in the @fields array
+ * @user_data: user data passed to [func@GLib.log_set_writer_func]
+ *
+ * Format a structured log message and send it to the syslog daemon. Only fields
+ * which are understood by this function are included in the formatted string
+ * which is printed.
+ *
+ * Log facility will be defined via the SYSLOG_FACILITY field and accepts the following
+ * values: "auth", "daemon", and "user". If SYSLOG_FACILITY is not specified, LOG_USER
+ * facility will be used.
+ *
+ * This is suitable for use as a [type@GLib.LogWriterFunc].
+ *
+ * If syslog is not supported, this function is still defined, but will always
+ * return [enum@GLib.LogWriterOutput.UNHANDLED].
+ *
+ * Returns: [enum@GLib.LogWriterOutput.HANDLED] on success, [enum@GLib.LogWriterOutput.UNHANDLED] otherwise
+ * Since: 2.80
+ */
+GLogWriterOutput
+g_log_writer_syslog (GLogLevelFlags log_level,
+ const GLogField *fields,
+ gsize n_fields,
+ gpointer user_data)
+{
+#ifdef HAVE_SYSLOG_H
+ gsize i;
+ const char *message = NULL;
+ const char *log_domain = NULL;
+ int syslog_facility = 0;
+ int syslog_level;
+ gssize message_length = -1;
+ gssize log_domain_length = -1;
+ GString *gstring;
+
+ g_return_val_if_fail (fields != NULL, G_LOG_WRITER_UNHANDLED);
+ g_return_val_if_fail (n_fields > 0, G_LOG_WRITER_UNHANDLED);
+
+/* As not all man pages provide sufficient information about the thread safety
+ * of the openlog() routine or even describe alternative routines like logopen_r()
+ * intended for multi-threaded applications, use locking on non-Linux platforms till
+ * the situation can be cleared. See the following links for more information:
+ * FreeBSD: https://man.freebsd.org/cgi/man.cgi?query=openlog
+ * NetBSD: https://man.netbsd.org/openlog.3
+ * POSIX: https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/openlog.html#
+ */
+#ifndef __linux__
+ G_LOCK (syslog_opened);
+#endif
+
+ if (!syslog_opened)
+ {
+ openlog (NULL, 0, 0);
+ syslog_opened = TRUE;
+ }
+
+#ifndef __linux__
+ G_UNLOCK (syslog_opened);
+#endif
+
+ for (i = 0; i < n_fields; i++)
+ {
+ const GLogField *field = &fields[i];
+
+ if (g_strcmp0 (field->key, "MESSAGE") == 0)
+ {
+ message = field->value;
+ message_length = field->length;
+ }
+ else if (g_strcmp0 (field->key, "GLIB_DOMAIN") == 0)
+ {
+ log_domain = field->value;
+ log_domain_length = field->length;
+ }
+ else if (g_strcmp0 (field->key, "SYSLOG_FACILITY") == 0)
+ {
+ syslog_facility = str_to_syslog_facility (field->value);
+ }
+ }
+
+ gstring = g_string_new (NULL);
+
+ if (log_domain != NULL)
+ {
+ g_string_append_len (gstring, log_domain, log_domain_length);
+ g_string_append (gstring, ": ");
+ }
+
+ g_string_append_len (gstring, message, message_length);
+
+ syslog_level = atoi (log_level_to_priority (log_level));
+ syslog (syslog_level | syslog_facility, "%s", gstring->str);
+
+ g_string_free (gstring, TRUE);
+
+ return G_LOG_WRITER_HANDLED;
+#else
+ return G_LOG_WRITER_UNHANDLED;
+#endif /* HAVE_SYSLOG_H */
+}
+
/* Enable support for the journal if we're on a recent enough Linux */
#if defined(__linux__) && !defined(__BIONIC__) && defined(HAVE_MKOSTEMP) && defined(O_CLOEXEC)
#define ENABLE_JOURNAL_SENDV
/**
* g_log_writer_journald:
- * @log_level: log level, either from #GLogLevelFlags, or a user-defined
+ * @log_level: log level, either from [type@GLib.LogLevelFlags], or a user-defined
* level
* @fields: (array length=n_fields): key–value pairs of structured data forming
* the log message
* @n_fields: number of elements in the @fields array
- * @user_data: user data passed to g_log_set_writer_func()
+ * @user_data: user data passed to [func@GLib.log_set_writer_func]
*
* Format a structured log message and send it to the systemd journal as a set
- * of key–value pairs. All fields are sent to the journal, but if a field has
+ * of key–value pairs.
+ *
+ * All fields are sent to the journal, but if a field has
* length zero (indicating program-specific data) then only its key will be
* sent.
*
- * This is suitable for use as a #GLogWriterFunc.
+ * This is suitable for use as a [type@GLib.LogWriterFunc].
*
* If GLib has been compiled without systemd support, this function is still
- * defined, but will always return %G_LOG_WRITER_UNHANDLED.
+ * defined, but will always return [enum@GLib.LogWriterOutput.UNHANDLED].
*
- * Returns: %G_LOG_WRITER_HANDLED on success, %G_LOG_WRITER_UNHANDLED otherwise
+ * Returns: [enum@GLib.LogWriterOutput.HANDLED] on success, [enum@GLib.LogWriterOutput.UNHANDLED] otherwise
* Since: 2.50
*/
GLogWriterOutput
/**
* g_log_writer_standard_streams:
- * @log_level: log level, either from #GLogLevelFlags, or a user-defined
+ * @log_level: log level, either from [type@GLib.LogLevelFlags], or a user-defined
* level
* @fields: (array length=n_fields): key–value pairs of structured data forming
* the log message
* @n_fields: number of elements in the @fields array
- * @user_data: user data passed to g_log_set_writer_func()
+ * @user_data: user data passed to [func@GLib.log_set_writer_func]
*
* Format a structured log message and print it to either `stdout` or `stderr`,
- * depending on its log level. %G_LOG_LEVEL_INFO and %G_LOG_LEVEL_DEBUG messages
+ * depending on its log level.
+ *
+ * [flags@GLib.LogLevelFlags.LEVEL_INFO] and [flags@GLib.LogLevelFlags.LEVEL_DEBUG] messages
* are sent to `stdout`, or to `stderr` if requested by
- * g_log_writer_default_set_use_stderr();
+ * [func@GLib.log_writer_default_set_use_stderr];
* all other log levels are sent to `stderr`. Only fields
* which are understood by this function are included in the formatted string
* which is printed.
*
- * If the output stream supports ANSI color escape sequences, they will be used
- * in the output.
+ * If the output stream supports
+ * [ANSI color escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code),
+ * they will be used in the output.
*
* A trailing new-line character is added to the log message when it is printed.
*
- * This is suitable for use as a #GLogWriterFunc.
+ * This is suitable for use as a [type@GLib.LogWriterFunc].
*
- * Returns: %G_LOG_WRITER_HANDLED on success, %G_LOG_WRITER_UNHANDLED otherwise
+ * Returns: [enum@GLib.LogWriterOutput.HANDLED] on success,
+ * [enum@GLib.LogWriterOutput.UNHANDLED] otherwise
* Since: 2.50
*/
GLogWriterOutput
* g_log_writer_default_set_debug_domains:
* @domains: (nullable) (transfer none): `NULL`-terminated array with domains to be printed.
* `NULL` or an array with no values means none. Array with a single value `"all"` means all.
-
+ *
* Reset the list of domains to be logged, that might be initially set by the
- * `G_MESSAGES_DEBUG` environment variable. This function is thread-safe.
+ * `G_MESSAGES_DEBUG` environment variable.
+ *
+ * This function is thread-safe.
*
* Since: 2.80
*/
/**
* g_log_writer_default_would_drop:
* @log_domain: (nullable): log domain
- * @log_level: log level, either from #GLogLevelFlags, or a user-defined
+ * @log_level: log level, either from [type@GLib.LogLevelFlags], or a user-defined
* level
*
- * Check whether g_log_writer_default() and g_log_default_handler() would
+ * Check whether [func@GLib.log_writer_default] and [func@GLib.log_default_handler] would
* ignore a message with the given domain and level.
*
- * As with g_log_default_handler(), this function drops debug and informational
+ * As with [func@GLib.log_default_handler], this function drops debug and informational
* messages unless their log domain (or `all`) is listed in the space-separated
- * `G_MESSAGES_DEBUG` environment variable, or by g_log_writer_default_set_debug_domains().
+ * `G_MESSAGES_DEBUG` environment variable, or by [func@GLib.log_writer_default_set_debug_domains].
*
* This can be used when implementing log writers with the same filtering
* behaviour as the default, but a different destination or output format:
*
- * |[<!-- language="C" -->
- * if (g_log_writer_default_would_drop (log_level, log_domain))
- * return G_LOG_WRITER_HANDLED;
+ * ```c
+ * if (g_log_writer_default_would_drop (log_level, log_domain))
+ * return G_LOG_WRITER_HANDLED;
* ]|
*
* or to skip an expensive computation if it is only needed for a debugging
* message, and `G_MESSAGES_DEBUG` is not set:
*
- * |[<!-- language="C" -->
- * if (!g_log_writer_default_would_drop (G_LOG_LEVEL_DEBUG, G_LOG_DOMAIN))
- * {
- * gchar *result = expensive_computation (my_object);
+ * ```c
+ * if (!g_log_writer_default_would_drop (G_LOG_LEVEL_DEBUG, G_LOG_DOMAIN))
+ * {
+ * g_autofree gchar *result = expensive_computation (my_object);
*
- * g_debug ("my_object result: %s", result);
- * g_free (result);
- * }
- * ]|
+ * g_debug ("my_object result: %s", result);
+ * }
+ * ```
*
- * Returns: %TRUE if the log message would be dropped by GLib's
- * default log handlers
+ * Returns: `TRUE` if the log message would be dropped by GLib’s
+ * default log handlers
* Since: 2.68
*/
gboolean
/**
* g_log_writer_default:
- * @log_level: log level, either from #GLogLevelFlags, or a user-defined
+ * @log_level: log level, either from [type@GLib.LogLevelFlags], or a user-defined
* level
* @fields: (array length=n_fields): key–value pairs of structured data forming
* the log message
* @n_fields: number of elements in the @fields array
- * @user_data: user data passed to g_log_set_writer_func()
+ * @user_data: user data passed to [func@GLib.log_set_writer_func]
*
* Format a structured log message and output it to the default log destination
- * for the platform. On Linux, this is typically the systemd journal, falling
+ * for the platform.
+ *
+ * On Linux, this is typically the systemd journal, falling
* back to `stdout` or `stderr` if running from the terminal or if output is
* being redirected to a file.
*
* future. Distributors of GLib may modify this function to impose their own
* (documented) platform-specific log writing policies.
*
- * This is suitable for use as a #GLogWriterFunc, and is the default writer used
- * if no other is set using g_log_set_writer_func().
+ * This is suitable for use as a [type@GLib.LogWriterFunc], and is the default writer used
+ * if no other is set using [func@GLib.log_set_writer_func].
*
- * As with g_log_default_handler(), this function drops debug and informational
+ * As with [func@GLib.log_default_handler], this function drops debug and informational
* messages unless their log domain (or `all`) is listed in the space-separated
- * `G_MESSAGES_DEBUG` environment variable, or set at runtime by g_log_writer_default_set_debug_domains().
+ * `G_MESSAGES_DEBUG` environment variable, or set at runtime by [func@GLib.log_writer_default_set_debug_domains].
*
- * g_log_writer_default() uses the mask set by g_log_set_always_fatal() to
- * determine which messages are fatal. When using a custom writer func instead it is
+ * [func@GLib.log_writer_default] uses the mask set by [func@GLib.log_set_always_fatal] to
+ * determine which messages are fatal. When using a custom writer function instead it is
* up to the writer function to determine which log messages are fatal.
*
- * Returns: %G_LOG_WRITER_HANDLED on success, %G_LOG_WRITER_UNHANDLED otherwise
+ * Returns: [enum@GLib.LogWriterOutput.HANDLED] on success,
+ * [enum@GLib.LogWriterOutput.UNHANDLED] otherwise
* Since: 2.50
*/
GLogWriterOutput
*
* Return whether debug output from the GLib logging system is enabled.
*
- * Note that this should not be used to conditionalise calls to g_debug() or
- * other logging functions; it should only be used from %GLogWriterFunc
+ * Note that this should not be used to conditionalise calls to [func@GLib.debug] or
+ * other logging functions; it should only be used from [type@GLib.LogWriterFunc]
* implementations.
*
* Note also that the value of this does not depend on `G_MESSAGES_DEBUG`, nor
- * g_log_writer_default_set_debug_domains(); see the docs for g_log_set_debug_enabled().
+ * [func@GLib.log_writer_default_set_debug_domains]; see the docs for [func@GLib.log_set_debug_enabled].
*
- * Returns: %TRUE if debug output is enabled, %FALSE otherwise
+ * Returns: `TRUE` if debug output is enabled, `FALSE` otherwise
*
* Since: 2.72
*/
/**
* g_log_set_debug_enabled:
- * @enabled: %TRUE to enable debug output, %FALSE otherwise
+ * @enabled: `TRUE` to enable debug output, `FALSE` otherwise
*
* Enable or disable debug output from the GLib logging system for all domains.
+ *
* This value interacts disjunctively with `G_MESSAGES_DEBUG` and
- * g_log_writer_default_set_debug_domains() — if any of them would allow
+ * [func@GLib.log_writer_default_set_debug_domains] — if any of them would allow
* a debug message to be outputted, it will be.
*
* Note that this should not be used from within library code to enable debug
* @pretty_function: function containing the assertion
* @expression: (nullable): expression which failed
*
- * Internal function used to print messages from the public g_return_if_fail()
- * and g_return_val_if_fail() macros.
+ * Internal function used to print messages from the public [func@GLib.return_if_fail]
+ * and [func@GLib.return_val_if_fail] macros.
*/
void
g_return_if_fail_warning (const char *log_domain,
* @func: function containing the warning
* @warnexpr: (nullable): expression which failed
*
- * Internal function used to print messages from the public g_warn_if_reached()
- * and g_warn_if_fail() macros.
+ * Internal function used to print messages from the public [func@GLib.warn_if_reached]
+ * and [func@GLib.warn_if_fail] macros.
*/
void
g_warn_message (const char *domain,
* g_test_expect_message:
* @log_domain: (nullable): the log domain of the message
* @log_level: the log level of the message
- * @pattern: a glob-style [pattern][glib-Glob-style-pattern-matching]
+ * @pattern: a glob-style pattern (see [type@GLib.PatternSpec])
*
* Indicates that a message with the given @log_domain and @log_level,
- * with text matching @pattern, is expected to be logged. When this
- * message is logged, it will not be printed, and the test case will
+ * with text matching @pattern, is expected to be logged.
+ *
+ * When this message is logged, it will not be printed, and the test case will
* not abort.
*
- * This API may only be used with the old logging API (g_log() without
- * %G_LOG_USE_STRUCTURED defined). It will not work with the structured logging
- * API. See [Testing for Messages][testing-for-messages].
+ * This API may only be used with the old logging API ([func@GLib.log] without
+ * `G_LOG_USE_STRUCTURED` defined). It will not work with the structured logging
+ * API. See [Testing for Messages](logging.html#testing-for-messages).
*
- * Use g_test_assert_expected_messages() to assert that all
+ * Use [func@GLib.test_assert_expected_messages] to assert that all
* previously-expected messages have been seen and suppressed.
*
* You can call this multiple times in a row, if multiple messages are
* expected as a result of a single call. (The messages must appear in
- * the same order as the calls to g_test_expect_message().)
+ * the same order as the calls to [func@GLib.test_expect_message].)
*
* For example:
*
- * |[<!-- language="C" -->
- * // g_main_context_push_thread_default() should fail if the
- * // context is already owned by another thread.
- * g_test_expect_message (G_LOG_DOMAIN,
- * G_LOG_LEVEL_CRITICAL,
- * "assertion*acquired_context*failed");
- * g_main_context_push_thread_default (bad_context);
- * g_test_assert_expected_messages ();
- * ]|
+ * ```c
+ * // g_main_context_push_thread_default() should fail if the
+ * // context is already owned by another thread.
+ * g_test_expect_message (G_LOG_DOMAIN,
+ * G_LOG_LEVEL_CRITICAL,
+ * "assertion*acquired_context*failed");
+ * g_main_context_push_thread_default (bad_context);
+ * g_test_assert_expected_messages ();
+ * ```
*
- * Note that you cannot use this to test g_error() messages, since
- * g_error() intentionally never returns even if the program doesn't
- * abort; use g_test_trap_subprocess() in this case.
+ * Note that you cannot use this to test [func@GLib.error] messages, since
+ * [func@GLib.error] intentionally never returns even if the program doesn’t
+ * abort; use [func@GLib.test_trap_subprocess] in this case.
*
- * If messages at %G_LOG_LEVEL_DEBUG are emitted, but not explicitly
- * expected via g_test_expect_message() then they will be ignored.
+ * If messages at [flags@GLib.LogLevelFlags.LEVEL_DEBUG] are emitted, but not explicitly
+ * expected via [func@GLib.test_expect_message] then they will be ignored.
*
* Since: 2.34
*/
* g_test_assert_expected_messages:
*
* Asserts that all messages previously indicated via
- * g_test_expect_message() have been seen and suppressed.
+ * [func@GLib.test_expect_message] have been seen and suppressed.
*
- * This API may only be used with the old logging API (g_log() without
- * %G_LOG_USE_STRUCTURED defined). It will not work with the structured logging
- * API. See [Testing for Messages][testing-for-messages].
+ * This API may only be used with the old logging API ([func@GLib.log] without
+ * `G_LOG_USE_STRUCTURED` defined). It will not work with the structured logging
+ * API. See [Testing for Messages](logging.html#testing-for-messages).
*
- * If messages at %G_LOG_LEVEL_DEBUG are emitted, but not explicitly
- * expected via g_test_expect_message() then they will be ignored.
+ * If messages at [flags@GLib.LogLevelFlags.LEVEL_DEBUG] are emitted, but not explicitly
+ * expected via [func@GLib.test_expect_message] then they will be ignored.
*
* Since: 2.34
*/
/**
* g_log_default_handler:
- * @log_domain: (nullable): the log domain of the message, or %NULL for the
- * default "" application domain
+ * @log_domain: (nullable): the log domain of the message, or `NULL` for the
+ * default `""` application domain
* @log_level: the level of the message
* @message: (nullable): the message
- * @unused_data: (nullable): data passed from g_log() which is unused
+ * @unused_data: (nullable): data passed from [func@GLib.log] which is unused
*
- * The default log handler set up by GLib; g_log_set_default_handler()
+ * The default log handler set up by GLib; [func@GLib.log_set_default_handler]
* allows to install an alternate default log handler.
+ *
* This is used if no log handler has been set for the particular log
- * domain and log level combination. It outputs the message to stderr
- * or stdout and if the log level is fatal it calls G_BREAKPOINT(). It automatically
+ * domain and log level combination. It outputs the message to `stderr`
+ * or `stdout` and if the log level is fatal it calls [func@GLib.BREAKPOINT]. It automatically
* prints a new-line character after the message, so one does not need to be
* manually included in @message.
*
* The behavior of this log handler can be influenced by a number of
* environment variables:
*
- * - `G_MESSAGES_PREFIXED`: A :-separated list of log levels for which
- * messages should be prefixed by the program name and PID of the
- * application.
+ * - `G_MESSAGES_PREFIXED`: A `:`-separated list of log levels for which
+ * messages should be prefixed by the program name and PID of the
+ * application.
+ * - `G_MESSAGES_DEBUG`: A space-separated list of log domains for
+ * which debug and informational messages are printed. By default
+ * these messages are not printed. If you need to set the allowed
+ * domains at runtime, use [func@GLib.log_writer_default_set_debug_domains].
*
- * - `G_MESSAGES_DEBUG`: A space-separated list of log domains for
- * which debug and informational messages are printed. By default
- * these messages are not printed. If you need to set the allowed
- * domains at runtime, use g_log_writer_default_set_debug_domains().
- *
- * stderr is used for levels %G_LOG_LEVEL_ERROR, %G_LOG_LEVEL_CRITICAL,
- * %G_LOG_LEVEL_WARNING and %G_LOG_LEVEL_MESSAGE. stdout is used for
- * the rest, unless stderr was requested by
- * g_log_writer_default_set_use_stderr().
+ * `stderr` is used for levels [flags@GLib.LogLevelFlags.LEVEL_ERROR],
+ * [flags@GLib.LogLevelFlags.LEVEL_CRITICAL], [flags@GLib.LogLevelFlags.LEVEL_WARNING] and
+ * [flags@GLib.LogLevelFlags.LEVEL_MESSAGE]. `stdout` is used for
+ * the rest, unless `stderr` was requested by
+ * [func@GLib.log_writer_default_set_use_stderr].
*
* This has no effect if structured logging is enabled; see
- * [Using Structured Logging][using-structured-logging].
+ * [Using Structured Logging](logging.html#using-structured-logging).
*/
void
g_log_default_handler (const gchar *log_domain,
/**
* g_set_print_handler:
- * @func: (nullable): the new print handler or %NULL to
+ * @func: (nullable): the new print handler or `NULL` to
* reset to the default
*
* Sets the print handler to @func, or resets it to the
- * default GLib handler if %NULL.
+ * default GLib handler if `NULL`.
*
- * Any messages passed to g_print() will be output via
+ * Any messages passed to [func@GLib.print] will be output via
* the new handler. The default handler outputs
- * the encoded message to stdout. By providing your own handler
+ * the encoded message to `stdout`. By providing your own handler
* you can redirect the output, to a GTK widget or a
* log file for example.
*
* Since 2.76 this functions always returns a valid
- * #GPrintFunc, and never returns %NULL. If no custom
+ * [type@GLib.PrintFunc], and never returns `NULL`. If no custom
* print handler was set, it will return the GLib
* default print handler and that can be re-used to
- * decorate its output and/or to write to stderr
- * in all platforms. Before GLib 2.76, this was %NULL.
+ * decorate its output and/or to write to `stderr`
+ * in all platforms. Before GLib 2.76, this was `NULL`.
*
* Returns: (not nullable): the old print handler
*/
/**
* g_print:
- * @format: the message format. See the printf() documentation
+ * @format: the message format. See the `printf()` documentation
* @...: the parameters to insert into the format string
*
* Outputs a formatted message via the print handler.
- * The default print handler outputs the encoded message to stdout, without
+ *
+ * The default print handler outputs the encoded message to `stdout`, without
* appending a trailing new-line character. Typically, @format should end with
* its own new-line character.
*
- * g_print() should not be used from within libraries for debugging
+ * This function should not be used from within libraries for debugging
* messages, since it may be redirected by applications to special
* purpose message windows or even files. Instead, libraries should
- * use g_log(), g_log_structured(), or the convenience macros g_message(),
- * g_warning() and g_error().
+ * use [func@GLib.log], [func@GLib.log_structured], or the convenience macros
+ * [func@GLib.message], [func@GLib.warning] and [func@GLib.error].
*/
void
g_print (const gchar *format,
/**
* g_set_printerr_handler:
- * @func: (nullable): he new error message handler or %NULL
- * to reset to the default
+ * @func: (nullable): he new error message handler or `NULL`
+ * to reset to the default
*
* Sets the handler for printing error messages to @func,
- * or resets it to the default GLib handler if %NULL.
+ * or resets it to the default GLib handler if `NULL`.
*
- * Any messages passed to g_printerr() will be output via
+ * Any messages passed to [func@GLib.printerr] will be output via
* the new handler. The default handler outputs the encoded
- * message to stderr. By providing your own handler you can
+ * message to `stderr`. By providing your own handler you can
* redirect the output, to a GTK widget or a log file for
* example.
*
* Since 2.76 this functions always returns a valid
- * #GPrintFunc, and never returns %NULL. If no custom error
+ * [type@GLib.PrintFunc], and never returns `NULL`. If no custom error
* print handler was set, it will return the GLib default
* error print handler and that can be re-used to decorate
- * its output and/or to write to stderr in all platforms.
- * Before GLib 2.76, this was %NULL.
+ * its output and/or to write to `stderr` in all platforms.
+ * Before GLib 2.76, this was `NULL`.
*
* Returns: (not nullable): the old error message handler
*/
/**
* g_printerr:
- * @format: the message format. See the printf() documentation
+ * @format: the message format. See the `printf()` documentation
* @...: the parameters to insert into the format string
*
* Outputs a formatted message via the error message handler.
- * The default handler outputs the encoded message to stderr, without appending
+ *
+ * The default handler outputs the encoded message to `stderr`, without appending
* a trailing new-line character. Typically, @format should end with its own
* new-line character.
*
- * g_printerr() should not be used from within libraries.
- * Instead g_log() or g_log_structured() should be used, or the convenience
- * macros g_message(), g_warning() and g_error().
+ * This function should not be used from within libraries.
+ * Instead [func@GLib.log] or [func@GLib.log_structured] should be used, or the convenience
+ * macros [func@GLib.message], [func@GLib.warning] and [func@GLib.error].
*/
void
g_printerr (const gchar *format,
/**
* g_printf_string_upper_bound:
- * @format: the format string. See the printf() documentation
+ * @format: the format string. See the `printf()` documentation
* @args: the parameters to be inserted into the format string
*
* Calculates the maximum space needed to store the output
- * of the sprintf() function.
+ * of the `sprintf()` function.
*
* If @format or @args are invalid, `0` is returned. This could happen if, for
* example, @format contains an `%lc` or `%ls` placeholder and @args contains a
gsize n_fields,
gboolean use_color);
+GLIB_AVAILABLE_IN_2_80
+GLogWriterOutput g_log_writer_syslog (GLogLevelFlags log_level,
+ const GLogField *fields,
+ gsize n_fields,
+ gpointer user_data);
GLIB_AVAILABLE_IN_2_50
GLogWriterOutput g_log_writer_journald (GLogLevelFlags log_level,
const GLogField *fields,
/**
* g_set_str: (skip)
- * @str_pointer: (inout) (not optional) (nullable): a pointer to either a string or %NULL
- * @new_str: (nullable): a string to assign to @str_pointer, or %NULL
+ * @str_pointer: (inout) (not optional) (nullable): a pointer to either
+ * a string or `NULL`
+ * @new_str: (nullable): a string to assign to @str_pointer
*
- * Updates a pointer to a string to a copy of @new_str. The previous string
- * pointed to by @str_pointer will be freed with g_free().
+ * Updates a pointer to a string to a copy of @new_str and returns whether the
+ * string was changed.
*
- * @str_pointer must not be %NULL, but can point to a %NULL value.
+ * If @new_str matches the previous string, this function is a no-op. If
+ * @new_str is different, a copy of it will be assigned to @str_pointer and
+ * the previous string pointed to by @str_pointer will be freed with
+ * [func@GLib.free].
+ *
+ * @str_pointer must not be `NULL`, but can point to a `NULL` value.
*
* One convenient usage of this function is in implementing property settings:
- * |[
- * void
- * foo_set_bar (Foo *foo,
- * const char *new_bar)
- * {
- * g_return_if_fail (IS_FOO (foo));
+ * ```C
+ * void
+ * foo_set_bar (Foo *foo,
+ * const char *new_bar)
+ * {
+ * g_return_if_fail (IS_FOO (foo));
*
- * if (g_set_str (&foo->bar, new_bar))
- * g_object_notify (foo, "bar");
- * }
- * ]|
+ * if (g_set_str (&foo->bar, new_bar))
+ * g_object_notify (foo, "bar");
+ * }
+ * ```
*
- * Returns: %TRUE if the value of @str_pointer changed, %FALSE otherwise
+ * Returns: true if the value of @str_pointer changed, false otherwise
*
* Since: 2.76
*/
#ifdef G_OS_UNIX
#include <unistd.h>
+
+#if defined(THREADS_POSIX) && defined(HAVE_PTHREAD_GETAFFINITY_NP)
+#include <pthread.h>
#endif
+#endif /* G_OS_UNIX */
#ifndef G_OS_WIN32
#include <sys/time.h>
* %G_LOCK_DEFINE.
*/
+/**
+ * G_AUTO_LOCK:
+ * @name: the name of the lock
+ *
+ * Works like [func@GLib.MUTEX_AUTO_LOCK], but for a lock defined with
+ * [func@GLib.LOCK_DEFINE].
+ *
+ * This feature is only supported on GCC and clang. This macro is not defined on
+ * other compilers and should not be used in programs that are intended to be
+ * portable to those compilers.
+ *
+ * Since: 2.80
+ */
+
/* GMutex Documentation {{{1 ------------------------------------------ */
/**
if (count > 0)
return count;
+#elif defined(_SC_NPROCESSORS_ONLN) && defined(THREADS_POSIX) && defined(HAVE_PTHREAD_GETAFFINITY_NP)
+ {
+ int idx;
+ int ncores = MIN (sysconf (_SC_NPROCESSORS_ONLN), CPU_SETSIZE);
+ cpu_set_t cpu_mask;
+ CPU_ZERO (&cpu_mask);
+
+ int af_count = 0;
+ int err = pthread_getaffinity_np (pthread_self (), sizeof (cpu_mask), &cpu_mask);
+ if (!err)
+ for (idx = 0; idx < ncores && idx < CPU_SETSIZE; ++idx)
+ af_count += CPU_ISSET (idx, &cpu_mask);
+
+ int count = (af_count > 0) ? af_count : ncores;
+ return count;
+ }
#elif defined(_SC_NPROCESSORS_ONLN)
{
int count;
# define G_TRYLOCK(name) g_mutex_trylock (&G_LOCK_NAME (name))
#endif /* !G_DEBUG_LOCKS */
+#ifdef g_autoptr
+#define G_AUTO_LOCK(name) G_MUTEX_AUTO_LOCK (&G_LOCK_NAME (name), g__##name##_locker)
+#endif /* g_autoptr */
+
GLIB_AVAILABLE_IN_2_32
GThread * g_thread_ref (GThread *thread);
GLIB_AVAILABLE_IN_2_32
*
* // Code with mutex locked here
*
- * if (cond)
+ * if (condition)
* // No need to unlock
* return;
*
* }
* ]|
*
+ * Note that it is common for the declared variable to not be used in the scope,
+ * which causes some compilers to warn. That can be avoided by using
+ * `G_GNUC_UNUSED` or, since 2.80, [func@GLib.MUTEX_AUTO_LOCK].
+ *
* Returns: a #GMutexLocker
* Since: 2.44
*/
}
/**
+ * G_MUTEX_AUTO_LOCK:
+ * @mutex: a [type@GLib.Mutex]
+ * @var: a variable name to be declared
+ *
+ * Declare a [type@GLib.MutexLocker] variable with `g_autoptr()` and lock the
+ * mutex. The mutex will be unlocked automatically when leaving the scope. The
+ * variable is declared with `G_GNUC_UNUSED` to avoid compiler warning if it is
+ * not used in the scope.
+ *
+ * This feature is only supported on GCC and clang. This macro is not defined on
+ * other compilers and should not be used in programs that are intended to be
+ * portable to those compilers.
+ *
+ * Note that this should be used in a place where it is allowed to declare a
+ * variable, which could be before any statement in the case
+ * `-Wdeclaration-after-statement` is used, or C standard prior to C99.
+ *
+ * ```c
+ * {
+ * G_MUTEX_AUTO_LOCK (&obj->mutex, locker);
+ *
+ * obj->stuff_with_lock ();
+ * if (condition)
+ * {
+ * // No need to unlock
+ * return;
+ * }
+ *
+ * // Unlock before end of scope
+ * g_clear_pointer (&locker, g_mutex_locker_free);
+ * obj->stuff_without_lock ();
+ * }
+ * ```
+ *
+ * Since: 2.80.0
+ */
+#ifdef g_autoptr
+#define G_MUTEX_AUTO_LOCK(mutex, var) \
+ GLIB_AVAILABLE_MACRO_IN_2_80 g_autoptr (GMutexLocker) \
+ G_GNUC_UNUSED var = g_mutex_locker_new (mutex)
+#endif /* g_autoptr */
+
+/**
* GRecMutexLocker:
*
* Opaque type. See g_rec_mutex_locker_new() for details.
*
* // Code with rec_mutex locked here
*
- * if (cond)
+ * if (condition)
* // No need to unlock
* return;
*
* }
* ]|
*
+ * Note that it is common for the declared variable to not be used in the scope,
+ * which causes some compilers to warn. That can be avoided by using
+ * `G_GNUC_UNUSED` or, since 2.80, [func@GLib.REC_MUTEX_AUTO_LOCK].
+ *
* Returns: a #GRecMutexLocker
* Since: 2.60
*/
G_GNUC_END_IGNORE_DEPRECATIONS
/**
+ * G_REC_MUTEX_AUTO_LOCK:
+ * @mutex: a [type@GLib.RecMutex]
+ * @var: a variable name to be declared
+ *
+ * Declare a [type@GLib.RecMutexLocker] variable with `g_autoptr()` and lock the
+ * mutex. The mutex will be unlocked automatically when leaving the scope. The
+ * variable is declared with `G_GNUC_UNUSED` to avoid compiler warning if it is
+ * not used in the scope.
+ *
+ * This feature is only supported on GCC and clang. This macro is not defined on
+ * other compilers and should not be used in programs that are intended to be
+ * portable to those compilers.
+ *
+ * Note that this should be used in a place where it is allowed to declare a
+ * variable, which could be before any statement in the case
+ * `-Wdeclaration-after-statement` is used, or C standard prior to C99.
+ *
+ * ```c
+ * {
+ * G_REC_MUTEX_AUTO_LOCK (&obj->rec_mutex, locker);
+ *
+ * obj->stuff_with_lock ();
+ * if (condition)
+ * {
+ * // No need to unlock
+ * return;
+ * }
+ *
+ * // Unlock before end of scope
+ * g_clear_pointer (&locker, g_rec_mutex_locker_free);
+ * obj->stuff_without_lock ();
+ * }
+ * ```
+ *
+ * Since: 2.80.0
+ */
+#ifdef g_autoptr
+#define G_REC_MUTEX_AUTO_LOCK(mutex, var) \
+ GLIB_AVAILABLE_MACRO_IN_2_80 g_autoptr (GRecMutexLocker) \
+ G_GNUC_UNUSED var = g_rec_mutex_locker_new (mutex)
+#endif /* g_autoptr */
+
+/**
* GRWLockWriterLocker:
*
* Opaque type. See g_rw_lock_writer_locker_new() for details.
* if (self->array == NULL)
* self->array = g_ptr_array_new ();
*
- * if (cond)
+ * if (condition)
* // No need to unlock
* return;
*
* }
* ]|
*
+ * Note that it is common for the declared variable to not be used in the scope,
+ * which causes some compilers to warn. That can be avoided by using
+ * `G_GNUC_UNUSED` or, since 2.80, [func@GLib.RW_LOCK_WRITER_AUTO_LOCK].
+ *
* Returns: a #GRWLockWriterLocker
* Since: 2.62
*/
G_GNUC_END_IGNORE_DEPRECATIONS
/**
+ * G_RW_LOCK_WRITER_AUTO_LOCK:
+ * @mutex: a [type@GLib.RWLock]
+ * @var: a variable name to be declared
+ *
+ * Declare a [type@GLib.RWLockWriterLocker] variable with `g_autoptr()` and lock
+ * for writing. The mutex will be unlocked automatically when leaving the scope.
+ * The variable is declared with `G_GNUC_UNUSED` to avoid compiler warning if it
+ * is not used in the scope.
+ *
+ * This feature is only supported on GCC and clang. This macro is not defined on
+ * other compilers and should not be used in programs that are intended to be
+ * portable to those compilers.
+ *
+ * Note that this should be used in a place where it is allowed to declare a
+ * variable, which could be before any statement in the case
+ * `-Wdeclaration-after-statement` is used, or C standard prior to C99.
+ *
+ * ```c
+ * {
+ * G_RW_LOCK_WRITER_AUTO_LOCK (&obj->rw_lock, locker);
+ *
+ * obj->stuff_with_lock ();
+ * if (condition)
+ * {
+ * // No need to unlock
+ * return;
+ * }
+ *
+ * // Unlock before end of scope
+ * g_clear_pointer (&locker, g_rw_lock_writer_locker_free);
+ * obj->stuff_without_lock ();
+ * }
+ * ```
+ *
+ * Since: 2.80.0
+ */
+#ifdef g_autoptr
+#define G_RW_LOCK_WRITER_AUTO_LOCK(mutex, var) \
+ GLIB_AVAILABLE_MACRO_IN_2_80 g_autoptr (GRWLockWriterLocker) \
+ G_GNUC_UNUSED var = g_rw_lock_writer_locker_new (mutex)
+#endif /* g_autoptr */
+
+/**
* GRWLockReaderLocker:
*
* Opaque type. See g_rw_lock_reader_locker_new() for details.
}
G_GNUC_END_IGNORE_DEPRECATIONS
+/**
+ * G_RW_LOCK_READER_AUTO_LOCK:
+ * @mutex: a [type@GLib.RWLock]
+ * @var: a variable name to be declared
+ *
+ * Declare a [type@GLib.RWLockReaderLocker] variable with `g_autoptr()` and lock
+ * for reading. The mutex will be unlocked automatically when leaving the scope.
+ * The variable is declared with `G_GNUC_UNUSED` to avoid compiler warning if it
+ * is not used in the scope.
+ *
+ * This feature is only supported on GCC and clang. This macro is not defined on
+ * other compilers and should not be used in programs that are intended to be
+ * portable to those compilers.
+ *
+ * Note that this should be used in a place where it is allowed to declare a
+ * variable, which could be before any statement in the case
+ * `-Wdeclaration-after-statement` is used, or C standard prior to C99.
+ *
+ * ```c
+ * {
+ * G_RW_LOCK_READER_AUTO_LOCK (&obj->rw_lock, locker);
+ *
+ * obj->stuff_with_lock ();
+ * if (condition)
+ * {
+ * // No need to unlock
+ * return;
+ * }
+ *
+ * // Unlock before end of scope
+ * g_clear_pointer (&locker, g_rw_lock_reader_locker_free);
+ * obj->stuff_without_lock ();
+ * }
+ * ```
+ *
+ * Since: 2.80.0
+ */
+#ifdef g_autoptr
+#define G_RW_LOCK_READER_AUTO_LOCK(mutex, var) \
+ GLIB_AVAILABLE_MACRO_IN_2_80 g_autoptr (GRWLockReaderLocker) \
+ G_GNUC_UNUSED var = g_rw_lock_reader_locker_new (mutex)
+#endif /* g_autoptr */
+
G_END_DECLS
#endif /* __G_THREAD_H__ */
/* posix_memalign() requires the alignment to be a multiple of
* sizeof(void*), and a power of 2. See g_variant_type_info_query() for
- * details on the alignment format. */
- if (posix_memalign (&aligned_data, MAX (sizeof (void *), alignment + 1),
+ * details on the alignment format.
+ *
+ * While calling posix_memalign() with aligned_size==0 is safe on glibc,
+ * POSIX specifies that the behaviour is implementation-defined, so avoid
+ * that and leave aligned_data==NULL in that case.
+ * See https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html */
+ if (aligned_size != 0 &&
+ posix_memalign (&aligned_data, MAX (sizeof (void *), alignment + 1),
aligned_size) != 0)
g_error ("posix_memalign failed");
*
* A single #GVariant is parsed from the content of @text.
*
- * The format is described [here][gvariant-text].
+ * The format is described [here](gvariant-text-format.html).
*
* The memory at @limit will never be accessed and the parser behaves as
* if the character at @limit is the nul terminator. This has the
*
* In the event that the parsing is successful, the resulting #GVariant
* is returned. It is never floating, and must be freed with
- * g_variant_unref().
+ * [method@GLib.Variant.unref].
*
* In case of any error, %NULL will be returned. If @error is non-%NULL
* then it will be set to reflect the error that occurred.
*
- * Officially, the language understood by the parser is "any string
- * produced by g_variant_print()".
+ * Officially, the language understood by the parser is “any string
+ * produced by [method@GLib.Variant.print]”. This explicitly includes
+ * `g_variant_print()`’s annotated types like `int64 -1000`.
*
* There may be implementation specific restrictions on deeply nested values,
* which would result in a %G_VARIANT_PARSE_ERROR_RECURSION error. #GVariant is
*
* `GVariant` is useful whenever data needs to be serialized, for example when
* sending method parameters in D-Bus, or when saving settings using
- * [class@Gio.Settings].
+ * [`GSettings`](../gio/class.Settings.html).
*
* When creating a new `GVariant`, you pass the data you want to store in it
* along with a string representing the type of data you wish to pass to it.
* `GVariant` instances can be sent over D-Bus. See [type@GLib.VariantType] for
* exceptions. (However, `GVariant`’s serialization format is not the same
* as the serialization format of a D-Bus message body: use
- * [class@Gio.DBusMessage], in the GIO library, for those.)
+ * [GDBusMessage](../gio/class.DBusMessage.html), in the GIO library, for those.)
*
* For space-efficiency, the `GVariant` serialization format does not
* automatically include the variant’s length, type or endianness,
* This is similar to how instances of abstract classes may not
* directly exist in other type systems, but instances of their
* non-abstract subtypes may. For example, in GTK, no object that has
- * the type of [class@Gtk.Widget] can exist (since [class@Gtk.Widget] is an
- * abstract class), but a [class@Gtk.Window] can certainly be instantiated, and
- * you would say that the [class@Gtk.Window] is a [class@Gtk.Widget] (since
- * [class@Gtk.Window] is a subclass of [class@Gtk.Widget]).
+ * the type of [`GtkWidget`](https://docs.gtk.org/gtk4/class.Widget.html) can
+ * exist (since `GtkWidget` is an abstract class), but a [`GtkWindow`](https://docs.gtk.org/gtk4/class.Window.html)
+ * can certainly be instantiated, and you would say that a `GtkWindow` is a
+ * `GtkWidget` (since `GtkWindow` is a subclass of `GtkWidget`).
*
* Two types may not be compared by value; use [method@GLib.VariantType.equal]
* or [method@GLib.VariantType.is_subtype_of] May be copied using
* `a(aa(ui)(qna{ya(yd)}))`. In order to not hit memory limits,
* [type@GLib.Variant] imposes a limit on recursion depth of 65 nested
* containers. This is the limit in the D-Bus specification (64) plus one to
- * allow a [class@Gio.DBusMessage] to be nested in a top-level tuple.
+ * allow a [`GDBusMessage`](../gio/class.DBusMessage.html) to be nested in
+ * a top-level tuple.
*
* The meaning of each of the characters is as follows:
*
defining our own version of the g_bit_*lock symbols
*/
#undef g_pointer_bit_lock
+ #undef g_pointer_bit_lock_and_get
#undef g_pointer_bit_trylock
#undef g_pointer_bit_unlock
-
- #define g_bit_lock _emufutex_g_bit_lock
- #define g_bit_trylock _emufutex_g_bit_trylock
- #define g_bit_unlock _emufutex_g_bit_unlock
- #define g_pointer_bit_lock _emufutex_g_pointer_bit_lock
- #define g_pointer_bit_trylock _emufutex_g_pointer_bit_trylock
- #define g_pointer_bit_unlock _emufutex_g_pointer_bit_unlock
+ #undef g_pointer_bit_unlock_and_set
+
+ #define g_bit_lock _emufutex_g_bit_lock
+ #define g_bit_trylock _emufutex_g_bit_trylock
+ #define g_bit_unlock _emufutex_g_bit_unlock
+ #define g_pointer_bit_lock _emufutex_g_pointer_bit_lock
+ #define g_pointer_bit_lock_and_get _emufutex_g_pointer_bit_lock_and_get
+ #define g_pointer_bit_trylock _emufutex_g_pointer_bit_trylock
+ #define g_pointer_bit_unlock _emufutex_g_pointer_bit_unlock
+ #define g_pointer_bit_lock_mask_ptr _emufutex_g_pointer_bit_lock_mask_ptr
+ #define g_pointer_bit_unlock_and_set _emufutex_g_pointer_bit_unlock_and_set
#define G_BIT_LOCK_FORCE_FUTEX_EMULATION
GPtrArray *ptr_array, *ptr_array2, *ptr_array3;
gsize i;
const gsize array_size = 100;
- gsize *array_test = g_malloc (array_size * sizeof (gsize));
+ guintptr *array_test = g_malloc (array_size * sizeof (guintptr));
/* Initializing array_test */
for (i = 0; i < array_size; i++)
g_ptr_array_extend_and_steal (ptr_array, ptr_array2);
for (i = 0; i < array_size; i++)
- g_assert_cmpuint (*((gsize *) g_ptr_array_index (ptr_array, i)), ==, i);
+ g_assert_cmpuint (*((guintptr *) g_ptr_array_index (ptr_array, i)), ==, i);
g_ptr_array_free (ptr_array, TRUE);
g_ptr_array_extend_and_steal (ptr_array, ptr_array2);
for (i = 0; i < array_size; i++)
- g_assert_cmpuint (*((gsize *) g_ptr_array_index (ptr_array, i)), ==, i);
+ g_assert_cmpuint (*((guintptr *) g_ptr_array_index (ptr_array, i)), ==, i);
g_assert_cmpuint (ptr_array3->len, ==, 0);
g_assert_null (ptr_array3->pdata);
if (TRUE)
{
+ /* val is unused in this scope but compiler should not warn. */
+ G_MUTEX_AUTO_LOCK (&mutex, val);
+ }
+
+ if (TRUE)
+ {
g_autoptr(GMutexLocker) val = g_mutex_locker_new (&mutex);
g_assert_nonnull (val);
if (TRUE)
{
+ /* val is unused in this scope but compiler should not warn. */
+ G_REC_MUTEX_AUTO_LOCK (&rec_mutex, val);
+ }
+
+ if (TRUE)
+ {
g_autoptr(GRecMutexLocker) val = g_rec_mutex_locker_new (&rec_mutex);
g_autoptr(GRecMutexLocker) other = NULL;
if (TRUE)
{
+ /* val is unused in this scope but compiler should not warn. */
+ G_RW_LOCK_WRITER_AUTO_LOCK (&lock, val);
+ }
+
+ if (TRUE)
+ {
+ /* val is unused in this scope but compiler should not warn. */
+ G_RW_LOCK_READER_AUTO_LOCK (&lock, val);
+ }
+
+ if (TRUE)
+ {
g_autoptr(GRWLockWriterLocker) val = g_rw_lock_writer_locker_new (&lock);
g_assert_nonnull (val);
g_rw_lock_clear (&lock);
}
+G_LOCK_DEFINE (test_g_auto_lock);
+
+static void
+test_g_auto_lock (void)
+{
+ GThread *thread;
+
+ if (TRUE)
+ {
+ G_AUTO_LOCK (test_g_auto_lock);
+
+ /* Verify that the mutex is actually locked */
+ thread = g_thread_new ("mutex locked", mutex_locked_thread, &G_LOCK_NAME (test_g_auto_lock));
+ g_thread_join (thread);
+ }
+
+ /* Verify that the mutex is unlocked again */
+ thread = g_thread_new ("mutex unlocked", mutex_unlocked_thread, &G_LOCK_NAME (test_g_auto_lock));
+ g_thread_join (thread);
+}
+
static void
test_g_cond (void)
{
g_test_add_func ("/autoptr/g_mutex_locker", test_g_mutex_locker);
g_test_add_func ("/autoptr/g_rec_mutex_locker", test_g_rec_mutex_locker);
g_test_add_func ("/autoptr/g_rw_lock_lockers", test_g_rw_lock_lockers);
+ g_test_add_func ("/autoptr/g_auto_lock", test_g_auto_lock);
g_test_add_func ("/autoptr/g_cond", test_g_cond);
g_test_add_func ("/autoptr/g_timer", test_g_timer);
g_test_add_func ("/autoptr/g_time_zone", test_g_time_zone);
TEST_PRINTF ("%%", "%");
TEST_PRINTF ("%", "");
TEST_PRINTF ("%9", NULL);
-#ifdef HAVE_LANGINFO_ERA
+#if defined(HAVE_LANGINFO_ERA) && (G_BYTE_ORDER == G_LITTLE_ENDIAN || GLIB_SIZEOF_VOID_P == 4)
TEST_PRINTF ("%Ec", "平成21年10月24日 00時00分00秒");
TEST_PRINTF ("%EC", "平成");
TEST_PRINTF ("%Ex", "平成21年10月24日");
static void
test_date_time_eras_japan (void)
{
-#ifdef HAVE_LANGINFO_ERA
+#if defined(HAVE_LANGINFO_ERA) && (G_BYTE_ORDER == G_LITTLE_ENDIAN || GLIB_SIZEOF_VOID_P == 4)
gchar *oldlocale;
oldlocale = g_strdup (setlocale (LC_ALL, NULL));
static void
test_date_time_eras_thailand (void)
{
-#ifdef HAVE_LANGINFO_ERA
+#if defined(HAVE_LANGINFO_ERA) && (G_BYTE_ORDER == G_LITTLE_ENDIAN || GLIB_SIZEOF_VOID_P == 4)
gchar *oldlocale;
oldlocale = g_strdup (setlocale (LC_ALL, NULL));
static gpointer
align_malloc (gsize size)
{
- gpointer mem;
+ gpointer mem = NULL;
#ifdef HAVE_POSIX_MEMALIGN
/* posix_memalign() requires the alignment to be a multiple of
- * sizeof(void*), and a power of 2. */
- if (posix_memalign (&mem, MAX (sizeof (void *), 8), size))
+ * sizeof(void*), and a power of 2.
+ * Calling it with size==0 leads to implementation-defined behaviour, so avoid
+ * that and guarantee to return NULL. */
+ if (size != 0 &&
+ posix_memalign (&mem, MAX (sizeof (void *), 8), size))
g_error ("posix_memalign failed");
#else
/* NOTE: there may be platforms that lack posix_memalign() and also
* have malloc() that returns non-8-aligned. if so, we need to try
* harder here.
*/
- mem = malloc (size);
+ mem = (size > 0) ? malloc (size) : NULL;
#endif
return mem;
g_bytes_unref (bytes2);
g_variant_unref (a);
g_variant_unref (tuple);
+
+ bytes = g_bytes_new (NULL, 0);
+ a = g_variant_new_from_bytes (G_VARIANT_TYPE ("as"), bytes, TRUE);
+ g_bytes_unref (bytes);
+ g_assert_cmpuint (g_variant_n_children (a), ==, 0);
+ g_variant_unref (a);
}
typedef struct {
static void
test_error (void)
{
+ /* We expect this test to abort, so try to avoid that creating a coredump */
+ g_test_disable_crash_reporting ();
+
g_error ("This should error out\nBecause it's just\nwrong!");
}
g_thread_join (thread);
}
+#if defined(_SC_NPROCESSORS_ONLN) && defined(THREADS_POSIX) && defined(HAVE_PTHREAD_GETAFFINITY_NP)
+static gpointer
+thread7_func (gpointer data)
+{
+ int idx = 0, err;
+ int ncores = sysconf (_SC_NPROCESSORS_ONLN);
+
+ cpu_set_t old_mask, new_mask;
+
+ err = pthread_getaffinity_np (pthread_self (), sizeof (old_mask), &old_mask);
+ CPU_ZERO (&new_mask);
+ g_assert_cmpint (err, ==, 0);
+
+ for (idx = 0; idx < ncores; ++idx)
+ if (CPU_ISSET (idx, &old_mask))
+ {
+ CPU_SET (idx, &new_mask);
+ break;
+ }
+
+ err = pthread_setaffinity_np (pthread_self (), sizeof (new_mask), &new_mask);
+ g_assert_cmpint (err, ==, 0);
+
+ int af_count = g_get_num_processors ();
+ return GINT_TO_POINTER (af_count);
+}
+#endif
+
+static void
+test_thread7 (void)
+{
+#if defined(_SC_NPROCESSORS_ONLN) && defined(THREADS_POSIX) && defined(HAVE_PTHREAD_GETAFFINITY_NP)
+ GThread *thread = g_thread_new ("mask", thread7_func, NULL);
+ gpointer result = g_thread_join (thread);
+
+ g_assert_cmpint (GPOINTER_TO_INT (result), ==, 1);
+#else
+ g_test_skip ("Skipping because pthread_getaffinity_np() is not available");
+#endif
+}
+
int
main (int argc, char *argv[])
{
g_test_add_func ("/thread/thread4", test_thread4);
g_test_add_func ("/thread/thread5", test_thread5);
g_test_add_func ("/thread/thread6", test_thread6);
+ g_test_add_func ("/thread/thread7", test_thread7);
return g_test_run ();
}
* @error: #GError.
*
* Opens a module. If the module has already been opened, its reference count
- * is incremented. If not, the module is searched in the following order:
+ * is incremented. If not, the module is searched using @file_name.
+ *
+ * Since 2.76, the search order/behavior is as follows:
*
* 1. If @file_name exists as a regular file, it is used as-is; else
* 2. If @file_name doesn't have the correct suffix and/or prefix for the
* libtool archive is parsed to find the actual file name, and that is
* used.
*
- * At the end of all this, we would have a file path that we can access on
- * disk, and it is opened as a module. If not, @file_name is opened as
- * a module verbatim in the hopes that the system implementation will somehow
- * be able to access it.
+ * If, at the end of all this, we have a file path that we can access on disk,
+ * it is opened as a module. If not, @file_name is attempted to be opened as a
+ * module verbatim in the hopes that the system implementation will somehow be
+ * able to access it. If that is not possible, %NULL is returned.
+ *
+ * Note that this behaviour was different prior to 2.76, but there is some
+ * overlap in functionality. If backwards compatibility is an issue, kindly
+ * consult earlier #GModule documentation for the prior search order/behavior
+ * of @file_name.
*
* Returns: a #GModule on success, or %NULL on failure
*
gmodule_sources = [gmodule_c, gmodule_visibility_h, gmodule_deprecated_c]
-if host_system == 'windows'
+if host_system == 'windows' and glib_build_shared
gmodule_win_rc = configure_file(
input: 'gmodule.rc.in',
output: 'gmodule.rc',
G_DEFINE_BOXED_TYPE (GBookmarkFile, g_bookmark_file, g_bookmark_file_copy, g_bookmark_file_free)
G_DEFINE_BOXED_TYPE (GHmac, g_hmac, g_hmac_ref, g_hmac_unref)
G_DEFINE_BOXED_TYPE (GDir, g_dir, g_dir_ref, g_dir_unref)
+G_DEFINE_BOXED_TYPE (GRand, g_rand, g_rand_copy, g_rand_free)
G_DEFINE_BOXED_TYPE (GMainLoop, g_main_loop, g_main_loop_ref, g_main_loop_unref)
G_DEFINE_BOXED_TYPE (GMainContext, g_main_context, g_main_context_ref, g_main_context_unref)
#define G_DEFINE_ENUM_TYPE(TypeName, type_name, ...) \
GType \
type_name ## _get_type (void) { \
- static gsize g_define_type__static = 0; \
- if (g_once_init_enter (&g_define_type__static)) { \
+ static _g_type_once_init_type g_define_type__static = 0; \
+ if (_g_type_once_init_enter (&g_define_type__static)) { \
static const GEnumValue enum_values[] = { \
__VA_ARGS__ , \
{ 0, NULL, NULL }, \
}; \
GType g_define_type = g_enum_register_static (g_intern_static_string (#TypeName), enum_values); \
- g_once_init_leave (&g_define_type__static, g_define_type); \
+ _g_type_once_init_leave (&g_define_type__static, g_define_type); \
} \
return g_define_type__static; \
} \
#define G_DEFINE_FLAGS_TYPE(TypeName, type_name, ...) \
GType \
type_name ## _get_type (void) { \
- static gsize g_define_type__static = 0; \
- if (g_once_init_enter (&g_define_type__static)) { \
+ static _g_type_once_init_type g_define_type__static = 0; \
+ if (_g_type_once_init_enter (&g_define_type__static)) { \
static const GFlagsValue flags_values[] = { \
__VA_ARGS__ , \
{ 0, NULL, NULL }, \
}; \
GType g_define_type = g_flags_register_static (g_intern_static_string (#TypeName), flags_values); \
- g_once_init_leave (&g_define_type__static, g_define_type); \
+ _g_type_once_init_leave (&g_define_type__static, g_define_type); \
} \
return g_define_type__static; \
} \
#define G_TYPE_DIR (g_dir_get_type ())
/**
+ * G_TYPE_RAND:
+ *
+ * The #GType for a boxed type holding a #GRand.
+ *
+ * Since: 2.80
+ */
+#define G_TYPE_RAND (g_rand_get_type ())
+
+/**
* G_TYPE_STRV_BUILDER:
*
* The #GType for a boxed type holding a #GStrvBuilder.
GOBJECT_AVAILABLE_IN_2_80
GType g_dir_get_type (void) G_GNUC_CONST;
GOBJECT_AVAILABLE_IN_2_80
+GType g_rand_get_type (void) G_GNUC_CONST;
+GOBJECT_AVAILABLE_IN_2_80
GType g_strv_builder_get_type (void) G_GNUC_CONST;
GOBJECT_DEPRECATED_FOR('G_TYPE_VARIANT')
PROP_NONE
};
+#define _OPTIONAL_BIT_LOCK 3
+
#define OPTIONAL_FLAG_IN_CONSTRUCTION (1 << 0)
#define OPTIONAL_FLAG_HAS_SIGNAL_HANDLER (1 << 1) /* Set if object ever had a signal handler */
#define OPTIONAL_FLAG_HAS_NOTIFY_HANDLER (1 << 2) /* Same, specifically for "notify" */
+#define OPTIONAL_FLAG_LOCK (1 << 3) /* _OPTIONAL_BIT_LOCK */
+
+/* We use g_bit_lock(), which only supports one lock per integer.
+ *
+ * Hence, while we have locks for different purposes, internally they all
+ * map to the same bit lock (_OPTIONAL_BIT_LOCK).
+ *
+ * This means you cannot take a lock (object_bit_lock()) while already holding
+ * another bit lock. There is an assert against that with G_ENABLE_DEBUG
+ * builds (_object_bit_is_locked).
+ *
+ * In the past, we had different global mutexes per topic. Now we have one
+ * per-object mutex for several topics. The downside is that we are not as
+ * parallel as possible. The alternative would be to add individual locking
+ * integers to GObjectPrivate. But increasing memory usage for more parallelism
+ * (per-object!) is not worth it. */
+#define OPTIONAL_BIT_LOCK_WEAK_REFS 1
+#define OPTIONAL_BIT_LOCK_NOTIFY 2
+#define OPTIONAL_BIT_LOCK_TOGGLE_REFS 3
+#define OPTIONAL_BIT_LOCK_CLOSURE_ARRAY 4
-#if SIZEOF_INT == 4 && GLIB_SIZEOF_VOID_P == 8
-#define HAVE_OPTIONAL_FLAGS
+#if SIZEOF_INT == 4 && GLIB_SIZEOF_VOID_P >= 8
+#define HAVE_OPTIONAL_FLAGS_IN_GOBJECT 1
+#else
+#define HAVE_OPTIONAL_FLAGS_IN_GOBJECT 0
+#endif
+
+/* For now we only create a private struct if we don't have optional flags in
+ * GObject. Currently we don't need it otherwise. In the future we might
+ * always add a private struct. */
+#define HAVE_PRIVATE (!HAVE_OPTIONAL_FLAGS_IN_GOBJECT)
+
+#if HAVE_PRIVATE
+typedef struct {
+#if !HAVE_OPTIONAL_FLAGS_IN_GOBJECT
+ guint optional_flags; /* (atomic) */
+#endif
+} GObjectPrivate;
+
+static int GObject_private_offset;
#endif
typedef struct
/*< private >*/
guint ref_count; /* (atomic) */
-#ifdef HAVE_OPTIONAL_FLAGS
+#if HAVE_OPTIONAL_FLAGS_IN_GOBJECT
guint optional_flags; /* (atomic) */
#endif
GData *qdata;
};
/* --- variables --- */
-G_LOCK_DEFINE_STATIC (closure_array_mutex);
-G_LOCK_DEFINE_STATIC (weak_refs_mutex);
-G_LOCK_DEFINE_STATIC (toggle_refs_mutex);
static GQuark quark_closure_array = 0;
-static GQuark quark_weak_refs = 0;
static GQuark quark_weak_notifies = 0;
static GQuark quark_toggle_refs = 0;
static GQuark quark_notify_queue;
-#ifndef HAVE_OPTIONAL_FLAGS
-static GQuark quark_in_construction;
-#endif
static GParamSpecPool *pspec_pool = NULL;
static gulong gobject_signals[LAST_SIGNAL] = { 0, };
static guint (*floating_flag_handler) (GObject*, gint) = object_floating_flag_handler;
static GQuark quark_weak_locations = 0;
static GRWLock weak_locations_lock;
-G_LOCK_DEFINE_STATIC(notify_lock);
+#if HAVE_PRIVATE
+G_ALWAYS_INLINE static inline GObjectPrivate *
+g_object_get_instance_private (GObject *object)
+{
+ return G_STRUCT_MEMBER_P (object, GObject_private_offset);
+}
+#endif
+
+G_ALWAYS_INLINE static inline guint *
+object_get_optional_flags_p (GObject *object)
+{
+#if HAVE_OPTIONAL_FLAGS_IN_GOBJECT
+ return &(((GObjectReal *) object)->optional_flags);
+#else
+ return &g_object_get_instance_private (object)->optional_flags;
+#endif
+}
+
+#if defined(G_ENABLE_DEBUG) && defined(G_THREAD_LOCAL)
+/* Using this thread-local global is sufficient to guard the per-object
+ * locking, because while the current thread holds a lock on one object, it
+ * never calls out to another object (because doing so would would be prone to
+ * deadlock). */
+static G_THREAD_LOCAL guint _object_bit_is_locked;
+#endif
+
+static void
+object_bit_lock (GObject *object, guint lock_bit)
+{
+#if defined(G_ENABLE_DEBUG) && defined(G_THREAD_LOCAL)
+ /* all object_bit_lock() really use the same bit/mutex. The "lock_bit" argument
+ * only exists for asserting. object_bit_lock() is not re-entrant (also not with
+ * different "lock_bit" values). */
+ g_assert (lock_bit > 0);
+ g_assert (_object_bit_is_locked == 0);
+ _object_bit_is_locked = lock_bit;
+#endif
+
+ g_bit_lock ((gint *) object_get_optional_flags_p (object), _OPTIONAL_BIT_LOCK);
+}
+
+static void
+object_bit_unlock (GObject *object, guint lock_bit)
+{
+#if defined(G_ENABLE_DEBUG) && defined(G_THREAD_LOCAL)
+ /* All lock_bit map to the same mutex. We cannot use two different locks on
+ * the same integer. Assert against that. */
+ g_assert (lock_bit > 0);
+ g_assert (_object_bit_is_locked == lock_bit);
+ _object_bit_is_locked = 0;
+#endif
+
+ g_bit_unlock ((gint *) object_get_optional_flags_p (object), _OPTIONAL_BIT_LOCK);
+}
/* --- functions --- */
static void
{
GObjectNotifyQueue *nqueue;
- G_LOCK(notify_lock);
+ object_bit_lock (object, OPTIONAL_BIT_LOCK_NOTIFY);
nqueue = g_datalist_id_get_data (&object->qdata, quark_notify_queue);
if (!nqueue)
{
nqueue->freeze_count++;
out:
- G_UNLOCK(notify_lock);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_NOTIFY);
return nqueue;
}
GSList *slist;
guint n_pspecs = 0;
- G_LOCK(notify_lock);
+ object_bit_lock (object, OPTIONAL_BIT_LOCK_NOTIFY);
if (!nqueue)
{
/* Just make sure we never get into some nasty race condition */
if (G_UNLIKELY (!nqueue || nqueue->freeze_count == 0))
{
- G_UNLOCK (notify_lock);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_NOTIFY);
g_critical ("%s: property-changed notification for %s(%p) is not frozen",
G_STRFUNC, G_OBJECT_TYPE_NAME (object), object);
return;
nqueue->freeze_count--;
if (nqueue->freeze_count)
{
- G_UNLOCK (notify_lock);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_NOTIFY);
return;
}
}
g_datalist_id_set_data (&object->qdata, quark_notify_queue, NULL);
- G_UNLOCK(notify_lock);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_NOTIFY);
if (n_pspecs)
{
GParamSpec *pspec,
gboolean in_init)
{
- G_LOCK(notify_lock);
+ object_bit_lock (object, OPTIONAL_BIT_LOCK_NOTIFY);
if (!nqueue)
{
{
/* We don't have a notify queue and are not in_init. The event
* is not to be queued. The caller will dispatch directly. */
- G_UNLOCK (notify_lock);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_NOTIFY);
return FALSE;
}
nqueue->n_pspecs++;
}
- G_UNLOCK(notify_lock);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_NOTIFY);
return TRUE;
}
# endif /* G_HAS_CONSTRUCTORS */
}
#endif /* G_ENABLE_DEBUG */
+
+#if HAVE_PRIVATE
+ GObject_private_offset =
+ g_type_add_instance_private (G_TYPE_OBJECT, sizeof (GObjectPrivate));
+#endif
}
/* Initialize the global GParamSpecPool; this function needs to be
/* read the comment about typedef struct CArray; on why not to change this quark */
quark_closure_array = g_quark_from_static_string ("GObject-closure-array");
- quark_weak_refs = g_quark_from_static_string ("GObject-weak-references");
quark_weak_notifies = g_quark_from_static_string ("GObject-weak-notifies");
quark_weak_locations = g_quark_from_static_string ("GObject-weak-locations");
quark_toggle_refs = g_quark_from_static_string ("GObject-toggle-references");
quark_notify_queue = g_quark_from_static_string ("GObject-notify-queue");
-#ifndef HAVE_OPTIONAL_FLAGS
- quark_in_construction = g_quark_from_static_string ("GObject-in-construction");
-#endif
g_object_init_pspec_pool ();
* implement an interface implement all properties for that interface
*/
g_type_add_interface_check (NULL, object_interface_check_properties);
+
+#if HAVE_PRIVATE
+ g_type_class_adjust_private_offset (class, &GObject_private_offset);
+#endif
}
/* Sinks @pspec if it’s a floating ref. */
static inline guint
object_get_optional_flags (GObject *object)
{
-#ifdef HAVE_OPTIONAL_FLAGS
- GObjectReal *real = (GObjectReal *)object;
- return (guint)g_atomic_int_get (&real->optional_flags);
-#else
- return 0;
-#endif
+ return g_atomic_int_get (object_get_optional_flags_p (object));
}
-/* Variant of object_get_optional_flags for when
- * we know that we have exclusive access (during
- * construction)
- */
-static inline guint
-object_get_optional_flags_X (GObject *object)
-{
-#ifdef HAVE_OPTIONAL_FLAGS
- GObjectReal *real = (GObjectReal *)object;
- return real->optional_flags;
-#else
- return 0;
-#endif
-}
-
-#ifdef HAVE_OPTIONAL_FLAGS
static inline void
object_set_optional_flags (GObject *object,
guint flags)
{
- GObjectReal *real = (GObjectReal *)object;
- g_atomic_int_or (&real->optional_flags, flags);
-}
-
-/* Variant for when we have exclusive access
- * (during construction)
- */
-static inline void
-object_set_optional_flags_X (GObject *object,
- guint flags)
-{
- GObjectReal *real = (GObjectReal *)object;
- real->optional_flags |= flags;
+ g_atomic_int_or (object_get_optional_flags_p (object), flags);
}
-/* Variant for when we have exclusive access
- * (during construction)
- */
static inline void
-object_unset_optional_flags_X (GObject *object,
+object_unset_optional_flags (GObject *object,
guint flags)
{
- GObjectReal *real = (GObjectReal *)object;
- real->optional_flags &= ~flags;
+ g_atomic_int_and (object_get_optional_flags_p (object), ~flags);
}
-#endif
gboolean
_g_object_has_signal_handler (GObject *object)
{
-#ifdef HAVE_OPTIONAL_FLAGS
return (object_get_optional_flags (object) & OPTIONAL_FLAG_HAS_SIGNAL_HANDLER) != 0;
-#else
- return TRUE;
-#endif
}
static inline gboolean
_g_object_has_notify_handler (GObject *object)
{
-#ifdef HAVE_OPTIONAL_FLAGS
return CLASS_NEEDS_NOTIFY (G_OBJECT_GET_CLASS (object)) ||
(object_get_optional_flags (object) & OPTIONAL_FLAG_HAS_NOTIFY_HANDLER) != 0;
-#else
- return TRUE;
-#endif
-}
-
-static inline gboolean
-_g_object_has_notify_handler_X (GObject *object)
-{
-#ifdef HAVE_OPTIONAL_FLAGS
- return CLASS_NEEDS_NOTIFY (G_OBJECT_GET_CLASS (object)) ||
- (object_get_optional_flags_X (object) & OPTIONAL_FLAG_HAS_NOTIFY_HANDLER) != 0;
-#else
- return TRUE;
-#endif
}
void
_g_object_set_has_signal_handler (GObject *object,
guint signal_id)
{
-#ifdef HAVE_OPTIONAL_FLAGS
guint flags = OPTIONAL_FLAG_HAS_SIGNAL_HANDLER;
if (signal_id == gobject_signals[NOTIFY])
flags |= OPTIONAL_FLAG_HAS_NOTIFY_HANDLER;
object_set_optional_flags (object, flags);
-#endif
}
static inline gboolean
object_in_construction (GObject *object)
{
-#ifdef HAVE_OPTIONAL_FLAGS
return (object_get_optional_flags (object) & OPTIONAL_FLAG_IN_CONSTRUCTION) != 0;
-#else
- return g_datalist_id_get_data (&object->qdata, quark_in_construction) != NULL;
-#endif
}
static inline void
set_object_in_construction (GObject *object)
{
-#ifdef HAVE_OPTIONAL_FLAGS
- object_set_optional_flags_X (object, OPTIONAL_FLAG_IN_CONSTRUCTION);
-#else
- g_datalist_id_set_data (&object->qdata, quark_in_construction, object);
-#endif
+ object_set_optional_flags (object, OPTIONAL_FLAG_IN_CONSTRUCTION);
}
static inline void
unset_object_in_construction (GObject *object)
{
-#ifdef HAVE_OPTIONAL_FLAGS
- object_unset_optional_flags_X (object, OPTIONAL_FLAG_IN_CONSTRUCTION);
-#else
- g_datalist_id_set_data (&object->qdata, quark_in_construction, NULL);
-#endif
+ object_unset_optional_flags (object, OPTIONAL_FLAG_IN_CONSTRUCTION);
}
static void
{
g_signal_handlers_destroy (object);
- /* GWeakRef and weak_pointer do not call into user code. Clear those first
- * so that user code can rely on the state of their weak pointers.
- */
- g_datalist_id_set_data (&object->qdata, quark_weak_refs, NULL);
- g_datalist_id_set_data (&object->qdata, quark_weak_locations, NULL);
-
/* GWeakNotify and GClosure can call into user code */
g_datalist_id_set_data (&object->qdata, quark_weak_notifies, NULL);
g_datalist_id_set_data (&object->qdata, quark_closure_array, NULL);
TRACE (GOBJECT_OBJECT_DISPOSE(object,G_TYPE_FROM_INSTANCE(object), 0));
G_OBJECT_GET_CLASS (object)->dispose (object);
TRACE (GOBJECT_OBJECT_DISPOSE_END(object,G_TYPE_FROM_INSTANCE(object), 0));
+ g_datalist_id_remove_data (&object->qdata, quark_weak_locations);
g_object_unref (object);
}
g_object_notify_by_spec_internal (GObject *object,
GParamSpec *pspec)
{
-#ifdef HAVE_OPTIONAL_FLAGS
guint object_flags;
-#endif
gboolean needs_notify;
gboolean in_init;
param_spec_follow_override (&pspec);
-#ifdef HAVE_OPTIONAL_FLAGS
/* get all flags we need with a single atomic read */
object_flags = object_get_optional_flags (object);
needs_notify = ((object_flags & OPTIONAL_FLAG_HAS_NOTIFY_HANDLER) != 0) ||
CLASS_NEEDS_NOTIFY (G_OBJECT_GET_CLASS (object));
in_init = (object_flags & OPTIONAL_FLAG_IN_CONSTRUCTION) != 0;
-#else
- needs_notify = TRUE;
- in_init = object_in_construction (object);
-#endif
if (pspec != NULL && needs_notify)
{
if (CLASS_HAS_PROPS (class))
{
- if ((newly_constructed && _g_object_has_notify_handler_X (object)) ||
+ if ((newly_constructed && _g_object_has_notify_handler (object)) ||
_g_object_has_notify_handler (object))
{
/* This may or may not have been setup in g_object_init().
{
GSList *node;
- if (_g_object_has_notify_handler_X (object))
+ if (_g_object_has_notify_handler (object))
{
/* This may or may not have been setup in g_object_init().
* If it hasn't, we do it now.
g_return_if_fail (notify != NULL);
g_return_if_fail (g_atomic_int_get (&object->ref_count) >= 1);
- G_LOCK (weak_refs_mutex);
+ object_bit_lock (object, OPTIONAL_BIT_LOCK_WEAK_REFS);
wstack = g_datalist_id_remove_no_notify (&object->qdata, quark_weak_notifies);
if (wstack)
{
wstack->weak_refs[i].notify = notify;
wstack->weak_refs[i].data = data;
g_datalist_id_set_data_full (&object->qdata, quark_weak_notifies, wstack, weak_refs_notify);
- G_UNLOCK (weak_refs_mutex);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_WEAK_REFS);
}
/**
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (notify != NULL);
- G_LOCK (weak_refs_mutex);
+ object_bit_lock (object, OPTIONAL_BIT_LOCK_WEAK_REFS);
wstack = g_datalist_id_get_data (&object->qdata, quark_weak_notifies);
if (wstack)
{
break;
}
}
- G_UNLOCK (weak_refs_mutex);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_WEAK_REFS);
if (!found_one)
g_critical ("%s: couldn't find weak ref %p(%p)", G_STRFUNC, notify, data);
}
}
typedef struct {
- GObject *object;
guint n_toggle_refs;
struct {
GToggleNotify notify;
} toggle_refs[1]; /* flexible array */
} ToggleRefStack;
-static void
-toggle_refs_notify (GObject *object,
- gboolean is_last_ref)
+static GToggleNotify
+toggle_refs_get_notify_unlocked (GObject *object,
+ gpointer *out_data)
{
- ToggleRefStack tstack, *tstackptr;
+ ToggleRefStack *tstackptr;
- G_LOCK (toggle_refs_mutex);
- /* If another thread removed the toggle reference on the object, while
- * we were waiting here, there's nothing to notify.
- * So let's check again if the object has toggle reference and in case return.
- */
if (!OBJECT_HAS_TOGGLE_REF (object))
- {
- G_UNLOCK (toggle_refs_mutex);
- return;
- }
+ return NULL;
tstackptr = g_datalist_id_get_data (&object->qdata, quark_toggle_refs);
- tstack = *tstackptr;
- G_UNLOCK (toggle_refs_mutex);
- /* Reentrancy here is not as tricky as it seems, because a toggle reference
- * will only be notified when there is exactly one of them.
- */
- g_assert (tstack.n_toggle_refs == 1);
- tstack.toggle_refs[0].notify (tstack.toggle_refs[0].data, tstack.object, is_last_ref);
+ if (tstackptr->n_toggle_refs != 1)
+ {
+ g_critical ("Unexpected number of toggle-refs. g_object_add_toggle_ref() must be paired with g_object_remove_toggle_ref()");
+ return NULL;
+ }
+
+ *out_data = tstackptr->toggle_refs[0].data;
+ return tstackptr->toggle_refs[0].notify;
}
/**
* this reason, you should only ever use a toggle reference if there
* is important state in the proxy object.
*
+ * Note that if you unref the object on another thread, then @notify might
+ * still be invoked after g_object_remove_toggle_ref(), and the object argument
+ * might be a dangling pointer. If the object is destroyed on other threads,
+ * you must take care of that yourself.
+ *
+ * A g_object_add_toggle_ref() must be released with g_object_remove_toggle_ref().
+ *
* Since: 2.8
*/
void
g_object_ref (object);
- G_LOCK (toggle_refs_mutex);
+ object_bit_lock (object, OPTIONAL_BIT_LOCK_TOGGLE_REFS);
tstack = g_datalist_id_remove_no_notify (&object->qdata, quark_toggle_refs);
if (tstack)
{
else
{
tstack = g_renew (ToggleRefStack, NULL, 1);
- tstack->object = object;
tstack->n_toggle_refs = 1;
i = 0;
}
tstack->toggle_refs[i].data = data;
g_datalist_id_set_data_full (&object->qdata, quark_toggle_refs, tstack,
(GDestroyNotify)g_free);
- G_UNLOCK (toggle_refs_mutex);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_TOGGLE_REFS);
}
/**
* Removes a reference added with g_object_add_toggle_ref(). The
* reference count of the object is decreased by one.
*
+ * Note that if you unref the object on another thread, then @notify might
+ * still be invoked after g_object_remove_toggle_ref(), and the object argument
+ * might be a dangling pointer. If the object is destroyed on other threads,
+ * you must take care of that yourself.
+ *
* Since: 2.8
*/
void
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (notify != NULL);
- G_LOCK (toggle_refs_mutex);
+ object_bit_lock (object, OPTIONAL_BIT_LOCK_TOGGLE_REFS);
tstack = g_datalist_id_get_data (&object->qdata, quark_toggle_refs);
if (tstack)
{
tstack->toggle_refs[i] = tstack->toggle_refs[tstack->n_toggle_refs];
if (tstack->n_toggle_refs == 0)
- g_datalist_unset_flags (&object->qdata, OBJECT_HAS_TOGGLE_REF_FLAG);
+ {
+ g_datalist_unset_flags (&object->qdata, OBJECT_HAS_TOGGLE_REF_FLAG);
+ g_datalist_id_set_data_full (&object->qdata, quark_toggle_refs, NULL, NULL);
+ }
break;
}
}
- G_UNLOCK (toggle_refs_mutex);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_TOGGLE_REFS);
if (found_one)
g_object_unref (object);
g_critical ("%s: couldn't find toggle ref %p(%p)", G_STRFUNC, notify, data);
}
+/* Internal implementation of g_object_ref() which doesn't call out to user code.
+ * @out_toggle_notify and @out_toggle_data *must* be provided, and if non-`NULL`
+ * values are returned, then the caller *must* call that toggle notify function
+ * as soon as it is safe to do so. It may call (or be) user-provided code so should
+ * only be called once all locks are released. */
+static gpointer
+object_ref (GObject *object,
+ GToggleNotify *out_toggle_notify,
+ gpointer *out_toggle_data)
+{
+ GToggleNotify toggle_notify;
+ gpointer toggle_data;
+ gint old_ref;
+
+ old_ref = g_atomic_int_get (&object->ref_count);
+
+retry:
+ toggle_notify = NULL;
+ toggle_data = NULL;
+ if (old_ref > 1 && old_ref < G_MAXINT)
+ {
+ /* Fast-path. We have apparently more than 1 references already. No
+ * special handling for toggle references, just increment the ref count. */
+ if (!g_atomic_int_compare_and_exchange_full ((int *) &object->ref_count,
+ old_ref, old_ref + 1, &old_ref))
+ goto retry;
+ }
+ else if (old_ref == 1)
+ {
+ gboolean do_retry;
+
+ /* With ref count 1, check whether we need to emit a toggle notification. */
+ object_bit_lock (object, OPTIONAL_BIT_LOCK_TOGGLE_REFS);
+ toggle_notify = toggle_refs_get_notify_unlocked (object, &toggle_data);
+ do_retry = !g_atomic_int_compare_and_exchange_full ((int *) &object->ref_count,
+ old_ref, old_ref + 1, &old_ref);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_TOGGLE_REFS);
+ if (do_retry)
+ goto retry;
+ }
+ else
+ {
+ gboolean object_already_finalized = TRUE;
+
+ *out_toggle_notify = NULL;
+ *out_toggle_data = NULL;
+ g_return_val_if_fail (!object_already_finalized, NULL);
+ return NULL;
+ }
+
+ TRACE (GOBJECT_OBJECT_REF (object, G_TYPE_FROM_INSTANCE (object), old_ref));
+
+ *out_toggle_notify = toggle_notify;
+ *out_toggle_data = toggle_data;
+ return object;
+}
+
/**
* g_object_ref:
* @object: (type GObject.Object): a #GObject
(g_object_ref) (gpointer _object)
{
GObject *object = _object;
- gint old_val;
- gboolean object_already_finalized;
+ GToggleNotify toggle_notify;
+ gpointer toggle_data;
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
-
- old_val = g_atomic_int_add (&object->ref_count, 1);
- object_already_finalized = (old_val <= 0);
- g_return_val_if_fail (!object_already_finalized, NULL);
- if (old_val == 1 && OBJECT_HAS_TOGGLE_REF (object))
- toggle_refs_notify (object, FALSE);
+ object = object_ref (object, &toggle_notify, &toggle_data);
- TRACE (GOBJECT_OBJECT_REF(object,G_TYPE_FROM_INSTANCE(object),old_val));
+ if (toggle_notify)
+ toggle_notify (toggle_data, object, FALSE);
return object;
}
+static gboolean
+_object_unref_clear_weak_locations (GObject *object, gint *p_old_ref, gboolean do_unref)
+{
+ GSList **weak_locations;
+
+ if (do_unref)
+ {
+ gboolean unreffed = FALSE;
+
+ /* Fast path for the final unref using a read-lck only. We check whether
+ * we have weak_locations and drop ref count to zero under a reader lock. */
+
+ g_rw_lock_reader_lock (&weak_locations_lock);
+
+ weak_locations = g_datalist_id_get_data (&object->qdata, quark_weak_locations);
+ if (!weak_locations)
+ {
+ unreffed = g_atomic_int_compare_and_exchange_full ((int *) &object->ref_count,
+ 1, 0,
+ p_old_ref);
+ g_rw_lock_reader_unlock (&weak_locations_lock);
+ return unreffed;
+ }
+
+ g_rw_lock_reader_unlock (&weak_locations_lock);
+
+ /* We have weak-locations. Note that we are here already after dispose(). That
+ * means, during dispose a GWeakRef was registered (very unusual). */
+
+ g_rw_lock_writer_lock (&weak_locations_lock);
+
+ if (!g_atomic_int_compare_and_exchange_full ((int *) &object->ref_count,
+ 1, 0,
+ p_old_ref))
+ {
+ g_rw_lock_writer_unlock (&weak_locations_lock);
+ return FALSE;
+ }
+
+ weak_locations = g_datalist_id_remove_no_notify (&object->qdata, quark_weak_locations);
+ g_clear_pointer (&weak_locations, weak_locations_free_unlocked);
+
+ g_rw_lock_writer_unlock (&weak_locations_lock);
+ return TRUE;
+ }
+
+ weak_locations = g_datalist_id_get_data (&object->qdata, quark_weak_locations);
+ if (weak_locations != NULL)
+ {
+ g_rw_lock_writer_lock (&weak_locations_lock);
+
+ *p_old_ref = g_atomic_int_get (&object->ref_count);
+ if (*p_old_ref != 1)
+ {
+ g_rw_lock_writer_unlock (&weak_locations_lock);
+ return FALSE;
+ }
+
+ weak_locations = g_datalist_id_remove_no_notify (&object->qdata, quark_weak_locations);
+ g_clear_pointer (&weak_locations, weak_locations_free_unlocked);
+
+ g_rw_lock_writer_unlock (&weak_locations_lock);
+ return TRUE;
+ }
+
+ /* We don't need to re-fetch p_old_ref or check that it's still 1. The caller
+ * did that already. We are good.
+ *
+ * Note that in this case we fetched old_ref and weak_locations separately,
+ * without a lock. But this is fine. We are still before calling dispose().
+ * If there is a race at this point, the same race can happen between
+ * _object_unref_clear_weak_locations() and dispose() call. That is handled
+ * just fine. */
+ return TRUE;
+}
+
/**
* g_object_unref:
* @object: (type GObject.Object): a #GObject
{
GObject *object = _object;
gint old_ref;
-
+ GToggleNotify toggle_notify;
+ gpointer toggle_data;
+ GObjectNotifyQueue *nqueue;
+ gboolean do_retry;
+ GType obj_gtype;
+
g_return_if_fail (G_IS_OBJECT (object));
-
- /* here we want to atomically do: if (ref_count>1) { ref_count--; return; } */
+
+ /* obj_gtype will be needed for TRACE(GOBJECT_OBJECT_UNREF()) later. Note
+ * that we issue the TRACE() after decrementing the ref-counter. If at that
+ * point the reference counter does not reach zero, somebody else can race
+ * and destroy the object.
+ *
+ * This means, TRACE() can be called with a dangling object pointer. This
+ * could only be avoided, by emitting the TRACE before doing the actual
+ * unref, but at that point we wouldn't know the correct "old_ref" value.
+ * Maybe this should change.
+ *
+ * Anyway. At that later point we can also no longer safely get the GType for
+ * the TRACE(). Do it now.
+ */
+ obj_gtype = G_TYPE_FROM_INSTANCE (object);
+ (void) obj_gtype;
+
old_ref = g_atomic_int_get (&object->ref_count);
- retry_atomic_decrement1:
- while (old_ref > 1)
+
+retry_beginning:
+
+ if (old_ref > 2)
{
- /* valid if last 2 refs are owned by this call to unref and the toggle_ref */
+ /* We have many references. If we can decrement the ref counter, we are done. */
+ if (!g_atomic_int_compare_and_exchange_full ((int *) &object->ref_count,
+ old_ref, old_ref - 1, &old_ref))
+ goto retry_beginning;
- if (!g_atomic_int_compare_and_exchange_full ((int *)&object->ref_count,
- old_ref, old_ref - 1,
- &old_ref))
- continue;
+ /* Beware: object might be a dangling pointer. */
+ TRACE (GOBJECT_OBJECT_UNREF (object, obj_gtype, old_ref));
+ return;
+ }
+
+ if (old_ref == 2)
+ {
+ /* We are about to return the second-to-last reference. In that case we
+ * might need to notify a toggle reference.
+ *
+ * Note that a g_object_add_toggle_ref() MUST always be released
+ * via g_object_remove_toggle_ref(). Thus, if we are here with
+ * an old_ref of 2, then at most one of the references can be
+ * a toggle reference.
+ *
+ * We need to take a lock, to avoid races. */
+
+ object_bit_lock (object, OPTIONAL_BIT_LOCK_TOGGLE_REFS);
- TRACE (GOBJECT_OBJECT_UNREF(object,G_TYPE_FROM_INSTANCE(object),old_ref));
+ toggle_notify = toggle_refs_get_notify_unlocked (object, &toggle_data);
- /* if we went from 2->1 we need to notify toggle refs if any */
- if (old_ref == 2 && OBJECT_HAS_TOGGLE_REF (object))
+ if (!g_atomic_int_compare_and_exchange_full ((int *) &object->ref_count,
+ old_ref, old_ref - 1, &old_ref))
{
- /* The last ref being held in this case is owned by the toggle_ref */
- toggle_refs_notify (object, TRUE);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_TOGGLE_REFS);
+ goto retry_beginning;
}
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_TOGGLE_REFS);
+
+ /* Beware: object might be a dangling pointer. */
+ TRACE (GOBJECT_OBJECT_UNREF (object, obj_gtype, old_ref));
+ if (toggle_notify)
+ toggle_notify (toggle_data, object, TRUE);
return;
}
+ if (G_UNLIKELY (old_ref != 1))
{
- GSList **weak_locations;
- GObjectNotifyQueue *nqueue;
-
- /* The only way that this object can live at this point is if
- * there are outstanding weak references already established
- * before we got here.
- *
- * If there were not already weak references then no more can be
- * established at this time, because the other thread would have
- * to hold a strong ref in order to call
- * g_object_add_weak_pointer() and then we wouldn't be here.
- *
- * Other GWeakRef's (weak locations) instead may still be added
- * before the object is finalized, but in such case we'll unset
- * them as part of the qdata removal.
- */
- weak_locations = g_datalist_id_get_data (&object->qdata, quark_weak_locations);
+ gboolean object_already_finalized = TRUE;
- if (weak_locations != NULL)
- {
- g_rw_lock_writer_lock (&weak_locations_lock);
+ g_return_if_fail (!object_already_finalized);
+ return;
+ }
- /* It is possible that one of the weak references beat us to
- * the lock. Make sure the refcount is still what we expected
- * it to be.
- */
- old_ref = g_atomic_int_get (&object->ref_count);
- if (old_ref != 1)
- {
- g_rw_lock_writer_unlock (&weak_locations_lock);
- goto retry_atomic_decrement1;
- }
+ /* We only have one reference left. Proceed to (maybe) clear weak locations. */
+ if (!_object_unref_clear_weak_locations (object, &old_ref, FALSE))
+ goto retry_beginning;
- /* We got the lock first, so the object will definitely die
- * now. Clear out all the weak references, if they're still set.
- */
- weak_locations = g_datalist_id_remove_no_notify (&object->qdata,
- quark_weak_locations);
- g_clear_pointer (&weak_locations, weak_locations_free_unlocked);
+ /* At this point, we checked with an atomic read that we only hold only one
+ * reference. Weak locations are cleared (and toggle references are not to
+ * be considered in this case). Proceed with dispose().
+ *
+ * First, freeze the notification queue, so we don't accidentally emit
+ * notifications during dispose() and finalize().
+ *
+ * The notification queue stays frozen unless the instance acquires a
+ * reference during dispose(), in which case we thaw it and dispatch all the
+ * notifications. If the instance gets through to finalize(), the
+ * notification queue gets automatically drained when g_object_finalize() is
+ * reached and the qdata is cleared.
+ */
+ nqueue = g_object_notify_queue_freeze (object);
- g_rw_lock_writer_unlock (&weak_locations_lock);
- }
+ TRACE (GOBJECT_OBJECT_DISPOSE (object, G_TYPE_FROM_INSTANCE (object), 1));
+ G_OBJECT_GET_CLASS (object)->dispose (object);
+ TRACE (GOBJECT_OBJECT_DISPOSE_END (object, G_TYPE_FROM_INSTANCE (object), 1));
- /* freeze the notification queue, so we don't accidentally emit
- * notifications during dispose() and finalize().
- *
- * The notification queue stays frozen unless the instance acquires
- * a reference during dispose(), in which case we thaw it and
- * dispatch all the notifications. If the instance gets through
- * to finalize(), the notification queue gets automatically
- * drained when g_object_finalize() is reached and
- * the qdata is cleared.
- */
- nqueue = g_object_notify_queue_freeze (object);
+retry_decrement:
+ /* Here, old_ref is 1 if we just come from dispose(). If the object was resurrected,
+ * we can hit `goto retry_decrement` and be here with a larger old_ref. */
- /* we are about to remove the last reference */
- TRACE (GOBJECT_OBJECT_DISPOSE(object,G_TYPE_FROM_INSTANCE(object), 1));
- G_OBJECT_GET_CLASS (object)->dispose (object);
- TRACE (GOBJECT_OBJECT_DISPOSE_END(object,G_TYPE_FROM_INSTANCE(object), 1));
+ if (old_ref > 1 && nqueue)
+ {
+ /* If the object was resurrected, we need to unfreeze the notify
+ * queue. */
+ g_object_notify_queue_thaw (object, nqueue, FALSE);
+ nqueue = NULL;
+ }
- /* may have been re-referenced meanwhile */
- old_ref = g_atomic_int_get ((int *)&object->ref_count);
+ if (old_ref > 2)
+ {
+ if (!g_atomic_int_compare_and_exchange_full ((int *) &object->ref_count,
+ old_ref, old_ref - 1,
+ &old_ref))
+ goto retry_decrement;
- while (old_ref > 1)
- {
- /* valid if last 2 refs are owned by this call to unref and the toggle_ref */
+ /* Beware: object might be a dangling pointer. */
+ TRACE (GOBJECT_OBJECT_UNREF (object, obj_gtype, old_ref));
+ return;
+ }
- if (!g_atomic_int_compare_and_exchange_full ((int *)&object->ref_count,
- old_ref, old_ref - 1,
- &old_ref))
- continue;
+ if (old_ref == 2)
+ {
+ /* If the object was resurrected and the current ref-count is 2, then we
+ * are about to drop the ref-count to 1. We may need to emit a toggle
+ * notification. Take a lock and check for that.
+ *
+ * In that case, we need a lock to get the toggle notification. */
+ object_bit_lock (object, OPTIONAL_BIT_LOCK_TOGGLE_REFS);
+ toggle_notify = toggle_refs_get_notify_unlocked (object, &toggle_data);
+ do_retry = !g_atomic_int_compare_and_exchange_full ((int *) &object->ref_count,
+ old_ref, old_ref - 1,
+ &old_ref);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_TOGGLE_REFS);
+
+ if (do_retry)
+ goto retry_decrement;
+
+ /* Beware: object might be a dangling pointer. */
+ TRACE (GOBJECT_OBJECT_UNREF (object, obj_gtype, old_ref));
+ if (toggle_notify)
+ toggle_notify (toggle_data, object, TRUE);
+ return;
+ }
- TRACE (GOBJECT_OBJECT_UNREF (object, G_TYPE_FROM_INSTANCE (object), old_ref));
+ /* old_ref is 1, we are about to drop the reference count to zero. That is
+ * done by _object_unref_clear_weak_locations() under a weak_locations_lock
+ * so that there is no race with g_weak_ref_set(). */
+ if (!_object_unref_clear_weak_locations (object, &old_ref, TRUE))
+ goto retry_decrement;
- /* emit all notifications that have been queued during dispose() */
- g_object_notify_queue_thaw (object, nqueue, FALSE);
+ TRACE (GOBJECT_OBJECT_UNREF (object, obj_gtype, old_ref));
- /* if we went from 2->1 we need to notify toggle refs if any */
- if (old_ref == 2 && OBJECT_HAS_TOGGLE_REF (object) &&
- g_atomic_int_get ((int *)&object->ref_count) == 1)
- {
- /* The last ref being held in this case is owned by the toggle_ref */
- toggle_refs_notify (object, TRUE);
- }
+ /* The object is almost gone. Finalize. */
- return;
- }
+ g_datalist_id_set_data (&object->qdata, quark_closure_array, NULL);
+ g_signal_handlers_destroy (object);
+ g_datalist_id_set_data (&object->qdata, quark_weak_notifies, NULL);
- /* we are still in the process of taking away the last ref */
- g_datalist_id_set_data (&object->qdata, quark_closure_array, NULL);
- g_signal_handlers_destroy (object);
- g_datalist_id_set_data (&object->qdata, quark_weak_refs, NULL);
- g_datalist_id_set_data (&object->qdata, quark_weak_locations, NULL);
- g_datalist_id_set_data (&object->qdata, quark_weak_notifies, NULL);
+ TRACE (GOBJECT_OBJECT_FINALIZE (object, G_TYPE_FROM_INSTANCE (object)));
+ G_OBJECT_GET_CLASS (object)->finalize (object);
+ TRACE (GOBJECT_OBJECT_FINALIZE_END (object, G_TYPE_FROM_INSTANCE (object)));
- /* decrement the last reference */
- old_ref = g_atomic_int_add (&object->ref_count, -1);
- g_return_if_fail (old_ref > 0);
+ GOBJECT_IF_DEBUG (OBJECTS,
+ {
+ gboolean was_present;
- TRACE (GOBJECT_OBJECT_UNREF(object,G_TYPE_FROM_INSTANCE(object),old_ref));
+ /* catch objects not chaining finalize handlers */
+ G_LOCK (debug_objects);
+ was_present = g_hash_table_remove (debug_objects_ht, object);
+ G_UNLOCK (debug_objects);
- /* may have been re-referenced meanwhile */
- if (G_LIKELY (old_ref == 1))
- {
- TRACE (GOBJECT_OBJECT_FINALIZE(object,G_TYPE_FROM_INSTANCE(object)));
- G_OBJECT_GET_CLASS (object)->finalize (object);
- TRACE (GOBJECT_OBJECT_FINALIZE_END(object,G_TYPE_FROM_INSTANCE(object)));
-
- GOBJECT_IF_DEBUG (OBJECTS,
- {
- gboolean was_present;
-
- /* catch objects not chaining finalize handlers */
- G_LOCK (debug_objects);
- was_present = g_hash_table_remove (debug_objects_ht, object);
- G_UNLOCK (debug_objects);
-
- if (was_present)
- g_critical ("Object %p of type %s not finalized correctly.",
- object, G_OBJECT_TYPE_NAME (object));
- });
- g_type_free_instance ((GTypeInstance*) object);
- }
- else
- {
- /* The instance acquired a reference between dispose() and
- * finalize(), so we need to thaw the notification queue
- */
- g_object_notify_queue_thaw (object, nqueue, FALSE);
- }
- }
+ if (was_present)
+ g_critical ("Object %p of type %s not finalized correctly.",
+ object, G_OBJECT_TYPE_NAME (object));
+ });
+ g_type_free_instance ((GTypeInstance *) object);
}
/**
CArray *carray;
guint i;
- G_LOCK (closure_array_mutex);
+ object_bit_lock (object, OPTIONAL_BIT_LOCK_CLOSURE_ARRAY);
carray = g_object_get_qdata (object, quark_closure_array);
for (i = 0; i < carray->n_closures; i++)
if (carray->closures[i] == closure)
carray->n_closures--;
if (i < carray->n_closures)
carray->closures[i] = carray->closures[carray->n_closures];
- G_UNLOCK (closure_array_mutex);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_CLOSURE_ARRAY);
return;
}
- G_UNLOCK (closure_array_mutex);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_CLOSURE_ARRAY);
g_assert_not_reached ();
}
g_closure_add_marshal_guards (closure,
object, (GClosureNotify) g_object_ref,
object, (GClosureNotify) g_object_unref);
- G_LOCK (closure_array_mutex);
+ object_bit_lock (object, OPTIONAL_BIT_LOCK_CLOSURE_ARRAY);
carray = g_datalist_id_remove_no_notify (&object->qdata, quark_closure_array);
if (!carray)
{
}
carray->closures[i] = closure;
g_datalist_id_set_data_full (&object->qdata, quark_closure_array, carray, destroy_closure_array);
- G_UNLOCK (closure_array_mutex);
+ object_bit_unlock (object, OPTIONAL_BIT_LOCK_CLOSURE_ARRAY);
}
/**
{
weak_ref->priv.p = NULL;
- g_weak_ref_set (weak_ref, object);
+ if (object)
+ g_weak_ref_set (weak_ref, object);
}
/**
gpointer
g_weak_ref_get (GWeakRef *weak_ref)
{
- gpointer object_or_null;
+ GToggleNotify toggle_notify = NULL;
+ gpointer toggle_data = NULL;
+ GObject *object;
- g_return_val_if_fail (weak_ref!= NULL, NULL);
+ g_return_val_if_fail (weak_ref, NULL);
g_rw_lock_reader_lock (&weak_locations_lock);
- object_or_null = weak_ref->priv.p;
+ object = weak_ref->priv.p;
- if (object_or_null != NULL)
- g_object_ref (object_or_null);
+ if (object)
+ object = object_ref (object, &toggle_notify, &toggle_data);
g_rw_lock_reader_unlock (&weak_locations_lock);
- return object_or_null;
+ if (toggle_notify)
+ toggle_notify (toggle_data, object, FALSE);
+
+ return object;
}
static void
weak_locations = g_datalist_id_get_data (&old_object->qdata, quark_weak_locations);
if (weak_locations == NULL)
{
-#ifndef G_DISABLE_ASSERT
- gboolean in_weak_refs_notify =
- g_datalist_id_get_data (&old_object->qdata, quark_weak_refs) == NULL;
- g_assert (in_weak_refs_notify);
-#endif /* G_DISABLE_ASSERT */
+ g_critical ("unexpected missing GWeakRef");
}
else
{
/* Add the weak ref to the new object */
if (new_object != NULL)
{
+ if (g_atomic_int_get (&new_object->ref_count) < 1)
+ {
+ weak_ref->priv.p = NULL;
+ g_rw_lock_writer_unlock (&weak_locations_lock);
+ g_critical ("calling g_weak_ref_set() with already destroyed object");
+ return;
+ }
+
weak_locations = g_datalist_id_get_data (&new_object->qdata, quark_weak_locations);
if (weak_locations == NULL)
*/
probe gobject.object_unref = process("@ABS_GLIB_RUNTIME_LIBDIR@/libgobject-2.0.so.0.@LT_CURRENT@.@LT_REVISION@").mark("object__unref")
{
+ /* Beware that if old_refcount is larger than 1 and other threads might race
+ * and destroy object. In that case, object might be a dangling pointer. */
object = $arg1;
gtype = $arg2;
type = gobject_type_names_2_0_@LT_CURRENT@_@LT_REVISION@[pid(),gtype];
if (!hlbsa)
{
hlbsa = g_bsearch_array_create (&g_signal_hlbsa_bconfig);
- hlbsa = g_bsearch_array_insert (hlbsa, &g_signal_hlbsa_bconfig, &key);
- g_hash_table_insert (g_handler_list_bsa_ht, instance, hlbsa);
- }
- else
- {
- GBSearchArray *o = hlbsa;
-
- hlbsa = g_bsearch_array_insert (o, &g_signal_hlbsa_bconfig, &key);
- if (hlbsa != o)
- g_hash_table_insert (g_handler_list_bsa_ht, instance, hlbsa);
}
+ hlbsa = g_bsearch_array_insert (hlbsa, &g_signal_hlbsa_bconfig, &key);
+ g_hash_table_insert (g_handler_list_bsa_ht, instance, hlbsa);
return g_bsearch_array_lookup (hlbsa, &g_signal_hlbsa_bconfig, &key);
}
g_value_unset (&value);
}
+static void
+test_boxed_rand (void)
+{
+ GRand *r, *r2;
+ GValue value = G_VALUE_INIT;
+
+ g_value_init (&value, G_TYPE_RAND);
+ g_assert_true (G_VALUE_HOLDS_BOXED (&value));
+
+ r = g_rand_new ();
+ g_value_take_boxed (&value, r);
+
+ r2 = g_value_get_boxed (&value);
+ g_assert_true (r == r2);
+
+ r2 = g_value_dup_boxed (&value);
+ g_assert_true (r != r2);
+ g_rand_free (r2);
+
+ g_value_unset (&value);
+}
+
int
main (int argc, char *argv[])
{
g_test_add_func ("/boxed/checksum", test_boxed_checksum);
g_test_add_func ("/boxed/tree", test_boxed_tree);
g_test_add_func ("/boxed/patternspec", test_boxed_pattern_spec);
+ g_test_add_func ("/boxed/rand", test_boxed_rand);
return g_test_run ();
}
test_param_spec_pool (void)
{
GParamSpecPool *pool = g_param_spec_pool_new (FALSE);
- GParamSpec *pspec = g_param_spec_int ("int", NULL, NULL, -1, 100, -1, G_PARAM_READWRITE);
+ GParamSpec *pspec = g_param_spec_ref_sink (g_param_spec_int ("int", NULL, NULL, -1, 100, -1, G_PARAM_READWRITE));
GParamSpec *check = NULL;
- g_param_spec_pool_insert (pool, g_param_spec_ref_sink (pspec), G_TYPE_OBJECT);
+ g_param_spec_pool_insert (pool, pspec, G_TYPE_OBJECT);
check = g_param_spec_pool_lookup (pool, "int", G_TYPE_OBJECT, FALSE);
g_assert_true (check->owner_type == G_TYPE_OBJECT);
g_assert_null (g_param_spec_pool_lookup (pool, "int", G_TYPE_OBJECT, FALSE));
g_param_spec_pool_free (pool);
+ g_param_spec_unref (pspec);
}
int
G_OBJECT_CLASS (weak_reffed_object_parent_class)->dispose (object);
- g_assert_null (g_weak_ref_get (weak_reffed->weak_ref));
+ g_assert_true (object == g_weak_ref_get (weak_reffed->weak_ref));
+ g_object_unref (object);
}
static void
g_object_run_dispose (obj);
g_assert_null (g_weak_ref_get (&weak));
+ g_weak_ref_set (&weak, obj);
+
g_clear_object (&obj);
g_assert_null (g_weak_ref_get (&weak));
}
g_assert_null (g_weak_ref_get (&weak));
}
+static void
+weak_ref_in_toggle_notify_toggle_cb (gpointer data,
+ GObject *object,
+ gboolean is_last_ref)
+{
+ GWeakRef weak2;
+ GObject *obj2;
+
+ if (is_last_ref)
+ return;
+
+ /* We just got a second ref, while calling g_weak_ref_get().
+ *
+ * Test that taking another weak ref in this situation works.
+ */
+
+ g_weak_ref_init (&weak2, object);
+ g_assert_true (object == g_weak_ref_get (&weak2));
+ g_object_unref (object);
+
+ obj2 = g_object_new (G_TYPE_OBJECT, NULL);
+ g_weak_ref_set (&weak2, obj2);
+ g_object_unref (obj2);
+
+ g_assert_null (g_weak_ref_get (&weak2));
+}
+
+static void
+test_weak_ref_in_toggle_notify (void)
+{
+ GObject *obj;
+ GWeakRef weak = { { GUINT_TO_POINTER (0xDEADBEEFU) } };
+
+ obj = g_object_new (G_TYPE_OBJECT, NULL);
+ g_object_add_toggle_ref (obj, weak_ref_in_toggle_notify_toggle_cb, NULL);
+ g_object_unref (obj);
+
+ g_weak_ref_init (&weak, obj);
+
+ /* We trigger a toggle notify via g_weak_ref_get(). */
+ g_assert_true (g_weak_ref_get (&weak) == obj);
+
+ g_object_remove_toggle_ref (obj, weak_ref_in_toggle_notify_toggle_cb, NULL);
+ g_object_unref (obj);
+
+ g_assert_null (g_weak_ref_get (&weak));
+}
+
+/*****************************************************************************/
+
+#define CONCURRENT_N_OBJS 5
+#define CONCURRENT_N_THREADS 5
+#define CONCURRENT_N_RACES 100
+
+typedef struct
+{
+ int TEST_IDX;
+ GObject *objs[CONCURRENT_N_OBJS];
+ int thread_done[CONCURRENT_N_THREADS];
+} ConcurrentData;
+
+typedef struct
+{
+ const ConcurrentData *data;
+ int idx;
+ int race_count;
+ GWeakRef *weak_ref;
+ GRand *rnd;
+} ConcurrentThreadData;
+
+static gpointer
+_test_weak_ref_concurrent_thread_cb (gpointer data)
+{
+ ConcurrentThreadData *thread_data = data;
+
+ while (TRUE)
+ {
+ gboolean all_done;
+ int i;
+ int r;
+
+ for (r = 0; r < 15; r++)
+ {
+ GObject *obj_allocated = NULL;
+ GObject *obj;
+ GObject *obj2;
+ gboolean got_race;
+
+ /* Choose a random object */
+ obj = thread_data->data->objs[g_rand_int (thread_data->rnd) % CONCURRENT_N_OBJS];
+ if (thread_data->data->TEST_IDX > 0 && (g_rand_int (thread_data->rnd) % 4 == 0))
+ {
+ /* With TEST_IDX>0 also randomly choose NULL or a newly created
+ * object. */
+ if (g_rand_boolean (thread_data->rnd))
+ obj = NULL;
+ else
+ {
+ obj_allocated = g_object_new (G_TYPE_OBJECT, NULL);
+ obj = obj_allocated;
+ }
+ }
+
+ g_assert (!obj || G_IS_OBJECT (obj));
+
+ g_weak_ref_set (thread_data->weak_ref, obj);
+
+ /* get the weak-ref. If there is no race, we expect to get the same
+ * object back. */
+ obj2 = g_weak_ref_get (thread_data->weak_ref);
+
+ g_assert (!obj2 || G_IS_OBJECT (obj2));
+ if (!obj2)
+ {
+ g_assert (thread_data->data->TEST_IDX > 0);
+ }
+ if (obj != obj2)
+ {
+ int cnt;
+
+ cnt = 0;
+ for (i = 0; i < CONCURRENT_N_OBJS; i++)
+ {
+ if (obj2 == thread_data->data->objs[i])
+ cnt++;
+ }
+ if (!obj2)
+ g_assert_cmpint (cnt, ==, 0);
+ else if (obj2 && obj2 == obj_allocated)
+ g_assert_cmpint (cnt, ==, 0);
+ else if (thread_data->data->TEST_IDX > 0)
+ g_assert_cmpint (cnt, <=, 1);
+ else
+ g_assert_cmpint (cnt, ==, 1);
+ got_race = TRUE;
+ }
+ else
+ got_race = FALSE;
+
+ g_clear_object (&obj2);
+ g_clear_object (&obj_allocated);
+
+ if (got_race)
+ {
+ /* Each thread should see CONCURRENT_N_RACES before being done.
+ * Count them. */
+ if (g_atomic_int_get (&thread_data->race_count) > CONCURRENT_N_RACES)
+ g_atomic_int_set (&thread_data->data->thread_done[thread_data->idx], 1);
+ else
+ g_atomic_int_add (&thread_data->race_count, 1);
+ }
+ }
+
+ /* Each thread runs, until all threads saw the expected number of races. */
+ all_done = TRUE;
+ for (i = 0; i < CONCURRENT_N_THREADS; i++)
+ {
+ if (!g_atomic_int_get (&thread_data->data->thread_done[i]))
+ {
+ all_done = FALSE;
+ break;
+ }
+ }
+ if (all_done)
+ return GINT_TO_POINTER (1);
+ }
+}
+
+static void
+test_weak_ref_concurrent (gconstpointer testdata)
+{
+ const int TEST_IDX = GPOINTER_TO_INT (testdata);
+ GThread *threads[CONCURRENT_N_THREADS];
+ int i;
+ ConcurrentData data = {
+ .TEST_IDX = TEST_IDX,
+ };
+ ConcurrentThreadData thread_data[CONCURRENT_N_THREADS];
+ GWeakRef weak_ref = { 0 };
+
+ /* Let several threads call g_weak_ref_set() & g_weak_ref_get() in a loop. */
+
+ for (i = 0; i < CONCURRENT_N_OBJS; i++)
+ data.objs[i] = g_object_new (G_TYPE_OBJECT, NULL);
+
+ for (i = 0; i < CONCURRENT_N_THREADS; i++)
+ {
+ const guint32 rnd_seed[] = {
+ g_test_rand_int (),
+ g_test_rand_int (),
+ g_test_rand_int (),
+ };
+
+ thread_data[i] = (ConcurrentThreadData){
+ .idx = i,
+ .data = &data,
+ .weak_ref = &weak_ref,
+ .rnd = g_rand_new_with_seed_array (rnd_seed, G_N_ELEMENTS (rnd_seed)),
+ };
+ threads[i] = g_thread_new ("test-weak-ref-concurrent", _test_weak_ref_concurrent_thread_cb, &thread_data[i]);
+ }
+
+ for (i = 0; i < CONCURRENT_N_THREADS; i++)
+ {
+ gpointer r;
+
+ r = g_thread_join (g_steal_pointer (&threads[i]));
+ g_assert_cmpint (GPOINTER_TO_INT (r), ==, 1);
+ }
+
+ for (i = 0; i < CONCURRENT_N_OBJS; i++)
+ g_object_unref (g_steal_pointer (&data.objs[i]));
+ for (i = 0; i < CONCURRENT_N_THREADS; i++)
+ g_rand_free (g_steal_pointer (&thread_data[i].rnd));
+}
+
+/*****************************************************************************/
+
typedef struct
{
gboolean should_be_last;
obj->expected.count = 1;
obj->notify_handler = G_CALLBACK (on_object_notify);
g_object_remove_toggle_ref (G_OBJECT (obj), obj->toggle_notify, NULL);
- /* FIXME: adjust the count to 1 when !2377 is in */
- g_assert_cmpint (obj->actual.count, ==, 4);
+ g_assert_cmpint (obj->actual.count, ==, 2);
g_assert_cmpuint (obj->notify_called, ==, 1);
disposed_checker = &obj;
* notification is happening if notify handler switches to normal reference
*/
obj->disposing_refs = 1;
- obj->expected.count = 4;
+ obj->expected.count = 2;
obj->notify_handler = G_CALLBACK (on_object_notify_switch_to_normal_ref);
g_object_remove_toggle_ref (G_OBJECT (obj), obj->toggle_notify, NULL);
- g_assert_cmpint (obj->actual.count, ==, 5);
+ g_assert_cmpint (obj->actual.count, ==, 2);
g_assert_cmpuint (obj->notify_called, ==, 2);
disposed_checker = &obj;
*/
obj->disposing_refs = 1;
obj->disposing_refs_all_normal = TRUE;
- obj->expected.count = 5;
+ obj->expected.count = 2;
obj->notify_handler = G_CALLBACK (on_object_notify_switch_to_toggle_ref);
g_object_unref (obj);
- g_assert_cmpint (obj->actual.count, ==, 7);
+ g_assert_cmpint (obj->actual.count, ==, 3);
g_assert_cmpuint (obj->notify_called, ==, 3);
disposed_checker = &obj;
*/
obj->disposing_refs = 1;
obj->disposing_refs_all_normal = FALSE;
- obj->expected.count = 7;
+ obj->expected.count = 3;
obj->notify_handler = G_CALLBACK (on_object_notify_add_ref);
g_object_remove_toggle_ref (G_OBJECT (obj), obj->toggle_notify, NULL);
- g_assert_cmpint (obj->actual.count, ==, 8);
+ g_assert_cmpint (obj->actual.count, ==, 3);
g_assert_cmpuint (obj->notify_called, ==, 4);
g_object_unref (obj);
g_object_add_weak_pointer (G_OBJECT (obj), &disposed_checker);
obj->disposing_refs = 0;
- obj->expected.count = 9;
+ obj->expected.count = 4;
g_clear_object (&obj);
g_assert_null (disposed_checker);
}
g_test_add_func ("/object/weak-ref/on-dispose", test_weak_ref_on_dispose);
g_test_add_func ("/object/weak-ref/on-run-dispose", test_weak_ref_on_run_dispose);
g_test_add_func ("/object/weak-ref/on-toggle-notify", test_weak_ref_on_toggle_notify);
+ g_test_add_func ("/object/weak-ref/in-toggle-notify", test_weak_ref_in_toggle_notify);
+ g_test_add_data_func ("/object/weak-ref/concurrent/0", GINT_TO_POINTER (0), test_weak_ref_concurrent);
+ g_test_add_data_func ("/object/weak-ref/concurrent/1", GINT_TO_POINTER (1), test_weak_ref_concurrent);
g_test_add_func ("/object/toggle-ref", test_toggle_ref);
g_test_add_func ("/object/toggle-ref/ref-on-dispose", test_toggle_ref_on_dispose);
g_test_add_func ("/object/toggle-ref/ref-and-notify-on-dispose", test_toggle_ref_and_notify_on_dispose);
g_clear_object (&object);
}
+static void
+test_threaded_g_pointer_bit_unlock_and_set (void)
+{
+ GObject *obj;
+ gpointer plock;
+ gpointer ptr;
+ guintptr ptr2;
+ gpointer mangled_obj;
+
+#if defined(__GNUC__)
+ /* We should have at least one bit we can use safely for bit-locking */
+ G_STATIC_ASSERT (__alignof (GObject) > 1);
+#endif
+
+ obj = g_object_new (G_TYPE_OBJECT, NULL);
+
+ g_assert_true (g_pointer_bit_lock_mask_ptr (obj, 0, 0, 0, NULL) == obj);
+ g_assert_true (g_pointer_bit_lock_mask_ptr (obj, 0, 0, 0x2, obj) == obj);
+ g_assert_true (g_pointer_bit_lock_mask_ptr (obj, 0, 1, 0, NULL) != obj);
+
+ mangled_obj = obj;
+ g_assert_true (g_pointer_bit_lock_mask_ptr (obj, 0, 0, 0x2, mangled_obj) == obj);
+ g_assert_true (g_pointer_bit_lock_mask_ptr (obj, 0, 0, 0x3, mangled_obj) == obj);
+ g_atomic_pointer_and (&mangled_obj, ~((gsize) 0x7));
+ g_atomic_pointer_or (&mangled_obj, 0x2);
+ g_assert_true (g_pointer_bit_lock_mask_ptr (obj, 0, 0, 0x2, mangled_obj) != obj);
+ g_assert_true (g_pointer_bit_lock_mask_ptr (obj, 0, 0, 0x2, mangled_obj) == (gpointer) (((guintptr) obj) | ((guintptr) mangled_obj)));
+ g_assert_true (g_pointer_bit_lock_mask_ptr (obj, 0, 0, 0x3, mangled_obj) == (gpointer) (((guintptr) obj) | ((guintptr) mangled_obj)));
+ g_assert_true (g_pointer_bit_lock_mask_ptr (obj, 0, TRUE, 0x3, mangled_obj) == (gpointer) (((guintptr) obj) | ((guintptr) mangled_obj) | ((guintptr) 1)));
+ g_atomic_pointer_and (&mangled_obj, ~((gsize) 0x2));
+ g_assert_true (g_pointer_bit_lock_mask_ptr (obj, 0, 0, 0x2, mangled_obj) == obj);
+ g_atomic_pointer_or (&mangled_obj, 0x2);
+
+ plock = obj;
+ g_pointer_bit_lock (&plock, 0);
+ g_assert_true (plock != obj);
+ g_pointer_bit_unlock_and_set (&plock, 0, obj, 0);
+ g_assert_true (plock == obj);
+
+ plock = obj;
+ g_pointer_bit_lock_and_get (&plock, 0, &ptr2);
+ g_assert_true ((gpointer) ptr2 == plock);
+ g_assert_true (plock != obj);
+ g_atomic_pointer_set (&plock, mangled_obj);
+ g_pointer_bit_unlock_and_set (&plock, 0, obj, 0);
+ g_assert_true (plock == obj);
+
+ plock = obj;
+ g_pointer_bit_lock_and_get (&plock, 0, NULL);
+ g_assert_true (plock != obj);
+ g_atomic_pointer_set (&plock, mangled_obj);
+ g_pointer_bit_unlock_and_set (&plock, 0, obj, 0x7);
+ g_assert_true (plock != obj);
+ g_assert_true (plock == (gpointer) (((guintptr) obj) | ((guintptr) mangled_obj)));
+
+ plock = NULL;
+ g_pointer_bit_lock (&plock, 0);
+ g_assert_true (plock != NULL);
+ g_pointer_bit_unlock_and_set (&plock, 0, NULL, 0);
+ g_assert_true (plock == NULL);
+
+ ptr = ((char *) obj) + 1;
+ plock = obj;
+ g_pointer_bit_lock (&plock, 0);
+ g_assert_true (plock == ptr);
+ g_test_expect_message ("GLib", G_LOG_LEVEL_CRITICAL,
+ "*assertion 'ptr == pointer_bit_lock_mask_ptr (ptr, lock_bit, FALSE, 0, NULL)' failed*");
+ g_pointer_bit_unlock_and_set (&plock, 0, ptr, 0);
+ g_test_assert_expected_messages ();
+ g_assert_true (plock != ptr);
+ g_assert_true (plock == obj);
+
+ g_object_unref (obj);
+}
+
int
main (int argc,
char *argv[])
test_threaded_weak_ref_finalization);
g_test_add_func ("/GObject/threaded-toggle-notify",
test_threaded_toggle_notify);
+ g_test_add_func ("/GObject/threaded-g-pointer-bit-unlock-and-set",
+ test_threaded_g_pointer_bit_unlock_and_set);
return g_test_run();
}
# has been moved into glib now
gthread_sources = ['gthread-impl.c']
-if host_system == 'windows'
+if host_system == 'windows' and glib_build_shared
gthread_win_rc = configure_file(
input: 'gthread.rc.in',
output: 'gthread.rc',
project('glib', 'c',
- version : '2.79.0',
+ version : '2.79.1',
# NOTE: See the policy in docs/meson-version.md before changing the Meson dependency
meson_version : '>= 1.2.0',
default_options : [
'sys/vfstab.h',
'sys/vmount.h',
'sys/wait.h',
+ 'syslog.h',
'termios.h',
'unistd.h',
'values.h',
if cc.has_header_symbol('pthread.h', 'pthread_getname_np', prefix : pthread_prefix)
glib_conf.set('HAVE_PTHREAD_GETNAME_NP', 1)
endif
+ if cc.has_header_symbol('pthread.h', 'pthread_getaffinity_np', prefix : pthread_prefix)
+ glib_conf.set('HAVE_PTHREAD_GETAFFINITY_NP', 1)
+ endif
# Assume that pthread_setname_np is available in some form; same as configure
if cc.links(pthread_prefix + '''
# Georgian translation for glib
# Copyright (C) 2023 glib's authors.
# This file is distributed under the same license as the PACKAGE package.
-# Ekaterine Papava <papava.e@gtu.ge>, 2023.
+# Ekaterine Papava <papava.e@gtu.ge>, 2023-2024.
#
msgid ""
msgstr ""
"Project-Id-Version: glib\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/glib/issues\n"
-"POT-Creation-Date: 2023-09-06 04:18+0000\n"
-"PO-Revision-Date: 2023-09-08 14:07+0200\n"
+"POT-Creation-Date: 2023-12-20 00:43+0000\n"
+"PO-Revision-Date: 2024-01-08 05:28+0100\n"
"Last-Translator: Ekaterine Papava <papava.e@gtu.ge>\n"
"Language-Team: Georgian <(nothing)>\n"
"Language: ka\n"
msgid "Failed to find default application for URI Scheme ‘%s’"
msgstr "ჩავარდა ნაგულისხმევი აპლიკაციის პოვნის მცდელობა URI-ის სქემისთვის '%s'"
-#: gio/gapplication.c:506
+#: gio/gapplication.c:503
msgid "GApplication Options:"
msgstr "GApplication-ის მორგება:"
-#: gio/gapplication.c:506
+#: gio/gapplication.c:503
msgid "Show GApplication options"
msgstr "GApplication პარამეტრების ჩვენება"
-#: gio/gapplication.c:551
+#: gio/gapplication.c:548
msgid "Enter GApplication service mode (use from D-Bus service files)"
msgstr ""
"Gapplication-ის სერვისის რეჟიმში შესვლა (გამოიყენება D-Bus-ის სერვისის "
"ფაილებიდან)"
-#: gio/gapplication.c:563
+#: gio/gapplication.c:560
msgid "Override the application’s ID"
msgstr "აპლიკაციის ID-ის გადაფარვა"
-#: gio/gapplication.c:575
+#: gio/gapplication.c:572
msgid "Replace the running instance"
msgstr "გაშვებული ინტერფეისის შეცვლა"
-#: gio/gapplication-tool.c:47 gio/gapplication-tool.c:48 gio/gio-tool.c:229
+#: gio/gapplication-tool.c:47 gio/gapplication-tool.c:48 gio/gio-tool.c:230
#: gio/gresource-tool.c:496 gio/gsettings-tool.c:586
msgid "Print help"
msgstr "დახმარების ჩვენება"
msgid "[COMMAND]"
msgstr "[ბრძანება]"
-#: gio/gapplication-tool.c:51 gio/gio-tool.c:230
+#: gio/gapplication-tool.c:51 gio/gio-tool.c:231
msgid "Print version"
msgstr "მიმდინარე ვერსიის დაბეჭდვა"
msgstr "აპისID"
#: gio/gapplication-tool.c:74 gio/gapplication-tool.c:137 gio/gdbus-tool.c:108
-#: gio/gio-tool.c:226
+#: gio/gio-tool.c:259
msgid "COMMAND"
msgstr "ბრძანება"
msgid "Arguments:\n"
msgstr "არგუმენტები:\n"
-#: gio/gapplication-tool.c:137 gio/gio-tool.c:226
+#: gio/gapplication-tool.c:137 gio/gio-tool.c:259
msgid "[ARGS…]"
msgstr "[არგუმენტები…]"
"უცნობი ბრძანება: %s\n"
"\n"
-#: gio/gbufferedinputstream.c:422 gio/gbufferedinputstream.c:500
+#: gio/gbufferedinputstream.c:421 gio/gbufferedinputstream.c:499
#: gio/ginputstream.c:181 gio/ginputstream.c:381 gio/ginputstream.c:651
-#: gio/ginputstream.c:1056 gio/goutputstream.c:225 gio/goutputstream.c:1052
-#: gio/gpollableinputstream.c:221 gio/gpollableoutputstream.c:293
+#: gio/ginputstream.c:1056 gio/goutputstream.c:227 gio/goutputstream.c:1052
+#: gio/gpollableinputstream.c:217 gio/gpollableoutputstream.c:289
#, c-format
msgid "Too large count value passed to %s"
msgstr "%s-სთვის გადაცემული რაოდენობის მნიშვნელობა მეტიმეტად დიდია"
-#: gio/gbufferedinputstream.c:893 gio/gbufferedoutputstream.c:577
-#: gio/gdataoutputstream.c:564
+#: gio/gbufferedinputstream.c:892 gio/gbufferedoutputstream.c:579
+#: gio/gdataoutputstream.c:557
msgid "Seek not supported on base stream"
msgstr "საბაზისო ნაკადში გადახვევა მხარდაუჭერელია"
-#: gio/gbufferedinputstream.c:940
+#: gio/gbufferedinputstream.c:939
msgid "Cannot truncate GBufferedInputStream"
msgstr "GBufferedInputStream-ის წაკვეთა შეუძლებელია"
-#: gio/gbufferedinputstream.c:985 gio/ginputstream.c:1246 gio/giostream.c:302
+#: gio/gbufferedinputstream.c:984 gio/ginputstream.c:1246 gio/giostream.c:317
#: gio/goutputstream.c:2208
msgid "Stream is already closed"
msgstr "ნაკადი უკვე დახურულია"
-#: gio/gbufferedoutputstream.c:614 gio/gdataoutputstream.c:594
+#: gio/gbufferedoutputstream.c:616 gio/gdataoutputstream.c:587
msgid "Truncate not supported on base stream"
msgstr "საბაზისო ნაკადის წაკვეთა შეუძლებელია"
-#: gio/gcancellable.c:326 gio/gdbusconnection.c:1867 gio/gdbusprivate.c:1434
-#: gio/gsimpleasyncresult.c:873 gio/gsimpleasyncresult.c:899
+#: gio/gcancellable.c:326 gio/gdbusconnection.c:1844 gio/gdbusprivate.c:1432
+#: gio/gsimpleasyncresult.c:871 gio/gsimpleasyncresult.c:897
#, c-format
msgid "Operation was cancelled"
msgstr "ოპერაცია გაუქმდა"
-#: gio/gcharsetconverter.c:262
+#: gio/gcharsetconverter.c:272
msgid "Invalid object, not initialized"
msgstr "ობიექტი არასწორია. ინიციალიზებული არაა"
-#: gio/gcharsetconverter.c:283 gio/gcharsetconverter.c:311
+#: gio/gcharsetconverter.c:293 gio/gcharsetconverter.c:321
msgid "Incomplete multibyte sequence in input"
msgstr "შეტანილ ტექსტში ბაიტების მიმდევრობა მცდარია"
-#: gio/gcharsetconverter.c:317 gio/gcharsetconverter.c:326
+#: gio/gcharsetconverter.c:327 gio/gcharsetconverter.c:336
msgid "Not enough space in destination"
msgstr "დანიშნულების წერტილში საკმარისი ადგილი არაა"
-#: gio/gcharsetconverter.c:344 gio/gdatainputstream.c:850
-#: gio/gdatainputstream.c:1268 glib/gconvert.c:450 glib/gconvert.c:882
-#: glib/giochannel.c:1576 glib/giochannel.c:1618 glib/giochannel.c:2478
+#: gio/gcharsetconverter.c:354 gio/gdatainputstream.c:842
+#: gio/gdatainputstream.c:1260 glib/gconvert.c:351 glib/gconvert.c:783
+#: glib/giochannel.c:1565 glib/giochannel.c:1607 glib/giochannel.c:2467
#: glib/gutf8.c:958 glib/gutf8.c:1412
msgid "Invalid byte sequence in conversion input"
msgstr "შეტანილ ტექსტში ბაიტების მიმდევრობა მცდარია"
-#: gio/gcharsetconverter.c:349 glib/gconvert.c:458 glib/gconvert.c:796
-#: glib/giochannel.c:1583 glib/giochannel.c:2493
+#: gio/gcharsetconverter.c:359 glib/gconvert.c:359 glib/gconvert.c:697
+#: glib/giochannel.c:1572 glib/giochannel.c:2482
#, c-format
msgid "Error during conversion: %s"
msgstr "გარდაქმნის შეცდომა: %s"
-#: gio/gcharsetconverter.c:447 gio/gsocket.c:1164
+#: gio/gcharsetconverter.c:457 gio/gsocket.c:1217
msgid "Cancellable initialization not supported"
msgstr "გაუქმებადი ინიციალიზაცია მხარდაჭერილი არაა"
-#: gio/gcharsetconverter.c:458 glib/gconvert.c:323 glib/giochannel.c:1404
+#: gio/gcharsetconverter.c:468 glib/gconvert.c:224 glib/giochannel.c:1393
#, c-format
msgid "Conversion from character set “%s” to “%s” is not supported"
msgstr "კოდური გვერდის \"%s\" გარდაქმნა \"%s\" კოდირებაში მხარდაუჭერელია"
-#: gio/gcharsetconverter.c:462 glib/gconvert.c:327
+#: gio/gcharsetconverter.c:472 glib/gconvert.c:228
#, c-format
msgid "Could not open converter from “%s” to “%s”"
msgstr "ვერ ხერხდება \"%s\" - \"%s\" გარდამქმნელის გახსნა"
-#: gio/gcontenttype.c:472
+#: gio/gcontenttype.c:470
#, c-format
msgid "%s type"
msgstr "ტიპი %s"
msgid "%s filetype"
msgstr "ფაილის ტიპი %s"
-#: gio/gcredentials.c:337
+#: gio/gcredentials.c:327
msgid "GCredentials contains invalid data"
msgstr "GCredentials არასწორ მონაცემებს შეიცავს"
-#: gio/gcredentials.c:397 gio/gcredentials.c:688
+#: gio/gcredentials.c:387 gio/gcredentials.c:678
msgid "GCredentials is not implemented on this OS"
msgstr "GCredentials ამ OS-თვის განხორციელებული არაა"
-#: gio/gcredentials.c:552 gio/gcredentials.c:570
+#: gio/gcredentials.c:542 gio/gcredentials.c:560
msgid "There is no GCredentials support for your platform"
msgstr "თვენი პლატფორმისთვის GCredentials მხარდაჭერილი არაა"
-#: gio/gcredentials.c:628
+#: gio/gcredentials.c:618
msgid "GCredentials does not contain a process ID on this OS"
msgstr "GCredentials ამ OS-ზე პროცესის ID-ს არ შეიცავს"
-#: gio/gcredentials.c:682
+#: gio/gcredentials.c:672
msgid "Credentials spoofing is not possible on this OS"
msgstr "ამ OS-ზე ავტორიზაციის დეტალების ჩანაცვლება შეუძლებელია"
-#: gio/gdatainputstream.c:306
+#: gio/gdatainputstream.c:298
msgid "Unexpected early end-of-stream"
msgstr "მოულოდნელი ნაადრევი ნაკადის დასასრული"
-#: gio/gdbusaddress.c:168 gio/gdbusaddress.c:240 gio/gdbusaddress.c:327
+#: gio/gdbusaddress.c:165 gio/gdbusaddress.c:237 gio/gdbusaddress.c:324
#, c-format
msgid "Unsupported key “%s” in address entry “%s”"
msgstr "მხარდაუჭერელი გასაღები \"%s\" მისამართის ჩანაწერში \"%s\""
-#: gio/gdbusaddress.c:181
+#: gio/gdbusaddress.c:178
#, c-format
msgid "Meaningless key/value pair combination in address entry “%s”"
msgstr ""
"უაზრო გასაღები/მნიშვნელობის წყვილის კომბინაცია მისამართის ჩანაწერში \"%s\""
-#: gio/gdbusaddress.c:190
+#: gio/gdbusaddress.c:187
#, c-format
msgid ""
"Address “%s” is invalid (need exactly one of path, dir, tmpdir, or abstract "
"მისამართ \"%s\" არასწორია (საჭიროა ზუსტად 1 ბილიკი, დროებითი საქაღალდე ან "
"აბსტრაქტული გასაღებები)"
-#: gio/gdbusaddress.c:255 gio/gdbusaddress.c:266 gio/gdbusaddress.c:281
-#: gio/gdbusaddress.c:342 gio/gdbusaddress.c:353
+#: gio/gdbusaddress.c:252 gio/gdbusaddress.c:263 gio/gdbusaddress.c:278
+#: gio/gdbusaddress.c:339 gio/gdbusaddress.c:350
#, c-format
msgid "Error in address “%s” — the “%s” attribute is malformed"
msgstr "შეცდომა მისამართში \"%s\"- ატრიბუტი \"%s\" არასწორადაა ჩამოყალიბებული"
-#: gio/gdbusaddress.c:423 gio/gdbusaddress.c:682
+#: gio/gdbusaddress.c:420 gio/gdbusaddress.c:679
#, c-format
msgid "Unknown or unsupported transport “%s” for address “%s”"
msgstr "უცნობი ან მხარდაუჭერელი ტრანსპორტი \"%s\" მისამართისთვის \"%s\""
-#: gio/gdbusaddress.c:467
+#: gio/gdbusaddress.c:464
#, c-format
msgid "Address element “%s” does not contain a colon (:)"
msgstr "მისამართის ელემენტი \"%s\" ორწერტილს (:) არ შეიცავს"
-#: gio/gdbusaddress.c:476
+#: gio/gdbusaddress.c:473
#, c-format
msgid "Transport name in address element “%s” must not be empty"
msgstr ""
"ტრანსპორტის სახელი მისამართის ელემენტში \"%s\" ცარიელი არ შეიძლება იყოს"
-#: gio/gdbusaddress.c:497
+#: gio/gdbusaddress.c:494
#, c-format
msgid ""
"Key/Value pair %d, “%s”, in address element “%s” does not contain an equal "
"გასაღები/მნიშვნელობის წყვილი %d, \"%s\" მისამართის ელემენტში \"%s\" ტოლობის "
"ნიშანს არ შეიცავს"
-#: gio/gdbusaddress.c:508
+#: gio/gdbusaddress.c:505
#, c-format
msgid ""
"Key/Value pair %d, “%s”, in address element “%s” must not have an empty key"
"გასაღები/მნიშვნელობის წყვილი %d, \"%s\" მისამართის ელემენტში \"%s\" არ "
"შეიძლება, ცარიელ გასაღებს შეიცავდეს"
-#: gio/gdbusaddress.c:522
+#: gio/gdbusaddress.c:519
#, c-format
msgid ""
"Error unescaping key or value in Key/Value pair %d, “%s”, in address element "
"შეცდომა გასაღები/მნიშვნელობის წყვილი %d, \"%s\" მისამართის ელემენტში \"%s\" "
"სპეციალური სიმბოლოების მოცილებისას"
-#: gio/gdbusaddress.c:590
+#: gio/gdbusaddress.c:587
#, c-format
msgid ""
"Error in address “%s” — the unix transport requires exactly one of the keys "
"შეცდომა მისამართში \"%s\" — unix ტრანსპორტზე აუცილებელია \"path\" ან "
"\"abstract\"-დან მხოლოდ ერთის დაყენება"
-#: gio/gdbusaddress.c:625
+#: gio/gdbusaddress.c:622
#, c-format
msgid "Error in address “%s” — the host attribute is missing or malformed"
msgstr ""
"შეცდომა მისამართში \"%s\" — ჰოსტის ატრიბუტი აკლია ან არასწორადაა "
"ჩამოყალიბებული"
-#: gio/gdbusaddress.c:639
+#: gio/gdbusaddress.c:636
#, c-format
msgid "Error in address “%s” — the port attribute is missing or malformed"
msgstr ""
"შეცდომა მისამართში \"%s\" — პორტის ატრიბუტი აკლია ან არასწორადაა "
"ჩამოყალიბებული"
-#: gio/gdbusaddress.c:653
+#: gio/gdbusaddress.c:650
#, c-format
msgid "Error in address “%s” — the noncefile attribute is missing or malformed"
msgstr ""
"შეცდომა მისამართში \"%s\" — ატრიბუტი noncefile აკლია ან არასწორადაა "
"ჩამოყალიბებული"
-#: gio/gdbusaddress.c:674
+#: gio/gdbusaddress.c:671
msgid "Error auto-launching: "
msgstr "ავტომატურად გაშვების შეცდომა: "
-#: gio/gdbusaddress.c:727
+#: gio/gdbusaddress.c:724
#, c-format
msgid "Error opening nonce file “%s”: %s"
msgstr "ერთჯერადი ფაილის (%s) გახსნის შეცდომა: %s"
-#: gio/gdbusaddress.c:746
+#: gio/gdbusaddress.c:743
#, c-format
msgid "Error reading from nonce file “%s”: %s"
msgstr "ერთჯერადი ფაილიდან (%s) წაკითხვის შეცდომა: %s"
-#: gio/gdbusaddress.c:755
+#: gio/gdbusaddress.c:752
#, c-format
msgid "Error reading from nonce file “%s”, expected 16 bytes, got %d"
msgstr ""
"შეცდომა nonce ფაილიდან \"%s\" წაკითხვისას. მოველოდი 16 ბაიტს. მივიღე %d"
-#: gio/gdbusaddress.c:773
+#: gio/gdbusaddress.c:770
#, c-format
msgid "Error writing contents of nonce file “%s” to stream:"
msgstr "შეცდომა nonce ფაილის, \"%s\", შემცველობის ჩაწერისას ნაკადში:"
-#: gio/gdbusaddress.c:988
+#: gio/gdbusaddress.c:985
msgid "The given address is empty"
msgstr "მითითებული მისამართი ცარიელია"
-#: gio/gdbusaddress.c:1101
+#: gio/gdbusaddress.c:1098
#, c-format
msgid "Cannot spawn a message bus when AT_SECURE is set"
msgstr ""
"შეტყობინებების მატარებლის შექმნა შეუძლებელია, როცა AT_SECURE დაყენებულია"
-#: gio/gdbusaddress.c:1108
+#: gio/gdbusaddress.c:1105
msgid "Cannot spawn a message bus without a machine-id: "
msgstr "შეტყობინების მატარებლის შექმნა machine-id-ის გარეშე შეუძლებელია: "
-#: gio/gdbusaddress.c:1115
+#: gio/gdbusaddress.c:1112
#, c-format
msgid "Cannot autolaunch D-Bus without X11 $DISPLAY"
msgstr "D-Bus-ის ავტომატური გაშვება X11 $DISPLAY-ის გარეშე შეუძლებელია"
-#: gio/gdbusaddress.c:1157
+#: gio/gdbusaddress.c:1154
#, c-format
msgid "Error spawning command line “%s”: "
msgstr "ბრძანების სტრიქონის \"%s\" შექმნის შეცდომა: "
-#: gio/gdbusaddress.c:1226
+#: gio/gdbusaddress.c:1223
#, c-format
msgid "Cannot determine session bus address (not implemented for this OS)"
msgstr ""
"სესიის მატარებლის მისამართის დადგენა შეუძლებელია (ამ ოს-სთვის "
"განხორციელებული არაა)"
-#: gio/gdbusaddress.c:1380 gio/gdbusconnection.c:7339
+#: gio/gdbusaddress.c:1377 gio/gdbusconnection.c:7339
#, c-format
msgid ""
"Cannot determine bus address from DBUS_STARTER_BUS_TYPE environment variable "
"გარემოს ცვლადიდან DBUS_STARTER_BUS_TYPE მატარებლის მისამართის დადგენა "
"შეუძლებელია - უცნობი მნიშვნელობა \"%s\""
-#: gio/gdbusaddress.c:1389 gio/gdbusconnection.c:7348
+#: gio/gdbusaddress.c:1386 gio/gdbusconnection.c:7348
msgid ""
"Cannot determine bus address because the DBUS_STARTER_BUS_TYPE environment "
"variable is not set"
"მატარებლის მისამართის დადგენა შეუძლებელია, რადგან გარემოს ცვლადი "
"DBUS_STARTER_BUS_TYPE დაყენებული არაა"
-#: gio/gdbusaddress.c:1399
+#: gio/gdbusaddress.c:1396
#, c-format
msgid "Unknown bus type %d"
msgstr "მატარებლის უცნობი ტიპი %d"
-#: gio/gdbusauth.c:294
+#: gio/gdbusauth.c:292
msgid "Unexpected lack of content trying to read a line"
msgstr "შემცველობის მოულოდნელი უქონლობა ხაზის წაკითხვის მცდელობისას"
-#: gio/gdbusauth.c:338
+#: gio/gdbusauth.c:336
msgid "Unexpected lack of content trying to (safely) read a line"
msgstr ""
"შემცველობის მოულოდნელი უქონლობა ხაზის (უსაფრთხოდ) წაკითხვის მცდელობისას"
-#: gio/gdbusauth.c:482
+#: gio/gdbusauth.c:480
#, c-format
msgid ""
"Exhausted all available authentication mechanisms (tried: %s) (available: %s)"
"დახარჯულია ყველა ხელმისაწვდომი ავთენტიკაციის მექანიზმი (ვცადე: %s) "
"(ხელმისაწვდომია: %s)"
-#: gio/gdbusauth.c:1045
+#: gio/gdbusauth.c:1043
msgid "Unexpected lack of content trying to read a byte"
msgstr "შემცველობის მოულოდნელი უქონლობა ბაიტის წაკითხვის მცდელობისას"
-#: gio/gdbusauth.c:1195
+#: gio/gdbusauth.c:1193
msgid "User IDs must be the same for peer and server"
msgstr "მომხმარებლის ID-ები პარტნიორისთვის და სერვერისთვის ტოლი უნდა იყოს"
-#: gio/gdbusauth.c:1207
+#: gio/gdbusauth.c:1205
msgid "Cancelled via GDBusAuthObserver::authorize-authenticated-peer"
msgstr "გაუქმებულია GDBusAuthObserver::authorize-authenticated-peer-ით"
msgid "Error creating directory “%s”: %s"
msgstr "საქაღალდის (\"%s\") შექმნის შეცდომა: %s"
-#: gio/gdbusauthmechanismsha1.c:368 gio/gfile.c:1102 gio/gfile.c:1340
-#: gio/gfile.c:1478 gio/gfile.c:1716 gio/gfile.c:1771 gio/gfile.c:1829
-#: gio/gfile.c:1913 gio/gfile.c:1970 gio/gfile.c:2034 gio/gfile.c:2089
-#: gio/gfile.c:3949 gio/gfile.c:4088 gio/gfile.c:4500 gio/gfile.c:4970
-#: gio/gfile.c:5382 gio/gfile.c:5467 gio/gfile.c:5557 gio/gfile.c:5654
-#: gio/gfile.c:5741 gio/gfile.c:5842 gio/gfile.c:9000 gio/gfile.c:9090
-#: gio/gfile.c:9174 gio/win32/gwinhttpfile.c:453
+#: 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:3955 gio/gfile.c:4094 gio/gfile.c:4501 gio/gfile.c:4966
+#: gio/gfile.c:5378 gio/gfile.c:5463 gio/gfile.c:5553 gio/gfile.c:5650
+#: gio/gfile.c:5737 gio/gfile.c:5836 gio/gfile.c:8990 gio/gfile.c:9080
+#: gio/gfile.c:9164 gio/win32/gwinhttpfile.c:453
msgid "Operation not supported"
msgstr "ოპერაცია მხარდაუჭერელია"
msgid "(Additionally, releasing the lock for “%s” also failed: %s) "
msgstr "(დამატებით, \"%s\"-ის ბლოკის მოხსნაც ჩავარდა: %s) "
-#: gio/gdbusconnection.c:590 gio/gdbusconnection.c:2415
+#: gio/gdbusconnection.c:585 gio/gdbusconnection.c:2392
msgid "The connection is closed"
msgstr "შეერთება არ დახურულა"
-#: gio/gdbusconnection.c:1899
+#: gio/gdbusconnection.c:1876
msgid "Timeout was reached"
msgstr "მოლოდინის ვადა ამიწურა"
-#: gio/gdbusconnection.c:2538
+#: gio/gdbusconnection.c:2515
msgid ""
"Unsupported flags encountered when constructing a client-side connection"
msgstr "კლიენტის მხრის მიერთების აწყობისას შემჩნეული ალმები მხარდაუჭერელა"
msgid "Object does not exist at path “%s”"
msgstr "ობიექტი არ არსებობს ბილიკზე \"%s\""
-#: gio/gdbusmessage.c:1306
+#: gio/gdbusmessage.c:1303
msgid "type is INVALID"
msgstr "ტიპი არასწორია"
-#: gio/gdbusmessage.c:1324
+#: gio/gdbusmessage.c:1321
msgid "METHOD_CALL message: PATH or MEMBER header field is missing or invalid"
msgstr ""
"METHOD_CALL შეტყობინება: PATH ან MEMBER თავსართის ველი აკლია ან არასწორია"
-#: gio/gdbusmessage.c:1340
+#: gio/gdbusmessage.c:1337
msgid "METHOD_RETURN message: REPLY_SERIAL header field is missing or invalid"
msgstr ""
"METHOD_RETURN შეტყობინება: REPLY_SERIAL თავსართის ველი აკლია ან არასწორია"
-#: gio/gdbusmessage.c:1360
+#: gio/gdbusmessage.c:1357
msgid ""
"ERROR message: REPLY_SERIAL or ERROR_NAME header field is missing or invalid"
msgstr ""
"ERROR შეტყობინება: REPLY_SERIAL ან ERROR_NAME თავსართის ველი აკლია ან "
"არასწორია"
-#: gio/gdbusmessage.c:1384
+#: gio/gdbusmessage.c:1381
msgid ""
"SIGNAL message: PATH, INTERFACE or MEMBER header field is missing or invalid"
msgstr ""
"SIGNAL შეტყობინება: PATH, INTERFACE ან MEMBER თავსართის ველი აკლია ან "
"არასწორია"
-#: gio/gdbusmessage.c:1392
+#: gio/gdbusmessage.c:1389
msgid ""
"SIGNAL message: The PATH header field is using the reserved value /org/"
"freedesktop/DBus/Local"
"SIGNAL შეტყობინება: PATH თავსართის ველი იყენებს დაცულ მნიშვნელობას /org/"
"freedesktop/DBus/Local"
-#: gio/gdbusmessage.c:1400
+#: gio/gdbusmessage.c:1397
msgid ""
"SIGNAL message: The INTERFACE header field is using the reserved value org."
"freedesktop.DBus.Local"
"SIGNAL შეტყობინება: INTERFACE თავსართის ველი იყენებს დაცულ მნიშვნელობას org."
"freedesktop.DBus.Local"
-#: gio/gdbusmessage.c:1449 gio/gdbusmessage.c:1509
+#: gio/gdbusmessage.c:1446 gio/gdbusmessage.c:1506
#, c-format
msgid "Wanted to read %lu byte but only got %lu"
msgid_plural "Wanted to read %lu bytes but only got %lu"
msgstr[0] "მინდოდა წამეკითხა %lu ბაიტი, მაგრამ მივიღე მხოლოდ %lu"
-#: gio/gdbusmessage.c:1463
+#: gio/gdbusmessage.c:1460
#, c-format
msgid "Expected NUL byte after the string “%s” but found byte %d"
msgstr ""
"სტრიქონის \"%s\" შემდეგ მოველოდი ბაიტს NUL, მაგრამ აღმოჩენილია ბაიტი %d"
-#: gio/gdbusmessage.c:1482
+#: gio/gdbusmessage.c:1479
#, c-format
msgid ""
"Expected valid UTF-8 string but found invalid bytes at byte offset %d "
"მოველოდი სწორ UTF-8 სტრიქონს, მაგრამ ბაიტის წანაცვლებაზე %d (სტრიქონის "
"სიგრძეა %d) აღმოჩენილია არასწორი ბაიტები. სწორი UTF-8 ამ დრომდე იყო \"%s\""
-#: gio/gdbusmessage.c:1546 gio/gdbusmessage.c:1822 gio/gdbusmessage.c:2033
+#: gio/gdbusmessage.c:1543 gio/gdbusmessage.c:1819 gio/gdbusmessage.c:2030
msgid "Value nested too deeply"
msgstr "მნიშვნელობა მეტისმეტად ღრმადაა ჩადგმული"
-#: gio/gdbusmessage.c:1714
+#: gio/gdbusmessage.c:1711
#, c-format
msgid "Parsed value “%s” is not a valid D-Bus object path"
msgstr ""
"დამუშავებული მნიშვნელობა \"%s\" სწორ D-Bus-ის ობიექტის ბილიკს არ წარმოადგენს"
-#: gio/gdbusmessage.c:1738
+#: gio/gdbusmessage.c:1735
#, c-format
msgid "Parsed value “%s” is not a valid D-Bus signature"
msgstr ""
"დამუშავებული მნიშვნელობა \"%s\" სწორ D-Bus-ის ხელმოწერას არ წარმოადგენს"
-#: gio/gdbusmessage.c:1789
+#: gio/gdbusmessage.c:1786
#, c-format
msgid ""
"Encountered array of length %u byte. Maximum length is 2<<26 bytes (64 MiB)."
msgstr[0] ""
"შემხვდა მასივი სიგრძით %u ბაიტი. მაქსიმალური სიგრძეა 2<<26 ბაიტი (64 მიბ)."
-#: gio/gdbusmessage.c:1809
+#: gio/gdbusmessage.c:1806
#, c-format
msgid ""
"Encountered array of type “a%c”, expected to have a length a multiple of %u "
"შემხვდა მასივი ტიპით \"a%c\". მოველოდი, რომ %u ბაიტის ნამრავლის სიგრძე "
"ექნებოდა, მაგრამ ის %u ბაიტის სიგრძისაა"
-#: gio/gdbusmessage.c:1963 gio/gdbusmessage.c:2682
+#: gio/gdbusmessage.c:1960 gio/gdbusmessage.c:2687
msgid "Empty structures (tuples) are not allowed in D-Bus"
msgstr "D-Bus-ში ცარიელი სტრუქტურები (კორტეჟები) მხარდაჭერილი არაა"
-#: gio/gdbusmessage.c:2017
+#: gio/gdbusmessage.c:2014
#, c-format
msgid "Parsed value “%s” for variant is not a valid D-Bus signature"
msgstr ""
"ვარიანტისთვის დამუშავებული მნიშვნელობა \"%s\" სწორ D-Bus-ის ხელმოწერას არ "
"წარმოადგენს"
-#: gio/gdbusmessage.c:2058
+#: gio/gdbusmessage.c:2055
#, c-format
msgid ""
"Error deserializing GVariant with type string “%s” from the D-Bus wire format"
"D-Bus-ის მავთულის ფორმატიდან GVariant-ის სტრიქონის ტიპით \"%s\" "
"დესერიალიზაციის შეცდომა"
-#: gio/gdbusmessage.c:2243
+#: gio/gdbusmessage.c:2240
#, c-format
msgid ""
"Invalid endianness value. Expected 0x6c (“l”) or 0x42 (“B”) but found value "
"არასწორი ბოლოიანობის მნიშვნელობა. მოველოდი 0x6c (“l”) ან 0x42 (“B”) მაგრამ "
"მიღებულია მნიშვნელობა: 0x%02x"
-#: gio/gdbusmessage.c:2262
+#: gio/gdbusmessage.c:2259
#, c-format
msgid "Invalid major protocol version. Expected 1 but found %d"
msgstr "არასწორი პროტოკოლის ძირითადი ვერსია. მოველოდი 1, აღმოჩენილია %d"
-#: gio/gdbusmessage.c:2320 gio/gdbusmessage.c:2918
+#: gio/gdbusmessage.c:2317 gio/gdbusmessage.c:2923
msgid "Signature header found but is not of type signature"
msgstr "აღმოჩენილია ხელმოწერის თავსართი, მაგრამ ის ხელმოწერის ტიპი არაა"
-#: gio/gdbusmessage.c:2332
+#: gio/gdbusmessage.c:2329
#, c-format
msgid "Signature header with signature “%s” found but message body is empty"
msgstr ""
"აღმოჩენილია ხელმოწერის თავსართი ხელმოწერით \"%s\", მაგრამ შეტყობინების "
"სხეული ცარიელია"
-#: gio/gdbusmessage.c:2347
+#: gio/gdbusmessage.c:2344
#, c-format
msgid "Parsed value “%s” is not a valid D-Bus signature (for body)"
msgstr ""
"დამუშავებული მნიშვნელობა \"%s\" სწორ D-Bus-ის ხელმოწერას არ წარმოადგენს "
"(სხეულისთვის)"
-#: gio/gdbusmessage.c:2379
+#: gio/gdbusmessage.c:2384
#, c-format
msgid "No signature header in message but the message body is %u byte"
msgid_plural "No signature header in message but the message body is %u bytes"
"შეტყობინებაში ხელმოწერის თავსართი აღმოჩენილი არაა, მაგრამ შეტყობინების "
"სხეული %u ბაიტია"
-#: gio/gdbusmessage.c:2389
+#: gio/gdbusmessage.c:2394
msgid "Cannot deserialize message: "
msgstr "დესერიალიზაცია შეუძლებელია შეტყობინებისთვის: "
-#: gio/gdbusmessage.c:2735
+#: gio/gdbusmessage.c:2740
#, c-format
msgid ""
"Error serializing GVariant with type string “%s” to the D-Bus wire format"
"D-Bus-ის მავთულის ფორმატიდან GVariant-ის სტრიქონის ტიპით \"%s\" "
"სერიალიზაციის შეცდომა"
-#: gio/gdbusmessage.c:2872
+#: gio/gdbusmessage.c:2877
#, c-format
msgid ""
"Number of file descriptors in message (%d) differs from header field (%d)"
"დესკრიპტორების რაოდენობა შეტყობინებაში (%d) განსხვავდება თავსართის ველისგან "
"(%d)"
-#: gio/gdbusmessage.c:2880
+#: gio/gdbusmessage.c:2885
msgid "Cannot serialize message: "
msgstr "სერიალიზაცია შეუძლებელია შეტყობინებისთვის: "
-#: gio/gdbusmessage.c:2933
+#: gio/gdbusmessage.c:2938
#, c-format
msgid "Message body has signature “%s” but there is no signature header"
msgstr ""
"შეტყობინების სხეულს გააჩნია ხელმოწერა \"%s\", მაგრამ ხელმოწერის თავსართი "
"აღმოჩენილი არაა"
-#: gio/gdbusmessage.c:2943
+#: gio/gdbusmessage.c:2948
#, c-format
msgid ""
"Message body has type signature “%s” but signature in the header field is "
"შეტყობინების სხეულს გააჩნია ხელმოწერა \"%s\", მაგრამ ხელმოწერა, რომელიც "
"თავსართის ველშია, \"%s\"-ია"
-#: gio/gdbusmessage.c:2959
+#: gio/gdbusmessage.c:2964
#, c-format
msgid "Message body is empty but signature in the header field is “(%s)”"
msgstr ""
"შეტყობინების სხეული ცარელია, მაგრამ ხელმოწერა თავსართის ველში \"(%s)\"-ის "
"ტოლია"
-#: gio/gdbusmessage.c:3514
+#: gio/gdbusmessage.c:3538
#, c-format
msgid "Error return with body of type “%s”"
msgstr "\"%s\" ტიპის სხეულით დაბრუნების შეცდომა"
-#: gio/gdbusmessage.c:3522
+#: gio/gdbusmessage.c:3546
msgid "Error return with empty body"
msgstr "შეცდომა ცარიელი სხეულით დაბრუნდა"
-#: gio/gdbusprivate.c:2201
+#: gio/gdbusprivate.c:2199
#, c-format
msgid "(Type any character to close this window)\n"
msgstr "(ფანჯრის დასახურად დააჭირეთ ნებისმიერ კლავიშას)\n"
-#: gio/gdbusprivate.c:2387
+#: gio/gdbusprivate.c:2385
#, c-format
msgid "Session dbus not running, and autolaunch failed"
msgstr "სესიის dbus გაშვებული არაა და ავტომატური გაშვება ჩავარდა"
-#: gio/gdbusprivate.c:2410
+#: gio/gdbusprivate.c:2408
#, c-format
msgid "Unable to get Hardware profile: %s"
msgstr "აპარატურის პროფილის მიღების შეცდომა: %s"
#. Translators: Both placeholders are file paths
-#: gio/gdbusprivate.c:2461
+#: gio/gdbusprivate.c:2464
#, c-format
msgid "Unable to load %s or %s: "
msgstr "%s-ის ან %s-ის ჩატვირთვის შეცდომა: "
-#: gio/gdbusproxy.c:1568
+#: gio/gdbusproxy.c:1552
#, c-format
msgid "Error calling StartServiceByName for %s: "
msgstr "%s-თვის StartServiceByName-ის გამოძახების შეცდომა: "
-#: gio/gdbusproxy.c:1591
+#: gio/gdbusproxy.c:1575
#, c-format
msgid "Unexpected reply %d from StartServiceByName(\"%s\") method"
msgstr "მოულოდნელი პასუხი %d StartServiceByName(\"%s\") მეთოდიდან"
-#: gio/gdbusproxy.c:2702 gio/gdbusproxy.c:2837
+#: gio/gdbusproxy.c:2686 gio/gdbusproxy.c:2821
#, c-format
msgid ""
"Cannot invoke method; proxy is for the well-known name %s without an owner, "
"მეტოდის ჩაწორება შეუძლებელია. პროქსი კარგად ცნობილი სახელისთვის %s მფლობლის "
"გარეშეა და პროქსი G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START ალმით აიგო"
-#: gio/gdbusserver.c:758
+#: gio/gdbusserver.c:739
msgid "Abstract namespace not supported"
msgstr "აბსტრაქტული სახელების სივრცე მხარდაჭერილი არაა"
-#: gio/gdbusserver.c:850
+#: gio/gdbusserver.c:831
msgid "Cannot specify nonce file when creating a server"
msgstr "სერვერის შექმნისას nonce ფაილს ვერ მიუთითებთ"
-#: gio/gdbusserver.c:932
+#: gio/gdbusserver.c:913
#, c-format
msgid "Error writing nonce file at “%s”: %s"
msgstr "შეცდომა nonce ფაილში ჩაწერისას მისამართზე \"%s\": %s"
-#: gio/gdbusserver.c:1107
+#: gio/gdbusserver.c:1088
#, c-format
msgid "The string “%s” is not a valid D-Bus GUID"
msgstr "სტრიქონი \"%s\" სწორ D-Bus-ის GUID-ს არ წარმოადგენს"
-#: gio/gdbusserver.c:1145
+#: gio/gdbusserver.c:1126
#, c-format
msgid "Cannot listen on unsupported transport “%s”"
msgstr "მხარდაუჭერელ ტრანსპორტზე \"%s\" ვერ მოვუსმენ"
msgid "Not authorized to change debug settings"
msgstr "გამართვის პარამეტრების შესაცვლელად ავტორიზაცია არ გაგაჩნიათ"
-#: gio/gdesktopappinfo.c:2242 gio/gdesktopappinfo.c:5226
+#: gio/gdesktopappinfo.c:2235 gio/gdesktopappinfo.c:5219
+#: gio/gwin32appinfo.c:4256
msgid "Unnamed"
msgstr "უსახელო"
-#: gio/gdesktopappinfo.c:2652
+#: gio/gdesktopappinfo.c:2645
msgid "Desktop file didn’t specify Exec field"
msgstr ".desktop ფაილში Exec ველი მითითებული არაა"
-#: gio/gdesktopappinfo.c:2942
+#: gio/gdesktopappinfo.c:2935
msgid "Unable to find terminal required for application"
msgstr "აპლიკაციისთვის აუცილებელი ტერმინალი ვერ ვიპოვე"
-#: gio/gdesktopappinfo.c:3002
+#: gio/gdesktopappinfo.c:2995
#, c-format
msgid "Program ‘%s’ not found in $PATH"
msgstr "პროგრამა '%s' $PATH-ში აღმოჩენილი არაა"
-#: gio/gdesktopappinfo.c:3738
+#: gio/gdesktopappinfo.c:3731
#, c-format
msgid "Can’t create user application configuration folder %s: %s"
msgstr "ვერ შევქმენი მომხმარებლის აპლიკაციის კონფიგურაციის საქაღალდე %s: %s"
-#: gio/gdesktopappinfo.c:3742
+#: gio/gdesktopappinfo.c:3735
#, c-format
msgid "Can’t create user MIME configuration folder %s: %s"
msgstr "ვერ შევქმენი MIME-ის კონფიგურაციის საქაღალდე %s: %s"
-#: gio/gdesktopappinfo.c:3984 gio/gdesktopappinfo.c:4008
+#: gio/gdesktopappinfo.c:3977 gio/gdesktopappinfo.c:4001
msgid "Application information lacks an identifier"
msgstr "აპლიკაციის ინფორმაციას იდენტიფიკატორი აკლია"
-#: gio/gdesktopappinfo.c:4244
+#: gio/gdesktopappinfo.c:4237
#, c-format
msgid "Can’t create user desktop file %s"
msgstr "მომხმარებლის სამუშაო მაგიდის ფაილის '%s' შექმნა შეუძლებელია"
-#: gio/gdesktopappinfo.c:4380
+#: gio/gdesktopappinfo.c:4373
#, c-format
msgid "Custom definition for %s"
msgstr "ხელით მითითებული აღწერა %s-სთვის"
-#: gio/gdrive.c:419
+#: gio/gdrive.c:417
msgid "drive doesn’t implement eject"
msgstr "ამძრავს გამოღების ფუნქცია არ გააჩნია"
#. Translators: This is an error
#. * message for drive objects that
#. * don't implement any of eject or eject_with_operation.
-#: gio/gdrive.c:497
+#: gio/gdrive.c:495
msgid "drive doesn’t implement eject or eject_with_operation"
msgstr "ამძრავს გამოღების ან eject_with_operations-ის ფუნქცია არ გააჩნია"
-#: gio/gdrive.c:573
+#: gio/gdrive.c:571
msgid "drive doesn’t implement polling for media"
msgstr "ამძრავს მედიის გამოკითხვის ფუნქცია არ გააჩნია"
-#: gio/gdrive.c:780
+#: gio/gdrive.c:778
msgid "drive doesn’t implement start"
msgstr "ამძრავს გაშვების ფუნქცია არ გააჩნია"
-#: gio/gdrive.c:882
+#: gio/gdrive.c:880
msgid "drive doesn’t implement stop"
msgstr "ამძრავს გაჩერების ფუნქცია არ გააჩნია"
-#: gio/gdtlsconnection.c:1188 gio/gtlsconnection.c:957
+#: gio/gdtlsconnection.c:1154 gio/gtlsconnection.c:921
msgid "TLS backend does not implement TLS binding retrieval"
msgstr "TLS უკანაბოლოს TLS მიბმის მიღების მხარდაჭერა არ გააჩნია"
msgid "DTLS support is not available"
msgstr "DTLS-ის მხარდაჭერა ხელმისაწვდომი არაა"
-#: gio/gemblem.c:325
+#: gio/gemblem.c:332
#, c-format
msgid "Can’t handle version %d of GEmblem encoding"
msgstr "GEmblem-ის კოდირების %d ვერსია უცნობია"
-#: gio/gemblem.c:335
+#: gio/gemblem.c:342
#, c-format
msgid "Malformed number of tokens (%d) in GEmblem encoding"
msgstr "კოდების არასწორი რაოდენობა(%d) GEmblem-ის დაშიფვრაში"
-#: gio/gemblemedicon.c:364
+#: gio/gemblemedicon.c:366
#, c-format
msgid "Can’t handle version %d of GEmblemedIcon encoding"
msgstr "GEmblemedIcon-ის კოდირების %d ვერსია უცნობია"
-#: gio/gemblemedicon.c:374
+#: gio/gemblemedicon.c:376
#, c-format
msgid "Malformed number of tokens (%d) in GEmblemedIcon encoding"
msgstr "კოდების არასწორი რაოდენობა(%d) GEmblemedIcon-ის დაშიფვრაში"
-#: gio/gemblemedicon.c:397
+#: gio/gemblemedicon.c:399
msgid "Expected a GEmblem for GEmblemedIcon"
msgstr "GEmblemedIcon-სთვის GEmblem-ს ველოდებოდი"
#. * trying to find the enclosing (user visible)
#. * mount of a file, but none exists.
#.
-#: gio/gfile.c:1601
+#: gio/gfile.c:1604
msgid "Containing mount does not exist"
msgstr "შეცველი მიმაგრება არ არსებობს"
-#: gio/gfile.c:2648 gio/glocalfile.c:2518
+#: gio/gfile.c:2650 gio/glocalfile.c:2518
msgid "Can’t copy over directory"
msgstr "საქაღალდეზე ზემოდან კოპირება შეუძლებელია"
-#: gio/gfile.c:2708
+#: gio/gfile.c:2710
msgid "Can’t copy directory over directory"
msgstr "საქაღალდის საქაღალდეზე კოპირება შეუძლებელია"
-#: gio/gfile.c:2716
+#: gio/gfile.c:2718
msgid "Target file exists"
msgstr "სამიზნე ფაილი უკვე არსებობს"
-#: gio/gfile.c:2735
+#: gio/gfile.c:2737
msgid "Can’t recursively copy directory"
msgstr "საქაღალდის რეკურსიულად კოპირება შეუძლებელია"
-#: gio/gfile.c:3044 gio/gfile.c:3092
+#: gio/gfile.c:3050 gio/gfile.c:3098
#, c-format
msgid "Copy file range not supported"
msgstr "ფაილების დიაპაზონის კოპირება მხარდაჭერილი არაა"
-#: gio/gfile.c:3050 gio/gfile.c:3161
+#: gio/gfile.c:3056 gio/gfile.c:3167
#, c-format
msgid "Error splicing file: %s"
msgstr "ფაილის შეერთების შეცდომა: %s"
-#: gio/gfile.c:3157
+#: gio/gfile.c:3163
msgid "Splice not supported"
msgstr "შეერთება მხარდაჭერილი არაა"
-#: gio/gfile.c:3321
+#: gio/gfile.c:3327
msgid "Copy (reflink/clone) between mounts is not supported"
msgstr ""
-#: gio/gfile.c:3325
+#: gio/gfile.c:3331
msgid "Copy (reflink/clone) is not supported or invalid"
msgstr ""
-#: gio/gfile.c:3330
+#: gio/gfile.c:3336
msgid "Copy (reflink/clone) is not supported or didn’t work"
msgstr ""
-#: gio/gfile.c:3395
+#: gio/gfile.c:3401
msgid "Can’t copy special file"
msgstr "სპეციალური ფაილის კოპირება შეუძლებელია"
-#: gio/gfile.c:4314
+#: gio/gfile.c:4318
msgid "Invalid symlink value given"
msgstr "სიმბმბულის მითითებული მნიშვნელობა არასწორია"
-#: gio/gfile.c:4324 glib/gfileutils.c:2392
+#: gio/gfile.c:4328 glib/gfileutils.c:2399
msgid "Symbolic links not supported"
msgstr "სიმბოლური ბმების გამოყენება არაა რეალიზებული"
-#: gio/gfile.c:4611
+#: gio/gfile.c:4609
msgid "Trash not supported"
msgstr "ნაგავი მხარდაუჭერელია"
-#: gio/gfile.c:4723
+#: gio/gfile.c:4719
#, c-format
msgid "File names cannot contain “%c”"
msgstr "ფაილის სახელი არ შეიძლება, \"%c\"-ს შეიცავდეს"
-#: gio/gfile.c:7155 gio/gfile.c:7281
+#: gio/gfile.c:7145 gio/gfile.c:7271
#, c-format
msgid "Failed to create a temporary directory for template “%s”: %s"
msgstr "შაბლონისთვის \"%s\" დროებითი საქაღალდის შექმნის შეცდომა: %s"
-#: gio/gfile.c:7599 gio/gvolume.c:366
+#: gio/gfile.c:7589 gio/gvolume.c:362
msgid "volume doesn’t implement mount"
msgstr "ტომს მიმაგრების მხარდაჭერა არ გააჩნია"
-#: gio/gfile.c:7713 gio/gfile.c:7790
+#: gio/gfile.c:7703 gio/gfile.c:7780
msgid "No application is registered as handling this file"
msgstr "ამ ფაილის გასახსნელი პროგრამა დარეგისტრირებული არაა"
-#: gio/gfileenumerator.c:214
+#: gio/gfileenumerator.c:216
msgid "Enumerator is closed"
msgstr "დამთვლელი დახურულია"
-#: gio/gfileenumerator.c:221 gio/gfileenumerator.c:280
-#: gio/gfileenumerator.c:425 gio/gfileenumerator.c:525
+#: gio/gfileenumerator.c:223 gio/gfileenumerator.c:282
+#: gio/gfileenumerator.c:427 gio/gfileenumerator.c:527
msgid "File enumerator has outstanding operation"
msgstr "ფაილის დამთვლელი დაკავებულია"
-#: gio/gfileenumerator.c:416 gio/gfileenumerator.c:516
+#: gio/gfileenumerator.c:418 gio/gfileenumerator.c:518
msgid "File enumerator is already closed"
msgstr "ფაილის დამთვლელი უკვე დახურულია"
-#: gio/gfileicon.c:252
+#: gio/gfileicon.c:248
#, c-format
msgid "Can’t handle version %d of GFileIcon encoding"
msgstr "GFileIcon-ის კოდირების %d ვერსია უცნობია"
-#: gio/gfileicon.c:262
+#: gio/gfileicon.c:258
msgid "Malformed input data for GFileIcon"
msgstr "GFileIcon-ს ის შეყვანილი მონაცემები არასწორია"
-#: gio/gfileinputstream.c:151 gio/gfileinputstream.c:397
-#: gio/gfileiostream.c:169 gio/gfileoutputstream.c:166
-#: gio/gfileoutputstream.c:499
+#: gio/gfileinputstream.c:148 gio/gfileinputstream.c:394
+#: gio/gfileiostream.c:166 gio/gfileoutputstream.c:163
+#: gio/gfileoutputstream.c:497
msgid "Stream doesn’t support query_info"
msgstr "ნაკადს query_info-ის მხარდაჭერა არ გააჩნია"
-#: gio/gfileinputstream.c:328 gio/gfileiostream.c:382
-#: gio/gfileoutputstream.c:373
+#: gio/gfileinputstream.c:325 gio/gfileiostream.c:380
+#: gio/gfileoutputstream.c:371
msgid "Seek not supported on stream"
msgstr "ნაკადში გადახვევა მხარდაუჭერელია"
-#: gio/gfileinputstream.c:372
+#: gio/gfileinputstream.c:369
msgid "Truncate not allowed on input stream"
msgstr "შეყვანის ნაკადზე წაკვეთა დაუშვებელია"
-#: gio/gfileiostream.c:458 gio/gfileoutputstream.c:449
+#: gio/gfileiostream.c:456 gio/gfileoutputstream.c:447
msgid "Truncate not supported on stream"
msgstr "ნაკადის მოკვეთა მხარდაუჭერელია"
-#: gio/ghttpproxy.c:93 gio/gresolver.c:535 gio/gresolver.c:688
-#: glib/gconvert.c:1842
+#: gio/ghttpproxy.c:93 gio/gresolver.c:529 gio/gresolver.c:682
+#: glib/gconvert.c:1743
msgid "Invalid hostname"
msgstr "ჰოსტის არასწორი სახელი"
msgid "HTTP proxy server closed connection unexpectedly."
msgstr "HTTP პროქსისთან მიერთება მოულოდნელად დაიხურა."
-#: gio/gicon.c:299
+#: gio/gicon.c:297
#, c-format
msgid "Wrong number of tokens (%d)"
msgstr "კოდების არასწორი რაოდენობა (%d)"
-#: gio/gicon.c:319
+#: gio/gicon.c:317
#, c-format
msgid "No type for class name %s"
msgstr "ტიპი კლასის სახელისთვის %s მითითებული არაა"
-#: gio/gicon.c:329
+#: gio/gicon.c:327
#, c-format
msgid "Type %s does not implement the GIcon interface"
msgstr "ტიპი %s GIcon ინტერფეისის განხორციელებას არ ახდენს"
-#: gio/gicon.c:340
+#: gio/gicon.c:338
#, c-format
msgid "Type %s is not classed"
msgstr "ტიპი %s klasSi araa"
-#: gio/gicon.c:354
+#: gio/gicon.c:352
#, c-format
msgid "Malformed version number: %s"
msgstr "არასწორი ვერსიის ნომერი: %s"
-#: gio/gicon.c:368
+#: gio/gicon.c:366
#, c-format
msgid "Type %s does not implement from_tokens() on the GIcon interface"
msgstr "ტიპი %s GIcon ინტერფეისზე from_tokens()-ის განხორციელებას არ ახდენს"
-#: gio/gicon.c:470
+#: gio/gicon.c:468
msgid "Can’t handle the supplied version of the icon encoding"
msgstr "ხატულის კოდირების მითითებული ვერსიის დამუშავება შეუძლებელია"
-#: gio/ginetaddressmask.c:184
+#: gio/ginetaddressmask.c:192
msgid "No address specified"
msgstr "მისამართი მითითებული არაა"
-#: gio/ginetaddressmask.c:192
+#: gio/ginetaddressmask.c:200
#, c-format
msgid "Length %u is too long for address"
msgstr "სიგრძე %u მისამართისთვის მეტისმეტად გრძელია"
-#: gio/ginetaddressmask.c:225
+#: gio/ginetaddressmask.c:233
msgid "Address has bits set beyond prefix length"
msgstr "მისამართს ბიტები პრეფიქსის სიგრძის მიღმა აქვს"
-#: gio/ginetaddressmask.c:302
+#: gio/ginetaddressmask.c:310
#, c-format
msgid "Could not parse “%s” as IP address mask"
msgstr "\"%s\"-ის IP მისამართის ნიღბის სახით დამუშავება შეუძლებელია"
-#: gio/ginetsocketaddress.c:205 gio/ginetsocketaddress.c:222
-#: gio/gnativesocketaddress.c:111 gio/gunixsocketaddress.c:230
+#: gio/ginetsocketaddress.c:199 gio/ginetsocketaddress.c:216
+#: gio/gnativesocketaddress.c:107 gio/gunixsocketaddress.c:222
msgid "Not enough space for socket address"
msgstr "სოკეტის მისამართისთვის ადგილი საკმარისი არაა"
-#: gio/ginetsocketaddress.c:237
+#: gio/ginetsocketaddress.c:231
msgid "Unsupported socket address"
msgstr "სოკეტის მხარდაუჭერელი მისამართი"
#. Translators: This is an error you get if there is
#. * already an operation running against this stream when
#. * you try to start one
-#: gio/ginputstream.c:1256 gio/giostream.c:312 gio/goutputstream.c:2218
+#: gio/ginputstream.c:1256 gio/giostream.c:327 gio/goutputstream.c:2218
msgid "Stream has outstanding operation"
-msgstr ""
+msgstr "ნაკადი გადაუდებელ ოპერაციას ასრულებს"
#: gio/gio-tool.c:162
msgid "Copy with file"
msgid "“version” takes no arguments"
msgstr "\"version\"-ს არგუმენტები არ აქვს"
-#: gio/gio-tool.c:209 gio/gio-tool.c:225 glib/goption.c:871
+#: gio/gio-tool.c:209 gio/gio-tool.c:258 glib/goption.c:712
msgid "Usage:"
msgstr "გამოყენება:"
msgid "Print version information and exit."
msgstr "ვერსიის ინფორმაციის გამოტანა და გასვლა."
-#: gio/gio-tool.c:228
-msgid "Commands:"
-msgstr "ბრძანებები:"
-
-#: gio/gio-tool.c:231
+#: gio/gio-tool.c:232
msgid "Concatenate files to standard output"
-msgstr ""
+msgstr "სტანდარტულ შეტანაზე არსებული ფაილების შეერთება"
-#: gio/gio-tool.c:232
+#: gio/gio-tool.c:233
msgid "Copy one or more files"
msgstr "ერთი ან მეტი ფაილის კოპირება"
-#: gio/gio-tool.c:233
+#: gio/gio-tool.c:234
msgid "Show information about locations"
msgstr "მდებარეობების შესახებ ინფორმაციის ჩვენება"
-#: gio/gio-tool.c:234
+#: gio/gio-tool.c:235
msgid "Launch an application from a desktop file"
msgstr "აპლიკაციის გაშვება სამუშაო მაგიდის ფაილიდან"
-#: gio/gio-tool.c:235
+#: gio/gio-tool.c:236
msgid "List the contents of locations"
msgstr "მდებარეობების შემცველობის სია"
-#: gio/gio-tool.c:236
+#: gio/gio-tool.c:237
msgid "Get or set the handler for a mimetype"
msgstr "დამმუშავებლის დაყენება ან მიღება mimetype-სთვის"
-#: gio/gio-tool.c:237
+#: gio/gio-tool.c:238
msgid "Create directories"
msgstr "საქაღალდეების შექმნა"
-#: gio/gio-tool.c:238
+#: gio/gio-tool.c:239
msgid "Monitor files and directories for changes"
msgstr "ფაილების და საქაღალდეების ცვლილებების მონიტორინგი"
-#: gio/gio-tool.c:239
+#: gio/gio-tool.c:240
msgid "Mount or unmount the locations"
msgstr "მდებარეობების მიმაგრება ან მოხსნა"
-#: gio/gio-tool.c:240
+#: gio/gio-tool.c:241
msgid "Move one or more files"
msgstr "ერთი ან მეტი ფაილის გადატანა"
-#: gio/gio-tool.c:241
+#: gio/gio-tool.c:242
msgid "Open files with the default application"
msgstr "ფაილების ნაგულისხმევი აპლიკაციით გახსნა"
-#: gio/gio-tool.c:242
+#: gio/gio-tool.c:243
msgid "Rename a file"
msgstr "ფაილის სახელის გადარქმევა"
-#: gio/gio-tool.c:243
+#: gio/gio-tool.c:244
msgid "Delete one or more files"
msgstr "ერთი ან მეტი ფაილის აშლა"
-#: gio/gio-tool.c:244
+#: gio/gio-tool.c:245
msgid "Read from standard input and save"
msgstr "სტანდარტული შეტანიდან წაკითხვა და შენახვა"
-#: gio/gio-tool.c:245
+#: gio/gio-tool.c:246
msgid "Set a file attribute"
msgstr "ფაილის ატრიბუტის დაყენება"
-#: gio/gio-tool.c:246
+#: gio/gio-tool.c:247
msgid "Move files or directories to the trash"
msgstr "ფაილების ან საქაღალდეების ნაგვის ყუთში გადატანა"
-#: gio/gio-tool.c:247
+#: gio/gio-tool.c:248
msgid "Lists the contents of locations in a tree"
msgstr "ხეში მდებარეობების შემცველობის ჩამონათვალი"
-#: gio/gio-tool.c:249
+#: gio/gio-tool.c:261
+msgid "Commands:"
+msgstr "ბრძანებები:"
+
+#: gio/gio-tool.c:275
#, c-format
msgid "Use %s to get detailed help.\n"
msgstr "დეტალური დახმარების მისაღებად გამოიყენეთ %s.\n"
msgstr "შეცდომა stdout-ზე ჩაწერისას"
#. Translators: commandline placeholder
-#: gio/gio-tool-cat.c:135 gio/gio-tool-info.c:382 gio/gio-tool-list.c:176
+#: gio/gio-tool-cat.c:135 gio/gio-tool-info.c:383 gio/gio-tool-list.c:176
#: gio/gio-tool-mkdir.c:50 gio/gio-tool-monitor.c:39 gio/gio-tool-monitor.c:41
#: gio/gio-tool-monitor.c:43 gio/gio-tool-monitor.c:45
#: gio/gio-tool-monitor.c:206 gio/gio-tool-mount.c:1236 gio/gio-tool-open.c:72
#: gio/gio-tool-cat.c:140
msgid "Concatenate files and print to standard output."
-msgstr ""
+msgstr "ფაილების შეერთება და სტანდარტულ გამოტანაზე ჩვენება."
#: gio/gio-tool-cat.c:142
msgid ""
"like smb://server/resource/file.txt as location."
msgstr ""
-#: gio/gio-tool-cat.c:164 gio/gio-tool-info.c:413 gio/gio-tool-mkdir.c:78
+#: gio/gio-tool-cat.c:164 gio/gio-tool-info.c:414 gio/gio-tool-mkdir.c:78
#: gio/gio-tool-monitor.c:231 gio/gio-tool-mount.c:1287 gio/gio-tool-open.c:98
#: gio/gio-tool-remove.c:74 gio/gio-tool-trash.c:303
msgid "No locations given"
msgstr "მდებარეობები მითითებული არაა"
-#: gio/gio-tool-copy.c:45 gio/gio-tool-move.c:40
+#: gio/gio-tool-copy.c:46 gio/gio-tool-move.c:40
msgid "No target directory"
msgstr "სამიზნე საქაღალდის გარეშე"
-#: gio/gio-tool-copy.c:46 gio/gio-tool-move.c:41
+#: gio/gio-tool-copy.c:47 gio/gio-tool-move.c:41
msgid "Show progress"
msgstr "მიმდინარეობის ჩვენება"
-#: gio/gio-tool-copy.c:47 gio/gio-tool-move.c:42
+#: gio/gio-tool-copy.c:48 gio/gio-tool-move.c:42
msgid "Prompt before overwrite"
msgstr "კითხვა თავზე გადაწერამდე"
-#: gio/gio-tool-copy.c:48
+#: gio/gio-tool-copy.c:49
msgid "Preserve all attributes"
msgstr "ყველა ატრიბუტის შენარჩუნება"
-#: gio/gio-tool-copy.c:49 gio/gio-tool-move.c:43 gio/gio-tool-save.c:51
+#: gio/gio-tool-copy.c:50 gio/gio-tool-move.c:43 gio/gio-tool-save.c:51
msgid "Backup existing destination files"
msgstr "არსებული სამიზნე ფაილების მარქაფი"
-#: gio/gio-tool-copy.c:50
+#: gio/gio-tool-copy.c:51
msgid "Never follow symbolic links"
msgstr "არასდროს მიჰყვე სიმბმულებს"
-#: gio/gio-tool-copy.c:51
+#: gio/gio-tool-copy.c:52
msgid "Use default permissions for the destination"
msgstr "სამიზნისთვის ნაგულისხმევი წვდომების გამოყენება"
-#: gio/gio-tool-copy.c:76 gio/gio-tool-move.c:69
+#: gio/gio-tool-copy.c:53
+msgid "Use default file modification timestamps for the destination"
+msgstr "სამიზნისთვის ნაგულისხმევი ფაილის ცვლილების დროის შტამპების გამოყენება"
+
+#: gio/gio-tool-copy.c:78 gio/gio-tool-move.c:69
#, c-format
msgid "Transferred %s out of %s (%s/s)"
msgstr "გადაცემულია %s %s-დან (%s/წმ)"
#. Translators: commandline placeholder
-#: gio/gio-tool-copy.c:102 gio/gio-tool-move.c:96
+#: gio/gio-tool-copy.c:104 gio/gio-tool-move.c:96
msgid "SOURCE"
msgstr "წყარო"
#. Translators: commandline placeholder
-#: gio/gio-tool-copy.c:102 gio/gio-tool-move.c:96 gio/gio-tool-save.c:162
+#: gio/gio-tool-copy.c:104 gio/gio-tool-move.c:96 gio/gio-tool-save.c:162
msgid "DESTINATION"
msgstr "დანიშნულება"
-#: gio/gio-tool-copy.c:107
+#: gio/gio-tool-copy.c:109
msgid "Copy one or more files from SOURCE to DESTINATION."
msgstr ""
-#: gio/gio-tool-copy.c:109
+#: gio/gio-tool-copy.c:111
msgid ""
"gio copy is similar to the traditional cp utility, but using GIO\n"
"locations instead of local files: for example, you can use something\n"
"like smb://server/resource/file.txt as location."
msgstr ""
-#: gio/gio-tool-copy.c:151
+#: gio/gio-tool-copy.c:153
#, c-format
msgid "Destination %s is not a directory"
msgstr "სამიზნე %s საქაღალდე არაა"
-#: gio/gio-tool-copy.c:198 gio/gio-tool-move.c:188
+#: gio/gio-tool-copy.c:202 gio/gio-tool-move.c:188
#, c-format
msgid "%s: overwrite “%s”? "
msgstr "%s: გადავაწერო %s-ს? "
msgid "edit name: %s\n"
msgstr "სახელის ჩასწორება: %s\n"
-#: gio/gio-tool-info.c:184
+#: gio/gio-tool-info.c:185
#, c-format
msgid "name: %s\n"
msgstr "სახელი: %s\n"
-#: gio/gio-tool-info.c:191
+#: gio/gio-tool-info.c:192
#, c-format
msgid "type: %s\n"
msgstr "ტიპი : %s\n"
-#: gio/gio-tool-info.c:197
+#: gio/gio-tool-info.c:198
msgid "size: "
msgstr "ზომა: "
-#: gio/gio-tool-info.c:203
+#: gio/gio-tool-info.c:204
msgid "hidden\n"
msgstr "დამალული\n"
-#: gio/gio-tool-info.c:206
+#: gio/gio-tool-info.c:207
#, c-format
msgid "uri: %s\n"
msgstr "uri: %s\n"
-#: gio/gio-tool-info.c:213
+#: gio/gio-tool-info.c:214
#, c-format
msgid "local path: %s\n"
msgstr "ლოკალური ბილიკი: %s\n"
-#: gio/gio-tool-info.c:247
+#: gio/gio-tool-info.c:248
#, c-format
msgid "unix mount: %s%s %s %s %s\n"
msgstr "unix მიმაგრება: %s%s %s %s %s\n"
-#: gio/gio-tool-info.c:328
+#: gio/gio-tool-info.c:329
msgid "Settable attributes:\n"
msgstr "დაყენებადი პარამეტრები:\n"
-#: gio/gio-tool-info.c:352
+#: gio/gio-tool-info.c:353
msgid "Writable attribute namespaces:\n"
msgstr "ჩაწერადი ატრიბუტი სახელის სივრცეები:\n"
-#: gio/gio-tool-info.c:387
+#: gio/gio-tool-info.c:388
msgid "Show information about locations."
msgstr "მდებარეობების შესახებ ინფორმაციის ჩვენება."
-#: gio/gio-tool-info.c:389
+#: gio/gio-tool-info.c:390
msgid ""
"gio info is similar to the traditional ls utility, but using GIO\n"
"locations instead of local files: for example, you can use something\n"
#: gio/gio-tool-launch.c:109
#, c-format
msgid "Unable to load application information for ‘%s‘"
-msgstr ""
+msgstr "ვერ ჩავტვირთე აპლიკაციის ინფორმაცია '%s'-სთვის"
#: gio/gio-tool-launch.c:121
#, c-format
#, c-format
msgid "Failed to set “%s” as the default handler for “%s”: %s\n"
msgstr ""
+"შეცდომა \"%s\"-ის ნაგულიხმევ დამმუშავებლად დაყენებისას \"%s\"-სთვის: %s\n"
#: gio/gio-tool-mkdir.c:33
msgid "Create parent directories"
#: gio/gio-tool-monitor.c:39
msgid "Monitor a directory (default: depends on type)"
-msgstr ""
+msgstr "საქაღალდის მონიტორინგი (ნაგულისხმევი: დამოკიდებულია ტიპზე)"
#: gio/gio-tool-monitor.c:41
msgid "Monitor a file (default: depends on type)"
-msgstr ""
+msgstr "ფაილის მონიტორინგი (ნაგულისხმევი: დამოკიდებულია ტიპზე)"
#: gio/gio-tool-monitor.c:43
msgid "Monitor a file directly (notices changes made via hardlinks)"
#: gio/gio-tool-mount.c:77
msgid "The numeric PIM when unlocking a VeraCrypt volume"
-msgstr ""
+msgstr "რიცხვითი PIM დაშიფრული VeraCrypt ტომის გახსნისას"
#: gio/gio-tool-mount.c:77
msgid "PIM"
#: gio/gio-tool-remove.c:33 gio/gio-tool-trash.c:35
msgid "Ignore nonexistent files, never prompt"
-msgstr ""
+msgstr "არარსებული ფაილების გამოტოვება. არასდროს მკითხო"
#: gio/gio-tool-remove.c:54
msgid "Delete the given files."
#: gio/gio-tool-save.c:55
msgid "When replacing, replace as if the destination did not exist"
-msgstr ""
+msgstr "ჩანაცვლებისას, ჩაანაცვლე, თითქოს სამიზნე ფაილი არც არსებობდა"
#. Translators: The "etag" is a token allowing to verify whether a file has been modified
#: gio/gio-tool-save.c:57
#: gio/gio-tool-save.c:165
msgid "Read from standard input and save to DEST."
-msgstr ""
+msgstr "წაკითხვა სტანდარტული შეყვანიდან და მითითებულ სამიზნეზე ჩაწერა."
#: gio/gio-tool-save.c:185
msgid "No destination given"
#: gio/gio-tool-set.c:99
msgid "Set a file attribute of LOCATION."
-msgstr ""
+msgstr "მითითებული მდებარეობის ფაილის ატრიბუტის დაყენება."
#: gio/gio-tool-set.c:119
msgid "Location not specified"
#: gio/gio-tool-trash.c:37
msgid "List files in the trash with their original locations"
-msgstr ""
+msgstr "ნაგვის ყუთში არსებული ფაილების სია მათი საწყისი მდებარეობებით"
#: gio/gio-tool-trash.c:38
msgid ""
#: gio/gio-tool-trash.c:227
msgid "Move/Restore files or directories to the trash."
-msgstr ""
+msgstr "ფაილების ან საქაღალდეების ნაგვის ყუთში გადატანა/აღდგენა."
#: gio/gio-tool-trash.c:229
msgid ""
#: gio/gio-tool-trash.c:260
msgid "Location given doesn't start with trash:///"
-msgstr ""
+msgstr "მითითებული მდებარეობა არ იწყება სტრიქონით trash:///"
#: gio/gio-tool-tree.c:35
msgid "Follow symbolic links, mounts and shortcuts"
#, c-format
msgid "%s preprocessing requested, but %s is not set, and %s is not in PATH"
msgstr ""
+"%s წინასწარი დამუშავება მოთხოვნილია, მაგრამ %s დაყენებული არაა და %s გარემოს "
+"ცვლად PATH-ში არაა"
#: gio/glib-compile-resources.c:459
#, c-format
#: gio/glib-compile-schemas.c:95
#, c-format
msgid "nick must be a minimum of 2 characters"
-msgstr ""
+msgstr "ფსევდონიმი, მიმიმუმ, 2 სიმბოლოს უნდა შეიცავდეს"
#: gio/glib-compile-schemas.c:106
#, c-format
#: gio/glib-compile-schemas.c:317
#, c-format
msgid "<%s> is not contained in the specified range"
-msgstr ""
+msgstr "<%s> მითითებული შუალედიდან არაა"
#: gio/glib-compile-schemas.c:329
#, c-format
msgid "<%s> is not a valid member of the specified enumerated type"
-msgstr ""
+msgstr "<%s> მითითებული ჩამონათვალის ტიპის სწორი წევრი არაა"
#: gio/glib-compile-schemas.c:335
#, c-format
msgid "<%s> contains string not in the specified flags type"
-msgstr ""
+msgstr "<%s> შეიცავს სტრიქონს, რომელიც მითითებული ალმის ტიპში არაა"
#: gio/glib-compile-schemas.c:341
#, c-format
msgid "<%s> contains a string not in <choices>"
-msgstr ""
+msgstr "<%s> შეიცავს სტრიქონს, რომელიც <choices>-ში არაა"
#: gio/glib-compile-schemas.c:375
msgid "<range/> already specified for this key"
#: gio/glib-compile-schemas.c:393
#, c-format
msgid "<range> not allowed for keys of type “%s”"
-msgstr ""
+msgstr "<range> დაუშვებელია გასაღებებისთვის ტიპით “%s”"
#: gio/glib-compile-schemas.c:410
#, c-format
msgid "<range> specified minimum is greater than maximum"
-msgstr ""
+msgstr "<range> მაქსიმალური მნიშვნელობა მინიმალურზე მეტი უნდა იყოს"
#: gio/glib-compile-schemas.c:435
#, c-format
#, c-format
msgid "Invalid name “%s”: names must begin with a lowercase letter"
msgstr ""
+"არასწორი სახელი \"%s\": სახელები ქვედა რეგისტრის სიმბოლოებით უნდა იწყებოდეს"
#: gio/glib-compile-schemas.c:819
#, c-format
#: gio/glib-compile-schemas.c:845
#, c-format
msgid "Invalid name “%s”: maximum length is 1024"
-msgstr ""
+msgstr "არასწორი სახელი \"%s\": მაქსიმალური სიგრძეა 1024"
#: gio/glib-compile-schemas.c:917
#, c-format
#: gio/glib-compile-schemas.c:1231
#, c-format
msgid "The path of a list must end with “:/”"
-msgstr ""
+msgstr "სიის ბილიკი ':/'-ით უნდა მთავრდებოდეს"
#: gio/glib-compile-schemas.c:1240
#, c-format
msgid "Error setting extended attribute “%s”: %s"
msgstr "გაფართოებული ატრიბუტის \"%s\" დაყენების შეცდომა: %s"
-#: gio/glocalfileinfo.c:1785 gio/win32/gwinhttpfile.c:191
+#: gio/glocalfileinfo.c:1789 gio/win32/gwinhttpfile.c:191
msgid " (invalid encoding)"
msgstr " (არასწორი კოდირება)"
-#: gio/glocalfileinfo.c:1944 gio/glocalfileoutputstream.c:945
+#: gio/glocalfileinfo.c:1948 gio/glocalfileoutputstream.c:945
#: gio/glocalfileoutputstream.c:997
#, c-format
msgid "Error when getting information for file “%s”: %s"
msgstr "ფაილის \"%s\" შესახებ ინფორმაციის მიღების შეცდომა: %s"
-#: gio/glocalfileinfo.c:2250
+#: gio/glocalfileinfo.c:2254
#, c-format
msgid "Error when getting information for file descriptor: %s"
msgstr "შეცდომა ფაილის დესკრიპტორის შესახებ ინფორმაციის მიღებისას: %s"
-#: gio/glocalfileinfo.c:2295
+#: gio/glocalfileinfo.c:2299
msgid "Invalid attribute type (uint32 expected)"
msgstr "ატრიბუტის არასწორი ტიპი (მოველოდი uint32-ს)"
-#: gio/glocalfileinfo.c:2313
+#: gio/glocalfileinfo.c:2317
msgid "Invalid attribute type (uint64 expected)"
msgstr "ატრიბუტის არასწორი ტიპი (მოველოდი uint64-ს)"
-#: gio/glocalfileinfo.c:2332 gio/glocalfileinfo.c:2351
+#: gio/glocalfileinfo.c:2336 gio/glocalfileinfo.c:2355
msgid "Invalid attribute type (byte string expected)"
msgstr "არასწორი ატრიბუტის ტიპი (მოველოდები ბაიტს ან სტრიქონს)"
-#: gio/glocalfileinfo.c:2398
+#: gio/glocalfileinfo.c:2402
msgid "Cannot set permissions on symlinks"
msgstr "სიმბმულებზე წვდომების დაყენების შეცდომა"
-#: gio/glocalfileinfo.c:2414
+#: gio/glocalfileinfo.c:2418
#, c-format
msgid "Error setting permissions: %s"
msgstr "წვდომის დაყენების შეცდომა: %s"
-#: gio/glocalfileinfo.c:2465
+#: gio/glocalfileinfo.c:2469
#, c-format
msgid "Error setting owner: %s"
msgstr "მფლობლის დაყენების შეცდომა: %s"
-#: gio/glocalfileinfo.c:2488
+#: gio/glocalfileinfo.c:2492
msgid "symlink must be non-NULL"
msgstr "სიმბმული არა-ნულოვანი უნდა იყოს"
-#: gio/glocalfileinfo.c:2498 gio/glocalfileinfo.c:2517
-#: gio/glocalfileinfo.c:2528
+#: gio/glocalfileinfo.c:2502 gio/glocalfileinfo.c:2521
+#: gio/glocalfileinfo.c:2532
#, c-format
msgid "Error setting symlink: %s"
msgstr "სიმბმულის დაყენების შეცდომა: %s"
-#: gio/glocalfileinfo.c:2507
+#: gio/glocalfileinfo.c:2511
msgid "Error setting symlink: file is not a symlink"
msgstr "სიმბმულის დაყენების შეცდომა: ფაილი სიმბმული არაა"
-#: gio/glocalfileinfo.c:2599
+#: gio/glocalfileinfo.c:2603
#, c-format
msgid "Extra nanoseconds %d for UNIX timestamp %lld are negative"
msgstr ""
-#: gio/glocalfileinfo.c:2608
+#: gio/glocalfileinfo.c:2612
#, c-format
msgid "Extra nanoseconds %d for UNIX timestamp %lld reach 1 second"
msgstr ""
-#: gio/glocalfileinfo.c:2618
+#: gio/glocalfileinfo.c:2622
#, c-format
msgid "UNIX timestamp %lld does not fit into 64 bits"
msgstr ""
-#: gio/glocalfileinfo.c:2629
+#: gio/glocalfileinfo.c:2633
#, c-format
msgid "UNIX timestamp %lld is outside of the range supported by Windows"
msgstr ""
-#: gio/glocalfileinfo.c:2761
+#: gio/glocalfileinfo.c:2765
#, c-format
msgid "File name “%s” cannot be converted to UTF-16"
msgstr "ფაილის სახელის \"%s\" UTF-16-ში გადაყვანა შეუძლებელია"
-#: gio/glocalfileinfo.c:2780
+#: gio/glocalfileinfo.c:2784
#, c-format
msgid "File “%s” cannot be opened: Windows Error %lu"
msgstr ""
-#: gio/glocalfileinfo.c:2793
+#: gio/glocalfileinfo.c:2797
#, c-format
msgid "Error setting modification or access time for file “%s”: %lu"
msgstr "%s-ისთვის შეცვლის ან წვდომის დროის დაყენების შეცდომა: %lu"
-#: gio/glocalfileinfo.c:2950
+#: gio/glocalfileinfo.c:2974
#, c-format
msgid "Error setting modification or access time: %s"
msgstr "ცვლილების ან წვდომის დროის დაყენების შეცდომა: %s"
-#: gio/glocalfileinfo.c:2973
+#: gio/glocalfileinfo.c:2997
msgid "SELinux context must be non-NULL"
msgstr "SELinux-ის კონტექსტი ნულოვანი არ უნდა იყოს"
-#: gio/glocalfileinfo.c:2980
+#: gio/glocalfileinfo.c:3004
msgid "SELinux is not enabled on this system"
msgstr "ამ სისტემაზე SELnux ჩართული არაა"
-#: gio/glocalfileinfo.c:2990
+#: gio/glocalfileinfo.c:3014
#, c-format
msgid "Error setting SELinux context: %s"
msgstr "SELinux-ის კონტექსტის დაყენების შეცდომა: %s"
-#: gio/glocalfileinfo.c:3087
+#: gio/glocalfileinfo.c:3111
#, c-format
msgid "Setting attribute %s not supported"
msgstr "ატრიბუტის (%s) დაყენება მხარდაუჭერელია"
msgstr "ფაილის წაკვეთის შეცდომა: %s"
#: gio/glocalfileoutputstream.c:664 gio/glocalfileoutputstream.c:909
-#: gio/glocalfileoutputstream.c:1223 gio/gsubprocess.c:231
+#: gio/glocalfileoutputstream.c:1223 gio/gsubprocess.c:227
#, c-format
msgid "Error opening file “%s”: %s"
msgstr "ფაილის (\"%s\") გახსნის შეცდომა: %s"
msgid "Error removing old file: %s"
msgstr "ძველი ფაილის წაშლის შეცდომა: %s"
-#: gio/gmemoryinputstream.c:476 gio/gmemoryoutputstream.c:764
+#: gio/gmemoryinputstream.c:473 gio/gmemoryoutputstream.c:751
msgid "Invalid GSeekType supplied"
msgstr "მიწოდებული GSeekType არასწორია"
-#: gio/gmemoryinputstream.c:486
+#: gio/gmemoryinputstream.c:483
msgid "Invalid seek request"
msgstr "გადახვევის არასწორი მოთხოვნა"
-#: gio/gmemoryinputstream.c:510
+#: gio/gmemoryinputstream.c:507
msgid "Cannot truncate GMemoryInputStream"
msgstr "GMemoryInputStream-ის წაკვეთა შეუძლებელია"
-#: gio/gmemoryoutputstream.c:570
+#: gio/gmemoryoutputstream.c:557
msgid "Memory output stream not resizable"
msgstr "მეხსიერების გამოტანის ნაკადის ზომა შეცვლადი არაა"
-#: gio/gmemoryoutputstream.c:586
+#: gio/gmemoryoutputstream.c:573
msgid "Failed to resize memory output stream"
msgstr "მეხსიერების გამოტანის ნაკადის ზომის შეცვლა ჩავარდა"
-#: gio/gmemoryoutputstream.c:665
+#: gio/gmemoryoutputstream.c:652
msgid ""
"Amount of memory required to process the write is larger than available "
"address space"
msgstr ""
-#: gio/gmemoryoutputstream.c:774
+#: gio/gmemoryoutputstream.c:761
msgid "Requested seek before the beginning of the stream"
msgstr ""
-#: gio/gmemoryoutputstream.c:789
+#: gio/gmemoryoutputstream.c:776
msgid "Requested seek beyond the end of the stream"
msgstr ""
#. Translators: This is an error
#. * message for mount objects that
#. * don't implement unmount.
-#: gio/gmount.c:401
+#: gio/gmount.c:400
msgid "mount doesn’t implement “unmount”"
msgstr "მიმაგრების წერტილს არ გააჩნია მხარდაჭერა ფუნქციის \"unmount\""
#. Translators: This is an error
#. * message for mount objects that
#. * don't implement eject.
-#: gio/gmount.c:477
+#: gio/gmount.c:476
msgid "mount doesn’t implement “eject”"
msgstr "მიმაგრების წერტილს არ გააჩნია მხარდაჭერა ფუნქციის \"eject\""
#. Translators: This is an error
#. * message for mount objects that
#. * don't implement any of unmount or unmount_with_operation.
-#: gio/gmount.c:555
+#: gio/gmount.c:554
msgid "mount doesn’t implement “unmount” or “unmount_with_operation”"
msgstr ""
"მიმაგრების წერტილს არ გააჩნია მხარდაჭერა ფუნქციის \"unmount\" ან "
#. Translators: This is an error
#. * message for mount objects that
#. * don't implement any of eject or eject_with_operation.
-#: gio/gmount.c:640
+#: gio/gmount.c:639
msgid "mount doesn’t implement “eject” or “eject_with_operation”"
msgstr ""
"მიმაგრების წერტილს არ გააჩნია მხარდაჭერა ფუნქციის \"eject\" ან "
#. Translators: This is an error
#. * message for mount objects that
#. * don't implement remount.
-#: gio/gmount.c:728
+#: gio/gmount.c:727
msgid "mount doesn’t implement “remount”"
msgstr "მიმაგრების წერტილს არ გააჩნია მხარდაჭერა ფუნქციის \"remount\""
#. Translators: This is an error
#. * message for mount objects that
#. * don't implement content type guessing.
-#: gio/gmount.c:810
+#: gio/gmount.c:809
msgid "mount doesn’t implement content type guessing"
msgstr ""
"მიმაგრების წერტილს შემცველობის ტიპის გამოცნობის ფუნქციის მხარდაჭერა არ "
#. Translators: This is an error
#. * message for mount objects that
#. * don't implement content type guessing.
-#: gio/gmount.c:897
+#: gio/gmount.c:896
msgid "mount doesn’t implement synchronous content type guessing"
msgstr ""
"მიმაგრების წერტილს სინქრონული შემცველობის ტიპის გამოცნობის ფუნქციის "
"მხარდაჭერა არ გააჩნია"
-#: gio/gnetworkaddress.c:417
+#: gio/gnetworkaddress.c:424
#, c-format
msgid "Hostname “%s” contains “[” but not “]”"
msgstr "ჰოსტის სახელი “%s” შეიცავს “[”-ს, მაგრამ არა “]”-ს"
msgid "NetworkManager version too old"
msgstr "NetworkManager-ის ვერსია მეტისმეტად ძველია"
-#: gio/goutputstream.c:234 gio/goutputstream.c:777
+#: gio/goutputstream.c:236 gio/goutputstream.c:777
msgid "Output stream doesn’t implement write"
msgstr "გამოტანის ნაკადს ჩაწერის ფუნქცია განხორციელებული არ აქვს"
msgid "Source stream is already closed"
msgstr "შეყვანის ნაკადი უკვე დახურულია"
-#: gio/gproxyaddressenumerator.c:329 gio/gproxyaddressenumerator.c:347
+#: gio/gproxyaddressenumerator.c:328 gio/gproxyaddressenumerator.c:346
msgid "Unspecified proxy lookup failure"
msgstr "მიუთითებელი პროქსის მოძებნის შეცდომა"
#. Translators: the first placeholder is a domain name, the
#. * second is an error message
-#: gio/gresolver.c:478 gio/gthreadedresolver.c:317 gio/gthreadedresolver.c:338
+#: gio/gresolver.c:472 gio/gthreadedresolver.c:317 gio/gthreadedresolver.c:338
#: gio/gthreadedresolver.c:983 gio/gthreadedresolver.c:1007
#: gio/gthreadedresolver.c:1032 gio/gthreadedresolver.c:1047
#, c-format
msgstr "'%s'-ის ამოხსნის შეცდომა: %s"
#. Translators: The placeholder is for a function name.
-#: gio/gresolver.c:547 gio/gresolver.c:707
+#: gio/gresolver.c:541 gio/gresolver.c:701
#, c-format
msgid "%s not implemented"
msgstr "%s განხორციელებული არაა"
-#: gio/gresolver.c:1076 gio/gresolver.c:1128
+#: gio/gresolver.c:1070 gio/gresolver.c:1122
msgid "Invalid domain"
msgstr "დომენის არასწორი სახელი"
-#: gio/gresource.c:683 gio/gresource.c:945 gio/gresource.c:985
-#: gio/gresource.c:1109 gio/gresource.c:1181 gio/gresource.c:1255
-#: gio/gresource.c:1336 gio/gresourcefile.c:482 gio/gresourcefile.c:606
+#: gio/gresource.c:704 gio/gresource.c:966 gio/gresource.c:1006
+#: gio/gresource.c:1130 gio/gresource.c:1202 gio/gresource.c:1276
+#: gio/gresource.c:1357 gio/gresourcefile.c:482 gio/gresourcefile.c:606
#: gio/gresourcefile.c:757
#, c-format
msgid "The resource at “%s” does not exist"
msgstr "რესურსი მისამართზე \"%s\" არ არსებობს"
-#: gio/gresource.c:850
+#: gio/gresource.c:871
#, c-format
msgid "The resource at “%s” failed to decompress"
msgstr "რესურის, მისამართზე \"%s\", გაშლა ჩავარდა"
#: gio/gresource-tool.c:563
msgid " SECTION An (optional) elf section name\n"
-msgstr ""
+msgstr " სექცია (არასავალდებულო) elf სექციის სახელი\n"
#: gio/gresource-tool.c:567 gio/gsettings-tool.c:720
msgid " COMMAND The (optional) command to explain\n"
-msgstr ""
+msgstr " ბრძანება (არასავალდებულო) ასახსნელი ბრძანება\n"
#: gio/gresource-tool.c:573
msgid " FILE An elf file (a binary or a shared library)\n"
-msgstr ""
+msgstr " ფაილი elf ფაილი (გამშვები ან გაზიარებული ბიბლიოთეკა)\n"
#: gio/gresource-tool.c:576
msgid ""
" FILE An elf file (a binary or a shared library)\n"
" or a compiled resource file\n"
msgstr ""
+" ფაილი elf ფაილი (გამშვები ან გაზიარებული ბიბლიოთეკა)\n"
+" ან აგებული რესურსის ფაილი\n"
#: gio/gresource-tool.c:580
msgid "[PATH]"
#: gio/gsettings-tool.c:733
msgid " KEY The key within the schema\n"
-msgstr ""
+msgstr " გასაღები გასაღები სქემაშ\n"
#: gio/gsettings-tool.c:737
msgid " VALUE The value to set\n"
-msgstr ""
+msgstr " მნისვნელობა დასაყენებელი მნიშვნელობა\n"
#: gio/gsettings-tool.c:792
#, c-format
msgid "No such key “%s”\n"
msgstr "ასეთი გასაღები \"%s\" არ არსებობს\n"
-#: gio/gsocket.c:419
+#: gio/gsocket.c:435
msgid "Invalid socket, not initialized"
msgstr "სოკეტი არასწორია. ინიციალიზებული არაა"
-#: gio/gsocket.c:426
+#: gio/gsocket.c:442
#, c-format
msgid "Invalid socket, initialization failed due to: %s"
msgstr "სოკეტი არასწორია. ინიციალიზაცია ჩავარდა მიზეზით: %s"
-#: gio/gsocket.c:434
+#: gio/gsocket.c:450
msgid "Socket is already closed"
msgstr "სოკეტი უკვე დახურულია"
-#: gio/gsocket.c:449 gio/gsocket.c:3238 gio/gsocket.c:4469 gio/gsocket.c:4527
-#: gio/gthreadedresolver.c:1438
+#: gio/gsocket.c:465 gio/gsocket.c:3291 gio/gsocket.c:4664 gio/gsocket.c:4722
+#: gio/gthreadedresolver.c:1452
msgid "Socket I/O timed out"
msgstr "სოკეტის I/O ვადა გავიდა"
-#: gio/gsocket.c:586
+#: gio/gsocket.c:602
#, c-format
msgid "creating GSocket from fd: %s"
msgstr "იქმნება GSocket fd-დან: %s"
-#: gio/gsocket.c:646 gio/gsocket.c:714 gio/gsocket.c:721
+#: gio/gsocket.c:662 gio/gsocket.c:730 gio/gsocket.c:737
#, c-format
msgid "Unable to create socket: %s"
msgstr "სოკეტის შექმნის შეცდომა: %s"
-#: gio/gsocket.c:714
+#: gio/gsocket.c:730
msgid "Unknown family was specified"
msgstr "მითითებული ოჯახი უცნობია"
-#: gio/gsocket.c:721
+#: gio/gsocket.c:737
msgid "Unknown protocol was specified"
msgstr "მითითებული პროტოკოლი უცნობია"
-#: gio/gsocket.c:1190
+#: gio/gsocket.c:1243
#, c-format
msgid "Cannot use datagram operations on a non-datagram socket."
msgstr ""
-#: gio/gsocket.c:1207
+#: gio/gsocket.c:1260
#, c-format
msgid "Cannot use datagram operations on a socket with a timeout set."
msgstr ""
-#: gio/gsocket.c:2014
+#: gio/gsocket.c:2067
#, c-format
msgid "could not get local address: %s"
msgstr "ლოკალური მისამართის მიღება შეუძლებელია: %s"
-#: gio/gsocket.c:2060
+#: gio/gsocket.c:2113
#, c-format
msgid "could not get remote address: %s"
msgstr "დაშორებული მისამართის მიღება შეუძლებელია: %s"
-#: gio/gsocket.c:2126
+#: gio/gsocket.c:2179
#, c-format
msgid "could not listen: %s"
msgstr "მოსმენა შეუძლებელია: %s"
-#: gio/gsocket.c:2230
+#: gio/gsocket.c:2283
#, c-format
msgid "Error binding to address %s: %s"
msgstr "მისამართზე '%s' მიბმის შეცდომა: %s"
-#: gio/gsocket.c:2405 gio/gsocket.c:2442 gio/gsocket.c:2552 gio/gsocket.c:2577
-#: gio/gsocket.c:2644 gio/gsocket.c:2702 gio/gsocket.c:2720
+#: gio/gsocket.c:2458 gio/gsocket.c:2495 gio/gsocket.c:2605 gio/gsocket.c:2630
+#: gio/gsocket.c:2697 gio/gsocket.c:2755 gio/gsocket.c:2773
#, c-format
msgid "Error joining multicast group: %s"
msgstr "შეცდომა multicast ჯგუფში გაწევრებისას: %s"
-#: gio/gsocket.c:2406 gio/gsocket.c:2443 gio/gsocket.c:2553 gio/gsocket.c:2578
-#: gio/gsocket.c:2645 gio/gsocket.c:2703 gio/gsocket.c:2721
+#: gio/gsocket.c:2459 gio/gsocket.c:2496 gio/gsocket.c:2606 gio/gsocket.c:2631
+#: gio/gsocket.c:2698 gio/gsocket.c:2756 gio/gsocket.c:2774
#, c-format
msgid "Error leaving multicast group: %s"
msgstr "შეცდომა multicast ჯგუფის დატოვებისას: %s"
-#: gio/gsocket.c:2407
+#: gio/gsocket.c:2460
msgid "No support for source-specific multicast"
msgstr "წყაროზე-დამოკიდებული multicast-ის მხარდაჭერა არ არსებბობს"
-#: gio/gsocket.c:2554
+#: gio/gsocket.c:2607
msgid "Unsupported socket family"
msgstr "სოკეტის მხარდაუჭერელი ოჯახი"
-#: gio/gsocket.c:2579
+#: gio/gsocket.c:2632
msgid "source-specific not an IPv4 address"
msgstr "წყაროზე-დამოკიდებული IPv4 მისამართი არაა"
-#: gio/gsocket.c:2603
+#: gio/gsocket.c:2656
#, c-format
msgid "Interface name too long"
msgstr "ინტერფეისის სახელი მეტისმეტად გრძელია"
-#: gio/gsocket.c:2616 gio/gsocket.c:2670
+#: gio/gsocket.c:2669 gio/gsocket.c:2723
#, c-format
msgid "Interface not found: %s"
msgstr "ინტერფეისი ვერ ვიპოვე: %s"
-#: gio/gsocket.c:2646
+#: gio/gsocket.c:2699
msgid "No support for IPv4 source-specific multicast"
-msgstr ""
+msgstr "IPv4 წყაროზე-დამოკიდებული multicast-ის მხარდაჭერის გარეშე"
-#: gio/gsocket.c:2704
+#: gio/gsocket.c:2757
msgid "No support for IPv6 source-specific multicast"
-msgstr ""
+msgstr "IPv6 წყაროზე-დამოკიდებული multicast-ის მხარდაჭერის გარეშე"
-#: gio/gsocket.c:2937
+#: gio/gsocket.c:2990
#, c-format
msgid "Error accepting connection: %s"
msgstr "შეერთების მიღების შეცდომა: %s"
-#: gio/gsocket.c:3063
+#: gio/gsocket.c:3116
msgid "Connection in progress"
msgstr "მიმდინარეობს მიერთება"
-#: gio/gsocket.c:3114
+#: gio/gsocket.c:3167
msgid "Unable to get pending error: "
msgstr "დარჩენილი შეცდომის მიღება შეუძლებელია: "
-#: gio/gsocket.c:3303
+#: gio/gsocket.c:3356
#, c-format
msgid "Error receiving data: %s"
msgstr "მონაცემები მიღების შეცდომა: %s"
-#: gio/gsocket.c:3500
+#: gio/gsocket.c:3695
#, c-format
msgid "Error sending data: %s"
msgstr "მონაცემების გაგზავნის შეცდომა: %s"
-#: gio/gsocket.c:3687
+#: gio/gsocket.c:3882
#, c-format
msgid "Unable to shutdown socket: %s"
msgstr "სოკეტის გამორთვის შეცდომა: %s"
-#: gio/gsocket.c:3768
+#: gio/gsocket.c:3963
#, c-format
msgid "Error closing socket: %s"
msgstr "სოკეტის დახურვის შეცდომა: %s"
-#: gio/gsocket.c:4462
+#: gio/gsocket.c:4657
#, c-format
msgid "Waiting for socket condition: %s"
msgstr "ველოდები სოკეტის მდგომარეობას: %s"
-#: gio/gsocket.c:4852 gio/gsocket.c:4868 gio/gsocket.c:4881
+#: gio/gsocket.c:5047 gio/gsocket.c:5063 gio/gsocket.c:5076
#, c-format
msgid "Unable to send message: %s"
msgstr "შეუძლებელია შეტყობინების გაგზავნა: %s"
-#: gio/gsocket.c:4853 gio/gsocket.c:4869 gio/gsocket.c:4882
+#: gio/gsocket.c:5048 gio/gsocket.c:5064 gio/gsocket.c:5077
msgid "Message vectors too large"
msgstr "შეტყობინების ვექტორები მეტისმეტად დიდია"
-#: gio/gsocket.c:4898 gio/gsocket.c:4900 gio/gsocket.c:5047 gio/gsocket.c:5132
-#: gio/gsocket.c:5310 gio/gsocket.c:5350 gio/gsocket.c:5352
+#: gio/gsocket.c:5093 gio/gsocket.c:5095 gio/gsocket.c:5242 gio/gsocket.c:5327
+#: gio/gsocket.c:5505 gio/gsocket.c:5545 gio/gsocket.c:5547
#, c-format
msgid "Error sending message: %s"
msgstr "შეტყობინების გაგზავნის შეცდომა: %s"
-#: gio/gsocket.c:5074
+#: gio/gsocket.c:5269
msgid "GSocketControlMessage not supported on Windows"
-msgstr ""
+msgstr "ფუნქცია GSocketControlMessage Windows-ზე მხარდაჭერილი არაა"
-#: gio/gsocket.c:5547 gio/gsocket.c:5623 gio/gsocket.c:5849
+#: gio/gsocket.c:5742 gio/gsocket.c:5818 gio/gsocket.c:6044
#, c-format
msgid "Error receiving message: %s"
msgstr "შეტყობინების მიღების შეცდომა: %s"
-#: gio/gsocket.c:6134 gio/gsocket.c:6145 gio/gsocket.c:6208
+#: gio/gsocket.c:6329 gio/gsocket.c:6340 gio/gsocket.c:6403
#, c-format
msgid "Unable to read socket credentials: %s"
msgstr "სოკეტის მომხმარებლის/პაროლის წაკითხვის შეცდომა: %s"
-#: gio/gsocket.c:6217
+#: gio/gsocket.c:6412
msgid "g_socket_get_credentials not implemented for this OS"
-msgstr ""
+msgstr "g_socket_get_credentials ამ OS-სთვის განხორციელებული არაა"
-#: gio/gsocketclient.c:193
+#: gio/gsocketclient.c:192
#, c-format
msgid "Could not connect to proxy server %s: "
msgstr "პროქსი სერვერთან (%s) დაკავშირების შეცდომა: "
-#: gio/gsocketclient.c:207
+#: gio/gsocketclient.c:206
#, c-format
msgid "Could not connect to %s: "
msgstr "%s-სთან მიერთების შეცდომა: "
-#: gio/gsocketclient.c:209
+#: gio/gsocketclient.c:208
msgid "Could not connect: "
msgstr "მიერთების პრობლემა: "
-#: gio/gsocketclient.c:1204 gio/gsocketclient.c:1807
+#: gio/gsocketclient.c:1234 gio/gsocketclient.c:1851
msgid "Proxying over a non-TCP connection is not supported."
msgstr "არა-TCP შეერთების ზემოდან პროქსი მხარდაუჭერელია."
-#: gio/gsocketclient.c:1236 gio/gsocketclient.c:1836
+#: gio/gsocketclient.c:1266 gio/gsocketclient.c:1886
#, c-format
msgid "Proxy protocol “%s” is not supported."
msgstr "პროქსი პროტოკოლი \"%s\" მხარდაუჭერელია."
-#: gio/gsocketlistener.c:232
+#: gio/gsocketlistener.c:235
msgid "Listener is already closed"
msgstr "მსმენელი უკვე დახურულია"
-#: gio/gsocketlistener.c:278
+#: gio/gsocketlistener.c:281
msgid "Added socket is closed"
msgstr "დამატებული სოკეტი დახურულია"
#: gio/gsocks4aproxy.c:120
#, c-format
msgid "SOCKSv4 does not support IPv6 address “%s”"
-msgstr ""
+msgstr "SOCKSv4-ს არ აქვს მხარდაჭერა IPv6 მისამართისთვის “%s”"
#: gio/gsocks4aproxy.c:138
msgid "Username is too long for SOCKSv4 protocol"
-msgstr ""
+msgstr "SOCKSv4 პროტოკოლისთვის მომხმარებლის სახელი ძალიან გრძელია"
#: gio/gsocks4aproxy.c:155
#, c-format
msgid "Hostname “%s” is too long for SOCKSv4 protocol"
-msgstr ""
+msgstr "SOCKSv4 პროტოკოლისთვის ჰოსტის სახელი '%s' მეტისმეტად გრძელია"
#: gio/gsocks4aproxy.c:181
msgid "The server is not a SOCKSv4 proxy server."
-msgstr ""
+msgstr "სერვერი SOCKSv4 პროქსი სერვერი არაა."
#: gio/gsocks4aproxy.c:188
msgid "Connection through SOCKSv4 server was rejected"
-msgstr ""
+msgstr "შეერთება SOCKSv4 სერვერის გავლით უარყოფილია"
#: gio/gsocks5proxy.c:155 gio/gsocks5proxy.c:340 gio/gsocks5proxy.c:350
msgid "The server is not a SOCKSv5 proxy server."
-msgstr ""
+msgstr "სერვერი SOCKSv5 პროქსი სერვერი არაა."
#: gio/gsocks5proxy.c:169 gio/gsocks5proxy.c:186
msgid "The SOCKSv5 proxy requires authentication."
-msgstr ""
+msgstr "SOCKSv5 პროქსის ავთენტიკაციას მოითხოვს."
#: gio/gsocks5proxy.c:193
msgid ""
"The SOCKSv5 proxy requires an authentication method that is not supported by "
"GLib."
msgstr ""
+"SOCKSv5 პროქსი მოითხოვს ავთენტიკაციის მეთოდს, რომელიც GLib-ის მიერ "
+"მხარდაჭერილი არაა."
#: gio/gsocks5proxy.c:222
msgid "Username or password is too long for SOCKSv5 protocol."
-msgstr ""
+msgstr "SOCKSv5 პროტოკოლისთვის მომხმარებლის სახელი ან პაროლი ძალიან გრძელია."
#: gio/gsocks5proxy.c:252
msgid "SOCKSv5 authentication failed due to wrong username or password."
msgstr ""
+"SOCKSv5 ავთენტიკაცია ჩავარდა, რადგან მომხმარებლის სახელი ან პაროლი არასწორია."
#: gio/gsocks5proxy.c:302
#, c-format
msgid "Hostname “%s” is too long for SOCKSv5 protocol"
-msgstr ""
+msgstr "SOCKSv5 პროტოკოლისთვის ჰოსტის სახელი '%s' მეტისმეტად გრძელია"
#: gio/gsocks5proxy.c:364
msgid "The SOCKSv5 proxy server uses unknown address type."
-msgstr ""
+msgstr "SOCKSv5 პროქსი სერვერი უცნობი მისამართის ტიპს იყენებს."
#: gio/gsocks5proxy.c:371
msgid "Internal SOCKSv5 proxy server error."
#: gio/gsocks5proxy.c:377
msgid "SOCKSv5 connection not allowed by ruleset."
-msgstr ""
+msgstr "SOCKSv5 მიერთება დაუშვებელია წესების მიერ."
#: gio/gsocks5proxy.c:384
msgid "Host unreachable through SOCKSv5 server."
-msgstr ""
+msgstr "SOCKSv5 სერვერის გავლით ჰოსტი მიუწვდომელია."
#: gio/gsocks5proxy.c:390
msgid "Network unreachable through SOCKSv5 proxy."
-msgstr ""
+msgstr "SOCKSv5 სერვერის გავლით ქსელი ხელმიუწვდომელია."
#: gio/gsocks5proxy.c:396
msgid "Connection refused through SOCKSv5 proxy."
-msgstr ""
+msgstr "SOCKSv5 პროქსის გავლით მიერთება უარყოფილია."
#: gio/gsocks5proxy.c:402
msgid "SOCKSv5 proxy does not support “connect” command."
-msgstr ""
+msgstr "SOCKSv5 პროქსის ბრძანება \"connect\"-ის მხარდაჭერა არ გააჩნია."
#: gio/gsocks5proxy.c:408
msgid "SOCKSv5 proxy does not support provided address type."
-msgstr ""
+msgstr "SOCKSv5 პროქსის მითითებული მისამართის ტიპის მხარდაჭერა არ გააჩნია."
#: gio/gsocks5proxy.c:414
msgid "Unknown SOCKSv5 proxy error."
msgstr "უცნობი SOCKSv5 პროქსის შეცდომა."
-#: gio/gtestdbus.c:614 glib/gspawn-win32.c:433
+#: gio/gtestdbus.c:608 glib/gspawn-win32.c:433
#, c-format
msgid "Failed to create pipe for communicating with child process (%s)"
msgstr "არხის შექმნა ქვეპროცესთან დასაკავშირებლად ვერ მოხერხდა (%s)"
-#: gio/gtestdbus.c:621
+#: gio/gtestdbus.c:615
#, c-format
msgid "Pipes are not supported in this platform"
msgstr "ამ პლატფორმაზე ფაიფები მხარდაჭერილი არაა"
-#: gio/gthemedicon.c:597
+#: gio/gthemedicon.c:590
#, c-format
msgid "Can’t handle version %d of GThemedIcon encoding"
msgstr "GThemedIcon-ის კოდირების %d ვერსია უცნობია"
#: gio/gthreadedresolver.c:514
#, c-format
msgid "Error reverse-resolving “%s”: %s"
-msgstr ""
+msgstr "\"%s\"-ის უკუამოხსნის შეცდომა: %s"
#. Translators: the placeholder is a DNS record type, such as ‘MX’ or ‘SRV’
#: gio/gthreadedresolver.c:737 gio/gthreadedresolver.c:759
#: gio/gthreadedresolver.c:889 gio/gthreadedresolver.c:901
#, c-format
msgid "Error parsing DNS %s record: malformed DNS packet"
-msgstr ""
+msgstr "DNS %s ჩანაწერის დამუშავება ჩავარდა: DNS პაკეტი შეცდომებს შეიცავს"
#: gio/gthreadedresolver.c:959 gio/gthreadedresolver.c:1096
#: gio/gthreadedresolver.c:1194 gio/gthreadedresolver.c:1244
#, c-format
msgid "No DNS record of the requested type for “%s”"
-msgstr ""
+msgstr "მოთხოვნილი ტიპის DNS ჩანაწერის გარეშე \"%s\"-სთვის"
#: gio/gthreadedresolver.c:964 gio/gthreadedresolver.c:1199
#, c-format
msgid "Temporarily unable to resolve “%s”"
-msgstr ""
+msgstr "დროებით \"%s\" ვერ ამოვხსენი"
#: gio/gthreadedresolver.c:969 gio/gthreadedresolver.c:1204
#: gio/gthreadedresolver.c:1300
#: gio/gthreadedresolver.c:1089
#, c-format
msgid "Failed to parse DNS response for “%s”: "
-msgstr ""
+msgstr "\"%s\"-სთვის DNS პასუხის დამუშავება ჩავარდა: "
-#: gio/gtlscertificate.c:480
+#: gio/gtlscertificate.c:438
msgid "No PEM-encoded private key found"
-msgstr ""
+msgstr "PEM-ით კოდირებული პირადი გასაღები ვერ ვიპოვე"
-#: gio/gtlscertificate.c:490
+#: gio/gtlscertificate.c:448
msgid "Cannot decrypt PEM-encoded private key"
-msgstr ""
+msgstr "PEM-ით დაშიფრული პირადი გასაღების გაშიფვრა შეუძლებელია"
-#: gio/gtlscertificate.c:501
+#: gio/gtlscertificate.c:459
msgid "Could not parse PEM-encoded private key"
-msgstr ""
+msgstr "PEM-ით დაშიფრული პირადი გასაღების გაშიფვრის შეცდომა"
-#: gio/gtlscertificate.c:528
+#: gio/gtlscertificate.c:486
msgid "No PEM-encoded certificate found"
-msgstr ""
+msgstr "PEM-ით დაშიფრული სერტიფიკატი ვერ ვიპოვე"
-#: gio/gtlscertificate.c:537
+#: gio/gtlscertificate.c:495
msgid "Could not parse PEM-encoded certificate"
-msgstr ""
+msgstr "PEM-ით დაშიფრული სერტიფიკატის გაშიფვრის შეცდომა"
-#: gio/gtlscertificate.c:800
+#: gio/gtlscertificate.c:758
msgid "The current TLS backend does not support PKCS #12"
msgstr ""
-#: gio/gtlscertificate.c:1017
+#: gio/gtlscertificate.c:975
msgid "This GTlsBackend does not support creating PKCS #11 certificates"
msgstr ""
-#: gio/gtlspassword.c:113
+#: gio/gtlspassword.c:104
msgid ""
"This is the last chance to enter the password correctly before your access "
"is locked out."
#. Translators: This is not the 'This is the last chance' string. It is
#. * displayed when more than one attempt is allowed.
-#: gio/gtlspassword.c:117
+#: gio/gtlspassword.c:108
msgid ""
"Several passwords entered have been incorrect, and your access will be "
"locked out after further failures."
msgstr ""
-#: gio/gtlspassword.c:119
+#: gio/gtlspassword.c:110
msgid "The password entered is incorrect."
msgstr "შეყვანილი პაროლი არასწორია."
-#: gio/gunixconnection.c:127
+#: gio/gunixconnection.c:116
msgid "Sending FD is not supported"
msgstr "FD-ის გაგზავნა მხარდაუჭერელია"
-#: gio/gunixconnection.c:181 gio/gunixconnection.c:602
+#: gio/gunixconnection.c:170 gio/gunixconnection.c:591
#, c-format
msgid "Expecting 1 control message, got %d"
msgid_plural "Expecting 1 control message, got %d"
-msgstr[0] ""
+msgstr[0] "მოველოდი 1 საკონტროლო შეტყობინებას. მივიღე %d"
-#: gio/gunixconnection.c:197 gio/gunixconnection.c:614
+#: gio/gunixconnection.c:186 gio/gunixconnection.c:603
msgid "Unexpected type of ancillary data"
-msgstr ""
+msgstr "დამატებითი მონაცემების მოულოდნელი ტიპი"
-#: gio/gunixconnection.c:216
+#: gio/gunixconnection.c:205
#, c-format
msgid "Expecting one fd, but got %d\n"
msgid_plural "Expecting one fd, but got %d\n"
msgstr[0] "მოველოდი ერთ fd-ს, მივიღე %d\n"
-#: gio/gunixconnection.c:235
+#: gio/gunixconnection.c:224
msgid "Received invalid fd"
msgstr "მიღებულია არასწორი fd"
-#: gio/gunixconnection.c:242
+#: gio/gunixconnection.c:231
msgid "Receiving FD is not supported"
msgstr "FD-ის მიღება მხარდაუჭერელია"
-#: gio/gunixconnection.c:384
+#: gio/gunixconnection.c:373
msgid "Error sending credentials: "
msgstr "შეცდომა ავტორიზაციის დეტალების გაგზავნისას: "
-#: gio/gunixconnection.c:542
+#: gio/gunixconnection.c:531
#, c-format
msgid "Error checking if SO_PASSCRED is enabled for socket: %s"
msgstr ""
-#: gio/gunixconnection.c:558
+#: gio/gunixconnection.c:547
#, c-format
msgid "Error enabling SO_PASSCRED: %s"
-msgstr ""
+msgstr "შეცდომა SO_PASSCRED-ის ჩართვისას: %s"
-#: gio/gunixconnection.c:587
+#: gio/gunixconnection.c:576
msgid ""
"Expecting to read a single byte for receiving credentials but read zero bytes"
msgstr ""
-#: gio/gunixconnection.c:628
+#: gio/gunixconnection.c:617
#, c-format
msgid "Not expecting control message, but got %d"
-msgstr ""
+msgstr "არ მოველოდი საკონტროლო შეტყობინებას. მივიღე %d"
-#: gio/gunixconnection.c:653
+#: gio/gunixconnection.c:642
#, c-format
msgid "Error while disabling SO_PASSCRED: %s"
-msgstr ""
+msgstr "შეცდომა SO_PASSCRED-ის გამორთვისას: %s"
-#: gio/gunixinputstream.c:359 gio/gunixinputstream.c:380
+#: gio/gunixinputstream.c:352 gio/gunixinputstream.c:373
#, c-format
msgid "Error reading from file descriptor: %s"
msgstr "შეცდომა ფაილის დესკრიპტორიდან კითხვისას: %s"
-#: gio/gunixinputstream.c:413 gio/gunixoutputstream.c:522
-#: gio/gwin32inputstream.c:219 gio/gwin32outputstream.c:206
+#: gio/gunixinputstream.c:406 gio/gunixoutputstream.c:515
+#: gio/gwin32inputstream.c:216 gio/gwin32outputstream.c:203
#, c-format
msgid "Error closing file descriptor: %s"
msgstr "შეცდომა ფაილის დესკრიპტორის დახურვისას: %s"
-#: gio/gunixmounts.c:2826 gio/gunixmounts.c:2879
+#: gio/gunixmounts.c:2814 gio/gunixmounts.c:2867
msgid "Filesystem root"
msgstr "ფაილური სისტემის საწყისი საქაღალდე"
-#: gio/gunixoutputstream.c:359 gio/gunixoutputstream.c:379
-#: gio/gunixoutputstream.c:466 gio/gunixoutputstream.c:486
-#: gio/gunixoutputstream.c:632
+#: gio/gunixoutputstream.c:352 gio/gunixoutputstream.c:372
+#: gio/gunixoutputstream.c:459 gio/gunixoutputstream.c:479
+#: gio/gunixoutputstream.c:625
#, c-format
msgid "Error writing to file descriptor: %s"
msgstr "შეცდომა ფაილის დესკრიპტორში ჩაწერისას: %s"
-#: gio/gunixsocketaddress.c:253
+#: gio/gunixsocketaddress.c:245
msgid "Abstract UNIX domain socket addresses not supported on this system"
msgstr ""
-#: gio/gvolume.c:440
+#: gio/gvolume.c:436
msgid "volume doesn’t implement eject"
msgstr "ტომს გამოღების ფუნქცია არ გააჩნია"
#. Translators: This is an error
#. * message for volume objects that
#. * don't implement any of eject or eject_with_operation.
-#: gio/gvolume.c:517
+#: gio/gvolume.c:513
msgid "volume doesn’t implement eject or eject_with_operation"
msgstr ""
-#: gio/gwin32inputstream.c:187
+#: gio/gwin32appinfo.c:5216
+#, c-format
+msgid "The app ‘%s’ in the application object has no verbs"
+msgstr ""
+
+#: gio/gwin32appinfo.c:5220
+#, c-format
+msgid ""
+"The app ‘%s’ and the handler ‘%s’ in the application object have no verbs"
+msgstr ""
+
+#: gio/gwin32inputstream.c:184
#, c-format
msgid "Error reading from handle: %s"
msgstr "დამმუშავებლიდან წაკითხვის შეცდომა: %s"
-#: gio/gwin32inputstream.c:234 gio/gwin32outputstream.c:221
+#: gio/gwin32inputstream.c:231 gio/gwin32outputstream.c:218
#, c-format
msgid "Error closing handle: %s"
msgstr "დამმუშავებლის დახურვის შეცდომა: %s"
-#: gio/gwin32outputstream.c:174
+#: gio/gwin32outputstream.c:171
#, c-format
msgid "Error writing to handle: %s"
msgstr "დამმუშავებელში ჩაწერის შეცდომა: %s"
-#: gio/gzlibcompressor.c:396 gio/gzlibdecompressor.c:349
+#: gio/gzlibcompressor.c:399 gio/gzlibdecompressor.c:345
msgid "Not enough memory"
msgstr "მეხსიერება საკმარისი არ არის"
-#: gio/gzlibcompressor.c:403 gio/gzlibdecompressor.c:356
+#: gio/gzlibcompressor.c:406 gio/gzlibdecompressor.c:352
#, c-format
msgid "Internal error: %s"
msgstr "შიდა შეცდომა: %s"
-#: gio/gzlibcompressor.c:416 gio/gzlibdecompressor.c:370
+#: gio/gzlibcompressor.c:419 gio/gzlibdecompressor.c:366
msgid "Need more input"
msgstr "საჭიროა მეტი შეტანა"
-#: gio/gzlibdecompressor.c:342
+#: gio/gzlibdecompressor.c:338
msgid "Invalid compressed data"
msgstr "არასწორი შეკუმშული მონაცემები"
msgid "Wrong args\n"
msgstr "არასწორი არგუმენტები\n"
-#: glib/gbookmarkfile.c:861
+#: glib/gbookmarkfile.c:816
#, c-format
msgid "Unexpected attribute “%s” for element “%s”"
msgstr "მოულოდნელი ატრიბუტი '%s' ელემენტ '%s'-თვის"
-#: glib/gbookmarkfile.c:872 glib/gbookmarkfile.c:952 glib/gbookmarkfile.c:962
-#: glib/gbookmarkfile.c:1075
+#: glib/gbookmarkfile.c:827 glib/gbookmarkfile.c:907 glib/gbookmarkfile.c:917
+#: glib/gbookmarkfile.c:1030
#, c-format
msgid "Attribute “%s” of element “%s” not found"
msgstr "ატრიბუტი'%s' ელემენტისთვის '%s' ვერ მოიძებნა"
-#: glib/gbookmarkfile.c:1284 glib/gbookmarkfile.c:1349
-#: glib/gbookmarkfile.c:1413 glib/gbookmarkfile.c:1423
+#: glib/gbookmarkfile.c:1239 glib/gbookmarkfile.c:1304
+#: glib/gbookmarkfile.c:1368 glib/gbookmarkfile.c:1378
#, c-format
msgid "Unexpected tag “%s”, tag “%s” expected"
msgstr "უცნობი ჭდე '%s', მოსალოდნელი იყო '%s'"
-#: glib/gbookmarkfile.c:1309 glib/gbookmarkfile.c:1323
-#: glib/gbookmarkfile.c:1391 glib/gbookmarkfile.c:1437
+#: glib/gbookmarkfile.c:1264 glib/gbookmarkfile.c:1278
+#: glib/gbookmarkfile.c:1346 glib/gbookmarkfile.c:1392
#, c-format
msgid "Unexpected tag “%s” inside “%s”"
msgstr "უცნობი ჭდე '%s' - '%s'-ში"
-#: glib/gbookmarkfile.c:1717
+#: glib/gbookmarkfile.c:1672
#, c-format
msgid "Invalid date/time ‘%s’ in bookmark file"
msgstr ""
-#: glib/gbookmarkfile.c:1956
+#: glib/gbookmarkfile.c:1911
msgid "No valid bookmark file found in data dirs"
msgstr "მონაცემთა დასტებში მართებული საკვანძო ფაილი ვერ მოიძებნა"
-#: glib/gbookmarkfile.c:2157
+#: glib/gbookmarkfile.c:2112
#, c-format
msgid "A bookmark for URI “%s” already exists"
msgstr "სანიშნე URI-სთვის '%s' უკვე არსებობს"
-#: glib/gbookmarkfile.c:2206 glib/gbookmarkfile.c:2364
-#: glib/gbookmarkfile.c:2449 glib/gbookmarkfile.c:2529
-#: glib/gbookmarkfile.c:2614 glib/gbookmarkfile.c:2748
-#: glib/gbookmarkfile.c:2881 glib/gbookmarkfile.c:3016
-#: glib/gbookmarkfile.c:3058 glib/gbookmarkfile.c:3155
-#: glib/gbookmarkfile.c:3276 glib/gbookmarkfile.c:3470
-#: glib/gbookmarkfile.c:3611 glib/gbookmarkfile.c:3830
-#: glib/gbookmarkfile.c:3919 glib/gbookmarkfile.c:4008
-#: glib/gbookmarkfile.c:4127
+#: glib/gbookmarkfile.c:2161 glib/gbookmarkfile.c:2319
+#: glib/gbookmarkfile.c:2404 glib/gbookmarkfile.c:2484
+#: glib/gbookmarkfile.c:2569 glib/gbookmarkfile.c:2703
+#: glib/gbookmarkfile.c:2836 glib/gbookmarkfile.c:2971
+#: glib/gbookmarkfile.c:3013 glib/gbookmarkfile.c:3110
+#: glib/gbookmarkfile.c:3231 glib/gbookmarkfile.c:3425
+#: glib/gbookmarkfile.c:3566 glib/gbookmarkfile.c:3785
+#: glib/gbookmarkfile.c:3874 glib/gbookmarkfile.c:3963
+#: glib/gbookmarkfile.c:4082
#, c-format
msgid "No bookmark found for URI “%s”"
msgstr "URI '%s'-თვის სანიშნე ვერ მოიძებნა"
-#: glib/gbookmarkfile.c:2538
+#: glib/gbookmarkfile.c:2493
#, c-format
msgid "No MIME type defined in the bookmark for URI “%s”"
msgstr "URI '%s' სანიშნეში MIME ტიპი მითითებული არაა"
-#: glib/gbookmarkfile.c:2623
+#: glib/gbookmarkfile.c:2578
#, c-format
msgid "No private flag has been defined in bookmark for URI “%s”"
msgstr "URI '%s' სანიშნეში პირადი ალამი არ მითითებულა"
-#: glib/gbookmarkfile.c:3164
+#: glib/gbookmarkfile.c:3119
#, c-format
msgid "No groups set in bookmark for URI “%s”"
msgstr "URI '%s' სანიშნეში ჯგუფები დაყენებული არაა"
-#: glib/gbookmarkfile.c:3632 glib/gbookmarkfile.c:3840
+#: glib/gbookmarkfile.c:3587 glib/gbookmarkfile.c:3795
#, c-format
msgid "No application with name “%s” registered a bookmark for “%s”"
msgstr "პროგრამას სახელით \"%s\" სანიშნე \"%s\" არ დაურეგისტრირებია"
-#: glib/gbookmarkfile.c:3863
+#: glib/gbookmarkfile.c:3818
#, c-format
msgid "Failed to expand exec line “%s” with URI “%s”"
msgstr ""
-#: glib/gconvert.c:469
+#: glib/gconvert.c:370
msgid "Unrepresentable character in conversion input"
msgstr ""
-#: glib/gconvert.c:496 glib/gutf8.c:954 glib/gutf8.c:1167 glib/gutf8.c:1304
+#: glib/gconvert.c:397 glib/gutf8.c:954 glib/gutf8.c:1167 glib/gutf8.c:1304
#: glib/gutf8.c:1408
msgid "Partial character sequence at end of input"
msgstr "არასრული სიმბოლო შეტანის ტექსტის ბოლოს"
-#: glib/gconvert.c:767
+#: glib/gconvert.c:668
#, c-format
msgid "Cannot convert fallback “%s” to codeset “%s”"
msgstr "ვერ ხერხდება \"%s\" სიმბოლოს გარდაქმნა კოდირებაში \"%s\""
-#: glib/gconvert.c:939
+#: glib/gconvert.c:840
msgid "Embedded NUL byte in conversion input"
msgstr "გადაყვანისას შეყვანაში ჩაშენებული NUL ბაიტი"
-#: glib/gconvert.c:960
+#: glib/gconvert.c:861
msgid "Embedded NUL byte in conversion output"
msgstr "გადაყვანისას გამოტანაში ჩაშენებული NUL ბაიტი"
-#: glib/gconvert.c:1698
+#: glib/gconvert.c:1599
#, c-format
msgid "The URI “%s” is not an absolute URI using the “file” scheme"
msgstr ""
"URI \"%s\" არ გახლავთ აბსოლუტური იდენტიფიკატორი \"file\" სქემის გამოყენებისას"
-#: glib/gconvert.c:1728
+#: glib/gconvert.c:1629
#, c-format
msgid "The URI “%s” is invalid"
msgstr "URI იდენტიფიკატორი \"%s\" მცდარია"
-#: glib/gconvert.c:1741
+#: glib/gconvert.c:1642
#, c-format
msgid "The hostname of the URI “%s” is invalid"
msgstr "URI იდენტიფიკატორის \"%s\" ჰოსტის სახელი მცდარია"
-#: glib/gconvert.c:1758
+#: glib/gconvert.c:1659
#, c-format
msgid "The URI “%s” contains invalidly escaped characters"
msgstr "URI იდენტიფიკატორი \"%s\" შეიცავ მცდარ საკონტროლო სიმბოლოებს"
-#: glib/gconvert.c:1832
+#: glib/gconvert.c:1733
#, c-format
msgid "The pathname “%s” is not an absolute path"
msgstr "ბილიკი \"%s\" აბსოლუტური არ გახლავთ"
#. Translators: this is the preferred format for expressing the date and the time
-#: glib/gdatetime.c:228
+#: glib/gdatetime.c:199
msgctxt "GDateTime"
msgid "%a %b %e %H:%M:%S %Y"
msgstr "%Y წლის %d %B, %T %Z"
#. Translators: this is the preferred format for expressing the date
-#: glib/gdatetime.c:231
+#: glib/gdatetime.c:202
msgctxt "GDateTime"
msgid "%m/%d/%y"
msgstr "%m/%d/%Y"
#. Translators: this is the preferred format for expressing the time
-#: glib/gdatetime.c:234
+#: glib/gdatetime.c:205
msgctxt "GDateTime"
msgid "%H:%M:%S"
msgstr "%T"
#. Translators: this is the preferred format for expressing 12 hour time
-#: glib/gdatetime.c:237
+#: glib/gdatetime.c:208
msgctxt "GDateTime"
msgid "%I:%M:%S %p"
msgstr "%I:%M:%S %p"
#. * non-European) there is no difference between the standalone and
#. * complete date form.
#.
-#: glib/gdatetime.c:276
+#: glib/gdatetime.c:247
msgctxt "full month name"
msgid "January"
msgstr "იანვარი"
-#: glib/gdatetime.c:278
+#: glib/gdatetime.c:249
msgctxt "full month name"
msgid "February"
msgstr "თებერვალი"
-#: glib/gdatetime.c:280
+#: glib/gdatetime.c:251
msgctxt "full month name"
msgid "March"
msgstr "მარტი"
-#: glib/gdatetime.c:282
+#: glib/gdatetime.c:253
msgctxt "full month name"
msgid "April"
msgstr "აპრილი"
-#: glib/gdatetime.c:284
+#: glib/gdatetime.c:255
msgctxt "full month name"
msgid "May"
msgstr "მაისი"
-#: glib/gdatetime.c:286
+#: glib/gdatetime.c:257
msgctxt "full month name"
msgid "June"
msgstr "ივნისი"
-#: glib/gdatetime.c:288
+#: glib/gdatetime.c:259
msgctxt "full month name"
msgid "July"
msgstr "ივლისი"
-#: glib/gdatetime.c:290
+#: glib/gdatetime.c:261
msgctxt "full month name"
msgid "August"
msgstr "აგვისტო"
-#: glib/gdatetime.c:292
+#: glib/gdatetime.c:263
msgctxt "full month name"
msgid "September"
msgstr "სექტემბერი"
-#: glib/gdatetime.c:294
+#: glib/gdatetime.c:265
msgctxt "full month name"
msgid "October"
msgstr "ოქტომბერი"
-#: glib/gdatetime.c:296
+#: glib/gdatetime.c:267
msgctxt "full month name"
msgid "November"
msgstr "ნოემბერი"
-#: glib/gdatetime.c:298
+#: glib/gdatetime.c:269
msgctxt "full month name"
msgid "December"
msgstr "დეკემბერი"
#. * other platform. Here are abbreviated month names in a form
#. * appropriate when they are used standalone.
#.
-#: glib/gdatetime.c:330
+#: glib/gdatetime.c:301
msgctxt "abbreviated month name"
msgid "Jan"
msgstr "იან"
-#: glib/gdatetime.c:332
+#: glib/gdatetime.c:303
msgctxt "abbreviated month name"
msgid "Feb"
msgstr "თებ"
-#: glib/gdatetime.c:334
+#: glib/gdatetime.c:305
msgctxt "abbreviated month name"
msgid "Mar"
msgstr "მარ"
-#: glib/gdatetime.c:336
+#: glib/gdatetime.c:307
msgctxt "abbreviated month name"
msgid "Apr"
msgstr "აპრ"
-#: glib/gdatetime.c:338
+#: glib/gdatetime.c:309
msgctxt "abbreviated month name"
msgid "May"
msgstr "მაისი"
-#: glib/gdatetime.c:340
+#: glib/gdatetime.c:311
msgctxt "abbreviated month name"
msgid "Jun"
msgstr "ივნ"
-#: glib/gdatetime.c:342
+#: glib/gdatetime.c:313
msgctxt "abbreviated month name"
msgid "Jul"
msgstr "ივლ"
-#: glib/gdatetime.c:344
+#: glib/gdatetime.c:315
msgctxt "abbreviated month name"
msgid "Aug"
msgstr "აგვ"
-#: glib/gdatetime.c:346
+#: glib/gdatetime.c:317
msgctxt "abbreviated month name"
msgid "Sep"
msgstr "სექ"
-#: glib/gdatetime.c:348
+#: glib/gdatetime.c:319
msgctxt "abbreviated month name"
msgid "Oct"
msgstr "ოქტ"
-#: glib/gdatetime.c:350
+#: glib/gdatetime.c:321
msgctxt "abbreviated month name"
msgid "Nov"
msgstr "ნოე"
-#: glib/gdatetime.c:352
+#: glib/gdatetime.c:323
msgctxt "abbreviated month name"
msgid "Dec"
msgstr "დეკ"
-#: glib/gdatetime.c:367
+#: glib/gdatetime.c:338
msgctxt "full weekday name"
msgid "Monday"
msgstr "ორშაბათი"
-#: glib/gdatetime.c:369
+#: glib/gdatetime.c:340
msgctxt "full weekday name"
msgid "Tuesday"
msgstr "სამშაბათი"
-#: glib/gdatetime.c:371
+#: glib/gdatetime.c:342
msgctxt "full weekday name"
msgid "Wednesday"
msgstr "ოთხშაბათი"
-#: glib/gdatetime.c:373
+#: glib/gdatetime.c:344
msgctxt "full weekday name"
msgid "Thursday"
msgstr "ხუთშაბათი"
-#: glib/gdatetime.c:375
+#: glib/gdatetime.c:346
msgctxt "full weekday name"
msgid "Friday"
msgstr "პარასკევი"
-#: glib/gdatetime.c:377
+#: glib/gdatetime.c:348
msgctxt "full weekday name"
msgid "Saturday"
msgstr "შაბათი"
-#: glib/gdatetime.c:379
+#: glib/gdatetime.c:350
msgctxt "full weekday name"
msgid "Sunday"
msgstr "კვირა"
-#: glib/gdatetime.c:394
+#: glib/gdatetime.c:365
msgctxt "abbreviated weekday name"
msgid "Mon"
msgstr "ორშ"
-#: glib/gdatetime.c:396
+#: glib/gdatetime.c:367
msgctxt "abbreviated weekday name"
msgid "Tue"
msgstr "სამ"
-#: glib/gdatetime.c:398
+#: glib/gdatetime.c:369
msgctxt "abbreviated weekday name"
msgid "Wed"
msgstr "ოთხ"
-#: glib/gdatetime.c:400
+#: glib/gdatetime.c:371
msgctxt "abbreviated weekday name"
msgid "Thu"
msgstr "ხუთ"
-#: glib/gdatetime.c:402
+#: glib/gdatetime.c:373
msgctxt "abbreviated weekday name"
msgid "Fri"
msgstr "პარ"
-#: glib/gdatetime.c:404
+#: glib/gdatetime.c:375
msgctxt "abbreviated weekday name"
msgid "Sat"
msgstr "შაბ"
-#: glib/gdatetime.c:406
+#: glib/gdatetime.c:377
msgctxt "abbreviated weekday name"
msgid "Sun"
msgstr "კვი"
#. * (western European, non-European) there is no difference between the
#. * standalone and complete date form.
#.
-#: glib/gdatetime.c:470
+#: glib/gdatetime.c:441
msgctxt "full month name with day"
msgid "January"
msgstr "იანვარი"
-#: glib/gdatetime.c:472
+#: glib/gdatetime.c:443
msgctxt "full month name with day"
msgid "February"
msgstr "თებერვალი"
-#: glib/gdatetime.c:474
+#: glib/gdatetime.c:445
msgctxt "full month name with day"
msgid "March"
msgstr "მარტი"
-#: glib/gdatetime.c:476
+#: glib/gdatetime.c:447
msgctxt "full month name with day"
msgid "April"
msgstr "აპრილი"
-#: glib/gdatetime.c:478
+#: glib/gdatetime.c:449
msgctxt "full month name with day"
msgid "May"
msgstr "მაისი"
-#: glib/gdatetime.c:480
+#: glib/gdatetime.c:451
msgctxt "full month name with day"
msgid "June"
msgstr "ივნისი"
-#: glib/gdatetime.c:482
+#: glib/gdatetime.c:453
msgctxt "full month name with day"
msgid "July"
msgstr "ივლისი"
-#: glib/gdatetime.c:484
+#: glib/gdatetime.c:455
msgctxt "full month name with day"
msgid "August"
msgstr "აგვისტო"
-#: glib/gdatetime.c:486
+#: glib/gdatetime.c:457
msgctxt "full month name with day"
msgid "September"
msgstr "სექტემბერი"
-#: glib/gdatetime.c:488
+#: glib/gdatetime.c:459
msgctxt "full month name with day"
msgid "October"
msgstr "ოქტომბერი"
-#: glib/gdatetime.c:490
+#: glib/gdatetime.c:461
msgctxt "full month name with day"
msgid "November"
msgstr "ნოემბერი"
-#: glib/gdatetime.c:492
+#: glib/gdatetime.c:463
msgctxt "full month name with day"
msgid "December"
msgstr "დეკემბერი"
#. * 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:557
+#: glib/gdatetime.c:528
msgctxt "abbreviated month name with day"
msgid "Jan"
msgstr "იან"
-#: glib/gdatetime.c:559
+#: glib/gdatetime.c:530
msgctxt "abbreviated month name with day"
msgid "Feb"
msgstr "თებ"
-#: glib/gdatetime.c:561
+#: glib/gdatetime.c:532
msgctxt "abbreviated month name with day"
msgid "Mar"
msgstr "მარ"
-#: glib/gdatetime.c:563
+#: glib/gdatetime.c:534
msgctxt "abbreviated month name with day"
msgid "Apr"
msgstr "აპრ"
-#: glib/gdatetime.c:565
+#: glib/gdatetime.c:536
msgctxt "abbreviated month name with day"
msgid "May"
msgstr "მაისი"
-#: glib/gdatetime.c:567
+#: glib/gdatetime.c:538
msgctxt "abbreviated month name with day"
msgid "Jun"
msgstr "ივნ"
-#: glib/gdatetime.c:569
+#: glib/gdatetime.c:540
msgctxt "abbreviated month name with day"
msgid "Jul"
msgstr "ივლ"
-#: glib/gdatetime.c:571
+#: glib/gdatetime.c:542
msgctxt "abbreviated month name with day"
msgid "Aug"
msgstr "აგვ"
-#: glib/gdatetime.c:573
+#: glib/gdatetime.c:544
msgctxt "abbreviated month name with day"
msgid "Sep"
msgstr "სექ"
-#: glib/gdatetime.c:575
+#: glib/gdatetime.c:546
msgctxt "abbreviated month name with day"
msgid "Oct"
msgstr "ოქტ"
-#: glib/gdatetime.c:577
+#: glib/gdatetime.c:548
msgctxt "abbreviated month name with day"
msgid "Nov"
msgstr "ნოე"
-#: glib/gdatetime.c:579
+#: glib/gdatetime.c:550
msgctxt "abbreviated month name with day"
msgid "Dec"
msgstr "დეკ"
#. Translators: 'before midday' indicator
-#: glib/gdatetime.c:596
+#: glib/gdatetime.c:589
msgctxt "GDateTime"
msgid "AM"
msgstr "AM"
#. Translators: 'after midday' indicator
-#: glib/gdatetime.c:599
+#: glib/gdatetime.c:592
msgctxt "GDateTime"
msgid "PM"
msgstr "PM"
-#: glib/gdir.c:158
+#: glib/gdir.c:168
#, c-format
msgid "Error opening directory “%s”: %s"
-msgstr ""
+msgstr "ვერ გავხსენი საქაღალდე \"%s\": %s"
-#: glib/gfileutils.c:753 glib/gfileutils.c:845
-#, 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] "ვერ ხერხდება %lu ბაიტის გამოყოფა \"%s\" ფაილის წასაკითხად"
+#: glib/gfileutils.c:716 glib/gfileutils.c:820
+msgid "Could not allocate %"
+msgid_plural "Could not allocate %"
+msgstr[0] "გამოყოფის შეცდომა %s-სთვის"
-#: glib/gfileutils.c:770
+#: glib/gfileutils.c:733
#, c-format
msgid "Error reading file “%s”: %s"
msgstr "ფაილის \"%s\" წაკითხვის შეცდომა: %s"
-#: glib/gfileutils.c:806
+#: glib/gfileutils.c:769 glib/gfileutils.c:803
#, c-format
msgid "File “%s” is too large"
msgstr "%s: ფაილი ძალიან დიდია"
-#: glib/gfileutils.c:870
+#: glib/gfileutils.c:845
#, c-format
msgid "Failed to read from file “%s”: %s"
msgstr "ფაილიდან \"%s\" წაკითხვის შეცდომა: %s"
-#: glib/gfileutils.c:920 glib/gfileutils.c:995 glib/gfileutils.c:1472
+#: glib/gfileutils.c:895 glib/gfileutils.c:970 glib/gfileutils.c:1477
#, c-format
msgid "Failed to open file “%s”: %s"
msgstr "ფაილის (%s) გახსნა შეუძლებელია: %s"
-#: glib/gfileutils.c:933
+#: glib/gfileutils.c:908
#, c-format
msgid "Failed to get attributes of file “%s”: fstat() failed: %s"
msgstr "ფაილის \"%s\" ატრიბუტების წაკითხვის შეცდომა: fstat() ჩავარდა: %s"
-#: glib/gfileutils.c:964
+#: glib/gfileutils.c:939
#, c-format
msgid "Failed to open file “%s”: fdopen() failed: %s"
msgstr "ფაილის \"%s\" გახსნის შეცდომა: fdopen() ჩავარდა: %s"
-#: glib/gfileutils.c:1065
+#: glib/gfileutils.c:1040
#, c-format
msgid "Failed to rename file “%s” to “%s”: g_rename() failed: %s"
msgstr "ვერ მოხერხდა '%s' ფაილის გადარქმევა - '%s': g_rename() ვერ შედგა: %s"
-#: glib/gfileutils.c:1179
+#: glib/gfileutils.c:1139
+#, c-format
+msgid "Failed to write file “%s”: ftruncate() failed: %s"
+msgstr "ვერ ვწერ '%s' ფაილს: ftruncate() ჩავარდა: %s"
+
+#: glib/gfileutils.c:1184
#, c-format
msgid "Failed to write file “%s”: write() failed: %s"
msgstr "ვერ ვწერ '%s' ფაილს: fwrite() ვერ შედგა: %s"
-#: glib/gfileutils.c:1200
+#: glib/gfileutils.c:1205
#, c-format
msgid "Failed to write file “%s”: fsync() failed: %s"
msgstr "ვერ ვწერ '%s' ფაილს: fsync() ვერ შედგა: %s"
-#: glib/gfileutils.c:1361 glib/gfileutils.c:1776
+#: glib/gfileutils.c:1366 glib/gfileutils.c:1783
#, c-format
msgid "Failed to create file “%s”: %s"
msgstr "ვერ ვქმნი '%s' ფაილს: %s"
-#: glib/gfileutils.c:1406
+#: glib/gfileutils.c:1411
#, c-format
msgid "Existing file “%s” could not be removed: g_unlink() failed: %s"
msgstr "არსებული '%s' ფაილი ვერ ამოიშლება: g_unlink() ვერ შედგა: %s"
-#: glib/gfileutils.c:1741
+#: glib/gfileutils.c:1748
#, c-format
msgid "Template “%s” invalid, should not contain a “%s”"
msgstr "შაბლონი '%s' მცდარია და '%s'-ს არ უნდა შეიცავდეს"
-#: glib/gfileutils.c:1754
+#: glib/gfileutils.c:1761
#, c-format
msgid "Template “%s” doesn’t contain XXXXXX"
msgstr "შაბლონი '%s' არ შეიცავს XXXXXX"
-#: glib/gfileutils.c:2348 glib/gfileutils.c:2377
+#: glib/gfileutils.c:2355 glib/gfileutils.c:2384
#, c-format
msgid "Failed to read the symbolic link “%s”: %s"
msgstr "სიმბოლური ბმის \"%s\" წაკითხვის შეცდომა: %s"
-#: glib/giochannel.c:1408
+#: glib/giochannel.c:1397
#, c-format
msgid "Could not open converter from “%s” to “%s”: %s"
msgstr "ვერ ხერხდება გარდამქმნელის გახსნა '%s' - '%s': %s"
-#: glib/giochannel.c:1761
+#: glib/giochannel.c:1750
msgid "Can’t do a raw read in g_io_channel_read_line_string"
msgstr "უშუალოდ წაკითხვა ფუნქციაში g_io_channel_read_line_string ვერ ხერხდება"
-#: glib/giochannel.c:1808 glib/giochannel.c:2066 glib/giochannel.c:2153
+#: glib/giochannel.c:1797 glib/giochannel.c:2055 glib/giochannel.c:2142
msgid "Leftover unconverted data in read buffer"
msgstr "გარდაუქმნელი მონაცემები წაკითხვის ბუფერში დარჩა"
-#: glib/giochannel.c:1889 glib/giochannel.c:1966
+#: glib/giochannel.c:1878 glib/giochannel.c:1955
msgid "Channel terminates in a partial character"
msgstr "არხი არასრული სიმბოლოთი იხურება"
-#: glib/giochannel.c:1952
+#: glib/giochannel.c:1941
msgid "Can’t do a raw read in g_io_channel_read_to_end"
msgstr "უშუალოდ წაკითხვა ფუნქციაში g_io_channel_read_to_end ვერ ხერხდება"
-#: glib/gkeyfile.c:802
+#: glib/gkeyfile.c:791
msgid "Valid key file could not be found in search dirs"
msgstr "ძიების კატალოგებში შეუძლებელია დამოწმებული გასაღების პოვნა"
-#: glib/gkeyfile.c:839
+#: glib/gkeyfile.c:828
msgid "Not a regular file"
msgstr "ფაილი ჩვეულებრივი არაა"
-#: glib/gkeyfile.c:1297
+#: glib/gkeyfile.c:1286
#, c-format
msgid ""
"Key file contains line “%s” which is not a key-value pair, group, or comment"
"გასაღების ფაილი '%s' შეიცავს სტრიქონს, რომელიც არ წარმოადგენს გასაღები-"
"მნიშვნელობას, ჯგუფს ან კომენტარს"
-#: glib/gkeyfile.c:1354
+#: glib/gkeyfile.c:1343
#, c-format
msgid "Invalid group name: %s"
msgstr "ჯგუფის მიუღებელი სახელი: %s"
-#: glib/gkeyfile.c:1378
+#: glib/gkeyfile.c:1367
msgid "Key file does not start with a group"
msgstr "საკვანძო ფაილი ჯგუფით არ იწყება"
-#: glib/gkeyfile.c:1402
+#: glib/gkeyfile.c:1391
#, c-format
msgid "Invalid key name: %.*s"
msgstr "გასაღების მიუღებელი სახელი: %.*s"
-#: glib/gkeyfile.c:1430
+#: glib/gkeyfile.c:1419
#, c-format
msgid "Key file contains unsupported encoding “%s”"
msgstr "გასაღების ფაილი შეიცავს მხარდაუჭერელ კოდირებას '%s'"
-#: glib/gkeyfile.c:1678 glib/gkeyfile.c:1851 glib/gkeyfile.c:3298
-#: glib/gkeyfile.c:3400 glib/gkeyfile.c:3505 glib/gkeyfile.c:3634
-#: glib/gkeyfile.c:3777 glib/gkeyfile.c:4026 glib/gkeyfile.c:4100
+#: glib/gkeyfile.c:1667 glib/gkeyfile.c:1840 glib/gkeyfile.c:3287
+#: glib/gkeyfile.c:3389 glib/gkeyfile.c:3494 glib/gkeyfile.c:3623
+#: glib/gkeyfile.c:3766 glib/gkeyfile.c:4015 glib/gkeyfile.c:4089
#, c-format
msgid "Key file does not have group “%s”"
msgstr "გასაღების ფაილი არ შეიცავს ჯგუფს '%s'"
-#: glib/gkeyfile.c:1806
+#: glib/gkeyfile.c:1795
#, c-format
msgid "Key file does not have key “%s” in group “%s”"
msgstr "გასაღების ფაილი არ შეიცავს გასაღებს '%s' ჯგუფში '%s'"
-#: glib/gkeyfile.c:1968 glib/gkeyfile.c:2084
+#: glib/gkeyfile.c:1957 glib/gkeyfile.c:2073
#, c-format
msgid "Key file contains key “%s” with value “%s” which is not UTF-8"
msgstr ""
"ფაილი შეიცავს გასაღებს '%s', რომლის მნიშვნელობაც '%s' UTF-8 კოდირებაში არაა"
-#: glib/gkeyfile.c:1988 glib/gkeyfile.c:2104 glib/gkeyfile.c:2543
+#: glib/gkeyfile.c:1977 glib/gkeyfile.c:2093 glib/gkeyfile.c:2532
#, c-format
msgid ""
"Key file contains key “%s” which has a value that cannot be interpreted."
msgstr "ფაილი შეიცავს გასაღებს '%s', რომლის მნიშვნელობაც ვერ იშიფრება."
-#: glib/gkeyfile.c:2758 glib/gkeyfile.c:3127
+#: glib/gkeyfile.c:2747 glib/gkeyfile.c:3116
#, c-format
msgid ""
"Key file contains key “%s” in group “%s” which has a value that cannot be "
msgstr ""
"ფაილი შეიცავს გასაღებს '%s' ჯგუფში '%s', რომლის მნიშვნელობაც ვერ იშიფრება."
-#: glib/gkeyfile.c:2836 glib/gkeyfile.c:2913
+#: glib/gkeyfile.c:2825 glib/gkeyfile.c:2902
#, c-format
msgid "Key “%s” in group “%s” has value “%s” where %s was expected"
msgstr ""
-#: glib/gkeyfile.c:4356
+#: glib/gkeyfile.c:4345
msgid "Key file contains escape character at end of line"
msgstr "გასაღების ფაილი სტრიქონის ბოლოს escape სიმბოლოს შეიცავს"
-#: glib/gkeyfile.c:4378
+#: glib/gkeyfile.c:4367
#, c-format
msgid "Key file contains invalid escape sequence “%s”"
msgstr "გასაღების ფაილი მცდარ escape მიმდევრობას '%s' შეიცავს"
-#: glib/gkeyfile.c:4530
+#: glib/gkeyfile.c:4519
#, c-format
msgid "Value “%s” cannot be interpreted as a number."
msgstr "მნიშვნელობა '%s' ვერ აღიქმება, როგორც რიცხვი."
-#: glib/gkeyfile.c:4544
+#: glib/gkeyfile.c:4533
#, c-format
msgid "Integer value “%s” out of range"
msgstr "მთელი მნიშვნელობა '%s' დიაპაზონს გარეთაა"
-#: glib/gkeyfile.c:4577
+#: glib/gkeyfile.c:4566
#, c-format
msgid "Value “%s” cannot be interpreted as a float number."
msgstr "მნიშვნელობა '%s' ვერ აღიქმება, როგორც წილადი."
-#: glib/gkeyfile.c:4616
+#: glib/gkeyfile.c:4605
#, c-format
msgid "Value “%s” cannot be interpreted as a boolean."
msgstr "მნიშვნელობა '%s' ვერ აღიქმება, როგორც ლოგიკური ოპერატორი."
msgid "Failed to open file “%s”: open() failed: %s"
msgstr "ვერ მოხერხდა '%s' ფაილის გახსნა: open() ვერ შედგა: %s"
-#: glib/gmarkup.c:398 glib/gmarkup.c:440
+#: glib/gmarkup.c:344 glib/gmarkup.c:386
#, c-format
msgid "Error on line %d char %d: "
-msgstr ""
+msgstr "შეცდომა ხაზზე %d სიმბოლო %d: "
-#: glib/gmarkup.c:462 glib/gmarkup.c:545
+#: glib/gmarkup.c:408 glib/gmarkup.c:491
#, c-format
msgid "Invalid UTF-8 encoded text in name — not valid “%s”"
msgstr "ტექსტი მიუღებელი UTF-8 კოდირებით - მიუღებელი '%s'"
-#: glib/gmarkup.c:473
+#: glib/gmarkup.c:419
#, c-format
msgid "“%s” is not a valid name"
msgstr "არასწორი სახელი: %s"
-#: glib/gmarkup.c:489
+#: glib/gmarkup.c:435
#, c-format
msgid "“%s” is not a valid name: “%c”"
msgstr "\"%s\" არასწორი სახელია: \"%c\""
-#: glib/gmarkup.c:613
+#: glib/gmarkup.c:559
#, c-format
msgid "Error on line %d: %s"
msgstr "შეცდომა სტრიქონში %d: %s"
-#: glib/gmarkup.c:690
+#: glib/gmarkup.c:636
#, c-format
msgid ""
"Failed to parse “%-.*s”, which should have been a digit inside a character "
"ვერ მუშავდება სტრიქონი '%-.*s', რომელშიც უნდა იყოს სიმბოლოს ნომერი "
"(მაგალითად, ê): შესაძლოა რიცხვი მეტისმეტად დიდია"
-#: glib/gmarkup.c:702
+#: glib/gmarkup.c:648
msgid ""
"Character reference did not end with a semicolon; most likely you used an "
"ampersand character without intending to start an entity — escape ampersand "
"as &"
msgstr ""
-#: glib/gmarkup.c:728
+#: glib/gmarkup.c:674
#, c-format
msgid "Character reference “%-.*s” does not encode a permitted character"
msgstr ""
-#: glib/gmarkup.c:766
+#: glib/gmarkup.c:712
msgid ""
"Empty entity “&;” seen; valid entities are: & " < > '"
msgstr ""
"ცარიელი ერთეული \"&;\"; შესაძლო ერთეულებია: & " < > '"
-#: glib/gmarkup.c:774
+#: glib/gmarkup.c:720
#, c-format
msgid "Entity name “%-.*s” is not known"
msgstr "ერთეულის სახელი \"%-.*s\" უცნობია"
-#: glib/gmarkup.c:779
+#: glib/gmarkup.c:725
msgid ""
"Entity did not end with a semicolon; most likely you used an ampersand "
"character without intending to start an entity — escape ampersand as &"
"ერთეული არ მთავრდება წერტილ-მძიმით; როგორც ჩანს, სახელის დასაწყისში "
"გამოყენებულია სიმბოლო \"&\". გამოსახეთ იგი, როგორც &"
-#: glib/gmarkup.c:1193
+#: glib/gmarkup.c:1139
msgid "Document must begin with an element (e.g. <book>)"
msgstr "დოკუმენტი უნდა დაიწყოს ელემეტით (მაგალითად <book>)"
-#: glib/gmarkup.c:1233
+#: glib/gmarkup.c:1179
#, c-format
msgid ""
"“%s” is not a valid character following a “<” character; it may not begin an "
"სიმბოლო \"%s\" დაუშვებელია \"<\" სიმბოლოს შემდეგ; ამ სიმბოლოთი ელემენტის "
"სახელის დაწყება არ შეიძლება"
-#: glib/gmarkup.c:1276
+#: glib/gmarkup.c:1222
#, c-format
msgid ""
"Odd character “%s”, expected a “>” character to end the empty-element tag "
"უცნაური სიმბოლო \"%s\". მოველოდი სიმბოლოს \">\" ცარიელი ელემენტის ჭდის (%s) "
"დასასრულებლად"
-#: glib/gmarkup.c:1346
+#: glib/gmarkup.c:1292
#, c-format
msgid "Too many attributes in element “%s”"
-msgstr ""
+msgstr "მეტისმეტად ბევრი ატრიბუტი ელემენტში \"%s\""
-#: glib/gmarkup.c:1366
+#: glib/gmarkup.c:1312
#, c-format
msgid ""
"Odd character “%s”, expected a “=” after attribute name “%s” of element “%s”"
"უცნაური სიმბოლო \"%s\". მოველოდი \"=\"-ს ატრიბუტის (%s) სახელის შემდეგ "
"ელემენტისთვის \"%s\""
-#: glib/gmarkup.c:1408
+#: glib/gmarkup.c:1354
#, c-format
msgid ""
"Odd character “%s”, expected a “>” or “/” character to end the start tag of "
"საწყისი ჭდის დასასრულებლად, ან ატრიბუტს. ალბათ ატრიბუტის სახელში არასწორი "
"სიმბოლო გამოიყენეთ"
-#: glib/gmarkup.c:1453
+#: glib/gmarkup.c:1399
#, c-format
msgid ""
"Odd character “%s”, expected an open quote mark after the equals sign when "
"ზედმეტი სიმბოლო \"%s\", მოსალოდნელია გახსნილი ბრჭყალები ტოლობის ნიშნის "
"შემდეგ ატრიბუტისთვის \"%s\" მნიშვნელობის მისანიჭებლად ელემენტისთვის \"%s\""
-#: glib/gmarkup.c:1587
+#: glib/gmarkup.c:1533
#, c-format
msgid ""
"“%s” is not a valid character following the characters “</”; “%s” may not "
"სიმბოლო \"%s\" დაუშვებელია \"</\" შემდეგ; სიმბოლო \"%s\" არ შეიძლება იყოს "
"ელემენტის სახელის დასაწყისში"
-#: glib/gmarkup.c:1625
+#: glib/gmarkup.c:1571
#, c-format
msgid ""
"“%s” is not a valid character following the close element name “%s”; the "
"სიმბოლო \"%s\" დაუშვებელია ელემენტის \"%s\" დახურვის ჭდის შემდეგ; დასაშვები "
"სიმბოლოა \">\""
-#: glib/gmarkup.c:1637
+#: glib/gmarkup.c:1583
#, c-format
msgid "Element “%s” was closed, no element is currently open"
msgstr "ელემენტი \"%s\" დაიხურა, არცერთი ელემენტი არაა გახსნილი"
-#: glib/gmarkup.c:1646
+#: glib/gmarkup.c:1592
#, c-format
msgid "Element “%s” was closed, but the currently open element is “%s”"
msgstr "ელემენტი \"%s\" დაიხურა, მაგრამ გახსნილია ელემენტი \"%s\""
-#: glib/gmarkup.c:1799
+#: glib/gmarkup.c:1745
msgid "Document was empty or contained only whitespace"
msgstr "დოკუმენტი ცარიელია ან მხოლოდ ხარეებს შეიცავს"
-#: glib/gmarkup.c:1813
+#: glib/gmarkup.c:1759
msgid "Document ended unexpectedly just after an open angle bracket “<”"
msgstr "დოკუმენტი დასრულდა უშუალოდ კუთხოვანი ფრჩხილის \"<\" შემდეგ"
-#: glib/gmarkup.c:1821 glib/gmarkup.c:1866
+#: glib/gmarkup.c:1767 glib/gmarkup.c:1812
#, c-format
msgid ""
"Document ended unexpectedly with elements still open — “%s” was the last "
"დოკუმენტი მოულოდნელად დასრულდა გახსნილი ელემენტებით - \"%s\" ბოლო გახსნილი "
"ელემენტია"
-#: glib/gmarkup.c:1829
+#: glib/gmarkup.c:1775
#, c-format
msgid ""
"Document ended unexpectedly, expected to see a close angle bracket ending "
msgstr ""
"დოკუმენტი მოულოდნელად დასრულდა, მოსალოდნელია ჩამკეტი კუთხოვანი ფრჩხილი <%s/>"
-#: glib/gmarkup.c:1835
+#: glib/gmarkup.c:1781
msgid "Document ended unexpectedly inside an element name"
msgstr "დოკუმენტი მოულოდნელად დასრულდა ელემენტის სახელის შიგნით"
-#: glib/gmarkup.c:1841
+#: glib/gmarkup.c:1787
msgid "Document ended unexpectedly inside an attribute name"
msgstr "დოკუმენტი მოულოდნელად დასრულდა ატრიბუტის სახელის შიგნით"
-#: glib/gmarkup.c:1846
+#: glib/gmarkup.c:1792
msgid "Document ended unexpectedly inside an element-opening tag."
msgstr "დოკუმენტი მოულოდნელად დასრულდა ელემენტის გამხსნელი ჭდის შიგნით."
-#: glib/gmarkup.c:1852
+#: glib/gmarkup.c:1798
msgid ""
"Document ended unexpectedly after the equals sign following an attribute "
"name; no attribute value"
"დოკუმენტი მოულოდნელად დასრულდა ატრიბუტის სახელის შემდგომი ტოლობის ნიშნის "
"შემდეგ; ატრიბუტის მნიშვნელობა არ მითითებულა"
-#: glib/gmarkup.c:1859
+#: glib/gmarkup.c:1805
msgid "Document ended unexpectedly while inside an attribute value"
msgstr "დოკუმენტი მოულოდნელად დასრულდა ატრიბუტის მნიშვნელობის შიგნით"
-#: glib/gmarkup.c:1876
+#: glib/gmarkup.c:1822
#, c-format
msgid "Document ended unexpectedly inside the close tag for element “%s”"
msgstr "დოკუმენტი მოულოდნელად დასრულდა ელემენტის \"%s\" ჩამკეტი ჭდის შიგნით"
-#: glib/gmarkup.c:1880
+#: glib/gmarkup.c:1826
msgid ""
"Document ended unexpectedly inside the close tag for an unopened element"
msgstr "დოკუმენტი მოულოდნელად დასრულდა გაუხსნელი ელემენტის ჩამკეტი ჭდის შიგნით"
-#: glib/gmarkup.c:1886
+#: glib/gmarkup.c:1832
msgid "Document ended unexpectedly inside a comment or processing instruction"
msgstr ""
"დოკუმენტი მოულოდნელად დასრულდა კომენტარის ან დამუშავების ინსტრუქციის შიგნით"
-#: glib/goption.c:875
+#: glib/goption.c:716
msgid "[OPTION…]"
msgstr "[პარამეტრი...]"
-#: glib/goption.c:991
+#: glib/goption.c:832
msgid "Help Options:"
msgstr "დახმარების პარამეტრები:"
-#: glib/goption.c:992
+#: glib/goption.c:833
msgid "Show help options"
msgstr "დახმარების პარამეტრების ჩვენება"
-#: glib/goption.c:998
+#: glib/goption.c:839
msgid "Show all help options"
msgstr "დახმარების ყველა პარამეტრის ჩვენება"
-#: glib/goption.c:1061
+#: glib/goption.c:902
msgid "Application Options:"
msgstr "პროგრამის პარამეტრები:"
-#: glib/goption.c:1063
+#: glib/goption.c:904
msgid "Options:"
msgstr "პარამეტრები:"
-#: glib/goption.c:1127 glib/goption.c:1197
+#: glib/goption.c:968 glib/goption.c:1038
#, c-format
msgid "Cannot parse integer value “%s” for %s"
msgstr "მთელი მნიშვნელობის \"%s\" დამუშავების შეცდომა %s-თვის"
-#: glib/goption.c:1137 glib/goption.c:1205
+#: glib/goption.c:978 glib/goption.c:1046
#, c-format
msgid "Integer value “%s” for %s out of range"
msgstr "მთელი მნიშვნელობა '%s' ელემენტისთვის %s დიაპაზონს გარეთაა"
-#: glib/goption.c:1162
+#: glib/goption.c:1003
#, c-format
msgid "Cannot parse double value “%s” for %s"
msgstr "ორმაგი მნიშვნელობის \"%s\" დამუშავების შეცდომა %s-თვის"
-#: glib/goption.c:1170
+#: glib/goption.c:1011
#, c-format
msgid "Double value “%s” for %s out of range"
msgstr "ორმაგი მნიშვნელობა '%s' ელემენტისთვის %s დიაპაზონს გარეთაა"
-#: glib/goption.c:1462 glib/goption.c:1541
+#: glib/goption.c:1303 glib/goption.c:1382
#, c-format
msgid "Error parsing option %s"
msgstr "შეცდომის გაანალიზების პარამეტრი: %s"
-#: glib/goption.c:1563 glib/goption.c:1676
+#: glib/goption.c:1404 glib/goption.c:1517
#, c-format
msgid "Missing argument for %s"
msgstr "არ არსებული არგუმენტი - %s-თვის"
-#: glib/goption.c:2186
+#: glib/goption.c:2024
#, c-format
msgid "Unknown option %s"
msgstr "უცნობი პარამეტრი %s"
-#: glib/gregex.c:480
+#: glib/gregex.c:486
msgid "corrupted object"
msgstr "დაზიანებული ობიექტი"
-#: glib/gregex.c:482
+#: glib/gregex.c:488
msgid "out of memory"
msgstr "არასაკმარისი მეხსიერება"
-#: glib/gregex.c:497
+#: glib/gregex.c:503
msgid "internal error"
msgstr "შიდა შეცდომა"
-#: glib/gregex.c:499
+#: glib/gregex.c:505
msgid "the pattern contains items not supported for partial matching"
msgstr "თარგი შეიცავს ნაწილობრივი დამთხვევისთვის მხარდაუჭერელ ელემეტებს"
-#: glib/gregex.c:501
+#: glib/gregex.c:507
msgid "back references as conditions are not supported for partial matching"
msgstr "უკუ მიმართვა პირობების სახით მხარდაუჭერელია ნაწილობრივი დამთხვევისთვის"
-#: glib/gregex.c:507
+#: glib/gregex.c:513
msgid "recursion limit reached"
msgstr "რეკურსიის ლიმიტი მიღწეულია"
-#: glib/gregex.c:509
+#: glib/gregex.c:515
msgid "bad offset"
msgstr "არასწორი წანაცვლება"
-#: glib/gregex.c:511
+#: glib/gregex.c:517
msgid "recursion loop"
msgstr "რეკურსიის მარყუჟი"
#. should not happen in GRegex since we check modes before each match
-#: glib/gregex.c:514
+#: glib/gregex.c:520
msgid "matching mode is requested that was not compiled for JIT"
msgstr ""
-#: glib/gregex.c:535 glib/gregex.c:1851
+#: glib/gregex.c:541 glib/gregex.c:1869
msgid "unknown error"
msgstr "უცნობი შეცდომა"
-#: glib/gregex.c:556
+#: glib/gregex.c:562
msgid "\\ at end of pattern"
msgstr "\\ ნიმუშის ბოლოში"
-#: glib/gregex.c:560
+#: glib/gregex.c:566
msgid "\\c at end of pattern"
msgstr "\\c ნიმუშის ბოლოში"
-#: glib/gregex.c:565
+#: glib/gregex.c:571
msgid "unrecognized character following \\"
-msgstr ""
+msgstr "უცნობი სიმბოლო \\-ის შემდეგ"
-#: glib/gregex.c:569
+#: glib/gregex.c:575
msgid "numbers out of order in {} quantifier"
msgstr "მთვლელში რიცხვები დაულაგებელია {}"
-#: glib/gregex.c:573
+#: glib/gregex.c:579
msgid "number too big in {} quantifier"
msgstr "მთვლელში {} რიცხვები ძალიან დიდია"
-#: glib/gregex.c:577
+#: glib/gregex.c:583
msgid "missing terminating ] for character class"
msgstr "სიმბოლოების კლასს დამაბოლოებელი ] აკლია"
-#: glib/gregex.c:581
+#: glib/gregex.c:587
msgid "invalid escape sequence in character class"
msgstr "სიმბოლოების კლასის არასწორი დამაბოლოებელი თანამიმდევრობა"
-#: glib/gregex.c:585
+#: glib/gregex.c:591
msgid "range out of order in character class"
msgstr "სიმბოლოების კლასის დიაპაზონი მიმდევრობის გარეთაა"
-#: glib/gregex.c:590
+#: glib/gregex.c:596
msgid "nothing to repeat"
msgstr "გასამეორებელი არაფერია"
-#: glib/gregex.c:594
+#: glib/gregex.c:600
msgid "unrecognized character after (? or (?-"
msgstr "უცნობი სიმბლოები (? ან (?- ის შემდეგ"
-#: glib/gregex.c:598
+#: glib/gregex.c:604
msgid "POSIX named classes are supported only within a class"
msgstr "POSIX-ის დასახელებული კლასები მხოლოდ კლასის შიგნითაა ხელმისაწვდომი"
-#: glib/gregex.c:602
+#: glib/gregex.c:608
msgid "POSIX collating elements are not supported"
msgstr "POSIX-ის გადაფარვადი ელემენტები მხარდაუჭერელია"
-#: glib/gregex.c:608
+#: glib/gregex.c:614
msgid "missing terminating )"
-msgstr ""
+msgstr "აკლია დამხურავი )"
-#: glib/gregex.c:612
+#: glib/gregex.c:618
msgid "reference to non-existent subpattern"
msgstr "ბმა არარსებულ ქვეშაბლონთან"
-#: glib/gregex.c:616
+#: glib/gregex.c:622
msgid "missing ) after comment"
msgstr "კომენტარის შემდეგ ) აკლია"
-#: glib/gregex.c:620
+#: glib/gregex.c:626
msgid "regular expression is too large"
msgstr "რეგულარული გამოსახულება ძალიან გრძელია"
-#: glib/gregex.c:624
+#: glib/gregex.c:630
msgid "malformed number or name after (?("
msgstr "(?(-ის შემდეგ არასწორი რიცხვი ან სახელია"
-#: glib/gregex.c:628
+#: glib/gregex.c:634
msgid "lookbehind assertion is not fixed length"
msgstr "lookbehind assertion is not fixed length"
-#: glib/gregex.c:632
+#: glib/gregex.c:638
msgid "conditional group contains more than two branches"
msgstr "პირობითი ჯგუფი ორ ბრენჩზე მეტს შეიცავს"
-#: glib/gregex.c:636
+#: glib/gregex.c:642
msgid "assertion expected after (?("
msgstr "assertion expected after (?("
-#: glib/gregex.c:640
+#: glib/gregex.c:646
msgid "a numbered reference must not be zero"
msgstr ""
-#: glib/gregex.c:644
+#: glib/gregex.c:650
msgid "unknown POSIX class name"
msgstr "posix-ის უცნობი კლასის სახელი"
-#: glib/gregex.c:649
+#: glib/gregex.c:655
msgid "character value in \\x{...} sequence is too large"
msgstr "character value in \\x{...} sequence is too large"
-#: glib/gregex.c:653
+#: glib/gregex.c:659
msgid "\\C not allowed in lookbehind assertion"
msgstr "\\C not allowed in lookbehind assertion"
-#: glib/gregex.c:657
+#: glib/gregex.c:663
msgid "missing terminator in subpattern name"
msgstr ""
-#: glib/gregex.c:661
+#: glib/gregex.c:667
msgid "two named subpatterns have the same name"
msgstr "ორ სხვადასხვა ქვეშაბლონს ერთი და იგივე სახელი აქვთ"
-#: glib/gregex.c:665
+#: glib/gregex.c:671
msgid "malformed \\P or \\p sequence"
msgstr "არასწორი \\P ან \\p მიმდევრობა"
-#: glib/gregex.c:669
+#: glib/gregex.c:675
msgid "unknown property name after \\P or \\p"
msgstr "უცნობი თვისების სახელი \\P-ის ან \\p-ის შემდეგ"
-#: glib/gregex.c:673
+#: glib/gregex.c:679
msgid "subpattern name is too long (maximum 32 characters)"
msgstr "ქვეშაბლონის სახელი ძალიან გრძელია (მაქს 32 სიმბოლო)"
-#: glib/gregex.c:677
+#: glib/gregex.c:683
msgid "too many named subpatterns (maximum 10,000)"
-msgstr ""
+msgstr "მეტისმეტად ბევრი სახელიანი ქვეშაბლონი (მაქს 10000)"
-#: glib/gregex.c:681
+#: glib/gregex.c:687
msgid "octal value is greater than \\377"
-msgstr ""
+msgstr "რვაობითი მნიშვნელობა მეტია, ვიდრე \\377"
-#: glib/gregex.c:685
+#: glib/gregex.c:691
msgid "DEFINE group contains more than one branch"
msgstr ""
-#: glib/gregex.c:689
+#: glib/gregex.c:695
msgid "inconsistent NEWLINE options"
-msgstr ""
+msgstr "არამდგრადი ახალი ხაზის პარამეტრები"
-#: glib/gregex.c:693
+#: glib/gregex.c:699
msgid ""
"\\g is not followed by a braced, angle-bracketed, or quoted name or number, "
"or by a plain number"
msgstr ""
-#: glib/gregex.c:698
+#: glib/gregex.c:704
msgid "an argument is not allowed for (*ACCEPT), (*FAIL), or (*COMMIT)"
msgstr ""
-#: glib/gregex.c:702
+#: glib/gregex.c:708
msgid "(*VERB) not recognized"
msgstr "(*VERB) უცნობია"
-#: glib/gregex.c:706
+#: glib/gregex.c:712
msgid "number is too big"
msgstr "რიცხვი ძალიან დიდია"
-#: glib/gregex.c:710
+#: glib/gregex.c:716
msgid "missing subpattern name after (?&"
msgstr ""
-#: glib/gregex.c:714
+#: glib/gregex.c:720
msgid "different names for subpatterns of the same number are not allowed"
msgstr ""
-#: glib/gregex.c:718
+#: glib/gregex.c:724
msgid "(*MARK) must have an argument"
msgstr ""
-#: glib/gregex.c:722
+#: glib/gregex.c:728
msgid "\\c must be followed by an ASCII character"
msgstr ""
-#: glib/gregex.c:726
+#: glib/gregex.c:732
msgid "\\k is not followed by a braced, angle-bracketed, or quoted name"
msgstr ""
-#: glib/gregex.c:730
+#: glib/gregex.c:736
msgid "\\N is not supported in a class"
msgstr "კლასში \\N მხარდაუჭერელია"
-#: glib/gregex.c:734
+#: glib/gregex.c:740
msgid "name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)"
msgstr "სახელი ძალიან გრძელია (*MARK), (*PRUNE), (*SKIP) ან (*THEN)"
-#: glib/gregex.c:738 glib/gregex.c:874
+#: glib/gregex.c:744 glib/gregex.c:880
msgid "code overflow"
msgstr "კოდის გადავსება"
-#: glib/gregex.c:742
+#: glib/gregex.c:748
msgid "unrecognized character after (?P"
msgstr "უცნობი სიმბოლო (?P-ის შემდეგ"
-#: glib/gregex.c:746
+#: glib/gregex.c:752
msgid "overran compiling workspace"
msgstr "კომპილაციის სამუშაო სივრცის გადავსება"
-#: glib/gregex.c:750
+#: glib/gregex.c:756
msgid "previously-checked referenced subpattern not found"
msgstr ""
-#: glib/gregex.c:873 glib/gregex.c:1135 glib/gregex.c:2457
+#: glib/gregex.c:879 glib/gregex.c:1153 glib/gregex.c:2475
#, c-format
msgid "Error while matching regular expression %s: %s"
msgstr "დაიშვა შეცდომა სტანდარტული გამოსახულების %s დამთხვევის ძიების დროს: %s"
-#: glib/gregex.c:1735
+#: glib/gregex.c:1753
msgid "PCRE library is compiled without UTF8 support"
msgstr "ბიბლიოთეკა PCRE-ს არ გააჩნია UTF8-ის მხარდაჭერა"
-#: glib/gregex.c:1743
+#: glib/gregex.c:1761
msgid "PCRE library is compiled with incompatible options"
msgstr "PCRE ბიბლიოთეკა კომპილირებულია შეუთავსებელი პარამეტრებით"
-#: glib/gregex.c:1860
+#: glib/gregex.c:1878
#, c-format
msgid "Error while compiling regular expression ‘%s’ at char %s: %s"
msgstr ""
"შეცდომა რეგულარული გამოსახულება %s-ის კომპილირებისას, სიმბოლოსთან %s: %s"
-#: glib/gregex.c:2900
+#: glib/gregex.c:2918
msgid "hexadecimal digit or “}” expected"
msgstr "მოსალოდნელია თექვსმეტობითი რიცხვი, ან '}'"
-#: glib/gregex.c:2916
+#: glib/gregex.c:2934
msgid "hexadecimal digit expected"
msgstr "მოსალოდნელია თექვსმეტობითი სიმბოლო"
-#: glib/gregex.c:2956
+#: glib/gregex.c:2974
msgid "missing “<” in symbolic reference"
msgstr "არ მოიძებნა '<', სიმბოლურ მითითებაში"
-#: glib/gregex.c:2965
+#: glib/gregex.c:2983
msgid "unfinished symbolic reference"
msgstr "დაუსრულებელი სიმბოლური მითითება"
-#: glib/gregex.c:2972
+#: glib/gregex.c:2990
msgid "zero-length symbolic reference"
msgstr "ნულოვანი სიგრძის სიმბოლური მითითება"
-#: glib/gregex.c:2983
+#: glib/gregex.c:3001
msgid "digit expected"
msgstr "მოველოდი ციფრს"
-#: glib/gregex.c:3001
+#: glib/gregex.c:3019
msgid "illegal symbolic reference"
msgstr "მიუღებელი სიმბოლური მითითება"
-#: glib/gregex.c:3064
+#: glib/gregex.c:3082
msgid "stray final “\\”"
msgstr "დაბოლოვება '\\'"
-#: glib/gregex.c:3068
+#: glib/gregex.c:3086
msgid "unknown escape sequence"
msgstr "უცნობი escape სეკვენცია"
-#: glib/gregex.c:3078
+#: glib/gregex.c:3096
#, c-format
msgid "Error while parsing replacement text “%s” at char %lu: %s"
msgstr ""
"შეცდომა ჩასანაცვლებელი ტექსტის \"%s\" განაალიზებისას, სიმბოლო ნომრით %lu: %s"
-#: glib/gshell.c:98
+#: glib/gshell.c:84
msgid "Quoted text doesn’t begin with a quotation mark"
msgstr "ციტირებული ტექსტი ბრჭყალებით არ იწყება"
-#: glib/gshell.c:188
+#: glib/gshell.c:174
msgid "Unmatched quotation mark in command line or other shell-quoted text"
msgstr "უმართებლო ბრჭყალი ბრძანებაში ან სხვა ტექსტურ გარსში"
-#: glib/gshell.c:594
+#: glib/gshell.c:580
#, c-format
msgid "Text ended just after a “\\” character. (The text was “%s”)"
msgstr "ტექსტი დასრულდა უშუალოდ \"\\\" სიმბოლოს შემდეგ. (ტექსტი - \"%s\")"
-#: glib/gshell.c:601
+#: glib/gshell.c:587
#, c-format
msgid "Text ended before matching quote was found for %c. (The text was “%s”)"
msgstr "ტექსტი დასრულდა %c შესაბამისი ბრჭყალის წინ. (ტექსტი - \"%s\")"
-#: glib/gshell.c:613
+#: glib/gshell.c:599
msgid "Text was empty (or contained only whitespace)"
msgstr "ტექსტი ცარიელი იყო (ან მხოლოდ ხარეებს შეიცავდა)"
-#: glib/gspawn.c:320
+#: glib/gspawn.c:242
#, c-format
msgid "Failed to read data from child process (%s)"
msgstr "მონაცემთა წაკითხვა ქვეპროცესიდან ვერ მოხერხდა (%s)"
-#: glib/gspawn.c:473
+#: glib/gspawn.c:395
#, c-format
msgid "Unexpected error in reading data from a child process (%s)"
msgstr "შვილეული პროცესიდან (%s) მონაცემების წაკითხვის შეცდომა"
-#: glib/gspawn.c:558
+#: glib/gspawn.c:475
#, c-format
msgid "Unexpected error in waitpid() (%s)"
msgstr "მოულოდნელი შეცდომა ფუნქციაში waitpid() (%s)"
-#: glib/gspawn.c:1180 glib/gspawn-win32.c:1575
+#: glib/gspawn.c:1097 glib/gspawn-win32.c:1575
#, c-format
msgid "Child process exited with code %ld"
msgstr ""
-#: glib/gspawn.c:1188
+#: glib/gspawn.c:1105
#, c-format
msgid "Child process killed by signal %ld"
msgstr ""
-#: glib/gspawn.c:1195
+#: glib/gspawn.c:1112
#, c-format
msgid "Child process stopped by signal %ld"
msgstr ""
-#: glib/gspawn.c:1202
+#: glib/gspawn.c:1119
#, c-format
msgid "Child process exited abnormally"
msgstr ""
-#: glib/gspawn.c:2032 glib/gspawn-win32.c:472 glib/gspawn-win32.c:480
+#: glib/gspawn.c:1956 glib/gspawn-win32.c:472 glib/gspawn-win32.c:480
#, c-format
msgid "Failed to read from child pipe (%s)"
msgstr "მონაცემთა წაკითხვა ქვეპროცესის არხიდან ვერ მოხერხდა (%s)"
-#: glib/gspawn.c:2404
+#: glib/gspawn.c:2335
#, c-format
msgid "Failed to spawn child process “%s” (%s)"
msgstr "ქვეპროცესის (%s) განტოტვის შეცდომა (%s)"
-#: glib/gspawn.c:2530
+#: glib/gspawn.c:2459
#, c-format
msgid "Failed to fork (%s)"
msgstr "განტოტების შეცდომა (%s)"
-#: glib/gspawn.c:2690 glib/gspawn-win32.c:503
+#: glib/gspawn.c:2620 glib/gspawn-win32.c:503
#, c-format
msgid "Failed to change to directory “%s” (%s)"
msgstr "საქაღალდის ცვლილების შეცდომა \"%s\" (%s)"
-#: glib/gspawn.c:2700
+#: glib/gspawn.c:2630
#, c-format
msgid "Failed to execute child process “%s” (%s)"
msgstr "შვილობილი პროცესის %s გაშვების შეცდომა %s"
-#: glib/gspawn.c:2710
+#: glib/gspawn.c:2640
#, c-format
msgid "Failed to open file to remap file descriptor (%s)"
msgstr "დესკრიპტორისთვის ფაილის გადამაგრების შეცდომა (%s)"
-#: glib/gspawn.c:2718
+#: glib/gspawn.c:2648
#, c-format
msgid "Failed to duplicate file descriptor for child process (%s)"
msgstr "შვილეული პროცესისთვის (%s) ფაილის დესკრიპტორის დუბლირების შეცდომა"
-#: glib/gspawn.c:2727
+#: glib/gspawn.c:2657
#, c-format
msgid "Failed to fork child process (%s)"
msgstr "დამხმარე პროცესის გაშვების შეცდომა (%s)"
-#: glib/gspawn.c:2735
+#: glib/gspawn.c:2665
#, c-format
msgid "Failed to close file descriptor for child process (%s)"
msgstr "შვილეული პროცესის (%s) ფაილის დესკრიპტორის დახურვის შეცდომა"
-#: glib/gspawn.c:2743
+#: glib/gspawn.c:2673
#, c-format
msgid "Unknown error executing child process “%s”"
msgstr "შეცდომა შვილეული პროცესის (%s) შესრულებისას"
-#: glib/gspawn.c:2767
+#: glib/gspawn.c:2697
#, c-format
msgid "Failed to read enough data from child pid pipe (%s)"
msgstr "ქვეპროცესის არხიდან საკმარის მონაცემთა წაკითხვა ვერ მოხერხდა (%s)"
"მოულოდნელი შეცდომა ფუნქციაში g_io_channel_win32_poll() ქვეპროცესიდან "
"მონაცემთა წაკითხვისას"
-#: glib/gstrfuncs.c:3373 glib/gstrfuncs.c:3475
+#: glib/gstrfuncs.c:3334 glib/gstrfuncs.c:3436
msgid "Empty string is not a number"
msgstr "ცარიელი სტრიქონი რიცხვი არაა"
-#: glib/gstrfuncs.c:3397
+#: glib/gstrfuncs.c:3358
#, c-format
msgid "“%s” is not a signed number"
msgstr "\"%s\" ნიშნიანი რიცხვი არაა"
-#: glib/gstrfuncs.c:3407 glib/gstrfuncs.c:3511
+#: glib/gstrfuncs.c:3368 glib/gstrfuncs.c:3472
#, c-format
msgid "Number “%s” is out of bounds [%s, %s]"
msgstr "რიცხვი \"%s\" დიაპაზონს გარეთაა [%s, %s]"
-#: glib/gstrfuncs.c:3501
+#: glib/gstrfuncs.c:3462
#, c-format
msgid "“%s” is not an unsigned number"
msgstr "\"%s\" უნიშნო რიცხვი არაა"
-#: glib/guri.c:318
+#: glib/guri.c:309
#, no-c-format
msgid "Invalid %-encoding in URI"
msgstr "არასწორი %s-კოდირება URI-ში"
-#: glib/guri.c:335
+#: glib/guri.c:326
msgid "Illegal character in URI"
msgstr "დაუშვებელი სიმბოლო URI-ში"
-#: glib/guri.c:369
+#: glib/guri.c:360
msgid "Non-UTF-8 characters in URI"
msgstr "არა-UTF-8 სიმბოლოები URI-ში"
-#: glib/guri.c:549
+#: glib/guri.c:540
#, c-format
msgid "Invalid IPv6 address ‘%.*s’ in URI"
msgstr "არასწორი IPv6 მისამართი '%.*s' URI-ში"
-#: glib/guri.c:604
+#: glib/guri.c:595
#, c-format
msgid "Illegal encoded IP address ‘%.*s’ in URI"
msgstr "არასწორად კოდირებული IP მისამართი ‘%.*s’ URI-ში"
-#: glib/guri.c:616
+#: glib/guri.c:607
#, c-format
msgid "Illegal internationalized hostname ‘%.*s’ in URI"
msgstr "არასწორი არა-ASCII ჰოსტის სახელი '%.*s' URI-ში"
-#: glib/guri.c:648 glib/guri.c:660
+#: glib/guri.c:639 glib/guri.c:651
#, c-format
msgid "Could not parse port ‘%.*s’ in URI"
msgstr "URI-ში პორტის '%.*s'-ის დამუშავების შეცდომა"
-#: glib/guri.c:667
+#: glib/guri.c:658
#, c-format
msgid "Port ‘%.*s’ in URI is out of range"
msgstr "URI-ში პორტი '%.*s' დიაპაზონს გარეთაა"
-#: glib/guri.c:1230 glib/guri.c:1294
+#: glib/guri.c:1221 glib/guri.c:1285
#, c-format
msgid "URI ‘%s’ is not an absolute URI"
msgstr "URI \"%s\" აბსოლუტური იდენტიფიკატორი არ გახლავთ"
-#: glib/guri.c:1236
+#: glib/guri.c:1227
#, c-format
msgid "URI ‘%s’ has no host component"
msgstr "URL-ს '%s' ჰოსტის კომპონენტი არ გააჩნია"
-#: glib/guri.c:1466
+#: glib/guri.c:1457
msgid "URI is not absolute, and no base URI was provided"
msgstr "URI აბსოლუტური არაა და საბაზისო URI მითითებული არაა"
-#: glib/guri.c:2252
+#: glib/guri.c:2243
msgid "Missing ‘=’ and parameter value"
msgstr "აკლია '=' და პარამეტრის მნიშვნელობა"
msgid "EiB"
msgstr "EiB"
-#. 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 kbit"
#: glib/gutils.c:2994
-msgid "kb"
-msgstr "კბ"
+msgid "kbit"
+msgstr "კბიტ"
-#. 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 Mbit"
#: glib/gutils.c:2996
-msgid "Mb"
-msgstr "მბ"
+msgid "Mbit"
+msgstr "მბიტ"
-#. 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 Gbit"
#: glib/gutils.c:2998
-msgid "Gb"
-msgstr "გბ"
+msgid "Gbit"
+msgstr "გბიტ"
-#. 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 Tbit"
#: glib/gutils.c:3000
-msgid "Tb"
-msgstr "ტბ"
+msgid "Tbit"
+msgstr "ტბიტ"
-#. 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 Pbit"
#: glib/gutils.c:3002
-msgid "Pb"
-msgstr "პბ"
+msgid "Pbit"
+msgstr "პბიტ"
-#. 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 Ebit"
#: glib/gutils.c:3004
-msgid "Eb"
-msgstr "ებ"
+msgid "Ebit"
+msgstr "ებიტ"
-#. 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 Kibit"
#: glib/gutils.c:3008
-msgid "Kib"
-msgstr "კიბ"
+msgid "Kibit"
+msgstr "კიბიტ"
-#. 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 Mibit"
#: glib/gutils.c:3010
-msgid "Mib"
-msgstr "მიბ"
+msgid "Mibit"
+msgstr "მიბიტ"
-#. 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 Gibit"
#: glib/gutils.c:3012
-msgid "Gib"
-msgstr "გიბ"
+msgid "Gibit"
+msgstr "გიბიტ"
-#. 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 Tibit"
#: glib/gutils.c:3014
-msgid "Tib"
-msgstr "ტიბ"
+msgid "Tibit"
+msgstr "ტიბიტ"
-#. 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 Pibit"
#: glib/gutils.c:3016
-msgid "Pib"
-msgstr "პიბ"
+msgid "Pibit"
+msgstr "პიბიტ"
-#. 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 Eibit"
#: glib/gutils.c:3018
-msgid "Eib"
-msgstr "ეიბ"
+msgid "Eibit"
+msgstr "ეიბიტ"
#: glib/gutils.c:3056
msgid "byte"
msgstr "%.1f ებ"
#, 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] "ვერ ხერხდება %lu ბაიტის გამოყოფა \"%s\" ფაილის წასაკითხად"
+
+#~ msgid "kb"
+#~ msgstr "კბ"
+
+#~ msgid "Mb"
+#~ msgstr "მბ"
+
+#~ msgid "Gb"
+#~ msgstr "გბ"
+
+#~ msgid "Tb"
+#~ msgstr "ტბ"
+
+#~ msgid "Pb"
+#~ msgstr "პბ"
+
+#~ msgid "Eb"
+#~ msgstr "ებ"
+
+#~ msgid "Kib"
+#~ msgstr "კიბ"
+
+#~ msgid "Mib"
+#~ msgstr "მიბ"
+
+#~ msgid "Gib"
+#~ msgstr "გიბ"
+
+#~ msgid "Tib"
+#~ msgstr "ტიბ"
+
+#~ msgid "Pib"
+#~ msgstr "პიბ"
+
+#~ msgid "Eib"
+#~ msgstr "ეიბ"
+
+#, c-format
#~ msgid "The local file URI “%s” may not include a “#”"
#~ msgstr ""
#~ "ლოკალური ფაილის URI იდენტიფიკატორი \"%s\" არ შეიძლება შეიცავდეს სიმბოლოს "
msgstr ""
"Project-Id-Version: ru\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/glib/issues\n"
-"POT-Creation-Date: 2023-11-23 12:42+0000\n"
-"PO-Revision-Date: 2023-11-25 14:32+0300\n"
+"POT-Creation-Date: 2023-12-12 20:32+0000\n"
+"PO-Revision-Date: 2023-12-16 14:24+0300\n"
"Last-Translator: Artur So <arturios2005@mail.ru>\n"
"Language-Team: Русский <gnome-cyr@gnome.org>\n"
"Language: ru\n"
"нераспознанная команда %s\n"
"\n"
-#: gio/gbufferedinputstream.c:418 gio/gbufferedinputstream.c:496
+#: gio/gbufferedinputstream.c:421 gio/gbufferedinputstream.c:499
#: gio/ginputstream.c:181 gio/ginputstream.c:381 gio/ginputstream.c:651
#: gio/ginputstream.c:1056 gio/goutputstream.c:227 gio/goutputstream.c:1052
#: gio/gpollableinputstream.c:217 gio/gpollableoutputstream.c:289
msgid "Too large count value passed to %s"
msgstr "Слишком большое значение количества передано в %s"
-#: gio/gbufferedinputstream.c:889 gio/gbufferedoutputstream.c:573
-#: gio/gdataoutputstream.c:559
+#: gio/gbufferedinputstream.c:892 gio/gbufferedoutputstream.c:579
+#: gio/gdataoutputstream.c:557
msgid "Seek not supported on base stream"
msgstr "Переход в базовом потоке не поддерживается"
-#: gio/gbufferedinputstream.c:936
+#: gio/gbufferedinputstream.c:939
msgid "Cannot truncate GBufferedInputStream"
msgstr "Нельзя усечь GBufferedInputStream"
-#: gio/gbufferedinputstream.c:981 gio/ginputstream.c:1246 gio/giostream.c:301
+#: gio/gbufferedinputstream.c:984 gio/ginputstream.c:1246 gio/giostream.c:317
#: gio/goutputstream.c:2208
msgid "Stream is already closed"
msgstr "Поток уже закрыт"
-#: gio/gbufferedoutputstream.c:610 gio/gdataoutputstream.c:589
+#: gio/gbufferedoutputstream.c:616 gio/gdataoutputstream.c:587
msgid "Truncate not supported on base stream"
msgstr "Усечение не поддерживается в базовом потоке"
-#: gio/gcancellable.c:326 gio/gdbusconnection.c:1862 gio/gdbusprivate.c:1432
+#: gio/gcancellable.c:326 gio/gdbusconnection.c:1844 gio/gdbusprivate.c:1432
#: gio/gsimpleasyncresult.c:871 gio/gsimpleasyncresult.c:897
#, c-format
msgid "Operation was cancelled"
msgstr "Действие было отменено"
-#: gio/gcharsetconverter.c:255
+#: gio/gcharsetconverter.c:272
msgid "Invalid object, not initialized"
msgstr "Недопустимый объект, не инициализировано"
-#: gio/gcharsetconverter.c:276 gio/gcharsetconverter.c:304
+#: gio/gcharsetconverter.c:293 gio/gcharsetconverter.c:321
msgid "Incomplete multibyte sequence in input"
msgstr "Неполная многобайтовая последовательность во входных данных"
-#: gio/gcharsetconverter.c:310 gio/gcharsetconverter.c:319
+#: gio/gcharsetconverter.c:327 gio/gcharsetconverter.c:336
msgid "Not enough space in destination"
msgstr "Недостаточно места в целевом расположении"
-#: gio/gcharsetconverter.c:337 gio/gdatainputstream.c:846
-#: gio/gdatainputstream.c:1264 glib/gconvert.c:351 glib/gconvert.c:783
+#: gio/gcharsetconverter.c:354 gio/gdatainputstream.c:842
+#: gio/gdatainputstream.c:1260 glib/gconvert.c:351 glib/gconvert.c:783
#: glib/giochannel.c:1565 glib/giochannel.c:1607 glib/giochannel.c:2467
#: glib/gutf8.c:958 glib/gutf8.c:1412
msgid "Invalid byte sequence in conversion input"
msgstr "Недопустимая последовательность байтов во входных преобразуемых данных"
-#: gio/gcharsetconverter.c:342 glib/gconvert.c:359 glib/gconvert.c:697
+#: gio/gcharsetconverter.c:359 glib/gconvert.c:359 glib/gconvert.c:697
#: glib/giochannel.c:1572 glib/giochannel.c:2482
#, c-format
msgid "Error during conversion: %s"
msgstr "Произошла ошибка при преобразовании: %s"
-#: gio/gcharsetconverter.c:440 gio/gsocket.c:1162
+#: gio/gcharsetconverter.c:457 gio/gsocket.c:1217
msgid "Cancellable initialization not supported"
msgstr "Прерываемая инициализация не поддерживается"
-#: gio/gcharsetconverter.c:451 glib/gconvert.c:224 glib/giochannel.c:1393
+#: gio/gcharsetconverter.c:468 glib/gconvert.c:224 glib/giochannel.c:1393
#, c-format
msgid "Conversion from character set “%s” to “%s” is not supported"
msgstr "Преобразование из набора символов «%s» в «%s» не поддерживается"
-#: gio/gcharsetconverter.c:455 glib/gconvert.c:228
+#: gio/gcharsetconverter.c:472 glib/gconvert.c:228
#, c-format
msgid "Could not open converter from “%s” to “%s”"
msgstr "Не удалось открыть преобразователь из «%s» в «%s»"
msgid "Credentials spoofing is not possible on this OS"
msgstr "Спуфинг учётных данных невозможен в этой ОС"
-#: gio/gdatainputstream.c:302
+#: gio/gdatainputstream.c:298
msgid "Unexpected early end-of-stream"
msgstr "Неожиданный ранний конец потока"
msgstr ""
"Не удалось определить адрес сеансовой шины (не реализовано для этой ОС)"
-#: gio/gdbusaddress.c:1377 gio/gdbusconnection.c:7334
+#: gio/gdbusaddress.c:1377 gio/gdbusconnection.c:7339
#, c-format
msgid ""
"Cannot determine bus address from DBUS_STARTER_BUS_TYPE environment variable "
"Не удалось определить адрес шины из значения переменной окружения "
"DBUS_STARTER_BUS_TYPE — неизвестное значение «%s»"
-#: gio/gdbusaddress.c:1386 gio/gdbusconnection.c:7343
+#: gio/gdbusaddress.c:1386 gio/gdbusconnection.c:7348
msgid ""
"Cannot determine bus address because the DBUS_STARTER_BUS_TYPE environment "
"variable is not set"
msgid "Unknown bus type %d"
msgstr "Неизвестный тип шины %d"
-#: gio/gdbusauth.c:294
+#: gio/gdbusauth.c:292
msgid "Unexpected lack of content trying to read a line"
msgstr "Неожиданное отсутствие содержимого при чтении строки"
-#: gio/gdbusauth.c:338
+#: gio/gdbusauth.c:336
msgid "Unexpected lack of content trying to (safely) read a line"
msgstr "Неожиданное отсутствие содержимого при (надёжном) чтении строки"
-#: gio/gdbusauth.c:482
+#: gio/gdbusauth.c:480
#, c-format
msgid ""
"Exhausted all available authentication mechanisms (tried: %s) (available: %s)"
"Перепробованы все доступные механизмы аутентификации (проведено: %s) "
"(доступно: %s)"
-#: gio/gdbusauth.c:1045
+#: gio/gdbusauth.c:1043
msgid "Unexpected lack of content trying to read a byte"
msgstr "Неожиданное отсутствие содержимого при попытке прочитать байт"
-#: gio/gdbusauth.c:1195
+#: gio/gdbusauth.c:1193
msgid "User IDs must be the same for peer and server"
msgstr "Идентификаторы пользователя должны быть и на клиенте и на сервере"
-#: gio/gdbusauth.c:1207
+#: gio/gdbusauth.c:1205
msgid "Cancelled via GDBusAuthObserver::authorize-authenticated-peer"
msgstr "Отменено через GDBusAuthObserver::authorize-authenticated-peer"
msgid "(Additionally, releasing the lock for “%s” also failed: %s) "
msgstr "(Также, не удалось освободить блокировку для «%s»: %s) "
-#: gio/gdbusconnection.c:585 gio/gdbusconnection.c:2410
+#: gio/gdbusconnection.c:585 gio/gdbusconnection.c:2392
msgid "The connection is closed"
msgstr "Соединение закрыто"
-#: gio/gdbusconnection.c:1894
+#: gio/gdbusconnection.c:1876
msgid "Timeout was reached"
msgstr "Время ожидания истекло"
-#: gio/gdbusconnection.c:2533
+#: gio/gdbusconnection.c:2515
msgid ""
"Unsupported flags encountered when constructing a client-side connection"
msgstr "При создании клиентского соединения обнаружены неподдерживаемые флаги"
-#: gio/gdbusconnection.c:4272 gio/gdbusconnection.c:4626
+#: gio/gdbusconnection.c:4277 gio/gdbusconnection.c:4631
#, c-format
msgid ""
"No such interface “org.freedesktop.DBus.Properties” on object at path %s"
msgstr ""
"Интерфейс «org.freedesktop.DBus.Properties» для пути %s объекта не найден"
-#: gio/gdbusconnection.c:4417
+#: gio/gdbusconnection.c:4422
#, c-format
msgid "No such property “%s”"
msgstr "Свойство «%s» отсутствует"
-#: gio/gdbusconnection.c:4429
+#: gio/gdbusconnection.c:4434
#, c-format
msgid "Property “%s” is not readable"
msgstr "Свойство «%s» недоступно для чтения"
-#: gio/gdbusconnection.c:4440
+#: gio/gdbusconnection.c:4445
#, c-format
msgid "Property “%s” is not writable"
msgstr "Свойство «%s» недоступно для записи"
-#: gio/gdbusconnection.c:4460
+#: gio/gdbusconnection.c:4465
#, c-format
msgid "Error setting property “%s”: Expected type “%s” but got “%s”"
msgstr "Ошибка установки свойства «%s»: ожидался тип «%s», но получен «%s»"
-#: gio/gdbusconnection.c:4565 gio/gdbusconnection.c:4780
-#: gio/gdbusconnection.c:6757
+#: gio/gdbusconnection.c:4570 gio/gdbusconnection.c:4785
+#: gio/gdbusconnection.c:6762
#, c-format
msgid "No such interface “%s”"
msgstr "Интерфейс «%s» отсутствует"
-#: gio/gdbusconnection.c:4996 gio/gdbusconnection.c:7274
+#: gio/gdbusconnection.c:5001 gio/gdbusconnection.c:7279
#, c-format
msgid "No such interface “%s” on object at path %s"
msgstr "Интерфейс «%s» для пути %s объекта не найден"
-#: gio/gdbusconnection.c:5097
+#: gio/gdbusconnection.c:5102
#, c-format
msgid "No such method “%s”"
msgstr "Ключ «%s» отсутствует"
-#: gio/gdbusconnection.c:5128
+#: gio/gdbusconnection.c:5133
#, c-format
msgid "Type of message, “%s”, does not match expected type “%s”"
msgstr "Тип сообщения «%s» не совпадает с ожидаемым типом «%s»"
-#: gio/gdbusconnection.c:5331
+#: gio/gdbusconnection.c:5336
#, c-format
msgid "An object is already exported for the interface %s at %s"
msgstr "Объект интерфейса %s уже экспортирован как %s"
-#: gio/gdbusconnection.c:5558
+#: gio/gdbusconnection.c:5563
#, c-format
msgid "Unable to retrieve property %s.%s"
msgstr "Невозможно получить свойство %s.%s"
-#: gio/gdbusconnection.c:5614
+#: gio/gdbusconnection.c:5619
#, c-format
msgid "Unable to set property %s.%s"
msgstr "Невозможно установить свойство %s.%s"
-#: gio/gdbusconnection.c:5793
+#: gio/gdbusconnection.c:5798
#, c-format
msgid "Method “%s” returned type “%s”, but expected “%s”"
msgstr "Метод «%s» вернул тип «%s», но ожидалось «%s»"
-#: gio/gdbusconnection.c:6869
+#: gio/gdbusconnection.c:6874
#, c-format
msgid "Method “%s” on interface “%s” with signature “%s” does not exist"
msgstr "Метод «%s» интерфейса «%s» с сигнатурой «%s» не существует"
-#: gio/gdbusconnection.c:6990
+#: gio/gdbusconnection.c:6995
#, c-format
msgid "A subtree is already exported for %s"
msgstr "Поддерево уже экспортировано для %s"
-#: gio/gdbusconnection.c:7282
+#: gio/gdbusconnection.c:7287
#, c-format
msgid "Object does not exist at path “%s”"
msgstr "Объект по пути «%s» не существует"
-#: gio/gdbusmessage.c:1296
+#: gio/gdbusmessage.c:1303
msgid "type is INVALID"
msgstr "тип является НЕДОПУСТИМЫМ"
-#: gio/gdbusmessage.c:1314
+#: gio/gdbusmessage.c:1321
msgid "METHOD_CALL message: PATH or MEMBER header field is missing or invalid"
msgstr ""
"Сообщение METHOD_CALL: отсутствует или недопустимо поле заголовка PATH или "
"MEMBER"
-#: gio/gdbusmessage.c:1330
+#: gio/gdbusmessage.c:1337
msgid "METHOD_RETURN message: REPLY_SERIAL header field is missing or invalid"
msgstr ""
"Сообщение METHOD_RETURN: отсутствует или недопустимо поле заголовка "
"REPLY_SERIAL"
-#: gio/gdbusmessage.c:1350
+#: gio/gdbusmessage.c:1357
msgid ""
"ERROR message: REPLY_SERIAL or ERROR_NAME header field is missing or invalid"
msgstr ""
"Сообщение ERROR: отсутствует или недопустимо поле заголовка REPLY_SERIAL или "
"ERROR_NAME"
-#: gio/gdbusmessage.c:1374
+#: gio/gdbusmessage.c:1381
msgid ""
"SIGNAL message: PATH, INTERFACE or MEMBER header field is missing or invalid"
msgstr ""
"Сообщение SIGNAL: отсутствует или недопустимо поле заголовка PATH, INTERFACE "
"или MEMBER"
-#: gio/gdbusmessage.c:1382
+#: gio/gdbusmessage.c:1389
msgid ""
"SIGNAL message: The PATH header field is using the reserved value /org/"
"freedesktop/DBus/Local"
"Сообщение SIGNAL: поле заголовка PATH использует зарезервированное значение /"
"org/freedesktop/DBus/Local"
-#: gio/gdbusmessage.c:1390
+#: gio/gdbusmessage.c:1397
msgid ""
"SIGNAL message: The INTERFACE header field is using the reserved value org."
"freedesktop.DBus.Local"
"Сообщение SIGNAL: поле заголовка INTERFACE использует зарезервированное "
"значение org.freedesktop.DBus.Local"
-#: gio/gdbusmessage.c:1439 gio/gdbusmessage.c:1499
+#: gio/gdbusmessage.c:1446 gio/gdbusmessage.c:1506
#, c-format
msgid "Wanted to read %lu byte but only got %lu"
msgid_plural "Wanted to read %lu bytes but only got %lu"
msgstr[1] "Требовалось прочитать %lu байта, но прочитано только %lu"
msgstr[2] "Требовалось прочитать %lu байт, но прочитано только %lu"
-#: gio/gdbusmessage.c:1453
+#: gio/gdbusmessage.c:1460
#, c-format
msgid "Expected NUL byte after the string “%s” but found byte %d"
msgstr "Ожидался байт NUL после строки «%s», но найден байт %d"
-#: gio/gdbusmessage.c:1472
+#: gio/gdbusmessage.c:1479
#, c-format
msgid ""
"Expected valid UTF-8 string but found invalid bytes at byte offset %d "
"(смещение %d, длина строки %d). Корректная строка UTF-8 вплоть до тех байт: "
"«%s»"
-#: gio/gdbusmessage.c:1536 gio/gdbusmessage.c:1812 gio/gdbusmessage.c:2023
+#: gio/gdbusmessage.c:1543 gio/gdbusmessage.c:1819 gio/gdbusmessage.c:2030
msgid "Value nested too deeply"
msgstr "Слишком глубокая иерархия"
-#: gio/gdbusmessage.c:1704
+#: gio/gdbusmessage.c:1711
#, c-format
msgid "Parsed value “%s” is not a valid D-Bus object path"
msgstr "Разобранное значение «%s» не является допустимым путём объекта D-Bus"
-#: gio/gdbusmessage.c:1728
+#: gio/gdbusmessage.c:1735
#, c-format
msgid "Parsed value “%s” is not a valid D-Bus signature"
msgstr "Разобранное значение «%s» не является допустимой подписью D-Bus"
-#: gio/gdbusmessage.c:1779
+#: gio/gdbusmessage.c:1786
#, c-format
msgid ""
"Encountered array of length %u byte. Maximum length is 2<<26 bytes (64 MiB)."
"Обнаружен массив длинной %u байт. Максимальная длина равна 2<<26 байт (64 "
"МиБ)."
-#: gio/gdbusmessage.c:1799
+#: gio/gdbusmessage.c:1806
#, c-format
msgid ""
"Encountered array of type “a%c”, expected to have a length a multiple of %u "
"Получен массив типа «a%c», который должен иметь размер кратный %u (байт), но "
"массив имеет длину %u (байт)"
-#: gio/gdbusmessage.c:1953 gio/gdbusmessage.c:2672
+#: gio/gdbusmessage.c:1960 gio/gdbusmessage.c:2687
msgid "Empty structures (tuples) are not allowed in D-Bus"
msgstr "Пустые структуры (записи) не допускаются в D-Bus"
-#: gio/gdbusmessage.c:2007
+#: gio/gdbusmessage.c:2014
#, c-format
msgid "Parsed value “%s” for variant is not a valid D-Bus signature"
msgstr ""
"Разобранное значение «%s» для варианта не является допустимой подписью D-Bus"
-#: gio/gdbusmessage.c:2048
+#: gio/gdbusmessage.c:2055
#, c-format
msgid ""
"Error deserializing GVariant with type string “%s” from the D-Bus wire format"
msgstr ""
"Ошибка десериализации GVariant с типом строки «%s» из формата D-Bus wire"
-#: gio/gdbusmessage.c:2233
+#: gio/gdbusmessage.c:2240
#, c-format
msgid ""
"Invalid endianness value. Expected 0x6c (“l”) or 0x42 (“B”) but found value "
"Неправильный порядок байтов в значении. Ожидался 0x6c ('l') или 0x42 ('B'), "
"но найдено значение 0x%02x"
-#: gio/gdbusmessage.c:2252
+#: gio/gdbusmessage.c:2259
#, c-format
msgid "Invalid major protocol version. Expected 1 but found %d"
msgstr "Неправильный старший номер версии протокола. Ожидался 1, но найден %d"
-#: gio/gdbusmessage.c:2310 gio/gdbusmessage.c:2908
+#: gio/gdbusmessage.c:2317 gio/gdbusmessage.c:2923
msgid "Signature header found but is not of type signature"
msgstr "Заголовок подписи найден, но его тип отличается от подписи"
-#: gio/gdbusmessage.c:2322
+#: gio/gdbusmessage.c:2329
#, c-format
msgid "Signature header with signature “%s” found but message body is empty"
msgstr "Найден заголовок подписи с подписью «%s», но тело сообщения пусто"
-#: gio/gdbusmessage.c:2337
+#: gio/gdbusmessage.c:2344
#, c-format
msgid "Parsed value “%s” is not a valid D-Bus signature (for body)"
msgstr ""
"Разобранное значение «%s» не является допустимой подписью D-Bus (для тела)"
-#: gio/gdbusmessage.c:2369
+#: gio/gdbusmessage.c:2384
#, c-format
msgid "No signature header in message but the message body is %u byte"
msgid_plural "No signature header in message but the message body is %u bytes"
msgstr[2] ""
"Отсутствует заголовок подписи в сообщении, но тело сообщения занимает %u байт"
-#: gio/gdbusmessage.c:2379
+#: gio/gdbusmessage.c:2394
msgid "Cannot deserialize message: "
msgstr "Не удалось выполнить извлечение сообщения: "
-#: gio/gdbusmessage.c:2725
+#: gio/gdbusmessage.c:2740
#, c-format
msgid ""
"Error serializing GVariant with type string “%s” to the D-Bus wire format"
msgstr "Ошибка сериализации GVariant с типом строки «%s» в формат D-Bus wire"
-#: gio/gdbusmessage.c:2862
+#: gio/gdbusmessage.c:2877
#, c-format
msgid ""
"Number of file descriptors in message (%d) differs from header field (%d)"
"Количество дескрипторов файлов в сообщении (%d) отличается от указанного в "
"заголовке (%d)"
-#: gio/gdbusmessage.c:2870
+#: gio/gdbusmessage.c:2885
msgid "Cannot serialize message: "
msgstr "Не удалось сериализовать сообщение: "
-#: gio/gdbusmessage.c:2923
+#: gio/gdbusmessage.c:2938
#, c-format
msgid "Message body has signature “%s” but there is no signature header"
msgstr "Тело сообщения имеет подпись «%s», но нет заголовка подписи"
-#: gio/gdbusmessage.c:2933
+#: gio/gdbusmessage.c:2948
#, c-format
msgid ""
"Message body has type signature “%s” but signature in the header field is "
"Тело сообщения имеет тип подписи «%s», но значение подписи в поле заголовка "
"равно «%s»"
-#: gio/gdbusmessage.c:2949
+#: gio/gdbusmessage.c:2964
#, c-format
msgid "Message body is empty but signature in the header field is “(%s)”"
msgstr ""
"Тело сообщения пусто, но значение подписи в поле заголовка равно «(%s)»"
-#: gio/gdbusmessage.c:3504
+#: gio/gdbusmessage.c:3538
#, c-format
msgid "Error return with body of type “%s”"
msgstr "Возвращена ошибка с телом типа «%s»"
-#: gio/gdbusmessage.c:3512
+#: gio/gdbusmessage.c:3546
msgid "Error return with empty body"
msgstr "Возвращена ошибка с пустым телом"
msgid "Unable to load %s or %s: "
msgstr "Не удалось загрузить %s или %s: "
-#: gio/gdbusproxy.c:1570
+#: gio/gdbusproxy.c:1552
#, c-format
msgid "Error calling StartServiceByName for %s: "
msgstr "Ошибка вызова StartServiceByName для %s: "
-#: gio/gdbusproxy.c:1593
+#: gio/gdbusproxy.c:1575
#, c-format
msgid "Unexpected reply %d from StartServiceByName(\"%s\") method"
msgstr "Неожиданный ответ %d из метода StartServiceByName(«%s»)"
-#: gio/gdbusproxy.c:2704 gio/gdbusproxy.c:2839
+#: gio/gdbusproxy.c:2686 gio/gdbusproxy.c:2821
#, c-format
msgid ""
"Cannot invoke method; proxy is for the well-known name %s without an owner, "
"Не удалось вызвать метод; у прокси с хорошо известным именем %s нет "
"владельца и прокси создать с флагом G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START"
-#: gio/gdbusserver.c:751
+#: gio/gdbusserver.c:739
msgid "Abstract namespace not supported"
msgstr "Абстрактное пространство имён не поддерживается"
-#: gio/gdbusserver.c:843
+#: gio/gdbusserver.c:831
msgid "Cannot specify nonce file when creating a server"
msgstr "Не удалось задать nonce-файл при создании сервера"
-#: gio/gdbusserver.c:925
+#: gio/gdbusserver.c:913
#, c-format
msgid "Error writing nonce file at “%s”: %s"
msgstr "Произошла ошибка при записи в nonce-файл у «%s»: %s"
-#: gio/gdbusserver.c:1100
+#: gio/gdbusserver.c:1088
#, c-format
msgid "The string “%s” is not a valid D-Bus GUID"
msgstr "Строка «%s» не является допустимым D-Bus GUID"
-#: gio/gdbusserver.c:1138
+#: gio/gdbusserver.c:1126
#, c-format
msgid "Cannot listen on unsupported transport “%s”"
msgstr "Невозможно прослушивать неподдерживаемый транспорт «%s»"
msgstr "Не вправе изменять настройки отладки"
#: gio/gdesktopappinfo.c:2235 gio/gdesktopappinfo.c:5219
+#: gio/gwin32appinfo.c:4256
msgid "Unnamed"
msgstr "Без имени"
msgid "drive doesn’t implement stop"
msgstr "привод не поддерживает остановку"
-#: gio/gdtlsconnection.c:1178 gio/gtlsconnection.c:947
+#: gio/gdtlsconnection.c:1154 gio/gtlsconnection.c:921
msgid "TLS backend does not implement TLS binding retrieval"
msgstr "Библиотека TLS не реализует запрос на TLS binding"
msgid "DTLS support is not available"
msgstr "Поддержка DTLS недоступна"
-#: gio/gemblem.c:322
+#: gio/gemblem.c:332
#, c-format
msgid "Can’t handle version %d of GEmblem encoding"
msgstr "Не удалось обработать версию %d текстового представления GEmblem"
-#: gio/gemblem.c:332
+#: gio/gemblem.c:342
#, c-format
msgid "Malformed number of tokens (%d) in GEmblem encoding"
msgstr "Некорректное число лексем (%d) текстового представления GEmblem"
-#: gio/gemblemedicon.c:361
+#: gio/gemblemedicon.c:366
#, c-format
msgid "Can’t handle version %d of GEmblemedIcon encoding"
msgstr "Не удалось обработать версию %d текстового представления GEmblemedIcon"
-#: gio/gemblemedicon.c:371
+#: gio/gemblemedicon.c:376
#, c-format
msgid "Malformed number of tokens (%d) in GEmblemedIcon encoding"
msgstr "Некорректное число лексем (%d) текстового представления GEmblemedIcon"
-#: gio/gemblemedicon.c:394
+#: gio/gemblemedicon.c:399
msgid "Expected a GEmblem for GEmblemedIcon"
msgstr "Для GEmblemedIcon ожидается GEmblem"
msgid "Invalid symlink value given"
msgstr "Дано неверное значение символьной ссылки"
-#: gio/gfile.c:4328 glib/gfileutils.c:2436
+#: gio/gfile.c:4328 glib/gfileutils.c:2399
msgid "Symbolic links not supported"
msgstr "Символьные ссылки не поддерживаются"
msgid "No application is registered as handling this file"
msgstr "Нет зарегистрированного приложения для обработки данного файла"
-#: gio/gfileenumerator.c:212
+#: gio/gfileenumerator.c:216
msgid "Enumerator is closed"
msgstr "Перечислитель закрыт"
-#: gio/gfileenumerator.c:219 gio/gfileenumerator.c:278
-#: gio/gfileenumerator.c:423 gio/gfileenumerator.c:523
+#: gio/gfileenumerator.c:223 gio/gfileenumerator.c:282
+#: gio/gfileenumerator.c:427 gio/gfileenumerator.c:527
msgid "File enumerator has outstanding operation"
msgstr "Перечислитель файлов имеет незавершённое действие"
-#: gio/gfileenumerator.c:414 gio/gfileenumerator.c:514
+#: gio/gfileenumerator.c:418 gio/gfileenumerator.c:518
msgid "File enumerator is already closed"
msgstr "Перечислитель файлов уже закрыт"
-#: gio/gfileicon.c:250
+#: gio/gfileicon.c:248
#, c-format
msgid "Can’t handle version %d of GFileIcon encoding"
msgstr "Не удалось обработать версию %d текстового представления GFileIcon"
-#: gio/gfileicon.c:260
+#: gio/gfileicon.c:258
msgid "Malformed input data for GFileIcon"
msgstr "Некорректные входные данные для GFileIcon"
msgid "Truncate not supported on stream"
msgstr "Усечение не поддерживается на потоке"
-#: gio/ghttpproxy.c:93 gio/gresolver.c:531 gio/gresolver.c:684
+#: gio/ghttpproxy.c:93 gio/gresolver.c:529 gio/gresolver.c:682
#: glib/gconvert.c:1743
msgid "Invalid hostname"
msgstr "Недопустимое имя узла"
msgid "Can’t handle the supplied version of the icon encoding"
msgstr "Не удалось обработать данную версию текстового представления значка"
-#: gio/ginetaddressmask.c:175
+#: gio/ginetaddressmask.c:192
msgid "No address specified"
msgstr "Адрес не указан"
-#: gio/ginetaddressmask.c:183
+#: gio/ginetaddressmask.c:200
#, c-format
msgid "Length %u is too long for address"
msgstr "Значение длины %u слишком велико для адреса"
-#: gio/ginetaddressmask.c:216
+#: gio/ginetaddressmask.c:233
msgid "Address has bits set beyond prefix length"
msgstr "В адресе установлены биты вне пределов длины префикса"
-#: gio/ginetaddressmask.c:293
+#: gio/ginetaddressmask.c:310
#, c-format
msgid "Could not parse “%s” as IP address mask"
msgstr "Невозможно считать «%s» маской IP-адреса"
#. Translators: This is an error you get if there is
#. * already an operation running against this stream when
#. * you try to start one
-#: gio/ginputstream.c:1256 gio/giostream.c:311 gio/goutputstream.c:2218
+#: gio/ginputstream.c:1256 gio/giostream.c:327 gio/goutputstream.c:2218
msgid "Stream has outstanding operation"
msgstr "Поток имеет незавершённое действие"
msgid "Error setting extended attribute “%s”: %s"
msgstr "Произошла ошибка при установке расширенного атрибута «%s»: %s"
-#: gio/glocalfileinfo.c:1785 gio/win32/gwinhttpfile.c:191
+#: gio/glocalfileinfo.c:1789 gio/win32/gwinhttpfile.c:191
msgid " (invalid encoding)"
msgstr " (неверная кодировка)"
-#: gio/glocalfileinfo.c:1944 gio/glocalfileoutputstream.c:945
+#: gio/glocalfileinfo.c:1948 gio/glocalfileoutputstream.c:945
#: gio/glocalfileoutputstream.c:997
#, c-format
msgid "Error when getting information for file “%s”: %s"
msgstr "Ошибка при получении информации о файле «%s»: %s"
-#: gio/glocalfileinfo.c:2250
+#: gio/glocalfileinfo.c:2254
#, c-format
msgid "Error when getting information for file descriptor: %s"
msgstr "Ошибка при получении информации о файловом дескрипторе: %s"
-#: gio/glocalfileinfo.c:2295
+#: gio/glocalfileinfo.c:2299
msgid "Invalid attribute type (uint32 expected)"
msgstr "Неверный тип атрибута (ожидался uint32)"
-#: gio/glocalfileinfo.c:2313
+#: gio/glocalfileinfo.c:2317
msgid "Invalid attribute type (uint64 expected)"
msgstr "Неверный тип атрибута (ожидался uint64)"
-#: gio/glocalfileinfo.c:2332 gio/glocalfileinfo.c:2351
+#: gio/glocalfileinfo.c:2336 gio/glocalfileinfo.c:2355
msgid "Invalid attribute type (byte string expected)"
msgstr "Неверный тип атрибута (ожидалась строка byte)"
-#: gio/glocalfileinfo.c:2398
+#: gio/glocalfileinfo.c:2402
msgid "Cannot set permissions on symlinks"
msgstr "Не удалось установить права на символические ссылки"
-#: gio/glocalfileinfo.c:2414
+#: gio/glocalfileinfo.c:2418
#, c-format
msgid "Error setting permissions: %s"
msgstr "Произошла ошибка при установке прав: %s"
-#: gio/glocalfileinfo.c:2465
+#: gio/glocalfileinfo.c:2469
#, c-format
msgid "Error setting owner: %s"
msgstr "Произошла ошибка при установке владельца: %s"
-#: gio/glocalfileinfo.c:2488
+#: gio/glocalfileinfo.c:2492
msgid "symlink must be non-NULL"
msgstr "символьная ссылка не должна быть NULL"
-#: gio/glocalfileinfo.c:2498 gio/glocalfileinfo.c:2517
-#: gio/glocalfileinfo.c:2528
+#: gio/glocalfileinfo.c:2502 gio/glocalfileinfo.c:2521
+#: gio/glocalfileinfo.c:2532
#, c-format
msgid "Error setting symlink: %s"
msgstr "Произошла ошибка при установке символьной ссылки: %s"
-#: gio/glocalfileinfo.c:2507
+#: gio/glocalfileinfo.c:2511
msgid "Error setting symlink: file is not a symlink"
msgstr ""
"Произошла ошибка при установке символьной ссылки: файл не является "
"символьной ссылкой"
-#: gio/glocalfileinfo.c:2599
+#: gio/glocalfileinfo.c:2603
#, c-format
msgid "Extra nanoseconds %d for UNIX timestamp %lld are negative"
msgstr ""
"Дополнительные нано-секунды %d во временной метке UNIX %lld имеют "
"отрицательное значение"
-#: gio/glocalfileinfo.c:2608
+#: gio/glocalfileinfo.c:2612
#, c-format
msgid "Extra nanoseconds %d for UNIX timestamp %lld reach 1 second"
msgstr ""
"Дополнительные нано-секунды %d во временной метке UNIX %lld достигли одной "
"секунды"
-#: gio/glocalfileinfo.c:2618
+#: gio/glocalfileinfo.c:2622
#, c-format
msgid "UNIX timestamp %lld does not fit into 64 bits"
msgstr "Временная метка UNIX %lld не помещается в 64 бита"
-#: gio/glocalfileinfo.c:2629
+#: gio/glocalfileinfo.c:2633
#, c-format
msgid "UNIX timestamp %lld is outside of the range supported by Windows"
msgstr "Временная метка UNIX %lld не входит в диапазон, поддерживаемый Windows"
-#: gio/glocalfileinfo.c:2761
+#: gio/glocalfileinfo.c:2765
#, c-format
msgid "File name “%s” cannot be converted to UTF-16"
msgstr "Не удалось преобразовать имя файла «%s» в строку UTF-16"
-#: gio/glocalfileinfo.c:2780
+#: gio/glocalfileinfo.c:2784
#, c-format
msgid "File “%s” cannot be opened: Windows Error %lu"
msgstr "Не удалось открыть файл «%s»: ошибка Windows %lu"
-#: gio/glocalfileinfo.c:2793
+#: gio/glocalfileinfo.c:2797
#, c-format
msgid "Error setting modification or access time for file “%s”: %lu"
msgstr ""
"Произошла ошибка при установке времени модификации или доступа файла «%s»: "
"%lu"
-#: gio/glocalfileinfo.c:2970
+#: gio/glocalfileinfo.c:2974
#, c-format
msgid "Error setting modification or access time: %s"
msgstr "Произошла ошибка при установке времени модификации или доступа: %s"
-#: gio/glocalfileinfo.c:2993
+#: gio/glocalfileinfo.c:2997
msgid "SELinux context must be non-NULL"
msgstr "Контекст SELinux не должен быть равен NULL"
-#: gio/glocalfileinfo.c:3000
+#: gio/glocalfileinfo.c:3004
msgid "SELinux is not enabled on this system"
msgstr "В этой системе не включён SELinux"
-#: gio/glocalfileinfo.c:3010
+#: gio/glocalfileinfo.c:3014
#, c-format
msgid "Error setting SELinux context: %s"
msgstr "Произошла ошибка при установке контекста SELinux: %s"
-#: gio/glocalfileinfo.c:3107
+#: gio/glocalfileinfo.c:3111
#, c-format
msgid "Setting attribute %s not supported"
msgstr "Установка атрибута %s не поддерживается"
msgid "Error removing old file: %s"
msgstr "Произошла ошибка при удалении старого файла: %s"
-#: gio/gmemoryinputstream.c:473 gio/gmemoryoutputstream.c:761
+#: gio/gmemoryinputstream.c:473 gio/gmemoryoutputstream.c:751
msgid "Invalid GSeekType supplied"
msgstr "Передан недопустимый GSeekType"
msgid "Cannot truncate GMemoryInputStream"
msgstr "Нельзя усечь GMemoryInputStream"
-#: gio/gmemoryoutputstream.c:567
+#: gio/gmemoryoutputstream.c:557
msgid "Memory output stream not resizable"
msgstr "Невозможно изменить размер выходного потока в память"
-#: gio/gmemoryoutputstream.c:583
+#: gio/gmemoryoutputstream.c:573
msgid "Failed to resize memory output stream"
msgstr "Не удалось изменить размер выходного потока в память"
-#: gio/gmemoryoutputstream.c:662
+#: gio/gmemoryoutputstream.c:652
msgid ""
"Amount of memory required to process the write is larger than available "
"address space"
"Количество памяти, требуемое процессом записи, больше чем доступное адресное "
"пространство"
-#: gio/gmemoryoutputstream.c:771
+#: gio/gmemoryoutputstream.c:761
msgid "Requested seek before the beginning of the stream"
msgstr "Выполнять перемещение в начало потока"
-#: gio/gmemoryoutputstream.c:786
+#: gio/gmemoryoutputstream.c:776
msgid "Requested seek beyond the end of the stream"
msgstr "Выполнять перемещение в конец потока"
"точка монтирования не поддерживает возможность синхронного определения типа "
"содержимого"
-#: gio/gnetworkaddress.c:408
+#: gio/gnetworkaddress.c:424
#, c-format
msgid "Hostname “%s” contains “[” but not “]”"
msgstr "Имя узла «%s» содержит «[», но не «]»"
#. Translators: the first placeholder is a domain name, the
#. * second is an error message
-#: gio/gresolver.c:474 gio/gthreadedresolver.c:317 gio/gthreadedresolver.c:338
+#: gio/gresolver.c:472 gio/gthreadedresolver.c:317 gio/gthreadedresolver.c:338
#: gio/gthreadedresolver.c:983 gio/gthreadedresolver.c:1007
#: gio/gthreadedresolver.c:1032 gio/gthreadedresolver.c:1047
#, c-format
msgstr "Ошибка разрешения «%s»: %s"
#. Translators: The placeholder is for a function name.
-#: gio/gresolver.c:543 gio/gresolver.c:703
+#: gio/gresolver.c:541 gio/gresolver.c:701
#, c-format
msgid "%s not implemented"
msgstr "«%s» не реализовано"
-#: gio/gresolver.c:1072 gio/gresolver.c:1124
+#: gio/gresolver.c:1070 gio/gresolver.c:1122
msgid "Invalid domain"
msgstr "Недопустимый домен"
msgid "No such key “%s”\n"
msgstr "Ключ «%s» отсутствует\n"
-#: gio/gsocket.c:417
+#: gio/gsocket.c:435
msgid "Invalid socket, not initialized"
msgstr "Недопустимый сокет, не инициализировано"
-#: gio/gsocket.c:424
+#: gio/gsocket.c:442
#, c-format
msgid "Invalid socket, initialization failed due to: %s"
msgstr "Недопустимый сокет, инициализация не удалась по причине: %s"
-#: gio/gsocket.c:432
+#: gio/gsocket.c:450
msgid "Socket is already closed"
msgstr "Сокет уже закрыт"
-#: gio/gsocket.c:447 gio/gsocket.c:3236 gio/gsocket.c:4467 gio/gsocket.c:4525
+#: gio/gsocket.c:465 gio/gsocket.c:3291 gio/gsocket.c:4522 gio/gsocket.c:4580
#: gio/gthreadedresolver.c:1452
msgid "Socket I/O timed out"
msgstr "Превышено время ожидания ввода-вывода сокета"
-#: gio/gsocket.c:584
+#: gio/gsocket.c:602
#, c-format
msgid "creating GSocket from fd: %s"
msgstr "создаётся GSocket из fd: %s"
-#: gio/gsocket.c:644 gio/gsocket.c:712 gio/gsocket.c:719
+#: gio/gsocket.c:662 gio/gsocket.c:730 gio/gsocket.c:737
#, c-format
msgid "Unable to create socket: %s"
msgstr "Не удалось создать сокет: %s"
-#: gio/gsocket.c:712
+#: gio/gsocket.c:730
msgid "Unknown family was specified"
msgstr "Указано неизвестное семейство"
-#: gio/gsocket.c:719
+#: gio/gsocket.c:737
msgid "Unknown protocol was specified"
msgstr "Указан неизвестный протокол"
-#: gio/gsocket.c:1188
+#: gio/gsocket.c:1243
#, c-format
msgid "Cannot use datagram operations on a non-datagram socket."
msgstr ""
"Невозможно использовать дейтаграммные операции на не-дейтаграммном сокете."
-#: gio/gsocket.c:1205
+#: gio/gsocket.c:1260
#, c-format
msgid "Cannot use datagram operations on a socket with a timeout set."
msgstr ""
"Невозможно использовать дейтаграммные операции на сокете с установленным "
"тайм-аутом."
-#: gio/gsocket.c:2012
+#: gio/gsocket.c:2067
#, c-format
msgid "could not get local address: %s"
msgstr "не удалось получить локальный адрес: %s"
-#: gio/gsocket.c:2058
+#: gio/gsocket.c:2113
#, c-format
msgid "could not get remote address: %s"
msgstr "не удалось получить удаленный адрес: %s"
-#: gio/gsocket.c:2124
+#: gio/gsocket.c:2179
#, c-format
msgid "could not listen: %s"
msgstr "не удалось слушать: %s"
-#: gio/gsocket.c:2228
+#: gio/gsocket.c:2283
#, c-format
msgid "Error binding to address %s: %s"
msgstr "Произошла ошибка при связывании к адресу %s: %s"
-#: gio/gsocket.c:2403 gio/gsocket.c:2440 gio/gsocket.c:2550 gio/gsocket.c:2575
-#: gio/gsocket.c:2642 gio/gsocket.c:2700 gio/gsocket.c:2718
+#: gio/gsocket.c:2458 gio/gsocket.c:2495 gio/gsocket.c:2605 gio/gsocket.c:2630
+#: gio/gsocket.c:2697 gio/gsocket.c:2755 gio/gsocket.c:2773
#, c-format
msgid "Error joining multicast group: %s"
msgstr "Ошибка при вступлении в мультикастовую группу: %s"
-#: gio/gsocket.c:2404 gio/gsocket.c:2441 gio/gsocket.c:2551 gio/gsocket.c:2576
-#: gio/gsocket.c:2643 gio/gsocket.c:2701 gio/gsocket.c:2719
+#: gio/gsocket.c:2459 gio/gsocket.c:2496 gio/gsocket.c:2606 gio/gsocket.c:2631
+#: gio/gsocket.c:2698 gio/gsocket.c:2756 gio/gsocket.c:2774
#, c-format
msgid "Error leaving multicast group: %s"
msgstr "Ошибка при выходе из мультикастовой группы: %s"
-#: gio/gsocket.c:2405
+#: gio/gsocket.c:2460
msgid "No support for source-specific multicast"
msgstr "Отсутствует поддержка мультикаста по источнику"
-#: gio/gsocket.c:2552
+#: gio/gsocket.c:2607
msgid "Unsupported socket family"
msgstr "Неподдерживаемое семейство сокетов"
-#: gio/gsocket.c:2577
+#: gio/gsocket.c:2632
msgid "source-specific not an IPv4 address"
msgstr "специфичный источник, не адрес IP4"
-#: gio/gsocket.c:2601
+#: gio/gsocket.c:2656
#, c-format
msgid "Interface name too long"
msgstr "Имя интерфейса слишком длинное"
-#: gio/gsocket.c:2614 gio/gsocket.c:2668
+#: gio/gsocket.c:2669 gio/gsocket.c:2723
#, c-format
msgid "Interface not found: %s"
msgstr "Интерфейс не найден: %s"
-#: gio/gsocket.c:2644
+#: gio/gsocket.c:2699
msgid "No support for IPv4 source-specific multicast"
msgstr "Отсутствует поддержка IPv4 мультикаста по источнику"
-#: gio/gsocket.c:2702
+#: gio/gsocket.c:2757
msgid "No support for IPv6 source-specific multicast"
msgstr "Отсутствует поддержка IPv6 мультикаста по источнику"
-#: gio/gsocket.c:2935
+#: gio/gsocket.c:2990
#, c-format
msgid "Error accepting connection: %s"
msgstr "Ошибка приёма подключения: %s"
-#: gio/gsocket.c:3061
+#: gio/gsocket.c:3116
msgid "Connection in progress"
msgstr "Выполняется соединение"
-#: gio/gsocket.c:3112
+#: gio/gsocket.c:3167
msgid "Unable to get pending error: "
msgstr "Не удалось получить ошибку ожидания: "
-#: gio/gsocket.c:3301
+#: gio/gsocket.c:3356
#, c-format
msgid "Error receiving data: %s"
msgstr "Ошибка при получении данных: %s"
-#: gio/gsocket.c:3498
+#: gio/gsocket.c:3553
#, c-format
msgid "Error sending data: %s"
msgstr "Ошибка при отправлении данных: %s"
-#: gio/gsocket.c:3685
+#: gio/gsocket.c:3740
#, c-format
msgid "Unable to shutdown socket: %s"
msgstr "Не удалось выключить сокет: %s"
-#: gio/gsocket.c:3766
+#: gio/gsocket.c:3821
#, c-format
msgid "Error closing socket: %s"
msgstr "Произошла ошибка при закрытии сокета: %s"
-#: gio/gsocket.c:4460
+#: gio/gsocket.c:4515
#, c-format
msgid "Waiting for socket condition: %s"
msgstr "Ожидание состояния сокета: %s"
-#: gio/gsocket.c:4850 gio/gsocket.c:4866 gio/gsocket.c:4879
+#: gio/gsocket.c:4905 gio/gsocket.c:4921 gio/gsocket.c:4934
#, c-format
msgid "Unable to send message: %s"
msgstr "Не удалось отправить сообщение: %s"
-#: gio/gsocket.c:4851 gio/gsocket.c:4867 gio/gsocket.c:4880
+#: gio/gsocket.c:4906 gio/gsocket.c:4922 gio/gsocket.c:4935
msgid "Message vectors too large"
msgstr "Слишком большие массивы сообщения"
-#: gio/gsocket.c:4896 gio/gsocket.c:4898 gio/gsocket.c:5045 gio/gsocket.c:5130
-#: gio/gsocket.c:5308 gio/gsocket.c:5348 gio/gsocket.c:5350
+#: gio/gsocket.c:4951 gio/gsocket.c:4953 gio/gsocket.c:5100 gio/gsocket.c:5185
+#: gio/gsocket.c:5363 gio/gsocket.c:5403 gio/gsocket.c:5405
#, c-format
msgid "Error sending message: %s"
msgstr "Произошла ошибка при отправлении сообщения: %s"
-#: gio/gsocket.c:5072
+#: gio/gsocket.c:5127
msgid "GSocketControlMessage not supported on Windows"
msgstr "GSocketControlMessage не поддерживается в Windows"
-#: gio/gsocket.c:5545 gio/gsocket.c:5621 gio/gsocket.c:5847
+#: gio/gsocket.c:5600 gio/gsocket.c:5676 gio/gsocket.c:5902
#, c-format
msgid "Error receiving message: %s"
msgstr "Произошла ошибка при получении сообщения: %s"
-#: gio/gsocket.c:6132 gio/gsocket.c:6143 gio/gsocket.c:6206
+#: gio/gsocket.c:6187 gio/gsocket.c:6198 gio/gsocket.c:6261
#, c-format
msgid "Unable to read socket credentials: %s"
msgstr "Не удалось прочитать полномочия сокета: %s"
-#: gio/gsocket.c:6215
+#: gio/gsocket.c:6270
msgid "g_socket_get_credentials not implemented for this OS"
msgstr "g_socket_get_credentials не реализован для данной ОС"
-#: gio/gsocketclient.c:190
+#: gio/gsocketclient.c:192
#, c-format
msgid "Could not connect to proxy server %s: "
msgstr "Не удалось подключиться к прокси-серверу %s: "
-#: gio/gsocketclient.c:204
+#: gio/gsocketclient.c:206
#, c-format
msgid "Could not connect to %s: "
msgstr "Не удалось подключиться к %s: "
-#: gio/gsocketclient.c:206
+#: gio/gsocketclient.c:208
msgid "Could not connect: "
msgstr "Не удалось подключиться к: "
-#: gio/gsocketclient.c:1201 gio/gsocketclient.c:1804
+#: gio/gsocketclient.c:1234 gio/gsocketclient.c:1851
msgid "Proxying over a non-TCP connection is not supported."
msgstr "Проксирование через не-TCP соединение не поддерживается."
-#: gio/gsocketclient.c:1233 gio/gsocketclient.c:1833
+#: gio/gsocketclient.c:1266 gio/gsocketclient.c:1886
#, c-format
msgid "Proxy protocol “%s” is not supported."
msgstr "Протокол прокси «%s» не поддерживается."
-#: gio/gsocketlistener.c:229
+#: gio/gsocketlistener.c:235
msgid "Listener is already closed"
msgstr "Слушатель уже закрыт"
-#: gio/gsocketlistener.c:275
+#: gio/gsocketlistener.c:281
msgid "Added socket is closed"
msgstr "Добавленный сокет закрыт"
msgid "Unknown SOCKSv5 proxy error."
msgstr "Неизвестная ошибка прокси SOCKSv5."
-#: gio/gtestdbus.c:610 glib/gspawn-win32.c:433
+#: gio/gtestdbus.c:608 glib/gspawn-win32.c:433
#, c-format
msgid "Failed to create pipe for communicating with child process (%s)"
msgstr "Не удалось создать канал для сообщения с процессом-потомком (%s)"
-#: gio/gtestdbus.c:617
+#: gio/gtestdbus.c:615
#, c-format
msgid "Pipes are not supported in this platform"
msgstr "Каналы не поддерживаются на этой платформе"
-#: gio/gthemedicon.c:596
+#: gio/gthemedicon.c:590
#, c-format
msgid "Can’t handle version %d of GThemedIcon encoding"
msgstr "Не удалось обработать версию %d текстового представления GThemedIcon"
msgid "Failed to parse DNS response for “%s”: "
msgstr "Не удалось разобрать ответ DNS для \"%s\": "
-#: gio/gtlscertificate.c:468
+#: gio/gtlscertificate.c:438
msgid "No PEM-encoded private key found"
msgstr "Не найден секретный ключ в формате PEM"
-#: gio/gtlscertificate.c:478
+#: gio/gtlscertificate.c:448
msgid "Cannot decrypt PEM-encoded private key"
msgstr "Не удалось расшифровать секретный ключ в формате PEM"
-#: gio/gtlscertificate.c:489
+#: gio/gtlscertificate.c:459
msgid "Could not parse PEM-encoded private key"
msgstr "Не удалось разобрать секретный ключ в формате PEM"
-#: gio/gtlscertificate.c:516
+#: gio/gtlscertificate.c:486
msgid "No PEM-encoded certificate found"
msgstr "Не найден сертификат в формате PEM"
-#: gio/gtlscertificate.c:525
+#: gio/gtlscertificate.c:495
msgid "Could not parse PEM-encoded certificate"
msgstr "Не удалось разобрать сертификат в формате PEM"
-#: gio/gtlscertificate.c:788
+#: gio/gtlscertificate.c:758
msgid "The current TLS backend does not support PKCS #12"
msgstr "Текущий бэкенд TLS не поддерживает PKCS #12"
-#: gio/gtlscertificate.c:1005
+#: gio/gtlscertificate.c:975
msgid "This GTlsBackend does not support creating PKCS #11 certificates"
msgstr "Сервис GTlsBackend не поддерживает создание сертификатов PKCS #11"
msgid "Error while disabling SO_PASSCRED: %s"
msgstr "Произошла ошибка при отключении SO_PASSCRED: %s"
-#: gio/gunixinputstream.c:356 gio/gunixinputstream.c:377
+#: gio/gunixinputstream.c:352 gio/gunixinputstream.c:373
#, c-format
msgid "Error reading from file descriptor: %s"
msgstr "Ошибка при чтении из файлового дескриптора: %s"
-#: gio/gunixinputstream.c:410 gio/gunixoutputstream.c:519
+#: gio/gunixinputstream.c:406 gio/gunixoutputstream.c:515
#: gio/gwin32inputstream.c:216 gio/gwin32outputstream.c:203
#, c-format
msgid "Error closing file descriptor: %s"
msgid "Filesystem root"
msgstr "Корень файловой системы"
-#: gio/gunixoutputstream.c:356 gio/gunixoutputstream.c:376
-#: gio/gunixoutputstream.c:463 gio/gunixoutputstream.c:483
-#: gio/gunixoutputstream.c:629
+#: gio/gunixoutputstream.c:352 gio/gunixoutputstream.c:372
+#: gio/gunixoutputstream.c:459 gio/gunixoutputstream.c:479
+#: gio/gunixoutputstream.c:625
#, c-format
msgid "Error writing to file descriptor: %s"
msgstr "Ошибка при записи в файловый дескриптор: %s"
msgid "volume doesn’t implement eject or eject_with_operation"
msgstr "том не поддерживает извлечение или извлечение_с_операцией"
+#: gio/gwin32appinfo.c:5216
+#, c-format
+msgid "The app ‘%s’ in the application object has no verbs"
+msgstr "Приложение '%s' в объекте приложения не имеет глаголов"
+
+#: gio/gwin32appinfo.c:5220
+#, c-format
+msgid ""
+"The app ‘%s’ and the handler ‘%s’ in the application object have no verbs"
+msgstr ""
+"Приложение '%s' и обработчик '%s' в объекте приложения не имеют глаголов"
+
#: gio/gwin32inputstream.c:184
#, c-format
msgid "Error reading from handle: %s"
msgid "Error writing to handle: %s"
msgstr "Произошла ошибка при записи в дескриптор: %s"
-#: gio/gzlibcompressor.c:389 gio/gzlibdecompressor.c:342
+#: gio/gzlibcompressor.c:399 gio/gzlibdecompressor.c:345
msgid "Not enough memory"
msgstr "Недостаточно памяти"
-#: gio/gzlibcompressor.c:396 gio/gzlibdecompressor.c:349
+#: gio/gzlibcompressor.c:406 gio/gzlibdecompressor.c:352
#, c-format
msgid "Internal error: %s"
msgstr "Внутренняя ошибка: %s"
-#: gio/gzlibcompressor.c:409 gio/gzlibdecompressor.c:363
+#: gio/gzlibcompressor.c:419 gio/gzlibdecompressor.c:366
msgid "Need more input"
msgstr "Требуется больше входных данных"
-#: gio/gzlibdecompressor.c:335
+#: gio/gzlibdecompressor.c:338
msgid "Invalid compressed data"
msgstr "Неправильные сжатые данные"
msgstr "Путь «%s» не является абсолютным"
#. Translators: this is the preferred format for expressing the date and the time
-#: glib/gdatetime.c:196
+#: glib/gdatetime.c:199
msgctxt "GDateTime"
msgid "%a %b %e %H:%M:%S %Y"
msgstr "%a, %-d %b %Y, %H∶%M∶%S"
#. Translators: this is the preferred format for expressing the date
-#: glib/gdatetime.c:199
+#: glib/gdatetime.c:202
msgctxt "GDateTime"
msgid "%m/%d/%y"
msgstr "%d.%m.%y"
#. Translators: this is the preferred format for expressing the time
-#: glib/gdatetime.c:202
+#: glib/gdatetime.c:205
msgctxt "GDateTime"
msgid "%H:%M:%S"
msgstr "%H:%M:%S"
#. Translators: this is the preferred format for expressing 12 hour time
-#: glib/gdatetime.c:205
+#: glib/gdatetime.c:208
msgctxt "GDateTime"
msgid "%I:%M:%S %p"
msgstr "%-I∶%M∶%S %p"
#. * non-European) there is no difference between the standalone and
#. * complete date form.
#.
-#: glib/gdatetime.c:244
+#: glib/gdatetime.c:247
msgctxt "full month name"
msgid "January"
msgstr "Январь"
-#: glib/gdatetime.c:246
+#: glib/gdatetime.c:249
msgctxt "full month name"
msgid "February"
msgstr "Февраль"
-#: glib/gdatetime.c:248
+#: glib/gdatetime.c:251
msgctxt "full month name"
msgid "March"
msgstr "Март"
-#: glib/gdatetime.c:250
+#: glib/gdatetime.c:253
msgctxt "full month name"
msgid "April"
msgstr "Апрель"
-#: glib/gdatetime.c:252
+#: glib/gdatetime.c:255
msgctxt "full month name"
msgid "May"
msgstr "Май"
-#: glib/gdatetime.c:254
+#: glib/gdatetime.c:257
msgctxt "full month name"
msgid "June"
msgstr "Июнь"
-#: glib/gdatetime.c:256
+#: glib/gdatetime.c:259
msgctxt "full month name"
msgid "July"
msgstr "Июль"
-#: glib/gdatetime.c:258
+#: glib/gdatetime.c:261
msgctxt "full month name"
msgid "August"
msgstr "Август"
-#: glib/gdatetime.c:260
+#: glib/gdatetime.c:263
msgctxt "full month name"
msgid "September"
msgstr "Сентябрь"
-#: glib/gdatetime.c:262
+#: glib/gdatetime.c:265
msgctxt "full month name"
msgid "October"
msgstr "Октябрь"
-#: glib/gdatetime.c:264
+#: glib/gdatetime.c:267
msgctxt "full month name"
msgid "November"
msgstr "Ноябрь"
-#: glib/gdatetime.c:266
+#: glib/gdatetime.c:269
msgctxt "full month name"
msgid "December"
msgstr "Декабрь"
#. * other platform. Here are abbreviated month names in a form
#. * appropriate when they are used standalone.
#.
-#: glib/gdatetime.c:298
+#: glib/gdatetime.c:301
msgctxt "abbreviated month name"
msgid "Jan"
msgstr "Янв"
-#: glib/gdatetime.c:300
+#: glib/gdatetime.c:303
msgctxt "abbreviated month name"
msgid "Feb"
msgstr "Фев"
-#: glib/gdatetime.c:302
+#: glib/gdatetime.c:305
msgctxt "abbreviated month name"
msgid "Mar"
msgstr "Мар"
-#: glib/gdatetime.c:304
+#: glib/gdatetime.c:307
msgctxt "abbreviated month name"
msgid "Apr"
msgstr "Апр"
-#: glib/gdatetime.c:306
+#: glib/gdatetime.c:309
msgctxt "abbreviated month name"
msgid "May"
msgstr "Май"
-#: glib/gdatetime.c:308
+#: glib/gdatetime.c:311
msgctxt "abbreviated month name"
msgid "Jun"
msgstr "Июн"
-#: glib/gdatetime.c:310
+#: glib/gdatetime.c:313
msgctxt "abbreviated month name"
msgid "Jul"
msgstr "Июл"
-#: glib/gdatetime.c:312
+#: glib/gdatetime.c:315
msgctxt "abbreviated month name"
msgid "Aug"
msgstr "Авг"
-#: glib/gdatetime.c:314
+#: glib/gdatetime.c:317
msgctxt "abbreviated month name"
msgid "Sep"
msgstr "Сен"
-#: glib/gdatetime.c:316
+#: glib/gdatetime.c:319
msgctxt "abbreviated month name"
msgid "Oct"
msgstr "Окт"
-#: glib/gdatetime.c:318
+#: glib/gdatetime.c:321
msgctxt "abbreviated month name"
msgid "Nov"
msgstr "Ноя"
-#: glib/gdatetime.c:320
+#: glib/gdatetime.c:323
msgctxt "abbreviated month name"
msgid "Dec"
msgstr "Дек"
-#: glib/gdatetime.c:335
+#: glib/gdatetime.c:338
msgctxt "full weekday name"
msgid "Monday"
msgstr "Понедельник"
-#: glib/gdatetime.c:337
+#: glib/gdatetime.c:340
msgctxt "full weekday name"
msgid "Tuesday"
msgstr "Вторник"
-#: glib/gdatetime.c:339
+#: glib/gdatetime.c:342
msgctxt "full weekday name"
msgid "Wednesday"
msgstr "Среда"
-#: glib/gdatetime.c:341
+#: glib/gdatetime.c:344
msgctxt "full weekday name"
msgid "Thursday"
msgstr "Четверг"
-#: glib/gdatetime.c:343
+#: glib/gdatetime.c:346
msgctxt "full weekday name"
msgid "Friday"
msgstr "Пятница"
-#: glib/gdatetime.c:345
+#: glib/gdatetime.c:348
msgctxt "full weekday name"
msgid "Saturday"
msgstr "Суббота"
-#: glib/gdatetime.c:347
+#: glib/gdatetime.c:350
msgctxt "full weekday name"
msgid "Sunday"
msgstr "Воскресенье"
-#: glib/gdatetime.c:362
+#: glib/gdatetime.c:365
msgctxt "abbreviated weekday name"
msgid "Mon"
msgstr "Пн"
-#: glib/gdatetime.c:364
+#: glib/gdatetime.c:367
msgctxt "abbreviated weekday name"
msgid "Tue"
msgstr "Вт"
-#: glib/gdatetime.c:366
+#: glib/gdatetime.c:369
msgctxt "abbreviated weekday name"
msgid "Wed"
msgstr "Ср"
-#: glib/gdatetime.c:368
+#: glib/gdatetime.c:371
msgctxt "abbreviated weekday name"
msgid "Thu"
msgstr "Чт"
-#: glib/gdatetime.c:370
+#: glib/gdatetime.c:373
msgctxt "abbreviated weekday name"
msgid "Fri"
msgstr "Пт"
-#: glib/gdatetime.c:372
+#: glib/gdatetime.c:375
msgctxt "abbreviated weekday name"
msgid "Sat"
msgstr "Сб"
-#: glib/gdatetime.c:374
+#: glib/gdatetime.c:377
msgctxt "abbreviated weekday name"
msgid "Sun"
msgstr "Вс"
#. * (western European, non-European) there is no difference between the
#. * standalone and complete date form.
#.
-#: glib/gdatetime.c:438
+#: glib/gdatetime.c:441
msgctxt "full month name with day"
msgid "January"
msgstr "Января"
-#: glib/gdatetime.c:440
+#: glib/gdatetime.c:443
msgctxt "full month name with day"
msgid "February"
msgstr "Февраля"
-#: glib/gdatetime.c:442
+#: glib/gdatetime.c:445
msgctxt "full month name with day"
msgid "March"
msgstr "Марта"
-#: glib/gdatetime.c:444
+#: glib/gdatetime.c:447
msgctxt "full month name with day"
msgid "April"
msgstr "Апреля"
-#: glib/gdatetime.c:446
+#: glib/gdatetime.c:449
msgctxt "full month name with day"
msgid "May"
msgstr "Мая"
-#: glib/gdatetime.c:448
+#: glib/gdatetime.c:451
msgctxt "full month name with day"
msgid "June"
msgstr "Июня"
-#: glib/gdatetime.c:450
+#: glib/gdatetime.c:453
msgctxt "full month name with day"
msgid "July"
msgstr "Июля"
-#: glib/gdatetime.c:452
+#: glib/gdatetime.c:455
msgctxt "full month name with day"
msgid "August"
msgstr "Августа"
-#: glib/gdatetime.c:454
+#: glib/gdatetime.c:457
msgctxt "full month name with day"
msgid "September"
msgstr "Сентября"
-#: glib/gdatetime.c:456
+#: glib/gdatetime.c:459
msgctxt "full month name with day"
msgid "October"
msgstr "Октября"
-#: glib/gdatetime.c:458
+#: glib/gdatetime.c:461
msgctxt "full month name with day"
msgid "November"
msgstr "Ноября"
-#: glib/gdatetime.c:460
+#: glib/gdatetime.c:463
msgctxt "full month name with day"
msgid "December"
msgstr "Декабря"
#. * 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:525
+#: glib/gdatetime.c:528
msgctxt "abbreviated month name with day"
msgid "Jan"
msgstr "Янв"
-#: glib/gdatetime.c:527
+#: glib/gdatetime.c:530
msgctxt "abbreviated month name with day"
msgid "Feb"
msgstr "Фев"
-#: glib/gdatetime.c:529
+#: glib/gdatetime.c:532
msgctxt "abbreviated month name with day"
msgid "Mar"
msgstr "Мар"
-#: glib/gdatetime.c:531
+#: glib/gdatetime.c:534
msgctxt "abbreviated month name with day"
msgid "Apr"
msgstr "Апр"
-#: glib/gdatetime.c:533
+#: glib/gdatetime.c:536
msgctxt "abbreviated month name with day"
msgid "May"
msgstr "Мая"
-#: glib/gdatetime.c:535
+#: glib/gdatetime.c:538
msgctxt "abbreviated month name with day"
msgid "Jun"
msgstr "Июн"
-#: glib/gdatetime.c:537
+#: glib/gdatetime.c:540
msgctxt "abbreviated month name with day"
msgid "Jul"
msgstr "Июл"
-#: glib/gdatetime.c:539
+#: glib/gdatetime.c:542
msgctxt "abbreviated month name with day"
msgid "Aug"
msgstr "Авг"
-#: glib/gdatetime.c:541
+#: glib/gdatetime.c:544
msgctxt "abbreviated month name with day"
msgid "Sep"
msgstr "Сен"
-#: glib/gdatetime.c:543
+#: glib/gdatetime.c:546
msgctxt "abbreviated month name with day"
msgid "Oct"
msgstr "Окт"
-#: glib/gdatetime.c:545
+#: glib/gdatetime.c:548
msgctxt "abbreviated month name with day"
msgid "Nov"
msgstr "Ноя"
-#: glib/gdatetime.c:547
+#: glib/gdatetime.c:550
msgctxt "abbreviated month name with day"
msgid "Dec"
msgstr "Дек"
#. Translators: 'before midday' indicator
-#: glib/gdatetime.c:564
+#: glib/gdatetime.c:589
msgctxt "GDateTime"
msgid "AM"
msgstr "ДП (AM)"
#. Translators: 'after midday' indicator
-#: glib/gdatetime.c:567
+#: glib/gdatetime.c:592
msgctxt "GDateTime"
msgid "PM"
msgstr "ПП (PM)"
-#: glib/gdir.c:158
+#: glib/gdir.c:168
#, c-format
msgid "Error opening directory “%s”: %s"
msgstr "Произошла ошибка при открытии каталога «%s»: %s"
-#: glib/gfileutils.c:753 glib/gfileutils.c:857
+#: glib/gfileutils.c:716 glib/gfileutils.c:820
msgid "Could not allocate %"
msgid_plural "Could not allocate %"
msgstr[0] "Не удалось распределить %"
msgstr[1] "Не удалось распределить %"
msgstr[2] "Не удалось распределить %"
-#: glib/gfileutils.c:770
+#: glib/gfileutils.c:733
#, c-format
msgid "Error reading file “%s”: %s"
msgstr "Ошибка при чтении файла «%s»: %s"
-#: glib/gfileutils.c:806 glib/gfileutils.c:840
+#: glib/gfileutils.c:769 glib/gfileutils.c:803
#, c-format
msgid "File “%s” is too large"
msgstr "Файл «%s» слишком велик"
-#: glib/gfileutils.c:882
+#: glib/gfileutils.c:845
#, c-format
msgid "Failed to read from file “%s”: %s"
msgstr "Не удалось прочитать из файла «%s»: %s"
-#: glib/gfileutils.c:932 glib/gfileutils.c:1007 glib/gfileutils.c:1514
+#: glib/gfileutils.c:895 glib/gfileutils.c:970 glib/gfileutils.c:1477
#, c-format
msgid "Failed to open file “%s”: %s"
msgstr "Не удалось открыть файл «%s»: %s"
-#: glib/gfileutils.c:945
+#: glib/gfileutils.c:908
#, c-format
msgid "Failed to get attributes of file “%s”: fstat() failed: %s"
msgstr "Не удалось получить атрибуты файла «%s»: сбой в функции fstat(): %s"
-#: glib/gfileutils.c:976
+#: glib/gfileutils.c:939
#, c-format
msgid "Failed to open file “%s”: fdopen() failed: %s"
msgstr "Не удалось открыть файл «%s»: сбой в функции fdopen(): %s"
-#: glib/gfileutils.c:1077
+#: glib/gfileutils.c:1040
#, c-format
msgid "Failed to rename file “%s” to “%s”: g_rename() failed: %s"
msgstr ""
"Не удалось переименовать файл «%s» в «%s»: сбой в функции g_rename(): %s"
-#: glib/gfileutils.c:1176
+#: glib/gfileutils.c:1139
#, c-format
msgid "Failed to write file “%s”: ftruncate() failed: %s"
msgstr "Не удалось записать файл «%s»: сбой в функции ftruncate(): %s"
-#: glib/gfileutils.c:1221
+#: glib/gfileutils.c:1184
#, c-format
msgid "Failed to write file “%s”: write() failed: %s"
msgstr "Не удалось записать файл «%s»: сбой в функции write(): %s"
-#: glib/gfileutils.c:1242
+#: glib/gfileutils.c:1205
#, c-format
msgid "Failed to write file “%s”: fsync() failed: %s"
msgstr "Не удалось записать файл «%s»: сбой в функции fsync(): %s"
-#: glib/gfileutils.c:1403 glib/gfileutils.c:1820
+#: glib/gfileutils.c:1366 glib/gfileutils.c:1783
#, c-format
msgid "Failed to create file “%s”: %s"
msgstr "Не удалось создать файл «%s»: %s"
-#: glib/gfileutils.c:1448
+#: glib/gfileutils.c:1411
#, c-format
msgid "Existing file “%s” could not be removed: g_unlink() failed: %s"
msgstr ""
"Не удалось удалить существующий файл «%s»: сбой в функции g_unlink(): %s"
-#: glib/gfileutils.c:1785
+#: glib/gfileutils.c:1748
#, c-format
msgid "Template “%s” invalid, should not contain a “%s”"
msgstr "Шаблон «%s» недопустим: он не должен содержать «%s»"
-#: glib/gfileutils.c:1798
+#: glib/gfileutils.c:1761
#, c-format
msgid "Template “%s” doesn’t contain XXXXXX"
msgstr "Шаблон «%s» не содержит XXXXXX"
-#: glib/gfileutils.c:2392 glib/gfileutils.c:2421
+#: glib/gfileutils.c:2355 glib/gfileutils.c:2384
#, c-format
msgid "Failed to read the symbolic link “%s”: %s"
msgstr "Не удалось прочитать символьную ссылку «%s»: %s"
msgid "Unknown option %s"
msgstr "Неизвестный параметр %s"
-#: glib/gregex.c:478
+#: glib/gregex.c:479
msgid "corrupted object"
msgstr "повреждённый объект"
-#: glib/gregex.c:480
+#: glib/gregex.c:481
msgid "out of memory"
msgstr "закончилась память"
-#: glib/gregex.c:495
+#: glib/gregex.c:496
msgid "internal error"
msgstr "внутренняя ошибка"
-#: glib/gregex.c:497
+#: glib/gregex.c:498
msgid "the pattern contains items not supported for partial matching"
msgstr ""
"шаблон содержит элементы, которые не поддерживаются при поиске частичного "
"совпадения"
-#: glib/gregex.c:499
+#: glib/gregex.c:500
msgid "back references as conditions are not supported for partial matching"
msgstr ""
"условия в виде обратных ссылок при поиске частичного совпадения не "
"поддерживаются"
-#: glib/gregex.c:505
+#: glib/gregex.c:506
msgid "recursion limit reached"
msgstr "достигнут предел рекурсии"
-#: glib/gregex.c:507
+#: glib/gregex.c:508
msgid "bad offset"
msgstr "неправильное смещение"
-#: glib/gregex.c:509
+#: glib/gregex.c:510
msgid "recursion loop"
msgstr "зацикливание рекурсии"
#. should not happen in GRegex since we check modes before each match
-#: glib/gregex.c:512
+#: glib/gregex.c:513
msgid "matching mode is requested that was not compiled for JIT"
msgstr "запрашивается режим согласования, который не был скомпилирован для JIT"
-#: glib/gregex.c:533 glib/gregex.c:1849
+#: glib/gregex.c:534 glib/gregex.c:1850
msgid "unknown error"
msgstr "неизвестная ошибка"
-#: glib/gregex.c:554
+#: glib/gregex.c:555
msgid "\\ at end of pattern"
msgstr "\\ в конце шаблона"
-#: glib/gregex.c:558
+#: glib/gregex.c:559
msgid "\\c at end of pattern"
msgstr "\\c в конце шаблона"
-#: glib/gregex.c:563
+#: glib/gregex.c:564
msgid "unrecognized character following \\"
msgstr "неопознанный символ следует за \\"
-#: glib/gregex.c:567
+#: glib/gregex.c:568
msgid "numbers out of order in {} quantifier"
msgstr "числа в квантификаторе {} в неправильном порядке"
-#: glib/gregex.c:571
+#: glib/gregex.c:572
msgid "number too big in {} quantifier"
msgstr "слишком большое число в квантификаторе {}"
-#: glib/gregex.c:575
+#: glib/gregex.c:576
msgid "missing terminating ] for character class"
msgstr "отсутствует завершающая ] для класса символов"
-#: glib/gregex.c:579
+#: glib/gregex.c:580
msgid "invalid escape sequence in character class"
msgstr "неверное экранирование в классе символов"
-#: glib/gregex.c:583
+#: glib/gregex.c:584
msgid "range out of order in character class"
msgstr "диапазон в классе символов в неправильном порядке"
-#: glib/gregex.c:588
+#: glib/gregex.c:589
msgid "nothing to repeat"
msgstr "нечего повторять"
-#: glib/gregex.c:592
+#: glib/gregex.c:593
msgid "unrecognized character after (? or (?-"
msgstr "неопознанный символ после (? или (?-"
-#: glib/gregex.c:596
+#: glib/gregex.c:597
msgid "POSIX named classes are supported only within a class"
msgstr "Именованные классы POSIX поддерживаются только внутри класса"
-#: glib/gregex.c:600
+#: glib/gregex.c:601
msgid "POSIX collating elements are not supported"
msgstr "Сортировочные элементы POSIX не поддерживаются"
-#: glib/gregex.c:606
+#: glib/gregex.c:607
msgid "missing terminating )"
msgstr "отсутствует завершающая )"
-#: glib/gregex.c:610
+#: glib/gregex.c:611
msgid "reference to non-existent subpattern"
msgstr "ссылка на несуществующий подшаблон"
-#: glib/gregex.c:614
+#: glib/gregex.c:615
msgid "missing ) after comment"
msgstr "отсутствует ) после комментария"
-#: glib/gregex.c:618
+#: glib/gregex.c:619
msgid "regular expression is too large"
msgstr "слишком длинное регулярное выражение"
-#: glib/gregex.c:622
+#: glib/gregex.c:623
msgid "malformed number or name after (?("
msgstr "ошибочное число или имя после (?("
-#: glib/gregex.c:626
+#: glib/gregex.c:627
msgid "lookbehind assertion is not fixed length"
msgstr "lookbehind-утверждение не имеет фиксированную длину"
-#: glib/gregex.c:630
+#: glib/gregex.c:631
msgid "conditional group contains more than two branches"
msgstr "условная группа содержит более двух ветвей"
-#: glib/gregex.c:634
+#: glib/gregex.c:635
msgid "assertion expected after (?("
msgstr "ожидалось утверждение после (?("
-#: glib/gregex.c:638
+#: glib/gregex.c:639
msgid "a numbered reference must not be zero"
msgstr "номерная ссылка не может быть нулём"
-#: glib/gregex.c:642
+#: glib/gregex.c:643
msgid "unknown POSIX class name"
msgstr "неизвестное имя класса POSIX"
-#: glib/gregex.c:647
+#: glib/gregex.c:648
msgid "character value in \\x{...} sequence is too large"
msgstr "значение символа в последовательности \\x{...} слишком велико"
-#: glib/gregex.c:651
+#: glib/gregex.c:652
msgid "\\C not allowed in lookbehind assertion"
msgstr "\\C запрещено в lookbehind-утверждениях"
-#: glib/gregex.c:655
+#: glib/gregex.c:656
msgid "missing terminator in subpattern name"
msgstr "отсутствует завершающий символ в имени подшаблона"
-#: glib/gregex.c:659
+#: glib/gregex.c:660
msgid "two named subpatterns have the same name"
msgstr "два именованных подшаблона имеют одинаковое имя"
-#: glib/gregex.c:663
+#: glib/gregex.c:664
msgid "malformed \\P or \\p sequence"
msgstr "ошибочная последовательность \\P или \\p"
-#: glib/gregex.c:667
+#: glib/gregex.c:668
msgid "unknown property name after \\P or \\p"
msgstr "неизвестное имя свойства после \\P или \\p"
-#: glib/gregex.c:671
+#: glib/gregex.c:672
msgid "subpattern name is too long (maximum 32 characters)"
msgstr "имя подшаблона слишком длинное (не должно превышать 32 символа)"
-#: glib/gregex.c:675
+#: glib/gregex.c:676
msgid "too many named subpatterns (maximum 10,000)"
msgstr "слишком много именованных подшаблонов (не должно быть больше 10 000)"
-#: glib/gregex.c:679
+#: glib/gregex.c:680
msgid "octal value is greater than \\377"
msgstr "восьмеричное значение превышает \\377"
-#: glib/gregex.c:683
+#: glib/gregex.c:684
msgid "DEFINE group contains more than one branch"
msgstr "Группа DEFINE содержит более одной ветви"
-#: glib/gregex.c:687
+#: glib/gregex.c:688
msgid "inconsistent NEWLINE options"
msgstr "противоречивые параметры NEWLINE"
-#: glib/gregex.c:691
+#: glib/gregex.c:692
msgid ""
"\\g is not followed by a braced, angle-bracketed, or quoted name or number, "
"or by a plain number"
"за \\g не следует имя или число в скобках, угловых скобках или кавычках, или "
"просто число"
-#: glib/gregex.c:696
+#: glib/gregex.c:697
msgid "an argument is not allowed for (*ACCEPT), (*FAIL), or (*COMMIT)"
msgstr "нельзя указать параметр для (*ACCEPT), (*FAIL) или (*COMMIT)"
-#: glib/gregex.c:700
+#: glib/gregex.c:701
msgid "(*VERB) not recognized"
msgstr "значение (*VERB) не распознано"
-#: glib/gregex.c:704
+#: glib/gregex.c:705
msgid "number is too big"
msgstr "слишком большое число"
-#: glib/gregex.c:708
+#: glib/gregex.c:709
msgid "missing subpattern name after (?&"
msgstr "отсутствует имя подшаблона после (?&"
-#: glib/gregex.c:712
+#: glib/gregex.c:713
msgid "different names for subpatterns of the same number are not allowed"
msgstr ""
"не допускаются использовать различные имена для подшаблонов с одинаковым "
"номером"
-#: glib/gregex.c:716
+#: glib/gregex.c:717
msgid "(*MARK) must have an argument"
msgstr "для (*MARK) требуется параметр"
-#: glib/gregex.c:720
+#: glib/gregex.c:721
msgid "\\c must be followed by an ASCII character"
msgstr "за \\c должен быть символ ASCII"
-#: glib/gregex.c:724
+#: glib/gregex.c:725
msgid "\\k is not followed by a braced, angle-bracketed, or quoted name"
msgstr "за \\k не следует имя в скобках, угловых скобках или кавычках"
-#: glib/gregex.c:728
+#: glib/gregex.c:729
msgid "\\N is not supported in a class"
msgstr "\\N в классе не поддерживается"
-#: glib/gregex.c:732
+#: glib/gregex.c:733
msgid "name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)"
msgstr "слишком длинное имя в (*MARK), (*PRUNE), (*SKIP) или (*THEN)"
-#: glib/gregex.c:736 glib/gregex.c:872
+#: glib/gregex.c:737 glib/gregex.c:873
msgid "code overflow"
msgstr "переполнение кода"
-#: glib/gregex.c:740
+#: glib/gregex.c:741
msgid "unrecognized character after (?P"
msgstr "неопознанный символ после (?P"
-#: glib/gregex.c:744
+#: glib/gregex.c:745
msgid "overran compiling workspace"
msgstr "переполнение рабочего пространства компиляции"
-#: glib/gregex.c:748
+#: glib/gregex.c:749
msgid "previously-checked referenced subpattern not found"
msgstr "не найден ранее проверенный подшаблон со ссылкой"
-#: glib/gregex.c:871 glib/gregex.c:1133 glib/gregex.c:2455
+#: glib/gregex.c:872 glib/gregex.c:1134 glib/gregex.c:2456
#, c-format
msgid "Error while matching regular expression %s: %s"
msgstr ""
"Во время поиска совпадений с регулярным выражением %s возникла ошибка: %s"
-#: glib/gregex.c:1733
+#: glib/gregex.c:1734
msgid "PCRE library is compiled without UTF8 support"
msgstr "Библиотека PCRE собрана без поддержки UTF-8"
-#: glib/gregex.c:1741
+#: glib/gregex.c:1742
msgid "PCRE library is compiled with incompatible options"
msgstr "Библиотека PCRE собрана с несовместимыми параметрами"
-#: glib/gregex.c:1858
+#: glib/gregex.c:1859
#, c-format
msgid "Error while compiling regular expression ‘%s’ at char %s: %s"
msgstr ""
"Произошла ошибка при компиляции регулярного выражения '%s' у символа с "
"номером %s: %s"
-#: glib/gregex.c:2898
+#: glib/gregex.c:2899
msgid "hexadecimal digit or “}” expected"
msgstr "ожидалась шестнадцатеричная цифра или символ «}»"
-#: glib/gregex.c:2914
+#: glib/gregex.c:2915
msgid "hexadecimal digit expected"
msgstr "ожидалась шестнадцатеричная цифра"
-#: glib/gregex.c:2954
+#: glib/gregex.c:2955
msgid "missing “<” in symbolic reference"
msgstr "в символьной ссылке отсутствует «<»"
-#: glib/gregex.c:2963
+#: glib/gregex.c:2964
msgid "unfinished symbolic reference"
msgstr "незаконченная символьная ссылка"
-#: glib/gregex.c:2970
+#: glib/gregex.c:2971
msgid "zero-length symbolic reference"
msgstr "символьная ссылка нулевой длины"
-#: glib/gregex.c:2981
+#: glib/gregex.c:2982
msgid "digit expected"
msgstr "ожидалась цифра"
-#: glib/gregex.c:2999
+#: glib/gregex.c:3000
msgid "illegal symbolic reference"
msgstr "недопустимая символьная ссылка"
-#: glib/gregex.c:3062
+#: glib/gregex.c:3063
msgid "stray final “\\”"
msgstr "лишний «\\» в конце"
-#: glib/gregex.c:3066
+#: glib/gregex.c:3067
msgid "unknown escape sequence"
msgstr "неизвестная экранирующая последовательность"
-#: glib/gregex.c:3076
+#: glib/gregex.c:3077
#, c-format
msgid "Error while parsing replacement text “%s” at char %lu: %s"
msgstr ""
"Произошла ошибка во время разбора текста замен «%s» у символа с номером %lu: "
"%s"
-#: glib/gshell.c:98
+#: glib/gshell.c:84
msgid "Quoted text doesn’t begin with a quotation mark"
msgstr "Текст в кавычках не начинается с символа кавычки"
-#: glib/gshell.c:188
+#: glib/gshell.c:174
msgid "Unmatched quotation mark in command line or other shell-quoted text"
msgstr ""
"Обнаружена незакрытая кавычка в командной строке или другом тексте от "
"оболочки"
-#: glib/gshell.c:594
+#: glib/gshell.c:580
#, c-format
msgid "Text ended just after a “\\” character. (The text was “%s”)"
msgstr "Текст закончился сразу после символа «\\» (текст был «%s»)"
-#: glib/gshell.c:601
+#: glib/gshell.c:587
#, c-format
msgid "Text ended before matching quote was found for %c. (The text was “%s”)"
msgstr ""
"Текст закончился до того, как была найдена закрывающая кавычка для %c. "
"(Текст был «%s»)"
-#: glib/gshell.c:613
+#: glib/gshell.c:599
msgid "Text was empty (or contained only whitespace)"
msgstr "Текст был пуст (или содержал только пробелы)"
-#: glib/gspawn.c:303
+#: glib/gspawn.c:242
#, c-format
msgid "Failed to read data from child process (%s)"
msgstr "Не удалось прочитать данные из дочернего процесса (%s)"
-#: glib/gspawn.c:456
+#: glib/gspawn.c:395
#, c-format
msgid "Unexpected error in reading data from a child process (%s)"
msgstr "Неожиданная ошибка при чтении данных из дочернего процесса (%s)"
-#: glib/gspawn.c:536
+#: glib/gspawn.c:475
#, c-format
msgid "Unexpected error in waitpid() (%s)"
msgstr "Произошла неожиданная ошибка в функции waitpid() (%s)"
-#: glib/gspawn.c:1158 glib/gspawn-win32.c:1575
+#: glib/gspawn.c:1097 glib/gspawn-win32.c:1575
#, c-format
msgid "Child process exited with code %ld"
msgstr "Дочерний процесс завершился с кодом %ld"
-#: glib/gspawn.c:1166
+#: glib/gspawn.c:1105
#, c-format
msgid "Child process killed by signal %ld"
msgstr "Дочерний процесс убит по сигналу %ld"
-#: glib/gspawn.c:1173
+#: glib/gspawn.c:1112
#, c-format
msgid "Child process stopped by signal %ld"
msgstr "Дочерний процесс остановлен по сигналу %ld"
-#: glib/gspawn.c:1180
+#: glib/gspawn.c:1119
#, c-format
msgid "Child process exited abnormally"
msgstr "Дочерний процесс аварийно завершил работу"
-#: glib/gspawn.c:2017 glib/gspawn-win32.c:472 glib/gspawn-win32.c:480
+#: glib/gspawn.c:1956 glib/gspawn-win32.c:472 glib/gspawn-win32.c:480
#, c-format
msgid "Failed to read from child pipe (%s)"
msgstr "Не удалось выполнить чтение из дочернего канала (%s)"
-#: glib/gspawn.c:2396
+#: glib/gspawn.c:2335
#, c-format
msgid "Failed to spawn child process “%s” (%s)"
msgstr "Не удалось запустить дочерний процесс \"%s\" (%s)"
-#: glib/gspawn.c:2520
+#: glib/gspawn.c:2459
#, c-format
msgid "Failed to fork (%s)"
msgstr "Функция fork завершилась неудачно (%s)"
-#: glib/gspawn.c:2681 glib/gspawn-win32.c:503
+#: glib/gspawn.c:2620 glib/gspawn-win32.c:503
#, c-format
msgid "Failed to change to directory “%s” (%s)"
msgstr "Не удалось сменить каталог на «%s» (%s)"
-#: glib/gspawn.c:2691
+#: glib/gspawn.c:2630
#, c-format
msgid "Failed to execute child process “%s” (%s)"
msgstr "Не удалось выполнить дочерний процесс \"%s\" (%s)"
-#: glib/gspawn.c:2701
+#: glib/gspawn.c:2640
#, c-format
msgid "Failed to open file to remap file descriptor (%s)"
msgstr "Не удалось открыть файл для изменения дескриптора файла (%s)"
-#: glib/gspawn.c:2709
+#: glib/gspawn.c:2648
#, c-format
msgid "Failed to duplicate file descriptor for child process (%s)"
msgstr "Не удалось дублировать дескриптор файла для дочернего процесса (%s)"
-#: glib/gspawn.c:2718
+#: glib/gspawn.c:2657
#, c-format
msgid "Failed to fork child process (%s)"
msgstr "При создании дочернего процесса функция fork завершилась неудачно (%s)"
-#: glib/gspawn.c:2726
+#: glib/gspawn.c:2665
#, c-format
msgid "Failed to close file descriptor for child process (%s)"
msgstr "Не удалось закрыть дескриптор файла для дочернего процесса (%s)"
-#: glib/gspawn.c:2734
+#: glib/gspawn.c:2673
#, c-format
msgid "Unknown error executing child process “%s”"
msgstr "Произошла неизвестная ошибка при выполнении дочернего процесса «%s»"
-#: glib/gspawn.c:2758
+#: glib/gspawn.c:2697
#, c-format
msgid "Failed to read enough data from child pid pipe (%s)"
msgstr ""
"Произошла неожиданная ошибка в функции g_io_channel_win32_poll() при чтении "
"данных из процесса-потомка"
-#: glib/gstrfuncs.c:3373 glib/gstrfuncs.c:3475
+#: glib/gstrfuncs.c:3334 glib/gstrfuncs.c:3436
msgid "Empty string is not a number"
msgstr "Пустая строка не является числом"
-#: glib/gstrfuncs.c:3397
+#: glib/gstrfuncs.c:3358
#, c-format
msgid "“%s” is not a signed number"
msgstr "«%s» не является числом со знаком"
-#: glib/gstrfuncs.c:3407 glib/gstrfuncs.c:3511
+#: glib/gstrfuncs.c:3368 glib/gstrfuncs.c:3472
#, c-format
msgid "Number “%s” is out of bounds [%s, %s]"
msgstr "Число «%s» is out of bounds [%s, %s]"
-#: glib/gstrfuncs.c:3501
+#: glib/gstrfuncs.c:3462
#, c-format
msgid "“%s” is not an unsigned number"
msgstr "«%s» не является числом без знака"
-#: glib/guri.c:318
+#: glib/guri.c:309
#, no-c-format
msgid "Invalid %-encoding in URI"
msgstr "Неверная %-кодировка в URI"
-#: glib/guri.c:335
+#: glib/guri.c:326
msgid "Illegal character in URI"
msgstr "Недопустимый символ в URI"
-#: glib/guri.c:369
+#: glib/guri.c:360
msgid "Non-UTF-8 characters in URI"
msgstr "Не UTF-8 символ в URI"
-#: glib/guri.c:549
+#: glib/guri.c:540
#, c-format
msgid "Invalid IPv6 address ‘%.*s’ in URI"
msgstr "Недопустимый IPv6 адрес ‘%.*s’ в URI"
-#: glib/guri.c:604
+#: glib/guri.c:595
#, c-format
msgid "Illegal encoded IP address ‘%.*s’ in URI"
msgstr "Недопустимый закодированный IP адрес ‘%.*s’ в URI"
-#: glib/guri.c:616
+#: glib/guri.c:607
#, c-format
msgid "Illegal internationalized hostname ‘%.*s’ in URI"
msgstr "Недопустимое интернациональное имя хоста ‘%.*s’ в URI"
-#: glib/guri.c:648 glib/guri.c:660
+#: glib/guri.c:639 glib/guri.c:651
#, c-format
msgid "Could not parse port ‘%.*s’ in URI"
msgstr "Невозможно разобрать порт ‘%.*s’ в URI"
-#: glib/guri.c:667
+#: glib/guri.c:658
#, c-format
msgid "Port ‘%.*s’ in URI is out of range"
msgstr "Порт ‘%.*s’ в URI выходит за разрешённые границы"
-#: glib/guri.c:1230 glib/guri.c:1294
+#: glib/guri.c:1221 glib/guri.c:1285
#, c-format
msgid "URI ‘%s’ is not an absolute URI"
msgstr "Путь «%s» не является абсолютным URI"
-#: glib/guri.c:1236
+#: glib/guri.c:1227
#, c-format
msgid "URI ‘%s’ has no host component"
msgstr "URI ‘%s’ не содержит имени или адреса сервера"
-#: glib/guri.c:1466
+#: glib/guri.c:1457
msgid "URI is not absolute, and no base URI was provided"
msgstr "URI не абсолютный, базовый адрес URI не указан"
-#: glib/guri.c:2252
+#: glib/guri.c:2243
msgid "Missing ‘=’ and parameter value"
msgstr "Не хватает символа ‘=’ и значения параметра"
msgstr "Символ находится вне диапазона для UTF-16"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 kB"
-#: glib/gutils.c:2974
+#: glib/gutils.c:2966
msgid "kB"
msgstr "кБ"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 MB"
-#: glib/gutils.c:2976
+#: glib/gutils.c:2968
msgid "MB"
msgstr "МБ"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 GB"
-#: glib/gutils.c:2978
+#: glib/gutils.c:2970
msgid "GB"
msgstr "ГБ"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 TB"
-#: glib/gutils.c:2980
+#: glib/gutils.c:2972
msgid "TB"
msgstr "ТБ"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 PB"
-#: glib/gutils.c:2982
+#: glib/gutils.c:2974
msgid "PB"
msgstr "ПБ"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 EB"
-#: glib/gutils.c:2984
+#: glib/gutils.c:2976
msgid "EB"
msgstr "ЭБ"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 KiB"
-#: glib/gutils.c:2988
+#: glib/gutils.c:2980
msgid "KiB"
msgstr "КиБ"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 MiB"
-#: glib/gutils.c:2990
+#: glib/gutils.c:2982
msgid "MiB"
msgstr "МиБ"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 GiB"
-#: glib/gutils.c:2992
+#: glib/gutils.c:2984
msgid "GiB"
msgstr "ГиБ"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 TiB"
-#: glib/gutils.c:2994
+#: glib/gutils.c:2986
msgid "TiB"
msgstr "ТиБ"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 PiB"
-#: glib/gutils.c:2996
+#: glib/gutils.c:2988
msgid "PiB"
msgstr "ПиБ"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 EiB"
-#: glib/gutils.c:2998
+#: glib/gutils.c:2990
msgid "EiB"
msgstr "ЭиБ"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 kbit"
-#: glib/gutils.c:3002
+#: glib/gutils.c:2994
msgid "kbit"
msgstr "кбит"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 Mbit"
-#: glib/gutils.c:3004
+#: glib/gutils.c:2996
msgid "Mbit"
msgstr "Мбит"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 Gbit"
-#: glib/gutils.c:3006
+#: glib/gutils.c:2998
msgid "Gbit"
msgstr "Гбит"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 Tbit"
-#: glib/gutils.c:3008
+#: glib/gutils.c:3000
msgid "Tbit"
msgstr "Тбит"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 Pbit"
-#: glib/gutils.c:3010
+#: glib/gutils.c:3002
msgid "Pbit"
msgstr "Пбит"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 Ebit"
-#: glib/gutils.c:3012
+#: glib/gutils.c:3004
msgid "Ebit"
msgstr "Эбит"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 Kibit"
-#: glib/gutils.c:3016
+#: glib/gutils.c:3008
msgid "Kibit"
msgstr "Кибит"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 Mibit"
-#: glib/gutils.c:3018
+#: glib/gutils.c:3010
msgid "Mibit"
msgstr "Мибит"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 Gibit"
-#: glib/gutils.c:3020
+#: glib/gutils.c:3012
msgid "Gibit"
msgstr "Гибит"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 Tibit"
-#: glib/gutils.c:3022
+#: glib/gutils.c:3014
msgid "Tibit"
msgstr "Тибит"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 Pibit"
-#: glib/gutils.c:3024
+#: glib/gutils.c:3016
msgid "Pibit"
msgstr "Пибит"
#. Translators: A unit symbol for size formatting, showing for example: "13.0 Eibit"
-#: glib/gutils.c:3026
+#: glib/gutils.c:3018
msgid "Eibit"
msgstr "Эибит"
-#: glib/gutils.c:3064
+#: glib/gutils.c:3056
msgid "byte"
msgid_plural "bytes"
msgstr[0] "байт"
msgstr[1] "байта"
msgstr[2] "байт"
-#: glib/gutils.c:3068
+#: glib/gutils.c:3060
msgid "bit"
msgid_plural "bits"
msgstr[0] "бит"
#. Translators: The "%u" is replaced with the size value, like "13"; it could
#. * be part of "13 bytes", but only the number is requested this time.
-#: glib/gutils.c:3076
+#: glib/gutils.c:3068
#, c-format
msgctxt "format-size"
msgid "%u"
#. 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:3081
+#: glib/gutils.c:3073
#, c-format
msgctxt "format-size"
msgid "%u %s"
#. 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:3117
+#: glib/gutils.c:3109
#, c-format
msgctxt "format-size"
msgid "%.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
#. * the unit symbol. An example: "13.0 MB"
-#: glib/gutils.c:3123
+#: glib/gutils.c:3115
#, c-format
msgctxt "format-size"
msgid "%.1f %s"
msgstr "%.1f %s"
#. Translators: the %s in "%s bytes" will always be replaced by a number.
-#: glib/gutils.c:3163
+#: glib/gutils.c:3155
#, c-format
msgid "%s byte"
msgid_plural "%s bytes"
msgstr[2] "%s байт"
#. Translators: the %s in "%s bits" will always be replaced by a number.
-#: glib/gutils.c:3168
+#: glib/gutils.c:3160
#, c-format
msgid "%s bit"
msgid_plural "%s bits"
msgstr[1] "%s бита"
msgstr[2] "%s бит"
-#: glib/gutils.c:3209
+#: glib/gutils.c:3201
#, c-format
msgid "%u byte"
msgid_plural "%u bytes"
#. * compatibility. Users will not see this string unless a program is using this deprecated function.
#. * Please translate as literally as possible.
#.
-#: glib/gutils.c:3222
+#: glib/gutils.c:3214
#, c-format
msgid "%.1f KB"
msgstr "%.1f КБ"
-#: glib/gutils.c:3227
+#: glib/gutils.c:3219
#, c-format
msgid "%.1f MB"
msgstr "%.1f МБ"
-#: glib/gutils.c:3232
+#: glib/gutils.c:3224
#, c-format
msgid "%.1f GB"
msgstr "%.1f ГБ"
-#: glib/gutils.c:3237
+#: glib/gutils.c:3229
#, c-format
msgid "%.1f TB"
msgstr "%.1f ТБ"
-#: glib/gutils.c:3242
+#: glib/gutils.c:3234
#, c-format
msgid "%.1f PB"
msgstr "%.1f ПБ"
-#: glib/gutils.c:3247
+#: glib/gutils.c:3239
#, c-format
msgid "%.1f EB"
msgstr "%.1f ЭБ"