libfdisk and its tools don't always use the correct format specifiers.
Make sure that translated strings always use %ju, to keep the message
IDs stables.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
color_scheme_enable("header", UL_COLOR_BOLD);
fdisk_info(cxt, _("Disk %s: %s, %ju bytes, %ju sectors"),
fdisk_get_devname(cxt), strsz,
- bytes, (uintmax_t) fdisk_get_nsectors(cxt));
+ (uintmax_t)bytes, (uintmax_t) fdisk_get_nsectors(cxt));
color_disable();
free(strsz);
struct fdisk_partition *pa = NULL, *npa = NULL, *next = NULL;
char *query = NULL, *response = NULL, *default_size;
struct fdisk_table *tb = NULL;
- uint64_t max_size, size, secs;
+ uint64_t max_size, secs;
+ uintmax_t size;
size_t i;
int rc;
fprintf(f, "# Area size (sectors/bytes): %ju/%ju\n",
(uintmax_t)nsectors, (uintmax_t)nsectors * ss);
fprintf(f, "# Step size (sectors/bytes): %" PRIu64 "/%zu\n", step, step_bytes);
- fprintf(f, "# Steps: %ju\n", ((uintmax_t) nsectors / step) + 1);
+ fprintf(f, "# Steps: %ju\n", (uintmax_t)((uintmax_t) nsectors / step) + 1);
fprintf(f, "#\n");
fprintf(f, "# <step>: <from> <to> (step offsets in bytes)\n");
}
if (bytes_per_sec)
fprintf(stdout, _("Moved %ju from %ju sectors (%.3f%%, %.1f MiB/s)."),
- i + 1, nsectors,
+ (uintmax_t)i + 1, (uintmax_t)nsectors,
100.0 / ((double) nsectors/(i+1)),
(double) (bytes_per_sec / (1024 * 1024)));
else
fprintf(stdout, _("Moved %ju from %ju sectors (%.3f%%)."),
- i + 1, nsectors,
+ (uintmax_t)i + 1, (uintmax_t)nsectors,
100.0 / ((double) nsectors/(i+1)));
fflush(stdout);
fputc('\r', stdout);
i = nsectors;
fprintf(stdout, _("Moved %ju from %ju sectors (%.0f%%)."),
- i, nsectors,
+ (uintmax_t)i, (uintmax_t)nsectors,
100.0 / ((double) nsectors/(i+1)));
fputc('\n', stdout);
}
if (num->low > 0) {
/* only one existing partition, don't ask, return the number */
fdisk_ask_number_set_result(ask, num->low);
- fdisk_info(cxt, _("Selected partition %ju"), num->low);
+ fdisk_info(cxt, _("Selected partition %ju"), (uintmax_t)num->low);
} else if (num->low == 0) {
fdisk_warnx(cxt, _("No partition is defined yet!"));
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 %ju"), num->low);
+ fdisk_info(cxt, _("Selected partition %ju"), (uintmax_t)num->low);
}
if (num->low == 0) {
fdisk_warnx(cxt, _("No free partition available!"));
"partition table format cannot be used on drives for "
"volumes larger than %lu bytes for %lu-byte "
"sectors. Use GUID partition table format (GPT)."),
- szstr, bytes,
+ szstr, (uintmax_t) bytes,
UINT_MAX * cxt->sector_size,
cxt->sector_size);
free(szstr);
temp = start;
- DBG(LABEL, ul_debug("DOS: >>> search for first free from %ju", start));
+ DBG(LABEL, ul_debug("DOS: >>> search for first free from %"PRIu64, start));
rc = find_first_free_sector(cxt, is_logical, start, &dflt);
if (rc == -ENOSPC)
fdisk_warnx(cxt, _("No free sectors available."));
rc = find_last_free(cxt, is_logical, start, limit, &last);
if (rc == 0 && last - start + 1 < fdisk_partition_get_size(pa)) {
- DBG(LABEL, ul_debug("DOS: area <%ju,%ju> too small [wanted=%ju aval=%ju]",
- (uintmax_t) start, (uintmax_t) last,
+ DBG(LABEL, ul_debug("DOS: area <%"PRIu64",%"PRIu64"> too small [wanted=%"PRIu64" aval=%"PRIu64"]",
+ start, last,
fdisk_partition_get_size(pa),
last - start));
assert(start >= cxt->first_lba);
pe->offset = start - cxt->first_lba;
- DBG(LABEL, ul_debug("DOS: setting EBR offset to %ju [start=%ju]", pe->offset, start));
+ DBG(LABEL, ul_debug("DOS: setting EBR offset to %"PRIu64" [start=%"PRIu64"]", pe->offset, start));
if (pe->offset == l->ext_offset) { /* must be corrected */
pe->offset++;
"than the maximum %ju."), (uintmax_t) total, (uintmax_t) n_sectors);
else if (total < n_sectors)
fdisk_info(cxt, _("Remaining %ju unallocated %lu-byte "
- "sectors."), (uintmax_t) n_sectors - total, cxt->sector_size);
+ "sectors."), (uintmax_t) (n_sectors - total), cxt->sector_size);
} else
fdisk_warnx(cxt,
P_("%d error detected.", "%d errors detected.", nerrors),
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 %s).", nsegments),
- free_sectors, nsegments, strsz ? : "0 B");
+ (uintmax_t)free_sectors, nsegments, strsz ? : "0 B");
free(strsz);
} else
user_f = fdisk_ask_number_get_result(ask);
if (user_f != find_first_available(gpt, user_f)) {
- fdisk_warnx(cxt, _("Sector %ju already used."), user_f);
+ fdisk_warnx(cxt, _("Sector %ju already used."), (uintmax_t)user_f);
continue;
}
break;
/* Be paranoid and check against on-disk setting rather than against libfdisk cxt */
if (user_l > le64_to_cpu(pheader->last_usable_lba)) {
fdisk_warnx(cxt, _("The last usable GPT sector is %ju, but %ju is requested."),
- le64_to_cpu(pheader->last_usable_lba), user_l);
+ (uintmax_t)le64_to_cpu(pheader->last_usable_lba), (uintmax_t)user_l);
rc = -EINVAL;
goto done;
}
if (user_f < le64_to_cpu(pheader->first_usable_lba)) {
fdisk_warnx(cxt, _("The first usable GPT sector is %ju, but %ju is requested."),
- le64_to_cpu(pheader->first_usable_lba), user_f);
+ (uintmax_t)le64_to_cpu(pheader->first_usable_lba), (uintmax_t)user_f);
rc = -EINVAL;
goto done;
}
+#include <inttypes.h>
#include "fdiskP.h"
#include "cctype.h"
continue;
switch (item.type) {
case 'j':
- fdisk_info(cxt, "%s: %ju", item.name, item.data.num64);
+ fdisk_info(cxt, "%s: %"PRIu64, item.name, item.data.num64);
break;
case 's':
if (item.data.str && item.name)
}
done:
- DBG_OBJ(SCRIPT, dp, ul_debug(" start parse result: rc=%d, move=%s, start=%ju, default=%s",
+ DBG_OBJ(SCRIPT, dp, ul_debug(" start parse result: rc=%d, move=%s, start=%"PRIu64", default=%s",
rc, pa->movestart == FDISK_MOVE_DOWN ? "down" :
pa->movestart == FDISK_MOVE_UP ? "up" : "none",
pa->start,
}
done:
- DBG_OBJ(SCRIPT, dp, ul_debug(" size parse result: rc=%d, move=%s, size=%ju, default=%s",
+ DBG_OBJ(SCRIPT, dp, ul_debug(" size parse result: rc=%d, move=%s, size=%"PRIu64", default=%s",
rc, pa->resize == FDISK_RESIZE_REDUCE ? "reduce" :
pa->resize == FDISK_RESIZE_ENLARGE ? "enlarge" : "none",
pa->size,