tracker r2118 - in branches/indexer-split: . src/libtracker-common src/libtracker-db src/tracker-indexer/modules src/trackerd
- From: mr svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2118 - in branches/indexer-split: . src/libtracker-common src/libtracker-db src/tracker-indexer/modules src/trackerd
- Date: Wed, 20 Aug 2008 16:04:12 +0000 (UTC)
Author: mr
Date: Wed Aug 20 16:04:12 2008
New Revision: 2118
URL: http://svn.gnome.org/viewvc/tracker?rev=2118&view=rev
Log:
* src/libtracker-db/tracker-db-manager.c: Make use of
tracker_string_boolean_to_string_gint() instead of using code
which does the exact same thing. Also fixed 3 places which use
uninitalised integers as part of their calculations.
* src/tracker-indexer/modules/evolution.c:
(get_mbox_recipient_list): When getting the recipients list, don't
potentially add an uninitialised string.
* src/trackerd/tracker-db.c: (get_backup_id): Don't reuse id here,
call it something else and make this code work.
* src/trackerd/tracker-keywords.c: (tracker_keywords_search):
Don't check if "values" is != NULL since it is a local variable
now not a gchar** like it used to be.
* src/trackerd/tracker-metadata.c: (tracker_metadata_get): If
there is no result set, set the values to NULL so we don't check
for NULL against an uninitalised variable.
* src/trackerd/tracker-monitor.c: (tracker_monitor_add): Fixed
warning about unused variable when using libinotify.
* src/trackerd/tracker-processor.c: (item_queue_processed_cb):
Fixed warning about queue being uninitialised in NOP switch
statement condition.
* src/trackerd/tracker-search.c: (search_highlight_terms): If
there are no search terms, don't rely on uninitialised "s"
variable being set.
* src/trackerd/tracker-xesam-query.c: (build_sql): Set value to
NULL to initialise it and use
tracker_string_boolean_to_string_gint() instead of duplicating the
code to do the same thing.
* src/trackerd/tracker-xesam.c: (tracker_xesam_get_state): Don't
try to free random memory and make sure we NULL terminate the
GStrv that is returned.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/libtracker-common/tracker-type-utils.c
branches/indexer-split/src/libtracker-common/tracker-type-utils.h
branches/indexer-split/src/libtracker-db/tracker-db-manager.c
branches/indexer-split/src/tracker-indexer/modules/evolution.c
branches/indexer-split/src/trackerd/tracker-db.c
branches/indexer-split/src/trackerd/tracker-keywords.c
branches/indexer-split/src/trackerd/tracker-metadata.c
branches/indexer-split/src/trackerd/tracker-monitor.c
branches/indexer-split/src/trackerd/tracker-processor.c
branches/indexer-split/src/trackerd/tracker-search.c
branches/indexer-split/src/trackerd/tracker-xesam-query.c
branches/indexer-split/src/trackerd/tracker-xesam.c
Modified: branches/indexer-split/src/libtracker-common/tracker-type-utils.c
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-type-utils.c (original)
+++ branches/indexer-split/src/libtracker-common/tracker-type-utils.c Wed Aug 20 16:04:12 2008
@@ -719,7 +719,7 @@
return new_list;
}
gchar *
-tracker_boolean_as_text_to_number (const gchar *value)
+tracker_string_boolean_to_string_gint (const gchar *value)
{
g_return_val_if_fail (value != NULL, NULL);
Modified: branches/indexer-split/src/libtracker-common/tracker-type-utils.h
==============================================================================
--- branches/indexer-split/src/libtracker-common/tracker-type-utils.h (original)
+++ branches/indexer-split/src/libtracker-common/tracker-type-utils.h Wed Aug 20 16:04:12 2008
@@ -26,29 +26,27 @@
G_BEGIN_DECLS
-gchar * tracker_date_format (const gchar *time_string);
-time_t tracker_string_to_date (const gchar *time_string);
-gchar * tracker_date_to_string (time_t date_time);
-gchar * tracker_glong_to_string (glong i);
-gchar * tracker_gint_to_string (gint i);
-gchar * tracker_guint_to_string (guint i);
-gchar * tracker_gint32_to_string (gint32 i);
-gchar * tracker_guint32_to_string (guint32 i);
-gboolean tracker_string_to_uint (const gchar *s,
- guint *ret);
-gint tracker_string_in_string_list (const gchar *str,
- gchar **strv);
-GSList * tracker_string_list_to_gslist (gchar **strv,
- gsize length);
-gchar * tracker_string_list_to_string (gchar **strv,
- gsize length,
- gchar sep);
-gchar ** tracker_string_to_string_list (const gchar *str);
-gchar ** tracker_gslist_to_string_list (GSList *list);
-GSList * tracker_gslist_copy_with_string_data (GSList *list);
-
-/* "true" -> "1"; "false" -> "0" */
-gchar * tracker_boolean_as_text_to_number (const gchar *value);
+gchar * tracker_date_format (const gchar *time_string);
+time_t tracker_string_to_date (const gchar *time_string);
+gchar * tracker_date_to_string (time_t date_time);
+gchar * tracker_glong_to_string (glong i);
+gchar * tracker_gint_to_string (gint i);
+gchar * tracker_guint_to_string (guint i);
+gchar * tracker_gint32_to_string (gint32 i);
+gchar * tracker_guint32_to_string (guint32 i);
+gboolean tracker_string_to_uint (const gchar *s,
+ guint *ret);
+gint tracker_string_in_string_list (const gchar *str,
+ gchar **strv);
+GSList * tracker_string_list_to_gslist (gchar **strv,
+ gsize length);
+gchar * tracker_string_list_to_string (gchar **strv,
+ gsize length,
+ gchar sep);
+gchar ** tracker_string_to_string_list (const gchar *str);
+gchar ** tracker_gslist_to_string_list (GSList *list);
+GSList * tracker_gslist_copy_with_string_data (GSList *list);
+gchar * tracker_string_boolean_to_string_gint (const gchar *value);
G_END_DECLS
Modified: branches/indexer-split/src/libtracker-db/tracker-db-manager.c
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-manager.c (original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-manager.c Wed Aug 20 16:04:12 2008
@@ -268,7 +268,7 @@
continue;
}
- new_value = tracker_boolean_as_text_to_number (value);
+ new_value = tracker_string_boolean_to_string_gint (value);
g_free (value);
if (strcasecmp (keys[j], "Parent") == 0) {
@@ -445,7 +445,7 @@
gchar *value, *new_value, *esc_value;
value = g_key_file_get_string (key_file, groups[i], keys[j], NULL);
- new_value = tracker_boolean_as_text_to_number (value);
+ new_value = tracker_string_boolean_to_string_gint (value);
esc_value = tracker_escape_string (new_value);
tracker_db_interface_execute_query (iface,
@@ -601,7 +601,7 @@
gboolean is_service;
gboolean is_metadata_mapping;
gboolean is_service_mapping;
- gint i, j, id;
+ gint i, j;
const gchar *data_types[] = {
"string",
@@ -659,6 +659,7 @@
for (i = 0; groups[i]; i++) {
gchar *str_id;
gchar **keys;
+ gint id = -1;
if (is_metadata) {
db_exec_proc (iface,
@@ -746,7 +747,8 @@
mapped_data_id = TRACKER_FIELD_TYPE_STRING;
break;
default:
- g_warning ("Couldn't map data id %d to TrackerFieldType");
+ g_warning ("Couldn't map data id %d to TrackerFieldType",
+ data_id);
mapped_data_id = -1;
}
Modified: branches/indexer-split/src/tracker-indexer/modules/evolution.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/modules/evolution.c (original)
+++ branches/indexer-split/src/tracker-indexer/modules/evolution.c Wed Aug 20 16:04:12 2008
@@ -666,9 +666,14 @@
str = g_strdup (address->value.addr);
} else if (address->name) {
str = g_strdup (address->name);
+ } else {
+ str = NULL;
+ }
+
+ if (str) {
+ list = g_list_prepend (list, str);
}
- list = g_list_prepend (list, str);
addresses = addresses->next;
}
Modified: branches/indexer-split/src/trackerd/tracker-db.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-db.c (original)
+++ branches/indexer-split/src/trackerd/tracker-db.c Wed Aug 20 16:04:12 2008
@@ -304,14 +304,14 @@
}
if (!backup_id) {
- gint64 id;
+ gint64 last_insert_id;
tracker_db_exec_proc (iface,
"InsertBackupService",
id,
NULL);
- id = tracker_db_interface_sqlite_get_last_insert_id (TRACKER_DB_INTERFACE_SQLITE (iface));
- backup_id = tracker_gint_to_string (id);
+ last_insert_id = tracker_db_interface_sqlite_get_last_insert_id (TRACKER_DB_INTERFACE_SQLITE (iface));
+ backup_id = tracker_gint_to_string (last_insert_id);
}
return backup_id;
Modified: branches/indexer-split/src/trackerd/tracker-keywords.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-keywords.c (original)
+++ branches/indexer-split/src/trackerd/tracker-keywords.c Wed Aug 20 16:04:12 2008
@@ -499,7 +499,6 @@
tracker_dbus_async_return_if_fail (service_type != NULL, FALSE);
tracker_dbus_async_return_if_fail (keywords != NULL, FALSE);
- tracker_dbus_async_return_if_fail (values != NULL, FALSE);
tracker_dbus_request_new (request_id,
"DBus request to search keywords, "
Modified: branches/indexer-split/src/trackerd/tracker-metadata.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-metadata.c (original)
+++ branches/indexer-split/src/trackerd/tracker-metadata.c Wed Aug 20 16:04:12 2008
@@ -134,11 +134,11 @@
DBusGMethodInvocation *context,
GError **error)
{
- TrackerDBInterface *iface;
- TrackerDBResultSet *result_set;
- guint request_id;
- gchar *service_id, *service_result;
- guint i;
+ TrackerDBInterface *iface;
+ TrackerDBResultSet *result_set;
+ guint request_id;
+ gchar *service_id, *service_result;
+ guint i;
gchar **values;
GError *actual_error = NULL;
@@ -212,6 +212,8 @@
if (result_set) {
values = tracker_dbus_query_result_columns_to_strv (result_set, -1, -1, TRUE);
g_object_unref (result_set);
+ } else {
+ values = NULL;
}
if (!values) {
Modified: branches/indexer-split/src/trackerd/tracker-monitor.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-monitor.c (original)
+++ branches/indexer-split/src/trackerd/tracker-monitor.c Wed Aug 20 16:04:12 2008
@@ -1281,11 +1281,11 @@
INotifyHandle *file_monitor;
#else /* USE_LIBINOTIFY */
GFileMonitor *file_monitor;
+ GError *error = NULL;
#endif /* USE_LIBINOTIFY */
GHashTable *monitors;
GSList *ignored_roots;
GSList *l;
- GError *error = NULL;
gchar *path;
g_return_val_if_fail (TRACKER_IS_MONITOR (monitor), FALSE);
Modified: branches/indexer-split/src/trackerd/tracker-processor.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-processor.c (original)
+++ branches/indexer-split/src/trackerd/tracker-processor.c Wed Aug 20 16:04:12 2008
@@ -531,9 +531,6 @@
/* Put files back into queue */
switch (processor->private->sent_type) {
- case SENT_TYPE_NONE:
- queue = NULL;
- break;
case SENT_TYPE_CREATED:
queue = g_hash_table_lookup (processor->private->items_created_queues,
processor->private->sent_module_name);
@@ -550,6 +547,10 @@
queue = g_hash_table_lookup (processor->private->items_moved_queues,
processor->private->sent_module_name);
break;
+ case SENT_TYPE_NONE:
+ default:
+ queue = NULL;
+ break;
}
item_queue_readd_items (queue, processor->private->sent_items);
Modified: branches/indexer-split/src/trackerd/tracker-search.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-search.c (original)
+++ branches/indexer-split/src/trackerd/tracker-search.c Wed Aug 20 16:04:12 2008
@@ -254,6 +254,7 @@
return NULL;
}
+ s = NULL;
text_copy = g_strdup (text);
for (p = terms; *p; p++) {
Modified: branches/indexer-split/src/trackerd/tracker-xesam-query.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-xesam-query.c (original)
+++ branches/indexer-split/src/trackerd/tracker-xesam-query.c Wed Aug 20 16:04:12 2008
@@ -950,16 +950,21 @@
{
ParseState state;
gchar *avalue, *value, *sub;
- GList *field_data = NULL;
- GList *field_data_list = NULL;
+ GList *field_data;
+ GList *field_data_list;
GString *str;
- gint i = 0;
+ gint i;
g_return_val_if_fail (data->current_field &&
data->current_operator != OP_NONE &&
data->current_value,
FALSE);
+ value = NULL;
+ field_data = NULL;
+ field_data_list = NULL;
+ i = 0;
+
data->statement_count++;
state = peek_state (data);
@@ -1010,14 +1015,7 @@
/* FIXME We do a state check here, because
* TRACKER_FIELD_TYPE_BOOLEAN is not in db.
*/
- if (!strcmp(avalue,"true")) {
- value = g_strdup("1");
- } else if(!strcmp(avalue,"false")) {
- value = g_strdup("0");
- } else {
- /* TODO Add error message */
- return FALSE;
- }
+ value = tracker_string_boolean_to_string_gint (avalue);
} else {
value = g_strdup (avalue);
}
@@ -1139,7 +1137,6 @@
break;
case OP_FULL_TEXT:
-
sub = strchr (data->current_value, '*');
if (sub) {
Modified: branches/indexer-split/src/trackerd/tracker-xesam.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-xesam.c (original)
+++ branches/indexer-split/src/trackerd/tracker-xesam.c Wed Aug 20 16:04:12 2008
@@ -752,17 +752,18 @@
tracker_xesam_get_state (TrackerXesam *object,
DBusGMethodInvocation *context)
{
- GStrv state_info;
- gchar **state;
- guint request_id;
+ GStrv strv;
+ const gchar *state;
+ guint request_id;
request_id = tracker_dbus_get_next_request_id ();
- state = g_malloc (sizeof (gchar*) * 1);
- state[0] = g_strdup (tracker_status_get_as_string ());
- dbus_g_method_return (context, state_info);
+ state = tracker_status_get_as_string ();
+ strv = tracker_string_to_string_list (state);
- g_strfreev (state_info);
+ dbus_g_method_return (context, strv);
+
+ g_strfreev (strv);
tracker_dbus_request_success (request_id);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]