Commit 02f2f994 authored by Philip Van Hoof's avatar Philip Van Hoof

Various compiler warning fixes

parent f9b87f0b
...@@ -545,6 +545,9 @@ create_decomposed_metadata_property_table (TrackerDBInterface *iface, ...@@ -545,6 +545,9 @@ create_decomposed_metadata_property_table (TrackerDBInterface *iface,
case TRACKER_PROPERTY_TYPE_DOUBLE: case TRACKER_PROPERTY_TYPE_DOUBLE:
sql_type = "REAL"; sql_type = "REAL";
break; break;
case TRACKER_PROPERTY_TYPE_BLOB:
case TRACKER_PROPERTY_TYPE_STRUCT:
case TRACKER_PROPERTY_TYPE_FULLTEXT:
default: default:
sql_type = ""; sql_type = "";
break; break;
......
...@@ -306,24 +306,27 @@ ensure_resource_id (const gchar *uri) ...@@ -306,24 +306,27 @@ ensure_resource_id (const gchar *uri)
static void static void
statement_bind_gvalue (TrackerDBStatement *stmt, statement_bind_gvalue (TrackerDBStatement *stmt,
gint index, gint idx,
const GValue *value) const GValue *value)
{ {
switch (G_VALUE_TYPE (value)) { switch (G_VALUE_TYPE (value)) {
case G_TYPE_STRING: case G_TYPE_STRING:
tracker_db_statement_bind_text (stmt, index, g_value_get_string (value)); tracker_db_statement_bind_text (stmt, idx, g_value_get_string (value));
break; break;
case G_TYPE_INT: case G_TYPE_INT:
tracker_db_statement_bind_int (stmt, index, g_value_get_int (value)); tracker_db_statement_bind_int (stmt, idx, g_value_get_int (value));
break; break;
case G_TYPE_INT64: case G_TYPE_INT64:
tracker_db_statement_bind_int64 (stmt, index, g_value_get_int64 (value)); tracker_db_statement_bind_int64 (stmt, idx, g_value_get_int64 (value));
break; break;
case G_TYPE_BOOLEAN: case G_TYPE_BOOLEAN:
tracker_db_statement_bind_int (stmt, index, g_value_get_boolean (value)); tracker_db_statement_bind_int (stmt, idx, g_value_get_boolean (value));
break; break;
case G_TYPE_DOUBLE: case G_TYPE_DOUBLE:
tracker_db_statement_bind_double (stmt, index, g_value_get_double (value)); tracker_db_statement_bind_double (stmt, idx, g_value_get_double (value));
break;
default:
g_warning ("Unknown type for binding: %s\n", G_VALUE_TYPE_NAME (value));
break; break;
} }
} }
...@@ -643,6 +646,9 @@ cache_set_metadata_decomposed (TrackerProperty *property, ...@@ -643,6 +646,9 @@ cache_set_metadata_decomposed (TrackerProperty *property,
g_value_init (&gvalue, G_TYPE_INT); g_value_init (&gvalue, G_TYPE_INT);
g_value_set_int (&gvalue, object_id); g_value_set_int (&gvalue, object_id);
break; break;
case TRACKER_PROPERTY_TYPE_BLOB:
case TRACKER_PROPERTY_TYPE_STRUCT:
case TRACKER_PROPERTY_TYPE_FULLTEXT:
default: default:
return; return;
} }
...@@ -729,6 +735,9 @@ delete_metadata_decomposed (gint resource_id, ...@@ -729,6 +735,9 @@ delete_metadata_decomposed (gint resource_id,
object_id = ensure_resource_id (value); object_id = ensure_resource_id (value);
tracker_db_statement_bind_int (stmt, 1, object_id); tracker_db_statement_bind_int (stmt, 1, object_id);
break; break;
case TRACKER_PROPERTY_TYPE_BLOB:
case TRACKER_PROPERTY_TYPE_STRUCT:
case TRACKER_PROPERTY_TYPE_FULLTEXT:
default: default:
g_assert_not_reached (); g_assert_not_reached ();
} }
......
...@@ -374,43 +374,43 @@ tracker_db_interface_end_transaction (TrackerDBInterface *interface) ...@@ -374,43 +374,43 @@ tracker_db_interface_end_transaction (TrackerDBInterface *interface)
void void
tracker_db_statement_bind_double (TrackerDBStatement *stmt, tracker_db_statement_bind_double (TrackerDBStatement *stmt,
int index, int idx,
double value) double value)
{ {
g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt)); g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt));
TRACKER_DB_STATEMENT_GET_IFACE (stmt)->bind_double (stmt, index, value); TRACKER_DB_STATEMENT_GET_IFACE (stmt)->bind_double (stmt, idx, value);
} }
void void
tracker_db_statement_bind_int (TrackerDBStatement *stmt, tracker_db_statement_bind_int (TrackerDBStatement *stmt,
int index, int idx,
int value) int value)
{ {
g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt)); g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt));
TRACKER_DB_STATEMENT_GET_IFACE (stmt)->bind_int (stmt, index, value); TRACKER_DB_STATEMENT_GET_IFACE (stmt)->bind_int (stmt, idx, value);
} }
void void
tracker_db_statement_bind_int64 (TrackerDBStatement *stmt, tracker_db_statement_bind_int64 (TrackerDBStatement *stmt,
int index, int idx,
gint64 value) gint64 value)
{ {
g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt)); g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt));
TRACKER_DB_STATEMENT_GET_IFACE (stmt)->bind_int64 (stmt, index, value); TRACKER_DB_STATEMENT_GET_IFACE (stmt)->bind_int64 (stmt, idx, value);
} }
void void
tracker_db_statement_bind_text (TrackerDBStatement *stmt, tracker_db_statement_bind_text (TrackerDBStatement *stmt,
int index, int idx,
const gchar *value) const gchar *value)
{ {
g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt)); g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt));
TRACKER_DB_STATEMENT_GET_IFACE (stmt)->bind_text (stmt, index, value); TRACKER_DB_STATEMENT_GET_IFACE (stmt)->bind_text (stmt, idx, value);
} }
TrackerDBResultSet * TrackerDBResultSet *
...@@ -521,6 +521,9 @@ fill_in_value (GValue *value, ...@@ -521,6 +521,9 @@ fill_in_value (GValue *value,
case G_TYPE_STRING: case G_TYPE_STRING:
g_value_set_string (value, data); g_value_set_string (value, data);
break; break;
default:
g_warning ("Unknown type for resultset: %s\n", G_VALUE_TYPE_NAME (value));
break;
} }
} }
......
...@@ -967,7 +967,7 @@ tracker_albumart_process (const unsigned char *buffer, ...@@ -967,7 +967,7 @@ tracker_albumart_process (const unsigned char *buffer,
gchar *filename_uri; gchar *filename_uri;
g_debug ("Processing album art, buffer is %ld bytes, artist:'%s', album:'%s', filename:'%s', mime:'%s'", g_debug ("Processing album art, buffer is %ld bytes, artist:'%s', album:'%s', filename:'%s', mime:'%s'",
len, (long int) len,
artist ? artist : "", artist ? artist : "",
album ? album : "", album ? album : "",
filename, filename,
......
...@@ -39,9 +39,9 @@ typedef struct { ...@@ -39,9 +39,9 @@ typedef struct {
typedef struct { typedef struct {
GType type; GType type;
gchar *property; const gchar *property;
gchar *group; const gchar *group;
gchar *key; const gchar *key;
} ObjectToKeyFile; } ObjectToKeyFile;
static void config_set_property (GObject *object, static void config_set_property (GObject *object,
......
...@@ -300,6 +300,8 @@ fix_orientation (const gchar *orientation, gboolean *free_it) ...@@ -300,6 +300,8 @@ fix_orientation (const gchar *orientation, gboolean *free_it)
return (gchar *) "nfo:orientation-right-mirror"; return (gchar *) "nfo:orientation-right-mirror";
case 7: case 7:
return (gchar *) "nfo:orientation-left"; return (gchar *) "nfo:orientation-left";
default:
break;
} }
} }
} }
......
...@@ -100,7 +100,7 @@ void ...@@ -100,7 +100,7 @@ void
tracker_read_iptc (const unsigned char *buffer, tracker_read_iptc (const unsigned char *buffer,
size_t len, size_t len,
const gchar *uri, const gchar *uri,
GPtrArray *metadata) TrackerSparqlBuilder *metadata)
{ {
#ifdef HAVE_LIBIPTCDATA #ifdef HAVE_LIBIPTCDATA
IptcData *iptc = NULL; IptcData *iptc = NULL;
...@@ -119,15 +119,15 @@ tracker_read_iptc (const unsigned char *buffer, ...@@ -119,15 +119,15 @@ tracker_read_iptc (const unsigned char *buffer,
IptcDataSet *dataset = NULL; IptcDataSet *dataset = NULL;
while ( (dataset = iptc_data_get_next_dataset (iptc, dataset, p->record, p->tag) ) ) { while ( (dataset = iptc_data_get_next_dataset (iptc, dataset, p->record, p->tag) ) ) {
gchar buffer[1024]; gchar mbuffer[1024];
const gchar *what_i_need; const gchar *what_i_need;
iptc_dataset_get_as_str (dataset, buffer, 1024); iptc_dataset_get_as_str (dataset, mbuffer, 1024);
if (p->post) { if (p->post) {
what_i_need = (*p->post) (buffer); what_i_need = (*p->post) (mbuffer);
} else { } else {
what_i_need = buffer; what_i_need = mbuffer;
} }
if (p->urn) { if (p->urn) {
......
...@@ -7,6 +7,6 @@ ...@@ -7,6 +7,6 @@
void tracker_read_iptc (const unsigned char *buffer, void tracker_read_iptc (const unsigned char *buffer,
size_t len, size_t len,
const gchar *uri, const gchar *uri,
GPtrArray *metadata); TrackerSparqlBuilder *metadata);
#endif #endif
...@@ -246,6 +246,7 @@ log_handler (const gchar *domain, ...@@ -246,6 +246,7 @@ log_handler (const gchar *domain,
case G_LOG_LEVEL_INFO: case G_LOG_LEVEL_INFO:
case G_LOG_LEVEL_DEBUG: case G_LOG_LEVEL_DEBUG:
case G_LOG_LEVEL_MASK: case G_LOG_LEVEL_MASK:
default:
g_fprintf (stdout, "%s\n", message); g_fprintf (stdout, "%s\n", message);
fflush (stdout); fflush (stdout);
break; break;
......
...@@ -49,9 +49,9 @@ typedef struct { ...@@ -49,9 +49,9 @@ typedef struct {
typedef struct { typedef struct {
GType type; GType type;
gchar *property; const gchar *property;
gchar *group; const gchar *group;
gchar *key; const gchar *key;
} ObjectToKeyFile; } ObjectToKeyFile;
static void config_set_property (GObject *object, static void config_set_property (GObject *object,
......
...@@ -3359,7 +3359,9 @@ static int constructVtab( ...@@ -3359,7 +3359,9 @@ static int constructVtab(
int rc; int rc;
fulltext_vtab *v = 0; fulltext_vtab *v = 0;
char *schema; char *schema;
TrackerFTSConfig *config;
TrackerLanguage *language;
int min_len, max_len;
v = (fulltext_vtab *) sqlite3_malloc(sizeof(fulltext_vtab)); v = (fulltext_vtab *) sqlite3_malloc(sizeof(fulltext_vtab));
if( v==0 ) return SQLITE_NOMEM; if( v==0 ) return SQLITE_NOMEM;
...@@ -3405,12 +3407,13 @@ static int constructVtab( ...@@ -3405,12 +3407,13 @@ static int constructVtab(
/* set up our parser */ /* set up our parser */
TrackerFTSConfig *config = tracker_fts_config_new (); config = tracker_fts_config_new ();
language = tracker_language_new (NULL);
TrackerLanguage *language = tracker_language_new (NULL); min_len = tracker_fts_config_get_min_word_length (config);
max_len = tracker_fts_config_get_max_word_length (config);
int min_len = tracker_fts_config_get_min_word_length (config);
int max_len = tracker_fts_config_get_max_word_length (config);
v->max_words = tracker_fts_config_get_max_words_to_index (config); v->max_words = tracker_fts_config_get_max_words_to_index (config);
v->parser = tracker_parser_new (language, max_len, min_len); v->parser = tracker_parser_new (language, max_len, min_len);
...@@ -3844,6 +3847,11 @@ static void snippetAllOffsets(fulltext_cursor *p){ ...@@ -3844,6 +3847,11 @@ static void snippetAllOffsets(fulltext_cursor *p){
int iColumn, i; int iColumn, i;
fulltext_vtab *pFts; fulltext_vtab *pFts;
#ifndef STORE_CATEGORY
int iFirst, iLast;
int nColumn;
#endif
if( p->snippet.nMatch ) return; if( p->snippet.nMatch ) return;
if( p->q.nTerms==0 ) return; if( p->q.nTerms==0 ) return;
pFts = p->q.pFts; pFts = p->q.pFts;
...@@ -3910,9 +3918,7 @@ static void snippetAllOffsets(fulltext_cursor *p){ ...@@ -3910,9 +3918,7 @@ static void snippetAllOffsets(fulltext_cursor *p){
#else #else
int iFirst, iLast;
int nColumn;
nColumn = pFts->nColumn; nColumn = pFts->nColumn;
iColumn = (p->iCursorType - QUERY_FULLTEXT); iColumn = (p->iCursorType - QUERY_FULLTEXT);
if( iColumn<0 || iColumn>=nColumn ){ if( iColumn<0 || iColumn>=nColumn ){
...@@ -4156,6 +4162,8 @@ static int fulltextClose(sqlite3_vtab_cursor *pCursor){ ...@@ -4156,6 +4162,8 @@ static int fulltextClose(sqlite3_vtab_cursor *pCursor){
static int fulltextNext(sqlite3_vtab_cursor *pCursor){ static int fulltextNext(sqlite3_vtab_cursor *pCursor){
fulltext_cursor *c = (fulltext_cursor *) pCursor; fulltext_cursor *c = (fulltext_cursor *) pCursor;
int rc; int rc;
PLReader plReader;
gboolean first_pos = TRUE;
FTSTRACE(("FTS3 Next %p\n", pCursor)); FTSTRACE(("FTS3 Next %p\n", pCursor));
snippetClear(&c->snippet); snippetClear(&c->snippet);
...@@ -4189,8 +4197,6 @@ static int fulltextNext(sqlite3_vtab_cursor *pCursor){ ...@@ -4189,8 +4197,6 @@ static int fulltextNext(sqlite3_vtab_cursor *pCursor){
/* (tracker) read position offsets here */ /* (tracker) read position offsets here */
PLReader plReader;
gboolean first_pos = TRUE;
c->offsets = g_string_assign (c->offsets, ""); c->offsets = g_string_assign (c->offsets, "");
c->rank = 0; c->rank = 0;
...@@ -4815,6 +4821,8 @@ int Catid, ...@@ -4815,6 +4821,8 @@ int Catid,
int iStartOffset, iEndOffset, iPosition, stop_word, new_paragraph; int iStartOffset, iEndOffset, iPosition, stop_word, new_paragraph;
int rc; int rc;
TrackerParser *parser = v->parser; TrackerParser *parser = v->parser;
DLCollector *p;
int nData; /* Size of doclist before our update. */
if (!zText) return SQLITE_OK; if (!zText) return SQLITE_OK;
...@@ -4841,8 +4849,6 @@ int Catid, ...@@ -4841,8 +4849,6 @@ int Catid,
DLCollector *p;
int nData; /* Size of doclist before our update. */
/* Positions can't be negative; we use -1 as a terminator /* Positions can't be negative; we use -1 as a terminator
* internally. Token can't be NULL or empty. */ * internally. Token can't be NULL or empty. */
...@@ -5008,7 +5014,7 @@ static int index_update(fulltext_vtab *v, sqlite_int64 iRow, ...@@ -5008,7 +5014,7 @@ static int index_update(fulltext_vtab *v, sqlite_int64 iRow,
for(i = 0; i < v->nColumn ; ++i){ for(i = 0; i < v->nColumn ; ++i){
char *zText = (char*)sqlite3_value_text(pValues[i]); char *zText = (char*)sqlite3_value_text(pValues[i]);
int rc = buildTerms(v, iRow, zText, delete ? -1 : i); rc = buildTerms(v, iRow, zText, delete ? -1 : i);
if( rc!=SQLITE_OK ) return rc; if( rc!=SQLITE_OK ) return rc;
} }
...@@ -7147,7 +7153,7 @@ static int optimizeInternal(fulltext_vtab *v, ...@@ -7147,7 +7153,7 @@ static int optimizeInternal(fulltext_vtab *v,
-1, DL_DEFAULT, &merged); -1, DL_DEFAULT, &merged);
}else{ }else{
DLReader dlReaders[MERGE_COUNT]; DLReader dlReaders[MERGE_COUNT];
int iReader, nReaders; int iReader, pnReaders;
/* Prime the pipeline with the first reader's doclist. After /* Prime the pipeline with the first reader's doclist. After
** one pass index 0 will reference the accumulated doclist. ** one pass index 0 will reference the accumulated doclist.
...@@ -7160,22 +7166,22 @@ static int optimizeInternal(fulltext_vtab *v, ...@@ -7160,22 +7166,22 @@ static int optimizeInternal(fulltext_vtab *v,
assert( iReader<i ); /* Must execute the loop at least once. */ assert( iReader<i ); /* Must execute the loop at least once. */
while( iReader<i ){ while( iReader<i ){
/* Merge 16 inputs per pass. */ /* Merge 16 inputs per pass. */
for( nReaders=1; iReader<i && nReaders<MERGE_COUNT; for( pnReaders=1; iReader<i && pnReaders<MERGE_COUNT;
iReader++, nReaders++ ){ iReader++, pnReaders++ ){
dlrInit(&dlReaders[nReaders], DL_DEFAULT, dlrInit(&dlReaders[pnReaders], DL_DEFAULT,
optLeavesReaderData(&readers[iReader]), optLeavesReaderData(&readers[iReader]),
optLeavesReaderDataBytes(&readers[iReader])); optLeavesReaderDataBytes(&readers[iReader]));
} }
/* Merge doclists and swap result into accumulator. */ /* Merge doclists and swap result into accumulator. */
dataBufferReset(&merged); dataBufferReset(&merged);
docListMerge(&merged, dlReaders, nReaders); docListMerge(&merged, dlReaders, pnReaders);
tmp = merged; tmp = merged;
merged = doclist; merged = doclist;
doclist = tmp; doclist = tmp;
while( nReaders-- > 0 ){ while( pnReaders-- > 0 ){
dlrDestroy(&dlReaders[nReaders]); dlrDestroy(&dlReaders[pnReaders]);
} }
/* Accumulated doclist to reader 0 for next pass. */ /* Accumulated doclist to reader 0 for next pass. */
......
...@@ -76,9 +76,9 @@ typedef struct { ...@@ -76,9 +76,9 @@ typedef struct {
typedef struct { typedef struct {
GType type; GType type;
gchar *property; const gchar *property;
gchar *group; const gchar *group;
gchar *key; const gchar *key;
} ObjectToKeyFile; } ObjectToKeyFile;
static void config_set_property (GObject *object, static void config_set_property (GObject *object,
......
...@@ -91,7 +91,7 @@ name_owner_changed_cb (DBusGProxy *proxy, ...@@ -91,7 +91,7 @@ name_owner_changed_cb (DBusGProxy *proxy,
static gboolean static gboolean
dbus_register_object (GObject *object, dbus_register_object (GObject *object,
DBusGConnection *connection, DBusGConnection *mconnection,
DBusGProxy *proxy, DBusGProxy *proxy,
const DBusGObjectInfo *info, const DBusGObjectInfo *info,
const gchar *path) const gchar *path)
...@@ -101,7 +101,7 @@ dbus_register_object (GObject *object, ...@@ -101,7 +101,7 @@ dbus_register_object (GObject *object,
g_message (" Object Type:'%s'", G_OBJECT_TYPE_NAME (object)); g_message (" Object Type:'%s'", G_OBJECT_TYPE_NAME (object));
dbus_g_object_type_install_info (G_OBJECT_TYPE (object), info); dbus_g_object_type_install_info (G_OBJECT_TYPE (object), info);
dbus_g_connection_register_g_object (connection, path, object); dbus_g_connection_register_g_object (mconnection, path, object);
dbus_g_proxy_add_signal (proxy, "NameOwnerChanged", dbus_g_proxy_add_signal (proxy, "NameOwnerChanged",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
......
...@@ -50,9 +50,9 @@ typedef struct { ...@@ -50,9 +50,9 @@ typedef struct {
typedef struct { typedef struct {
GType type; GType type;
gchar *property; const gchar *property;
gchar *group; const gchar *group;
gchar *key; const gchar *key;
} ObjectToKeyFile; } ObjectToKeyFile;
static void config_set_property (GObject *object, static void config_set_property (GObject *object,
......
...@@ -109,6 +109,7 @@ log_handler (const gchar *domain, ...@@ -109,6 +109,7 @@ log_handler (const gchar *domain,
case G_LOG_LEVEL_INFO: case G_LOG_LEVEL_INFO:
case G_LOG_LEVEL_DEBUG: case G_LOG_LEVEL_DEBUG:
case G_LOG_LEVEL_MASK: case G_LOG_LEVEL_MASK:
default:
g_fprintf (stdout, "%s\n", message); g_fprintf (stdout, "%s\n", message);
fflush (stdout); fflush (stdout);
break; break;
......
...@@ -61,7 +61,7 @@ static GOptionEntry entries[] = { ...@@ -61,7 +61,7 @@ static GOptionEntry entries[] = {
static void static void
get_meta_table_data (gpointer value, gpointer user_data) get_meta_table_data (gpointer value, gpointer user_data)
{ {
gboolean detailed = GPOINTER_TO_INT (user_data); gboolean pdetailed = GPOINTER_TO_INT (user_data);
gchar **meta; gchar **meta;
gchar **p; gchar **p;
gint i; gint i;
...@@ -71,7 +71,7 @@ get_meta_table_data (gpointer value, gpointer user_data) ...@@ -71,7 +71,7 @@ get_meta_table_data (gpointer value, gpointer user_data)
for (p = meta, i = 0; *p; p++, i++) { for (p = meta, i = 0; *p; p++, i++) {
if (i == 0) { if (i == 0) {
g_print (" %s", *p); g_print (" %s", *p);
} else if (detailed) { } else if (pdetailed) {
g_print (", %s", *p); g_print (", %s", *p);
} }
} }
......
...@@ -482,7 +482,7 @@ main (gint argc, gchar *argv[]) ...@@ -482,7 +482,7 @@ main (gint argc, gchar *argv[])
if (!follow) { if (!follow) {
GError *error = NULL; GError *error = NULL;
gchar *state; const gchar *state;
/* state = tracker_get_status (client, &error); */ /* state = tracker_get_status (client, &error); */
state = "Idle"; state = "Idle";
......
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