/* data-io.c generated by valac 0.56.19, the Vala compiler
 * generated from data-io.vala, do not modify */

#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define G4_TYPE_DATA_INPUT_BYTES (g4_data_input_bytes_get_type ())
#define G4_DATA_INPUT_BYTES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_DATA_INPUT_BYTES, G4DataInputBytes))
#define G4_DATA_INPUT_BYTES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_DATA_INPUT_BYTES, G4DataInputBytesClass))
#define G4_IS_DATA_INPUT_BYTES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_DATA_INPUT_BYTES))
#define G4_IS_DATA_INPUT_BYTES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_DATA_INPUT_BYTES))
#define G4_DATA_INPUT_BYTES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_DATA_INPUT_BYTES, G4DataInputBytesClass))

typedef struct _G4DataInputBytes G4DataInputBytes;
typedef struct _G4DataInputBytesClass G4DataInputBytesClass;
typedef struct _G4DataInputBytesPrivate G4DataInputBytesPrivate;
enum  {
	G4_DATA_INPUT_BYTES_0_PROPERTY,
	G4_DATA_INPUT_BYTES_NUM_PROPERTIES
};
static GParamSpec* g4_data_input_bytes_properties[G4_DATA_INPUT_BYTES_NUM_PROPERTIES];
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define G4_TYPE_DATA_OUTPUT_BYTES (g4_data_output_bytes_get_type ())
#define G4_DATA_OUTPUT_BYTES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_DATA_OUTPUT_BYTES, G4DataOutputBytes))
#define G4_DATA_OUTPUT_BYTES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_DATA_OUTPUT_BYTES, G4DataOutputBytesClass))
#define G4_IS_DATA_OUTPUT_BYTES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_DATA_OUTPUT_BYTES))
#define G4_IS_DATA_OUTPUT_BYTES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_DATA_OUTPUT_BYTES))
#define G4_DATA_OUTPUT_BYTES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_DATA_OUTPUT_BYTES, G4DataOutputBytesClass))

typedef struct _G4DataOutputBytes G4DataOutputBytes;
typedef struct _G4DataOutputBytesClass G4DataOutputBytesClass;
typedef struct _G4DataOutputBytesPrivate G4DataOutputBytesPrivate;
enum  {
	G4_DATA_OUTPUT_BYTES_0_PROPERTY,
	G4_DATA_OUTPUT_BYTES_NUM_PROPERTIES
};
static GParamSpec* g4_data_output_bytes_properties[G4_DATA_OUTPUT_BYTES_NUM_PROPERTIES];
#define _g_byte_array_unref0(var) ((var == NULL) ? NULL : (var = (g_byte_array_unref (var), NULL)))

struct _G4DataInputBytes {
	GObject parent_instance;
	G4DataInputBytesPrivate * priv;
};

struct _G4DataInputBytesClass {
	GObjectClass parent_class;
};

struct _G4DataInputBytesPrivate {
	GBytes* _bytes;
	guint8* _data;
	gint _data_length1;
	gint __data_size_;
	gint _pos;
	gint _length;
};

struct _G4DataOutputBytes {
	GObject parent_instance;
	G4DataOutputBytesPrivate * priv;
};

struct _G4DataOutputBytesClass {
	GObjectClass parent_class;
};

struct _G4DataOutputBytesPrivate {
	GByteArray* _bytes;
	guint8* _data;
	gint _data_length1;
	gint __data_size_;
};

static gint G4DataInputBytes_private_offset;
static gpointer g4_data_input_bytes_parent_class = NULL;
static gint G4DataOutputBytes_private_offset;
static gpointer g4_data_output_bytes_parent_class = NULL;

VALA_EXTERN GType g4_data_input_bytes_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4DataInputBytes, g_object_unref)
VALA_EXTERN G4DataInputBytes* g4_data_input_bytes_new (GBytes* bytes);
VALA_EXTERN G4DataInputBytes* g4_data_input_bytes_construct (GType object_type,
                                                 GBytes* bytes);
VALA_EXTERN guint8 g4_data_input_bytes_read_byte (G4DataInputBytes* self,
                                      GError** error);
VALA_EXTERN guint16 g4_data_input_bytes_read_uint16 (G4DataInputBytes* self,
                                         GError** error);
VALA_EXTERN guint32 g4_data_input_bytes_read_uint32 (G4DataInputBytes* self,
                                         GError** error);
VALA_EXTERN guint64 g4_data_input_bytes_read_uint64 (G4DataInputBytes* self,
                                         GError** error);
VALA_EXTERN gsize g4_data_input_bytes_read_size (G4DataInputBytes* self,
                                     GError** error);
VALA_EXTERN gchar* g4_data_input_bytes_read_string (G4DataInputBytes* self,
                                        GError** error);
VALA_EXTERN void g4_data_input_bytes_reset (G4DataInputBytes* self);
static void g4_data_input_bytes_finalize (GObject * obj);
static GType g4_data_input_bytes_get_type_once (void);
VALA_EXTERN GType g4_data_output_bytes_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4DataOutputBytes, g_object_unref)
VALA_EXTERN G4DataOutputBytes* g4_data_output_bytes_new (guint reserved_size);
VALA_EXTERN G4DataOutputBytes* g4_data_output_bytes_construct (GType object_type,
                                                   guint reserved_size);
VALA_EXTERN void g4_data_output_bytes_write_byte (G4DataOutputBytes* self,
                                      guint8 n);
VALA_EXTERN void g4_data_output_bytes_write_uint16 (G4DataOutputBytes* self,
                                        guint16 n);
VALA_EXTERN void g4_data_output_bytes_write_uint32 (G4DataOutputBytes* self,
                                        guint32 n);
VALA_EXTERN void g4_data_output_bytes_write_uint64 (G4DataOutputBytes* self,
                                        guint64 n);
VALA_EXTERN void g4_data_output_bytes_write_size (G4DataOutputBytes* self,
                                      gsize n);
VALA_EXTERN void g4_data_output_bytes_write_string (G4DataOutputBytes* self,
                                        const gchar* str);
VALA_EXTERN gboolean g4_data_output_bytes_write_to (G4DataOutputBytes* self,
                                        GOutputStream* stream,
                                        GError** error);
static void g4_data_output_bytes_finalize (GObject * obj);
static GType g4_data_output_bytes_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
g4_data_input_bytes_get_instance_private (G4DataInputBytes* self)
{
	return G_STRUCT_MEMBER_P (self, G4DataInputBytes_private_offset);
}

static gpointer
_g_bytes_ref0 (gpointer self)
{
	return self ? g_bytes_ref (self) : NULL;
}

static gint
_vala_g_bytes_get_length (GBytes* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = (gint) g_bytes_get_size (self);
	return result;
}

G4DataInputBytes*
g4_data_input_bytes_construct (GType object_type,
                               GBytes* bytes)
{
	G4DataInputBytes * self = NULL;
	GBytes* _tmp0_;
	gsize _tmp1_ = 0;
	guint8* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	g_return_val_if_fail (bytes != NULL, NULL);
	self = (G4DataInputBytes*) g_object_new (object_type, NULL);
	_tmp0_ = _g_bytes_ref0 (bytes);
	_g_bytes_unref0 (self->priv->_bytes);
	self->priv->_bytes = _tmp0_;
	_tmp2_ = g_bytes_get_data (bytes, &_tmp1_);
	self->priv->_data = _tmp2_;
	self->priv->_data_length1 = _tmp1_;
	self->priv->__data_size_ = self->priv->_data_length1;
	_tmp3_ = _vala_g_bytes_get_length (bytes);
	_tmp4_ = _tmp3_;
	self->priv->_length = _tmp4_;
	return self;
}

G4DataInputBytes*
g4_data_input_bytes_new (GBytes* bytes)
{
	return g4_data_input_bytes_construct (G4_TYPE_DATA_INPUT_BYTES, bytes);
}

inline guint8
g4_data_input_bytes_read_byte (G4DataInputBytes* self,
                               GError** error)
{
	guint8* _tmp10_;
	gint _tmp10__length1;
	gint _tmp11_;
	guint8 _tmp12_;
	GError* _inner_error0_ = NULL;
	guint8 result;
	g_return_val_if_fail (self != NULL, 0U);
	if ((self->priv->_pos + 1) > self->priv->_length) {
		gchar* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		GError* _tmp6_;
		GError* _tmp7_;
		_tmp0_ = g_strdup_printf ("%i", self->priv->_pos);
		_tmp1_ = _tmp0_;
		_tmp2_ = g_strdup_printf ("%i", self->priv->_length);
		_tmp3_ = _tmp2_;
		_tmp4_ = g_strconcat ("Pos:", _tmp1_, "+1>", _tmp3_, NULL);
		_tmp5_ = _tmp4_;
		_tmp6_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _tmp5_);
		_tmp7_ = _tmp6_;
		_g_free0 (_tmp5_);
		_g_free0 (_tmp3_);
		_g_free0 (_tmp1_);
		_inner_error0_ = _tmp7_;
		if (_inner_error0_->domain == G_IO_ERROR) {
			guint8 _tmp8_ = 0U;
			g_propagate_error (error, _inner_error0_);
			return _tmp8_;
		} else {
			guint8 _tmp9_ = 0U;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp9_;
		}
	}
	_tmp10_ = self->priv->_data;
	_tmp10__length1 = self->priv->_data_length1;
	_tmp11_ = self->priv->_pos;
	self->priv->_pos = _tmp11_ + 1;
	_tmp12_ = _tmp10_[_tmp11_];
	result = _tmp12_;
	return result;
}

inline guint16
g4_data_input_bytes_read_uint16 (G4DataInputBytes* self,
                                 GError** error)
{
	guint8* _tmp10_;
	gint _tmp10__length1;
	gint _tmp11_;
	guint8 _tmp12_;
	guint8* _tmp13_;
	gint _tmp13__length1;
	gint _tmp14_;
	guint8 _tmp15_;
	GError* _inner_error0_ = NULL;
	guint16 result;
	g_return_val_if_fail (self != NULL, 0U);
	if ((self->priv->_pos + 2) > self->priv->_length) {
		gchar* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		GError* _tmp6_;
		GError* _tmp7_;
		_tmp0_ = g_strdup_printf ("%i", self->priv->_pos);
		_tmp1_ = _tmp0_;
		_tmp2_ = g_strdup_printf ("%i", self->priv->_length);
		_tmp3_ = _tmp2_;
		_tmp4_ = g_strconcat ("Pos:", _tmp1_, "+2>", _tmp3_, NULL);
		_tmp5_ = _tmp4_;
		_tmp6_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _tmp5_);
		_tmp7_ = _tmp6_;
		_g_free0 (_tmp5_);
		_g_free0 (_tmp3_);
		_g_free0 (_tmp1_);
		_inner_error0_ = _tmp7_;
		if (_inner_error0_->domain == G_IO_ERROR) {
			guint16 _tmp8_ = 0U;
			g_propagate_error (error, _inner_error0_);
			return _tmp8_;
		} else {
			guint16 _tmp9_ = 0U;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp9_;
		}
	}
	_tmp10_ = self->priv->_data;
	_tmp10__length1 = self->priv->_data_length1;
	_tmp11_ = self->priv->_pos;
	self->priv->_pos = _tmp11_ + 1;
	_tmp12_ = _tmp10_[_tmp11_];
	_tmp13_ = self->priv->_data;
	_tmp13__length1 = self->priv->_data_length1;
	_tmp14_ = self->priv->_pos;
	self->priv->_pos = _tmp14_ + 1;
	_tmp15_ = _tmp13_[_tmp14_];
	result = (guint16) ((((guint16) _tmp12_) << 8) | _tmp15_);
	return result;
}

inline guint32
g4_data_input_bytes_read_uint32 (G4DataInputBytes* self,
                                 GError** error)
{
	guint8* _tmp10_;
	gint _tmp10__length1;
	gint _tmp11_;
	guint8 _tmp12_;
	guint8* _tmp13_;
	gint _tmp13__length1;
	gint _tmp14_;
	guint8 _tmp15_;
	guint8* _tmp16_;
	gint _tmp16__length1;
	gint _tmp17_;
	guint8 _tmp18_;
	guint8* _tmp19_;
	gint _tmp19__length1;
	gint _tmp20_;
	guint8 _tmp21_;
	GError* _inner_error0_ = NULL;
	guint32 result;
	g_return_val_if_fail (self != NULL, 0U);
	if ((self->priv->_pos + 4) > self->priv->_length) {
		gchar* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		GError* _tmp6_;
		GError* _tmp7_;
		_tmp0_ = g_strdup_printf ("%i", self->priv->_pos);
		_tmp1_ = _tmp0_;
		_tmp2_ = g_strdup_printf ("%i", self->priv->_length);
		_tmp3_ = _tmp2_;
		_tmp4_ = g_strconcat ("Pos:", _tmp1_, "+4>", _tmp3_, NULL);
		_tmp5_ = _tmp4_;
		_tmp6_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _tmp5_);
		_tmp7_ = _tmp6_;
		_g_free0 (_tmp5_);
		_g_free0 (_tmp3_);
		_g_free0 (_tmp1_);
		_inner_error0_ = _tmp7_;
		if (_inner_error0_->domain == G_IO_ERROR) {
			guint32 _tmp8_ = 0U;
			g_propagate_error (error, _inner_error0_);
			return _tmp8_;
		} else {
			guint32 _tmp9_ = 0U;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp9_;
		}
	}
	_tmp10_ = self->priv->_data;
	_tmp10__length1 = self->priv->_data_length1;
	_tmp11_ = self->priv->_pos;
	self->priv->_pos = _tmp11_ + 1;
	_tmp12_ = _tmp10_[_tmp11_];
	_tmp13_ = self->priv->_data;
	_tmp13__length1 = self->priv->_data_length1;
	_tmp14_ = self->priv->_pos;
	self->priv->_pos = _tmp14_ + 1;
	_tmp15_ = _tmp13_[_tmp14_];
	_tmp16_ = self->priv->_data;
	_tmp16__length1 = self->priv->_data_length1;
	_tmp17_ = self->priv->_pos;
	self->priv->_pos = _tmp17_ + 1;
	_tmp18_ = _tmp16_[_tmp17_];
	_tmp19_ = self->priv->_data;
	_tmp19__length1 = self->priv->_data_length1;
	_tmp20_ = self->priv->_pos;
	self->priv->_pos = _tmp20_ + 1;
	_tmp21_ = _tmp19_[_tmp20_];
	result = (((((guint32) _tmp12_) << 24) | (((guint32) _tmp15_) << 16)) | (((guint32) _tmp18_) << 8)) | _tmp21_;
	return result;
}

inline guint64
g4_data_input_bytes_read_uint64 (G4DataInputBytes* self,
                                 GError** error)
{
	guint64 hi = 0ULL;
	guint64 lo = 0ULL;
	GError* _inner_error0_ = NULL;
	guint64 result;
	g_return_val_if_fail (self != NULL, 0ULL);
	hi = (guint64) g4_data_input_bytes_read_uint32 (self, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			guint64 _tmp0_ = 0ULL;
			g_propagate_error (error, _inner_error0_);
			return _tmp0_;
		} else {
			guint64 _tmp1_ = 0ULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp1_;
		}
	}
	lo = (guint64) g4_data_input_bytes_read_uint32 (self, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			guint64 _tmp2_ = 0ULL;
			g_propagate_error (error, _inner_error0_);
			return _tmp2_;
		} else {
			guint64 _tmp3_ = 0ULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp3_;
		}
	}
	result = (hi << 32) | lo;
	return result;
}

gsize
g4_data_input_bytes_read_size (G4DataInputBytes* self,
                               GError** error)
{
	guint8 n = 0U;
	GError* _inner_error0_ = NULL;
	gsize result;
	g_return_val_if_fail (self != NULL, 0UL);
	n = g4_data_input_bytes_read_byte (self, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			gsize _tmp0_ = 0UL;
			g_propagate_error (error, _inner_error0_);
			return _tmp0_;
		} else {
			gsize _tmp1_ = 0UL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp1_;
		}
	}
	switch (n) {
		case 254:
		{
			guint16 _tmp2_ = 0U;
			_tmp2_ = g4_data_input_bytes_read_uint16 (self, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				if (_inner_error0_->domain == G_IO_ERROR) {
					gsize _tmp3_ = 0UL;
					g_propagate_error (error, _inner_error0_);
					return _tmp3_;
				} else {
					gsize _tmp4_ = 0UL;
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
					g_clear_error (&_inner_error0_);
					return _tmp4_;
				}
			}
			result = (gsize) _tmp2_;
			return result;
		}
		case 255:
		{
			guint32 _tmp5_ = 0U;
			_tmp5_ = g4_data_input_bytes_read_uint32 (self, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				if (_inner_error0_->domain == G_IO_ERROR) {
					gsize _tmp6_ = 0UL;
					g_propagate_error (error, _inner_error0_);
					return _tmp6_;
				} else {
					gsize _tmp7_ = 0UL;
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
					g_clear_error (&_inner_error0_);
					return _tmp7_;
				}
			}
			result = (gsize) _tmp5_;
			return result;
		}
		default:
		{
			result = (gsize) n;
			return result;
		}
	}
}

gchar*
g4_data_input_bytes_read_string (G4DataInputBytes* self,
                                 GError** error)
{
	gsize _tmp0_ = 0UL;
	gint size = 0;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gchar* _tmp15_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g4_data_input_bytes_read_size (self, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	size = (gint) _tmp0_;
	if (size < 0) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = (self->priv->_pos + size) < 0;
	}
	if (_tmp2_) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (self->priv->_pos + size) > self->priv->_length;
	}
	if (_tmp1_) {
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		GError* _tmp11_;
		GError* _tmp12_;
		_tmp3_ = g_strdup_printf ("%i", self->priv->_pos);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strdup_printf ("%i", size);
		_tmp6_ = _tmp5_;
		_tmp7_ = g_strdup_printf ("%i", self->priv->_length);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_strconcat ("Size:", _tmp4_, "+", _tmp6_, ">", _tmp8_, NULL);
		_tmp10_ = _tmp9_;
		_tmp11_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _tmp10_);
		_tmp12_ = _tmp11_;
		_g_free0 (_tmp10_);
		_g_free0 (_tmp8_);
		_g_free0 (_tmp6_);
		_g_free0 (_tmp4_);
		_inner_error0_ = _tmp12_;
		if (_inner_error0_->domain == G_IO_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	} else {
		if (size > 0) {
			gchar* value = NULL;
			guint8* _tmp13_;
			gint _tmp13__length1;
			gchar* _tmp14_;
			_tmp13_ = self->priv->_data;
			_tmp13__length1 = self->priv->_data_length1;
			_tmp14_ = g_strndup (((gchar*) _tmp13_) + self->priv->_pos, (gsize) size);
			value = _tmp14_;
			self->priv->_pos = self->priv->_pos + size;
			result = value;
			return result;
		}
	}
	_tmp15_ = g_strdup ("");
	result = _tmp15_;
	return result;
}

void
g4_data_input_bytes_reset (G4DataInputBytes* self)
{
	g_return_if_fail (self != NULL);
	self->priv->_pos = 0;
}

static void
g4_data_input_bytes_class_init (G4DataInputBytesClass * klass,
                                gpointer klass_data)
{
	g4_data_input_bytes_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &G4DataInputBytes_private_offset);
	G_OBJECT_CLASS (klass)->finalize = g4_data_input_bytes_finalize;
}

static void
g4_data_input_bytes_instance_init (G4DataInputBytes * self,
                                   gpointer klass)
{
	self->priv = g4_data_input_bytes_get_instance_private (self);
	self->priv->_pos = 0;
}

static void
g4_data_input_bytes_finalize (GObject * obj)
{
	G4DataInputBytes * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_DATA_INPUT_BYTES, G4DataInputBytes);
	_g_bytes_unref0 (self->priv->_bytes);
	G_OBJECT_CLASS (g4_data_input_bytes_parent_class)->finalize (obj);
}

static GType
g4_data_input_bytes_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4DataInputBytesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_data_input_bytes_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4DataInputBytes), 0, (GInstanceInitFunc) g4_data_input_bytes_instance_init, NULL };
	GType g4_data_input_bytes_type_id;
	g4_data_input_bytes_type_id = g_type_register_static (G_TYPE_OBJECT, "G4DataInputBytes", &g_define_type_info, 0);
	G4DataInputBytes_private_offset = g_type_add_instance_private (g4_data_input_bytes_type_id, sizeof (G4DataInputBytesPrivate));
	return g4_data_input_bytes_type_id;
}

GType
g4_data_input_bytes_get_type (void)
{
	static volatile gsize g4_data_input_bytes_type_id__once = 0;
	if (g_once_init_enter (&g4_data_input_bytes_type_id__once)) {
		GType g4_data_input_bytes_type_id;
		g4_data_input_bytes_type_id = g4_data_input_bytes_get_type_once ();
		g_once_init_leave (&g4_data_input_bytes_type_id__once, g4_data_input_bytes_type_id);
	}
	return g4_data_input_bytes_type_id__once;
}

static inline gpointer
g4_data_output_bytes_get_instance_private (G4DataOutputBytes* self)
{
	return G_STRUCT_MEMBER_P (self, G4DataOutputBytes_private_offset);
}

G4DataOutputBytes*
g4_data_output_bytes_construct (GType object_type,
                                guint reserved_size)
{
	G4DataOutputBytes * self = NULL;
	GByteArray* _tmp0_;
	self = (G4DataOutputBytes*) g_object_new (object_type, NULL);
	_tmp0_ = g_byte_array_sized_new (reserved_size);
	_g_byte_array_unref0 (self->priv->_bytes);
	self->priv->_bytes = _tmp0_;
	return self;
}

G4DataOutputBytes*
g4_data_output_bytes_new (guint reserved_size)
{
	return g4_data_output_bytes_construct (G4_TYPE_DATA_OUTPUT_BYTES, reserved_size);
}

inline void
g4_data_output_bytes_write_byte (G4DataOutputBytes* self,
                                 guint8 n)
{
	guint8* _tmp0_;
	gint _tmp0__length1;
	GByteArray* _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_data;
	_tmp0__length1 = self->priv->_data_length1;
	_tmp0_[0] = n;
	_tmp1_ = self->priv->_bytes;
	_tmp2_ = self->priv->_data;
	_tmp2__length1 = self->priv->_data_length1;
	g_byte_array_append (_tmp1_, _tmp2_ + 0, (gint) (1 - 0));
}

inline void
g4_data_output_bytes_write_uint16 (G4DataOutputBytes* self,
                                   guint16 n)
{
	guint8* _tmp0_;
	gint _tmp0__length1;
	guint8* _tmp1_;
	gint _tmp1__length1;
	GByteArray* _tmp2_;
	guint8* _tmp3_;
	gint _tmp3__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_data;
	_tmp0__length1 = self->priv->_data_length1;
	_tmp0_[0] = (guint8) (n >> 8);
	_tmp1_ = self->priv->_data;
	_tmp1__length1 = self->priv->_data_length1;
	_tmp1_[1] = (guint8) n;
	_tmp2_ = self->priv->_bytes;
	_tmp3_ = self->priv->_data;
	_tmp3__length1 = self->priv->_data_length1;
	g_byte_array_append (_tmp2_, _tmp3_ + 0, (gint) (2 - 0));
}

inline void
g4_data_output_bytes_write_uint32 (G4DataOutputBytes* self,
                                   guint32 n)
{
	guint8* _tmp0_;
	gint _tmp0__length1;
	guint8* _tmp1_;
	gint _tmp1__length1;
	guint8* _tmp2_;
	gint _tmp2__length1;
	guint8* _tmp3_;
	gint _tmp3__length1;
	GByteArray* _tmp4_;
	guint8* _tmp5_;
	gint _tmp5__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_data;
	_tmp0__length1 = self->priv->_data_length1;
	_tmp0_[0] = (guint8) (n >> 24);
	_tmp1_ = self->priv->_data;
	_tmp1__length1 = self->priv->_data_length1;
	_tmp1_[1] = (guint8) (n >> 16);
	_tmp2_ = self->priv->_data;
	_tmp2__length1 = self->priv->_data_length1;
	_tmp2_[2] = (guint8) (n >> 8);
	_tmp3_ = self->priv->_data;
	_tmp3__length1 = self->priv->_data_length1;
	_tmp3_[3] = (guint8) n;
	_tmp4_ = self->priv->_bytes;
	_tmp5_ = self->priv->_data;
	_tmp5__length1 = self->priv->_data_length1;
	g_byte_array_append (_tmp4_, _tmp5_ + 0, (gint) (4 - 0));
}

inline void
g4_data_output_bytes_write_uint64 (G4DataOutputBytes* self,
                                   guint64 n)
{
	guint32 hi = 0U;
	guint32 lo = 0U;
	g_return_if_fail (self != NULL);
	hi = (guint32) (n >> 32);
	lo = (guint32) n;
	g4_data_output_bytes_write_uint32 (self, hi);
	g4_data_output_bytes_write_uint32 (self, lo);
}

void
g4_data_output_bytes_write_size (G4DataOutputBytes* self,
                                 gsize n)
{
	g_return_if_fail (self != NULL);
	if (n < ((gsize) 254)) {
		g4_data_output_bytes_write_byte (self, (guint8) n);
	} else {
		if (n <= ((gsize) 0xffff)) {
			g4_data_output_bytes_write_byte (self, (guint8) 254);
			g4_data_output_bytes_write_uint16 (self, (guint16) n);
		} else {
			g4_data_output_bytes_write_byte (self, (guint8) 255);
			g4_data_output_bytes_write_uint32 (self, (guint32) n);
		}
	}
}

void
g4_data_output_bytes_write_string (G4DataOutputBytes* self,
                                   const gchar* str)
{
	gsize size = 0UL;
	gint _tmp0_;
	gint _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (str != NULL);
	_tmp0_ = strlen (str);
	_tmp1_ = _tmp0_;
	size = (gsize) _tmp1_;
	g4_data_output_bytes_write_size (self, size);
	if (size > ((gsize) 0)) {
		guint8* data = NULL;
		gint data_length1;
		gint _data_size_;
		GByteArray* _tmp2_;
		guint8* _tmp3_;
		gint _tmp3__length1;
		data = (guint8*) str;
		data_length1 = -1;
		_data_size_ = data_length1;
		_tmp2_ = self->priv->_bytes;
		_tmp3_ = data;
		_tmp3__length1 = data_length1;
		g_byte_array_append (_tmp2_, _tmp3_ + 0, (gint) (((gint) size) - 0));
	}
}

gboolean
g4_data_output_bytes_write_to (G4DataOutputBytes* self,
                               GOutputStream* stream,
                               GError** error)
{
	gsize bytes_written = 0UL;
	gboolean _tmp0_ = FALSE;
	GByteArray* _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	gsize _tmp3_ = 0UL;
	gboolean _tmp4_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (stream != NULL, FALSE);
	bytes_written = (gsize) 0;
	_tmp1_ = self->priv->_bytes;
	_tmp2_ = _tmp1_->data;
	_tmp2__length1 = _tmp1_->len;
	_tmp4_ = g_output_stream_write_all (stream, _tmp2_, (gsize) _tmp2__length1, &_tmp3_, NULL, &_inner_error0_);
	bytes_written = _tmp3_;
	_tmp0_ = _tmp4_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == G_IO_ERROR) {
			gboolean _tmp5_ = FALSE;
			g_propagate_error (error, _inner_error0_);
			return _tmp5_;
		} else {
			gboolean _tmp6_ = FALSE;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp6_;
		}
	}
	result = _tmp0_;
	return result;
}

static void
g4_data_output_bytes_class_init (G4DataOutputBytesClass * klass,
                                 gpointer klass_data)
{
	g4_data_output_bytes_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &G4DataOutputBytes_private_offset);
	G_OBJECT_CLASS (klass)->finalize = g4_data_output_bytes_finalize;
}

static void
g4_data_output_bytes_instance_init (G4DataOutputBytes * self,
                                    gpointer klass)
{
	guint8* _tmp0_;
	self->priv = g4_data_output_bytes_get_instance_private (self);
	_tmp0_ = g_new0 (guint8, 4);
	self->priv->_data = _tmp0_;
	self->priv->_data_length1 = 4;
	self->priv->__data_size_ = self->priv->_data_length1;
}

static void
g4_data_output_bytes_finalize (GObject * obj)
{
	G4DataOutputBytes * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_DATA_OUTPUT_BYTES, G4DataOutputBytes);
	_g_byte_array_unref0 (self->priv->_bytes);
	self->priv->_data = (g_free (self->priv->_data), NULL);
	G_OBJECT_CLASS (g4_data_output_bytes_parent_class)->finalize (obj);
}

static GType
g4_data_output_bytes_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4DataOutputBytesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_data_output_bytes_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4DataOutputBytes), 0, (GInstanceInitFunc) g4_data_output_bytes_instance_init, NULL };
	GType g4_data_output_bytes_type_id;
	g4_data_output_bytes_type_id = g_type_register_static (G_TYPE_OBJECT, "G4DataOutputBytes", &g_define_type_info, 0);
	G4DataOutputBytes_private_offset = g_type_add_instance_private (g4_data_output_bytes_type_id, sizeof (G4DataOutputBytesPrivate));
	return g4_data_output_bytes_type_id;
}

GType
g4_data_output_bytes_get_type (void)
{
	static volatile gsize g4_data_output_bytes_type_id__once = 0;
	if (g_once_init_enter (&g4_data_output_bytes_type_id__once)) {
		GType g4_data_output_bytes_type_id;
		g4_data_output_bytes_type_id = g4_data_output_bytes_get_type_once ();
		g_once_init_leave (&g4_data_output_bytes_type_id__once, g4_data_output_bytes_type_id);
	}
	return g4_data_output_bytes_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

