/* GdefTable.c generated by valac 0.56.17, the Vala compiler
 * generated from GdefTable.vala, do not modify */

/*
Copyright (C) 2012, 2013 Johan Mattsson

This library is free software; you can redistribute it and/or modify 
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation; either version 3 of the 
License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but 
WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
Lesser General Public License for more details.
*/

#include "birdfont.h"
#include <glib.h>
#include <glib-object.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

enum  {
	BIRD_FONT_GDEF_TABLE_0_PROPERTY,
	BIRD_FONT_GDEF_TABLE_NUM_PROPERTIES
};
static GParamSpec* bird_font_gdef_table_properties[BIRD_FONT_GDEF_TABLE_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

static gpointer bird_font_gdef_table_parent_class = NULL;

static void bird_font_gdef_table_real_parse (BirdFontOtfTable* base,
                                      BirdFontFontData* dis,
                                      GError** error);
static GType bird_font_gdef_table_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

BirdFontGdefTable*
bird_font_gdef_table_construct (GType object_type)
{
	BirdFontGdefTable * self = NULL;
	gchar* _tmp0_;
	self = (BirdFontGdefTable*) bird_font_otf_table_construct (object_type);
	_tmp0_ = g_strdup ("GDEF");
	_g_free0 (((BirdFontOtfTable*) self)->id);
	((BirdFontOtfTable*) self)->id = _tmp0_;
	return self;
}

BirdFontGdefTable*
bird_font_gdef_table_new (void)
{
	return bird_font_gdef_table_construct (BIRD_FONT_TYPE_GDEF_TABLE);
}

static void
bird_font_gdef_table_real_parse (BirdFontOtfTable* base,
                                 BirdFontFontData* dis,
                                 GError** error)
{
	BirdFontGdefTable * self;
	self = (BirdFontGdefTable*) base;
	g_return_if_fail (dis != NULL);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

void
bird_font_gdef_table_process (BirdFontGdefTable* self,
                              GError** error)
{
	BirdFontFontData* fd = NULL;
	BirdFontFontData* _tmp0_;
	BirdFontFontData* _tmp1_;
	BirdFontFontData* _tmp2_;
	BirdFontFontData* _tmp3_;
	BirdFontFontData* _tmp4_;
	BirdFontFontData* _tmp5_;
	BirdFontFontData* _tmp6_;
	BirdFontFontData* _tmp7_;
	BirdFontFontData* _tmp8_;
	BirdFontFontData* _tmp9_;
	BirdFontFontData* _tmp10_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = bird_font_font_data_new ((guint32) 1024);
	fd = _tmp0_;
	_tmp1_ = fd;
	bird_font_font_data_add_ulong (_tmp1_, (guint32) 0x00010002, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (fd);
		return;
	}
	_tmp2_ = fd;
	bird_font_font_data_add_ushort (_tmp2_, (guint16) 0, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (fd);
		return;
	}
	_tmp3_ = fd;
	bird_font_font_data_add_ushort (_tmp3_, (guint16) 0, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (fd);
		return;
	}
	_tmp4_ = fd;
	bird_font_font_data_add_ushort (_tmp4_, (guint16) 0, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (fd);
		return;
	}
	_tmp5_ = fd;
	bird_font_font_data_add_ushort (_tmp5_, (guint16) 0, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (fd);
		return;
	}
	_tmp6_ = fd;
	bird_font_font_data_add_ushort (_tmp6_, (guint16) 0, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (fd);
		return;
	}
	_tmp7_ = fd;
	bird_font_font_data_add_ushort (_tmp7_, (guint16) 0, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (fd);
		return;
	}
	_tmp8_ = fd;
	bird_font_font_data_pad (_tmp8_);
	_tmp9_ = fd;
	_tmp10_ = _g_object_ref0 (_tmp9_);
	_g_object_unref0 (((BirdFontOtfTable*) self)->font_data);
	((BirdFontOtfTable*) self)->font_data = _tmp10_;
	_g_object_unref0 (fd);
}

static void
bird_font_gdef_table_class_init (BirdFontGdefTableClass * klass,
                                 gpointer klass_data)
{
	bird_font_gdef_table_parent_class = g_type_class_peek_parent (klass);
	((BirdFontOtfTableClass *) klass)->parse = (void (*) (BirdFontOtfTable*, BirdFontFontData*, GError**)) bird_font_gdef_table_real_parse;
}

static void
bird_font_gdef_table_instance_init (BirdFontGdefTable * self,
                                    gpointer klass)
{
}

static GType
bird_font_gdef_table_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontGdefTableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_gdef_table_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdFontGdefTable), 0, (GInstanceInitFunc) bird_font_gdef_table_instance_init, NULL };
	GType bird_font_gdef_table_type_id;
	bird_font_gdef_table_type_id = g_type_register_static (BIRD_FONT_TYPE_OTF_TABLE, "BirdFontGdefTable", &g_define_type_info, 0);
	return bird_font_gdef_table_type_id;
}

GType
bird_font_gdef_table_get_type (void)
{
	static volatile gsize bird_font_gdef_table_type_id__once = 0;
	if (g_once_init_enter (&bird_font_gdef_table_type_id__once)) {
		GType bird_font_gdef_table_type_id;
		bird_font_gdef_table_type_id = bird_font_gdef_table_get_type_once ();
		g_once_init_leave (&bird_font_gdef_table_type_id__once, bird_font_gdef_table_type_id);
	}
	return bird_font_gdef_table_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;
}

