[sound-juicer] Fix -Wsign-compare warning
- From: Phillip Wood <pwood src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sound-juicer] Fix -Wsign-compare warning
- Date: Mon, 13 Feb 2017 10:57:19 +0000 (UTC)
commit f2ad4683f1e93983cd54d7ab30d2f7049510b1fd
Author: Phillip Wood <phillip wood dunelm org uk>
Date: Fri Feb 3 11:30:01 2017 +0000
Fix -Wsign-compare warning
max_realfile needs to be an int as it’s passed to printf to control the
field width but strlen returns size_t. The casts are a bit ugly but the
strings are filenames so shouldn’t overflow an int.
src/sj-extracting.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/sj-extracting.c b/src/sj-extracting.c
index 0d17c00..bc40abf 100644
--- a/src/sj-extracting.c
+++ b/src/sj-extracting.c
@@ -133,7 +133,7 @@ build_filename (const TrackDetails *track, gboolean temp_filename, GError **erro
GFile *uri, *new;
gchar *realfile, *realpath, *filename, *scheme;
const gchar *extension;
- size_t len_extension;
+ int len_extension;
int max_realfile = INT_MAX;
GstEncodingProfile *profile;
@@ -155,7 +155,7 @@ build_filename (const TrackDetails *track, gboolean temp_filename, GError **erro
gst_encoding_profile_unref (profile);
}
- len_extension = 1 + strlen (extension);
+ len_extension = 1 + (int) strlen (extension);
#if defined(NAME_MAX) && NAME_MAX > 0
max_realfile = NAME_MAX - len_extension;
#endif /* NAME_MAX */
@@ -163,7 +163,7 @@ build_filename (const TrackDetails *track, gboolean temp_filename, GError **erro
scheme = g_file_get_uri_scheme (uri);
if (scheme && !strcmp (scheme, "file")) {
gchar *path = g_file_get_path (uri);
- size_t len_path = strlen (path) + 1;
+ int len_path = (int) strlen (path) + 1;
max_realfile = MIN (max_realfile, PATH_MAX - len_path - len_extension);
g_free (path);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]