]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: fix compiler warnings [-Wunused-parameter -Wsign-compare]
authorKarel Zak <kzak@redhat.com>
Tue, 2 Aug 2011 11:29:29 +0000 (13:29 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 2 Aug 2011 11:29:29 +0000 (13:29 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
TODO
libblkid/src/blkidP.h
libblkid/src/devno.c
libblkid/src/probe.c

diff --git a/TODO b/TODO
index 0dc74885c74aff5417b265eff13d7c623fee3ca9..37a3a273eb0432bba1acfeb8003663609c220866 100644 (file)
--- a/TODO
+++ b/TODO
@@ -143,6 +143,9 @@ libblkid
  - remove strerrr() from debug messages (use %m) to make BLKID_DEBUG= output
    thread-safe
 
+ - (!) don't use internally blkid_loff_t, rather use off_t, size_t, ssize_t,
+       stdint.h types and so on...
+
  - add -<BE|LE> suffix to test images for native-endian filesystems (e.g. swap)
    and add support for such functionality to tests/ts/blkid/low-probe
 
index aeeebc16512c6e79f0e929fd657e62940fb0aa90..61a1aad89560b384a1022d2b93a090967f793280 100644 (file)
@@ -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 */
index 9a356a84f5df795511ace785834e02fa016e4daa..92ed7c0259dd6d12ad1bf183145a1f94c376a723 100644 (file)
@@ -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) {
index 3c691cf7d49d810accdba1a4989186d7abb32384..7d0c9f9586ff12c8de3826bcab9389a4950602b9 100644 (file)
@@ -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;