[tracker/tracker-0.12] build: Fixed various compiler warnings across the entire code base
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.12] build: Fixed various compiler warnings across the entire code base
- Date: Fri, 16 Dec 2011 16:48:30 +0000 (UTC)
commit 78c745f974f7042f549d2e8e80e16393ff54b95a
Author: Martyn Russell <martyn lanedo com>
Date: Wed Dec 14 17:11:51 2011 +0000
build: Fixed various compiler warnings across the entire code base
src/libtracker-common/tracker-common.h | 1 +
src/tracker-control/tracker-control-general.c | 7 ---
src/tracker-extract/tracker-cue-sheet.c | 4 ++
src/tracker-writeback/tracker-writeback.c | 2 -
tests/libtracker-common/tracker-albumart-test.c | 24 +++++-----
tests/libtracker-common/tracker-sched-test.c | 8 ++--
tests/libtracker-common/tracker-utils-test.c | 9 ++--
tests/libtracker-extract/tracker-encoding-test.c | 5 +-
tests/libtracker-extract/tracker-exif-test.c | 13 +++---
.../libtracker-extract/tracker-extract-info-test.c | 12 +++--
tests/libtracker-extract/tracker-guarantee-test.c | 16 +++---
tests/libtracker-extract/tracker-iptc-test.c | 7 +--
tests/libtracker-extract/tracker-test-utils.c | 4 +-
.../libtracker-miner/tracker-priority-queue-test.c | 48 ++++++++++----------
tests/libtracker-miner/tracker-task-pool-test.c | 40 ++++++++++-------
15 files changed, 102 insertions(+), 98 deletions(-)
---
diff --git a/src/libtracker-common/tracker-common.h b/src/libtracker-common/tracker-common.h
index e5616b0..c89e53d 100644
--- a/src/libtracker-common/tracker-common.h
+++ b/src/libtracker-common/tracker-common.h
@@ -36,6 +36,7 @@
#include "tracker-keyfile-object.h"
#include "tracker-language.h"
#include "tracker-log.h"
+#include "tracker-albumart.h"
#include "tracker-ontologies.h"
#include "tracker-os-dependant.h"
#include "tracker-sched.h"
diff --git a/src/tracker-control/tracker-control-general.c b/src/tracker-control/tracker-control-general.c
index 96f40ab..8eaf935 100644
--- a/src/tracker-control/tracker-control-general.c
+++ b/src/tracker-control/tracker-control-general.c
@@ -330,13 +330,6 @@ tracker_gsettings_get_all (gint *longest_name_length)
miners_available = tracker_miner_manager_get_available (manager);
- /* First iterate to get max width for nice formatting */
- for (l = miners_available; l; l = l->next) {
- const gchar *name;
-
- name = tracker_miner_manager_get_display_name (manager, l->data);
- }
-
/* Get valid schemas so we don't try to load invalid ones */
for (schema = g_settings_list_schemas (); schema && *schema; schema++) {
if (!g_str_has_prefix (*schema, "org.freedesktop.Tracker.")) {
diff --git a/src/tracker-extract/tracker-cue-sheet.c b/src/tracker-extract/tracker-cue-sheet.c
index 7c00d69..6d953b5 100644
--- a/src/tracker-extract/tracker-cue-sheet.c
+++ b/src/tracker-extract/tracker-cue-sheet.c
@@ -37,6 +37,8 @@
#include "tracker-cue-sheet.h"
+#if defined(HAVE_LIBCUE)
+
static TrackerToc *
tracker_toc_new (void)
{
@@ -49,6 +51,8 @@ tracker_toc_new (void)
return toc;
}
+#endif /* HAVE_LIBCUE */
+
void
tracker_toc_free (TrackerToc *toc)
{
diff --git a/src/tracker-writeback/tracker-writeback.c b/src/tracker-writeback/tracker-writeback.c
index 31a6036..bae1769 100644
--- a/src/tracker-writeback/tracker-writeback.c
+++ b/src/tracker-writeback/tracker-writeback.c
@@ -30,8 +30,6 @@
#warning Stayalive traces enabled
#endif /* STAYALIVE_ENABLE_TRACE */
-#define THREAD_ENABLE_TRACE
-
#ifdef THREAD_ENABLE_TRACE
#warning Controller thread traces enabled
#endif /* THREAD_ENABLE_TRACE */
diff --git a/tests/libtracker-common/tracker-albumart-test.c b/tests/libtracker-common/tracker-albumart-test.c
index aafb758..8c3b304 100644
--- a/tests/libtracker-common/tracker-albumart-test.c
+++ b/tests/libtracker-common/tracker-albumart-test.c
@@ -45,10 +45,10 @@ struct {
{ NULL, NULL}
};
-void
-test_albumart_stripping ()
+static void
+test_albumart_stripping (void)
{
- gint i;
+ gint i;
gchar *result;
for (i = 0; strip_test_cases[i].input != NULL; i++) {
@@ -60,8 +60,8 @@ test_albumart_stripping ()
g_print ("(%d test cases) ", i);
}
-void
-test_albumart_stripping_null ()
+static void
+test_albumart_stripping_null (void)
{
// FIXME: Decide what is the expected behaviour here...
// a. Return NULL
@@ -92,12 +92,12 @@ struct {
{ NULL, NULL, NULL }
};
-void
-test_albumart_location ()
+static void
+test_albumart_location (void)
{
gchar *path = NULL, *local_uri = NULL;
gchar *expected;
- gint i;
+ gint i;
for (i = 0; albumart_test_cases[i].filename != NULL; i++) {
tracker_albumart_get_path (albumart_test_cases[i].artist,
@@ -122,8 +122,8 @@ test_albumart_location ()
}
-void
-test_albumart_location_null ()
+static void
+test_albumart_location_null (void)
{
gchar *path = NULL, *local_uri = NULL;
@@ -132,8 +132,8 @@ test_albumart_location_null ()
g_assert (!path && !local_uri);
}
-void
-test_albumart_location_path ()
+static void
+test_albumart_location_path (void)
{
gchar *path = NULL, *local_uri = NULL;
gchar *expected;
diff --git a/tests/libtracker-common/tracker-sched-test.c b/tests/libtracker-common/tracker-sched-test.c
index 7dba862..3d51e61 100644
--- a/tests/libtracker-common/tracker-sched-test.c
+++ b/tests/libtracker-common/tracker-sched-test.c
@@ -31,8 +31,8 @@
#include <errno.h>
-gboolean
-scheduler_is (gint scheduler)
+static gboolean
+scheduler_is (gint scheduler)
{
#ifdef __linux__
return (sched_getscheduler (0) == scheduler);
@@ -41,8 +41,8 @@ scheduler_is (gint scheduler)
#endif
}
-void
-test_sched_set_and_get ()
+static void
+test_sched_set_and_get (void)
{
g_assert (scheduler_is (SCHED_OTHER));
g_assert (tracker_sched_idle ());
diff --git a/tests/libtracker-common/tracker-utils-test.c b/tests/libtracker-common/tracker-utils-test.c
index 05f0428..43e59fa 100644
--- a/tests/libtracker-common/tracker-utils-test.c
+++ b/tests/libtracker-common/tracker-utils-test.c
@@ -97,7 +97,7 @@ test_is_blank_string ()
}
static void
-test_seconds_estimate ()
+test_seconds_estimate (void)
{
g_assert_cmpint (tracker_seconds_estimate (10, 10, 20), ==, 20);
g_assert_cmpint (tracker_seconds_estimate (10, 9, 20), ==, 22);
@@ -107,15 +107,14 @@ test_seconds_estimate ()
g_assert_cmpint (tracker_seconds_estimate (1, 0, 2), ==, 0);
g_assert_cmpint (tracker_seconds_estimate (1, -1, 2), ==, 0);
g_assert_cmpint (tracker_seconds_estimate (1, 1, 0), ==, 0);
-// g_assert_cmpint (tracker_seconds_estimate (1, 1, -1), ==, 0);
}
-void
-test_strhex ()
+static void
+test_strhex (void)
{
gchar *result;
- result = tracker_strhex ((const guint8 *)"a", 1, "|");
+ result = tracker_strhex ((const guint8 *)"a", 1, '|');
g_assert_cmpstr (result, ==, "61");
g_free (result);
diff --git a/tests/libtracker-extract/tracker-encoding-test.c b/tests/libtracker-extract/tracker-encoding-test.c
index 1e2a726..6b09943 100644
--- a/tests/libtracker-extract/tracker-encoding-test.c
+++ b/tests/libtracker-extract/tracker-encoding-test.c
@@ -52,9 +52,8 @@ test_encoding_guessing ()
g_free (output);
}
-
-void
-test_encoding_can_guess ()
+static void
+test_encoding_can_guess (void)
{
/* This just duplicates the function code... */
#if defined (HAVE_ENCA) || defined (HAVE_MEEGOTOUCH)
diff --git a/tests/libtracker-extract/tracker-exif-test.c b/tests/libtracker-extract/tracker-exif-test.c
index 91c0dd9..667fec2 100644
--- a/tests/libtracker-extract/tracker-exif-test.c
+++ b/tests/libtracker-extract/tracker-exif-test.c
@@ -16,12 +16,13 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
-#include <glib.h>
+
#include <glib-object.h>
-#include <libtracker-extract/tracker-exif.h>
-void
-test_exif_parse ()
+#include <libtracker-extract/tracker-extract.h>
+
+static void
+test_exif_parse (void)
{
TrackerExifData *exif;
gchar *blob;
@@ -67,8 +68,8 @@ test_exif_parse ()
tracker_exif_free (exif);
}
-void
-test_exif_parse_empty ()
+static void
+test_exif_parse_empty (void)
{
TrackerExifData *exif;
gchar *blob;
diff --git a/tests/libtracker-extract/tracker-extract-info-test.c b/tests/libtracker-extract/tracker-extract-info-test.c
index e3e1773..4ae893d 100644
--- a/tests/libtracker-extract/tracker-extract-info-test.c
+++ b/tests/libtracker-extract/tracker-extract-info-test.c
@@ -16,11 +16,13 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
+
#include <glib.h>
-#include <libtracker-extract/tracker-extract-info.h>
-void
-test_extract_info_setters ()
+#include <libtracker-extract/tracker-extract.h>
+
+static void
+test_extract_info_setters (void)
{
TrackerExtractInfo *info, *info_ref;
GFile *file;
@@ -48,8 +50,8 @@ test_extract_info_setters ()
g_object_unref (file);
}
-void
-test_extract_info_empty_objects ()
+static void
+test_extract_info_empty_objects (void)
{
TrackerExtractInfo *info, *info_ref;
GFile *file;
diff --git a/tests/libtracker-extract/tracker-guarantee-test.c b/tests/libtracker-extract/tracker-guarantee-test.c
index 10af11d..6fde144 100644
--- a/tests/libtracker-extract/tracker-guarantee-test.c
+++ b/tests/libtracker-extract/tracker-guarantee-test.c
@@ -41,13 +41,12 @@ TestCase test_cases_title [] = {
{ NULL, NULL, NULL}
};
-
/*
* @uri of the file that is being processed
* @value is the title returned by the extractor
* @expected can be either the title of the extractor (if not NULL or empty) or calculated from the filename
*/
-void
+static void
internal_test_title (const gchar *uri,
const gchar *value,
const gchar *expected)
@@ -74,7 +73,7 @@ internal_test_title (const gchar *uri,
g_free (sparql);
}
-void
+static void
internal_test_date (const gchar *uri,
const gchar *value)
{
@@ -94,8 +93,8 @@ internal_test_date (const gchar *uri,
g_object_unref (builder);
}
-void
-test_guarantee_title ()
+static void
+test_guarantee_title (void)
{
int i;
@@ -112,16 +111,17 @@ test_guarantee_title ()
#endif
}
-void
-test_guarantee_date ()
+static void
+test_guarantee_date (void)
{
+#ifdef GUARANTEE_METADATA
GFile *f;
gchar *uri;
+#endif
internal_test_date ("file:///does/not/matter/here", "2011-10-10T12:13:14Z0300");
#ifdef GUARANTEE_METADATA
-
f = g_file_new_for_path (TOP_SRCDIR "/tests/libtracker-extract/guarantee-mtime-test.txt");
uri = g_file_get_uri (f);
diff --git a/tests/libtracker-extract/tracker-iptc-test.c b/tests/libtracker-extract/tracker-iptc-test.c
index ebdf4a7..ed98b0f 100644
--- a/tests/libtracker-extract/tracker-iptc-test.c
+++ b/tests/libtracker-extract/tracker-iptc-test.c
@@ -51,7 +51,7 @@ extract_jpeg_error_exit (j_common_ptr cinfo)
* libiptcdata doesn't scan the file until find the IPTC blob.
* We need to find the blob ourselves. This code comes from tracker-extract-jpeg
*/
-TrackerIptcData *
+static TrackerIptcData *
load_iptc_blob (const gchar *filename)
{
struct jpeg_decompress_struct cinfo;
@@ -126,9 +126,8 @@ load_iptc_blob (const gchar *filename)
return id;
}
-
-void
-test_iptc_extraction ()
+static void
+test_iptc_extraction (void)
{
TrackerIptcData *data;
diff --git a/tests/libtracker-extract/tracker-test-utils.c b/tests/libtracker-extract/tracker-test-utils.c
index b1dfeee..25f31d8 100644
--- a/tests/libtracker-extract/tracker-test-utils.c
+++ b/tests/libtracker-extract/tracker-test-utils.c
@@ -241,8 +241,8 @@ test_merge_const ()
g_assert (!result);
}
-void
-test_getline ()
+static void
+test_getline (void)
{
FILE *f;
gchar *line = NULL;
diff --git a/tests/libtracker-miner/tracker-priority-queue-test.c b/tests/libtracker-miner/tracker-priority-queue-test.c
index c57211c..006d56a 100644
--- a/tests/libtracker-miner/tracker-priority-queue-test.c
+++ b/tests/libtracker-miner/tracker-priority-queue-test.c
@@ -17,13 +17,13 @@
* 02110-1301, USA.
*/
-#include <glib.h>
#include <glib-object.h>
+/* NOTE: We're not including tracker-miner.h here because this is private. */
#include <libtracker-miner/tracker-priority-queue.h>
-void
-test_priority_queue_ref_unref()
+static void
+test_priority_queue_ref_unref (void)
{
TrackerPriorityQueue *one, *two;
@@ -34,8 +34,8 @@ test_priority_queue_ref_unref()
tracker_priority_queue_unref (one);
}
-void
-test_priority_queue_emptiness ()
+static void
+test_priority_queue_emptiness (void)
{
TrackerPriorityQueue *one;
@@ -47,8 +47,8 @@ test_priority_queue_emptiness ()
tracker_priority_queue_unref (one);
}
-void
-test_priority_queue_insertion_pop ()
+static void
+test_priority_queue_insertion_pop (void)
{
TrackerPriorityQueue *queue;
int i, priority;
@@ -81,8 +81,8 @@ test_priority_queue_insertion_pop ()
tracker_priority_queue_unref (queue);
}
-void
-test_priority_queue_peek ()
+static void
+test_priority_queue_peek (void)
{
TrackerPriorityQueue *queue;
gchar *result;
@@ -110,13 +110,12 @@ test_priority_queue_peek ()
tracker_priority_queue_unref (queue);
}
-
-void
-test_priority_queue_find ()
+static void
+test_priority_queue_find (void)
{
TrackerPriorityQueue *queue;
- gchar *result;
- int priority;
+ gchar *result;
+ int priority;
queue = tracker_priority_queue_new ();
@@ -124,21 +123,23 @@ test_priority_queue_find ()
tracker_priority_queue_add (queue, g_strdup ("Not me"), 1);
tracker_priority_queue_add (queue, g_strdup ("Not me either"), 20);
- result = (gchar *)tracker_priority_queue_find (queue, &priority, g_str_equal, "search me");
+ result = (gchar *) tracker_priority_queue_find (queue, &priority, g_str_equal, "search me");
+ g_assert_cmpstr (result, !=, NULL);
g_assert_cmpint (priority, ==, 10);
tracker_priority_queue_unref (queue);
}
-void
-foreach_testing_cb (G_GNUC_UNUSED gpointer data, gpointer user_data)
+static void
+foreach_testing_cb (G_GNUC_UNUSED gpointer data,
+ gpointer user_data)
{
gint *counter = (gint *)user_data;
(*counter) += 1;
}
-void
-test_priority_queue_foreach ()
+static void
+test_priority_queue_foreach (void)
{
TrackerPriorityQueue *queue;
gint counter = 0;
@@ -156,8 +157,8 @@ test_priority_queue_foreach ()
tracker_priority_queue_unref (queue);
}
-void
-test_priority_queue_foreach_remove ()
+static void
+test_priority_queue_foreach_remove (void)
{
TrackerPriorityQueue *queue;
@@ -179,9 +180,8 @@ test_priority_queue_foreach_remove ()
tracker_priority_queue_unref (queue);
}
-
-void
-test_priority_queue_branches ()
+static void
+test_priority_queue_branches (void)
{
/* Few specific testing to improve the branch coverage */
diff --git a/tests/libtracker-miner/tracker-task-pool-test.c b/tests/libtracker-miner/tracker-task-pool-test.c
index 578c144..ad0255f 100644
--- a/tests/libtracker-miner/tracker-task-pool-test.c
+++ b/tests/libtracker-miner/tracker-task-pool-test.c
@@ -18,9 +18,11 @@
*
*/
#include <glib.h>
+
+/* NOTE: We're not including tracker-miner.h here because this is private. */
#include <libtracker-miner/tracker-task-pool.h>
-void
+static void
test_task_pool_limit_set (void)
{
TrackerTaskPool *pool;
@@ -35,8 +37,11 @@ test_task_pool_limit_set (void)
g_object_unref (pool);
}
-void
-add_task (TrackerTaskPool *pool, const gchar *filename, gint expected_size, gboolean hit_limit)
+static void
+add_task (TrackerTaskPool *pool,
+ const gchar *filename,
+ gint expected_size,
+ gboolean hit_limit)
{
TrackerTask *task;
@@ -50,8 +55,11 @@ add_task (TrackerTaskPool *pool, const gchar *filename, gint expected_size, gboo
tracker_task_unref (task);
}
-void
-remove_task (TrackerTaskPool *pool, const gchar *filename, gint expected_size, gboolean hit_limit)
+static void
+remove_task (TrackerTaskPool *pool,
+ const gchar *filename,
+ gint expected_size,
+ gboolean hit_limit)
{
TrackerTask *task;
@@ -65,7 +73,7 @@ remove_task (TrackerTaskPool *pool, const gchar *filename, gint expected_size, g
tracker_task_unref (task);
}
-void
+static void
test_task_pool_add_remove (void)
{
TrackerTaskPool *pool;
@@ -95,12 +103,12 @@ test_task_pool_add_remove (void)
g_object_unref (pool);
}
-void
-test_task_pool_find ()
+static void
+test_task_pool_find (void)
{
TrackerTaskPool *pool;
- TrackerTask *task;
- GFile *goal;
+ TrackerTask *task;
+ GFile *goal;
pool = tracker_task_pool_new (3);
@@ -132,18 +140,19 @@ test_task_pool_find ()
g_object_unref (pool);
}
-void
-count_elements_cb (gpointer data, gpointer user_data)
+static void
+count_elements_cb (gpointer data,
+ gpointer user_data)
{
gint *counter = (gint*)user_data;
(*counter) += 1;
}
-void
-test_task_pool_foreach ()
+static void
+test_task_pool_foreach (void)
{
TrackerTaskPool *pool;
- int counter = 0;
+ int counter = 0;
pool = tracker_task_pool_new (3);
@@ -156,7 +165,6 @@ test_task_pool_foreach ()
g_assert_cmpint (counter, ==, 3);
}
-
gint
main (gint argc, gchar **argv)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]