};
static guchar
-g_memory_buffer_read_byte (GMemoryBuffer *mbuf,
- GError **error)
+g_memory_buffer_read_byte (GMemoryBuffer *mbuf)
{
if (mbuf->pos >= mbuf->valid_len)
return 0;
}
static gint16
-g_memory_buffer_read_int16 (GMemoryBuffer *mbuf,
- GError **error)
+g_memory_buffer_read_int16 (GMemoryBuffer *mbuf)
{
gint16 v;
}
static guint16
-g_memory_buffer_read_uint16 (GMemoryBuffer *mbuf,
- GError **error)
+g_memory_buffer_read_uint16 (GMemoryBuffer *mbuf)
{
guint16 v;
}
static gint32
-g_memory_buffer_read_int32 (GMemoryBuffer *mbuf,
- GError **error)
+g_memory_buffer_read_int32 (GMemoryBuffer *mbuf)
{
gint32 v;
}
static guint32
-g_memory_buffer_read_uint32 (GMemoryBuffer *mbuf,
- GError **error)
+g_memory_buffer_read_uint32 (GMemoryBuffer *mbuf)
{
guint32 v;
}
static gint64
-g_memory_buffer_read_int64 (GMemoryBuffer *mbuf,
- GError **error)
+g_memory_buffer_read_int64 (GMemoryBuffer *mbuf)
{
gint64 v;
}
static guint64
-g_memory_buffer_read_uint64 (GMemoryBuffer *mbuf,
- GError **error)
+g_memory_buffer_read_uint64 (GMemoryBuffer *mbuf)
{
guint64 v;
}
static void
-array_resize (GMemoryBuffer *mbuf,
- gsize size)
+array_resize (GMemoryBuffer *mbuf,
+ gsize size)
{
gpointer data;
gsize len;
static gboolean
g_memory_buffer_write (GMemoryBuffer *mbuf,
- const void *buffer,
- gsize count)
+ const void *buffer,
+ gsize count)
{
guint8 *dest;
gsize new_size;
/* ---------------------------------------------------------------------------------------------------- */
static gboolean
-ensure_input_padding (GMemoryBuffer *buf,
- gsize padding_size,
- GError **error)
+ensure_input_padding (GMemoryBuffer *buf,
+ gsize padding_size)
{
gsize offset;
gsize wanted_offset;
}
static const gchar *
-read_string (GMemoryBuffer *mbuf,
- gsize len,
- GError **error)
+read_string (GMemoryBuffer *mbuf,
+ gsize len,
+ GError **error)
{
gchar *str;
const gchar *end_valid;
(gulong)len),
(gulong)len,
(gulong)(mbuf->valid_len - mbuf->pos));
- mbuf->pos = mbuf->valid_len;
return NULL;
}
/* returns a non-floating GVariant! */
static GVariant *
-parse_value_from_blob (GMemoryBuffer *buf,
- const GVariantType *type,
- gboolean just_align,
- guint indent,
- GError **error)
+parse_value_from_blob (GMemoryBuffer *buf,
+ const GVariantType *type,
+ gboolean just_align,
+ guint indent,
+ GError **error)
{
GVariant *ret;
GError *local_error;
switch (type_string[0])
{
case 'b': /* G_VARIANT_TYPE_BOOLEAN */
- if (!ensure_input_padding (buf, 4, &local_error))
- goto fail;
+ ensure_input_padding (buf, 4);
if (!just_align)
{
gboolean v;
- v = g_memory_buffer_read_uint32 (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ v = g_memory_buffer_read_uint32 (buf);
ret = g_variant_new_boolean (v);
}
break;
if (!just_align)
{
guchar v;
- v = g_memory_buffer_read_byte (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ v = g_memory_buffer_read_byte (buf);
ret = g_variant_new_byte (v);
}
break;
case 'n': /* G_VARIANT_TYPE_INT16 */
- if (!ensure_input_padding (buf, 2, &local_error))
- goto fail;
+ ensure_input_padding (buf, 2);
if (!just_align)
{
gint16 v;
- v = g_memory_buffer_read_int16 (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ v = g_memory_buffer_read_int16 (buf);
ret = g_variant_new_int16 (v);
}
break;
case 'q': /* G_VARIANT_TYPE_UINT16 */
- if (!ensure_input_padding (buf, 2, &local_error))
- goto fail;
+ ensure_input_padding (buf, 2);
if (!just_align)
{
guint16 v;
- v = g_memory_buffer_read_uint16 (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ v = g_memory_buffer_read_uint16 (buf);
ret = g_variant_new_uint16 (v);
}
break;
case 'i': /* G_VARIANT_TYPE_INT32 */
- if (!ensure_input_padding (buf, 4, &local_error))
- goto fail;
+ ensure_input_padding (buf, 4);
if (!just_align)
{
gint32 v;
- v = g_memory_buffer_read_int32 (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ v = g_memory_buffer_read_int32 (buf);
ret = g_variant_new_int32 (v);
}
break;
case 'u': /* G_VARIANT_TYPE_UINT32 */
- if (!ensure_input_padding (buf, 4, &local_error))
- goto fail;
+ ensure_input_padding (buf, 4);
if (!just_align)
{
guint32 v;
- v = g_memory_buffer_read_uint32 (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ v = g_memory_buffer_read_uint32 (buf);
ret = g_variant_new_uint32 (v);
}
break;
case 'x': /* G_VARIANT_TYPE_INT64 */
- if (!ensure_input_padding (buf, 8, &local_error))
- goto fail;
+ ensure_input_padding (buf, 8);
if (!just_align)
{
gint64 v;
- v = g_memory_buffer_read_int64 (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ v = g_memory_buffer_read_int64 (buf);
ret = g_variant_new_int64 (v);
}
break;
case 't': /* G_VARIANT_TYPE_UINT64 */
- if (!ensure_input_padding (buf, 8, &local_error))
- goto fail;
+ ensure_input_padding (buf, 8);
if (!just_align)
{
guint64 v;
- v = g_memory_buffer_read_uint64 (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ v = g_memory_buffer_read_uint64 (buf);
ret = g_variant_new_uint64 (v);
}
break;
case 'd': /* G_VARIANT_TYPE_DOUBLE */
- if (!ensure_input_padding (buf, 8, &local_error))
- goto fail;
+ ensure_input_padding (buf, 8);
if (!just_align)
{
union {
gdouble v_double;
} u;
G_STATIC_ASSERT (sizeof (gdouble) == sizeof (guint64));
- u.v_uint64 = g_memory_buffer_read_uint64 (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ u.v_uint64 = g_memory_buffer_read_uint64 (buf);
ret = g_variant_new_double (u.v_double);
}
break;
case 's': /* G_VARIANT_TYPE_STRING */
- if (!ensure_input_padding (buf, 4, &local_error))
- goto fail;
+ ensure_input_padding (buf, 4);
if (!just_align)
{
guint32 len;
const gchar *v;
- len = g_memory_buffer_read_uint32 (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ len = g_memory_buffer_read_uint32 (buf);
v = read_string (buf, (gsize) len, &local_error);
if (v == NULL)
goto fail;
break;
case 'o': /* G_VARIANT_TYPE_OBJECT_PATH */
- if (!ensure_input_padding (buf, 4, &local_error))
- goto fail;
+ ensure_input_padding (buf, 4);
if (!just_align)
{
guint32 len;
const gchar *v;
- len = g_memory_buffer_read_uint32 (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ len = g_memory_buffer_read_uint32 (buf);
v = read_string (buf, (gsize) len, &local_error);
if (v == NULL)
goto fail;
{
guchar len;
const gchar *v;
- len = g_memory_buffer_read_byte (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ len = g_memory_buffer_read_byte (buf);
v = read_string (buf, (gsize) len, &local_error);
if (v == NULL)
goto fail;
break;
case 'h': /* G_VARIANT_TYPE_HANDLE */
- if (!ensure_input_padding (buf, 4, &local_error))
- goto fail;
+ ensure_input_padding (buf, 4);
if (!just_align)
{
gint32 v;
- v = g_memory_buffer_read_int32 (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ v = g_memory_buffer_read_int32 (buf);
ret = g_variant_new_handle (v);
}
break;
case 'a': /* G_VARIANT_TYPE_ARRAY */
- if (!ensure_input_padding (buf, 4, &local_error))
- goto fail;
+ ensure_input_padding (buf, 4);
/* If we are only aligning for this array type, it is the child type of
* another array, which is empty. So, we do not need to add padding for
const GVariantType *element_type;
GVariantBuilder builder;
- array_len = g_memory_buffer_read_uint32 (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ array_len = g_memory_buffer_read_uint32 (buf);
is_leaf = FALSE;
#ifdef DEBUG_SERIALIZER
GVariant *key;
GVariant *value;
- if (!ensure_input_padding (buf, 8, &local_error))
- goto fail;
+ ensure_input_padding (buf, 8);
is_leaf = FALSE;
#ifdef DEBUG_SERIALIZER
}
else if (g_variant_type_is_tuple (type))
{
- if (!ensure_input_padding (buf, 8, &local_error))
- goto fail;
+ ensure_input_padding (buf, 8);
is_leaf = FALSE;
#ifdef DEBUG_SERIALIZER
GVariantType *variant_type;
GVariant *value;
- siglen = g_memory_buffer_read_byte (buf, &local_error);
- if (local_error != NULL)
- goto fail;
+ siglen = g_memory_buffer_read_byte (buf);
sig = read_string (buf, (gsize) siglen, &local_error);
if (sig == NULL)
goto fail;
* Since: 2.26
*/
gssize
-g_dbus_message_bytes_needed (guchar *blob,
- gsize blob_len,
- GError **error)
+g_dbus_message_bytes_needed (guchar *blob,
+ gsize blob_len,
+ GError **error)
{
gssize ret;
mbuf.data = (gchar *)blob;
mbuf.len = mbuf.valid_len = blob_len;
- endianness = g_memory_buffer_read_byte (&mbuf, NULL);
+ endianness = g_memory_buffer_read_byte (&mbuf);
switch (endianness)
{
case 'l':
goto out;
}
- message->type = g_memory_buffer_read_byte (&mbuf, NULL);
- message->flags = g_memory_buffer_read_byte (&mbuf, NULL);
- major_protocol_version = g_memory_buffer_read_byte (&mbuf, NULL);
+ message->type = g_memory_buffer_read_byte (&mbuf);
+ message->flags = g_memory_buffer_read_byte (&mbuf);
+ major_protocol_version = g_memory_buffer_read_byte (&mbuf);
if (major_protocol_version != 1)
{
g_set_error (error,
major_protocol_version);
goto out;
}
- message_body_len = g_memory_buffer_read_uint32 (&mbuf, NULL);
- message->serial = g_memory_buffer_read_uint32 (&mbuf, NULL);
+ message_body_len = g_memory_buffer_read_uint32 (&mbuf);
+ message->serial = g_memory_buffer_read_uint32 (&mbuf);
#ifdef DEBUG_SERIALIZER
g_print ("Parsing blob (blob_len = 0x%04x bytes)\n", (gint) blob_len);
static gsize
ensure_output_padding (GMemoryBuffer *mbuf,
- gsize padding_size)
+ gsize padding_size)
{
gsize offset;
gsize wanted_offset;
/* note that value can be NULL for e.g. empty arrays - type is never NULL */
static gboolean
-append_value_to_blob (GVariant *value,
- const GVariantType *type,
- GMemoryBuffer *mbuf,
- gsize *out_padding_added,
- GError **error)
+append_value_to_blob (GVariant *value,
+ const GVariantType *type,
+ GMemoryBuffer *mbuf,
+ gsize *out_padding_added,
+ GError **error)
{
gsize padding_added;
const gchar *type_string;
}
static gboolean
-append_body_to_blob (GVariant *value,
+append_body_to_blob (GVariant *value,
GMemoryBuffer *mbuf,
- GError **error)
+ GError **error)
{
GVariant *item;
GVariantIter iter;