gvariant: Change type of ‘y’ variants from guchar to guint8

This fits better with the convention in the rest of GLib where arbitrary
8-bit values are represented as guint8, avoiding the potential confusing
of a name which references ‘char’s.

This is not an API break, as both guint8 and guchar are unconditionally
typedeffed to unsigned char.

https://gitlab.gnome.org/GNOME/glib/issues/896
This commit is contained in:
Philip Withnall 2014-07-01 17:34:38 +01:00
parent 3126f73c80
commit 09419fdeb4
2 changed files with 7 additions and 7 deletions

View File

@ -403,11 +403,11 @@ g_variant_get_boolean (GVariant *value)
* It is an error to call this function with a @value of any type * It is an error to call this function with a @value of any type
* other than %G_VARIANT_TYPE_BYTE. * other than %G_VARIANT_TYPE_BYTE.
* *
* Returns: a #guchar * Returns: a #guint8
* *
* Since: 2.24 * Since: 2.24
**/ **/
NUMERIC_TYPE (BYTE, byte, guchar) NUMERIC_TYPE (BYTE, byte, guint8)
/** /**
* g_variant_new_int16: * g_variant_new_int16:
@ -1105,7 +1105,7 @@ g_variant_lookup_value (GVariant *dictionary,
* the appropriate type: * the appropriate type:
* - %G_VARIANT_TYPE_INT16 (etc.): #gint16 (etc.) * - %G_VARIANT_TYPE_INT16 (etc.): #gint16 (etc.)
* - %G_VARIANT_TYPE_BOOLEAN: #guchar (not #gboolean!) * - %G_VARIANT_TYPE_BOOLEAN: #guchar (not #gboolean!)
* - %G_VARIANT_TYPE_BYTE: #guchar * - %G_VARIANT_TYPE_BYTE: #guint8
* - %G_VARIANT_TYPE_HANDLE: #guint32 * - %G_VARIANT_TYPE_HANDLE: #guint32
* - %G_VARIANT_TYPE_DOUBLE: #gdouble * - %G_VARIANT_TYPE_DOUBLE: #gdouble
* *
@ -5042,7 +5042,7 @@ g_variant_valist_get_leaf (const gchar **str,
return; return;
case 'y': case 'y':
*(guchar *) ptr = g_variant_get_byte (value); *(guint8 *) ptr = g_variant_get_byte (value);
return; return;
case 'n': case 'n':
@ -5083,7 +5083,7 @@ g_variant_valist_get_leaf (const gchar **str,
switch (*(*str)++) switch (*(*str)++)
{ {
case 'y': case 'y':
*(guchar *) ptr = 0; *(guint8 *) ptr = 0;
return; return;
case 'n': case 'n':

View File

@ -80,7 +80,7 @@ GVariantClass g_variant_classify (GVarian
GLIB_AVAILABLE_IN_ALL GLIB_AVAILABLE_IN_ALL
GVariant * g_variant_new_boolean (gboolean value); GVariant * g_variant_new_boolean (gboolean value);
GLIB_AVAILABLE_IN_ALL GLIB_AVAILABLE_IN_ALL
GVariant * g_variant_new_byte (guchar value); GVariant * g_variant_new_byte (guint8 value);
GLIB_AVAILABLE_IN_ALL GLIB_AVAILABLE_IN_ALL
GVariant * g_variant_new_int16 (gint16 value); GVariant * g_variant_new_int16 (gint16 value);
GLIB_AVAILABLE_IN_ALL GLIB_AVAILABLE_IN_ALL
@ -133,7 +133,7 @@ GVariant * g_variant_new_fixed_array (const G
GLIB_AVAILABLE_IN_ALL GLIB_AVAILABLE_IN_ALL
gboolean g_variant_get_boolean (GVariant *value); gboolean g_variant_get_boolean (GVariant *value);
GLIB_AVAILABLE_IN_ALL GLIB_AVAILABLE_IN_ALL
guchar g_variant_get_byte (GVariant *value); guint8 g_variant_get_byte (GVariant *value);
GLIB_AVAILABLE_IN_ALL GLIB_AVAILABLE_IN_ALL
gint16 g_variant_get_int16 (GVariant *value); gint16 g_variant_get_int16 (GVariant *value);
GLIB_AVAILABLE_IN_ALL GLIB_AVAILABLE_IN_ALL