From 13dc7946889c30ccfccc080f20d57985caf3e8e6 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 3 Mar 2009 19:53:14 +0000 Subject: [PATCH] fix all 64-bit format string warnings --- include/ntfs-3g/mft.h | 4 ++-- libntfs-3g/attrib.c | 30 +++++++++++++++++------------- libntfs-3g/bootsect.c | 6 +++--- libntfs-3g/compress.c | 4 ++-- libntfs-3g/debug.c | 10 ++++++++-- libntfs-3g/device.c | 5 +++-- libntfs-3g/dir.c | 7 ++++--- libntfs-3g/index.c | 12 ++++++------ libntfs-3g/inode.c | 2 +- libntfs-3g/lcnalloc.c | 15 +++++++++------ libntfs-3g/mft.c | 2 +- libntfs-3g/volume.c | 4 ++-- 12 files changed, 58 insertions(+), 43 deletions(-) diff --git a/include/ntfs-3g/mft.h b/include/ntfs-3g/mft.h index 089a195d..bb15f0f3 100644 --- a/include/ntfs-3g/mft.h +++ b/include/ntfs-3g/mft.h @@ -52,7 +52,7 @@ static __inline__ int ntfs_mft_record_read(const ntfs_volume *vol, { int ret; - ntfs_log_enter("Entering for inode %lld\n", MREF(mref)); + ntfs_log_enter("Entering for inode %lld\n", (long long)MREF(mref)); ret = ntfs_mft_records_read(vol, mref, 1, b); ntfs_log_leave("\n"); return ret; @@ -87,7 +87,7 @@ static __inline__ int ntfs_mft_record_write(const ntfs_volume *vol, { int ret; - ntfs_log_enter("Entering for inode %lld\n", MREF(mref)); + ntfs_log_enter("Entering for inode %lld\n", (long long)MREF(mref)); ret = ntfs_mft_records_write(vol, mref, 1, b); ntfs_log_leave("\n"); return ret; diff --git a/libntfs-3g/attrib.c b/libntfs-3g/attrib.c index 80a9e782..8852f3a4 100644 --- a/libntfs-3g/attrib.c +++ b/libntfs-3g/attrib.c @@ -905,8 +905,9 @@ res_err_out: to_read = min(count, (rl->length << vol->cluster_size_bits) - ofs); retry: - ntfs_log_trace("Reading 0x%llx bytes from vcn 0x%llx, lcn 0x%llx, " - "ofs 0x%llx.\n", to_read, rl->vcn, rl->lcn, ofs); + ntfs_log_trace("Reading %lld bytes from vcn %lld, lcn %lld, ofs" + " %lld.\n", (long long)to_read, (long long)rl->vcn, + (long long )rl->lcn, (long long)ofs); br = ntfs_pread(vol->dev, (rl->lcn << vol->cluster_size_bits) + ofs, to_read, b); /* If everything ok, update progress counters and continue. */ @@ -1028,7 +1029,8 @@ static int ntfs_attr_fill_hole(ntfs_attr *na, s64 count, s64 *ofs, from_vcn = (*rl)->vcn + (*ofs >> vol->cluster_size_bits); ntfs_log_trace("count: %lld, cur_vcn: %lld, from: %lld, to: %lld, ofs: " - "%lld\n", count, cur_vcn, from_vcn, to_write, *ofs); + "%lld\n", (long long)count, (long long)cur_vcn, + (long long)from_vcn, (long long)to_write, (long long)*ofs); /* Map whole runlist to be able update mapping pairs later. */ if (ntfs_attr_map_whole_runlist(na)) @@ -1166,9 +1168,9 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) unsigned int undo_data_size : 1; } need_to = { 0, 0 }; - ntfs_log_enter("Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, count " - "0x%llx.\n", na->ni->mft_no, na->type, (long long)pos, - (long long)count); + ntfs_log_enter("Entering for inode %lld, attr 0x%x, pos 0x%llx, count " + "0x%llx.\n", (long long)na->ni->mft_no, na->type, + (long long)pos, (long long)count); if (!na || !na->ni || !na->ni->vol || !b || pos < 0 || count < 0) { errno = EINVAL; @@ -1343,7 +1345,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) to_write = min(count, (rl->length << vol->cluster_size_bits) - ofs); retry: ntfs_log_trace("Writing %lld bytes to vcn %lld, lcn %lld, ofs " - "%lld.\n", to_write, rl->vcn, rl->lcn, ofs); + "%lld.\n", (long long)to_write, (long long)rl->vcn, + (long long)rl->lcn, (long long)ofs); if (!NVolReadOnly(vol)) { s64 wpos = (rl->lcn << vol->cluster_size_bits) + ofs; @@ -3131,8 +3134,8 @@ int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, return -1; } - ntfs_log_trace("Entering for inode 0x%llx, attr %x, size %lld.\n", - (long long) ni->mft_no, type, size); + ntfs_log_trace("Entering for inode %lld, attr %x, size %lld.\n", + (long long)ni->mft_no, type, (long long)size); if (ni->nr_extents == -1) ni = ni->base_ni; @@ -4382,8 +4385,8 @@ retry: */ if (finished_build) { ntfs_log_trace("Mark attr 0x%x for delete in inode " - "0x%llx.\n", (unsigned)le32_to_cpu( - a->type), ctx->ntfs_ino->mft_no); + "%lld.\n", (unsigned)le32_to_cpu(a->type), + (long long)ctx->ntfs_ino->mft_no); a->highest_vcn = cpu_to_sle64(NTFS_VCN_DELETE_MARK); ntfs_inode_mark_dirty(ctx->ntfs_ino); continue; @@ -5006,8 +5009,9 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) return STATUS_ERROR; } - ntfs_log_enter("Entering for inode 0x%llx, attr 0x%x, size %lld\n", - (unsigned long long)na->ni->mft_no, na->type, newsize); + ntfs_log_enter("Entering for inode %lld, attr 0x%x, size %lld\n", + (unsigned long long)na->ni->mft_no, na->type, + (long long)newsize); if (na->data_size == newsize) { ntfs_log_trace("Size is already ok\n"); diff --git a/libntfs-3g/bootsect.c b/libntfs-3g/bootsect.c index ae5d60a9..e9bea370 100644 --- a/libntfs-3g/bootsect.c +++ b/libntfs-3g/bootsect.c @@ -195,7 +195,7 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) } sectors = sle64_to_cpu(bs->number_of_sectors); - ntfs_log_debug("NumberOfSectors = %lld\n", sectors); + ntfs_log_debug("NumberOfSectors = %lld\n", (long long)sectors); if (!sectors) { ntfs_log_error("Volume size is set to zero.\n"); return -1; @@ -213,8 +213,8 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) vol->mft_lcn = sle64_to_cpu(bs->mft_lcn); vol->mftmirr_lcn = sle64_to_cpu(bs->mftmirr_lcn); - ntfs_log_debug("MFT LCN = 0x%llx\n", vol->mft_lcn); - ntfs_log_debug("MFTMirr LCN = 0x%llx\n", vol->mftmirr_lcn); + ntfs_log_debug("MFT LCN = %lld\n", (long long)vol->mft_lcn); + ntfs_log_debug("MFTMirr LCN = %lld\n", (long long)vol->mftmirr_lcn); if (vol->mft_lcn > vol->nr_clusters || vol->mftmirr_lcn > vol->nr_clusters) { ntfs_log_error("$MFT LCN (%lld) or $MFTMirr LCN (%lld) is " diff --git a/libntfs-3g/compress.c b/libntfs-3g/compress.c index a6be8275..09f874bb 100644 --- a/libntfs-3g/compress.c +++ b/libntfs-3g/compress.c @@ -100,8 +100,8 @@ static int ntfs_decompress(u8 *dest, const u32 dest_size, ntfs_log_trace("Entering, cb_size = 0x%x.\n", (unsigned)cb_size); do_next_sb: - ntfs_log_debug("Beginning sub-block at offset = 0x%x in the cb.\n", - cb - cb_start); + ntfs_log_debug("Beginning sub-block at offset = %d in the cb.\n", + (int)(cb - cb_start)); /* * Have we reached the end of the compression block or the end of the * decompressed data? The latter can happen for example if the current diff --git a/libntfs-3g/debug.c b/libntfs-3g/debug.c index d154fb0e..f1934833 100644 --- a/libntfs-3g/debug.c +++ b/libntfs-3g/debug.c @@ -63,9 +63,15 @@ void ntfs_debug_runlist_dump(const runlist_element *rl) if (idx > -LCN_EINVAL - 1) idx = 4; - ntfs_log_debug("%-16llx %s %-16llx%s\n", rl[i].vcn, lcn_str[idx], rl[i].length, rl[i].length ? "" : " (runlist end)"); + ntfs_log_debug("%-16lld %s %-16lld%s\n", + (long long)rl[i].vcn, lcn_str[idx], + (long long)rl[i].length, + rl[i].length ? "" : " (runlist end)"); } else - ntfs_log_debug("%-16llx %-16llx %-16llx%s\n", rl[i].vcn, rl[i].lcn, rl[i].length, rl[i].length ? "" : " (runlist end)"); + ntfs_log_debug("%-16lld %-16lld %-16lld%s\n", + (long long)rl[i].vcn, (long long)rl[i].lcn, + (long long)rl[i].length, + rl[i].length ? "" : " (runlist end)"); } while (rl[i++].length); } diff --git a/libntfs-3g/device.c b/libntfs-3g/device.c index cf4969c3..c77d8f95 100644 --- a/libntfs-3g/device.c +++ b/libntfs-3g/device.c @@ -178,7 +178,7 @@ s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, void *b) s64 br, total; struct ntfs_device_operations *dops; - ntfs_log_trace("Entering for pos 0x%llx, count 0x%llx.\n", pos, count); + ntfs_log_trace("pos %lld, count %lld\n",(long long)pos,(long long)count); if (!b || count < 0 || pos < 0) { errno = EINVAL; @@ -229,7 +229,8 @@ s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, s64 written, total, ret = -1; struct ntfs_device_operations *dops; - ntfs_log_trace("Entering for pos 0x%llx, count 0x%llx.\n", pos, count); + ntfs_log_trace("pos %lld, count %lld\n",(long long)pos,(long long)count); + if (!b || count < 0 || pos < 0) { errno = EINVAL; goto out; diff --git a/libntfs-3g/dir.c b/libntfs-3g/dir.c index a91e1aca..9b0da6e0 100644 --- a/libntfs-3g/dir.c +++ b/libntfs-3g/dir.c @@ -814,7 +814,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, * or signals an error (both covered by the rc test). */ for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { - ntfs_log_debug("In index root, offset 0x%x.\n", (u8*)ie - (u8*)ir); + ntfs_log_debug("In index root, offset %d.\n", (int)((u8*)ie - (u8*)ir)); /* Bounds checks. */ if ((u8*)ie < (u8*)ctx->mrec || (u8*)ie + sizeof(INDEX_ENTRY_HEADER) > index_end || @@ -1442,8 +1442,9 @@ search: /* Ignore hard links from other directories */ if (dir_ni->mft_no != MREF_LE(fn->parent_directory)) { ntfs_log_debug("MFT record numbers don't match " - "(%llu != %llu)\n", dir_ni->mft_no, - MREF_LE(fn->parent_directory)); + "(%llu != %llu)\n", + (long long unsigned)dir_ni->mft_no, + (long long unsigned)MREF_LE(fn->parent_directory)); continue; } diff --git a/libntfs-3g/index.c b/libntfs-3g/index.c index 2e804514..8d3502ef 100644 --- a/libntfs-3g/index.c +++ b/libntfs-3g/index.c @@ -82,7 +82,7 @@ static int ntfs_ib_write(ntfs_index_context *icx, INDEX_BLOCK *ib) { s64 ret, vcn = sle64_to_cpu(ib->index_block_vcn); - ntfs_log_trace("vcn: %lld\n", vcn); + ntfs_log_trace("vcn: %lld\n", (long long)vcn); ret = ntfs_attr_mst_pwrite(icx->ia_na, ntfs_ib_vcn_to_pos(icx, vcn), 1, icx->block_size, ib); @@ -585,7 +585,7 @@ static int ntfs_ib_read(ntfs_index_context *icx, VCN vcn, INDEX_BLOCK *dst) { s64 pos, ret; - ntfs_log_trace("vcn: %lld\n", vcn); + ntfs_log_trace("vcn: %lld\n", (long long)vcn); pos = ntfs_ib_vcn_to_pos(icx, vcn); @@ -746,7 +746,7 @@ descend_into_child_node: } old_vcn = vcn; - ntfs_log_debug("Descend into node with VCN %lld.\n", vcn); + ntfs_log_debug("Descend into node with VCN %lld\n", (long long)vcn); if (ntfs_ib_read(icx, vcn, ib)) goto err_out; @@ -797,7 +797,7 @@ static INDEX_BLOCK *ntfs_ib_alloc(VCN ib_vcn, u32 ib_size, INDEX_BLOCK *ib; int ih_size = sizeof(INDEX_HEADER); - ntfs_log_trace("Entering ib_vcn = %lld ib_size = %u\n", ib_vcn, ib_size); + ntfs_log_trace("ib_vcn: %lld ib_size: %u\n", (long long)ib_vcn, ib_size); ib = ntfs_calloc(ib_size); if (!ib) @@ -893,7 +893,7 @@ static int ntfs_ibm_modify(ntfs_index_context *icx, VCN vcn, int set) ntfs_attr *na; int ret = STATUS_ERROR; - ntfs_log_trace("%s vcn: %lld\n", set ? "set" : "clear", vcn); + ntfs_log_trace("%s vcn: %lld\n", set ? "set" : "clear", (long long)vcn); na = ntfs_attr_open(icx->ni, AT_BITMAP, icx->name, icx->name_len); if (!na) { @@ -970,7 +970,7 @@ static VCN ntfs_ibm_get_free(ntfs_index_context *icx) vcn = ntfs_ibm_pos_to_vcn(icx, size * 8); out: - ntfs_log_trace("allocated vcn: %lld\n", vcn); + ntfs_log_trace("allocated vcn: %lld\n", (long long)vcn); if (ntfs_ibm_set(icx, vcn)) vcn = (VCN)-1; diff --git a/libntfs-3g/inode.c b/libntfs-3g/inode.c index bd35c9d7..198a02b7 100644 --- a/libntfs-3g/inode.c +++ b/libntfs-3g/inode.c @@ -156,7 +156,7 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) ntfs_attr_search_ctx *ctx; STANDARD_INFORMATION *std_info; - ntfs_log_enter("Entering for inode %lld\n", MREF(mref)); + ntfs_log_enter("Entering for inode %lld\n", (long long)MREF(mref)); if (!vol) { errno = EINVAL; goto out; diff --git a/libntfs-3g/lcnalloc.c b/libntfs-3g/lcnalloc.c index 6c07ab0d..e95a9eb4 100644 --- a/libntfs-3g/lcnalloc.c +++ b/libntfs-3g/lcnalloc.c @@ -56,7 +56,7 @@ static void ntfs_cluster_set_zone_pos(LCN start, LCN end, LCN *pos, LCN tc) { - ntfs_log_trace("pos: %lld tc: %lld\n", (long long)*pos, tc); + ntfs_log_trace("pos: %lld tc: %lld\n", (long long)*pos, (long long)tc); if (tc >= end) *pos = start; @@ -326,8 +326,10 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, if (prev_lcn == lcn + bmp_pos - prev_run_len && rlpos) { ntfs_log_debug("Cluster coalesce: prev_lcn: " "%lld lcn: %lld bmp_pos: %lld " - "prev_run_len: %lld\n", prev_lcn, - lcn, bmp_pos, prev_run_len); + "prev_run_len: %lld\n", + (long long)prev_lcn, + (long long)lcn, (long long)bmp_pos, + (long long)prev_run_len); rl[rlpos - 1].length = ++prev_run_len; } else { if (rlpos) @@ -336,7 +338,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, else { rl[rlpos].vcn = start_vcn; ntfs_log_debug("Start_vcn: %lld\n", - start_vcn); + (long long)start_vcn); } rl[rlpos].lcn = prev_lcn = lcn + bmp_pos; @@ -345,8 +347,9 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, } ntfs_log_debug("RUN: %-16lld %-16lld %-16lld\n", - rl[rlpos - 1].vcn, rl[rlpos - 1].lcn, - rl[rlpos - 1].length); + (long long)rl[rlpos - 1].vcn, + (long long)rl[rlpos - 1].lcn, + (long long)rl[rlpos - 1].length); /* Done? */ if (!--clusters) { if (used_zone_pos) diff --git a/libntfs-3g/mft.c b/libntfs-3g/mft.c index b73e9b21..8158f240 100644 --- a/libntfs-3g/mft.c +++ b/libntfs-3g/mft.c @@ -1025,7 +1025,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) "count %lli.\n", (long long)nr); } while (1); - ntfs_log_debug("Allocated %lli clusters.\n", nr); + ntfs_log_debug("Allocated %lld clusters.\n", (long long)nr); rl = ntfs_runlists_merge(mft_na->rl, rl2); if (!rl) { diff --git a/libntfs-3g/volume.c b/libntfs-3g/volume.c index 3ae3dc9a..ab8b8803 100644 --- a/libntfs-3g/volume.c +++ b/libntfs-3g/volume.c @@ -565,9 +565,9 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long flags) * respective zone. */ vol->data1_zone_pos = vol->mft_zone_end; - ntfs_log_debug("data1_zone_pos = 0x%llx\n", vol->data1_zone_pos); + ntfs_log_debug("data1_zone_pos = %lld\n", (long long)vol->data1_zone_pos); vol->data2_zone_pos = 0; - ntfs_log_debug("data2_zone_pos = 0x%llx\n", vol->data2_zone_pos); + ntfs_log_debug("data2_zone_pos = %lld\n", (long long)vol->data2_zone_pos); /* Set the mft data allocation position to mft record 24. */ vol->mft_data_pos = 24;