[tracker/rss-enclosures] libtracker-sparql: Fixed places where column is an int not uint



commit e43d80bbebea31cbd7382007092d33f332e8e492
Author: Martyn Russell <martyn lanedo com>
Date:   Wed Sep 15 16:33:28 2010 +0100

    libtracker-sparql: Fixed places where column is an int not uint
    
    This was mixed throughout the code base. Now we're consistent

 src/libtracker-bus/tracker-array-cursor.vala      |    8 ++++----
 src/libtracker-bus/tracker-bus-fd-cursor.c        |    8 ++++----
 src/libtracker-data/tracker-db-interface-sqlite.c |   14 +++++++-------
 src/libtracker-sparql/tracker-cursor.vala         |   18 +++++++++---------
 tests/functional-tests/shared-query-test.vala     |    4 ++--
 5 files changed, 26 insertions(+), 26 deletions(-)
---
diff --git a/src/libtracker-bus/tracker-array-cursor.vala b/src/libtracker-bus/tracker-array-cursor.vala
index ecc1d51..70e49fe 100644
--- a/src/libtracker-bus/tracker-array-cursor.vala
+++ b/src/libtracker-bus/tracker-array-cursor.vala
@@ -33,19 +33,19 @@ internal class Tracker.Bus.ArrayCursor : Tracker.Sparql.Cursor {
 		this.var_names = var_names;
 	}
 
-	public override int n_columns { get { return cols; } }
+	public override uint n_columns { get { return cols; } }
 
-	public override Sparql.ValueType get_value_type (int column)
+	public override Sparql.ValueType get_value_type (uint column)
 	requires (current_row >= 0) {
 		return this.types[column];
 	}
 
-	public override unowned string? get_variable_name (int column)
+	public override unowned string? get_variable_name (uint column)
 	requires (current_row >= 0) {
 		return this.var_names[column];
 	}
 
-	public override unowned string? get_string (int column, out long length = null)
+	public override unowned string? get_string (uint column, out long length = null)
 	requires (current_row >= 0) {
 		unowned string str;
 
diff --git a/src/libtracker-bus/tracker-bus-fd-cursor.c b/src/libtracker-bus/tracker-bus-fd-cursor.c
index f7e9cb5..96d4ab4 100644
--- a/src/libtracker-bus/tracker-bus-fd-cursor.c
+++ b/src/libtracker-bus/tracker-bus-fd-cursor.c
@@ -222,10 +222,10 @@ tracker_bus_fd_cursor_class_init (TrackerBusFDCursorClass *class)
 
 	object_class->finalize = tracker_bus_fd_cursor_finalize;
 
-	sparql_cursor_class->get_value_type = (TrackerSparqlValueType (*) (TrackerSparqlCursor *, gint)) tracker_bus_fd_cursor_get_value_type;
-	sparql_cursor_class->get_variable_name = (const gchar * (*) (TrackerSparqlCursor *, gint)) tracker_bus_fd_cursor_get_variable_name;
-	sparql_cursor_class->get_n_columns = (gint (*) (TrackerSparqlCursor *)) tracker_bus_fd_cursor_get_n_columns;
-	sparql_cursor_class->get_string = (const gchar * (*) (TrackerSparqlCursor *, gint, glong*)) tracker_bus_fd_cursor_get_string;
+	sparql_cursor_class->get_value_type = (TrackerSparqlValueType (*) (TrackerSparqlCursor *, guint)) tracker_bus_fd_cursor_get_value_type;
+	sparql_cursor_class->get_variable_name = (const gchar * (*) (TrackerSparqlCursor *, guint)) tracker_bus_fd_cursor_get_variable_name;
+	sparql_cursor_class->get_n_columns = (guint (*) (TrackerSparqlCursor *)) tracker_bus_fd_cursor_get_n_columns;
+	sparql_cursor_class->get_string = (const gchar * (*) (TrackerSparqlCursor *, guint, glong*)) tracker_bus_fd_cursor_get_string;
 	sparql_cursor_class->next = (gboolean (*) (TrackerSparqlCursor *, GCancellable *, GError **)) tracker_bus_fd_cursor_iter_next;
 	sparql_cursor_class->next_async = (void (*) (TrackerSparqlCursor *, GCancellable *, GAsyncReadyCallback, gpointer)) tracker_bus_fd_cursor_iter_next_async;
 	sparql_cursor_class->next_finish = (gboolean (*) (TrackerSparqlCursor *, GAsyncResult *, GError **)) tracker_bus_fd_cursor_iter_next_finish;
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c b/src/libtracker-data/tracker-db-interface-sqlite.c
index 5e45fa8..a287bf5 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -1180,18 +1180,18 @@ tracker_db_cursor_class_init (TrackerDBCursorClass *class)
 
 	object_class->finalize = tracker_db_cursor_finalize;
 
-	sparql_cursor_class->get_value_type = (TrackerSparqlValueType (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_value_type;
-	sparql_cursor_class->get_variable_name = (const gchar * (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_variable_name;
-	sparql_cursor_class->get_n_columns = (gint (*) (TrackerSparqlCursor *)) tracker_db_cursor_get_n_columns;
-	sparql_cursor_class->get_string = (const gchar * (*) (TrackerSparqlCursor *, gint, glong*)) tracker_db_cursor_get_string;
+	sparql_cursor_class->get_value_type = (TrackerSparqlValueType (*) (TrackerSparqlCursor *, guint)) tracker_db_cursor_get_value_type;
+	sparql_cursor_class->get_variable_name = (const gchar * (*) (TrackerSparqlCursor *, guint)) tracker_db_cursor_get_variable_name;
+	sparql_cursor_class->get_n_columns = (guint (*) (TrackerSparqlCursor *)) tracker_db_cursor_get_n_columns;
+	sparql_cursor_class->get_string = (const gchar * (*) (TrackerSparqlCursor *, guint, glong*)) tracker_db_cursor_get_string;
 	sparql_cursor_class->next = (gboolean (*) (TrackerSparqlCursor *, GCancellable *, GError **)) tracker_db_cursor_iter_next;
 	sparql_cursor_class->next_async = (void (*) (TrackerSparqlCursor *, GCancellable *, GAsyncReadyCallback, gpointer)) tracker_db_cursor_iter_next_async;
 	sparql_cursor_class->next_finish = (gboolean (*) (TrackerSparqlCursor *, GAsyncResult *, GError **)) tracker_db_cursor_iter_next_finish;
 	sparql_cursor_class->rewind = (void (*) (TrackerSparqlCursor *)) tracker_db_cursor_rewind;
 
-	sparql_cursor_class->get_integer = (gint64 (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_int;
-	sparql_cursor_class->get_double = (gdouble (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_double;
-	sparql_cursor_class->get_boolean = (gboolean (*) (TrackerSparqlCursor *, gint)) tracker_db_cursor_get_boolean;
+	sparql_cursor_class->get_integer = (gint64 (*) (TrackerSparqlCursor *, guint)) tracker_db_cursor_get_int;
+	sparql_cursor_class->get_double = (gdouble (*) (TrackerSparqlCursor *, guint)) tracker_db_cursor_get_double;
+	sparql_cursor_class->get_boolean = (gboolean (*) (TrackerSparqlCursor *, guint)) tracker_db_cursor_get_boolean;
 }
 
 static TrackerDBCursor *
diff --git a/src/libtracker-sparql/tracker-cursor.vala b/src/libtracker-sparql/tracker-cursor.vala
index 4311143..4def94f 100644
--- a/src/libtracker-sparql/tracker-cursor.vala
+++ b/src/libtracker-sparql/tracker-cursor.vala
@@ -88,7 +88,7 @@ public abstract class Tracker.Sparql.Cursor : Object {
 	 *
 	 * Number of columns available in the results to iterate.
 	 */
-	public abstract int n_columns {
+	public abstract uint n_columns {
 		/**
 		 * tracker_sparql_cursor_get_n_columns:
 		 * @self: a #TrackerSparqlCursor
@@ -98,7 +98,7 @@ public abstract class Tracker.Sparql.Cursor : Object {
 		 * tracker_sparql_cursor_next(); otherwise its return value will be
 		 * undefined.
 		 *
-		 * Returns: a #gint with the number of columns.
+		 * Returns: a #guint with the number of columns.
 		 */
 		get;
 	}
@@ -112,7 +112,7 @@ public abstract class Tracker.Sparql.Cursor : Object {
 	 *
 	 * Returns: a value type
 	 */
-	public abstract ValueType get_value_type (int column);
+	public abstract ValueType get_value_type (uint column);
 
 	/**
 	 * tracker_sparql_cursor_get_variable_name:
@@ -123,7 +123,7 @@ public abstract class Tracker.Sparql.Cursor : Object {
 	 *
 	 * Returns: a string, which should not be freed by the caller.
 	 */
-	public abstract unowned string? get_variable_name (int column);
+	public abstract unowned string? get_variable_name (uint column);
 
 	/**
 	 * tracker_sparql_cursor_get_string:
@@ -136,7 +136,7 @@ public abstract class Tracker.Sparql.Cursor : Object {
 	 * Returns: a string, which should not be freed by the caller. #NULL
 	 * is returned if the column number is in the [0,#n_columns] range.
 	 */
-	public abstract unowned string? get_string (int column, out long length = null);
+	public abstract unowned string? get_string (uint column, out long length = null);
 
 	/**
 	 * tracker_sparql_cursor_next:
@@ -192,7 +192,7 @@ public abstract class Tracker.Sparql.Cursor : Object {
 	 *
 	 * Returns: a integer.
 	 */
-	public virtual int64 get_integer (int column) {
+	public virtual int64 get_integer (uint column) {
 		return_val_if_fail (get_value_type (column) == ValueType.INTEGER, 0);
 		unowned string as_str = get_string (column);
 		return as_str.to_int64();
@@ -207,7 +207,7 @@ public abstract class Tracker.Sparql.Cursor : Object {
 	 *
 	 * Returns: a double.
 	 */
-	public virtual double get_double (int column) {
+	public virtual double get_double (uint column) {
 		return_val_if_fail (get_value_type (column) == ValueType.DOUBLE, 0);
 		unowned string as_str = get_string (column);
 		return as_str.to_double();
@@ -222,7 +222,7 @@ public abstract class Tracker.Sparql.Cursor : Object {
 	 *
 	 * Returns: a boolean.
 	 */
-	public virtual bool get_boolean (int column) {
+	public virtual bool get_boolean (uint column) {
 		ValueType type = get_value_type (column);
 		return_val_if_fail (type == ValueType.BOOLEAN, 0);
 		unowned string as_str = get_string (column);
@@ -238,7 +238,7 @@ public abstract class Tracker.Sparql.Cursor : Object {
 	 *
 	 * Returns: a boolean.
 	 */
-	public virtual bool is_bound (int column) {
+	public virtual bool is_bound (uint column) {
 		if (get_value_type (column) != ValueType.UNBOUND) {
 			return true;
 		}
diff --git a/tests/functional-tests/shared-query-test.vala b/tests/functional-tests/shared-query-test.vala
index 4ce6405..de122c2 100644
--- a/tests/functional-tests/shared-query-test.vala
+++ b/tests/functional-tests/shared-query-test.vala
@@ -35,13 +35,13 @@ public class TestApp : GLib.Object {
 	}
 
 	int iter_cursor (Cursor cursor) {
-		int i;
+		uint i;
 
 		try {
 			for (i = 0; i < cursor.n_columns; i++) {
 				print ("| %s ", cursor.get_variable_name (i));
 			}
-			print ("| -> %d columns\n", cursor.n_columns);
+			print ("| -> %u columns\n", cursor.n_columns);
 
 			while (cursor.next()) {
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]