From 2ebc84e7954b02c71d04ddc581eb11766bac11f2 Mon Sep 17 00:00:00 2001 From: Stef Date: Sat, 27 Nov 2010 04:15:42 +0000 Subject: Use 64-bit integers when listing partition info. --- src/list.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/list.c b/src/list.c index 31bb30e..b7085ce 100644 --- a/src/list.c +++ b/src/list.c @@ -28,8 +28,6 @@ const char kPrintData[] = "\ const char kPrintDrive[] = "\nDrive: %u\n"; const char kPrintDrivePath[] = "\nDrive: %s\n"; -const char kPrintDriveInfo[] = " %-15u %-15u "; -const char kPrintNTFSInfo[] = "%-15u %-15u"; int printNTFSInfo(int dd, uint64 tblSector) { @@ -53,7 +51,15 @@ int printNTFSInfo(int dd, uint64 tblSector) boot = (ntfs_bootsector*)sector; if(!memcmp(boot->sysId, kNTFS_SysId, sizeof(boot->sysId))) - printf(kPrintNTFSInfo, boot->secPerClus, boot->offMFT * boot->secPerClus); + { +#ifdef _WIN32 + printf("%-15u %-15I64u", (unsigned int)boot->secPerClus, + boot->offMFT * (uint64)boot->secPerClus); +#else + printf("%-15u %-15llu", (unsigned int)boot->secPerClus, + (unsigned long long)(boot->offMFT * (uint64)boot->secPerClus)); +#endif + } printf("\n"); return 0; @@ -91,7 +97,16 @@ int printPartitionInfo(int dd, uint64 tblSector) } else if(!mbr.partitions[i].system == kPartition_Invalid) { - printf(kPrintDriveInfo, (uint32)tblSector + mbr.partitions[i].startsec, (uint32)tblSector + mbr.partitions[i].endsec); +#ifdef _WIN32 + printf(" %-15I64u %-15I64u ", + tblSector + mbr.partitions[i].startsec, + tblSector + mbr.partitions[i].endsec); +#else + printf(" %-15llu %-15llu ", + (unsigned long long)(tblSector + mbr.partitions[i].startsec), + (unsigned long long)tblSector + mbr.partitions[i].endsec)); +#endif + printNTFSInfo(dd, tblSector + (uint64)mbr.partitions[i].startsec); } } -- cgit v1.2.3