mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 23:46:17 +01:00
girepository: Remove C99ism and other updates
-Make code using libgirepository_internals relocatable on Windows, like what is done in the GTK+ stack, and the girepository DLL. -Remove C99isms -"interface" is a reserved keyword on certain compilers, so change that to "giinterface" https://bugzilla.gnome.org/show_bug.cgi?id=681820
This commit is contained in:
parent
c449db7704
commit
08da5d65ee
@ -261,8 +261,9 @@ add_directory_index_section (guint8 *data, GIrModule *module, guint32 *offset2)
|
||||
|
||||
for (i = 0; i < n_interfaces; i++)
|
||||
{
|
||||
const char *str;
|
||||
entry = (DirEntry *)&data[header->directory + (i * header->entry_blob_size)];
|
||||
const char *str = (const char *) (&data[entry->name]);
|
||||
str = (const char *) (&data[entry->name]);
|
||||
_gi_typelib_hash_builder_add_string (dirindex_builder, str, i);
|
||||
}
|
||||
|
||||
|
15
girnode.c
15
girnode.c
@ -28,6 +28,11 @@
|
||||
#include "girnode.h"
|
||||
#include "gitypelib-internal.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define strtoll _strtoi64
|
||||
#define strtoull _strtoui64
|
||||
#endif
|
||||
|
||||
static gulong string_count = 0;
|
||||
static gulong unique_string_count = 0;
|
||||
static gulong string_size = 0;
|
||||
@ -228,7 +233,7 @@ _g_ir_node_free (GIrNode *node)
|
||||
_g_ir_node_free ((GIrNode *)type->parameter_type1);
|
||||
_g_ir_node_free ((GIrNode *)type->parameter_type2);
|
||||
|
||||
g_free (type->interface);
|
||||
g_free (type->giinterface);
|
||||
g_strfreev (type->errors);
|
||||
|
||||
}
|
||||
@ -1244,7 +1249,7 @@ serialize_type (GIrTypelibBuild *build,
|
||||
GIrNode *iface;
|
||||
gchar *name;
|
||||
|
||||
iface = find_entry_node (build, node->interface, NULL);
|
||||
iface = find_entry_node (build, node->giinterface, NULL);
|
||||
if (iface)
|
||||
{
|
||||
if (iface->type == G_IR_NODE_XREF)
|
||||
@ -1253,8 +1258,8 @@ serialize_type (GIrTypelibBuild *build,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Interface for type reference %s not found", node->interface);
|
||||
name = node->interface;
|
||||
g_warning ("Interface for type reference %s not found", node->giinterface);
|
||||
name = node->giinterface;
|
||||
}
|
||||
|
||||
g_string_append_printf (str, "%s%s", name,
|
||||
@ -1483,7 +1488,7 @@ _g_ir_node_build_typelib (GIrNode *node,
|
||||
iface->reserved = 0;
|
||||
iface->tag = type->tag;
|
||||
iface->reserved2 = 0;
|
||||
iface->interface = find_entry (build, type->interface);
|
||||
iface->interface = find_entry (build, type->giinterface);
|
||||
|
||||
}
|
||||
break;
|
||||
|
@ -133,7 +133,7 @@ struct _GIrNodeType
|
||||
GIrNodeType *parameter_type1;
|
||||
GIrNodeType *parameter_type2;
|
||||
|
||||
gchar *interface;
|
||||
gchar *giinterface;
|
||||
gchar **errors;
|
||||
};
|
||||
|
||||
|
@ -190,10 +190,10 @@ get_interface_size_alignment (GIrTypelibBuild *build,
|
||||
{
|
||||
GIrNode *iface;
|
||||
|
||||
iface = _g_ir_find_node (build, ((GIrNode*)type)->module, type->interface);
|
||||
iface = _g_ir_find_node (build, ((GIrNode*)type)->module, type->giinterface);
|
||||
if (!iface)
|
||||
{
|
||||
_g_ir_module_fatal (build, 0, "Can't resolve type '%s' for %s", type->interface, who);
|
||||
_g_ir_module_fatal (build, 0, "Can't resolve type '%s' for %s", type->giinterface, who);
|
||||
*size = -1;
|
||||
*alignment = -1;
|
||||
return FALSE;
|
||||
|
33
girparser.c
33
girparser.c
@ -36,6 +36,24 @@
|
||||
*/
|
||||
#define SUPPORTED_GIR_VERSION "1.2"
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef GIR_DIR
|
||||
#undef GIR_DIR
|
||||
#endif
|
||||
|
||||
/* GIR_DIR is used only in code called just once,
|
||||
* so no problem leaking this
|
||||
*/
|
||||
#define GIR_DIR \
|
||||
g_build_filename (g_win32_get_package_installation_directory_of_module(NULL), \
|
||||
"share", \
|
||||
GIR_SUFFIX, \
|
||||
NULL)
|
||||
#endif
|
||||
|
||||
struct _GIrParser
|
||||
{
|
||||
gchar **includes;
|
||||
@ -329,10 +347,12 @@ state_switch (ParseContext *ctx, ParseState newstate)
|
||||
static GIrNode *
|
||||
pop_node (ParseContext *ctx)
|
||||
{
|
||||
GSList *top;
|
||||
GIrNode *node;
|
||||
g_assert (ctx->node_stack != 0);
|
||||
|
||||
GSList *top = ctx->node_stack;
|
||||
GIrNode *node = top->data;
|
||||
top = ctx->node_stack;
|
||||
node = top->data;
|
||||
|
||||
g_debug ("popping node %d %s", node->type, node->name);
|
||||
ctx->node_stack = top->next;
|
||||
@ -552,8 +572,8 @@ parse_type_internal (GIrModule *module,
|
||||
|
||||
if (*str == '<')
|
||||
{
|
||||
(str)++;
|
||||
char *tmp, *end;
|
||||
(str)++;
|
||||
|
||||
end = strchr (str, '>');
|
||||
tmp = g_strndup (str, end - str);
|
||||
@ -565,9 +585,10 @@ parse_type_internal (GIrModule *module,
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *start;
|
||||
type->tag = GI_TYPE_TAG_INTERFACE;
|
||||
type->is_interface = TRUE;
|
||||
const char *start = str;
|
||||
start = str;
|
||||
|
||||
/* must be an interface type */
|
||||
while (g_ascii_isalnum (*str) ||
|
||||
@ -577,7 +598,7 @@ parse_type_internal (GIrModule *module,
|
||||
*str == ':')
|
||||
(str)++;
|
||||
|
||||
type->interface = g_strndup (start, str - start);
|
||||
type->giinterface = g_strndup (start, str - start);
|
||||
}
|
||||
|
||||
if (next)
|
||||
@ -1965,7 +1986,7 @@ start_type (GMarkupParseContext *context,
|
||||
* doesn't look like a pointer, but is internally.
|
||||
*/
|
||||
if (typenode->tag == GI_TYPE_TAG_INTERFACE &&
|
||||
is_disguised_structure (ctx, typenode->interface))
|
||||
is_disguised_structure (ctx, typenode->giinterface))
|
||||
pointer_depth++;
|
||||
|
||||
if (pointer_depth > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user