[tracker] Fix Vala warnings
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] Fix Vala warnings
- Date: Mon, 9 May 2011 09:51:58 +0000 (UTC)
commit b0abb6df83c8082f2358a95bfd87c1ccb1225349
Author: Jürg Billeter <j bitron ch>
Date: Mon May 9 11:34:38 2011 +0200
Fix Vala warnings
src/libtracker-bus/tracker-bus.vala | 2 -
src/libtracker-data/tracker-sparql-pattern.vala | 8 +++---
src/libtracker-data/tracker-sparql-query.vala | 5 +--
src/libtracker-data/tracker-turtle-reader.vala | 3 +-
src/libtracker-direct/tracker-direct.vala | 2 +-
src/libtracker-sparql-backend/tracker-backend.vala | 2 +-
src/libtracker-sparql/tracker-cursor.vala | 4 +-
src/tracker-needle/tracker-stats.vala | 28 ++++++++++----------
src/tracker-needle/tracker-taglist.vala | 1 -
src/tracker-needle/tracker-utils.vala | 2 +-
src/tracker-needle/tracker-view.vala | 4 +-
src/tracker-store/tracker-main.vala | 4 +-
src/tracker-store/tracker-store.vala | 2 +-
13 files changed, 31 insertions(+), 36 deletions(-)
---
diff --git a/src/libtracker-bus/tracker-bus.vala b/src/libtracker-bus/tracker-bus.vala
index 779b623..da32dbd 100644
--- a/src/libtracker-bus/tracker-bus.vala
+++ b/src/libtracker-bus/tracker-bus.vala
@@ -33,8 +33,6 @@ private interface Tracker.Bus.Steroids : DBusProxy {
public abstract async void batch_update (UnixInputStream sparql_stream, Cancellable? cancellable) throws Sparql.Error, DBusError;
[DBus (signature = "as")]
public abstract async Variant update_array (UnixInputStream sparql_stream, Cancellable? cancellable) throws Sparql.Error, DBusError;
- [DBus (signature = "as")]
- public abstract async Variant batch_update_array (UnixInputStream sparql_stream, Cancellable? cancellable) throws Sparql.Error, DBusError;
[DBus (visible = false)]
public void update_begin (UnixInputStream sparql_stream, int priority, Cancellable? cancellable, AsyncReadyCallback callback) {
diff --git a/src/libtracker-data/tracker-sparql-pattern.vala b/src/libtracker-data/tracker-sparql-pattern.vala
index 99b47ac..a5fc6cf 100644
--- a/src/libtracker-data/tracker-sparql-pattern.vala
+++ b/src/libtracker-data/tracker-sparql-pattern.vala
@@ -384,17 +384,17 @@ class Tracker.Sparql.Pattern : Object {
if (accept (SparqlTokenType.LIMIT)) {
expect (SparqlTokenType.INTEGER);
- limit = get_last_string ().to_int ();
+ limit = int.parse (get_last_string ());
if (accept (SparqlTokenType.OFFSET)) {
expect (SparqlTokenType.INTEGER);
- offset = get_last_string ().to_int ();
+ offset = int.parse (get_last_string ());
}
} else if (accept (SparqlTokenType.OFFSET)) {
expect (SparqlTokenType.INTEGER);
- offset = get_last_string ().to_int ();
+ offset = int.parse (get_last_string ());
if (accept (SparqlTokenType.LIMIT)) {
expect (SparqlTokenType.INTEGER);
- limit = get_last_string ().to_int ();
+ limit = int.parse (get_last_string ());
}
}
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index 5bbc079..6dc01c6 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -354,8 +354,7 @@ public class Tracker.Sparql.Query : Object {
internal string get_last_string (int strip = 0) {
int last_index = (index + BUFFER_SIZE - 1) % BUFFER_SIZE;
- // do not switch to substring for performance reasons until we require Vala 0.11.6
- 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 {
@@ -498,7 +497,7 @@ public class Tracker.Sparql.Query : Object {
} else if (binding.data_type == PropertyType.DATETIME) {
stmt.bind_int (i, string_to_date (binding.literal, null));
} else if (binding.data_type == PropertyType.INTEGER) {
- stmt.bind_int (i, binding.literal.to_int ());
+ stmt.bind_int (i, int.parse (binding.literal));
} else {
stmt.bind_text (i, binding.literal);
}
diff --git a/src/libtracker-data/tracker-turtle-reader.vala b/src/libtracker-data/tracker-turtle-reader.vala
index aaf0f00..b57235a 100644
--- a/src/libtracker-data/tracker-turtle-reader.vala
+++ b/src/libtracker-data/tracker-turtle-reader.vala
@@ -134,8 +134,7 @@ public class Tracker.TurtleReader : Object {
string get_last_string (int strip = 0) {
int last_index = (index + BUFFER_SIZE - 1) % BUFFER_SIZE;
- // do not switch to substring for performance reasons until we require Vala 0.11.6
- 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-direct/tracker-direct.vala b/src/libtracker-direct/tracker-direct.vala
index 4b86b3c..7ab92b2 100644
--- a/src/libtracker-direct/tracker-direct.vala
+++ b/src/libtracker-direct/tracker-direct.vala
@@ -27,7 +27,7 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
string env_cache_size = Environment.get_variable ("TRACKER_SPARQL_CACHE_SIZE");
if (env_cache_size != null) {
- select_cache_size = env_cache_size.to_int();
+ select_cache_size = int.parse (env_cache_size);
}
try {
diff --git a/src/libtracker-sparql-backend/tracker-backend.vala b/src/libtracker-sparql-backend/tracker-backend.vala
index 53f6151..908bdcc 100644
--- a/src/libtracker-sparql-backend/tracker-backend.vala
+++ b/src/libtracker-sparql-backend/tracker-backend.vala
@@ -316,7 +316,7 @@ class Tracker.Sparql.Backend : Connection {
int verbosity = 0;
string env_verbosity = Environment.get_variable ("TRACKER_VERBOSITY");
if (env_verbosity != null)
- verbosity = env_verbosity.to_int ();
+ verbosity = int.parse (env_verbosity);
LogLevelFlags remove_levels = 0;
diff --git a/src/libtracker-sparql/tracker-cursor.vala b/src/libtracker-sparql/tracker-cursor.vala
index e728d86..b7675a9 100644
--- a/src/libtracker-sparql/tracker-cursor.vala
+++ b/src/libtracker-sparql/tracker-cursor.vala
@@ -220,7 +220,7 @@ public abstract class Tracker.Sparql.Cursor : Object {
public virtual int64 get_integer (int column) {
return_val_if_fail (get_value_type (column) == ValueType.INTEGER, 0);
unowned string as_str = get_string (column);
- return as_str.to_int64();
+ return int64.parse (as_str);
}
/**
@@ -237,7 +237,7 @@ public abstract class Tracker.Sparql.Cursor : Object {
public virtual double get_double (int column) {
return_val_if_fail (get_value_type (column) == ValueType.DOUBLE, 0);
unowned string as_str = get_string (column);
- return as_str.to_double();
+ return double.parse (as_str);
}
/**
diff --git a/src/tracker-needle/tracker-stats.vala b/src/tracker-needle/tracker-stats.vala
index 5743216..98126b4 100644
--- a/src/tracker-needle/tracker-stats.vala
+++ b/src/tracker-needle/tracker-stats.vala
@@ -88,47 +88,47 @@ public class Tracker.Stats : Dialog {
switch (key) {
case "nao:Tag":
- key_used = ngettext ("Tag", "Tags", val.to_int ());
+ key_used = ngettext ("Tag", "Tags", int.parse (val));
break;
case "nco:Contact":
- key_used = ngettext ("Contact", "Contacts", val.to_int ());
+ key_used = ngettext ("Contact", "Contacts", int.parse (val));
break;
case "nfo:Audio":
- key_used = ngettext ("Audio", "Audios", val.to_int ());
+ key_used = ngettext ("Audio", "Audios", int.parse (val));
break;
case "nfo:Document":
- key_used = ngettext ("Document", "Documents", val.to_int ());
+ key_used = ngettext ("Document", "Documents", int.parse (val));
break;
case "nfo:FileDataObject":
- key_used = ngettext ("File", "Files", val.to_int ());
+ key_used = ngettext ("File", "Files", int.parse (val));
break;
case "nfo:Folder":
- key_used = ngettext ("Folder", "Folders", val.to_int ());
+ key_used = ngettext ("Folder", "Folders", int.parse (val));
break;
case "nfo:Image":
- key_used = ngettext ("Image", "Images", val.to_int ());
+ key_used = ngettext ("Image", "Images", int.parse (val));
break;
case "nfo:SoftwareApplication":
- key_used = ngettext ("Application", "Applications", val.to_int ());
+ key_used = ngettext ("Application", "Applications", int.parse (val));
break;
case "nfo:Video":
//case "nmm:Video":
- key_used = ngettext ("Video", "Videos", val.to_int ());
+ key_used = ngettext ("Video", "Videos", int.parse (val));
break;
case "nmm:MusicAlbum":
- key_used = ngettext ("Album", "Albums", val.to_int ());
+ key_used = ngettext ("Album", "Albums", int.parse (val));
break;
case "nmm:MusicPiece":
- key_used = ngettext ("Music Track", "Music Tracks", val.to_int ());
+ key_used = ngettext ("Music Track", "Music Tracks", int.parse (val));
break;
case "nmm:Photo":
- key_used = ngettext ("Photo", "Photos", val.to_int ());
+ key_used = ngettext ("Photo", "Photos", int.parse (val));
break;
case "nmm:Playlist":
- key_used = ngettext ("Playlist", "Playlists", val.to_int ());
+ key_used = ngettext ("Playlist", "Playlists", int.parse (val));
break;
case "nmo:Email":
- key_used = ngettext ("Email", "Emails", val.to_int ());
+ key_used = ngettext ("Email", "Emails", int.parse (val));
break;
default:
diff --git a/src/tracker-needle/tracker-taglist.vala b/src/tracker-needle/tracker-taglist.vala
index 57a7823..818c2a5 100644
--- a/src/tracker-needle/tracker-taglist.vala
+++ b/src/tracker-needle/tracker-taglist.vala
@@ -90,7 +90,6 @@ public class Tracker.TagList : ScrolledWindow {
TreeIter iter) {
string text, subtext;
string markup = null;
- int n_children;
tree_model.get (iter, 1, out text, 2, out subtext, -1);
diff --git a/src/tracker-needle/tracker-utils.vala b/src/tracker-needle/tracker-utils.vala
index c9dc2b3..95e0bfe 100644
--- a/src/tracker-needle/tracker-utils.vala
+++ b/src/tracker-needle/tracker-utils.vala
@@ -70,7 +70,7 @@ public string tracker_time_format_from_iso8601 (string s) {
}
public string tracker_time_format_from_seconds (string seconds_str) {
- double seconds = seconds_str.to_int ();
+ double seconds = int.parse (seconds_str);
double total;
int d, h, m, s;
diff --git a/src/tracker-needle/tracker-view.vala b/src/tracker-needle/tracker-view.vala
index 124c9eb..1309640 100644
--- a/src/tracker-needle/tracker-view.vala
+++ b/src/tracker-needle/tracker-view.vala
@@ -374,7 +374,7 @@ public class Tracker.View : ScrolledWindow {
tree_model.get (iter, 4, out size, -1);
if (size != null) {
- size = GLib.format_size_for_display (size.to_int());
+ size = GLib.format_size_for_display (int.parse (size));
}
cell.set ("text", size);
@@ -425,7 +425,7 @@ public class Tracker.View : ScrolledWindow {
detail = detail + " " + _("Pages");
break;
case Tracker.Query.Type.IMAGES:
- detail = GLib.format_size_for_display (detail.to_int());
+ detail = GLib.format_size_for_display (int.parse (detail));
break;
}
diff --git a/src/tracker-store/tracker-main.vala b/src/tracker-store/tracker-main.vala
index 05e06d6..6bc1977 100644
--- a/src/tracker-store/tracker-main.vala
+++ b/src/tracker-store/tracker-main.vala
@@ -259,14 +259,14 @@ License which can be viewed at:
cache_size_s = Environment.get_variable ("TRACKER_STORE_SELECT_CACHE_SIZE");
if (cache_size_s != null && cache_size_s != "") {
- select_cache_size = cache_size_s.to_int ();
+ select_cache_size = int.parse (cache_size_s);
} else {
select_cache_size = SELECT_CACHE_SIZE;
}
cache_size_s = Environment.get_variable ("TRACKER_STORE_UPDATE_CACHE_SIZE");
if (cache_size_s != null && cache_size_s != "") {
- update_cache_size = cache_size_s.to_int ();
+ update_cache_size = int.parse (cache_size_s);
} else {
update_cache_size = UPDATE_CACHE_SIZE;
}
diff --git a/src/tracker-store/tracker-store.vala b/src/tracker-store/tracker-store.vala
index e30956f..0b086c7 100644
--- a/src/tracker-store/tracker-store.vala
+++ b/src/tracker-store/tracker-store.vala
@@ -239,7 +239,7 @@ public class Tracker.Store {
public static void init () {
string max_task_time_env = Environment.get_variable ("TRACKER_STORE_MAX_TASK_TIME");
if (max_task_time_env != null) {
- max_task_time = max_task_time_env.to_int ();
+ max_task_time = int.parse (max_task_time_env);
} else {
max_task_time = MAX_TASK_TIME;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]