summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-12-19 23:34:14 +0100
committerLuke from DC <[email protected]>2022-02-09 04:03:59 +0000
commitb6d46039be75bd2b868ee6c32b091a1e37720a20 (patch)
treefe11a75d22da7ca239204f000c33b2338cc07419 /src
parent97b61e663e47e6bd6ee6ff460895a7370b3c6159 (diff)
downloadcaja-b6d46039be75bd2b868ee6c32b091a1e37720a20.tar.bz2
caja-b6d46039be75bd2b868ee6c32b091a1e37720a20.tar.xz
Fix some -Wsign-compare warnings
Diffstat (limited to 'src')
-rw-r--r--src/caja-application.c3
-rw-r--r--src/caja-connect-server-dialog.c23
-rw-r--r--src/caja-file-management-properties.c6
-rw-r--r--src/caja-image-properties-page.c2
-rw-r--r--src/caja-navigation-window.c10
-rw-r--r--src/caja-places-sidebar.c11
-rw-r--r--src/caja-query-editor.c8
-rw-r--r--src/caja-window.c2
-rw-r--r--src/file-manager/fm-directory-view.c4
-rw-r--r--src/file-manager/fm-properties-window.c2
10 files changed, 41 insertions, 30 deletions
diff --git a/src/caja-application.c b/src/caja-application.c
index 8f920108..c000b27f 100644
--- a/src/caja-application.c
+++ b/src/caja-application.c
@@ -283,6 +283,7 @@ open_tabs (CajaApplication *application,
CajaApplication *self = CAJA_APPLICATION (application);
CajaWindow *window;
gchar *uri = NULL;
+ guint i;
/* monitor the preference to use browser or spatial windows */
/* connect before trying to read or this preference won't be read by root or after change */
@@ -307,7 +308,7 @@ open_tabs (CajaApplication *application,
g_debug ("Opening new tab at uri %s\n", uri);
caja_window_go_to (window, locations[0]);
g_free (uri);
- for (int i = 1; i< n_files;i++) {
+ for (i = 1; i < n_files; i++) {
/* open tabs in reverse order because each
* tab is opened before the previous one */
guint tab = n_files-i;
diff --git a/src/caja-connect-server-dialog.c b/src/caja-connect-server-dialog.c
index d97bcb0a..66b2001a 100644
--- a/src/caja-connect-server-dialog.c
+++ b/src/caja-connect-server-dialog.c
@@ -92,6 +92,12 @@ enum
RESPONSE_CONNECT
};
+enum {
+ COL_TYPE_COMBO_INDEX = 0,
+ COL_TYPE_COMBO_DESCRIPTION,
+ COL_TYPE_COMBO_NUM
+};
+
struct MethodInfo
{
const char *scheme;
@@ -532,7 +538,7 @@ connect_dialog_connect_to_server (CajaConnectServerDialog *dialog)
gtk_combo_box_get_active_iter (GTK_COMBO_BOX (dialog->details->type_combo), &iter);
gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->details->type_combo)),
&iter, 0, &index, -1);
- g_assert (index < G_N_ELEMENTS (methods) && index >= 0);
+ g_assert (index >= 0 && ((gsize) index) < G_N_ELEMENTS (methods));
meth = &(methods[index]);
server = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->server_entry), 0, -1);
@@ -778,7 +784,7 @@ connect_dialog_setup_for_type (CajaConnectServerDialog *dialog)
gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->details->type_combo)),
&iter, 0, &index, -1);
- g_assert (index < G_N_ELEMENTS (methods) && index >= 0);
+ g_assert (index >= 0 && ((gsize) index) < G_N_ELEMENTS (methods));
meth = &(methods[index]);
g_object_set (dialog->details->share_entry,
@@ -847,7 +853,7 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
GtkListStore *store;
GtkCellRenderer *renderer;
gchar *str;
- int i;
+ gsize i;
dialog->details = caja_connect_server_dialog_get_instance_private (dialog);
@@ -932,13 +938,16 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
dialog->details->type_combo = combo = gtk_combo_box_new ();
/* each row contains: method index, textual description */
- store = gtk_list_store_new (2, G_TYPE_INT, G_TYPE_STRING);
+ store = gtk_list_store_new (COL_TYPE_COMBO_NUM,
+ G_TYPE_INT, /* COL_TYPE_COMBO_INDEX */
+ G_TYPE_STRING); /* COL_TYPE_COMBO_DESCRIPTION */
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
g_object_unref (store);
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
- gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "text", 1);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "text",
+ COL_TYPE_COMBO_DESCRIPTION);
for (i = 0; i < G_N_ELEMENTS (methods); i++)
{
@@ -971,8 +980,8 @@ caja_connect_server_dialog_init (CajaConnectServerDialog *dialog)
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
- 0, i,
- 1, get_method_description (&(methods[i])),
+ COL_TYPE_COMBO_INDEX, (int) i,
+ COL_TYPE_COMBO_DESCRIPTION, get_method_description (&(methods[i])),
-1);
if (methods[i].flags & DEFAULT_METHOD)
diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c
index a01e058a..ba76ebda 100644
--- a/src/caja-file-management-properties.c
+++ b/src/caja-file-management-properties.c
@@ -384,7 +384,7 @@ update_caption_combo_box (GtkBuilder *builder,
const char *name)
{
GtkWidget *combo_box;
- int i;
+ guint i;
GPtrArray *column_names;
combo_box = GTK_WIDGET (gtk_builder_get_object (builder, combo_box_name));
@@ -401,7 +401,7 @@ update_caption_combo_box (GtkBuilder *builder,
{
if (!strcmp (name, g_ptr_array_index (column_names, i)))
{
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), i);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), (int) i);
break;
}
}
@@ -842,7 +842,7 @@ caja_file_management_properties_dialog_setup_extension_page (GtkBuilder *builder
gchar *ext_text_info;
GList *extensions;
- int i;
+ guint i;
extensions = caja_extensions_get_list ();
diff --git a/src/caja-image-properties-page.c b/src/caja-image-properties-page.c
index afb66c9e..344f8339 100644
--- a/src/caja-image-properties-page.c
+++ b/src/caja-image-properties-page.c
@@ -472,7 +472,7 @@ file_read_callback (GObject *object,
{
int exif_still_loading;
- g_assert (count_read <= sizeof(page->details->buffer));
+ g_assert (((size_t) count_read) <= sizeof (page->details->buffer));
#ifdef HAVE_EXIF
exif_still_loading = exif_loader_write (page->details->exifldr,
diff --git a/src/caja-navigation-window.c b/src/caja-navigation-window.c
index 0768d326..0cdbb1dd 100644
--- a/src/caja-navigation-window.c
+++ b/src/caja-navigation-window.c
@@ -519,7 +519,7 @@ caja_navigation_window_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
CajaNavigationWindow *window;
- int i;
+ gsize i;
window = CAJA_NAVIGATION_WINDOW (widget);
@@ -604,12 +604,12 @@ caja_navigation_window_button_press_event (GtkWidget *widget,
handled = FALSE;
window = CAJA_NAVIGATION_WINDOW (widget);
- if (mouse_extra_buttons && (event->button == mouse_back_button))
+ if (mouse_extra_buttons && (((int) event->button) == mouse_back_button))
{
caja_navigation_window_go_back (window);
handled = TRUE;
}
- else if (mouse_extra_buttons && (event->button == mouse_forward_button))
+ else if (mouse_extra_buttons && (((int) event->button) == mouse_forward_button))
{
caja_navigation_window_go_forward (window);
handled = TRUE;
@@ -1082,7 +1082,7 @@ gint
caja_navigation_window_get_base_page_index (CajaNavigationWindow *window)
{
CajaNavigationWindowSlot *slot;
- gint forward_count;
+ guint forward_count;
slot = CAJA_NAVIGATION_WINDOW_SLOT (CAJA_WINDOW (window)->details->active_pane->active_slot);
@@ -1097,7 +1097,7 @@ caja_navigation_window_get_base_page_index (CajaNavigationWindow *window)
/* The forward count indicate the relative postion of the base page
* in the history list
*/
- return forward_count;
+ return (int) forward_count;
}
/**
diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c
index 2cd22148..d0ef6ee8 100644
--- a/src/caja-places-sidebar.c
+++ b/src/caja-places-sidebar.c
@@ -1461,6 +1461,7 @@ reorder_bookmarks (CajaPlacesSidebar *sidebar,
GtkTreeIter iter;
PlaceType type;
int old_position;
+ guint list_length;
/* Get the selected path */
@@ -1472,12 +1473,12 @@ reorder_bookmarks (CajaPlacesSidebar *sidebar,
PLACES_SIDEBAR_COLUMN_INDEX, &old_position,
-1);
- if (type != PLACES_BOOKMARK ||
- old_position < 0 ||
- old_position >= caja_bookmark_list_length (sidebar->bookmarks))
- {
+ if (type != PLACES_BOOKMARK || old_position < 0)
+ return;
+
+ list_length = caja_bookmark_list_length (sidebar->bookmarks);
+ if (((guint) old_position) >= list_length)
return;
- }
caja_bookmark_list_move_item (sidebar->bookmarks, old_position,
new_position);
diff --git a/src/caja-query-editor.c b/src/caja-query-editor.c
index 2c600c5d..b4f96179 100644
--- a/src/caja-query-editor.c
+++ b/src/caja-query-editor.c
@@ -468,7 +468,7 @@ tags_row_add_to_query (CajaQueryEditorRow *row,
char **strv = g_strsplit (tags, " ", -1);
guint len = g_strv_length (strv);
- int i;
+ guint i;
for (i = 0; i < len; ++i) {
strv[i] = g_strstrip (strv[i]);
@@ -839,7 +839,7 @@ type_row_create_widgets (CajaQueryEditorRow *row)
GtkCellRenderer *cell;
GtkListStore *store;
GtkTreeIter iter;
- int i;
+ gsize i;
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_BOOLEAN);
combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
@@ -993,7 +993,7 @@ type_add_rows_from_query (CajaQueryEditor *editor,
char *mime_type;
CajaQueryEditorRow *row;
GtkTreeIter iter;
- int i;
+ gsize i;
GtkTreeModel *model;
GList *l;
@@ -1017,7 +1017,7 @@ type_add_rows_from_query (CajaQueryEditor *editor,
model = gtk_combo_box_get_model (GTK_COMBO_BOX (row->type_widget));
- gtk_tree_model_iter_nth_child (model, &iter, NULL, i + 2);
+ gtk_tree_model_iter_nth_child (model, &iter, NULL, ((gint) i) + 2);
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (row->type_widget),
&iter);
}
diff --git a/src/caja-window.c b/src/caja-window.c
index a180414c..2417e07c 100644
--- a/src/caja-window.c
+++ b/src/caja-window.c
@@ -1073,7 +1073,7 @@ caja_window_key_press_event (GtkWidget *widget,
return TRUE;
CajaWindow *window;
- int i;
+ gsize i;
window = CAJA_WINDOW (widget);
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index ddaa334c..c76eefba 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -2351,9 +2351,9 @@ fm_directory_view_display_selection_info (FMDirectoryView *view)
char *size_string;
if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS))
- size_string = g_format_size_full (non_folder_size, G_FORMAT_SIZE_IEC_UNITS);
+ size_string = g_format_size_full ((guint64) non_folder_size, G_FORMAT_SIZE_IEC_UNITS);
else
- size_string = g_format_size(non_folder_size);
+ size_string = g_format_size ((guint64) non_folder_size);
/* Translators: This is marked for translation in case a localiser
* needs to use something other than parentheses. The
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index 0ab2bfc7..2b38788d 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -4139,7 +4139,7 @@ permission_combo_update (FMPropertiesWindow *window,
int current_perm;
gtk_tree_model_get (model, &iter, 1, &current_perm, -1);
- if (current_perm == all_perm) {
+ if (((PermissionValue) current_perm) == all_perm) {
found = TRUE;
break;
}