summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--girepository/girparser.c8
-rw-r--r--giscanner/ast.py15
-rw-r--r--tests/scanner/Annotation-1.0-expected.gir6
-rw-r--r--tests/scanner/Regress-1.0-expected.gir8
-rw-r--r--tests/scanner/Utility-1.0-expected.gir2
5 files changed, 24 insertions, 15 deletions
diff --git a/girepository/girparser.c b/girepository/girparser.c
index 03ab6d2e..96761ace 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -366,8 +366,10 @@ static IntegerAliasInfo integer_aliases[] = {
{ "guint", SIZEOF_INT, 0 },
{ "glong", SIZEOF_LONG, 1 },
{ "gulong", SIZEOF_LONG, 0 },
- { "gsize", GLIB_SIZEOF_SIZE_T, 0 },
{ "gssize", GLIB_SIZEOF_SIZE_T, 1 },
+ { "gsize", GLIB_SIZEOF_SIZE_T, 0 },
+ { "gintptr", GLIB_SIZEOF_SIZE_T, 1 },
+ { "guintptr", GLIB_SIZEOF_SIZE_T, 0 },
};
typedef struct {
@@ -407,12 +409,12 @@ parse_basic (const char *str)
for (i = 0; i < n_basic; i++)
{
- if (g_str_has_prefix (str, basic_types[i].str))
+ if (strcmp (str, basic_types[i].str) == 0)
return &(basic_types[i]);
}
for (i = 0; i < G_N_ELEMENTS (integer_aliases); i++)
{
- if (g_str_has_prefix (str, integer_aliases[i].str))
+ if (strcmp (str, integer_aliases[i].str) == 0)
{
switch (integer_aliases[i].size)
{
diff --git a/giscanner/ast.py b/giscanner/ast.py
index f7906f2d..f5270fcf 100644
--- a/giscanner/ast.py
+++ b/giscanner/ast.py
@@ -180,6 +180,10 @@ TYPE_INT = Type(target_fundamental='gint', ctype='gint')
TYPE_UINT = Type(target_fundamental='guint', ctype='guint')
TYPE_LONG = Type(target_fundamental='glong', ctype='glong')
TYPE_ULONG = Type(target_fundamental='gulong', ctype='gulong')
+TYPE_SIZE = Type(target_fundamental='gsize', ctype='gsize')
+TYPE_SSIZE = Type(target_fundamental='gssize', ctype='gssize')
+TYPE_INTPTR = Type(target_fundamental='gintptr', ctype='gintptr')
+TYPE_UINTPTR = Type(target_fundamental='guintptr', ctype='guintptr')
# C99 types
TYPE_LONG_LONG = Type(target_fundamental='long long', ctype='long long')
TYPE_LONG_ULONG = Type(target_fundamental='unsigned long long',
@@ -201,8 +205,9 @@ TYPE_VALIST = Type(target_fundamental='va_list', ctype='va_list')
BASIC_GIR_TYPES = [TYPE_BOOLEAN, TYPE_INT8, TYPE_UINT8, TYPE_INT16,
TYPE_UINT16, TYPE_INT32, TYPE_UINT32, TYPE_INT64,
TYPE_UINT64, TYPE_CHAR, TYPE_SHORT, TYPE_USHORT, TYPE_INT,
- TYPE_UINT, TYPE_LONG, TYPE_ULONG, TYPE_LONG_LONG,
- TYPE_LONG_ULONG, TYPE_FLOAT, TYPE_DOUBLE,
+ TYPE_UINT, TYPE_LONG, TYPE_ULONG, TYPE_SIZE, TYPE_SSIZE,
+ TYPE_LONG_LONG, TYPE_LONG_ULONG, TYPE_INTPTR, TYPE_UINTPTR,
+ TYPE_FLOAT, TYPE_DOUBLE,
TYPE_LONG_DOUBLE, TYPE_UNICHAR, TYPE_GTYPE]
GIR_TYPES = [TYPE_NONE, TYPE_ANY]
GIR_TYPES.extend(BASIC_GIR_TYPES)
@@ -252,8 +257,10 @@ type_names['gchararray'] = TYPE_STRING
type_names['gchar*'] = TYPE_STRING
type_names['goffset'] = TYPE_INT64
type_names['gunichar2'] = TYPE_UINT16
-type_names['gsize'] = TYPE_ULONG
-type_names['gssize'] = TYPE_LONG
+type_names['gsize'] = TYPE_SIZE
+type_names['gssize'] = TYPE_SSIZE
+type_names['gintptr'] = TYPE_INTPTR
+type_names['guintptr'] = TYPE_UINTPTR
type_names['gconstpointer'] = TYPE_ANY
# We used to support these; continue to do so
diff --git a/tests/scanner/Annotation-1.0-expected.gir b/tests/scanner/Annotation-1.0-expected.gir
index 2194eee3..e47a4b9f 100644
--- a/tests/scanner/Annotation-1.0-expected.gir
+++ b/tests/scanner/Annotation-1.0-expected.gir
@@ -397,7 +397,7 @@ each string needs to be freed.</doc>
</parameter>
<parameter name="length" transfer-ownership="none">
<doc xml:whitespace="preserve">Length of the data</doc>
- <type name="gulong" c:type="gsize"/>
+ <type name="gsize" c:type="gsize"/>
</parameter>
</parameters>
</method>
@@ -415,7 +415,7 @@ each string needs to be freed.</doc>
</parameter>
<parameter name="length" transfer-ownership="none">
<doc xml:whitespace="preserve">Length of the data</doc>
- <type name="gulong" c:type="gsize"/>
+ <type name="gsize" c:type="gsize"/>
</parameter>
</parameters>
</method>
@@ -434,7 +434,7 @@ type.</doc>
</parameter>
<parameter name="length" transfer-ownership="none">
<doc xml:whitespace="preserve">Length of the data</doc>
- <type name="gulong" c:type="gsize"/>
+ <type name="gsize" c:type="gsize"/>
</parameter>
</parameters>
</method>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 758497e3..c7fb7835 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -2041,21 +2041,21 @@ call and can be released on return.</doc>
</function>
<function name="test_size" c:identifier="regress_test_size">
<return-value transfer-ownership="none">
- <type name="gulong" c:type="gsize"/>
+ <type name="gsize" c:type="gsize"/>
</return-value>
<parameters>
<parameter name="in" transfer-ownership="none">
- <type name="gulong" c:type="gsize"/>
+ <type name="gsize" c:type="gsize"/>
</parameter>
</parameters>
</function>
<function name="test_ssize" c:identifier="regress_test_ssize">
<return-value transfer-ownership="none">
- <type name="glong" c:type="gssize"/>
+ <type name="gssize" c:type="gssize"/>
</return-value>
<parameters>
<parameter name="in" transfer-ownership="none">
- <type name="glong" c:type="gssize"/>
+ <type name="gssize" c:type="gssize"/>
</parameter>
</parameters>
</function>
diff --git a/tests/scanner/Utility-1.0-expected.gir b/tests/scanner/Utility-1.0-expected.gir
index 112fa425..dec79840 100644
--- a/tests/scanner/Utility-1.0-expected.gir
+++ b/tests/scanner/Utility-1.0-expected.gir
@@ -23,7 +23,7 @@ and/or use gtk-doc annotations. -->
<type name="gpointer"/>
</field>
<field name="length" writable="1">
- <type name="gulong" c:type="gsize"/>
+ <type name="gsize" c:type="gsize"/>
</field>
</record>
<union name="Byte" c:type="UtilityByte">