Commit b0abb6df authored by Jürg Billeter's avatar Jürg Billeter

Fix Vala warnings

parent f4bbeaaf
......@@ -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) {
......
......@@ -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 ());
}
}
......
......@@ -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);
}
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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;
......
......@@ -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);
}
/**
......
......@@ -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:
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment