From 7fc6d2b8f8f55f38f069414706bac59c20dd4d24 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 2 Aug 2011 11:21:16 +0200 Subject: libmount: fix compiler warnings [-Wunused-parameter -Wsign-compare] Signed-off-by: Karel Zak --- libmount/src/cache.c | 13 +++++++------ libmount/src/context.c | 11 +++++++---- libmount/src/lock.c | 2 +- libmount/src/utils.c | 6 ++++-- 4 files changed, 19 insertions(+), 13 deletions(-) (limited to 'libmount/src') diff --git a/libmount/src/cache.c b/libmount/src/cache.c index ecd71697c..802d072ee 100644 --- a/libmount/src/cache.c +++ b/libmount/src/cache.c @@ -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; diff --git a/libmount/src/context.c b/libmount/src/context.c index dc43707e9..d9b311621 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -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); diff --git a/libmount/src/lock.c b/libmount/src/lock.c index a6619b315..1670f0dda 100644 --- a/libmount/src/lock.c +++ b/libmount/src/lock.c @@ -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 */ } diff --git a/libmount/src/utils.c b/libmount/src/utils.c index 67389709b..f4d51e787 100644 --- a/libmount/src/utils.c +++ b/libmount/src/utils.c @@ -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 */ -- cgit v1.2.3-55-g7522