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

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

#define DINO_PLUGINS_OMEMO_TYPE_BACKED_SIGNED_PRE_KEY_STORE (dino_plugins_omemo_backed_signed_pre_key_store_get_type ())
#define DINO_PLUGINS_OMEMO_BACKED_SIGNED_PRE_KEY_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_PLUGINS_OMEMO_TYPE_BACKED_SIGNED_PRE_KEY_STORE, DinoPluginsOmemoBackedSignedPreKeyStore))
#define DINO_PLUGINS_OMEMO_BACKED_SIGNED_PRE_KEY_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_PLUGINS_OMEMO_TYPE_BACKED_SIGNED_PRE_KEY_STORE, DinoPluginsOmemoBackedSignedPreKeyStoreClass))
#define DINO_PLUGINS_OMEMO_IS_BACKED_SIGNED_PRE_KEY_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_PLUGINS_OMEMO_TYPE_BACKED_SIGNED_PRE_KEY_STORE))
#define DINO_PLUGINS_OMEMO_IS_BACKED_SIGNED_PRE_KEY_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_PLUGINS_OMEMO_TYPE_BACKED_SIGNED_PRE_KEY_STORE))
#define DINO_PLUGINS_OMEMO_BACKED_SIGNED_PRE_KEY_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_PLUGINS_OMEMO_TYPE_BACKED_SIGNED_PRE_KEY_STORE, DinoPluginsOmemoBackedSignedPreKeyStoreClass))

typedef struct _DinoPluginsOmemoBackedSignedPreKeyStore DinoPluginsOmemoBackedSignedPreKeyStore;
typedef struct _DinoPluginsOmemoBackedSignedPreKeyStoreClass DinoPluginsOmemoBackedSignedPreKeyStoreClass;
typedef struct _DinoPluginsOmemoBackedSignedPreKeyStorePrivate DinoPluginsOmemoBackedSignedPreKeyStorePrivate;
enum  {
	DINO_PLUGINS_OMEMO_BACKED_SIGNED_PRE_KEY_STORE_0_PROPERTY,
	DINO_PLUGINS_OMEMO_BACKED_SIGNED_PRE_KEY_STORE_NUM_PROPERTIES
};
static GParamSpec* dino_plugins_omemo_backed_signed_pre_key_store_properties[DINO_PLUGINS_OMEMO_BACKED_SIGNED_PRE_KEY_STORE_NUM_PROPERTIES];
#define _qlite_database_unref0(var) ((var == NULL) ? NULL : (var = (qlite_database_unref (var), NULL)))
#define _qlite_statement_builder_unref0(var) ((var == NULL) ? NULL : (var = (qlite_statement_builder_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _qlite_row_unref0(var) ((var == NULL) ? NULL : (var = (qlite_row_unref (var), NULL)))
#define _qlite_row_iterator_unref0(var) ((var == NULL) ? NULL : (var = (qlite_row_iterator_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _DinoPluginsOmemoBackedSignedPreKeyStore {
	OmemoSimpleSignedPreKeyStore parent_instance;
	DinoPluginsOmemoBackedSignedPreKeyStorePrivate * priv;
};

struct _DinoPluginsOmemoBackedSignedPreKeyStoreClass {
	OmemoSimpleSignedPreKeyStoreClass parent_class;
};

struct _DinoPluginsOmemoBackedSignedPreKeyStorePrivate {
	DinoPluginsOmemoDatabase* db;
	gint identity_id;
};

static gint DinoPluginsOmemoBackedSignedPreKeyStore_private_offset;
static gpointer dino_plugins_omemo_backed_signed_pre_key_store_parent_class = NULL;

VALA_EXTERN GType dino_plugins_omemo_backed_signed_pre_key_store_get_type (void) G_GNUC_CONST ;
VALA_EXTERN DinoPluginsOmemoBackedSignedPreKeyStore* dino_plugins_omemo_backed_signed_pre_key_store_new (DinoPluginsOmemoDatabase* db,
                                                                                             gint identity_id);
VALA_EXTERN DinoPluginsOmemoBackedSignedPreKeyStore* dino_plugins_omemo_backed_signed_pre_key_store_construct (GType object_type,
                                                                                                   DinoPluginsOmemoDatabase* db,
                                                                                                   gint identity_id);
static void dino_plugins_omemo_backed_signed_pre_key_store_init (DinoPluginsOmemoBackedSignedPreKeyStore* self);
VALA_EXTERN void dino_plugins_omemo_backed_signed_pre_key_store_on_signed_pre_key_stored (DinoPluginsOmemoBackedSignedPreKeyStore* self,
                                                                              OmemoSignedPreKeyStoreKey* key);
static void _dino_plugins_omemo_backed_signed_pre_key_store_on_signed_pre_key_stored_omemo_signed_pre_key_store_signed_pre_key_stored (OmemoSignedPreKeyStore* _sender,
                                                                                                                                OmemoSignedPreKeyStoreKey* key,
                                                                                                                                gpointer self);
VALA_EXTERN void dino_plugins_omemo_backed_signed_pre_key_store_on_signed_pre_key_deleted (DinoPluginsOmemoBackedSignedPreKeyStore* self,
                                                                               OmemoSignedPreKeyStoreKey* key);
static void _dino_plugins_omemo_backed_signed_pre_key_store_on_signed_pre_key_deleted_omemo_signed_pre_key_store_signed_pre_key_deleted (OmemoSignedPreKeyStore* _sender,
                                                                                                                                  OmemoSignedPreKeyStoreKey* key,
                                                                                                                                  gpointer self);
static void dino_plugins_omemo_backed_signed_pre_key_store_finalize (GObject * obj);
static GType dino_plugins_omemo_backed_signed_pre_key_store_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_plugins_omemo_backed_signed_pre_key_store_get_instance_private (DinoPluginsOmemoBackedSignedPreKeyStore* self)
{
	return G_STRUCT_MEMBER_P (self, DinoPluginsOmemoBackedSignedPreKeyStore_private_offset);
}

static gpointer
_qlite_database_ref0 (gpointer self)
{
	return self ? qlite_database_ref (self) : NULL;
}

DinoPluginsOmemoBackedSignedPreKeyStore*
dino_plugins_omemo_backed_signed_pre_key_store_construct (GType object_type,
                                                          DinoPluginsOmemoDatabase* db,
                                                          gint identity_id)
{
	DinoPluginsOmemoBackedSignedPreKeyStore * self = NULL;
	DinoPluginsOmemoDatabase* _tmp0_;
	g_return_val_if_fail (db != NULL, NULL);
	self = (DinoPluginsOmemoBackedSignedPreKeyStore*) omemo_simple_signed_pre_key_store_construct (object_type);
	_tmp0_ = _qlite_database_ref0 (db);
	_qlite_database_unref0 (self->priv->db);
	self->priv->db = _tmp0_;
	self->priv->identity_id = identity_id;
	dino_plugins_omemo_backed_signed_pre_key_store_init (self);
	return self;
}

DinoPluginsOmemoBackedSignedPreKeyStore*
dino_plugins_omemo_backed_signed_pre_key_store_new (DinoPluginsOmemoDatabase* db,
                                                    gint identity_id)
{
	return dino_plugins_omemo_backed_signed_pre_key_store_construct (DINO_PLUGINS_OMEMO_TYPE_BACKED_SIGNED_PRE_KEY_STORE, db, identity_id);
}

static void
_dino_plugins_omemo_backed_signed_pre_key_store_on_signed_pre_key_stored_omemo_signed_pre_key_store_signed_pre_key_stored (OmemoSignedPreKeyStore* _sender,
                                                                                                                           OmemoSignedPreKeyStoreKey* key,
                                                                                                                           gpointer self)
{
	dino_plugins_omemo_backed_signed_pre_key_store_on_signed_pre_key_stored ((DinoPluginsOmemoBackedSignedPreKeyStore*) self, key);
}

static void
_dino_plugins_omemo_backed_signed_pre_key_store_on_signed_pre_key_deleted_omemo_signed_pre_key_store_signed_pre_key_deleted (OmemoSignedPreKeyStore* _sender,
                                                                                                                             OmemoSignedPreKeyStoreKey* key,
                                                                                                                             gpointer self)
{
	dino_plugins_omemo_backed_signed_pre_key_store_on_signed_pre_key_deleted ((DinoPluginsOmemoBackedSignedPreKeyStore*) self, key);
}

static void
dino_plugins_omemo_backed_signed_pre_key_store_init (DinoPluginsOmemoBackedSignedPreKeyStore* self)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		{
			QliteRowIterator* _row_it = NULL;
			DinoPluginsOmemoDatabase* _tmp0_;
			DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp1_;
			DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp2_;
			QliteQueryBuilder* _tmp3_;
			QliteQueryBuilder* _tmp4_;
			DinoPluginsOmemoDatabase* _tmp5_;
			DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp6_;
			DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp7_;
			QliteColumn* _tmp8_;
			QliteQueryBuilder* _tmp9_;
			QliteQueryBuilder* _tmp10_;
			QliteRowIterator* _tmp11_;
			QliteRowIterator* _tmp12_;
			_tmp0_ = self->priv->db;
			_tmp1_ = dino_plugins_omemo_database_get_signed_pre_key (_tmp0_);
			_tmp2_ = _tmp1_;
			_tmp3_ = qlite_table_select ((QliteTable*) _tmp2_, NULL, (gint) 0);
			_tmp4_ = _tmp3_;
			_tmp5_ = self->priv->db;
			_tmp6_ = dino_plugins_omemo_database_get_signed_pre_key (_tmp5_);
			_tmp7_ = _tmp6_;
			_tmp8_ = _tmp7_->identity_id;
			_tmp9_ = qlite_query_builder_with (_tmp4_, G_TYPE_INT, NULL, NULL, _tmp8_, "=", (gpointer) ((gintptr) self->priv->identity_id));
			_tmp10_ = _tmp9_;
			_tmp11_ = qlite_query_builder_iterator (_tmp10_);
			_tmp12_ = _tmp11_;
			_qlite_statement_builder_unref0 (_tmp10_);
			_qlite_statement_builder_unref0 (_tmp4_);
			_row_it = _tmp12_;
			while (TRUE) {
				QliteRowIterator* _tmp13_;
				QliteRow* row = NULL;
				QliteRowIterator* _tmp14_;
				QliteRow* _tmp15_;
				QliteRow* _tmp16_;
				DinoPluginsOmemoDatabase* _tmp17_;
				DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp18_;
				DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp19_;
				QliteColumn* _tmp20_;
				gpointer _tmp21_;
				QliteRow* _tmp22_;
				DinoPluginsOmemoDatabase* _tmp23_;
				DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp24_;
				DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp25_;
				QliteColumn* _tmp26_;
				gpointer _tmp27_;
				gchar* _tmp28_;
				gsize _tmp29_ = 0;
				guchar* _tmp30_;
				guchar* _tmp31_;
				gint _tmp31__length1;
				_tmp13_ = _row_it;
				if (!qlite_row_iterator_next (_tmp13_)) {
					break;
				}
				_tmp14_ = _row_it;
				_tmp15_ = qlite_row_iterator_get (_tmp14_);
				row = _tmp15_;
				_tmp16_ = row;
				_tmp17_ = self->priv->db;
				_tmp18_ = dino_plugins_omemo_database_get_signed_pre_key (_tmp17_);
				_tmp19_ = _tmp18_;
				_tmp20_ = _tmp19_->signed_pre_key_id;
				_tmp21_ = qlite_row_get (_tmp16_, G_TYPE_INT, NULL, NULL, _tmp20_);
				_tmp22_ = row;
				_tmp23_ = self->priv->db;
				_tmp24_ = dino_plugins_omemo_database_get_signed_pre_key (_tmp23_);
				_tmp25_ = _tmp24_;
				_tmp26_ = _tmp25_->record_base64;
				_tmp27_ = qlite_row_get (_tmp22_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp26_);
				_tmp28_ = (gchar*) _tmp27_;
				_tmp30_ = g_base64_decode (_tmp28_, &_tmp29_);
				_tmp31_ = _tmp30_;
				_tmp31__length1 = _tmp29_;
				omemo_signed_pre_key_store_store_signed_pre_key ((OmemoSignedPreKeyStore*) self, (guint32) ((gint) ((gintptr) _tmp21_)), _tmp31_, (gint) _tmp29_, &_inner_error0_);
				_tmp31_ = (g_free (_tmp31_), NULL);
				_g_free0 (_tmp28_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					_qlite_row_unref0 (row);
					_qlite_row_iterator_unref0 (_row_it);
					goto __catch0_g_error;
				}
				_qlite_row_unref0 (row);
			}
			_qlite_row_iterator_unref0 (_row_it);
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp32_;
		const gchar* _tmp33_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp32_ = e;
		_tmp33_ = _tmp32_->message;
		g_print ("Error while initializing signed pre key store: %s", _tmp33_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
	g_signal_connect_object ((OmemoSignedPreKeyStore*) self, "signed-pre-key-stored", (GCallback) _dino_plugins_omemo_backed_signed_pre_key_store_on_signed_pre_key_stored_omemo_signed_pre_key_store_signed_pre_key_stored, self, 0);
	g_signal_connect_object ((OmemoSignedPreKeyStore*) self, "signed-pre-key-deleted", (GCallback) _dino_plugins_omemo_backed_signed_pre_key_store_on_signed_pre_key_deleted_omemo_signed_pre_key_store_signed_pre_key_deleted, self, 0);
}

void
dino_plugins_omemo_backed_signed_pre_key_store_on_signed_pre_key_stored (DinoPluginsOmemoBackedSignedPreKeyStore* self,
                                                                         OmemoSignedPreKeyStoreKey* key)
{
	DinoPluginsOmemoDatabase* _tmp0_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp1_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp2_;
	QliteUpsertBuilder* _tmp3_;
	QliteUpsertBuilder* _tmp4_;
	DinoPluginsOmemoDatabase* _tmp5_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp6_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp7_;
	QliteColumn* _tmp8_;
	QliteUpsertBuilder* _tmp9_;
	QliteUpsertBuilder* _tmp10_;
	DinoPluginsOmemoDatabase* _tmp11_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp12_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp13_;
	QliteColumn* _tmp14_;
	guint32 _tmp15_;
	guint32 _tmp16_;
	QliteUpsertBuilder* _tmp17_;
	QliteUpsertBuilder* _tmp18_;
	DinoPluginsOmemoDatabase* _tmp19_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp20_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp21_;
	QliteColumn* _tmp22_;
	guint8* _tmp23_;
	gint _tmp23__length1;
	gint _tmp24_ = 0;
	guint8* _tmp25_;
	gint _tmp25__length1;
	gchar* _tmp26_;
	gchar* _tmp27_;
	QliteUpsertBuilder* _tmp28_;
	QliteUpsertBuilder* _tmp29_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = self->priv->db;
	_tmp1_ = dino_plugins_omemo_database_get_signed_pre_key (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = qlite_table_upsert ((QliteTable*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->db;
	_tmp6_ = dino_plugins_omemo_database_get_signed_pre_key (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_->identity_id;
	_tmp9_ = qlite_upsert_builder_value (_tmp4_, G_TYPE_INT, NULL, NULL, _tmp8_, (gpointer) ((gintptr) self->priv->identity_id), TRUE);
	_tmp10_ = _tmp9_;
	_tmp11_ = self->priv->db;
	_tmp12_ = dino_plugins_omemo_database_get_signed_pre_key (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = _tmp13_->signed_pre_key_id;
	_tmp15_ = omemo_signed_pre_key_store_key_get_key_id (key);
	_tmp16_ = _tmp15_;
	_tmp17_ = qlite_upsert_builder_value (_tmp10_, G_TYPE_INT, NULL, NULL, _tmp14_, (gpointer) ((gintptr) _tmp16_), TRUE);
	_tmp18_ = _tmp17_;
	_tmp19_ = self->priv->db;
	_tmp20_ = dino_plugins_omemo_database_get_signed_pre_key (_tmp19_);
	_tmp21_ = _tmp20_;
	_tmp22_ = _tmp21_->record_base64;
	_tmp23_ = omemo_signed_pre_key_store_key_get_record (key, &_tmp24_);
	_tmp23__length1 = _tmp24_;
	_tmp25_ = _tmp23_;
	_tmp25__length1 = _tmp23__length1;
	_tmp26_ = g_base64_encode (_tmp25_, (gint) _tmp25__length1);
	_tmp27_ = _tmp26_;
	_tmp28_ = qlite_upsert_builder_value (_tmp18_, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, _tmp22_, _tmp27_, FALSE);
	_tmp29_ = _tmp28_;
	qlite_upsert_builder_perform (_tmp29_);
	_qlite_statement_builder_unref0 (_tmp29_);
	_g_free0 (_tmp27_);
	_qlite_statement_builder_unref0 (_tmp18_);
	_qlite_statement_builder_unref0 (_tmp10_);
	_qlite_statement_builder_unref0 (_tmp4_);
}

void
dino_plugins_omemo_backed_signed_pre_key_store_on_signed_pre_key_deleted (DinoPluginsOmemoBackedSignedPreKeyStore* self,
                                                                          OmemoSignedPreKeyStoreKey* key)
{
	DinoPluginsOmemoDatabase* _tmp0_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp1_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp2_;
	QliteDeleteBuilder* _tmp3_;
	QliteDeleteBuilder* _tmp4_;
	DinoPluginsOmemoDatabase* _tmp5_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp6_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp7_;
	QliteColumn* _tmp8_;
	QliteDeleteBuilder* _tmp9_;
	QliteDeleteBuilder* _tmp10_;
	DinoPluginsOmemoDatabase* _tmp11_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp12_;
	DinoPluginsOmemoDatabaseSignedPreKeyTable* _tmp13_;
	QliteColumn* _tmp14_;
	guint32 _tmp15_;
	guint32 _tmp16_;
	QliteDeleteBuilder* _tmp17_;
	QliteDeleteBuilder* _tmp18_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (key != NULL);
	_tmp0_ = self->priv->db;
	_tmp1_ = dino_plugins_omemo_database_get_signed_pre_key (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = qlite_table_delete ((QliteTable*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->db;
	_tmp6_ = dino_plugins_omemo_database_get_signed_pre_key (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_->identity_id;
	_tmp9_ = qlite_delete_builder_with (_tmp4_, G_TYPE_INT, NULL, NULL, _tmp8_, "=", (gpointer) ((gintptr) self->priv->identity_id));
	_tmp10_ = _tmp9_;
	_tmp11_ = self->priv->db;
	_tmp12_ = dino_plugins_omemo_database_get_signed_pre_key (_tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = _tmp13_->signed_pre_key_id;
	_tmp15_ = omemo_signed_pre_key_store_key_get_key_id (key);
	_tmp16_ = _tmp15_;
	_tmp17_ = qlite_delete_builder_with (_tmp10_, G_TYPE_INT, NULL, NULL, _tmp14_, "=", (gpointer) ((gintptr) _tmp16_));
	_tmp18_ = _tmp17_;
	qlite_delete_builder_perform (_tmp18_);
	_qlite_statement_builder_unref0 (_tmp18_);
	_qlite_statement_builder_unref0 (_tmp10_);
	_qlite_statement_builder_unref0 (_tmp4_);
}

static void
dino_plugins_omemo_backed_signed_pre_key_store_class_init (DinoPluginsOmemoBackedSignedPreKeyStoreClass * klass,
                                                           gpointer klass_data)
{
	dino_plugins_omemo_backed_signed_pre_key_store_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoPluginsOmemoBackedSignedPreKeyStore_private_offset);
	G_OBJECT_CLASS (klass)->finalize = dino_plugins_omemo_backed_signed_pre_key_store_finalize;
}

static void
dino_plugins_omemo_backed_signed_pre_key_store_instance_init (DinoPluginsOmemoBackedSignedPreKeyStore * self,
                                                              gpointer klass)
{
	self->priv = dino_plugins_omemo_backed_signed_pre_key_store_get_instance_private (self);
}

static void
dino_plugins_omemo_backed_signed_pre_key_store_finalize (GObject * obj)
{
	DinoPluginsOmemoBackedSignedPreKeyStore * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_PLUGINS_OMEMO_TYPE_BACKED_SIGNED_PRE_KEY_STORE, DinoPluginsOmemoBackedSignedPreKeyStore);
	_qlite_database_unref0 (self->priv->db);
	G_OBJECT_CLASS (dino_plugins_omemo_backed_signed_pre_key_store_parent_class)->finalize (obj);
}

static GType
dino_plugins_omemo_backed_signed_pre_key_store_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoPluginsOmemoBackedSignedPreKeyStoreClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_plugins_omemo_backed_signed_pre_key_store_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPluginsOmemoBackedSignedPreKeyStore), 0, (GInstanceInitFunc) dino_plugins_omemo_backed_signed_pre_key_store_instance_init, NULL };
	GType dino_plugins_omemo_backed_signed_pre_key_store_type_id;
	dino_plugins_omemo_backed_signed_pre_key_store_type_id = g_type_register_static (OMEMO_TYPE_SIMPLE_SIGNED_PRE_KEY_STORE, "DinoPluginsOmemoBackedSignedPreKeyStore", &g_define_type_info, 0);
	DinoPluginsOmemoBackedSignedPreKeyStore_private_offset = g_type_add_instance_private (dino_plugins_omemo_backed_signed_pre_key_store_type_id, sizeof (DinoPluginsOmemoBackedSignedPreKeyStorePrivate));
	return dino_plugins_omemo_backed_signed_pre_key_store_type_id;
}

GType
dino_plugins_omemo_backed_signed_pre_key_store_get_type (void)
{
	static volatile gsize dino_plugins_omemo_backed_signed_pre_key_store_type_id__once = 0;
	if (g_once_init_enter (&dino_plugins_omemo_backed_signed_pre_key_store_type_id__once)) {
		GType dino_plugins_omemo_backed_signed_pre_key_store_type_id;
		dino_plugins_omemo_backed_signed_pre_key_store_type_id = dino_plugins_omemo_backed_signed_pre_key_store_get_type_once ();
		g_once_init_leave (&dino_plugins_omemo_backed_signed_pre_key_store_type_id__once, dino_plugins_omemo_backed_signed_pre_key_store_type_id);
	}
	return dino_plugins_omemo_backed_signed_pre_key_store_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;
}

