[tracker: 12/13] Removed warning: cast incompatible
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker: 12/13] Removed warning: cast incompatible
- Date: Sun, 23 May 2021 01:05:16 +0000 (UTC)
commit 06b7d46f49241d2ce59c7220e1bc789dc5c0179f
Author: nitinosiris <nitinwartkar58 gmail com>
Date: Thu May 20 18:50:43 2021 +0530
Removed warning: cast incompatible
src/libtracker-data/tracker-data-manager.c | 29 ++++++++---------------
src/libtracker-data/tracker-db-interface-sqlite.c | 12 ++++++----
src/libtracker-sparql/tracker-endpoint-dbus.c | 4 ++--
src/tracker/tracker-sparql.c | 14 ++++++++---
4 files changed, 31 insertions(+), 28 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index c224f458a..753f231a8 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -1756,15 +1756,6 @@ tracker_data_ontology_process_changes_post_import (GPtrArray *seen_classes,
return;
}
-static void
-tracker_data_ontology_free_seen (GPtrArray *seen)
-{
- if (seen) {
- g_ptr_array_foreach (seen, (GFunc) g_object_unref, NULL);
- g_ptr_array_free (seen, TRUE);
- }
-}
-
static void
load_ontology_file (TrackerDataManager *manager,
GFile *file,
@@ -3994,8 +3985,8 @@ tracker_data_manager_initable_init (GInitable *initable,
GError *n_error = NULL;
gboolean transaction_started = FALSE;
- seen_classes = g_ptr_array_new ();
- seen_properties = g_ptr_array_new ();
+ seen_classes = g_ptr_array_new_with_free_func (g_object_unref);
+ seen_properties = g_ptr_array_new_with_free_func (g_object_unref);
g_debug ("Applying ontologies from %s to existing database", g_file_peek_path
(manager->ontology_location));
@@ -4131,8 +4122,8 @@ tracker_data_manager_initable_init (GInitable *initable,
g_warning ("%s", ontology_error->message);
g_error_free (ontology_error);
- tracker_data_ontology_free_seen (seen_classes);
- tracker_data_ontology_free_seen (seen_properties);
+ g_clear_pointer (&seen_classes, g_ptr_array_unref);
+ g_clear_pointer (&seen_properties, g_ptr_array_unref);
tracker_data_ontology_import_finished (manager);
/* as we're processing an ontology change,
@@ -4188,8 +4179,8 @@ tracker_data_manager_initable_init (GInitable *initable,
g_warning ("%s", ontology_error->message);
g_error_free (ontology_error);
- tracker_data_ontology_free_seen (seen_classes);
- tracker_data_ontology_free_seen (seen_properties);
+ g_clear_pointer (&seen_classes, g_ptr_array_unref);
+ g_clear_pointer (&seen_properties, g_ptr_array_unref);
tracker_data_ontology_import_finished (manager);
/* as we're processing an ontology change,
@@ -4306,8 +4297,8 @@ tracker_data_manager_initable_init (GInitable *initable,
g_warning ("%s", ontology_error->message);
g_error_free (ontology_error);
- tracker_data_ontology_free_seen (seen_classes);
- tracker_data_ontology_free_seen (seen_properties);
+ g_clear_pointer (&seen_classes, g_ptr_array_unref);
+ g_clear_pointer (&seen_properties, g_ptr_array_unref);
tracker_data_ontology_import_finished (manager);
/* as we're processing an ontology change,
@@ -4341,8 +4332,8 @@ tracker_data_manager_initable_init (GInitable *initable,
write_ontologies_gvdb (manager, TRUE /* overwrite */, NULL);
}
- tracker_data_ontology_free_seen (seen_classes);
- tracker_data_ontology_free_seen (seen_properties);
+ g_clear_pointer (&seen_classes, g_ptr_array_unref);
+ g_clear_pointer (&seen_properties, g_ptr_array_unref);
/* Reset the is_new flag for all classes and properties */
tracker_data_ontology_import_finished (manager);
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c
b/src/libtracker-data/tracker-db-interface-sqlite.c
index bfdac2ffa..fabb1d4aa 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -1820,6 +1820,12 @@ stmt_step (sqlite3_stmt *stmt)
return result;
}
+static void
+stmt_destroy (void *stmt)
+{
+ sqlite3_finalize ((sqlite3_stmt *) stmt);
+}
+
static void
generate_uuid (sqlite3_context *context,
const gchar *fn,
@@ -1856,8 +1862,7 @@ generate_uuid (sqlite3_context *context,
} while (result == SQLITE_ROW);
if (store_auxdata) {
- sqlite3_set_auxdata (context, 1, stmt,
- (void (*) (void*)) sqlite3_finalize);
+ sqlite3_set_auxdata (context, 1, (void*) stmt, stmt_destroy);
}
if (result != SQLITE_DONE) {
@@ -1945,8 +1950,7 @@ function_sparql_print_iri (sqlite3_context *context,
}
if (store_auxdata) {
- sqlite3_set_auxdata (context, 1, stmt,
- (void (*) (void*)) sqlite3_finalize);
+ sqlite3_set_auxdata (context, 1, (void*) stmt, stmt_destroy);
}
} else {
sqlite3_result_value (context, argv[0]);
diff --git a/src/libtracker-sparql/tracker-endpoint-dbus.c b/src/libtracker-sparql/tracker-endpoint-dbus.c
index 8c35a89cc..ea62aa56d 100644
--- a/src/libtracker-sparql/tracker-endpoint-dbus.c
+++ b/src/libtracker-sparql/tracker-endpoint-dbus.c
@@ -169,7 +169,7 @@ query_request_new (TrackerEndpointDBus *endpoint,
stream = g_unix_output_stream_new (fd, TRUE);
buffered_stream = g_buffered_output_stream_new_sized (stream,
- sysconf(_SC_PAGE_SIZE));
+ sysconf (_SC_PAGE_SIZE));
request->data_stream = g_data_output_stream_new (buffered_stream);
g_data_output_stream_set_byte_order (request->data_stream,
@@ -212,7 +212,7 @@ update_request_new (TrackerEndpointDBus *endpoint,
stream = g_unix_input_stream_new (input, TRUE);
request->input_stream = g_data_input_stream_new (stream);
g_buffered_input_stream_set_buffer_size (G_BUFFERED_INPUT_STREAM (request->input_stream),
- sysconf(_SC_PAGE_SIZE));
+ sysconf (_SC_PAGE_SIZE));
g_data_input_stream_set_byte_order (request->input_stream,
G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN);
g_object_unref (stream);
diff --git a/src/tracker/tracker-sparql.c b/src/tracker/tracker-sparql.c
index 2841d355f..04fcdff71 100644
--- a/src/tracker/tracker-sparql.c
+++ b/src/tracker/tracker-sparql.c
@@ -608,6 +608,13 @@ tree_node_data_new (const gchar *class,
return data;
}
+static void
+tree_data_free (gpointer data,
+ gpointer user_data)
+{
+ g_free (data);
+}
+
static void
tree_node_data_free (NodeData *data)
{
@@ -616,7 +623,7 @@ tree_node_data_free (NodeData *data)
}
if (data->properties) {
- g_slist_foreach (data->properties, (GFunc) g_free, NULL);
+ g_slist_foreach (data->properties, tree_data_free, NULL);
g_slist_free (data->properties);
}
@@ -631,7 +638,8 @@ tree_new (void)
}
static gboolean
-tree_free_foreach (GNode *node)
+tree_free_foreach (GNode *node,
+ gpointer data)
{
tree_node_data_free (node->data);
return FALSE;
@@ -644,7 +652,7 @@ tree_free (GNode *node)
G_POST_ORDER,
G_TRAVERSE_ALL,
-1,
- (GNodeTraverseFunc) tree_free_foreach,
+ tree_free_foreach,
NULL);
g_node_destroy (node);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]