Commit Graph

103 Commits

Author SHA1 Message Date
Patrick Griffis
ac76bbb53b girepository: Don't skip g_irepository_get_option_group()
This function works fine via introspection

https://bugzilla.gnome.org/show_bug.cgi?id=786665
2017-10-22 07:16:05 -04:00
Carlos Garnacho
8a08674b33 girepository: Merge overrides with the regular search path
This reverts commit e81c4681cc88a00fcd841c5a68d860d3714b55d7

The GI_TYPELIB_PATH envvar will still allow overriding the default
typelib dir (based on gobject-introspection libdir), but applications
will have the last say about typelib lookup directories. The resulting
lookup order is now:

- Paths added through g_irepository_prepend_search_path()
- Paths in GI_TYPELIB_PATH
- The default gobject introspection lookup dir

This makes g_irespository_prepend_search_path() work as announced
despite environment variables. If any application was relying on
GI_TYPELIB_PATH overriding the paths of this function call (for e.g.
make check, or to be able to run code inside the project tree), it
is encouraged to set up a similar envvar for their application specific
lookup dir, or perform this override through other means.

https://bugzilla.gnome.org/show_bug.cgi?id=765735
2016-05-02 16:20:31 +02:00
Colin Walters
569b1dc9a8 Revert "libgirepository: Refuse to run in setuid applications"
This reverts commit 98bb6c91b710a95efe4cfeb303daeec3381b9c98.

It breaks programs simply executed *transitively* from a setuid
binary like the dbus daemon launch helper.

https://bugzilla.redhat.com/show_bug.cgi?id=1285991

Conflicts:
	girepository/girepository.c
2015-12-09 16:17:48 -05:00
Garrett Regier
6b55207f25 girepository: Fix memory leak in g_irepository_get_dependencies()
The transitive_dependencies GHashTable was being leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=758448
2015-11-20 23:02:10 -08:00
Colin Walters
5bda8cc0d3 girepository: Add missing include
For previous commit.
2015-09-26 11:51:33 -04:00
Colin Walters
02c64c25d2 libgirepository: Refuse to run in setuid applications
We know of at least one privilege escalation path via
`GI_TYPELIB_PATH`.  I don't want to audit for others.  If someone
shows up with a use case we can talk.

https://bugzilla.gnome.org/show_bug.cgi?id=755472
2015-09-24 11:10:36 -04:00
Jasper St. Pierre
3fa183524e girepository: Remove "optimization" for found prefixes
This optimization is bugged and broken in the case of certain
libraries. GNOME uses a lot of prefixes with "G", so we'll almost always
have found the prefix.

This is specifically a problem for something like GXml.xDocument, which
uses a type name starting with a lower-case letter, which fools the
prefix logic, but we're also fooled by the "G" appearing in GLib and
Gio.

A more sophisticated version of this check would have three passes:
check prefix with type-case, check prefix without type-case, global
search, but this is an edge case and it doesn't feel worth it to write.
2015-07-27 17:21:05 -07:00
Lionel Landwerlin
355fcd387d scanner/girepository: remove GdkRectangle->CairoRectangleInt automatic conversion
https://bugzilla.gnome.org/show_bug.cgi?id=748832
2015-05-11 16:05:02 +01:00
Garrett Regier
1627d65d0f Fix docs for g_irepository_get_shared_library()
https://bugzilla.gnome.org/show_bug.cgi?id=744536
Signed-off-by: Garrett Regier <garrett.regier@riftio.com>
2015-03-10 20:47:59 +01:00
Philip Withnall
e222ca2ef2 girepository: Add g_irepository_get_immediate_dependencies()
g_irepository_get_dependencies() is supposed to return the transitive
closure of all dependencies of the given namespace. However, it just
loads the dependencies field from the typelib, which is supposed to only
list immediate dependencies.

Introduce a new g_irepository_get_immediate_dependencies() which does
this, and rewrite g_irepository_get_dependencies() to build the
transitive closure of all its namespace dependencies. This does not
require loading any new typelibs, as the transitive closure of
dependencies should already have been loaded by g_irepository_require()
or g_irepository_load_typelib().

https://bugzilla.gnome.org/show_bug.cgi?id=743782
2015-02-16 08:49:28 +00:00
Philip Withnall
3128c1e9a5 girepository: Fix NULL return from g_irepository_get_dependencies()
If a typelib had no dependencies, g_irepository_get_dependencies() would
return NULL, rather than an empty NULL-terminated vector.

https://bugzilla.gnome.org/show_bug.cgi?id=743782
2015-02-16 08:48:49 +00:00
Chun-wei Fan
adc6f08ff7 girepository: Include config.h First in All Sources
This includes config.h in all the C-sources of girepository so that we can
get the correct export directive from config.h during compile time and
therefore export the symbols as necessary, like what GLib and GTK+ is
currently doing.

https://bugzilla.gnome.org/show_bug.cgi?id=732669
2014-07-07 09:24:12 +08:00
Dieter Verfaillie
bb7f8d57c2 docs: fix up reference docs a bit
- require GTK-Doc 1.19
      - remove sgml mode
      - automatically generate gi.types (needs GTK-Doc 1.19)
      - fix https://bugzilla.gnome.org/show_bug.cgi?id=700025
[WIP] - rearange sections a bit
[WIP] - add gi-building, gi-programming sections
[WIP] - mark missing docs with TODO, which is only marginaly
        better than nothing but at least can be grepped :)

https://bugzilla.gnome.org/show_bug.cgi?id=571648
2013-10-10 16:48:51 -04:00
Dieter Verfaillie
a50bfe5ec3 girepository: remove glib-compat
We depend on glib-2.0 >= 2.36.0, so no need to keep a 2.22.X
compatibility symbol around...
2013-10-09 12:48:46 -04:00
Daniel Drake
33afebb2d7 Optimize g_irepository_find_by_gtype
When g_irepository_find_by_gtype() doesn't succeed on a simple prefix
match (the current 'fastpass' mechanism), it ends up taking a
considerable amount of CPU time, traversing the contents of all typelibs.

I imagine that the reasons to have the exhaustive search fallback are
not as strong as they used to be. For example, the case mentioned
(Clutter including Cogl) no longer seems to be true.

Also, typelibs (as generated by g-ir-scanner) now provide
comma-separated C prefix info for cases when the typelib includes
introspection info for multiple prefixes. For example, the Sugar typelib
has a c_prefix string of Sugar,EggSM,Gsm,Acme. So I imagine there are
not many remaining justified cases where the exhaustive search is needed.

With that in mind, I found two ways to optimize this function:

1. Support comma-separated C prefixes

2. Don't bother with an exhaustive search if we did find a typelib
   claiming support for the prefix. For example, if we're looking for
   GdkDeviceManagerXI2 (currently non-introspectable) and we already found
   typelib files providing the 'Gdk' prefix that didn't offer this, lets
   not bother with the exhaustive search, we aren't going to find anything.
2013-04-08 11:22:39 -04:00
Colin Walters
35091ec7df repo: Drop deprecated GStaticMutex usage
In favor of GOnce, since we just want initialize-once semantics.
2012-12-17 09:57:24 -05:00
Johan Dahlin
0a96da9284 Make introspection compile with -Wall -Werror
Address all gcc warnings, -Werror is not enabled yet but at least
-Wall -Werror passes on my machine.
2012-04-09 14:19:23 -03:00
Dieter Verfaillie
5374f24d38 Fix malformed GTK-Doc comment blocks:
- add missing colons
- invalid annotations
- invalid parameters and tags
- correct parameter name
- preserve description indentation
- no description parts
- comment end marker
- invalid empty lines
- line numbers

AnnotationParser now emits warnings which are considered as
errors by "make check" so fix those warnings...

https://bugzilla.gnome.org/show_bug.cgi?id=672254
2012-04-05 10:23:03 -03:00
Jesse van den Kieboom
c2d79efd53 Plug memory leak in lazy typelibs hash table
https://bugzilla.gnome.org/show_bug.cgi?id=669317
2012-02-05 15:45:09 +01:00
Colin Walters
e865dcb7b4 Add Emacs mode lines to C sources 2012-02-03 13:42:56 -05:00
Colin Walters
11cf4c56f3 repository: Fix g_irepository_get_c_prefix()
It was returning the wrong data.

https://bugzilla.gnome.org/show_bug.cgi?id=659749
2011-09-21 14:05:52 -04:00
Dieter Verfaillie
8461962337 Windows port: compute GOBJECT_INTROSPECTION_LIBDIR at runtime.
Otherwise, we fail to properly locate the typelibs, because on Windows
the value of GOBJECT_INTROSPECTION_LIBDIR depends on where Glib has been
installed. Due to the nature of how we handle software that depends on
Glib on Windows (it is recommended that each program bundles it's private
copy), we're working in a "multi-prefixed" environment. Hence the value
computed at build time will most likely not even exist at runtime.

https://bugzilla.gnome.org/show_bug.cgi?id=620566
2011-09-07 22:00:09 +02:00
Dan Winship
bf9c31f49c Add g_irepository_find_by_error_domain()
Add a method to look up a GIEnumInfo given its associated error quark.

Based on a patch from Colin Walters.

https://bugzilla.gnome.org/show_bug.cgi?id=602516
2011-08-12 11:11:45 -04:00
Dan Winship
f9ebb4e99d Deprecate ErrorDomain
The previous ErrorDomain blob was never actually scanned or used, and
it was kind of a lame API conceptually.

To keep some compatibility, rather than removing the enumeration
values, rename them to _INVALID, and don't bump the typelib version.
This should in theory allow a new libgirepository to read an old
typelib.

Based on a patch from Colin Walters

https://bugzilla.gnome.org/show_bug.cgi?id=602516
2011-08-12 11:10:43 -04:00
Dan Winship
2c0d884330 girepository: fix some doc comment syntax 2011-08-12 11:10:43 -04:00
Colin Walters
f9a3bb7300 Add support for gunichar in typelib
Some API such as gtk_text_iter_get_char returns an individual
"gunichar"; we should support this.

https://bugzilla.gnome.org/show_bug.cgi?id=633197
2010-11-12 16:00:10 -05:00
Colin Walters
3d7bb7feaf Fix regression in g_irepository_get_info
Commit f97cc8687469f25752f79275 broke the lookup in
g_irepository_get_info; the passed offset is 0-based, then
we convert it to 1-based (and then back to 0 later...which needs
to be fixed).
2010-10-21 15:01:07 -04:00
Colin Walters
54a1a7be49 girepository: Refactor lookup code
This is a cleanup patch in preparation for future indexing
patches.

The lookup code was a mess trying to mash in the 3 different
cases of name, GType, and index into one mega-function.

Split it up properly, and move the core typelib internal-scanning
bits into gitypelib.c where it belongs.
2010-10-18 12:04:08 -04:00
Pavel Holejsovsky
508edb91ad Fix memory leak. 2010-09-25 11:32:28 -03:00
Pavel Holejsovsky
916798b704 Update annotations for GIRepository.Repository.
https://bugzilla.gnome.org/show_bug.cgi?id=628753
2010-09-15 09:48:46 -03:00
Pavel Holejsovsky
bc6a8d2f23 [girepository] Document GIStructInfo & GIUnionInfo
https://bugzilla.gnome.org/show_bug.cgi?id=628753
2010-09-05 11:04:27 -03:00
Colin Walters
b18a6580d2 girepository: Call init_globals()
This fixes the search path initialization if g_irepository_require
is called first thing.
2010-09-02 17:43:23 -04:00
Johan Dahlin
14edb06326 [GIRepository] Rename GTypelib to GITypelib
Keep a typedef for backwards compatibility, until
the major bindings has moved over.
2010-08-31 17:37:10 -03:00
Johan Dahlin
180e1b61eb [girepository] Add a couple of missing transfer 2010-08-31 17:29:13 -03:00
Colin Walters
f5ec6f6698 Use GLib types consistently
Rather than have the scanner/parser handle both e.g. "glong" and
"long", simply use the GLib types everywhere.

This commit adds TYPE_LONG_LONG and TYPE_LONG_DOUBLE to the
scanner types; however, rather than add them to the typelib,
they're just marked as not-introspectable.
2010-08-31 16:05:56 -04:00
Steve Frécinaux
318843cead Fix warning when using g_irepository_enumerate_version()
The reason for the warning was that g_irepository_get_version() expects
the typelib to be already loaded, but enumerate_version() can be called
on typelibs that are not.
2010-08-18 22:45:19 +02:00
Steve Frécinaux
2b07f1ed31 Include the loaded version in g_irepository_enumerate_versions()
Logically speaking, the already loaded version of a namespace is part of
the currently available versions, and can be forgotten if we only
consider the versions available in GI_TYPELIB_PATH, as it could have
been loaded using g_irepository_require_private().

As a side effect, it meant that bindings relying on enumerate_version()
(like pygobject) were not able to require private versions through their
classical requirement scheme.

This patch fixes it by adding the loaded version to the unsorted list of
available versions returned by g_irepository_enumerate_versions()

This patch also uses g_list_prepend() instead of g_list_append() in that
function.

https://bugzilla.gnome.org/show_bug.cgi?id=625983
2010-08-18 20:07:18 +02:00
Colin Walters
9b1bb64e83 [girepository] Fix up error printing
We didn't show the right error message if we failed to find
the symbol; fix this by removing error printing from the
middle of the dumper, and add it correctly to the toplevel
dump entry point.
2010-08-17 13:12:52 -04:00
Steve Frécinaux
439753a5b3 Do not leak typelibs with wrong header info.
Previously the typelibs that were loaded but whose header information
weren't right were just leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=625672
2010-08-03 23:42:08 +02:00
Steve Frécinaux
e3b7e76b86 Add new API g_typelib_require_private()
This is equivalent to g_typelib_require() but intended for use with
private typelibs, which get loaded from the provided directory.

https://bugzilla.gnome.org/show_bug.cgi?id=625672
2010-08-03 23:36:54 +02:00
Johan Dahlin
c93fbff870 [girepository] Update documentation 2010-07-28 08:52:45 -03:00
Johan Dahlin
ab9085eda3 [GIRepository] Rename g_irepository_enumerate
Rename it to g_irepository_enumerate_versions
2010-07-28 08:52:05 -03:00
Tomeu Vizoso
da698167a0 Add g_info_type_to_string (GIInfoType type) 2010-07-28 12:24:10 +02:00
Colin Walters
958b70d8b0 Add g_irepository_enumerate
This will be used for pygobject to enumerate namespaces.
2010-07-27 17:56:36 +02:00
Colin Walters
c0b26bf0a0 [girepository] Include path to file in typelib load failure error
This makes version conflicts more obvious.
2010-07-22 13:48:32 -04:00
Florian Müllner
5b5ab282a6 [girepository] Fix ordering in override_search_path
Entries in the GI_TYPELIB_PATH environment variable are added to the
global search path in reverse order - instead, add entries in the
same order in which they are specified.
2010-07-15 23:40:28 +02:00
Colin Walters
1b8bf7a4dc [girepository] Actually verify header of loaded typelibs in g_irepository_require
Take a GError * for typelib loading code, validate the header.  This
fixes bizarre errors from gjs where g_irepository_require would happily
load old typelibs.
2010-07-14 11:59:11 -04:00
Colin Walters
3a310fd242 Don't include machine-dependent integral types in the typelib
Previously we had both e.g. GI_TYPE_TAG_LONG and GI_TYPE_TAG_INT64,
but in fact the typelib is already machine-specific, so it makes sense
to just encode this as a fixed type.  The .gir remains abstract.

We also remove size_t from the typelib; one would never want to treat
it differently than an integer.

time_t is removed as well; while bindings like gjs had special handling
to turn it into e.g. a JS Date object, I don't think we should encourage
people to use these POSIX types in their API.  Use GTimeVal or the like
instead.

Because the typelib is now really machine-specific, we need to remove
the -expected.tgirs from git.  (We could potentially add a check
which wasn't just a literal diff later)

https://bugzilla.gnome.org/show_bug.cgi?id=623774
2010-07-09 14:15:52 -04:00
Johan Dahlin
292033c7dc [girepository] Move GICallableInfo out of ginfo.ch 2010-06-05 12:40:28 -03:00
Johan Dahlin
64ee6cb5b0 [gtypelib.ch] Rename to gitypelib.ch
Rename gtypelib.h -> gitypelib-internal.h and rename
gtypelib.c to gitypelib.c
2010-05-31 17:47:50 -03:00