]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: fix printf stuff
authorKarel Zak <kzak@redhat.com>
Tue, 15 Oct 2013 11:26:04 +0000 (13:26 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 23 Oct 2013 08:46:10 +0000 (10:46 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/ask.c
libfdisk/src/bsd.c
libfdisk/src/dos.c
libfdisk/src/gpt.c
libfdisk/src/libfdisk.h
libfdisk/src/sgi.c
libfdisk/src/sun.c

index dd152a1f0cf27f5d6f7dec5b8d2d1065ff572231..8a5174c7eb8942cea7f3d81a97d05a139e991754 100644 (file)
@@ -331,7 +331,7 @@ int fdisk_ask_partnum(struct fdisk_context *cxt, size_t *partnum, int wantnew)
                if (num->low > 0) {
                        /* only one existing partiton, don't ask, return the number */
                        fdisk_ask_number_set_result(ask, num->low);
-                       fdisk_info(cxt, _("Selected partition %d"), (int) num->low);
+                       fdisk_info(cxt, _("Selected partition %ju"), num->low);
 
                } else if (num->low == 0) {
                        fdisk_warnx(cxt, _("No partition is defined yet!"));
@@ -343,7 +343,7 @@ int fdisk_ask_partnum(struct fdisk_context *cxt, size_t *partnum, int wantnew)
                if (num->low > 0) {
                        /* only one free partition, don't ask, return the number */
                        fdisk_ask_number_set_result(ask, num->low);
-                       fdisk_info(cxt, _("Selected partition %d"), (int) num->low);
+                       fdisk_info(cxt, _("Selected partition %ju"), num->low);
                }
                if (num->low == 0) {
                        fdisk_warnx(cxt, _("No free partition available!"));
index e898319fbb105303c70ab47e4fb0c8c8b9b97876..fdeaad29fc33970326b3203498515fbc3355f7ae 100644 (file)
@@ -838,8 +838,8 @@ int fdisk_bsd_link_partition(struct fdisk_context *cxt)
        fdisk_label_set_changed(cxt->label, 1);
 
        fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
-                       _("BSD partition '%c' linked to DOS partition %d."),
-                       'a' + (int) i, (int) k + 1);
+                       _("BSD partition '%c' linked to DOS partition %zu."),
+                       'a' + (int) i, k + 1);
        return 0;
 }
 
index 40c05af13cce55df44d1d67f546dd0d3592fa14b..ac8708fb6ca6c407d269d9bf0ee46648d576d6bf 100644 (file)
@@ -196,7 +196,7 @@ static int read_sector(struct fdisk_context *cxt, sector_t secno,
 }
 
 /* Allocate a buffer and read a partition table sector */
-static int read_pte(struct fdisk_context *cxt, int pno, sector_t offset)
+static int read_pte(struct fdisk_context *cxt, size_t pno, sector_t offset)
 {
        unsigned char *buf;
        struct pte *pe = self_pte(cxt, pno);
@@ -205,7 +205,7 @@ static int read_pte(struct fdisk_context *cxt, int pno, sector_t offset)
        if (!buf)
                return -ENOMEM;
 
-       DBG(LABEL, dbgprint("DOS: reading pte %d sector buffer %p", pno, buf));
+       DBG(LABEL, dbgprint("DOS: reading pte %zu sector buffer %p", pno, buf));
 
        pe->offset = offset;
        pe->sectorbuffer = buf;
@@ -213,7 +213,7 @@ static int read_pte(struct fdisk_context *cxt, int pno, sector_t offset)
 
        if (read_sector(cxt, offset, pe->sectorbuffer) != 0)
                fdisk_warn(cxt, _("Failed to read extended partition table "
-                               "(offset=%jd)"), (uintmax_t) offset);
+                               "(offset=%ju)"), (uintmax_t) offset);
        pe->changed = 0;
        pe->pt_entry = pe->ex_entry = NULL;
        return 0;
@@ -292,12 +292,12 @@ static void dos_init(struct fdisk_context *cxt)
                char *szstr = size_to_human_string(SIZE_SUFFIX_SPACE
                                           | SIZE_SUFFIX_3LETTER, bytes);
                fdisk_warnx(cxt,
-               _("The size of this disk is %s (%llu bytes). DOS "
+               _("The size of this disk is %s (%ju bytes). DOS "
                  "partition table format can not be used on drives for "
-                 "volumes larger than (%llu bytes) for %ld-byte "
+                 "volumes larger than %ju bytes for %lu-byte "
                  "sectors. Use GUID partition table format (GPT)."),
-                       szstr, (unsigned long long) bytes,
-                       (unsigned long long) UINT_MAX * cxt->sector_size,
+                       szstr, bytes,
+                       UINT_MAX * cxt->sector_size,
                        cxt->sector_size);
                free(szstr);
        }
@@ -391,7 +391,7 @@ static int dos_delete_partition(struct fdisk_context *cxt, size_t partnum)
                                free(l->ptes[partnum].sectorbuffer);
                        }
                        while (partnum < cxt->label->nparts_max) {
-                               DBG(LABEL, dbgprint("--> moving pte %zu <-- %zd", partnum, partnum + 1));
+                               DBG(LABEL, dbgprint("--> moving pte %zu <-- %zu", partnum, partnum + 1));
                                l->ptes[partnum] = l->ptes[partnum + 1];
                                partnum++;
                        }
@@ -405,7 +405,7 @@ static int dos_delete_partition(struct fdisk_context *cxt, size_t partnum)
        return 0;
 }
 
-static void read_extended(struct fdisk_context *cxt, int ext)
+static void read_extended(struct fdisk_context *cxt, size_t ext)
 {
        size_t i;
        struct pte *pex;
@@ -422,7 +422,7 @@ static void read_extended(struct fdisk_context *cxt, int ext)
                return;
        }
 
-       DBG(LABEL, dbgprint("DOS: REading extended %d", ext));
+       DBG(LABEL, dbgprint("DOS: REading extended %zu", ext));
 
        while (IS_EXTENDED (p->sys_ind)) {
                struct pte *pe = self_pte(cxt, cxt->label->nparts_max);
@@ -434,7 +434,7 @@ static void read_extended(struct fdisk_context *cxt, int ext)
                        struct pte *pre = self_pte(cxt,
                                                cxt->label->nparts_max - 1);
                        fdisk_warnx(cxt,
-                       _("Omitting partitions after #%zd. They will be deleted "
+                       _("Omitting partitions after #%zu. They will be deleted "
                          "if you save this partition table."),
                                cxt->label->nparts_max);
 
@@ -457,7 +457,7 @@ static void read_extended(struct fdisk_context *cxt, int ext)
                                if (pe->ex_entry)
                                        fdisk_warnx(cxt, _(
                                        "Extra link pointer in partition "
-                                       "table %zd."),
+                                       "table %zu."),
                                                cxt->label->nparts_max + 1);
                                else
                                        pe->ex_entry = p;
@@ -465,7 +465,7 @@ static void read_extended(struct fdisk_context *cxt, int ext)
                                if (pe->pt_entry)
                                        fdisk_warnx(cxt, _(
                                        "Ignoring extra data in partition "
-                                       "table %zd."),
+                                       "table %zu."),
                                                cxt->label->nparts_max + 1);
                                else
                                        pe->pt_entry = p;
@@ -498,7 +498,7 @@ static void read_extended(struct fdisk_context *cxt, int ext)
 
                if (!dos_partition_get_size(p) &&
                    (cxt->label->nparts_max > 5 || q->sys_ind)) {
-                       fdisk_info(cxt, _("omitting empty partition (%zd)"), i+1);
+                       fdisk_info(cxt, _("omitting empty partition (%zu)"), i+1);
                        dos_delete_partition(cxt, i);
                        goto remove;    /* numbering changed */
                }
@@ -675,7 +675,7 @@ static int dos_probe_label(struct fdisk_context *cxt)
                if (IS_EXTENDED (pe->pt_entry->sys_ind)) {
                        if (cxt->label->nparts_max != 4)
                                fdisk_warnx(cxt, _(
-                               "Ignoring extra extended partition %zd"),
+                               "Ignoring extra extended partition %zu"),
                                        i + 1);
                        else
                                read_extended(cxt, i);
@@ -687,7 +687,7 @@ static int dos_probe_label(struct fdisk_context *cxt)
 
                if (!mbr_is_valid_magic(pe->sectorbuffer)) {
                        fdisk_info(cxt, _(
-                       "Invalid flag 0x%02x%02x of partition table %zd will "
+                       "Invalid flag 0x%02x%02x of partition table %zu will "
                        "be corrected by w(rite)"),
                                pe->sectorbuffer[510],
                                pe->sectorbuffer[511],
@@ -791,7 +791,7 @@ static void fill_bounds(struct fdisk_context *cxt,
        }
 }
 
-static int add_partition(struct fdisk_context *cxt, int n, struct fdisk_parttype *t)
+static int add_partition(struct fdisk_context *cxt, size_t n, struct fdisk_parttype *t)
 {
        int sys, read = 0, rc;
        size_t i;
@@ -803,14 +803,14 @@ static int add_partition(struct fdisk_context *cxt, int n, struct fdisk_parttype
                first[cxt->label->nparts_max],
                last[cxt->label->nparts_max];
 
-       DBG(LABEL, dbgprint("DOS: adding partition %d", n));
+       DBG(LABEL, dbgprint("DOS: adding partition %zu", n));
 
        sys = t ? t->type : MBR_LINUX_DATA_PARTITION;
 
        if (p && p->sys_ind) {
-               fdisk_warnx(cxt, _("Partition %zd is already defined.  "
+               fdisk_warnx(cxt, _("Partition %zu is already defined.  "
                                   "Delete it before re-adding it."),
-                               (ssize_t) n + 1);
+                               n + 1);
                return -EINVAL;
        }
        fill_bounds(cxt, first, last);
@@ -1027,7 +1027,7 @@ static int add_logical(struct fdisk_context *cxt)
                partition_set_changed(cxt, cxt->label->nparts_max, 1);
                cxt->label->nparts_max++;
        }
-       fdisk_info(cxt, _("Adding logical partition %zd"),
+       fdisk_info(cxt, _("Adding logical partition %zu"),
                        cxt->label->nparts_max);
        return add_partition(cxt, cxt->label->nparts_max - 1, NULL);
 }
@@ -1043,22 +1043,22 @@ static void check(struct fdisk_context *cxt, size_t n,
        total = (real_c * cxt->geom.sectors + real_s) * cxt->geom.heads + h;
 
        if (!total)
-               fdisk_warnx(cxt, _("Partition %zd: contains sector 0"), n);
+               fdisk_warnx(cxt, _("Partition %zu: contains sector 0"), n);
        if (h >= cxt->geom.heads)
-               fdisk_warnx(cxt, _("Partition %zd: head %d greater than "
+               fdisk_warnx(cxt, _("Partition %zu: head %d greater than "
                                   "maximum %d"), n, h + 1, cxt->geom.heads);
        if (real_s >= cxt->geom.sectors)
-               fdisk_warnx(cxt, _("Partition %zd: sector %d greater than "
+               fdisk_warnx(cxt, _("Partition %zu: sector %d greater than "
                                   "maximum %llu"), n, s, cxt->geom.sectors);
        if (real_c >= cxt->geom.cylinders)
-               fdisk_warnx(cxt, _("Partition %zd: cylinder %d greater than "
+               fdisk_warnx(cxt, _("Partition %zu: cylinder %d greater than "
                                   "maximum %llu"),
                                n, real_c + 1,
                                cxt->geom.cylinders);
 
        if (cxt->geom.cylinders <= 1024 && start != total)
-               fdisk_warnx(cxt, _("Partition %zd: previous sectors %d "
-                                  "disagrees with total %d"), n, start, total);
+               fdisk_warnx(cxt, _("Partition %zu: previous sectors %u "
+                                  "disagrees with total %u"), n, start, total);
 }
 
 /* check_consistency() and long2chs() added Sat Mar 6 12:28:16 1993,
@@ -1110,7 +1110,7 @@ static void check_consistency(struct fdisk_context *cxt, struct dos_partition *p
        /* Same physical / logical beginning? */
        if (cxt->geom.cylinders <= 1024
            && (pbc != lbc || pbh != lbh || pbs != lbs)) {
-               fdisk_warnx(cxt, _("Partition %zd: different physical/logical "
+               fdisk_warnx(cxt, _("Partition %zu: different physical/logical "
                        "beginnings (non-Linux?): "
                        "phys=(%d, %d, %d), logical=(%d, %d, %d)"),
                        partition + 1,
@@ -1121,7 +1121,7 @@ static void check_consistency(struct fdisk_context *cxt, struct dos_partition *p
        /* Same physical / logical ending? */
        if (cxt->geom.cylinders <= 1024
            && (pec != lec || peh != leh || pes != les)) {
-               fdisk_warnx(cxt, _("Partition %zd: different physical/logical "
+               fdisk_warnx(cxt, _("Partition %zu: different physical/logical "
                        "endings: phys=(%d, %d, %d), logical=(%d, %d, %d)"),
                        partition + 1,
                        pec, peh, pes,
@@ -1130,7 +1130,7 @@ static void check_consistency(struct fdisk_context *cxt, struct dos_partition *p
 
        /* Ending on cylinder boundary? */
        if (peh != (cxt->geom.heads - 1) || pes != cxt->geom.sectors) {
-               fdisk_warnx(cxt, _("Partition %zd: does not end on "
+               fdisk_warnx(cxt, _("Partition %zu: does not end on "
                                   "cylinder boundary."),
                        partition + 1);
        }
@@ -1157,7 +1157,7 @@ static int dos_verify_disklabel(struct fdisk_context *cxt)
                        fdisk_warn_alignment(cxt, get_abs_partition_start(pe), i);
                        if (get_abs_partition_start(pe) < first[i])
                                fdisk_warnx(cxt, _(
-                                       "Partition %zd: bad start-of-data."),
+                                       "Partition %zu: bad start-of-data."),
                                         i + 1);
 
                        check(cxt, i + 1, p->eh, p->es, p->ec, last[i]);
@@ -1167,8 +1167,8 @@ static int dos_verify_disklabel(struct fdisk_context *cxt)
                                if ((first[i] >= first[j] && first[i] <= last[j])
                                    || ((last[i] <= last[j] && last[i] >= first[j]))) {
 
-                                       fdisk_warnx(cxt, _("Partition %zd: "
-                                               "overlaps partition %zd."),
+                                       fdisk_warnx(cxt, _("Partition %zu: "
+                                               "overlaps partition %zu."),
                                                j + 1, i + 1);
 
                                        total += first[i] >= first[j] ?
@@ -1193,13 +1193,13 @@ static int dos_verify_disklabel(struct fdisk_context *cxt)
                        if (!p->sys_ind) {
                                if (i != 4 || i + 1 < cxt->label->nparts_max)
                                        fdisk_warnx(cxt,
-                                               _("Partition %zd: empty."),
+                                               _("Partition %zu: empty."),
                                                i + 1);
                        } else if (first[i] < l->ext_offset
                                   || last[i] > e_last) {
 
-                               fdisk_warnx(cxt, _("Logical partition %zd: "
-                                       "not entirely in partition %zd."),
+                               fdisk_warnx(cxt, _("Logical partition %zu: "
+                                       "not entirely in partition %zu."),
                                        i + 1, l->ext_index + 1);
                        }
                }
@@ -1273,7 +1273,7 @@ static int dos_add_partition(
 
                snprintf(prompt, sizeof(prompt),
                         _("Partition type:\n"
-                          "   p   primary (%zd primary, %d extended, %zd free)\n"
+                          "   p   primary (%zu primary, %d extended, %zu free)\n"
                           "%s\n"
                           "Select (default %c)"),
                         4 - (l->ext_offset ? 1 : 0) - free_primary,
@@ -1560,7 +1560,7 @@ static int dos_fulllist_disklabel(struct fdisk_context *cxt, int ext)
                if (!ln)
                        continue;
 
-               if (asprintf(&str, "%zd",  i + 1) > 0)
+               if (asprintf(&str, "%zu",  i + 1) > 0)
                        tt_line_set_data(ln, 0, str);           /* Nr */
                if (asprintf(&str, "%02x", p->boot_ind) > 0)
                        tt_line_set_data(ln, 1, str);           /* AF */
@@ -1818,7 +1818,7 @@ int fdisk_dos_fix_order(struct fdisk_context *cxt)
        return 0;
 }
 
-int fdisk_dos_move_begin(struct fdisk_context *cxt, int i)
+int fdisk_dos_move_begin(struct fdisk_context *cxt, size_t i)
 {
        struct pte *pe;
        struct dos_partition *p;
@@ -1834,7 +1834,7 @@ int fdisk_dos_move_begin(struct fdisk_context *cxt, int i)
        p = pe->pt_entry;
 
        if (!p->sys_ind || !dos_partition_get_size(p) || IS_EXTENDED (p->sys_ind)) {
-               fdisk_warnx(cxt, _("Partition %d: no data area."), i + 1);
+               fdisk_warnx(cxt, _("Partition %zu: no data area."), i + 1);
                return 0;
        }
 
@@ -1926,8 +1926,8 @@ static int dos_toggle_partition_flag(
        switch (flag) {
        case DOS_FLAG_ACTIVE:
                if (IS_EXTENDED(p->sys_ind) && !p->boot_ind)
-                       fdisk_warnx(cxt, _("Partition %d: is an extended "
-                                       "partition."), (int) i + 1);
+                       fdisk_warnx(cxt, _("Partition %zu: is an extended "
+                                       "partition."), i + 1);
 
                p->boot_ind = (p->boot_ind ? 0 : ACTIVE_FLAG);
                partition_set_changed(cxt, i, 1);
index 235b351df3cf333e68e5883acb2b02fef2492a8d..ec58c00988bf01a5d7f3155929c59a454094cc03 100644 (file)
@@ -1204,7 +1204,7 @@ static int gpt_list_disklabel(struct fdisk_context *cxt)
                fdisk_colon(cxt, _("Last LBA: %ju"), h->last_usable_lba);
                fdisk_colon(cxt, _("Alternative LBA: %ju"), h->alternative_lba);
                fdisk_colon(cxt, _("Partitions entries LBA: %ju"), h->partition_entry_lba);
-               fdisk_colon(cxt, _("Allocated partition entries: %ju"), (uintmax_t) h->npartition_entries);
+               fdisk_colon(cxt, _("Allocated partition entries: %u"), h->npartition_entries);
        }
        tt_define_column(tb, _("Device"), 0.1, 0);
        tt_define_column(tb, _("Start"),   12, TT_FL_RIGHT);
@@ -1536,8 +1536,8 @@ static int gpt_verify_disklabel(struct fdisk_context *cxt)
                free_sectors = get_free_sectors(cxt, gpt->pheader, gpt->ents,
                                                &nsegments, &largest_segment);
                fdisk_info(cxt,
-                          P_("A total of %ju free sectors is available in %d segment.",
-                             "A total of %ju free sectors is available in %d segments "
+                          P_("A total of %ju free sectors is available in %u segment.",
+                             "A total of %ju free sectors is available in %u segments "
                              "(the largest is %ju).", nsegments),
                           free_sectors, nsegments, largest_segment);
        } else
@@ -1660,7 +1660,7 @@ static int gpt_add_partition(
        ents = gpt->ents;
 
        if (!partition_unused(&ents[partnum])) {
-               fdisk_warnx(cxt, _("Partition %zd is already defined.  "
+               fdisk_warnx(cxt, _("Partition %zu is already defined.  "
                                   "Delete it before re-adding it."), partnum +1);
                return -EINVAL;
        }
@@ -1737,7 +1737,7 @@ static int gpt_add_partition(
 
        if (gpt_create_new_partition(cxt, partnum,
                                     user_f, user_l, &typeid, ents) != 0)
-               fdisk_warnx(cxt, _("Could not create partition %zd"), partnum + 1);
+               fdisk_warnx(cxt, _("Could not create partition %ju"), partnum + 1);
        else {
                struct fdisk_parttype *t;
 
@@ -1978,7 +1978,7 @@ int fdisk_gpt_partition_set_uuid(struct fdisk_context *cxt, size_t i)
        assert(cxt->label);
        assert(fdisk_is_disklabel(cxt, GPT));
 
-       DBG(LABEL, dbgprint("UUID change requested partno=%zd", i));
+       DBG(LABEL, dbgprint("UUID change requested partno=%zu", i));
 
        gpt = self_label(cxt);
 
@@ -2024,7 +2024,7 @@ int fdisk_gpt_partition_set_name(struct fdisk_context *cxt, size_t i)
        assert(cxt->label);
        assert(fdisk_is_disklabel(cxt, GPT));
 
-       DBG(LABEL, dbgprint("NAME change requested partno=%zd", i));
+       DBG(LABEL, dbgprint("NAME change requested partno=%zu", i));
 
        gpt = self_label(cxt);
 
index 096bb1fdd8c34506772cec8d6ceefe4b925a52fa..835691be4c904ea2b7f46c68686e7a08ca6e8af3 100644 (file)
@@ -199,7 +199,7 @@ extern struct dos_partition *fdisk_dos_get_partition(
                                size_t i);
 
 extern int fdisk_dos_fix_order(struct fdisk_context *cxt);
-extern int fdisk_dos_move_begin(struct fdisk_context *cxt, int i);
+extern int fdisk_dos_move_begin(struct fdisk_context *cxt, size_t i);
 extern int fdisk_dos_list_extended(struct fdisk_context *cxt);
 
 #define DOS_FLAG_ACTIVE        1
index ce23675956f3169e7e1d6d854195dabf38d82959..1e725de8f879d6ebbe8983fbc486b36b0d130c22 100644 (file)
@@ -841,7 +841,7 @@ static int sgi_add_partition(struct fdisk_context *cxt,
        sgi = self_label(cxt);
 
        if (sgi_get_num_sectors(cxt, n)) {
-               fdisk_warnx(cxt, _("Partition %zd is already defined.  "
+               fdisk_warnx(cxt, _("Partition %zu is already defined.  "
                                   "Delete it before re-adding it."), n + 1);
                return -EINVAL;
        }
index d5a0af2a6371adfa584f7cf85ac373dfbd07bb25..d890a32a42c85ad3d2ce72efc225a35c1e51c6d8 100644 (file)
@@ -391,9 +391,8 @@ static int sun_verify_disklabel(struct fdisk_context *cxt)
 
     for (k = 0; k < 7; k++) {
        for (i = 0; i < SUN_MAXPARTITIONS; i++) {
-           if (k && (lens[i] % (cxt->geom.heads * cxt->geom.sectors))) {
-               fdisk_warnx(cxt, _("Partition %d doesn't end on cylinder boundary."), i+1);
-           }
+           if (k && (lens[i] % (cxt->geom.heads * cxt->geom.sectors)))
+               fdisk_warnx(cxt, _("Partition %u doesn't end on cylinder boundary."), i+1);
            if (lens[i]) {
                for (j = 0; j < i; j++)
                    if (lens[j]) {
@@ -412,8 +411,8 @@ static int sun_verify_disklabel(struct fdisk_context *cxt)
                                endo = starts[i]+lens[i];
                                if (starts[j]+lens[j] < endo)
                                        endo = starts[j]+lens[j];
-                               fdisk_warnx(cxt, _("Partition %d overlaps with others in "
-                                      "sectors %d-%d."), i+1, starto, endo);
+                               fdisk_warnx(cxt, _("Partition %u overlaps with others in "
+                                      "sectors %u-%u."), i+1, starto, endo);
                            }
                        }
                    }
@@ -437,15 +436,15 @@ static int sun_verify_disklabel(struct fdisk_context *cxt)
     }
     stop = cxt->geom.cylinders * cxt->geom.heads * cxt->geom.sectors;
     if (starts[array[0]])
-        fdisk_warnx(cxt, _("Unused gap - sectors 0-%d."), starts[array[0]]);
+        fdisk_warnx(cxt, _("Unused gap - sectors 0-%u."), starts[array[0]]);
     for (i = 0; i < 7 && array[i+1] != -1; i++) {
-        fdisk_warnx(cxt, _("Unused gap - sectors %d-%d."),
+        fdisk_warnx(cxt, _("Unused gap - sectors %u-%u."),
               (starts[array[i]] + lens[array[i]]),
               starts[array[i+1]]);
     }
     start = (starts[array[i]] + lens[array[i]]);
     if (start < stop)
-        fdisk_warnx(cxt, _("Unused gap - sectors %d-%d."), start, stop);
+        fdisk_warnx(cxt, _("Unused gap - sectors %u-%u."), start, stop);
     return 0;
 }
 
@@ -468,7 +467,7 @@ static int sun_add_partition(
        unsigned int first, last;
 
        if (part->num_sectors && be16_to_cpu(info->id) != SUN_TAG_UNASSIGNED) {
-               fdisk_info(cxt, _("Partition %zd is already defined.  Delete "
+               fdisk_info(cxt, _("Partition %zu is already defined.  Delete "
                        "it before re-adding it."), n + 1);
                return -EINVAL;
        }
@@ -616,10 +615,10 @@ static int sun_add_partition(
                } else if (last > stop) {
                    fdisk_warnx(cxt,
    _("You haven't covered the whole disk with the 3rd partition, but your value\n"
-     "%d %s covers some other partition. Your entry has been changed\n"
-     "to %d %s"),
-                       (int) fdisk_scround(cxt, last), fdisk_context_get_unit(cxt, SINGULAR),
-                       (int) fdisk_scround(cxt, stop), fdisk_context_get_unit(cxt, SINGULAR));
+     "%lu %s covers some other partition. Your entry has been changed\n"
+     "to %lu %s"),
+                       (unsigned long) fdisk_scround(cxt, last), fdisk_context_get_unit(cxt, SINGULAR),
+                       (unsigned long) fdisk_scround(cxt, stop), fdisk_context_get_unit(cxt, SINGULAR));
                    last = stop;
                }
        } else if (!whole_disk && last > stop)