[tracker] Fix Vala warnings



commit db6873b409174e33fe8296384706b5d434a27e40
Author: Jürg Billeter <j bitron ch>
Date:   Fri Jan 21 09:31:37 2011 +0100

    Fix Vala warnings

 src/libtracker-client/tracker-sparql-builder.vala  |    2 +-
 src/libtracker-data/tracker-sparql-query.vala      |    4 +-
 src/libtracker-data/tracker-turtle-reader.vala     |    4 +-
 src/libtracker-sparql/tracker-builder.vala         |    2 +-
 src/tracker-store/tracker-backup.vala              |    2 +-
 .../ipc/test-class-signal-performance-batch.vala   |    2 +-
 .../ipc/test-class-signal-performance.vala         |    2 +-
 tests/functional-tests/ipc/test-class-signal.vala  |    2 +-
 .../functional-tests/ipc/test-default-update.vala  |   40 +++++++---------
 tests/functional-tests/ipc/test-direct-query.vala  |   48 +++++++++-----------
 10 files changed, 50 insertions(+), 58 deletions(-)
---
diff --git a/src/libtracker-client/tracker-sparql-builder.vala b/src/libtracker-client/tracker-sparql-builder.vala
index b5fa989..3a7444b 100644
--- a/src/libtracker-client/tracker-sparql-builder.vala
+++ b/src/libtracker-client/tracker-sparql-builder.vala
@@ -242,7 +242,7 @@ public class Tracker.SparqlBuilder : Object {
 
 		if (!utf8_validate (value, -1, out end)) {
 			if (value != end) {
-				object_string (value.ndup (end - (char*) value));
+				object_string (value.substring (0, (long) (end - (char*) value)));
 			} else {
 				object_string ("(invalid data)");
 			}
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index d665548..9cdf479 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -254,7 +254,7 @@ public class Tracker.Sparql.Query : Object {
 
 		// generate name based uuid
 		return "urn:uuid:%.8s-%.4s-%.4s-%.4s-%.12s".printf (
-			sha1, sha1.offset (8), sha1.offset (12), sha1.offset (16), sha1.offset (20));
+			sha1, sha1.substring (8), sha1.substring (12), sha1.substring (16), sha1.substring (20));
 	}
 
 	internal string generate_bnodeid (string? user_bnodeid) {
@@ -353,7 +353,7 @@ public class Tracker.Sparql.Query : Object {
 
 	internal string get_last_string (int strip = 0) {
 		int last_index = (index + BUFFER_SIZE - 1) % BUFFER_SIZE;
-		return ((string) (tokens[last_index].begin.pos + strip)).ndup ((tokens[last_index].end.pos - tokens[last_index].begin.pos - 2 * strip));
+		return ((string) (tokens[last_index].begin.pos + strip)).substring (0, (int) (tokens[last_index].end.pos - tokens[last_index].begin.pos - 2 * strip));
 	}
 
 	void parse_prologue () throws Sparql.Error {
diff --git a/src/libtracker-data/tracker-turtle-reader.vala b/src/libtracker-data/tracker-turtle-reader.vala
index 3f3aadf..b57235a 100644
--- a/src/libtracker-data/tracker-turtle-reader.vala
+++ b/src/libtracker-data/tracker-turtle-reader.vala
@@ -90,7 +90,7 @@ public class Tracker.TurtleReader : Object {
 
 			// generate name based uuid
 			return "urn:uuid:%.8s-%.4s-%.4s-%.4s-%.12s".printf (
-				sha1, sha1.offset (8), sha1.offset (12), sha1.offset (16), sha1.offset (20));
+				sha1, sha1.substring (8), sha1.substring (12), sha1.substring (16), sha1.substring (20));
 		}
 	}
 
@@ -134,7 +134,7 @@ public class Tracker.TurtleReader : Object {
 
 	string get_last_string (int strip = 0) {
 		int last_index = (index + BUFFER_SIZE - 1) % BUFFER_SIZE;
-		return ((string) (tokens[last_index].begin.pos + strip)).ndup ((tokens[last_index].end.pos - tokens[last_index].begin.pos - 2 * strip));
+		return ((string) (tokens[last_index].begin.pos + strip)).substring (0, (int) (tokens[last_index].end.pos - tokens[last_index].begin.pos - 2 * strip));
 	}
 
 	string resolve_prefixed_name (string prefix, string local_name) throws Sparql.Error {
diff --git a/src/libtracker-sparql/tracker-builder.vala b/src/libtracker-sparql/tracker-builder.vala
index 910801b..07d1ad4 100644
--- a/src/libtracker-sparql/tracker-builder.vala
+++ b/src/libtracker-sparql/tracker-builder.vala
@@ -561,7 +561,7 @@ public class Tracker.Sparql.Builder : Object {
 
 		if (!utf8_validate (value, -1, out end)) {
 			if (value != end) {
-				object_string (value.ndup (end - (char*) value));
+				object_string (value.substring (0, (long) (end - (char*) value)));
 			} else {
 				object_string ("(invalid data)");
 			}
diff --git a/src/tracker-store/tracker-backup.vala b/src/tracker-store/tracker-backup.vala
index 19d0b6c..8bc91b4 100644
--- a/src/tracker-store/tracker-backup.vala
+++ b/src/tracker-store/tracker-backup.vala
@@ -19,7 +19,7 @@
  */
 
 [DBus (name = "org.freedesktop.Tracker1.Backup")]
-class Tracker.Backup : Object {
+public class Tracker.Backup : Object {
 	public const string PATH = "/org/freedesktop/Tracker1/Backup";
 
 	public async void save (BusName sender, string destination_uri) throws Error {
diff --git a/tests/functional-tests/ipc/test-class-signal-performance-batch.vala b/tests/functional-tests/ipc/test-class-signal-performance-batch.vala
index 1390481..5d77d55 100644
--- a/tests/functional-tests/ipc/test-class-signal-performance-batch.vala
+++ b/tests/functional-tests/ipc/test-class-signal-performance-batch.vala
@@ -23,7 +23,7 @@ using Tracker.Sparql;
 const int max_signals = 1000;
 const string title_data = "title";
 
-struct Event {
+public struct Event {
 	int graph_id;
 	int subject_id;
 	int pred_id;
diff --git a/tests/functional-tests/ipc/test-class-signal-performance.vala b/tests/functional-tests/ipc/test-class-signal-performance.vala
index ce2070d..35e9307 100644
--- a/tests/functional-tests/ipc/test-class-signal-performance.vala
+++ b/tests/functional-tests/ipc/test-class-signal-performance.vala
@@ -44,7 +44,7 @@ const string title_data = "title";
 // Low: VmRSS: 8868 Kb -- Max: VmRSS: 14060 kB
 
 
-struct Event {
+public struct Event {
 	int graph_id;
 	int subject_id;
 	int pred_id;
diff --git a/tests/functional-tests/ipc/test-class-signal.vala b/tests/functional-tests/ipc/test-class-signal.vala
index 109aeac..34749cd 100644
--- a/tests/functional-tests/ipc/test-class-signal.vala
+++ b/tests/functional-tests/ipc/test-class-signal.vala
@@ -24,7 +24,7 @@ const int max_signals = 10;
 const string title_data = "title";
 
 
-struct Event {
+public struct Event {
 	int graph_id;
 	int subject_id;
 	int pred_id;
diff --git a/tests/functional-tests/ipc/test-default-update.vala b/tests/functional-tests/ipc/test-default-update.vala
index c7fd137..e62c63a 100644
--- a/tests/functional-tests/ipc/test-default-update.vala
+++ b/tests/functional-tests/ipc/test-default-update.vala
@@ -4,30 +4,28 @@ private static int res;
 private static MainLoop loop;
 
 private void test_async () {
-	try {
-		Connection c = null;
+	Connection c = null;
 
-		// Test async
-		print ("Getting connection async\n");
-		loop = new MainLoop (null, false);
-		Connection.get_async.begin (null, (o, res) => {
+	// Test async
+	print ("Getting connection async\n");
+	loop = new MainLoop (null, false);
+	Connection.get_async.begin (null, (o, res) => {
+		try {
 			c = Connection.get_async.end (res);
 			loop.quit ();
-		});
-		loop.run ();
+		} catch (GLib.Error e) {
+			warning ("Couldn't perform test: %s", e.message);
+		}
+	});
+	loop.run ();
 
-		print ("Got it %p\n", c);
+	print ("Got it %p\n", c);
 
-		print ("Creating app with connection\n");
-		TestApp app = new TestApp (c);
+	print ("Creating app with connection\n");
+	TestApp app = new TestApp (c);
 
-		print ("Running app\n");
-		res = app.run();
-	} catch (GLib.IOError e1) {
-		warning ("Couldn't perform test: %s", e1.message);
-	} catch (Tracker.Sparql.Error e2) {
-		warning ("Couldn't perform test: %s", e2.message);
-	}
+	print ("Running app\n");
+	res = app.run();
 
 	print ("\n");
 }
@@ -47,10 +45,8 @@ private void test_sync () {
 
 		print ("Running app\n");
 		res = app.run();
-	} catch (GLib.IOError e1) {
-		warning ("Couldn't perform test: %s", e1.message);
-	} catch (Tracker.Sparql.Error e2) {
-		warning ("Couldn't perform test: %s", e2.message);
+	} catch (GLib.Error e) {
+		warning ("Couldn't perform test: %s", e.message);
 	}
 
 	print ("\n");
diff --git a/tests/functional-tests/ipc/test-direct-query.vala b/tests/functional-tests/ipc/test-direct-query.vala
index ddf7048..2d05161 100644
--- a/tests/functional-tests/ipc/test-direct-query.vala
+++ b/tests/functional-tests/ipc/test-direct-query.vala
@@ -5,32 +5,28 @@ private static int res;
 private static MainLoop loop;
 
 private void test_async () {
-	try {
-		Connection c = null;
-
-		// Test async
-		print ("Getting connection asynchronously\n");
-		loop = new MainLoop (null, false);
-		Connection.get_async.begin (null, (o, res) => {
-			try {
-				c = Connection.get_async.end (res);
-			} catch (GLib.Error e) {
-				warning ("Couldn't perform test: %s", e.message);
-			}
-			loop.quit ();
-		});
-		loop.run ();
-
-		print ("Got it %p\n", c);
-
-		print ("Creating app with connection\n");
-		TestApp app = new TestApp (c);
-
-		print ("Running app\n");
-		res = app.run();
-	} catch (GLib.Error e) {
-		warning ("Couldn't perform test: %s", e.message);
-	}
+	Connection c = null;
+
+	// Test async
+	print ("Getting connection asynchronously\n");
+	loop = new MainLoop (null, false);
+	Connection.get_async.begin (null, (o, res) => {
+		try {
+			c = Connection.get_async.end (res);
+		} catch (GLib.Error e) {
+			warning ("Couldn't perform test: %s", e.message);
+		}
+		loop.quit ();
+	});
+	loop.run ();
+
+	print ("Got it %p\n", c);
+
+	print ("Creating app with connection\n");
+	TestApp app = new TestApp (c);
+
+	print ("Running app\n");
+	res = app.run();
 
 	print ("\n");
 }



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