Commit 00b134d0 authored by Michael Catanzaro's avatar Michael Catanzaro
Browse files

Enable and placate -Wsign-compare

parent a6e5831a
......@@ -37,7 +37,7 @@ AX_COMPILER_FLAGS([WARN_CFLAGS], [WARN_LDFLAGS], [$ax_is_release], [-Wdeclaratio
dnl TODO: Remove all of these! These warnings should be fixed, not
dnl silenced. At least, for the most part. -Wswitch-enum really does
dnl seem pretty dumb.
[-Wno-deprecated-declarations -Wno-switch-enum -Wno-switch-default -Wno-sign-compare])
[-Wno-deprecated-declarations -Wno-switch-enum -Wno-switch-default])
AC_PROG_CC
......
......@@ -85,7 +85,7 @@ ephy_about_handler_finish_request (WebKitURISchemeRequest *request,
{
GInputStream *stream;
data_length = data_length != -1 ? data_length : strlen (data);
data_length = data_length != -1 ? data_length : (gssize)strlen (data);
stream = g_memory_input_stream_new_from_data (data, data_length, g_free);
webkit_uri_scheme_request_finish (request, stream, data_length, "text/html");
g_object_unref (stream);
......
......@@ -544,7 +544,7 @@ static gpointer
ephy_embed_prefs_init (gpointer user_data)
{
GtkSettings *gtk_settings;
int i;
guint i;
webkit_settings = webkit_settings_new_with_settings ("enable-developer-extras", TRUE,
"enable-fullscreen", TRUE,
......
......@@ -350,7 +350,7 @@ static void
ephy_encodings_init (EphyEncodings *encodings)
{
char **list;
int i;
guint i;
LOG ("EphyEncodings initialising");
......
......@@ -910,7 +910,7 @@ web_page_document_loaded (WebKitWebPage *web_page,
WebKitDOMHTMLCollection *forms = NULL;
WebKitDOMDocument *document = NULL;
gulong forms_n;
int i;
guint i;
if (!extension->form_auth_data_cache ||
!g_settings_get_boolean (EPHY_SETTINGS_MAIN, EPHY_PREFS_REMEMBER_PASSWORDS))
......
......@@ -359,7 +359,7 @@ ephy_file_helpers_init (const char *profile_dir,
if (steal_data_from_profile && profile_dir)
{
int i;
guint i;
const char *files_to_copy[] = { EPHY_HISTORY_FILE, EPHY_BOOKMARKS_FILE };
for (i = 0; i < G_N_ELEMENTS (files_to_copy); i++)
......
......@@ -74,7 +74,7 @@ find_by_name (const char *name)
{
EphyNode *result = NULL;
GPtrArray *children;
int i;
guint i;
children = ephy_node_get_children (states);
for (i = 0; i < children->len; i++) {
......
......@@ -37,7 +37,7 @@ ephy_langs_sanitise (GArray *array)
int i, j;
/* if we have 'xy-ab' in list but not 'xy', append 'xy' */
for (i = 0; i < array->len; i++)
for (i = 0; i < (int) array->len; i++)
{
gboolean found = FALSE;
char *dash, *prefix;
......@@ -47,7 +47,7 @@ ephy_langs_sanitise (GArray *array)
dash = strchr (lang1, '-');
if (dash == NULL) continue;
for (j = i + 1; j < array->len; j++)
for (j = i + 1; j < (int) array->len; j++)
{
lang2 = (char *) g_array_index (array, char *, j);
if (strchr (lang2, '-') == NULL &&
......
......@@ -406,7 +406,7 @@ ephy_node_db_write_to_xml_valist (EphyNodeDb *db,
GPtrArray *children;
EphyNodeFilterFunc filter;
gpointer user_data;
int i;
guint i;
filter = va_arg (argptr, EphyNodeFilterFunc);
user_data = va_arg (argptr, gpointer);
......
......@@ -154,7 +154,7 @@ ephy_node_filter_add_expression (EphyNodeFilter *filter,
EphyNodeFilterExpression *exp,
int level)
{
while (level >= filter->priv->levels->len)
while (level >= (int)filter->priv->levels->len)
g_ptr_array_add (filter->priv->levels, NULL);
/* FIXME bogosity! This only works because g_list_append (x, data) == x */
......@@ -204,7 +204,7 @@ gboolean
ephy_node_filter_evaluate (EphyNodeFilter *filter,
EphyNode *node)
{
int i;
guint i;
for (i = 0; i < filter->priv->levels->len; i++) {
GList *l, *list;
......@@ -336,7 +336,7 @@ ephy_node_filter_expression_evaluate (EphyNodeFilterExpression *exp,
{
EphyNode *prop;
GPtrArray *children;
int i;
guint i;
children = ephy_node_get_children (node);
for (i = 0; i < children->len; i++)
......
......@@ -191,7 +191,7 @@ ephy_node_emit_signal (EphyNode *node, EphyNodeSignalType type, ...)
if (G_UNLIKELY (--node->emissions == 0 && node->invalidated_signals))
{
int removed;
guint removed;
removed = g_hash_table_foreach_remove
(node->signals,
......@@ -1153,7 +1153,7 @@ ephy_node_sort_children (EphyNode *node,
GCompareFunc compare_func)
{
GPtrArray *newkids;
int i, *new_order;
guint i, *new_order;
if (ephy_node_db_is_immutable (node->db)) return;
......@@ -1171,8 +1171,8 @@ ephy_node_sort_children (EphyNode *node,
g_ptr_array_sort (newkids, compare_func);
new_order = g_new (int, newkids->len);
memset (new_order, -1, sizeof (int) * newkids->len);
new_order = g_new (guint, newkids->len);
memset (new_order, -1, sizeof (guint) * newkids->len);
for (i = 0; i < newkids->len; i++)
{
......@@ -1199,7 +1199,7 @@ ephy_node_reorder_children (EphyNode *node,
int *new_order)
{
GPtrArray *newkids;
int i;
guint i;
g_return_if_fail (EPHY_IS_NODE (node));
g_return_if_fail (new_order != NULL);
......
......@@ -153,7 +153,7 @@ parse_and_decrypt_signons (const char *signons,
{
int version;
gchar **lines;
int i;
guint i;
guint length;
lines = g_strsplit (signons, "\r\n", -1);
......
......@@ -44,7 +44,7 @@ ephy_string_to_int (const char *string, gulong *integer)
result = strtol (string, &parse_end, 0);
/* Check that the result is in range. */
if ((result == G_MINLONG || result == G_MAXLONG) && errno == ERANGE)
if (errno == ERANGE)
return FALSE;
/* Check that all the trailing characters are spaces. */
......@@ -108,7 +108,7 @@ ephy_string_shorten (char *str,
/* if the string is already short enough, or if it's too short for
* us to shorten it, return a new copy */
if (actual_length <= target_length)
if ((gsize)actual_length <= target_length)
return str;
/* create string */
......
......@@ -39,7 +39,7 @@ ephy_web_dom_utils_has_modified_forms (WebKitDOMDocument *document)
{
WebKitDOMHTMLCollection *forms;
gulong forms_n;
int i;
guint i;
forms = webkit_dom_document_get_forms (document);
forms_n = webkit_dom_html_collection_get_length (forms);
......@@ -48,7 +48,7 @@ ephy_web_dom_utils_has_modified_forms (WebKitDOMDocument *document)
WebKitDOMHTMLCollection *elements;
WebKitDOMNode *form_element = webkit_dom_html_collection_item (forms, i);
gulong elements_n;
int j;
guint j;
gboolean modified_input_element = FALSE;
elements = webkit_dom_html_form_element_get_elements (WEBKIT_DOM_HTML_FORM_ELEMENT (form_element));
......
......@@ -465,7 +465,7 @@ entry_key_press_after_cb (GtkEntry *entry,
const char *string;
string = gtk_entry_get_text (entry);
if (gtk_editable_get_position (GTK_EDITABLE (entry)) == strlen (string))
if (gtk_editable_get_position (GTK_EDITABLE (entry)) == (int)strlen (string))
{
g_signal_emit_by_name (entry, "changed", 0);
return TRUE;
......
......@@ -780,7 +780,7 @@ button_release_cb (GtkWidget *widget,
GdkEventButton *event,
EphyNodeView *view)
{
if (event->button == view->priv->drag_button)
if ((int)event->button == view->priv->drag_button)
{
stop_drag_check (view);
if (!view->priv->drag_started)
......
......@@ -80,7 +80,7 @@ create_menu_item (GtkAction *action)
EphyZoomActionPrivate *p = EPHY_ZOOM_ACTION (action)->priv;
GtkWidget *menu, *menu_item;
GSList *group = NULL;
int i;
guint i;
menu = gtk_menu_new ();
......
......@@ -661,7 +661,8 @@ export_format_combo_changed_cb (GtkComboBox *combo,
GtkFileChooser *chooser)
{
char *filename, *basename, *dot, *newname;
int i, format;
guint i;
gint format;
filename = gtk_file_chooser_get_filename (chooser);
if (filename == NULL) return;
......@@ -675,7 +676,7 @@ export_format_combo_changed_cb (GtkComboBox *combo,
}
format = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
g_return_if_fail (format >= 0 && format < G_N_ELEMENTS (export_formats));
g_return_if_fail (format >= 0 && (guint)format < G_N_ELEMENTS (export_formats));
dot = strrchr (basename, '.');
if (dot != NULL)
......@@ -729,7 +730,7 @@ export_dialog_response_cb (GtkWidget *dialog,
g_return_if_fail (combo != NULL);
format = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
g_return_if_fail (format >= 0 && format < G_N_ELEMENTS (export_formats));
g_return_if_fail (format >= 0 && (guint)format < G_N_ELEMENTS (export_formats));
gtk_widget_destroy (dialog);
......@@ -751,7 +752,7 @@ cmd_bookmarks_export (GtkAction *action,
EphyBookmarksEditor *editor)
{
GtkWidget *dialog, *hbox, *label, *combo;
int format;
guint format;
char *filename;
dialog = GTK_WIDGET (ephy_file_chooser_new (_("Export Bookmarks"),
......
......@@ -65,7 +65,7 @@ write_topics_list (EphyNode *topics,
{
GPtrArray *children;
GList *keywords = NULL, *l;
int i;
guint i;
int ret = 0;
children = ephy_node_get_children (topics);
......@@ -120,7 +120,8 @@ write_rdf (EphyBookmarks *bookmarks,
EphyNode *bmks, *topics, *smart_bmks;
GPtrArray *children;
char *file_uri;
int i, ret;
guint i;
gint ret;
xmlChar *safeString;
#ifdef ENABLE_ZEROCONF
EphyNode *local;
......
......@@ -110,7 +110,7 @@ G_DEFINE_TYPE (EphyBookmarks, ephy_bookmarks, G_TYPE_OBJECT)
static void
ephy_bookmarks_init_defaults (EphyBookmarks *eb)
{
int i;
guint i;
for (i = 0; i < G_N_ELEMENTS (default_topics); i++)
{
......@@ -252,7 +252,7 @@ static void
update_bookmark_keywords (EphyBookmarks *eb, EphyNode *bookmark)
{
GPtrArray *children;
int i;
guint i;
GString *list;
const char *title;
char *normalized_keywords, *case_normalized_keywords;
......@@ -322,7 +322,7 @@ static gboolean
bookmark_is_categorized (EphyBookmarks *eb, EphyNode *bookmark)
{
GPtrArray *children;
int i;
guint i;
children = ephy_node_get_children (eb->priv->keywords);
for (i = 0; i < children->len; i++)
......@@ -350,7 +350,7 @@ topics_removed_cb (EphyNode *node,
EphyBookmarks *eb)
{
GPtrArray *children;
int i;
guint i;
children = ephy_node_get_children (child);
for (i = 0; i < children->len; i++)
......@@ -378,7 +378,7 @@ fix_hierarchy_topic (EphyBookmarks *eb,
EphyNode *bookmark;
const char *name;
char **split;
int i, j;
guint i, j;
children = ephy_node_get_children (topic);
name = ephy_node_get_property_string (topic, EPHY_NODE_KEYWORD_PROP_NAME);
......@@ -463,7 +463,7 @@ static GHashTable *
decode_txt_record (AvahiStringList *input_text)
{
GHashTable *hash;
int i;
guint i;
int len;
char *key, *value, *end;
char *key_dup, *value_dup;
......@@ -1186,7 +1186,7 @@ ephy_bookmarks_find_bookmark (EphyBookmarks *eb,
const char *url)
{
GPtrArray *children;
int i;
guint i;
g_return_val_if_fail (EPHY_IS_BOOKMARKS (eb), NULL);
g_return_val_if_fail (eb->priv->bookmarks != NULL, NULL);
......@@ -1241,7 +1241,7 @@ ephy_bookmarks_get_similar (EphyBookmarks *eb,
{
GPtrArray *children;
const char *url;
int i, result;
guint i, result;
g_return_val_if_fail (EPHY_IS_BOOKMARKS (eb), -1);
g_return_val_if_fail (eb->priv->bookmarks != NULL, -1);
......@@ -1521,7 +1521,7 @@ ephy_bookmarks_find_keyword (EphyBookmarks *eb,
{
EphyNode *node;
GPtrArray *children;
int i;
guint i;
const char *topic_name;
g_return_val_if_fail (name != NULL, NULL);
......
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