[glib/mjog/2104-short-gtypes: 4/7] gobject: Add support for marshalling G_TYPE_(U)SHORT values



commit 7169c2a8665f2225876a606be73e1659e7f7e5c4
Author: Michael Gratton <mike vee net>
Date:   Mon May 11 21:24:17 2020 +1000

    gobject: Add support for marshalling G_TYPE_(U)SHORT values
    
    Update both marshalling code and glib-genmarhsal to handle shorts.

 gobject/glib-genmarshal.in    |  28 ++++++
 gobject/gmarshal.c            | 220 ++++++++++++++++++++++++++++++++++++++++++
 gobject/gmarshal.h            |  34 +++++++
 gobject/gsignal.c             |   2 +
 gobject/tests/genmarshal.py   |   4 +
 gobject/tests/marshalers.list |   2 +-
 gobject/tests/reference.c     |   2 +
 gobject/tests/signals.c       |  68 +++++++------
 8 files changed, 332 insertions(+), 28 deletions(-)
---
diff --git a/gobject/glib-genmarshal.in b/gobject/glib-genmarshal.in
index 7380f24a8..07c80f9ec 100755
--- a/gobject/glib-genmarshal.in
+++ b/gobject/glib-genmarshal.in
@@ -49,6 +49,8 @@ GETTERS_STR = '''#ifdef G_ENABLE_DEBUG
 #define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
 #define g_marshal_value_peek_object(v)   g_value_get_object (v)
 #define g_marshal_value_peek_variant(v)  g_value_get_variant (v)
+#define g_marshal_value_peek_short(v)    g_value_get_short (v)
+#define g_marshal_value_peek_ushort(v)   g_value_get_ushort (v)
 #else /* !G_ENABLE_DEBUG */
 /* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
  *          Do not access GValues directly in your code. Instead, use the
@@ -73,6 +75,8 @@ GETTERS_STR = '''#ifdef G_ENABLE_DEBUG
 #define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
 #define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
 #define g_marshal_value_peek_variant(v)  (v)->data[0].v_pointer
+#define g_marshal_value_peek_short(v)    (v)->data[0].v_int
+#define g_marshal_value_peek_ushort(v)   (v)->data[0].v_uint
 #endif /* !G_ENABLE_DEBUG */'''
 
 DEPRECATED_MSG_STR = 'The token "{}" is deprecated; use "{}" instead'
@@ -98,6 +102,8 @@ GOBJECT_MARSHALLERS = {
     'g_cclosure_marshal_VOID__BOOLEAN',
     'g_cclosure_marshal_VOID__CHAR',
     'g_cclosure_marshal_VOID__UCHAR',
+    'g_cclosure_marshal_VOID__SHORT',
+    'g_cclosure_marshal_VOID__USHORT',
     'g_cclosure_marshal_VOID__INT',
     'g_cclosure_marshal_VOID__UINT',
     'g_cclosure_marshal_VOID__LONG',
@@ -274,6 +280,18 @@ IN_ARGS = {
         'promoted': 'guint',
         'getter': 'g_marshal_value_peek_uchar',
     },
+    'SHORT': {
+        'signal': 'SHORT',
+        'ctype': 'gshort',
+        'promoted': 'gint',
+        'getter': 'g_marshal_value_peek_short',
+    },
+    'USHORT': {
+        'signal': 'USHORT',
+        'ctype': 'gushort',
+        'promoted': 'guint',
+        'getter': 'g_marshal_value_peek_ushort',
+    },
     'INT': {
         'signal': 'INT',
         'ctype': 'gint',
@@ -415,6 +433,16 @@ OUT_ARGS = {
         'ctype': 'guchar',
         'setter': 'g_value_set_uchar',
     },
+    'SHORT': {
+        'signal': 'SHORT',
+        'ctype': 'gshort',
+        'setter': 'g_value_set_short',
+    },
+    'USHORT': {
+        'signal': 'USHORT',
+        'ctype': 'gushort',
+        'setter': 'g_value_set_ushort',
+    },
     'INT': {
         'signal': 'INT',
         'ctype': 'gint',
diff --git a/gobject/gmarshal.c b/gobject/gmarshal.c
index 0c729b4b9..75b23a113 100644
--- a/gobject/gmarshal.c
+++ b/gobject/gmarshal.c
@@ -42,6 +42,8 @@
 #define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
 #define g_marshal_value_peek_object(v)   g_value_get_object (v)
 #define g_marshal_value_peek_variant(v)  g_value_get_variant (v)
+#define g_marshal_value_peek_short(v)    g_value_get_short (v)
+#define g_marshal_value_peek_ushort(v)   g_value_get_ushort (v)
 #else /* !G_ENABLE_DEBUG */
 /* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
  *          Do not access GValues directly in your code. Instead, use the
@@ -66,6 +68,8 @@
 #define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
 #define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
 #define g_marshal_value_peek_variant(v)  (v)->data[0].v_pointer
+#define g_marshal_value_peek_short(v)    (v)->data[0].v_int
+#define g_marshal_value_peek_ushort(v)   (v)->data[0].v_uint
 #endif /* !G_ENABLE_DEBUG */
 
 
@@ -490,6 +494,222 @@ g_cclosure_marshal_VOID__UCHARv (GClosure     *closure,
             data2);
 }
 
+/**
+ * g_cclosure_marshal_VOID__SHORT:
+ * @closure: A #GClosure.
+ * @return_value: A #GValue to store the return value. May be %NULL
+ *   if the callback of closure doesn't return a value.
+ * @n_param_values: The length of the @param_values array.
+ * @param_values: An array of #GValues holding the arguments
+ *   on which to invoke the callback of closure.
+ * @invocation_hint: The invocation hint given as the last argument to
+ *   g_closure_invoke().
+ * @marshal_data: Additional data specified when registering the
+ *   marshaller, see g_closure_set_marshal() and
+ *   g_closure_set_meta_marshal()
+ *
+ * A #GClosureMarshal function for use with signals with a single
+ * short argument.
+ */
+/* VOID:SHORT */
+void
+g_cclosure_marshal_VOID__SHORT (GClosure     *closure,
+                                GValue       *return_value G_GNUC_UNUSED,
+                                guint         n_param_values,
+                                const GValue *param_values,
+                                gpointer      invocation_hint G_GNUC_UNUSED,
+                                gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__SHORT) (gpointer     data1,
+                                            gshort       arg_1,
+                                            gpointer     data2);
+  GMarshalFunc_VOID__SHORT callback;
+  GCClosure *cc = (GCClosure*) closure;
+  gpointer data1, data2;
+
+  g_return_if_fail (n_param_values == 2);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__SHORT) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_short (param_values + 1),
+            data2);
+}
+
+/**
+ * g_cclosure_marshal_VOID__SHORTv:
+ * @closure: the #GClosure to which the marshaller belongs
+ * @return_value: (nullable): a #GValue to store the return
+ *  value. May be %NULL if the callback of @closure doesn't return a
+ *  value.
+ * @instance: (type GObject.TypeInstance): the instance on which the closure is invoked.
+ * @args: va_list of arguments to be passed to the closure.
+ * @marshal_data: (nullable): additional data specified when
+ *  registering the marshaller, see g_closure_set_marshal() and
+ *  g_closure_set_meta_marshal()
+ * @n_params: the length of the @param_types array
+ * @param_types: (array length=n_params): the #GType of each argument from
+ *  @args.
+ *
+ * The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__SHORT().
+ */
+void
+g_cclosure_marshal_VOID__SHORTv (GClosure     *closure,
+                                 GValue       *return_value,
+                                 gpointer      instance,
+                                 va_list       args,
+                                 gpointer      marshal_data,
+                                 int           n_params,
+                                 GType        *param_types)
+{
+  typedef void (*GMarshalFunc_VOID__SHORT) (gpointer     instance,
+                                            gshort        arg_0,
+                                            gpointer     data);
+  GCClosure *cc = (GCClosure*) closure;
+  gpointer data1, data2;
+  GMarshalFunc_VOID__SHORT callback;
+  gshort arg0;
+  va_list args_copy;
+
+  G_VA_COPY (args_copy, args);
+  arg0 = (gshort) va_arg (args_copy, gint);
+  va_end (args_copy);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = instance;
+    }
+  else
+    {
+      data1 = instance;
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__SHORT) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            arg0,
+            data2);
+}
+
+/**
+ * g_cclosure_marshal_VOID__USHORT:
+ * @closure: A #GClosure.
+ * @return_value: A #GValue to store the return value. May be %NULL
+ *   if the callback of closure doesn't return a value.
+ * @n_param_values: The length of the @param_values array.
+ * @param_values: An array of #GValues holding the arguments
+ *   on which to invoke the callback of closure.
+ * @invocation_hint: The invocation hint given as the last argument to
+ *   g_closure_invoke().
+ * @marshal_data: Additional data specified when registering the
+ *   marshaller, see g_closure_set_marshal() and
+ *   g_closure_set_meta_marshal()
+ *
+ * A #GClosureMarshal function for use with signals with a single
+ * unsigned short argument.
+ */
+/* VOID:USHORT */
+void
+g_cclosure_marshal_VOID__USHORT (GClosure     *closure,
+                                 GValue       *return_value G_GNUC_UNUSED,
+                                 guint         n_param_values,
+                                 const GValue *param_values,
+                                 gpointer      invocation_hint G_GNUC_UNUSED,
+                                 gpointer      marshal_data)
+{
+  typedef void (*GMarshalFunc_VOID__USHORT) (gpointer     data1,
+                                             gushort       arg_1,
+                                             gpointer     data2);
+  GMarshalFunc_VOID__USHORT callback;
+  GCClosure *cc = (GCClosure*) closure;
+  gpointer data1, data2;
+
+  g_return_if_fail (n_param_values == 2);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__USHORT) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            g_marshal_value_peek_ushort (param_values + 1),
+            data2);
+}
+
+/**
+ * g_cclosure_marshal_VOID__USHORTv:
+ * @closure: the #GClosure to which the marshaller belongs
+ * @return_value: (nullable): a #GValue to store the return
+ *  value. May be %NULL if the callback of @closure doesn't return a
+ *  value.
+ * @instance: (type GObject.TypeInstance): the instance on which the closure is invoked.
+ * @args: va_list of arguments to be passed to the closure.
+ * @marshal_data: (nullable): additional data specified when
+ *  registering the marshaller, see g_closure_set_marshal() and
+ *  g_closure_set_meta_marshal()
+ * @n_params: the length of the @param_types array
+ * @param_types: (array length=n_params): the #GType of each argument from
+ *  @args.
+ *
+ * The #GVaClosureMarshal equivalent to g_cclosure_marshal_VOID__USHORT().
+ */
+void
+g_cclosure_marshal_VOID__USHORTv (GClosure     *closure,
+                                  GValue       *return_value,
+                                  gpointer      instance,
+                                  va_list       args,
+                                  gpointer      marshal_data,
+                                  int           n_params,
+                                  GType        *param_types)
+{
+  typedef void (*GMarshalFunc_VOID__USHORT) (gpointer     instance,
+                                             gushort       arg_0,
+                                             gpointer     data);
+  GCClosure *cc = (GCClosure*) closure;
+  gpointer data1, data2;
+  GMarshalFunc_VOID__USHORT callback;
+  gushort arg0;
+  va_list args_copy;
+
+  G_VA_COPY (args_copy, args);
+  arg0 = (gushort) va_arg (args_copy, guint);
+  va_end (args_copy);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = instance;
+    }
+  else
+    {
+      data1 = instance;
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_VOID__USHORT) (marshal_data ? marshal_data : cc->callback);
+
+  callback (data1,
+            arg0,
+            data2);
+}
+
 /**
  * g_cclosure_marshal_VOID__INT:
  * @closure: A #GClosure.
diff --git a/gobject/gmarshal.h b/gobject/gmarshal.h
index fdd6c042e..5107e00b4 100644
--- a/gobject/gmarshal.h
+++ b/gobject/gmarshal.h
@@ -87,6 +87,40 @@ void g_cclosure_marshal_VOID__UCHARv (GClosure *closure,
                                       int       n_params,
                                       GType    *param_types);
 
+/* VOID:SHORT */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__SHORT (GClosure     *closure,
+                                     GValue       *return_value,
+                                     guint         n_param_values,
+                                     const GValue *param_values,
+                                     gpointer      invocation_hint,
+                                     gpointer      marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__SHORTv (GClosure *closure,
+                                      GValue   *return_value,
+                                      gpointer  instance,
+                                      va_list   args,
+                                      gpointer  marshal_data,
+                                      int       n_params,
+                                      GType    *param_types);
+
+/* VOID:USHORT */
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__USHORT (GClosure     *closure,
+                                      GValue       *return_value,
+                                      guint         n_param_values,
+                                      const GValue *param_values,
+                                      gpointer      invocation_hint,
+                                      gpointer      marshal_data);
+GLIB_AVAILABLE_IN_ALL
+void g_cclosure_marshal_VOID__USHORTv (GClosure *closure,
+                                       GValue   *return_value,
+                                       gpointer  instance,
+                                       va_list   args,
+                                       gpointer  marshal_data,
+                                       int       n_params,
+                                       GType    *param_types);
+
 /* VOID:INT */
 GLIB_AVAILABLE_IN_ALL
 void g_cclosure_marshal_VOID__INT (GClosure     *closure,
diff --git a/gobject/gsignal.c b/gobject/gsignal.c
index 64603c291..624c199b8 100644
--- a/gobject/gsignal.c
+++ b/gobject/gsignal.c
@@ -1854,6 +1854,8 @@ g_signal_newv (const gchar       *signal_name,
       ADD_CHECK (POINTER)
       ADD_CHECK (OBJECT)
       ADD_CHECK (VARIANT)
+      ADD_CHECK (SHORT)
+      ADD_CHECK (USHORT)
     }
 
   if (c_marshaller == NULL)
diff --git a/gobject/tests/genmarshal.py b/gobject/tests/genmarshal.py
index 46d9063e3..ff11ef0c2 100644
--- a/gobject/tests/genmarshal.py
+++ b/gobject/tests/genmarshal.py
@@ -135,6 +135,8 @@ class TestGenmarshal(unittest.TestCase):
                 #define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
                 #define g_marshal_value_peek_object(v)   g_value_get_object (v)
                 #define g_marshal_value_peek_variant(v)  g_value_get_variant (v)
+                #define g_marshal_value_peek_short(v)    g_value_get_short (v)
+                #define g_marshal_value_peek_ushort(v)   g_value_get_ushort (v)
                 #else /* !G_ENABLE_DEBUG */
                 /* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
                  *          Do not access GValues directly in your code. Instead, use the
@@ -159,6 +161,8 @@ class TestGenmarshal(unittest.TestCase):
                 #define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
                 #define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
                 #define g_marshal_value_peek_variant(v)  (v)->data[0].v_pointer
+                #define g_marshal_value_peek_short(v)    (v)->data[0].v_int
+                #define g_marshal_value_peek_ushort(v)   (v)->data[0].v_uint
                 #endif /* !G_ENABLE_DEBUG */
                 ''').strip(),
         }
diff --git a/gobject/tests/marshalers.list b/gobject/tests/marshalers.list
index 19167ead5..d60956e6e 100644
--- a/gobject/tests/marshalers.list
+++ b/gobject/tests/marshalers.list
@@ -1,3 +1,3 @@
-VOID:INT,BOOLEAN,CHAR,UCHAR,UINT,LONG,ULONG,ENUM,FLAGS,FLOAT,DOUBLE,STRING,PARAM,BOXED,POINTER,OBJECT,VARIANT,INT64,UINT64
+VOID:INT,BOOLEAN,CHAR,UCHAR,SHORT,USHORT,UINT,LONG,ULONG,ENUM,FLAGS,FLOAT,DOUBLE,STRING,PARAM,BOXED,POINTER,OBJECT,VARIANT,INT64,UINT64
 INT:VOID
 UINT:VOID
diff --git a/gobject/tests/reference.c b/gobject/tests/reference.c
index c6f4d5127..23ae608fc 100644
--- a/gobject/tests/reference.c
+++ b/gobject/tests/reference.c
@@ -8,6 +8,8 @@ test_fundamentals (void)
   g_assert (G_TYPE_IS_FUNDAMENTAL (G_TYPE_CHAR));
   g_assert (G_TYPE_IS_FUNDAMENTAL (G_TYPE_UCHAR));
   g_assert (G_TYPE_IS_FUNDAMENTAL (G_TYPE_BOOLEAN));
+  g_assert (G_TYPE_IS_FUNDAMENTAL (G_TYPE_SHORT));
+  g_assert (G_TYPE_IS_FUNDAMENTAL (G_TYPE_USHORT));
   g_assert (G_TYPE_IS_FUNDAMENTAL (G_TYPE_INT));
   g_assert (G_TYPE_IS_FUNDAMENTAL (G_TYPE_UINT));
   g_assert (G_TYPE_IS_FUNDAMENTAL (G_TYPE_LONG));
diff --git a/gobject/tests/signals.c b/gobject/tests/signals.c
index 08b54d0fa..53e04ca12 100644
--- a/gobject/tests/signals.c
+++ b/gobject/tests/signals.c
@@ -143,15 +143,15 @@ struct _Test
   GObject parent_instance;
 };
 
-static void all_types_handler (Test *test, int i, gboolean b, char c, guchar uc, guint ui, glong l, gulong 
ul, MyEnum e, MyFlags f, float fl, double db, char *str, GParamSpec *param, GBytes *bytes, gpointer ptr, Test 
*obj, GVariant *var, gint64 i64, guint64 ui64);
+static void all_types_handler (Test *test, int i, gboolean b, char c, guchar uc, gshort s, gushort us, guint 
ui, glong l, gulong ul, MyEnum e, MyFlags f, float fl, double db, char *str, GParamSpec *param, GBytes 
*bytes, gpointer ptr, Test *obj, GVariant *var, gint64 i64, guint64 ui64);
 
 struct _TestClass
 {
   GObjectClass parent_class;
 
   void (* variant_changed) (Test *, GVariant *);
-  void (* all_types) (Test *test, int i, gboolean b, char c, guchar uc, guint ui, glong l, gulong ul, MyEnum 
e, MyFlags f, float fl, double db, char *str, GParamSpec *param, GBytes *bytes, gpointer ptr, Test *obj, 
GVariant *var, gint64 i64, guint64 ui64);
-  void (* all_types_null) (Test *test, int i, gboolean b, char c, guchar uc, guint ui, glong l, gulong ul, 
MyEnum e, MyFlags f, float fl, double db, char *str, GParamSpec *param, GBytes *bytes, gpointer ptr, Test 
*obj, GVariant *var, gint64 i64, guint64 ui64);
+  void (* all_types) (Test *test, int i, gboolean b, char c, guchar uc, gshort s, gushort us, guint ui, 
glong l, gulong ul, MyEnum e, MyFlags f, float fl, double db, char *str, GParamSpec *param, GBytes *bytes, 
gpointer ptr, Test *obj, GVariant *var, gint64 i64, guint64 ui64);
+  void (* all_types_null) (Test *test, int i, gboolean b, char c, guchar uc, gshort s, gushort us, guint ui, 
glong l, gulong ul, MyEnum e, MyFlags f, float fl, double db, char *str, GParamSpec *param, GBytes *bytes, 
gpointer ptr, Test *obj, GVariant *var, gint64 i64, guint64 ui64);
 };
 
 static GType test_get_type (void);
@@ -299,13 +299,15 @@ test_class_init (TestClass *klass)
                 G_SIGNAL_RUN_LAST,
                 G_STRUCT_OFFSET (TestClass, all_types),
                 NULL, NULL,
-                
test_VOID__INT_BOOLEAN_CHAR_UCHAR_UINT_LONG_ULONG_ENUM_FLAGS_FLOAT_DOUBLE_STRING_PARAM_BOXED_POINTER_OBJECT_VARIANT_INT64_UINT64,
+                
test_VOID__INT_BOOLEAN_CHAR_UCHAR_SHORT_USHORT_UINT_LONG_ULONG_ENUM_FLAGS_FLOAT_DOUBLE_STRING_PARAM_BOXED_POINTER_OBJECT_VARIANT_INT64_UINT64,
                 G_TYPE_NONE,
-                19,
+                21,
                G_TYPE_INT,
                G_TYPE_BOOLEAN,
                G_TYPE_CHAR,
                G_TYPE_UCHAR,
+               G_TYPE_SHORT,
+               G_TYPE_USHORT,
                G_TYPE_UINT,
                G_TYPE_LONG,
                G_TYPE_ULONG,
@@ -326,13 +328,15 @@ test_class_init (TestClass *klass)
                 G_SIGNAL_RUN_LAST,
                 G_STRUCT_OFFSET (TestClass, all_types),
                 NULL, NULL,
-                
test_VOID__INT_BOOLEAN_CHAR_UCHAR_UINT_LONG_ULONG_ENUM_FLAGS_FLOAT_DOUBLE_STRING_PARAM_BOXED_POINTER_OBJECT_VARIANT_INT64_UINT64,
+                
test_VOID__INT_BOOLEAN_CHAR_UCHAR_SHORT_USHORT_UINT_LONG_ULONG_ENUM_FLAGS_FLOAT_DOUBLE_STRING_PARAM_BOXED_POINTER_OBJECT_VARIANT_INT64_UINT64,
                 G_TYPE_NONE,
                 19,
                G_TYPE_INT,
                G_TYPE_BOOLEAN,
                G_TYPE_CHAR,
                G_TYPE_UCHAR,
+               G_TYPE_SHORT,
+               G_TYPE_USHORT,
                G_TYPE_UINT,
                G_TYPE_LONG,
                G_TYPE_ULONG,
@@ -349,7 +353,7 @@ test_class_init (TestClass *klass)
                G_TYPE_INT64,
                G_TYPE_UINT64);
   g_signal_set_va_marshaller (s, G_TYPE_FROM_CLASS (klass),
-                             
test_VOID__INT_BOOLEAN_CHAR_UCHAR_UINT_LONG_ULONG_ENUM_FLAGS_FLOAT_DOUBLE_STRING_PARAM_BOXED_POINTER_OBJECT_VARIANT_INT64_UINT64v);
+                             
test_VOID__INT_BOOLEAN_CHAR_UCHAR_SHORT_USHORT_UINT_LONG_ULONG_ENUM_FLAGS_FLOAT_DOUBLE_STRING_PARAM_BOXED_POINTER_OBJECT_VARIANT_INT64_UINT64v);
 
   g_signal_new ("all-types-generic",
                 G_TYPE_FROM_CLASS (klass),
@@ -363,6 +367,8 @@ test_class_init (TestClass *klass)
                G_TYPE_BOOLEAN,
                G_TYPE_CHAR,
                G_TYPE_UCHAR,
+               G_TYPE_SHORT,
+               G_TYPE_USHORT,
                G_TYPE_UINT,
                G_TYPE_LONG,
                G_TYPE_ULONG,
@@ -383,13 +389,15 @@ test_class_init (TestClass *klass)
                 G_SIGNAL_RUN_LAST,
                 G_STRUCT_OFFSET (TestClass, all_types_null),
                 NULL, NULL,
-                
test_VOID__INT_BOOLEAN_CHAR_UCHAR_UINT_LONG_ULONG_ENUM_FLAGS_FLOAT_DOUBLE_STRING_PARAM_BOXED_POINTER_OBJECT_VARIANT_INT64_UINT64,
+                
test_VOID__INT_BOOLEAN_CHAR_UCHAR_SHORT_USHORT_UINT_LONG_ULONG_ENUM_FLAGS_FLOAT_DOUBLE_STRING_PARAM_BOXED_POINTER_OBJECT_VARIANT_INT64_UINT64,
                 G_TYPE_NONE,
                 19,
                G_TYPE_INT,
                G_TYPE_BOOLEAN,
                G_TYPE_CHAR,
                G_TYPE_UCHAR,
+               G_TYPE_SHORT,
+               G_TYPE_USHORT,
                G_TYPE_UINT,
                G_TYPE_LONG,
                G_TYPE_ULONG,
@@ -410,13 +418,15 @@ test_class_init (TestClass *klass)
                 G_SIGNAL_RUN_LAST,
                 0,
                 NULL, NULL,
-                
test_VOID__INT_BOOLEAN_CHAR_UCHAR_UINT_LONG_ULONG_ENUM_FLAGS_FLOAT_DOUBLE_STRING_PARAM_BOXED_POINTER_OBJECT_VARIANT_INT64_UINT64,
+                
test_VOID__INT_BOOLEAN_CHAR_UCHAR_SHORT_USHORT_UINT_LONG_ULONG_ENUM_FLAGS_FLOAT_DOUBLE_STRING_PARAM_BOXED_POINTER_OBJECT_VARIANT_INT64_UINT64,
                 G_TYPE_NONE,
                 19,
                G_TYPE_INT,
                G_TYPE_BOOLEAN,
                G_TYPE_CHAR,
                G_TYPE_UCHAR,
+               G_TYPE_SHORT,
+               G_TYPE_USHORT,
                G_TYPE_UINT,
                G_TYPE_LONG,
                G_TYPE_ULONG,
@@ -792,7 +802,7 @@ test_custom_marshaller (void)
 static int all_type_handlers_count = 0;
 
 static void
-all_types_handler (Test *test, int i, gboolean b, char c, guchar uc, guint ui, glong l, gulong ul, MyEnum e, 
MyFlags f, float fl, double db, char *str, GParamSpec *param, GBytes *bytes, gpointer ptr, Test *obj, 
GVariant *var, gint64 i64, guint64 ui64)
+all_types_handler (Test *test, int i, gboolean b, char c, guchar uc, gshort s, gushort us, guint ui, glong 
l, gulong ul, MyEnum e, MyFlags f, float fl, double db, char *str, GParamSpec *param, GBytes *bytes, gpointer 
ptr, Test *obj, GVariant *var, gint64 i64, guint64 ui64)
 {
   all_type_handlers_count++;
 
@@ -800,6 +810,8 @@ all_types_handler (Test *test, int i, gboolean b, char c, guchar uc, guint ui, g
   g_assert_cmpint (b, ==, TRUE);
   g_assert_cmpint (c, ==, 17);
   g_assert_cmpuint (uc, ==, 140);
+  g_assert_cmpint (s, ==, -1117);
+  g_assert_cmpuint (us, ==, G_MAXUSHORT - 999);
   g_assert_cmpuint (ui, ==, G_MAXUINT - 42);
   g_assert_cmpint (l, ==, -1117);
   g_assert_cmpuint (ul, ==, G_MAXULONG - 999);
@@ -817,10 +829,10 @@ all_types_handler (Test *test, int i, gboolean b, char c, guchar uc, guint ui, g
 }
 
 static void
-all_types_handler_cb (Test *test, int i, gboolean b, char c, guchar uc, guint ui, glong l, gulong ul, MyEnum 
e, guint f, float fl, double db, char *str, GParamSpec *param, GBytes *bytes, gpointer ptr, Test *obj, 
GVariant *var, gint64 i64, guint64 ui64, gpointer user_data)
+all_types_handler_cb (Test *test, int i, gboolean b, char c, guchar uc, gshort s, gushort us, guint ui, 
glong l, gulong ul, MyEnum e, guint f, float fl, double db, char *str, GParamSpec *param, GBytes *bytes, 
gpointer ptr, Test *obj, GVariant *var, gint64 i64, guint64 ui64, gpointer user_data)
 {
   g_assert_true (user_data == &flags_type);
-  all_types_handler (test, i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, obj, var, i64, 
ui64);
+  all_types_handler (test, i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, obj, var, 
i64, ui64);
 }
 
 static void
@@ -833,6 +845,8 @@ test_all_types (void)
   char c = 17;
   guchar uc = 140;
   guint ui = G_MAXUINT - 42;
+  gshort s =  -1117;
+  gushort us = G_MAXUSHORT - 999;
   glong l =  -1117;
   gulong ul = G_MAXULONG - 999;
   MyEnum e = MY_ENUM_VALUE;
@@ -855,15 +869,15 @@ test_all_types (void)
   all_type_handlers_count = 0;
 
   g_signal_emit_by_name (test, "all-types",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
   g_signal_emit_by_name (test, "all-types-va",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
   g_signal_emit_by_name (test, "all-types-generic",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
   g_signal_emit_by_name (test, "all-types-empty",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
   g_signal_emit_by_name (test, "all-types-null",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
 
   g_assert_cmpint (all_type_handlers_count, ==, 3);
 
@@ -876,15 +890,15 @@ test_all_types (void)
   g_signal_connect (test, "all-types-null", G_CALLBACK (all_types_handler_cb), &flags_type);
 
   g_signal_emit_by_name (test, "all-types",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
   g_signal_emit_by_name (test, "all-types-va",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
   g_signal_emit_by_name (test, "all-types-generic",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
   g_signal_emit_by_name (test, "all-types-empty",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
   g_signal_emit_by_name (test, "all-types-null",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
 
   g_assert_cmpint (all_type_handlers_count, ==, 3 + 5);
 
@@ -897,15 +911,15 @@ test_all_types (void)
   g_signal_connect (test, "all-types-null", G_CALLBACK (all_types_handler_cb), &flags_type);
 
   g_signal_emit_by_name (test, "all-types",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
   g_signal_emit_by_name (test, "all-types-va",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
   g_signal_emit_by_name (test, "all-types-generic",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
   g_signal_emit_by_name (test, "all-types-empty",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
   g_signal_emit_by_name (test, "all-types-null",
-                        i, b, c, uc, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, ui64);
+                        i, b, c, uc, s, us, ui, l, ul, e, f, fl, db, str, param, bytes, ptr, test, var, i64, 
ui64);
 
   g_assert_cmpint (all_type_handlers_count, ==, 3 + 5 + 5);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]