/* tracker-bus-fd-cursor.c generated by valac 0.56.3, the Vala compiler
 * generated from tracker-bus-fd-cursor.vala, do not modify */

/*
 * Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
 *
 * 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 2.1 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.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */

#include "libtracker-sparql/tracker-generated-no-checks.h"
#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include "tracker-bus.h"

#define TRACKER_BUS_TYPE_FD_CURSOR (tracker_bus_fd_cursor_get_type ())
#define TRACKER_BUS_FD_CURSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_BUS_TYPE_FD_CURSOR, TrackerBusFDCursor))
#define TRACKER_BUS_FD_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_BUS_TYPE_FD_CURSOR, TrackerBusFDCursorClass))
#define TRACKER_BUS_IS_FD_CURSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_BUS_TYPE_FD_CURSOR))
#define TRACKER_BUS_IS_FD_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_BUS_TYPE_FD_CURSOR))
#define TRACKER_BUS_FD_CURSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_BUS_TYPE_FD_CURSOR, TrackerBusFDCursorClass))

typedef struct _TrackerBusFDCursor TrackerBusFDCursor;
typedef struct _TrackerBusFDCursorClass TrackerBusFDCursorClass;
typedef struct _TrackerBusFDCursorPrivate TrackerBusFDCursorPrivate;
enum  {
	TRACKER_BUS_FD_CURSOR_0_PROPERTY,
	TRACKER_BUS_FD_CURSOR_N_COLUMNS_PROPERTY,
	TRACKER_BUS_FD_CURSOR_NUM_PROPERTIES
};
static GParamSpec* tracker_bus_fd_cursor_properties[TRACKER_BUS_FD_CURSOR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _TrackerBusFdCursorNextAsyncData TrackerBusFdCursorNextAsyncData;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _TrackerBusFDCursor {
	TrackerSparqlCursor parent_instance;
	TrackerBusFDCursorPrivate * priv;
	gchar* buffer;
	gulong buffer_index;
	gulong buffer_size;
	gint _n_columns;
	gint* offsets;
	gint* types;
	gchar* data;
	gchar** variable_names;
	gint variable_names_length1;
	gint _variable_names_size_;
	gboolean cursor_finished;
};

struct _TrackerBusFDCursorClass {
	TrackerSparqlCursorClass parent_class;
};

struct _TrackerBusFdCursorNextAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	TrackerBusFDCursor* self;
	GCancellable* cancellable;
	gboolean result;
	gboolean _tmp0_;
	GError* _inner_error0_;
};

static gpointer tracker_bus_fd_cursor_parent_class = NULL;

VALA_EXTERN GType tracker_bus_fd_cursor_get_type (void) G_GNUC_CONST ;
VALA_EXTERN TrackerBusFDCursor* tracker_bus_fd_cursor_new (gchar* buffer,
                                               gulong buffer_size,
                                               gchar** variable_names,
                                               gint variable_names_length1);
VALA_EXTERN TrackerBusFDCursor* tracker_bus_fd_cursor_construct (GType object_type,
                                                     gchar* buffer,
                                                     gulong buffer_size,
                                                     gchar** variable_names,
                                                     gint variable_names_length1);
static gchar** _vala_array_dup3 (gchar** self,
                          gssize length);
static inline gint tracker_bus_fd_cursor_buffer_read_int (TrackerBusFDCursor* self);
static TrackerSparqlValueType tracker_bus_fd_cursor_real_get_value_type (TrackerSparqlCursor* base,
                                                                  gint column);
static const gchar* tracker_bus_fd_cursor_real_get_variable_name (TrackerSparqlCursor* base,
                                                           gint column);
static const gchar* tracker_bus_fd_cursor_real_get_string (TrackerSparqlCursor* base,
                                                    gint column,
                                                    glong* length);
static gboolean tracker_bus_fd_cursor_real_next (TrackerSparqlCursor* base,
                                          GCancellable* cancellable,
                                          GError** error);
static void tracker_bus_fd_cursor_real_next_async_data_free (gpointer _data);
static void tracker_bus_fd_cursor_real_next_async (TrackerSparqlCursor* base,
                                            GCancellable* cancellable,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static gboolean tracker_bus_fd_cursor_real_next_async_co (TrackerBusFdCursorNextAsyncData* _data_);
static void tracker_bus_fd_cursor_real_rewind (TrackerSparqlCursor* base);
static void tracker_bus_fd_cursor_finalize (GObject * obj);
static GType tracker_bus_fd_cursor_get_type_once (void);
static void _vala_tracker_bus_fd_cursor_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static gchar**
_vala_array_dup3 (gchar** self,
                  gssize length)
{
#line 35 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (length >= 0) {
#line 140 "tracker-bus-fd-cursor.c"
		gchar** result;
		gssize i;
#line 35 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		result = g_new0 (gchar*, length + 1);
#line 35 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		for (i = 0; i < length; i++) {
#line 147 "tracker-bus-fd-cursor.c"
			gchar* _tmp0_;
#line 35 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
			_tmp0_ = g_strdup (self[i]);
#line 35 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
			result[i] = _tmp0_;
#line 153 "tracker-bus-fd-cursor.c"
		}
#line 35 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		return result;
#line 157 "tracker-bus-fd-cursor.c"
	}
#line 35 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return NULL;
#line 161 "tracker-bus-fd-cursor.c"
}

TrackerBusFDCursor*
tracker_bus_fd_cursor_construct (GType object_type,
                                 gchar* buffer,
                                 gulong buffer_size,
                                 gchar** variable_names,
                                 gint variable_names_length1)
{
	TrackerBusFDCursor * self = NULL;
	gchar** _tmp0_;
	gint _tmp0__length1;
#line 32 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self = (TrackerBusFDCursor*) tracker_sparql_cursor_construct (object_type);
#line 33 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->buffer = buffer;
#line 34 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->buffer_size = buffer_size;
#line 35 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp0_ = (variable_names != NULL) ? _vala_array_dup3 (variable_names, variable_names_length1) : variable_names;
#line 35 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp0__length1 = variable_names_length1;
#line 35 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->variable_names = (_vala_array_free (self->variable_names, self->variable_names_length1, (GDestroyNotify) g_free), NULL);
#line 35 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->variable_names = _tmp0_;
#line 35 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->variable_names_length1 = _tmp0__length1;
#line 35 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->_variable_names_size_ = self->variable_names_length1;
#line 36 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->cursor_finished = TRUE;
#line 37 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->_n_columns = variable_names_length1;
#line 32 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return self;
#line 198 "tracker-bus-fd-cursor.c"
}

TrackerBusFDCursor*
tracker_bus_fd_cursor_new (gchar* buffer,
                           gulong buffer_size,
                           gchar** variable_names,
                           gint variable_names_length1)
{
#line 32 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return tracker_bus_fd_cursor_construct (TRACKER_BUS_TYPE_FD_CURSOR, buffer, buffer_size, variable_names, variable_names_length1);
#line 209 "tracker-bus-fd-cursor.c"
}

static inline gint
tracker_bus_fd_cursor_buffer_read_int (TrackerBusFDCursor* self)
{
	gint v = 0;
	gchar* _tmp0_;
	gint result;
#line 44 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	g_return_val_if_fail (self != NULL, 0);
#line 45 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp0_ = self->buffer;
#line 45 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	v = *((gint*) (_tmp0_ + self->buffer_index));
#line 47 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->buffer_index = self->buffer_index + 4;
#line 49 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	result = v;
#line 49 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return result;
#line 230 "tracker-bus-fd-cursor.c"
}

static TrackerSparqlValueType
tracker_bus_fd_cursor_real_get_value_type (TrackerSparqlCursor* base,
                                           gint column)
{
	TrackerBusFDCursor * self;
	gint* _tmp0_;
	gint* _tmp1_;
	gint _tmp2_;
	TrackerSparqlValueType result;
#line 56 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self = (TrackerBusFDCursor*) base;
#line 56 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp0_ = self->types;
#line 56 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_vala_return_val_if_fail (_tmp0_ != NULL, "types != null", 0);
#line 59 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp1_ = self->types;
#line 59 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp2_ = _tmp1_[column];
#line 59 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	result = (TrackerSparqlValueType) _tmp2_;
#line 59 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return result;
#line 256 "tracker-bus-fd-cursor.c"
}

static const gchar*
tracker_bus_fd_cursor_real_get_variable_name (TrackerSparqlCursor* base,
                                              gint column)
{
	TrackerBusFDCursor * self;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	const gchar* _tmp2_;
	const gchar* result;
#line 62 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self = (TrackerBusFDCursor*) base;
#line 62 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp0_ = self->variable_names;
#line 62 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp0__length1 = self->variable_names_length1;
#line 62 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_vala_return_val_if_fail (_tmp0_ != NULL, "variable_names != null", NULL);
#line 64 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp1_ = self->variable_names;
#line 64 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp1__length1 = self->variable_names_length1;
#line 64 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp2_ = _tmp1_[column];
#line 64 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	result = _tmp2_;
#line 64 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return result;
#line 288 "tracker-bus-fd-cursor.c"
}

static const gchar*
tracker_bus_fd_cursor_real_get_string (TrackerSparqlCursor* base,
                                       gint column,
                                       glong* length)
{
	TrackerBusFDCursor * self;
	glong _vala_length = 0L;
	const gchar* str = NULL;
	gint _tmp0_;
	gint _tmp1_;
	gint* _tmp2_;
	gint _tmp3_;
	const gchar* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	const gchar* _tmp11_;
	const gchar* result;
#line 67 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self = (TrackerBusFDCursor*) base;
#line 67 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_vala_return_val_if_fail (self->cursor_finished == FALSE, "cursor_finished == false", NULL);
#line 69 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	str = NULL;
#line 71 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp0_ = tracker_sparql_cursor_get_n_columns ((TrackerSparqlCursor*) self);
#line 71 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp1_ = _tmp0_;
#line 71 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (column >= _tmp1_) {
#line 72 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		_vala_length = (glong) 0;
#line 73 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		result = NULL;
#line 73 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		if (length) {
#line 73 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
			*length = _vala_length;
#line 328 "tracker-bus-fd-cursor.c"
		}
#line 73 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		return result;
#line 332 "tracker-bus-fd-cursor.c"
	}
#line 77 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp2_ = self->types;
#line 77 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp3_ = _tmp2_[column];
#line 77 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (_tmp3_ == ((gint) TRACKER_SPARQL_VALUE_TYPE_UNBOUND)) {
#line 78 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		_vala_length = (glong) 0;
#line 79 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		result = NULL;
#line 79 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		if (length) {
#line 79 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
			*length = _vala_length;
#line 348 "tracker-bus-fd-cursor.c"
		}
#line 79 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		return result;
#line 352 "tracker-bus-fd-cursor.c"
	}
#line 82 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (column == 0) {
#line 356 "tracker-bus-fd-cursor.c"
		gchar* _tmp4_;
#line 83 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		_tmp4_ = self->data;
#line 83 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		str = (const gchar*) _tmp4_;
#line 362 "tracker-bus-fd-cursor.c"
	} else {
		gchar* _tmp5_;
		gint* _tmp6_;
		gint _tmp7_;
#line 85 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		_tmp5_ = self->data;
#line 85 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		_tmp6_ = self->offsets;
#line 85 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		_tmp7_ = _tmp6_[column - 1];
#line 85 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		str = (const gchar*) ((_tmp5_ + _tmp7_) + 1);
#line 375 "tracker-bus-fd-cursor.c"
	}
#line 88 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp8_ = str;
#line 88 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp9_ = strlen (_tmp8_);
#line 88 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp10_ = _tmp9_;
#line 88 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_vala_length = (glong) _tmp10_;
#line 90 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp11_ = str;
#line 90 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	result = _tmp11_;
#line 90 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (length) {
#line 90 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		*length = _vala_length;
#line 393 "tracker-bus-fd-cursor.c"
	}
#line 90 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return result;
#line 397 "tracker-bus-fd-cursor.c"
}

static gboolean
tracker_bus_fd_cursor_real_next (TrackerSparqlCursor* base,
                                 GCancellable* cancellable,
                                 GError** error)
{
	TrackerBusFDCursor * self;
	gint last_offset = 0;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gchar* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gchar* _tmp9_;
	GError* _inner_error0_ = NULL;
	gboolean result;
#line 93 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self = (TrackerBusFDCursor*) base;
#line 96 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (cancellable != NULL) {
#line 96 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		_tmp0_ = g_cancellable_is_cancelled (cancellable);
#line 423 "tracker-bus-fd-cursor.c"
	} else {
#line 96 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		_tmp0_ = FALSE;
#line 427 "tracker-bus-fd-cursor.c"
	}
#line 96 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (_tmp0_) {
#line 431 "tracker-bus-fd-cursor.c"
		GError* _tmp1_;
		gboolean _tmp2_ = FALSE;
#line 97 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		_tmp1_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_CANCELLED, "Operation was cancelled");
#line 97 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		_inner_error0_ = _tmp1_;
#line 97 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		g_propagate_error (error, _inner_error0_);
#line 97 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		return _tmp2_;
#line 442 "tracker-bus-fd-cursor.c"
	}
#line 100 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (self->buffer_index >= self->buffer_size) {
#line 101 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		self->cursor_finished = TRUE;
#line 102 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		self->data = NULL;
#line 103 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		result = FALSE;
#line 103 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		return result;
#line 454 "tracker-bus-fd-cursor.c"
	}
#line 113 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->_n_columns = tracker_bus_fd_cursor_buffer_read_int (self);
#line 117 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp3_ = self->buffer;
#line 117 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->types = (gint*) (_tmp3_ + self->buffer_index);
#line 118 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp4_ = tracker_sparql_cursor_get_n_columns ((TrackerSparqlCursor*) self);
#line 118 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp5_ = _tmp4_;
#line 118 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->buffer_index = self->buffer_index + (sizeof (gint) * _tmp5_);
#line 120 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp6_ = self->buffer;
#line 120 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->offsets = (gint*) (_tmp6_ + self->buffer_index);
#line 121 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp7_ = tracker_sparql_cursor_get_n_columns ((TrackerSparqlCursor*) self);
#line 121 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp8_ = _tmp7_;
#line 121 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->buffer_index = self->buffer_index + (sizeof (gint) * (_tmp8_ - 1));
#line 122 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	last_offset = tracker_bus_fd_cursor_buffer_read_int (self);
#line 124 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp9_ = self->buffer;
#line 124 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->data = _tmp9_ + self->buffer_index;
#line 125 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->cursor_finished = FALSE;
#line 127 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->buffer_index = self->buffer_index + (last_offset + 1);
#line 129 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	result = TRUE;
#line 129 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return result;
#line 492 "tracker-bus-fd-cursor.c"
}

static void
tracker_bus_fd_cursor_real_next_async_data_free (gpointer _data)
{
	TrackerBusFdCursorNextAsyncData* _data_;
	_data_ = _data;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_g_object_unref0 (_data_->cancellable);
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_g_object_unref0 (_data_->self);
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	g_slice_free (TrackerBusFdCursorNextAsyncData, _data_);
#line 506 "tracker-bus-fd-cursor.c"
}

static gpointer
_g_object_ref0 (gpointer self)
{
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return self ? g_object_ref (self) : NULL;
#line 514 "tracker-bus-fd-cursor.c"
}

static void
tracker_bus_fd_cursor_real_next_async (TrackerSparqlCursor* base,
                                       GCancellable* cancellable,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	TrackerBusFDCursor * self;
	TrackerBusFdCursorNextAsyncData* _data_;
	TrackerBusFDCursor* _tmp0_;
	GCancellable* _tmp1_;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self = (TrackerBusFDCursor*) base;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_data_ = g_slice_new0 (TrackerBusFdCursorNextAsyncData);
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	g_task_set_task_data (_data_->_async_result, _data_, tracker_bus_fd_cursor_real_next_async_data_free);
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp0_ = _g_object_ref0 (self);
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_data_->self = _tmp0_;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp1_ = _g_object_ref0 (cancellable);
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_g_object_unref0 (_data_->cancellable);
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_data_->cancellable = _tmp1_;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	tracker_bus_fd_cursor_real_next_async_co (_data_);
#line 547 "tracker-bus-fd-cursor.c"
}

static gboolean
tracker_bus_fd_cursor_next_finish (TrackerSparqlCursor* base,
                                   GAsyncResult* _res_,
                                   GError** error)
{
	gboolean result;
	TrackerBusFdCursorNextAsyncData* _data_;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (NULL == _data_) {
#line 561 "tracker-bus-fd-cursor.c"
		gboolean _tmp0_ = FALSE;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		return _tmp0_;
#line 565 "tracker-bus-fd-cursor.c"
	}
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	result = _data_->result;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return result;
#line 571 "tracker-bus-fd-cursor.c"
}

static gboolean
tracker_bus_fd_cursor_real_next_async_co (TrackerBusFdCursorNextAsyncData* _data_)
{
#line 132 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	switch (_data_->_state_) {
#line 132 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		case 0:
#line 581 "tracker-bus-fd-cursor.c"
		goto _state_0;
		default:
#line 132 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		g_assert_not_reached ();
#line 586 "tracker-bus-fd-cursor.c"
	}
	_state_0:
#line 134 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_data_->_tmp0_ = tracker_sparql_cursor_next ((TrackerSparqlCursor*) _data_->self, _data_->cancellable, &_data_->_inner_error0_);
#line 134 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
#line 134 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
#line 134 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		g_object_unref (_data_->_async_result);
#line 134 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		return FALSE;
#line 599 "tracker-bus-fd-cursor.c"
	}
#line 134 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_data_->result = _data_->_tmp0_;
#line 134 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
#line 134 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	if (_data_->_state_ != 0) {
#line 134 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		while (!g_task_get_completed (_data_->_async_result)) {
#line 134 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
#line 611 "tracker-bus-fd-cursor.c"
		}
	}
#line 134 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	g_object_unref (_data_->_async_result);
#line 134 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return FALSE;
#line 618 "tracker-bus-fd-cursor.c"
}

static void
tracker_bus_fd_cursor_real_rewind (TrackerSparqlCursor* base)
{
	TrackerBusFDCursor * self;
	gchar* _tmp0_;
#line 137 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self = (TrackerBusFDCursor*) base;
#line 138 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->buffer_index = (gulong) 0;
#line 139 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp0_ = self->buffer;
#line 139 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->data = _tmp0_;
#line 140 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->cursor_finished = FALSE;
#line 636 "tracker-bus-fd-cursor.c"
}

static gint
tracker_bus_fd_cursor_real_get_n_columns (TrackerSparqlCursor* base)
{
	gint result;
	TrackerBusFDCursor* self;
#line 53 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self = (TrackerBusFDCursor*) base;
#line 53 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	result = self->_n_columns;
#line 53 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	return result;
#line 650 "tracker-bus-fd-cursor.c"
}

static void
tracker_bus_fd_cursor_class_init (TrackerBusFDCursorClass * klass,
                                  gpointer klass_data)
{
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	tracker_bus_fd_cursor_parent_class = g_type_class_peek_parent (klass);
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	((TrackerSparqlCursorClass *) klass)->get_value_type = (TrackerSparqlValueType (*) (TrackerSparqlCursor*, gint)) tracker_bus_fd_cursor_real_get_value_type;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	((TrackerSparqlCursorClass *) klass)->get_variable_name = (const gchar* (*) (TrackerSparqlCursor*, gint)) tracker_bus_fd_cursor_real_get_variable_name;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	((TrackerSparqlCursorClass *) klass)->get_string = (const gchar* (*) (TrackerSparqlCursor*, gint, glong*)) tracker_bus_fd_cursor_real_get_string;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	((TrackerSparqlCursorClass *) klass)->next = (gboolean (*) (TrackerSparqlCursor*, GCancellable*, GError**)) tracker_bus_fd_cursor_real_next;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	((TrackerSparqlCursorClass *) klass)->next_async = (void (*) (TrackerSparqlCursor*, GCancellable*, GAsyncReadyCallback, gpointer)) tracker_bus_fd_cursor_real_next_async;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	((TrackerSparqlCursorClass *) klass)->next_finish = (gboolean (*) (TrackerSparqlCursor*, GAsyncResult*, GError**)) tracker_bus_fd_cursor_next_finish;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	((TrackerSparqlCursorClass *) klass)->rewind = (void (*) (TrackerSparqlCursor*)) tracker_bus_fd_cursor_real_rewind;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	TRACKER_SPARQL_CURSOR_CLASS (klass)->get_n_columns = tracker_bus_fd_cursor_real_get_n_columns;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_tracker_bus_fd_cursor_get_property;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	G_OBJECT_CLASS (klass)->finalize = tracker_bus_fd_cursor_finalize;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), TRACKER_BUS_FD_CURSOR_N_COLUMNS_PROPERTY, tracker_bus_fd_cursor_properties[TRACKER_BUS_FD_CURSOR_N_COLUMNS_PROPERTY] = g_param_spec_int ("n-columns", "n-columns", "n-columns", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
#line 681 "tracker-bus-fd-cursor.c"
}

static void
tracker_bus_fd_cursor_instance_init (TrackerBusFDCursor * self,
                                     gpointer klass)
{
}

static void
tracker_bus_fd_cursor_finalize (GObject * obj)
{
	TrackerBusFDCursor * self;
	gchar* _tmp0_;
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TRACKER_BUS_TYPE_FD_CURSOR, TrackerBusFDCursor);
#line 41 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	_tmp0_ = self->buffer;
#line 41 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	g_free (_tmp0_);
#line 29 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	self->variable_names = (_vala_array_free (self->variable_names, self->variable_names_length1, (GDestroyNotify) g_free), NULL);
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	G_OBJECT_CLASS (tracker_bus_fd_cursor_parent_class)->finalize (obj);
#line 705 "tracker-bus-fd-cursor.c"
}

static GType
tracker_bus_fd_cursor_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TrackerBusFDCursorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_bus_fd_cursor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerBusFDCursor), 0, (GInstanceInitFunc) tracker_bus_fd_cursor_instance_init, NULL };
	GType tracker_bus_fd_cursor_type_id;
	tracker_bus_fd_cursor_type_id = g_type_register_static (TRACKER_SPARQL_TYPE_CURSOR, "TrackerBusFDCursor", &g_define_type_info, 0);
	return tracker_bus_fd_cursor_type_id;
}

GType
tracker_bus_fd_cursor_get_type (void)
{
	static volatile gsize tracker_bus_fd_cursor_type_id__once = 0;
	if (g_once_init_enter (&tracker_bus_fd_cursor_type_id__once)) {
		GType tracker_bus_fd_cursor_type_id;
		tracker_bus_fd_cursor_type_id = tracker_bus_fd_cursor_get_type_once ();
		g_once_init_leave (&tracker_bus_fd_cursor_type_id__once, tracker_bus_fd_cursor_type_id);
	}
	return tracker_bus_fd_cursor_type_id__once;
}

static void
_vala_tracker_bus_fd_cursor_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec)
{
	TrackerBusFDCursor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TRACKER_BUS_TYPE_FD_CURSOR, TrackerBusFDCursor);
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
	switch (property_id) {
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		case TRACKER_BUS_FD_CURSOR_N_COLUMNS_PROPERTY:
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		g_value_set_int (value, tracker_sparql_cursor_get_n_columns ((TrackerSparqlCursor*) self));
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		break;
#line 745 "tracker-bus-fd-cursor.c"
		default:
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 20 "../tracker/src/libtracker-bus/tracker-bus-fd-cursor.vala"
		break;
#line 751 "tracker-bus-fd-cursor.c"
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

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;
}

