diff options
author | rbuj <[email protected]> | 2021-12-19 23:34:14 +0100 |
---|---|---|
committer | Luke from DC <[email protected]> | 2022-02-09 04:03:59 +0000 |
commit | b6d46039be75bd2b868ee6c32b091a1e37720a20 (patch) | |
tree | fe11a75d22da7ca239204f000c33b2338cc07419 /libcaja-private | |
parent | 97b61e663e47e6bd6ee6ff460895a7370b3c6159 (diff) | |
download | caja-b6d46039be75bd2b868ee6c32b091a1e37720a20.tar.bz2 caja-b6d46039be75bd2b868ee6c32b091a1e37720a20.tar.xz |
Fix some -Wsign-compare warnings
Diffstat (limited to 'libcaja-private')
-rw-r--r-- | libcaja-private/caja-debug-log.c | 2 | ||||
-rw-r--r-- | libcaja-private/caja-desktop-metadata.c | 2 | ||||
-rw-r--r-- | libcaja-private/caja-file-operations.c | 44 | ||||
-rw-r--r-- | libcaja-private/caja-file.c | 4 | ||||
-rw-r--r-- | libcaja-private/caja-query.c | 5 |
5 files changed, 27 insertions, 30 deletions
diff --git a/libcaja-private/caja-debug-log.c b/libcaja-private/caja-debug-log.c index d872f91d..a7594757 100644 --- a/libcaja-private/caja-debug-log.c +++ b/libcaja-private/caja-debug-log.c @@ -358,7 +358,7 @@ caja_debug_log_load_configuration (const char *filename, GError **error) g_error_free (my_error); else { - int i; + gsize i; for (i = 0; i < num_strings; i++) strings[i] = g_strstrip (strings[i]); diff --git a/libcaja-private/caja-desktop-metadata.c b/libcaja-private/caja-desktop-metadata.c index fd3bf08e..7fad726f 100644 --- a/libcaja-private/caja-desktop-metadata.c +++ b/libcaja-private/caja-desktop-metadata.c @@ -240,7 +240,7 @@ caja_desktop_update_metadata_from_keyfile (CajaFile *file, gsize length, values_length; GKeyFile *keyfile; GFileInfo *info; - gint idx; + gsize idx; gboolean res; keyfile = get_keyfile (); diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c index e82fe259..60193d47 100644 --- a/libcaja-private/caja-file-operations.c +++ b/libcaja-private/caja-file-operations.c @@ -376,7 +376,7 @@ get_link_name (const char *name, int count, int max_length) { const char *format; char *result; - int unshortened_length; + size_t unshortened_length; gboolean use_count; g_assert (name != NULL); @@ -444,10 +444,10 @@ get_link_name (const char *name, int count, int max_length) else result = g_strdup_printf (format, name); - if (max_length > 0 && (unshortened_length = strlen (result)) > max_length) { + if (max_length > 0 && (unshortened_length = strlen (result)) > (size_t) max_length) { char *new_name; - new_name = shorten_utf8_string (name, unshortened_length - max_length); + new_name = shorten_utf8_string (name, ((int) unshortened_length) - max_length); if (new_name) { g_free (result); @@ -456,7 +456,7 @@ get_link_name (const char *name, int count, int max_length) else result = g_strdup_printf (format, new_name); - g_assert (strlen (result) <= max_length); + g_assert (strlen (result) <= (size_t) max_length); g_free (new_name); } } @@ -655,7 +655,7 @@ make_next_duplicate_name (const char *base, const char *suffix, int count, int m { const char *format; char *result; - int unshortened_length; + size_t unshortened_length; gboolean use_count; if (count < 1) { @@ -733,10 +733,10 @@ make_next_duplicate_name (const char *base, const char *suffix, int count, int m else result = g_strdup_printf (format, base, suffix); - if (max_length > 0 && (unshortened_length = strlen (result)) > max_length) { + if (max_length > 0 && (unshortened_length = strlen (result)) > (size_t) max_length) { char *new_base; - new_base = shorten_utf8_string (base, unshortened_length - max_length); + new_base = shorten_utf8_string (base, ((int) unshortened_length) - max_length); if (new_base) { g_free (result); @@ -745,7 +745,7 @@ make_next_duplicate_name (const char *base, const char *suffix, int count, int m else result = g_strdup_printf (format, new_base, suffix); - g_assert (strlen (result) <= max_length); + g_assert (strlen (result) <= (size_t) max_length); g_free (new_base); } } @@ -1778,7 +1778,7 @@ delete_file (CommonJob *job, GFile *file, } static void -delete_files (CommonJob *job, GList *files, int *files_skipped) +delete_files (CommonJob *job, GList *files, guint *files_skipped) { GList *l; SourceInfo source_info; @@ -1821,10 +1821,10 @@ delete_files (CommonJob *job, GList *files, int *files_skipped) static void report_trash_progress (CommonJob *job, - int files_trashed, - int total_files) + guint files_trashed, + guint total_files) { - int files_left; + guint files_left; char *s; files_left = total_files - files_trashed; @@ -1844,13 +1844,13 @@ report_trash_progress (CommonJob *job, } static void -trash_files (CommonJob *job, GList *files, int *files_skipped) +trash_files (CommonJob *job, GList *files, guint *files_skipped) { GList *l; GFile *file; GList *to_delete; GError *error; - int total_files, files_trashed; + guint total_files, files_trashed; char *primary, *secondary, *details; int response; @@ -1978,7 +1978,7 @@ delete_job (GIOSchedulerJob *io_job, gboolean must_confirm_delete_in_trash; gboolean must_confirm_delete; gboolean must_confirm_trash; - int files_skipped; + guint files_skipped; GFile *file = NULL; common = (CommonJob *)job; @@ -2923,11 +2923,11 @@ verify_destination (CommonJob *job, free_size = g_file_info_get_attribute_uint64 (fsinfo, G_FILE_ATTRIBUTE_FILESYSTEM_FREE); - if (free_size < required_size) { + if (free_size < (guint64) required_size) { primary = f (_("Error while copying to \"%B\"."), dest); secondary = f(_("There is not enough space on the destination. Try to remove files to make space.")); - details = f (_("There is %S available, but %S is required."), free_size, required_size); + details = f (_("There is %" G_GUINT64_FORMAT " available, but %" G_GOFFSET_FORMAT " is required."), free_size, required_size); response = run_warning (job, primary, @@ -3174,7 +3174,7 @@ make_file_name_valid_for_dest_fs (char *filename, !strcmp (dest_fs_type, "msdos") || !strcmp (dest_fs_type, "msdosfs")) { gboolean ret; - int i, old_len; + size_t i, old_len; ret = str_replace (filename, FAT_FORBIDDEN_CHARACTERS, '_'); @@ -6134,11 +6134,13 @@ create_job (GIOSchedulerJob *io_job, if (count == 1) { new_filename = g_strdup (filename); } else if (job->make_dir) { - filename2 = g_strdup_printf ("%s %d", filename, count); + size_t unshortened_length; + filename2 = g_strdup_printf ("%s %d", filename, count); + unshortened_length = strlen (filename2); new_filename = NULL; - if (max_length > 0 && strlen (filename2) > max_length) { - new_filename = shorten_utf8_string (filename2, strlen (filename2) - max_length); + if (max_length > 0 && unshortened_length > (size_t) max_length) { + new_filename = shorten_utf8_string (filename2, ((int) unshortened_length) - max_length); } if (new_filename == NULL) { diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c index a5ed4ff9..27856bf7 100644 --- a/libcaja-private/caja-file.c +++ b/libcaja-private/caja-file.c @@ -6254,9 +6254,9 @@ caja_file_get_size_as_string (CajaFile *file, } if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_USE_IEC_UNITS)) - return g_format_size_full (size, G_FORMAT_SIZE_IEC_UNITS); + return g_format_size_full ((guint64) size, G_FORMAT_SIZE_IEC_UNITS); else - return g_format_size (size); + return g_format_size ((guint64) size); } /** diff --git a/libcaja-private/caja-query.c b/libcaja-private/caja-query.c index d0902652..ddeb8d24 100644 --- a/libcaja-private/caja-query.c +++ b/libcaja-private/caja-query.c @@ -335,11 +335,6 @@ caja_query_parse_xml (char *xml, gsize xml_len) ParserInfo info = { NULL }; GMarkupParseContext *ctx; - if (xml_len == -1) - { - xml_len = strlen (xml); - } - info.query = caja_query_new (); info.in_text = FALSE; |