diff options
author | Karel Zak | 2011-08-02 13:29:29 +0200 |
---|---|---|
committer | Karel Zak | 2011-08-02 13:29:29 +0200 |
commit | c9f51c712f952d661b264b4c5ac175a9ac08f60e (patch) | |
tree | a3f23727036fbd76c70e676b5ce6ed948bb2ad8a /libblkid | |
parent | libblkid: [superblocks] fix compiler warnings [-Wunused-parameter -Wsign-comp... (diff) | |
download | kernel-qcow2-util-linux-c9f51c712f952d661b264b4c5ac175a9ac08f60e.tar.gz kernel-qcow2-util-linux-c9f51c712f952d661b264b4c5ac175a9ac08f60e.tar.xz kernel-qcow2-util-linux-c9f51c712f952d661b264b4c5ac175a9ac08f60e.zip |
libblkid: fix compiler warnings [-Wunused-parameter -Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid')
-rw-r--r-- | libblkid/src/blkidP.h | 4 | ||||
-rw-r--r-- | libblkid/src/devno.c | 4 | ||||
-rw-r--r-- | libblkid/src/probe.c | 20 |
3 files changed, 16 insertions, 12 deletions
diff --git a/libblkid/src/blkidP.h b/libblkid/src/blkidP.h index aeeebc165..61a1aad89 100644 --- a/libblkid/src/blkidP.h +++ b/libblkid/src/blkidP.h @@ -90,7 +90,7 @@ struct blkid_chain { int enabled; /* boolean */ int flags; /* BLKID_<chain>_* */ int binary; /* boolean */ - int idx; /* index of the current prober */ + int idx; /* index of the current prober (or -1) */ unsigned long *fltr; /* filter or NULL */ void *data; /* private chain data or NULL */ }; @@ -99,7 +99,7 @@ struct blkid_chain { * Chain driver */ struct blkid_chaindrv { - const int id; /* BLKID_CHAIN_* */ + const size_t id; /* BLKID_CHAIN_* */ const char *name; /* name of chain (for debug purpose) */ const int dflt_flags; /* default chain flags */ const int dflt_enabled; /* default enabled boolean */ diff --git a/libblkid/src/devno.c b/libblkid/src/devno.c index 9a356a84f..92ed7c025 100644 --- a/libblkid/src/devno.c +++ b/libblkid/src/devno.c @@ -460,10 +460,10 @@ int blkid_driver_has_major(const char *drvname, int major) } while (fgets(buf, sizeof(buf), f)) { - unsigned int maj; + int maj; char name[64]; - if (sscanf(buf, "%u %64[^\n ]", &maj, name) != 2) + if (sscanf(buf, "%d %64[^\n ]", &maj, name) != 2) continue; if (maj == major && strcmp(name, drvname) == 0) { diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c index 3c691cf7d..7d0c9f958 100644 --- a/libblkid/src/probe.c +++ b/libblkid/src/probe.c @@ -456,7 +456,7 @@ unsigned long *blkid_probe_get_filter(blkid_probe pr, int chain, int create) */ int __blkid_probe_invert_filter(blkid_probe pr, int chain) { - int i; + size_t i; struct blkid_chain *chn; chn = &pr->chains[chain]; @@ -481,7 +481,7 @@ int __blkid_probe_filter_types(blkid_probe pr, int chain, int flag, char *names[ { unsigned long *fltr; struct blkid_chain *chn; - int i; + size_t i; fltr = blkid_probe_get_filter(pr, chain, TRUE); if (!fltr) @@ -882,10 +882,10 @@ int blkid_do_probe(blkid_probe pr) * the start (chain->idx == -1) */ else if (rc == 1 && (chn->enabled == FALSE || - chn->idx + 1 == chn->driver->nidinfos || + chn->idx + 1 == (int) chn->driver->nidinfos || chn->idx == -1)) { - int idx = chn->driver->id + 1; + size_t idx = chn->driver->id + 1; if (idx < BLKID_NCHAINS) chn = pr->cur_chain = &pr->chains[idx]; @@ -1398,11 +1398,15 @@ struct blkid_prval *__blkid_probe_lookup_value(blkid_probe pr, const char *name) /* converts DCE UUID (uuid[16]) to human readable string * - the @len should be always 37 */ -void blkid_unparse_uuid(const unsigned char *uuid, char *str, size_t len) -{ #ifdef HAVE_LIBUUID +void blkid_unparse_uuid(const unsigned char *uuid, char *str, + size_t len __attribute__((__unused__))) +{ uuid_unparse(uuid, str); +} #else +void blkid_unparse_uuid(const unsigned char *uuid, char *str, size_t len) +{ snprintf(str, len, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", uuid[0], uuid[1], uuid[2], uuid[3], @@ -1410,8 +1414,8 @@ void blkid_unparse_uuid(const unsigned char *uuid, char *str, size_t len) uuid[6], uuid[7], uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14],uuid[15]); -#endif } +#endif /* Removes whitespace from the right-hand side of a string (trailing @@ -1464,7 +1468,7 @@ void blkid_probe_set_wiper(blkid_probe pr, blkid_loff_t off, blkid_loff_t size) chn = pr->cur_chain; if (!chn || !chn->driver || - chn->idx < 0 || chn->idx >= chn->driver->nidinfos) + chn->idx < 0 || (size_t) chn->idx >= chn->driver->nidinfos) return; pr->wipe_size = size; |