Silenced warnings for unmatching printf-type formats

edge.strict_endians
Jean-Pierre André 2010-12-21 15:51:07 +01:00
parent bb142bc742
commit 1ca4a556b2
7 changed files with 88 additions and 58 deletions

View File

@ -3311,7 +3311,8 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol)
/* Validate volume size. */
if (volume_size < (1 << 20)) { /* 1MiB */
ntfs_log_error("Device is too small (%llikiB). Minimum NTFS "
"volume size is 1MiB.\n", volume_size / 1024);
"volume size is 1MiB.\n",
(long long)(volume_size / 1024));
return FALSE;
}
ntfs_log_debug("volume size = %llikiB\n", volume_size / 1024);

View File

@ -794,7 +794,7 @@ static void wipe_index_allocation_timestamps(ntfs_inode *ni, ATTR_RECORD *attr)
indexr = ntfs_index_root_get(ni, attr);
if (!indexr) {
perr_printf("Failed to read $INDEX_ROOT attribute of inode "
"%lld", ni->mft_no);
"%lld", (long long)ni->mft_no);
return;
}
@ -861,7 +861,8 @@ static void wipe_index_allocation_timestamps(ntfs_inode *ni, ATTR_RECORD *attr)
}
}
if (ntfs_rl_pwrite(vol, na->rl, 0, 0, na->data_size, indexa) != na->data_size)
perr_printf("ntfs_rl_pwrite failed for inode %lld", ni->mft_no);
perr_printf("ntfs_rl_pwrite failed for inode %lld",
(long long)ni->mft_no);
out_indexa:
free(indexa);
out_na:
@ -1028,9 +1029,10 @@ static void walk_runs(struct ntfs_walk_cluster *walk)
/* FIXME: ntfs_mapping_pairs_decompress should return error */
if (lcn < 0 || lcn_length < 0)
err_exit("Corrupt runlist in inode %lld attr %x LCN "
"%llx length %llx\n", ctx->ntfs_ino->mft_no,
(unsigned int)le32_to_cpu(a->type), lcn,
lcn_length);
"%llx length %llx\n",
(long long)ctx->ntfs_ino->mft_no,
(unsigned int)le32_to_cpu(a->type),
(long long)lcn, (long long)lcn_length);
if (!wipe)
dump_clusters(walk->image, rl + i);
@ -1091,7 +1093,8 @@ static void compare_bitmaps(struct bitmap *a)
if (count == 0) {
if (a->size > pos)
err_exit("$Bitmap size is smaller than expected"
" (%lld != %lld)\n", a->size, pos);
" (%lld != %lld)\n",
(long long)a->size, (long long)pos);
break;
}
@ -1263,7 +1266,8 @@ static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk)
MFT record not in use based on $MFT bitmap */
if (errno == EIO || errno == ENOENT)
continue;
perr_exit("Reading inode %lld failed", inode);
perr_exit("Reading inode %lld failed",
(long long)inode);
}
if (wipe)
@ -1281,7 +1285,8 @@ out:
}
if (ntfs_inode_close(ni))
perr_exit("ntfs_inode_close for inode %lld", inode);
perr_exit("ntfs_inode_close for inode %lld",
(long long)inode);
}
return 0;
@ -1355,7 +1360,7 @@ static void print_image_info(void)
sle64_to_cpu(image_hdr.nr_clusters) *
le32_to_cpu(image_hdr.cluster_size));
Printf("Image device size : %lld bytes\n",
sle64_to_cpu(image_hdr.device_size));
(long long)sle64_to_cpu(image_hdr.device_size));
print_disk_usage(" ", le32_to_cpu(image_hdr.cluster_size),
sle64_to_cpu(image_hdr.nr_clusters),
sle64_to_cpu(image_hdr.inuse));
@ -1616,14 +1621,15 @@ static s64 open_volume(void)
device_size = ntfs_device_size_get(vol->dev, 1);
if (device_size <= 0)
err_exit("Couldn't get device size (%lld)!\n", device_size);
err_exit("Couldn't get device size (%lld)!\n",
(long long)device_size);
print_volume_size("Current device size", device_size);
if (device_size < vol->nr_clusters * vol->cluster_size)
err_exit("Current NTFS volume size is bigger than the device "
"size (%lld)!\nCorrupt partition table or incorrect "
"device partitioning?\n", device_size);
"device partitioning?\n", (long long)device_size);
return device_size;
}
@ -1647,7 +1653,8 @@ static void check_output_device(s64 input_size)
s64 dest_size = device_size_get(fd_out);
if (dest_size < input_size)
err_exit("Output device is too small (%lld) to fit the "
"NTFS image (%lld).\n", dest_size, input_size);
"NTFS image (%lld).\n",
(long long)dest_size, (long long)input_size);
check_if_mounted(opt.output, 0);
} else
@ -1723,7 +1730,7 @@ static void ignore_bad_clusters(ntfs_walk_clusters_ctx *image)
}
if (nr_bad_clusters)
Printf("WARNING: The disk has %lld or more bad sectors"
" (hardware faults).\n", nr_bad_clusters);
" (hardware faults).\n", (long long)nr_bad_clusters);
free(rl_bad);
ntfs_attr_put_search_ctx(ctx);
@ -1763,8 +1770,8 @@ static void check_dest_free_space(u64 src_bytes)
if (dest_bytes < src_bytes)
err_exit("Destination doesn't have enough free space: "
"%llu MB < %llu MB\n",
rounded_up_division(dest_bytes, NTFS_MBYTE),
rounded_up_division(src_bytes, NTFS_MBYTE));
(unsigned long long)rounded_up_division(dest_bytes, NTFS_MBYTE),
(unsigned long long)rounded_up_division(src_bytes, NTFS_MBYTE));
}
int main(int argc, char **argv)

View File

@ -309,7 +309,8 @@ static int inode_close(ntfs_inode *ni)
return 0;
if (ntfs_inode_close(ni)) {
perr_println("ntfs_inode_close: inode %llu", inumber(ni));
perr_println("ntfs_inode_close: inode %llu",
(unsigned long long)inumber(ni));
return -1;
}
return 0;
@ -359,7 +360,7 @@ static int inode_open(ntfs_volume *vol, MFT_REF mref, ntfs_inode **ni)
if (errno == ENOENT)
return NTFSCMP_INODE_OPEN_ENOENT_ERROR;
perr_println("Reading inode %lld failed", mref);
perr_println("Reading inode %lld failed", (long long)mref);
return NTFSCMP_INODE_OPEN_ERROR;
}
@ -384,7 +385,7 @@ static ntfs_inode *base_inode(ntfs_attr_search_ctx *ctx)
static void print_inode(u64 inum)
{
printf("Inode %llu ", inum);
printf("Inode %llu ", (unsigned long long)inum);
}
static void print_inode_ni(ntfs_inode *ni)
@ -612,8 +613,10 @@ static void cmp_attribute_data(ntfs_attr *na1, ntfs_attr *na2)
if (count1 != count2) {
print_na(na1);
printf("abrupt length: %lld != %lld ",
na1->data_size, na2->data_size);
printf("(count: %lld != %lld)", count1, count2);
(long long)na1->data_size,
(long long)na2->data_size);
printf("(count: %lld != %lld)",
(long long)count1, (long long)count2);
puts("");
return;
}
@ -621,7 +624,8 @@ static void cmp_attribute_data(ntfs_attr *na1, ntfs_attr *na2)
if (count1 == -1) {
err_printf("%s read error: ", __FUNCTION__);
print_na(na1);
printf("len = %lld, pos = %lld\n", na1->data_size, pos);
printf("len = %lld, pos = %lld\n",
(long long)na1->data_size, (long long)pos);
exit(1);
}
@ -632,7 +636,8 @@ static void cmp_attribute_data(ntfs_attr *na1, ntfs_attr *na2)
err_printf("%s read error before EOF: ", __FUNCTION__);
print_na(na1);
printf("%lld != %lld\n", pos + count1, na1->data_size);
printf("%lld != %lld\n", (long long)pos + count1,
(long long)na1->data_size);
exit(1);
}
@ -643,7 +648,7 @@ static void cmp_attribute_data(ntfs_attr *na1, ntfs_attr *na2)
err_printf("%s read overrun: ", __FUNCTION__);
print_na(na1);
err_printf("(len = %lld, pos = %lld, count = %lld)\n",
na1->data_size, pos, count1);
(long long)na1->data_size, (long long)pos, (long long)count1);
exit(1);
}
@ -690,7 +695,8 @@ static void cmp_attribute(ntfs_attr_search_ctx *ctx1,
if (na1->data_size != na2->data_size) {
print_na(na1);
printf("length: %lld != %lld\n", na1->data_size, na2->data_size);
printf("length: %lld != %lld\n",
(long long)na1->data_size, (long long)na2->data_size);
goto close_attribs;
}
@ -732,7 +738,8 @@ static void print_attributes(ntfs_inode *ni,
if (!opt.verbose)
return;
printf("Walking inode %llu attributes: ", inumber(ni));
printf("Walking inode %llu attributes: ",
(unsigned long long)inumber(ni));
vprint_attribute(atype1, name1);
vprint_attribute(atype2, name2);
printf("\n");
@ -774,7 +781,8 @@ static int new_attribute(ntfs_attr_search_ctx *ctx,
print_inode(base_inode(ctx)->mft_no);
print_attribute_ctx(ctx);
printf("record %llu lowest_vcn %lld: SKIPPED\n",
ctx->ntfs_ino->mft_no, ctx->attr->lowest_vcn);
(unsigned long long)ctx->ntfs_ino->mft_no,
(long long)ctx->attr->lowest_vcn);
}
return 0;
@ -905,7 +913,7 @@ static int cmp_inodes(ntfs_volume *vol1, ntfs_volume *vol2)
if (nr_mft_records != nr_mft_records2) {
printf("Number of mft records: %lld != %lld\n",
nr_mft_records, nr_mft_records2);
(long long)nr_mft_records, (long long)nr_mft_records2);
if (nr_mft_records > nr_mft_records2)
nr_mft_records = nr_mft_records2;

View File

@ -367,7 +367,7 @@ int main(int argc, char *argv[])
}
new_size = fst.st_size;
}
ntfs_log_verbose("New file size: %lld\n", new_size);
ntfs_log_verbose("New file size: %lld\n", (long long)new_size);
in = fopen(opts.src_file, "r");
if (!in) {
@ -526,7 +526,7 @@ int main(int argc, char *argv[])
}
ntfs_ucsfree(attr_name);
ntfs_log_verbose("Old file size: %lld\n", na->data_size);
ntfs_log_verbose("Old file size: %lld\n", (long long)na->data_size);
if (na->data_size != new_size) {
if (__ntfs_attr_truncate(na, new_size, FALSE)) {
ntfs_log_perror("ERROR: Couldn't resize attribute");

View File

@ -1188,7 +1188,7 @@ static const char * ntfs_dump_lcn(LCN lcn)
return "<EIO>\t";
default:
ntfs_log_error("Invalid LCN value %llx passed to "
"ntfs_dump_lcn().\n", lcn);
"ntfs_dump_lcn().\n", (long long)lcn);
return "???\t";
}
}
@ -1297,13 +1297,16 @@ static void ntfs_dump_attribute_header(ntfs_attr_search_ctx *ctx,
while (rlc->length) {
if (rlc->lcn >= 0)
printf("\t\t\t0x%llx\t\t0x%llx\t\t"
"0x%llx\n", rlc->vcn,
rlc->lcn, rlc->length);
"0x%llx\n",
(long long)rlc->vcn,
(long long)rlc->lcn,
(long long)rlc->length);
else
printf("\t\t\t0x%llx\t\t%s\t"
"0x%llx\n", rlc->vcn,
"0x%llx\n",
(long long)rlc->vcn,
ntfs_dump_lcn(rlc->lcn),
rlc->length);
(long long)rlc->length);
rlc++;
}
free(rl);
@ -1539,8 +1542,8 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type)
if (entry->ie_flags & INDEX_ENTRY_NODE)
ntfs_log_verbose("\t\tSubnode VCN:\t\t %lld (0x%llx)\n",
ntfs_ie_get_vcn(entry),
ntfs_ie_get_vcn(entry));
(long long)ntfs_ie_get_vcn(entry),
(long long)ntfs_ie_get_vcn(entry));
if (entry->ie_flags & INDEX_ENTRY_END)
break;

View File

@ -799,9 +799,9 @@ static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfsck_t *fsck)
/* FIXME: ntfs_mapping_pairs_decompress should return error */
if (lcn < 0 || lcn_length <= 0)
err_exit("Corrupt runlist in inode %lld attr %x LCN "
"%llx length %llx\n", inode,
(unsigned int)le32_to_cpu(a->type), lcn,
lcn_length);
"%llx length %llx\n", (long long)inode,
(unsigned int)le32_to_cpu(a->type),
(long long)lcn, (long long)lcn_length);
for (j = 0; j < lcn_length; j++) {
u64 k = (u64)lcn + j;
@ -814,7 +814,8 @@ static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfsck_t *fsck)
if (++fsck->show_outsider <= 10 || opt.verbose)
printf("Outside of the volume reference"
" for inode %lld at %lld:%lld\n",
inode, (long long)k, outsiders);
(long long)inode, (long long)k,
(long long)outsiders);
break;
}
@ -888,7 +889,8 @@ static void compare_bitmaps(ntfs_volume *vol, struct bitmap *a)
if (count == 0) {
if (a->size > pos)
err_exit("$Bitmap size is smaller than expected"
" (%lld != %lld)\n", a->size, pos);
" (%lld != %lld)\n",
(long long)a->size, (long long)pos);
break;
}
@ -1018,7 +1020,8 @@ static int build_allocation_bitmap(ntfs_volume *vol, ntfsck_t *fsck)
MFT record not in use based on $MFT bitmap */
if (errno == EIO || errno == ENOENT)
continue;
perr_printf("Reading inode %lld failed", inode);
perr_printf("Reading inode %lld failed",
(long long)inode);
return -1;
}
@ -1091,7 +1094,8 @@ static void set_resize_constraints(ntfs_resize_t *resize)
if (ni == NULL) {
if (errno == EIO || errno == ENOENT)
continue;
perr_exit("Reading inode %lld failed", inode);
perr_exit("Reading inode %lld failed",
(long long)inode);
}
if (ni->mrec->base_mft_record)
@ -1407,7 +1411,7 @@ static void lseek_to_cluster(ntfs_volume *vol, s64 lcn)
pos = (off_t)(lcn * vol->cluster_size);
if (vol->dev->d_ops->seek(vol->dev, pos, SEEK_SET) == (off_t)-1)
perr_exit("seek failed to position %lld", lcn);
perr_exit("seek failed to position %lld", (long long)lcn);
}
static void copy_clusters(ntfs_resize_t *resize, s64 dest, s64 src, s64 len)
@ -1544,7 +1548,8 @@ static void relocate_run(ntfs_resize_t *resize, runlist **rl, int run)
if (!(relocate_rl = alloc_cluster(&resize->lcn_bitmap, lcn_length,
new_vol_size, hint)))
perr_exit("Cluster allocation failed for %llu:%lld",
resize->mref, lcn_length);
(unsigned long long)resize->mref,
(long long)lcn_length);
/* FIXME: check $MFTMirr DATA isn't multi-run (or support it) */
ntfs_log_verbose("Relocate record %7llu:0x%x:%08lld:0x%08llx:0x%08llx "
@ -1589,9 +1594,10 @@ static void relocate_attribute(ntfs_resize_t *resize)
/* FIXME: ntfs_mapping_pairs_decompress should return error */
if (lcn < 0 || lcn_length <= 0)
err_exit("Corrupt runlist in MTF %llu attr %x LCN "
"%llx length %llx\n", resize->mref,
"%llx length %llx\n",
(unsigned long long)resize->mref,
(unsigned int)le32_to_cpu(a->type),
lcn, lcn_length);
(long long)lcn, (long long)lcn_length);
relocate_run(resize, &rl, i);
}
@ -1705,7 +1711,8 @@ static void relocate_inode(ntfs_resize_t *resize, MFT_REF mref, int do_mftdata)
// if (vol->dev->d_ops->sync(vol->dev) == -1)
// perr_exit("Failed to sync device");
if (write_mft_record(resize->vol, mref, resize->mrec))
perr_exit("Couldn't update record %llu", mref);
perr_exit("Couldn't update record %llu",
(unsigned long long)mref);
}
}
@ -1741,7 +1748,7 @@ static void relocate_inodes(ntfs_resize_t *resize)
if (highest_vcn == resize->mft_highest_vcn)
err_exit("Sanity check failed! Highest_vcn = %lld. "
"Please report!\n", highest_vcn);
"Please report!\n", (long long)highest_vcn);
}
done:
free(resize->mrec);
@ -1797,7 +1804,8 @@ static void rl_expand(runlist **rl, const VCN last_vcn)
if (p[len].vcn > last_vcn)
err_exit("rl_expand: length is already more than requested "
"(%lld > %lld)\n", p[len].vcn, last_vcn);
"(%lld > %lld)\n",
(long long)p[len].vcn, (long long)last_vcn);
if (p[len - 1].lcn == LCN_HOLE) {
@ -1816,7 +1824,8 @@ static void rl_expand(runlist **rl, const VCN last_vcn)
*rl = p;
} else
err_exit("rl_expand: bad LCN: %lld\n", p[len - 1].lcn);
err_exit("rl_expand: bad LCN: %lld\n",
(long long)p[len - 1].lcn);
}
static void rl_truncate(runlist **rl, const VCN last_vcn)
@ -2046,15 +2055,16 @@ static int check_bad_sectors(ntfs_volume *vol)
badclusters += rl[i].length;
ntfs_log_verbose("Bad cluster: %#8llx - %#llx (%lld)\n",
rl[i].lcn, rl[i].lcn + rl[i].length - 1,
rl[i].length);
(long long)rl[i].lcn,
(long long)rl[i].lcn + rl[i].length - 1,
(long long)rl[i].length);
}
if (badclusters) {
printf("%sThis software has detected that the disk has at least"
" %lld bad sector%s.\n",
!opt.badsectors ? NERR_PREFIX : "WARNING: ",
badclusters, badclusters - 1 ? "s" : "");
(long long)badclusters, badclusters - 1 ? "s" : "");
if (!opt.badsectors) {
printf("%s", bad_sectors_warning_msg);
exit(1);
@ -2399,7 +2409,8 @@ int main(int argc, char **argv)
device_size = ntfs_device_size_get(vol->dev, vol->sector_size);
device_size *= vol->sector_size;
if (device_size <= 0)
err_exit("Couldn't get device size (%lld)!\n", device_size);
err_exit("Couldn't get device size (%lld)!\n",
(long long)device_size);
print_vol_size("Current device size", device_size);

View File

@ -2179,8 +2179,8 @@ int main(int argc, char *argv[])
result = !copy_mft(vol, opts.mft_begin, opts.mft_end);
if (result)
ntfs_log_verbose("ERROR: Failed to read MFT blocks "
"%lld-%lld.\n", opts.mft_begin,
min((vol->mft_na->initialized_size >>
"%lld-%lld.\n", (long long)opts.mft_begin,
(long long)min((vol->mft_na->initialized_size >>
vol->mft_record_size_bits) , opts.mft_end));
break;
default: