Commit 9d55f35d authored by Sam Thursfield's avatar Sam Thursfield

Fix pointer signedness warnings

It's a bit ugly that GLib string functions take signed chars and
SQLite'3 string functions return unsigned chars. We could disable
that warning instead but maybe it's useful in some other places.
parent a7a1abdd
......@@ -188,11 +188,11 @@ function_sparql_string_join (sqlite3_context *context,
return;
}
separator = sqlite3_value_text (argv[argc-1]);
separator = (gchar *)sqlite3_value_text (argv[argc-1]);
for (i = 0;i < argc-1; i++) {
if (sqlite3_value_type (argv[argc-1]) == SQLITE_TEXT) {
const gchar *text = sqlite3_value_text (argv[i]);
const gchar *text = (gchar *)sqlite3_value_text (argv[i]);
if (text != NULL) {
if (!str) {
......@@ -231,7 +231,7 @@ function_sparql_string_from_filename (sqlite3_context *context,
/* "/home/user/path/title_of_the_movie.movie" -> "title of the movie"
* Only for local files currently, do we need to change? */
name = g_filename_display_basename (sqlite3_value_text (argv[0]));
name = g_filename_display_basename ((gchar *)sqlite3_value_text (argv[0]));
if (!name) {
sqlite3_result_null (context);
......@@ -263,8 +263,8 @@ function_sparql_uri_is_parent (sqlite3_context *context,
return;
}
parent = sqlite3_value_text (argv[0]);
uri = sqlite3_value_text (argv[1]);
parent = (gchar *)sqlite3_value_text (argv[0]);
uri = (gchar *)sqlite3_value_text (argv[1]);
if (!parent || !uri) {
sqlite3_result_error (context, "Invalid arguments", -1);
......@@ -387,11 +387,11 @@ function_sparql_uri_is_descendant (sqlite3_context *context,
}
}
child = sqlite3_value_text (argv[argc-1]);
child = (gchar *)sqlite3_value_text (argv[argc-1]);
for (i = 0; i < argc - 1 && !match; i++) {
if (sqlite3_value_type (argv[i]) == SQLITE_TEXT) {
const gchar *parent = sqlite3_value_text (argv[i]);
const gchar *parent = (gchar *)sqlite3_value_text (argv[i]);
guint parent_len = sqlite3_value_bytes (argv[i]);
if (!parent)
......@@ -517,14 +517,14 @@ function_sparql_regex (sqlite3_context *context,
regex = sqlite3_get_auxdata (context, 1);
text = sqlite3_value_text (argv[0]);
flags = sqlite3_value_text (argv[2]);
text = (gchar *)sqlite3_value_text (argv[0]);
flags = (gchar *)sqlite3_value_text (argv[2]);
if (regex == NULL) {
gchar *err_str;
GError *error = NULL;
pattern = sqlite3_value_text (argv[1]);
pattern = (gchar *)sqlite3_value_text (argv[1]);
regex_flags = 0;
while (*flags) {
......@@ -604,18 +604,18 @@ function_sparql_replace (sqlite3_context *context,
if (argc == 3) {
flags = "";
} else if (argc == 4) {
flags = sqlite3_value_text (argv[3]);
flags = (gchar *)sqlite3_value_text (argv[3]);
} else {
sqlite3_result_error (context, "Invalid argument count", -1);
return;
}
input = sqlite3_value_text (argv[0]);
input = (gchar *)sqlite3_value_text (argv[0]);
regex = sqlite3_get_auxdata (context, 1);
replacement = sqlite3_value_text (argv[2]);
replacement = (gchar *)sqlite3_value_text (argv[2]);
if (regex == NULL) {
pattern = sqlite3_value_text (argv[1]);
pattern = (gchar *)sqlite3_value_text (argv[1]);
for (i = 0; flags[i]; i++) {
switch (flags[i]) {
......@@ -1078,7 +1078,7 @@ function_sparql_normalize (sqlite3_context *context,
return;
}
nfstr = sqlite3_value_text (argv[1]);
nfstr = (gchar *)sqlite3_value_text (argv[1]);
if (g_ascii_strcasecmp (nfstr, "nfc") == 0)
nf = UNORM_NFC;
else if (g_ascii_strcasecmp (nfstr, "nfd") == 0)
......@@ -1159,7 +1159,7 @@ function_sparql_encode_for_uri (sqlite3_context *context,
return;
}
str = sqlite3_value_text (argv[0]);
str = (gchar *)sqlite3_value_text (argv[0]);
encoded = g_uri_escape_string (str, NULL, FALSE);
sqlite3_result_text (context, encoded, -1, g_free);
}
......@@ -1183,8 +1183,8 @@ function_sparql_string_before (sqlite3_context *context,
return;
}
str = sqlite3_value_text (argv[0]);
substr = sqlite3_value_text (argv[1]);
str = (gchar *)sqlite3_value_text (argv[0]);
substr = (gchar *)sqlite3_value_text (argv[1]);
len = strlen (substr);
if (len == 0) {
......@@ -1221,8 +1221,8 @@ function_sparql_string_after (sqlite3_context *context,
return;
}
str = sqlite3_value_text (argv[0]);
substr = sqlite3_value_text (argv[1]);
str = (gchar *)sqlite3_value_text (argv[0]);
substr = (gchar *)sqlite3_value_text (argv[1]);
len = strlen (substr);
if (len == 0) {
......@@ -1299,8 +1299,8 @@ function_sparql_checksum (sqlite3_context *context,
return;
}
str = sqlite3_value_text (argv[0]);
checksumstr = sqlite3_value_text (argv[1]);
str = (gchar *)sqlite3_value_text (argv[0]);
checksumstr = (gchar *)sqlite3_value_text (argv[1]);
if (!str || !checksumstr) {
sqlite3_result_error (context, "Invalid arguments", -1);
......
......@@ -822,7 +822,7 @@ tracker_date_guess (const gchar *date_string)
static gint
my_igetdelim (gchar **linebuf,
guint *linebufsz,
gsize *linebufsz,
gint delimiter,
FILE *file)
{
......
......@@ -297,7 +297,7 @@ get_fts_weights (sqlite3_context *context)
guint weight;
weight = sqlite3_column_int (stmt, 0);
uri = sqlite3_column_text (stmt, 1);
uri = (gchar *)sqlite3_column_text (stmt, 1);
property = tracker_ontologies_get_property_by_uri (uri);
g_hash_table_insert (weights,
......
......@@ -106,7 +106,7 @@ parser_characters (void *data,
GString *string = data;
const gchar *str, *end;
str = ch;
str = (gchar *)ch;
g_utf8_validate (str, len, &end);
if (end > str) {
......
......@@ -881,7 +881,7 @@ miner_pause (const gchar *miner,
TrackerMinerManager *manager;
GError *error = NULL;
gchar *str;
gint cookie;
guint32 cookie;
/* Don't auto-start the miners here */
manager = tracker_miner_manager_new_full (FALSE, &error);
......
......@@ -186,8 +186,8 @@ run_parsing (void)
original_word[original_word_length] = '\0';
/* Get hex strings */
word_hex = tracker_strhex (word, word_length, ':');
original_word_hex = tracker_strhex (original_word,
word_hex = tracker_strhex ((guint8 *)word, word_length, ':');
original_word_hex = tracker_strhex ((guint8 *)original_word,
original_word_length,
':');
......
......@@ -31,7 +31,7 @@ test_exif_parse (void)
g_assert (g_file_get_contents (TOP_SRCDIR "/tests/libtracker-extract/exif-img.jpg", &blob, &length, NULL));
exif = tracker_exif_new (blob, length, "test://file");
exif = tracker_exif_new ((guchar *)blob, length, "test://file");
/* Ignored on purpose on the code (?) */
//g_assert_cmpstr (exif->x_dimension, ==, );
......@@ -77,7 +77,7 @@ test_exif_parse_empty (void)
g_assert (g_file_get_contents (TOP_SRCDIR "/tests/libtracker-extract/exif-free-img.jpg", &blob, &length, NULL));
exif = tracker_exif_new (blob, length, "test://file");
exif = tracker_exif_new ((guchar *)blob, length, "test://file");
tracker_exif_free (exif);
}
......
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