libgimpbase: add _gimp_wire_{read,write}_int64()
... for reading/writing guint64 data in the wire protocol.
This commit is contained in:
@ -311,6 +311,30 @@ gimp_wire_destroy (GimpWireMessage *msg)
|
||||
(* handler->destroy_func) (msg);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gimp_wire_read_int64 (GIOChannel *channel,
|
||||
guint64 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_val_if_fail (count >= 0, FALSE);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
if (! _gimp_wire_read_int8 (channel,
|
||||
(guint8 *) data, count * 8, user_data))
|
||||
return FALSE;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
*data = GUINT64_FROM_BE (*data);
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gimp_wire_read_int32 (GIOChannel *channel,
|
||||
guint32 *data,
|
||||
@ -468,6 +492,31 @@ _gimp_wire_read_color (GIOChannel *channel,
|
||||
(gdouble *) data, 4 * count, user_data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gimp_wire_write_int64 (GIOChannel *channel,
|
||||
const guint64 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_val_if_fail (count >= 0, FALSE);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
guint64 tmp = GUINT64_TO_BE (data[i]);
|
||||
|
||||
if (! _gimp_wire_write_int8 (channel,
|
||||
(const guint8 *) &tmp, 8, user_data))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gimp_wire_write_int32 (GIOChannel *channel,
|
||||
const guint32 *data,
|
||||
|
@ -83,6 +83,10 @@ void gimp_wire_destroy (GimpWireMessage *msg);
|
||||
|
||||
/* for internal use in libgimpbase */
|
||||
|
||||
G_GNUC_INTERNAL gboolean _gimp_wire_read_int64 (GIOChannel *channel,
|
||||
guint64 *data,
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
G_GNUC_INTERNAL gboolean _gimp_wire_read_int32 (GIOChannel *channel,
|
||||
guint32 *data,
|
||||
gint count,
|
||||
@ -107,6 +111,10 @@ G_GNUC_INTERNAL gboolean _gimp_wire_read_color (GIOChannel *channel,
|
||||
GimpRGB *data,
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
G_GNUC_INTERNAL gboolean _gimp_wire_write_int64 (GIOChannel *channel,
|
||||
const guint64 *data,
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
G_GNUC_INTERNAL gboolean _gimp_wire_write_int32 (GIOChannel *channel,
|
||||
const guint32 *data,
|
||||
gint count,
|
||||
|
Reference in New Issue
Block a user