[Tracker] [Patch] Fixes warnings
- From: Nate Nielsen <nielsen-list memberwebs com>
- To: tracker-list gnome org
- Subject: [Tracker] [Patch] Fixes warnings
- Date: Sat, 22 Apr 2006 00:04:39 +0000 (GMT)
I'm doing a little hacking on tracker (to the end of getting it to run
on my machine). There are a lot of warnings, and when that's the case
sometimes it's hard to see my own mistakes from the harmless warnings.
In any case, there's a patch attached which fixes most of warnings. Most
of them were harmless, although one was a crasher (freeing uninited
memory).
These are warnings are from GCC 4.0.x
Is this the right place to send this? Or should I just go ahead and
commit this (with a ChangeLog entry).
Cheers,
Nate
Index: configure.in
===================================================================
RCS file: /cvs/gnome/tracker/configure.in,v
retrieving revision 1.4
diff -U3 -r1.4 configure.in
--- configure.in 29 Mar 2006 11:31:39 -0000 1.4
+++ configure.in 21 Apr 2006 17:58:58 -0000
@@ -9,6 +9,8 @@
AC_SUBST(PACKAGE_URL, [http://www.freedesktop.org/Software/Tracker])
+CFLAGS="$CFLAGS -Wno-unused-parameter"
+
# Checks for programs.
AC_PROG_CC
AC_HEADER_STDC
Index: src/libtracker/tracker-get-meta-for-folder.c
===================================================================
RCS file: /cvs/gnome/tracker/src/libtracker/tracker-get-meta-for-folder.c,v
retrieving revision 1.3
diff -U3 -r1.3 tracker-get-meta-for-folder.c
--- src/libtracker/tracker-get-meta-for-folder.c 16 Jan 2006 01:51:41 -0000 1.3
+++ src/libtracker/tracker-get-meta-for-folder.c 21 Apr 2006 17:59:02 -0000
@@ -54,7 +54,7 @@
main (int argc, char **argv)
{
- char *metadata[] = {"File.Format", "File.Size", "Doc.PageCount", NULL};
+ const char *metadata[] = {"File.Format", "File.Size", "Doc.PageCount", NULL};
GHashTable *table = NULL;
GError *error = NULL;
TrackerClient *client = NULL;
@@ -91,8 +91,5 @@
tracker_disconnect (client);
-
+ return 0;
}
-
-
-
Index: src/libtracker/tracker-query.c
===================================================================
RCS file: /cvs/gnome/tracker/src/libtracker/tracker-query.c,v
retrieving revision 1.4
diff -U3 -r1.4 tracker-query.c
--- src/libtracker/tracker-query.c 29 Mar 2006 11:48:36 -0000 1.4
+++ src/libtracker/tracker-query.c 21 Apr 2006 17:59:02 -0000
@@ -38,7 +38,7 @@
if (!client) {
g_print ("Could not initialise Tracker - exiting...");
- return;
+ return 1;
}
bytes_read = fread(buffer, 1, 2047, stdin);
@@ -54,13 +54,13 @@
if (error) {
g_warning ("An error has occured : %s", error->message);
g_error_free (error);
- return;
+ return 1;
}
if (!strarray) {
g_print ("no results were found matching your query");
- return;
+ return 1;
}
for (p_strarray = strarray; *p_strarray; p_strarray++) {
Index: src/libtracker/tracker-search.c
===================================================================
RCS file: /cvs/gnome/tracker/src/libtracker/tracker-search.c,v
retrieving revision 1.3
diff -U3 -r1.3 tracker-search.c
--- src/libtracker/tracker-search.c 16 Jan 2006 01:51:41 -0000 1.3
+++ src/libtracker/tracker-search.c 21 Apr 2006 17:59:02 -0000
@@ -49,7 +49,7 @@
}
-void
+int
main (int argc, char **argv)
{
@@ -57,13 +57,14 @@
if (!argv[1]) {
g_print ("usage - tracker-search SearchTerm");
+ return 1;
}
client = tracker_connect (FALSE);
if (!client) {
g_print ("Could not initialise Tracker - exiting...");
- return;
+ return 1;
}
loop = g_main_loop_new (NULL, TRUE);
@@ -75,7 +76,7 @@
array[0] = argv[2];
array[1] = argv[3];
array[2] = NULL;
- tracker_search_metadata_by_text_and_mime_async (client, argv[1], array, my_callback, NULL);
+ tracker_search_metadata_by_text_and_mime_async (client, argv[1], (const char**)array,
my_callback, NULL);
} else {
tracker_search_metadata_by_text_async (client, argv[1], my_callback, NULL);
}
@@ -84,7 +85,5 @@
tracker_disconnect (client);
+ return 0;
}
-
-
-
Index: src/tracker-extract/tracker-extract.c
===================================================================
RCS file: /cvs/gnome/tracker/src/tracker-extract/tracker-extract.c,v
retrieving revision 1.4
diff -U3 -r1.4 tracker-extract.c
--- src/tracker-extract/tracker-extract.c 29 Mar 2006 12:09:55 -0000 1.4
+++ src/tracker-extract/tracker-extract.c 21 Apr 2006 17:59:02 -0000
@@ -199,7 +199,6 @@
char *str, *key;
char *sep = NULL, *label = NULL;
char tmp_buf[20];
- int i;
/* make sure dates are in the correct format (yyyy-mm-dd hh:mm:ss) */
if (g_hash_table_lookup_extended (meta_table, "Doc.Created", (gpointer)&key, (gpointer)&str)) {
Index: src/trackerd/tracker-db.c
===================================================================
RCS file: /cvs/gnome/tracker/src/trackerd/tracker-db.c,v
retrieving revision 1.6
diff -U3 -r1.6 tracker-db.c
--- src/trackerd/tracker-db.c 29 Mar 2006 11:48:37 -0000 1.6
+++ src/trackerd/tracker-db.c 21 Apr 2006 17:59:02 -0000
@@ -99,7 +99,7 @@
static gboolean
lock_db ()
{
- int attempt, fd, fd2;
+ int attempt, fd;
char *lock_file, *tmp, *tmp_file;
if (!use_nfs_safe_locking) {
@@ -945,7 +945,6 @@
char ***rows, ***res_str = NULL;
char **row, **array = NULL;
int i, row_count;
- char *str;
g_return_val_if_fail (db_con && folder_uri && (strlen (folder_uri) > 0), NULL);
@@ -997,7 +996,6 @@
{
FieldDef *def;
char ***res_str = NULL;
- char *field = NULL;
def = g_new (FieldDef, 1);
Index: src/trackerd/tracker-dbus-methods.c
===================================================================
RCS file: /cvs/gnome/tracker/src/trackerd/tracker-dbus-methods.c,v
retrieving revision 1.3
diff -U3 -r1.3 tracker-dbus-methods.c
--- src/trackerd/tracker-dbus-methods.c 29 Mar 2006 11:48:37 -0000 1.3
+++ src/trackerd/tracker-dbus-methods.c 21 Apr 2006 17:59:03 -0000
@@ -303,7 +303,7 @@
if (row_count > 0) {
- while (row = mysql_fetch_row (res)) {
+ while ((row = mysql_fetch_row (res)) != NULL) {
if (row[0] && row[1] &&row[2]) {
key = g_strconcat (row[1], "/", row[2], NULL);
@@ -580,7 +580,7 @@
DBusMessageIter iter;
DBusMessageIter iter_dict;
int i, id, n, table_count;
- char **array, **values = NULL, *folder, *field, *str, *mid;
+ char **array, *folder, *field, *str, *mid;
GString *sql;
MYSQL_RES *res;
@@ -1180,7 +1180,7 @@
array = g_new (char *, row_count);
i = 0;
- while (row = mysql_fetch_row (res)) {
+ while ((row = mysql_fetch_row (res)) != NULL) {
if (row[0] && row[1]) {
array[i] = g_strconcat (row[0], "/", row[1], NULL);
Index: src/trackerd/tracker-dbus.c
===================================================================
RCS file: /cvs/gnome/tracker/src/trackerd/tracker-dbus.c,v
retrieving revision 1.3
diff -U3 -r1.3 tracker-dbus.c
--- src/trackerd/tracker-dbus.c 29 Mar 2006 11:48:37 -0000 1.3
+++ src/trackerd/tracker-dbus.c 21 Apr 2006 17:59:03 -0000
@@ -30,6 +30,9 @@
static DBusObjectPathVTable tracker_vtable = {
unregistered_func,
message_func,
+ NULL,
+ NULL,
+ NULL,
NULL
};
Index: src/trackerd/tracker-inotify.c
===================================================================
RCS file: /cvs/gnome/tracker/src/trackerd/tracker-inotify.c,v
retrieving revision 1.2
diff -U3 -r1.2 tracker-inotify.c
--- src/trackerd/tracker-inotify.c 29 Mar 2006 11:48:37 -0000 1.2
+++ src/trackerd/tracker-inotify.c 21 Apr 2006 17:59:03 -0000
@@ -541,7 +541,7 @@
buffer_i = 0;
- while (buffer_i < r) {
+ while (buffer_i < (size_t)r) {
/* Parse events and process them ! */
pevent = (struct inotify_event *)&buffer[buffer_i];
event_size = sizeof(struct inotify_event) + pevent->len;
Index: src/trackerd/tracker-rdf-query.c
===================================================================
RCS file: /cvs/gnome/tracker/src/trackerd/tracker-rdf-query.c,v
retrieving revision 1.1.1.1
diff -U3 -r1.1.1.1 tracker-rdf-query.c
--- src/trackerd/tracker-rdf-query.c 14 Dec 2005 11:01:42 -0000 1.1.1.1
+++ src/trackerd/tracker-rdf-query.c 21 Apr 2006 17:59:03 -0000
@@ -737,11 +737,8 @@
gpointer user_data,
GError **error)
{
- int i;
ParserData *data;
ParseState state;
-
- char *str;
data = user_data;
state = peek_state (data);
Index: src/trackerd/tracker-utils.h
===================================================================
RCS file: /cvs/gnome/tracker/src/trackerd/tracker-utils.h,v
retrieving revision 1.3
diff -U3 -r1.3 tracker-utils.h
--- src/trackerd/tracker-utils.h 27 Feb 2006 00:31:36 -0000 1.3
+++ src/trackerd/tracker-utils.h 21 Apr 2006 17:59:03 -0000
@@ -23,7 +23,7 @@
#define FILE_PAUSE_PERIOD 1
#define FILE_SCHEDULE_PERIOD 500
-static char *tracker_actions[] = {
+static const char const *tracker_actions[] = {
"TRACKER_ACTION_IGNORE", "TRACKER_ACTION_CHECK", "TRACKER_ACTION_DELETE",
"TRACKER_ACTION_DELETE_SELF", "TRACKER_ACTION_CREATE","TRACKER_ACTION_MOVED_FROM",
"TRACKER_ACTION_MOVED_TO","TRACKER_ACTION_FILE_CHECK",
"TRACKER_ACTION_FILE_CHANGED","TRACKER_ACTION_FILE_DELETED", "TRACKER_ACTION_FILE_CREATED",
"TRACKER_ACTION_FILE_MOVED_FROM", "TRACKER_ACTION_FILE_MOVED_TO",
"TRACKER_ACTION_WRITABLE_FILE_CLOSED","TRACKER_ACTION_DIRECTORY_CHECK",
Index: src/trackerd/trackerd.c
===================================================================
RCS file: /cvs/gnome/tracker/src/trackerd/trackerd.c,v
retrieving revision 1.5
diff -U3 -r1.5 trackerd.c
--- src/trackerd/trackerd.c 29 Mar 2006 11:48:37 -0000 1.5
+++ src/trackerd/trackerd.c 21 Apr 2006 17:59:04 -0000
@@ -202,9 +202,6 @@
{
FileInfo *info_dir;
char **files, **files_p, *str;
- int i;
-
-
/* check for any deletions*/
@@ -693,8 +690,6 @@
process_scheduled_events (void)
{
FileInfo *info;
- MYSQL_RES *res = NULL;
- MYSQL_ROW row, end_row;
info = g_async_queue_try_pop (file_pending_queue);
@@ -747,7 +742,7 @@
DBConnection db_con;
gboolean has_pending;
MYSQL_RES *res = NULL;
- MYSQL_ROW row, end_row;
+ MYSQL_ROW row;
/* set thread safe DB connection */
mysql_thread_init ();
@@ -940,10 +935,10 @@
{
FileInfo *info;
DBConnection db_con;
- GSList *mylist = NULL, *moved_from_list = NULL; /* list to hold moved_from events whilst waiting for
a matching moved_to event */
+ GSList *moved_from_list = NULL; /* list to hold moved_from events whilst waiting for a matching
moved_to event */
gboolean need_index = FALSE, has_pending = FALSE;
MYSQL_RES *res = NULL;
- MYSQL_ROW row, end_row;
+ MYSQL_ROW row;
/* set thread safe DB connection */
mysql_thread_init ();
@@ -1161,10 +1156,6 @@
while (is_running) {
DBusMessage *reply;
- char **array = NULL;
- int row_count = 0, i = 0;
- MYSQL_ROW row = NULL;
- char *str, *str2;
g_mutex_unlock (mutex);
@@ -1190,7 +1181,6 @@
dbus_connection_send (rec->connection, reply, NULL);
dbus_message_unref (reply);
- g_free (str);
break;
case DBUS_ACTION_GET_METADATA:
@@ -1280,7 +1270,6 @@
sigset_t empty_mask;
char *prefix, *lock_file, *str, *lock_str, *tracker_data_dir;
GThread *file_metadata_thread, *file_process_thread, *user_request_thread1,
*user_request_thread2;
- GSList *mylist = NULL;
gboolean need_setup = FALSE;
DBConnection db_con;
GMainLoop *loop;
Index: src/trackerd/xdgmimecache.c
===================================================================
RCS file: /cvs/gnome/tracker/src/trackerd/xdgmimecache.c,v
retrieving revision 1.2
diff -U3 -r1.2 xdgmimecache.c
--- src/trackerd/xdgmimecache.c 29 Mar 2006 11:48:37 -0000 1.2
+++ src/trackerd/xdgmimecache.c 21 Apr 2006 17:59:04 -0000
@@ -163,7 +163,7 @@
xdg_uint32_t data_offset = GET_UINT32 (cache->buffer, offset + 16);
xdg_uint32_t mask_offset = GET_UINT32 (cache->buffer, offset + 20);
- int i, j;
+ xdg_uint32_t i, j;
for (i = range_start; i <= range_start + range_length; i++)
{
@@ -212,7 +212,7 @@
xdg_uint32_t n_children = GET_UINT32 (cache->buffer, offset + 24);
xdg_uint32_t child_offset = GET_UINT32 (cache->buffer, offset + 28);
- int i;
+ xdg_uint32_t i;
if (cache_magic_matchlet_compare_to_data (cache, offset, data, len))
{
@@ -242,7 +242,7 @@
xdg_uint32_t n_matchlets = GET_UINT32 (cache->buffer, offset + 8);
xdg_uint32_t matchlet_offset = GET_UINT32 (cache->buffer, offset + 12);
- int i;
+ xdg_uint32_t i;
for (i = 0; i < n_matchlets; i++)
{
@@ -270,7 +270,8 @@
xdg_uint32_t n_entries;
xdg_uint32_t offset;
- int j, n;
+ xdg_uint32_t j;
+ int n;
*prio = 0;
@@ -394,7 +395,8 @@
const char *mime_type;
const char *ptr;
- int i, j, n;
+ xdg_uint32_t i, j;
+ int n;
n = 0;
for (i = 0; _caches[i]; i++)
@@ -438,7 +440,8 @@
xdg_uint32_t n_children;
xdg_uint32_t child_offset;
- int min, max, mid, n, i;
+ xdg_uint32_t min, max, mid, i;
+ int n;
character = _xdg_utf8_to_ucs4 (suffix);
if (ignore_case)
@@ -529,7 +532,8 @@
static void
find_stopchars (char *stopchars)
{
- int i, j, k, l;
+ xdg_uint32_t j;
+ int i, k, l;
k = 0;
for (i = 0; _caches[i]; i++)
@@ -547,7 +551,7 @@
if (match_char < 128)
{
for (l = 0; l < k; l++)
- if (stopchars[l] == match_char)
+ if (stopchars[l] == (char)match_char)
break;
if (l == k)
{
@@ -768,7 +772,8 @@
{
const char *umime, *ubase;
- int i, j, min, max, med, cmp;
+ xdg_uint32_t j;
+ int i, min, max, med, cmp;
umime = _xdg_mime_cache_unalias_mime_type (mime);
ubase = _xdg_mime_cache_unalias_mime_type (base);
@@ -850,7 +855,7 @@
char **
_xdg_mime_cache_list_mime_parents (const char *mime)
{
- int i, j, p;
+ xdg_uint32_t i, j, p;
char *all_parents[128]; /* we'll stop at 128 */
char **result;
@@ -885,4 +890,3 @@
return result;
}
-
Index: src/trackerd/xdgmimemagic.c
===================================================================
RCS file: /cvs/gnome/tracker/src/trackerd/xdgmimemagic.c,v
retrieving revision 1.2
diff -U3 -r1.2 xdgmimemagic.c
--- src/trackerd/xdgmimemagic.c 29 Mar 2006 11:48:37 -0000 1.2
+++ src/trackerd/xdgmimemagic.c 21 Apr 2006 17:59:04 -0000
@@ -315,7 +315,7 @@
int c;
int end_of_file;
int indent = 0;
- int bytes_read;
+ unsigned int bytes_read;
assert (magic_file != NULL);
@@ -460,6 +460,8 @@
_xdg_mime_magic_matchlet_free (matchlet);
return XDG_MIME_MAGIC_EOF;
}
+
+ /* XXXX: Not possible |range_length| is of type |unsigned int| */
if (matchlet->range_length == -1)
{
_xdg_mime_magic_matchlet_free (matchlet);
@@ -474,7 +476,7 @@
/* We clean up the matchlet, byte swapping if needed */
if (matchlet->word_size > 1)
{
- int i;
+ xdg_uint32_t i;
if (matchlet->value_length % matchlet->word_size != 0)
{
_xdg_mime_magic_matchlet_free (matchlet);
@@ -519,7 +521,7 @@
const void *data,
size_t len)
{
- int i, j;
+ xdg_uint32_t i, j;
for (i = matchlet->offset; i < matchlet->offset + matchlet->range_length; i++)
{
int valid_matchlet = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]