]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: [partitions] fix compiler warnings [-Wunused-parameter -Wsign-compare]
authorKarel Zak <kzak@redhat.com>
Tue, 2 Aug 2011 11:22:30 +0000 (13:22 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 2 Aug 2011 11:22:30 +0000 (13:22 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/partitions/aix.c
libblkid/src/partitions/dos.c
libblkid/src/partitions/gpt.c
libblkid/src/partitions/mac.c
libblkid/src/partitions/minix.c
libblkid/src/partitions/partitions.c
libblkid/src/partitions/sgi.c
libblkid/src/partitions/solaris_x86.c
libblkid/src/partitions/sun.c
libblkid/src/partitions/ultrix.c
libblkid/src/partitions/unixware.c

index be0ad2b465ac82b4561a93f2e962e63923856a98..de397bf4ad1485b65063eb539962976c54f2a566 100644 (file)
@@ -14,7 +14,8 @@
 #include "partitions.h"
 #include "aix.h"
 
-static int probe_aix_pt(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_aix_pt(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        blkid_partlist ls;
        blkid_parttable tab;
index 72ac7788c419cfc045ef8ab977ed0827b6a67987..22d2625dfadb85891972c52f74896c0268af305a 100644 (file)
@@ -128,7 +128,8 @@ err:
        return -1;
 }
 
-static int probe_dos_pt(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_dos_pt(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        int i;
        int ssf;
@@ -240,7 +241,7 @@ static int probe_dos_pt(blkid_probe pr, const struct blkid_idmag *mag)
        /* Parse subtypes (nested partitions) on large disks */
        if (!blkid_probe_is_tiny(pr)) {
                for (p = p0, i = 0; i < 4; i++, p++) {
-                       int n;
+                       size_t n;
 
                        if (!dos_partition_size(p) || is_extended(p))
                                continue;
index 9281a89439f67f70236142db60476550030ff145..c0517c427117fcf0a8c771f5e47f82991c9b35f6 100644 (file)
@@ -287,16 +287,16 @@ static struct gpt_header *get_gpt_header(
        return h;
 }
 
-static int probe_gpt_pt(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_gpt_pt(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        uint64_t lastlba = 0, lba;
        struct gpt_header hdr, *h;
        struct gpt_entry *e;
        blkid_parttable tab = NULL;
        blkid_partlist ls;
-       int i;
        uint64_t fu, lu;
-       uint32_t ssf;
+       uint32_t ssf, i;
 
 
        if (last_lba(pr, &lastlba))
index 538b272708ed06eabceae127405288f9b9a631b8..4715ab6b640549dd87c2149b2f1485e55a3dd884 100644 (file)
@@ -71,15 +71,15 @@ static inline int has_part_signature(struct mac_partition *p)
                be16_to_cpu(p->signature) == MAC_PARTITION_MAGIC_OLD;
 }
 
-static int probe_mac_pt(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_mac_pt(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct mac_driver_desc *md;
        struct mac_partition *p;
        blkid_parttable tab = NULL;
        blkid_partlist ls;
-       int i;
        uint16_t ssf;   /* sector size fragment */
-       uint32_t nblks;
+       uint32_t nblks, i;
 
 
        /* The driver descriptor record is always located at physical block 0,
index b67d2c7b98fd86bf9e91b82ba899950d25aca66f..bd57a6d4b06c095d33f7fb34ca88199b8841a2b1 100644 (file)
@@ -15,7 +15,8 @@
 #include "dos.h"
 #include "minix.h"
 
-static int probe_minix_pt(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_minix_pt(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct dos_partition *p;
        blkid_parttable tab = NULL;
index a73181234ffd721a66741598a152fc5f10d8ac76..86bf432247c46d8d67f6f1d13cfdd6519dce44c0 100644 (file)
@@ -339,7 +339,7 @@ static void free_parttables(blkid_partlist ls)
        }
 }
 
-static void reset_partlist(blkid_probe pr, blkid_partlist ls)
+static void reset_partlist(blkid_partlist ls)
 {
        if (!ls)
                return;
@@ -364,7 +364,7 @@ static void reset_partlist(blkid_probe pr, blkid_partlist ls)
        DBG(DEBUG_LOWPROBE, printf("partlist reseted\n"));
 }
 
-static blkid_partlist partitions_init_data(blkid_probe pr, struct blkid_chain *chn)
+static blkid_partlist partitions_init_data(struct blkid_chain *chn)
 {
        blkid_partlist ls;
 
@@ -378,7 +378,7 @@ static blkid_partlist partitions_init_data(blkid_probe pr, struct blkid_chain *c
                chn->data = (void *) ls;
        }
 
-       reset_partlist(pr, ls);
+       reset_partlist(ls);
 
        DBG(DEBUG_LOWPROBE,
                printf("parts: initialized partitions list (%p, size=%d)\n",
@@ -386,7 +386,8 @@ static blkid_partlist partitions_init_data(blkid_probe pr, struct blkid_chain *c
        return ls;
 }
 
-static void partitions_free_data(blkid_probe pr, void *data)
+static void partitions_free_data(blkid_probe pr __attribute__((__unused__)),
+                                void *data)
 {
        blkid_partlist ls = (blkid_partlist) data;
 
@@ -547,7 +548,7 @@ static int idinfo_probe(blkid_probe pr, const struct blkid_idinfo *id)
                rc = id->probefunc(pr, mag);
                if (rc == -1) {
                        /* reset after error */
-                       reset_partlist(pr, blkid_probe_get_partlist(pr));
+                       reset_partlist(blkid_probe_get_partlist(pr));
                        DBG(DEBUG_LOWPROBE, printf(
                                "%s probefunc failed\n", id->name));
                }
@@ -564,14 +565,15 @@ nothing:
  */
 static int partitions_probe(blkid_probe pr, struct blkid_chain *chn)
 {
-       int i = 0, rc = 1;
+       int rc = 1;
+       size_t i;
 
        if (!pr || chn->idx < -1)
                return -1;
        blkid_probe_chain_reset_vals(pr, chn);
 
        if (chn->binary)
-               partitions_init_data(pr, chn);
+               partitions_init_data(chn);
 
        if (!pr->wipe_size && (pr->prob_flags & BLKID_PROBE_FL_IGNORE_PT))
                goto details_only;
@@ -580,7 +582,7 @@ static int partitions_probe(blkid_probe pr, struct blkid_chain *chn)
                printf("--> starting probing loop [PARTS idx=%d]\n",
                chn->idx));
 
-       i = chn->idx + 1;
+       i = chn->idx < 0 ? 0 : chn->idx + 1U;
 
        for ( ; i < ARRAY_SIZE(idinfos); i++) {
                const char *name;
@@ -830,7 +832,7 @@ done:
  */
 int blkid_known_pttype(const char *pttype)
 {
-       int i;
+       size_t i;
 
        if (!pttype)
                return 0;
@@ -962,7 +964,7 @@ blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno
                         if (partno != blkid_partition_get_partno(par))
                                 continue;
 
-                        if (size == blkid_partition_get_size(par) ||
+                        if ((blkid_loff_t) size == blkid_partition_get_size(par) ||
                             (blkid_partition_is_extended(par) && size <= 1024))
                                 return par;
 
@@ -975,12 +977,12 @@ blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno
        for (i = 0; i < ls->nparts; i++) {
                blkid_partition par = &ls->parts[i];
 
-               if (blkid_partition_get_start(par) == start &&
-                   blkid_partition_get_size(par) == size)
+               if (blkid_partition_get_start(par) == (blkid_loff_t) start &&
+                   blkid_partition_get_size(par) == (blkid_loff_t) size)
                        return par;
 
                /* exception for extended dos partitions */
-               if (blkid_partition_get_start(par) == start &&
+               if (blkid_partition_get_start(par) == (blkid_loff_t) start &&
                    blkid_partition_is_extended(par) && size <= 1024)
                        return par;
 
index 945ead542a21d5360c59bee7ebd14f28eb56382a..b89e46320a8d785f065d6b4c6c6120db4a8f030b 100644 (file)
@@ -89,7 +89,8 @@ static uint32_t count_checksum(struct sgi_disklabel *label)
 }
 
 
-static int probe_sgi_pt(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_sgi_pt(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct sgi_disklabel *l;
        struct sgi_partition *p;
index ce102bd8f7a2ecf3c534b901dbe817a8e0e59022..7824f4ee7e93331a52b4513fe3d5ff0b3f61d96c 100644 (file)
@@ -57,7 +57,8 @@ struct solaris_vtoc {
        char         v_asciilabel[128]; /* for compatibility */
 } __attribute__((packed));
 
-static int probe_solaris_pt(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_solaris_pt(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct solaris_vtoc *l; /* disk label */
        struct solaris_slice *p;        /* partitsion */
index dffab24c60ce635d7899f05a0883be661def8b25..f151f46ae4589ad24c6d619c3a9d851dfaf85d85 100644 (file)
@@ -80,7 +80,8 @@ uint16_t count_checksum(struct sun_disklabel *label)
        return sum;
 }
 
-static int probe_sun_pt(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_sun_pt(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct sun_disklabel *l;
        struct sun_partition *p;
index cc848d0a62a06db705cea0c0c0d17870a637bd5b..f637c5474456a9e094310a98fd82004ea58e32b0 100644 (file)
@@ -32,7 +32,8 @@ struct ultrix_disklabel {
 } __attribute__((packed));
 
 
-static int probe_ultrix_pt(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_ultrix_pt(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        unsigned char *data;
        struct ultrix_disklabel *l;
index ac11a46d31e48a7f5b02b1dfa2d5ee21b9873537..e9bcba358565090ce70ad7d217053134955b91c4 100644 (file)
@@ -94,7 +94,8 @@ struct unixware_disklabel {
        } __attribute__((packed)) vtoc;
 };
 
-static int probe_unixware_pt(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_unixware_pt(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct unixware_disklabel *l;
        struct unixware_partition *p;