Auto merged
2004/03/09 14:38:51+00:00 cantab.net!aia21 Fix all occurences of printf with %ll length modifiers but 64 bit arguments to typecast the arguments to (unsigned) long long to avoid the warnings when compiling on 64 bit architectures. (Logical change 1.306)edge.strict_endians
parent
43280fed03
commit
6dea839252
|
|
@ -861,14 +861,17 @@ int calc_percentage (struct ufile *file, ntfs_volume *vol)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */
|
if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */
|
||||||
Vprintf ("Missing segment at beginning, %lld clusters\n", rl[0].length);
|
Vprintf ("Missing segment at beginning, %lld "
|
||||||
|
"clusters\n", (long long)rl[0].length);
|
||||||
inuse += rl[0].length;
|
inuse += rl[0].length;
|
||||||
rl++;
|
rl++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; rl[i].length > 0; i++) {
|
for (i = 0; rl[i].length > 0; i++) {
|
||||||
if (rl[i].lcn == LCN_RL_NOT_MAPPED) {
|
if (rl[i].lcn == LCN_RL_NOT_MAPPED) {
|
||||||
Vprintf ("Missing segment at end, %lld clusters\n", rl[i].length);
|
Vprintf ("Missing segment at end, %lld "
|
||||||
|
"clusters\n",
|
||||||
|
(long long)rl[i].length);
|
||||||
inuse += rl[i].length;
|
inuse += rl[i].length;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -994,7 +997,9 @@ void dump_record (struct ufile *file)
|
||||||
Qprintf (" None\n");
|
Qprintf (" None\n");
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; d->runlist[i].length > 0; i++) {
|
for (i = 0; d->runlist[i].length > 0; i++) {
|
||||||
Qprintf (" %lld @ %lld\n", d->runlist[i].length, d->runlist[i].lcn);
|
Qprintf (" %lld @ %lld\n",
|
||||||
|
(long long)d->runlist[i].length,
|
||||||
|
(long long)d->runlist[i].lcn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1478,7 +1483,9 @@ int undelete_file (ntfs_volume *vol, long long inode)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */
|
if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */
|
||||||
Vprintf ("Missing segment at beginning, %lld clusters.\n", rl[0].length);
|
Vprintf ("Missing segment at beginning, %lld "
|
||||||
|
"clusters.\n",
|
||||||
|
(long long)rl[0].length);
|
||||||
memset (buffer, opts.fillbyte, bufsize);
|
memset (buffer, opts.fillbyte, bufsize);
|
||||||
for (k = 0; k < rl[0].length * vol->cluster_size; k += bufsize) {
|
for (k = 0; k < rl[0].length * vol->cluster_size; k += bufsize) {
|
||||||
if (write_data (fd, buffer, bufsize) < bufsize) {
|
if (write_data (fd, buffer, bufsize) < bufsize) {
|
||||||
|
|
@ -1492,7 +1499,9 @@ int undelete_file (ntfs_volume *vol, long long inode)
|
||||||
for (i = 0; rl[i].length > 0; i++) {
|
for (i = 0; rl[i].length > 0; i++) {
|
||||||
|
|
||||||
if (rl[i].lcn == LCN_RL_NOT_MAPPED) {
|
if (rl[i].lcn == LCN_RL_NOT_MAPPED) {
|
||||||
Vprintf ("Missing segment at end, %lld clusters.\n", rl[i].length);
|
Vprintf ("Missing segment at end, "
|
||||||
|
"%lld clusters.\n",
|
||||||
|
(long long)rl[i].length);
|
||||||
memset (buffer, opts.fillbyte, bufsize);
|
memset (buffer, opts.fillbyte, bufsize);
|
||||||
for (k = 0; k < rl[k].length * vol->cluster_size; k += bufsize) {
|
for (k = 0; k < rl[k].length * vol->cluster_size; k += bufsize) {
|
||||||
if (write_data (fd, buffer, bufsize) < bufsize) {
|
if (write_data (fd, buffer, bufsize) < bufsize) {
|
||||||
|
|
@ -1684,7 +1693,9 @@ int main (int argc, char *argv[])
|
||||||
result = !copy_mft (vol, opts.mft_begin, opts.mft_end);
|
result = !copy_mft (vol, opts.mft_begin, opts.mft_end);
|
||||||
if (result)
|
if (result)
|
||||||
Vprintf ("Failed to read MFT blocks %lld-%lld.\n",
|
Vprintf ("Failed to read MFT blocks %lld-%lld.\n",
|
||||||
opts.mft_begin, min (vol->nr_mft_records, opts.mft_end));
|
(long long)opts.mft_begin,
|
||||||
|
(long long)min(vol->nr_mft_records,
|
||||||
|
opts.mft_end));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
; /* Cannot happen */
|
; /* Cannot happen */
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,7 @@ s64 wipe_unused (ntfs_volume *vol, int byte, enum action act)
|
||||||
total += vol->cluster_size;
|
total += vol->cluster_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qprintf ("wipe_unused 0x%02x, %lld bytes\n", byte, total);
|
Qprintf ("wipe_unused 0x%02x, %lld bytes\n", byte, (long long)total);
|
||||||
free:
|
free:
|
||||||
free (buffer);
|
free (buffer);
|
||||||
return total;
|
return total;
|
||||||
|
|
@ -448,7 +448,8 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act)
|
||||||
result = ntfs_attr_mst_pread (vol->mft_na, vol->mft_record_size * i,
|
result = ntfs_attr_mst_pread (vol->mft_na, vol->mft_record_size * i,
|
||||||
1, vol->mft_record_size, buffer);
|
1, vol->mft_record_size, buffer);
|
||||||
if (result != 1) {
|
if (result != 1) {
|
||||||
Eprintf ("error attr mst read %lld\n", i);
|
Eprintf ("error attr mst read %lld\n",
|
||||||
|
(long long)i);
|
||||||
total = -1; // XXX just negate result?
|
total = -1; // XXX just negate result?
|
||||||
goto free;
|
goto free;
|
||||||
}
|
}
|
||||||
|
|
@ -467,7 +468,8 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act)
|
||||||
result = ntfs_attr_mst_pwrite (vol->mft_na, vol->mft_record_size * i,
|
result = ntfs_attr_mst_pwrite (vol->mft_na, vol->mft_record_size * i,
|
||||||
1, vol->mft_record_size, buffer);
|
1, vol->mft_record_size, buffer);
|
||||||
if (result != 1) {
|
if (result != 1) {
|
||||||
Eprintf ("error attr mst write %lld\n", i);
|
Eprintf ("error attr mst write %lld\n",
|
||||||
|
(long long)i);
|
||||||
total = -1;
|
total = -1;
|
||||||
goto free;
|
goto free;
|
||||||
}
|
}
|
||||||
|
|
@ -484,7 +486,8 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act)
|
||||||
result = ntfs_attr_mst_pwrite (vol->mftmirr_na, vol->mft_record_size * i,
|
result = ntfs_attr_mst_pwrite (vol->mftmirr_na, vol->mft_record_size * i,
|
||||||
1, vol->mft_record_size, buffer);
|
1, vol->mft_record_size, buffer);
|
||||||
if (result != 1) {
|
if (result != 1) {
|
||||||
Eprintf ("error attr mst write %lld\n", i);
|
Eprintf ("error attr mst write %lld\n",
|
||||||
|
(long long)i);
|
||||||
total = -1;
|
total = -1;
|
||||||
goto free;
|
goto free;
|
||||||
}
|
}
|
||||||
|
|
@ -524,7 +527,8 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act)
|
||||||
result = ntfs_attr_mst_pwrite (vol->mft_na, vol->mft_record_size * i,
|
result = ntfs_attr_mst_pwrite (vol->mft_na, vol->mft_record_size * i,
|
||||||
1, vol->mft_record_size, buffer);
|
1, vol->mft_record_size, buffer);
|
||||||
if (result != 1) {
|
if (result != 1) {
|
||||||
Eprintf ("error attr mst write %lld\n", i);
|
Eprintf ("error attr mst write %lld\n",
|
||||||
|
(long long)i);
|
||||||
total = -1;
|
total = -1;
|
||||||
goto free;
|
goto free;
|
||||||
}
|
}
|
||||||
|
|
@ -533,7 +537,7 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Qprintf ("wipe_mft 0x%02x, %lld bytes\n", byte, total);
|
Qprintf ("wipe_mft 0x%02x, %lld bytes\n", byte, (long long)total);
|
||||||
free:
|
free:
|
||||||
free (buffer);
|
free (buffer);
|
||||||
return total;
|
return total;
|
||||||
|
|
@ -765,9 +769,11 @@ int ntfs_info (ntfs_volume *vol)
|
||||||
Qprintf ("\n");
|
Qprintf ("\n");
|
||||||
|
|
||||||
Qprintf ("Cluster size = %u\n", vol->cluster_size);
|
Qprintf ("Cluster size = %u\n", vol->cluster_size);
|
||||||
Qprintf ("Volume size = %lld clusters\n", vol->nr_clusters);
|
Qprintf ("Volume size = %lld clusters\n", (long long)vol->nr_clusters);
|
||||||
Qprintf ("Volume size = %lld bytes\n", vol->nr_clusters * vol->cluster_size);
|
Qprintf ("Volume size = %lld bytes\n",
|
||||||
Qprintf ("Volume size = %lld MiB\n", vol->nr_clusters * vol->cluster_size / (1024*1024)); /* round up? */
|
(long long)vol->nr_clusters * vol->cluster_size);
|
||||||
|
Qprintf ("Volume size = %lld MiB\n", (long long)vol->nr_clusters *
|
||||||
|
vol->cluster_size / (1024*1024)); /* round up? */
|
||||||
|
|
||||||
Qprintf ("\n");
|
Qprintf ("\n");
|
||||||
|
|
||||||
|
|
@ -778,7 +784,7 @@ int ntfs_info (ntfs_volume *vol)
|
||||||
|
|
||||||
Qprintf ("cluster\n");
|
Qprintf ("cluster\n");
|
||||||
//Qprintf ("allocated_size = %lld\n", vol->lcnbmp_na->allocated_size);
|
//Qprintf ("allocated_size = %lld\n", vol->lcnbmp_na->allocated_size);
|
||||||
Qprintf ("data_size = %lld\n", vol->lcnbmp_na->data_size);
|
Qprintf ("data_size = %lld\n", (long long)vol->lcnbmp_na->data_size);
|
||||||
//Qprintf ("initialized_size = %lld\n", vol->lcnbmp_na->initialized_size);
|
//Qprintf ("initialized_size = %lld\n", vol->lcnbmp_na->initialized_size);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -815,7 +821,8 @@ int ntfs_info (ntfs_volume *vol)
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
|
|
||||||
Qprintf ("cluster use %lld, not %lld, total %lld\n", use, not, use+not);
|
Qprintf ("cluster use %lld, not %lld, total %lld\n", (long long)use,
|
||||||
|
(long long)not, (long long)(use + not));
|
||||||
Qprintf ("\n");
|
Qprintf ("\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -832,13 +839,13 @@ done:
|
||||||
if (!bitmap)
|
if (!bitmap)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
printf ("mft has %lld records\n", vol->nr_mft_records);
|
printf ("mft has %lld records\n", (long long)vol->nr_mft_records);
|
||||||
|
|
||||||
//Qprintf ("allocated_size = %lld\n", vol->mftbmp_na->allocated_size);
|
//Qprintf ("allocated_size = %lld\n", vol->mftbmp_na->allocated_size);
|
||||||
Qprintf ("data_size = %lld\n", vol->mftbmp_na->data_size);
|
Qprintf ("data_size = %lld\n", (long long)vol->mftbmp_na->data_size);
|
||||||
//Qprintf ("initialized_size = %lld\n", vol->mftbmp_na->initialized_size);
|
//Qprintf ("initialized_size = %lld\n", vol->mftbmp_na->initialized_size);
|
||||||
|
|
||||||
printf ("bmpsize = %lld\n", bmpsize);
|
printf ("bmpsize = %lld\n", (long long)bmpsize);
|
||||||
for (bmpoff = 0; bmpoff < bmpsize; bmpoff += bmpbufsize) {
|
for (bmpoff = 0; bmpoff < bmpsize; bmpoff += bmpbufsize) {
|
||||||
if ((bmpoff + bmpbufsize) > bmpsize)
|
if ((bmpoff + bmpbufsize) > bmpsize)
|
||||||
bmpbufsize = bmpsize - bmpoff;
|
bmpbufsize = bmpsize - bmpoff;
|
||||||
|
|
@ -867,7 +874,8 @@ done:
|
||||||
|
|
||||||
bmpdone:
|
bmpdone:
|
||||||
printf ("mft\n");
|
printf ("mft\n");
|
||||||
printf ("use %lld, not %lld, total %lld\n", use, not, use+not);
|
printf ("use %lld, not %lld, total %lld\n", (long long)use,
|
||||||
|
(long long)not, (long long)(use + not));
|
||||||
|
|
||||||
free (bitmap);
|
free (bitmap);
|
||||||
}
|
}
|
||||||
|
|
@ -1014,9 +1022,12 @@ int main (int argc, char *argv[])
|
||||||
runlist_element *rl = vol->mft_na->rl;
|
runlist_element *rl = vol->mft_na->rl;
|
||||||
printf ("________________________________________________________________________________\n\n");
|
printf ("________________________________________________________________________________\n\n");
|
||||||
for (; rl->length > 0; rl++, i++) {
|
for (; rl->length > 0; rl++, i++) {
|
||||||
printf ("%4d %lld,%lld,%lld\n", i, rl->vcn, rl->lcn, rl->length);
|
printf ("%4d %lld,%lld,%lld\n", i, (long long)rl->vcn,
|
||||||
|
(long long)rl->lcn,
|
||||||
|
(long long)rl->length);
|
||||||
}
|
}
|
||||||
printf ("%4d %lld,%lld,%lld\n", i, rl->vcn, rl->lcn, rl->length);
|
printf ("%4d %lld,%lld,%lld\n", i, (long long)rl->vcn,
|
||||||
|
(long long)rl->lcn, (long long)rl->length);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1080,7 +1091,7 @@ int main (int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("%llu bytes were wiped\n", total);
|
printf ("%lld bytes were wiped\n", (long long)total);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntfs_volume_set_flags (vol, VOLUME_IS_DIRTY) < 0) {
|
if (ntfs_volume_set_flags (vol, VOLUME_IS_DIRTY) < 0) {
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,7 @@ int utils_parse_size (const char *value, s64 *size, BOOL scale)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((suffix[0] != '-') && (suffix[0] != 0)) {
|
if ((suffix[0] != '-') && (suffix[0] != 0)) {
|
||||||
Eprintf ("Invalid number '%.*s'.\n", (suffix - value + 1), value);
|
Eprintf ("Invalid number '%.*s'.\n", (int)(suffix - value + 1), value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -472,7 +472,8 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize)
|
||||||
temp = malloc (30);
|
temp = malloc (30);
|
||||||
if (!temp)
|
if (!temp)
|
||||||
return 0;
|
return 0;
|
||||||
snprintf (temp, 30, "<MFT%lld>", inode->mft_no);
|
snprintf (temp, 30, "<MFT%llu>", (unsigned
|
||||||
|
long long)inode->mft_no);
|
||||||
names[i] = temp;
|
names[i] = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -492,7 +493,8 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize)
|
||||||
|
|
||||||
inode = ntfs_inode_open (vol, parent);
|
inode = ntfs_inode_open (vol, parent);
|
||||||
if (!inode) {
|
if (!inode) {
|
||||||
Eprintf ("Couldn't open inode %lld.\n", MREF (parent));
|
Eprintf ("Couldn't open inode %llu.\n",
|
||||||
|
(unsigned long long)MREF(parent));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -776,7 +778,8 @@ ntfs_inode * utils_pathname_to_inode (ntfs_volume *vol, ntfs_inode *parent, cons
|
||||||
|
|
||||||
ni = ntfs_inode_open (vol, inum);
|
ni = ntfs_inode_open (vol, inum);
|
||||||
if (!ni) {
|
if (!ni) {
|
||||||
Eprintf ("Cannot open inode %lld: %s.\n", inum, p);
|
Eprintf ("Cannot open inode %llu: %s.\n",
|
||||||
|
(unsigned long long)inum, p);
|
||||||
goto close;
|
goto close;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -968,7 +971,8 @@ int mft_next_record (struct mft_search_ctx *ctx)
|
||||||
ctx->flags_match = 0;
|
ctx->flags_match = 0;
|
||||||
int in_use = utils_mftrec_in_use (ctx->vol, (MFT_REF) ctx->mft_num);
|
int in_use = utils_mftrec_in_use (ctx->vol, (MFT_REF) ctx->mft_num);
|
||||||
if (in_use == -1) {
|
if (in_use == -1) {
|
||||||
Eprintf ("Error reading inode %lld. Aborting.", ctx->mft_num);
|
Eprintf ("Error reading inode %llu. Aborting.",
|
||||||
|
(unsigned long long)ctx->mft_num);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -977,7 +981,8 @@ int mft_next_record (struct mft_search_ctx *ctx)
|
||||||
|
|
||||||
ctx->inode = ntfs_inode_open (ctx->vol, (MFT_REF) ctx->mft_num);
|
ctx->inode = ntfs_inode_open (ctx->vol, (MFT_REF) ctx->mft_num);
|
||||||
if (ctx->inode == NULL) {
|
if (ctx->inode == NULL) {
|
||||||
Eprintf ("Error reading inode %lld.", ctx->mft_num);
|
Eprintf ("Error reading inode %llu.", (unsigned
|
||||||
|
long long) ctx->mft_num);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1046,7 +1051,9 @@ int mft_next_record (struct mft_search_ctx *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntfs_attr_pread (mft, ctx->vol->mft_record_size * ctx->mft_num, ctx->vol->mft_record_size, ctx->inode->mrec) < ctx->vol->mft_record_size) {
|
if (ntfs_attr_pread (mft, ctx->vol->mft_record_size * ctx->mft_num, ctx->vol->mft_record_size, ctx->inode->mrec) < ctx->vol->mft_record_size) {
|
||||||
Eprintf ("Couldn't read MFT Record %lld: %s.\n", ctx->mft_num, strerror (errno));
|
Eprintf ("Couldn't read MFT Record %llu: %s.\n",
|
||||||
|
(unsigned long long)
|
||||||
|
ctx->mft_num, strerror (errno));
|
||||||
// free / close
|
// free / close
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -1057,7 +1064,8 @@ int mft_next_record (struct mft_search_ctx *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntfs_inode_close (ctx->inode)) {
|
if (ntfs_inode_close (ctx->inode)) {
|
||||||
Eprintf ("Error closing inode %lld.", ctx->mft_num);
|
Eprintf ("Error closing inode %llu.",
|
||||||
|
(unsigned long long)ctx->mft_num);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue