diff --git a/ginfo.c b/ginfo.c index 0e39bcd07..5df1e3f83 100644 --- a/ginfo.c +++ b/ginfo.c @@ -494,7 +494,7 @@ g_function_info_get_flags (GIFunctionInfo *info) flags = 0; /* Make sure we don't flag Constructors as methods */ - if (base->container != NULL && !blob->constructor) + if (!blob->constructor && !blob->is_static) flags = flags | GI_FUNCTION_IS_METHOD; if (blob->constructor) diff --git a/girmodule.c b/girmodule.c index 1b26f3de4..be41a1ed3 100644 --- a/girmodule.c +++ b/girmodule.c @@ -209,7 +209,7 @@ g_ir_module_build_typelib (GIrModule *module, : 0); header->directory = ALIGN_VALUE (header_size, 4); header->entry_blob_size = 12; - header->function_blob_size = 16; + header->function_blob_size = sizeof (FunctionBlob); header->callback_blob_size = 12; header->signal_blob_size = 12; header->vfunc_blob_size = 16; diff --git a/girnode.c b/girnode.c index 75dd265c8..61e4f0b6c 100644 --- a/girnode.c +++ b/girnode.c @@ -415,7 +415,7 @@ g_ir_node_get_size (GIrNode *node) break; case G_IR_NODE_FUNCTION: - size = 16; + size = sizeof (FunctionBlob); break; case G_IR_NODE_PARAM: @@ -1581,6 +1581,7 @@ g_ir_node_build_typelib (GIrNode *node, blob->blob_type = BLOB_TYPE_FUNCTION; blob->deprecated = function->deprecated; + blob->is_static = !function->is_method; blob->setter = function->is_setter; blob->getter = function->is_getter; blob->constructor = function->is_constructor; diff --git a/girparser.c b/girparser.c index 48e311923..e6d59b4c3 100644 --- a/girparser.c +++ b/girparser.c @@ -674,10 +674,12 @@ start_function (GMarkupParseContext *context, strcmp (element_name, "callback") == 0); break; case STATE_CLASS: + found = strcmp (element_name, "function") == 0; + /* fallthrough */ case STATE_BOXED: case STATE_STRUCT: case STATE_UNION: - found = strcmp (element_name, "constructor") == 0; + found = (found || strcmp (element_name, "constructor") == 0); /* fallthrough */ case STATE_INTERFACE: found = (found || diff --git a/gtypelib.c b/gtypelib.c index 5cda70579..51cbafcd2 100644 --- a/gtypelib.c +++ b/gtypelib.c @@ -167,7 +167,7 @@ g_typelib_check_sanity (void) CHECK_SIZE (ArgBlob, 12); CHECK_SIZE (SignatureBlob, 8); CHECK_SIZE (CommonBlob, 8); - CHECK_SIZE (FunctionBlob, 16); + CHECK_SIZE (FunctionBlob, 20); CHECK_SIZE (InterfaceTypeBlob, 4); CHECK_SIZE (ArrayTypeBlob, 8); CHECK_SIZE (ParamTypeBlob, 4); @@ -315,7 +315,7 @@ validate_header (ValidateContext *ctx, } if (header->entry_blob_size != 12 || - header->function_blob_size != 16 || + header->function_blob_size != 20 || header->callback_blob_size != 12 || header->signal_blob_size != 12 || header->vfunc_blob_size != 16 || @@ -731,7 +731,7 @@ validate_function_blob (ValidateContext *ctx, g_set_error (error, G_TYPELIB_ERROR, G_TYPELIB_ERROR_INVALID_BLOB, - "Wrong blob type"); + "Wrong blob type %d, expected function", blob->blob_type); return FALSE; } diff --git a/gtypelib.h b/gtypelib.h index 7db15db3a..343f9e1bb 100644 --- a/gtypelib.h +++ b/gtypelib.h @@ -172,10 +172,17 @@ typedef struct guint16 wraps_vfunc : 1; guint16 throws : 1; guint16 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; + + guint16 is_static : 1; + guint16 reserved : 15; + guint16 reserved2 : 16; } FunctionBlob; typedef struct