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

@@ -118,7 +118,7 @@ void Fragmentation(const char* path, size_t clusterSize)
free(buffer);
}
printf("\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu\n", "HALFCLST", halfCluster, rc, wRc, cRc);
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n", "HALFCLST", halfCluster, rc, wRc, cRc);
h = CreateFileA("QUARCLST", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
rc = 0;
@@ -141,7 +141,7 @@ void Fragmentation(const char* path, size_t clusterSize)
}
printf(
"\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu\n", "QUARCLST", quarterCluster, rc, wRc, cRc);
"\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n", "QUARCLST", quarterCluster, rc, wRc, cRc);
h = CreateFileA("TWOCLST", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
rc = 0;
@@ -163,7 +163,7 @@ void Fragmentation(const char* path, size_t clusterSize)
free(buffer);
}
printf("\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu\n", "TWOCLST", twoCluster, rc, wRc, cRc);
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n", "TWOCLST", twoCluster, rc, wRc, cRc);
h = CreateFileA("TRQTCLST", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
rc = 0;
@@ -185,7 +185,7 @@ void Fragmentation(const char* path, size_t clusterSize)
free(buffer);
}
printf("\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu\n",
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n",
"TRQTCLST",
threeQuartersCluster,
rc,
@@ -212,7 +212,7 @@ void Fragmentation(const char* path, size_t clusterSize)
free(buffer);
}
printf("\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu\n",
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n",
"TWTQCLST",
twoAndThreeQuartCluster,
rc,
@@ -239,7 +239,7 @@ void Fragmentation(const char* path, size_t clusterSize)
free(buffer);
}
printf("\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu\n", "TWO1", twoCluster, rc, wRc, cRc);
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n", "TWO1", twoCluster, rc, wRc, cRc);
h = CreateFileA("TWO2", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
rc = 0;
@@ -261,7 +261,7 @@ void Fragmentation(const char* path, size_t clusterSize)
free(buffer);
}
printf("\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu\n", "TWO2", twoCluster, rc, wRc, cRc);
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n", "TWO2", twoCluster, rc, wRc, cRc);
h = CreateFileA("TWO3", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
rc = 0;
@@ -287,7 +287,7 @@ void Fragmentation(const char* path, size_t clusterSize)
ret = DeleteFileA("TWO2");
if(!ret) { rc = GetLastError(); }
printf("\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu\n", "TWO3", twoCluster, rc, wRc, cRc);
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n", "TWO3", twoCluster, rc, wRc, cRc);
h = CreateFileA("FRAGTHRQ", dwFilePermissions, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
rc = 0;
@@ -316,7 +316,7 @@ void Fragmentation(const char* path, size_t clusterSize)
ret = DeleteFileA("TWO3");
if(!ret) { rc = GetLastError(); }
printf("\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu\n",
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n",
"FRAGTHRQ",
threeQuartersCluster,
rc,
@@ -343,7 +343,7 @@ void Fragmentation(const char* path, size_t clusterSize)
free(buffer);
}
printf("\tFile name = \"%s\", size = %d, rc = %lu, wRc = %lu, cRc = %lu\n",
printf("\tFile name = \"%s\", size = "SIZE_T_FORMAT", rc = %lu, wRc = %lu, cRc = %lu\n",
"FRAGSIXQ",
twoAndThreeQuartCluster,
rc,

View File

@@ -287,7 +287,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
*clusterSize = dwSectorsPerCluster * dwBytesPerSector;
printf("\tBytes per sector: %lu\n", dwBytesPerSector);
printf("\tSectors per cluster: %lu (%u bytes)\n", dwSectorsPerCluster, *clusterSize);
printf("\tSectors per cluster: %lu ("SIZE_T_FORMAT" bytes)\n", dwSectorsPerCluster, *clusterSize);
if(WinGetVersionExA)
{

View File

@@ -27,6 +27,9 @@ Contains 32-bit and 64-bit Windows declarations
Copyright (C) 2011-2021 Natalia Portillo
*****************************************************************************/
#pragma clang diagnostic push
#pragma ide diagnostic ignored "bugprone-reserved-identifier"
#ifndef AARU_FSTESTER_SETTER_WIN32_H
#define AARU_FSTESTER_SETTER_WIN32_H
@@ -57,4 +60,12 @@ static BOOL(WINAPI* WinGetVersionExA)(WIN_LPOSVERSIONINFOA);
static DWORD dwMaxNameSize = MAX_PATH + 1;
static DWORD dwFilePermissions = GENERIC_READ | GENERIC_WRITE;
#if defined(__aarch64__) || defined(_M_ARM64) || defined(__ia64__) || defined(_M_IA64) || defined(__x86_64__) || defined(__amd64) || defined(_M_AMD64) || defined(_M_X64)
#define SIZE_T_FORMAT "%llu"
#else
#define SIZE_T_FORMAT "%u"
#endif
#endif
#pragma clang diagnostic pop