Fixed type sizes.

This commit is contained in:
2021-03-14 18:51:29 +00:00
parent 1fa25644d1
commit 7c5f015623
7 changed files with 46 additions and 35 deletions

View File

@@ -44,11 +44,11 @@ Copyright (C) 2011-2021 Natalia Portillo
void Fragmentation(const char* path, size_t clusterSize)
{
size_t halfCluster = clusterSize / 2;
size_t quarterCluster = clusterSize / 4;
size_t twoCluster = clusterSize * 2;
size_t threeQuartersCluster = halfCluster + quarterCluster;
size_t twoAndThreeQuartCluster = threeQuartersCluster + twoCluster;
int32_t halfCluster = (int32_t)clusterSize / 2;
int32_t quarterCluster = (int32_t)clusterSize / 4;
int32_t twoCluster = (int32_t)clusterSize * 2;
int32_t threeQuartersCluster = halfCluster + quarterCluster;
int32_t twoAndThreeQuartCluster = threeQuartersCluster + twoCluster;
unsigned char* buffer;
OSErr rc, wRc, cRc;
Str255 str255;
@@ -107,7 +107,7 @@ void Fragmentation(const char* path, size_t clusterSize)
}
}
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "HALFCLST", halfCluster, rc, wRc, cRc);
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "HALFCLST", halfCluster, rc, wRc, cRc);
rc = HCreate(refNum, dirId, "\pQUARCLST", ostUnknown, ftGenericDocumentPC);
if(!rc)
@@ -127,7 +127,7 @@ void Fragmentation(const char* path, size_t clusterSize)
}
}
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "QUARCLST", quarterCluster, rc, wRc, cRc);
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "QUARCLST", quarterCluster, rc, wRc, cRc);
rc = HCreate(refNum, dirId, "\pTWOCLST", ostUnknown, ftGenericDocumentPC);
if(!rc)
@@ -147,7 +147,7 @@ void Fragmentation(const char* path, size_t clusterSize)
}
}
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWOCLST", twoCluster, rc, wRc, cRc);
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "TWOCLST", twoCluster, rc, wRc, cRc);
rc = HCreate(refNum, dirId, "\pTRQTCLST", ostUnknown, ftGenericDocumentPC);
if(!rc)
@@ -167,7 +167,7 @@ void Fragmentation(const char* path, size_t clusterSize)
}
}
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n",
"TRQTCLST",
threeQuartersCluster,
rc,
@@ -192,7 +192,7 @@ void Fragmentation(const char* path, size_t clusterSize)
}
}
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n",
"TWTQCLST",
twoAndThreeQuartCluster,
rc,
@@ -217,7 +217,7 @@ void Fragmentation(const char* path, size_t clusterSize)
}
}
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWO1", twoCluster, rc, wRc, cRc);
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "TWO1", twoCluster, rc, wRc, cRc);
rc = HCreate(refNum, dirId, "\pTWO2", ostUnknown, ftGenericDocumentPC);
if(!rc)
@@ -237,7 +237,7 @@ void Fragmentation(const char* path, size_t clusterSize)
}
}
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWO2", twoCluster, rc, wRc, cRc);
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "TWO2", twoCluster, rc, wRc, cRc);
rc = HCreate(refNum, dirId, "\pTWO3", ostUnknown, ftGenericDocumentPC);
if(!rc)
@@ -260,7 +260,7 @@ void Fragmentation(const char* path, size_t clusterSize)
printf("\tDeleting \"TWO2\".\n");
rc = HDelete(refNum, dirId, "\pTWO2");
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n", "TWO3", twoCluster, rc, wRc, cRc);
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n", "TWO3", twoCluster, rc, wRc, cRc);
rc = HCreate(refNum, dirId, "\pFRAGTHRQ", ostUnknown, ftGenericDocumentPC);
if(!rc)
@@ -303,7 +303,7 @@ void Fragmentation(const char* path, size_t clusterSize)
}
}
printf("\tFile name = \"%s\", size = %d, rc = %d, wRc = %d, cRc = %d\n",
printf("\tFile name = \"%s\", size = %ld, rc = %d, wRc = %d, cRc = %d\n",
"FRAGSIXQ",
twoAndThreeQuartCluster,
rc,

View File

@@ -43,14 +43,14 @@ void GetOsInfo()
printf("OS information:\n");
rc = Gestalt(gestaltAUXVersion, &gestaltResponse);
if(!rc) { printf("Running under A/UX version 0x%08X\n", gestaltResponse); }
if(!rc) { printf("Running under A/UX version 0x%08lX\n", gestaltResponse); }
else
{
rc = Gestalt(gestaltSystemVersion, &gestaltResponse);
if(rc) { printf("Could not get Mac OS version.\n"); }
else
{
printf("Running under Mac OS version %d.%d.%d",
printf("Running under Mac OS version %ld.%ld.%ld",
(gestaltResponse & 0xF00) >> 8,
(gestaltResponse & 0xF0) >> 4,
gestaltResponse & 0xF);
@@ -63,7 +63,7 @@ void GetOsInfo()
case 1: printf("Motorola 68k architecture."); break;
case 2: printf("PowerPC architecture."); break;
case 3: printf("x86 architecture."); break;
default: printf("unknown architecture code %d.", gestaltResponse); break;
default: printf("unknown architecture code %ld.", gestaltResponse); break;
}
}
printf("\n");

View File

@@ -62,8 +62,8 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
rc = Gestalt(gestaltFSAttr, &gestaltResponse);
if(!rc)
{
hfsPlusApis = gestaltResponse & (1 << gestaltHasHFSPlusAPIs);
bigVol = gestaltResponse & (1 << gestaltFSSupports2TBVols);
hfsPlusApis = (gestaltResponse & (1 << gestaltHasHFSPlusAPIs))!= 0;
bigVol = (gestaltResponse & (1 << gestaltFSSupports2TBVols))!=0;
}
if(!bigVol)
@@ -124,10 +124,10 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
printf("\tVolume name: %#s\n", str255);
printf("\t%llu allocation blocks in volume, %llu free\n", totalBlocks, freeBlocks);
printf("\t%llu bytes in volume, %llu free\n", totalBytes, freeBytes);
printf("\t%d bytes per allocation block.\n", *clusterSize);
printf("\tVolume created on 0x%08X\n", crDate);
printf("\tVolume last written on 0x%08X\n", lwDate);
printf("\tVolume last backed up on 0x%08X\n", bkDate);
printf("\t%lu bytes per allocation block.\n", *clusterSize);
printf("\tVolume created on 0x%08lX\n", crDate);
printf("\tVolume last written on 0x%08lX\n", lwDate);
printf("\tVolume last backed up on 0x%08lX\n", bkDate);
printf("\tFilesystem type: ");
switch(fsId)
{