]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: fix compiler warnings [-Wunused-parameter -Wsign-compare]
authorKarel Zak <kzak@redhat.com>
Tue, 2 Aug 2011 09:21:16 +0000 (11:21 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 2 Aug 2011 09:21:16 +0000 (11:21 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/samples/mount.c
libmount/src/cache.c
libmount/src/context.c
libmount/src/lock.c
libmount/src/utils.c

index e01612144609e7954e608064f1ad81fd0e70709d..30c2610edc5764b0e2ab95e765035241f9e2b124 100644 (file)
@@ -79,7 +79,7 @@ static void __attribute__((__noreturn__)) print_version(void)
        exit(EX_SUCCESS);
 }
 
-static int table_parser_errcb(struct libmnt_table *tb,
+static int table_parser_errcb(struct libmnt_table *tb __attribute__((__unused__)),
                        const char *filename, int line)
 {
        if (filename)
index ecd71697c272416424582052b8b43ffd04c03ceb..802d072ee7c394a6fce15cc67f6889b9414eb621 100644 (file)
@@ -86,7 +86,7 @@ struct libmnt_cache *mnt_new_cache(void)
  */
 void mnt_free_cache(struct libmnt_cache *cache)
 {
-       int i;
+       size_t i;
 
        if (!cache)
                return;
@@ -181,7 +181,7 @@ static int cache_add_tag(struct libmnt_cache *cache, const char *tagname,
  */
 static const char *cache_find_path(struct libmnt_cache *cache, const char *path)
 {
-       int i;
+       size_t i;
 
        assert(cache);
        assert(path);
@@ -205,7 +205,7 @@ static const char *cache_find_path(struct libmnt_cache *cache, const char *path)
 static const char *cache_find_tag(struct libmnt_cache *cache,
                        const char *token, const char *value)
 {
-       int i;
+       size_t i;
        size_t tksz;
 
        assert(cache);
@@ -231,7 +231,7 @@ static const char *cache_find_tag(struct libmnt_cache *cache,
 static char *cache_find_tag_value(struct libmnt_cache *cache,
                        const char *devname, const char *token)
 {
-       int i;
+       size_t i;
 
        assert(cache);
        assert(devname);
@@ -297,7 +297,8 @@ static int cache_get_probe(struct libmnt_cache *cache, const char *devname,
  */
 int mnt_cache_read_tags(struct libmnt_cache *cache, const char *devname)
 {
-       int i, ntags = 0, rc;
+       size_t i, ntags = 0;
+       int rc;
        const char *tags[] = { "LABEL", "UUID", "TYPE" };
 
        assert(cache);
@@ -355,7 +356,7 @@ int mnt_cache_read_tags(struct libmnt_cache *cache, const char *devname)
                ntags++;
        }
 
-       DBG(CACHE, mnt_debug_h(cache, "\tread %d tags", ntags));
+       DBG(CACHE, mnt_debug_h(cache, "\tread %zd tags", ntags));
        return ntags ? 0 : 1;
 error:
        return -1;
index dc43707e95fd9a21df89ce4ffabd9cfe7acf8bf3..d9b311621686f409b59061a6122e9a4dc43de2e5 100644 (file)
@@ -1244,7 +1244,7 @@ int mnt_context_prepare_helper(struct libmnt_context *cxt, const char *name,
                                                path, name, type);
                path = strtok_r(NULL, ":", &p);
 
-               if (rc >= sizeof(helper) || rc < 0)
+               if (rc < 0 || (size_t) rc >= sizeof(helper))
                        continue;
 
                rc = stat(helper, &st);
@@ -1595,7 +1595,9 @@ int mnt_context_set_syscall_status(struct libmnt_context *cxt, int status)
  *
  * Returns: 0 or negative number in case of error.
  */
-int mnt_context_strerror(struct libmnt_context *cxt, char *buf, size_t bufsiz)
+int mnt_context_strerror(struct libmnt_context *cxt __attribute__((__unused__)),
+                        char *buf __attribute__((__unused__)),
+                        size_t bufsiz __attribute__((__unused__)))
 {
        /* TODO: based on cxt->syscall_errno or cxt->helper_status */
        return 0;
@@ -1605,7 +1607,7 @@ int mnt_context_strerror(struct libmnt_context *cxt, char *buf, size_t bufsiz)
  * mnt_context_init_helper
  * @cxt: mount context
  * @action: MNT_ACT_{UMOUNT,MOUNT}
- * @flags: not used
+ * @flags: not used now
  *
  * This function infors libmount that used from [u]mount.type helper.
  *
@@ -1618,7 +1620,8 @@ int mnt_context_strerror(struct libmnt_context *cxt, char *buf, size_t bufsiz)
  *
  * Returns: 0 on success, negative number in case of error.
  */
-int mnt_context_init_helper(struct libmnt_context *cxt, int action, int flags)
+int mnt_context_init_helper(struct libmnt_context *cxt, int action,
+                           int flags __attribute__((__unused__)))
 {
        int rc = mnt_context_disable_helpers(cxt, TRUE);
 
index a6619b31599637212dc28f1e2e133b03b0c095a0..1670f0dda0246c3c3c1246aaf4688d2c3a950bb9 100644 (file)
@@ -236,7 +236,7 @@ err:
  * traditional mtab locking
  */
 
-static void mnt_lockalrm_handler(int sig)
+static void mnt_lockalrm_handler(int sig __attribute__((__unused__)))
 {
        /* do nothing, say nothing, be nothing */
 }
index 67389709b031a43ac1d3fc496597e01e1e1afa2e..f4d51e7873b2652c4587f7c7becb5d60dcc0ffb8 100644 (file)
@@ -263,7 +263,8 @@ static int check_option(const char *haystack, size_t len,
 
        for (p = haystack; p && p < haystack + len; p++) {
                char *sep = strchr(p, ',');
-               size_t plen = sep ? sep - p : len - (p - haystack);
+               size_t plen = sep ? (size_t) (sep - p) :
+                                   len - (p - haystack);
 
                if (plen == needle_len) {
                        if (!strncmp(p, needle, plen))
@@ -309,7 +310,8 @@ int mnt_match_options(const char *optstr, const char *pattern)
 
        for (p = pattern; p < pattern + len; p++) {
                char *sep = strchr(p, ',');
-               size_t plen = sep ? sep - p : len - (p - pattern);
+               size_t plen = sep ? (size_t) (sep - p) :
+                                   len - (p - pattern);
 
                if (!plen)
                        continue; /* if two ',' appear in a row */