Fix using signed return codes for DOS.

This commit is contained in:
2021-03-11 04:44:00 +00:00
parent 4542f64b00
commit 055a54edbb
8 changed files with 24 additions and 23 deletions

View File

@@ -47,7 +47,8 @@ void FileAttributes(const char* path)
{
char driveNo = path[0] - '@';
unsigned total, actionTaken;
int rc, wRc, cRc, handle;
unsigned int rc, wRc, cRc;
int handle;
int i;
if(driveNo > 32) driveNo -= 32;

View File

@@ -45,9 +45,9 @@ Copyright (C) 2011-2021 Natalia Portillo
void DeleteFiles(const char* path)
{
char driveNo = path[0] - '@';
int rc = 0;
unsigned int rc;
char filename[9];
short pos = 0;
short pos;
unsigned total;
int handle;
@@ -64,7 +64,7 @@ void DeleteFiles(const char* path)
return;
}
rc = chdir("DELETED");
chdir("DELETED");
printf("Creating and deleting files.\n");

View File

@@ -46,7 +46,7 @@ Copyright (C) 2011-2021 Natalia Portillo
void DirectoryDepth(const char* path)
{
char driveNo = path[0] - '@';
int rc = 0;
unsigned int rc ;
unsigned total;
char filename[9];
long pos = 2;

View File

@@ -46,7 +46,7 @@ Copyright (C) 2011-2021 Natalia Portillo
void Filenames(const char* path)
{
char driveNo = path[0] - '@';
int rc = 0, wRc = 0, cRc = 0;
unsigned int rc, wRc = 0, cRc = 0;
unsigned actionTaken, total;
int handle;
char message[300];
@@ -65,7 +65,7 @@ void Filenames(const char* path)
return;
}
rc = chdir("FILENAME");
chdir("FILENAME");
printf("Creating files with different filenames.\n");

View File

@@ -45,7 +45,7 @@ Copyright (C) 2011-2021 Natalia Portillo
void MillionFiles(const char* path)
{
char driveNo = path[0] - '@';
int rc = 0;
unsigned int rc;
char filename[9];
unsigned long pos = 0;
int handle;
@@ -64,7 +64,7 @@ void MillionFiles(const char* path)
return;
}
rc = chdir("MILLION");
chdir("MILLION");
printf("Creating lots of files.\n");

View File

@@ -47,14 +47,14 @@ 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;
unsigned int halfCluster = clusterSize / 2;
unsigned int quarterCluster = clusterSize / 4;
unsigned int twoCluster = clusterSize * 2;
unsigned int threeQuartersCluster = halfCluster + quarterCluster;
unsigned int twoAndThreeQuartCluster = threeQuartersCluster + twoCluster;
unsigned char* buffer;
char driveNo = path[0] - '@';
int rc = 0, wRc = 0, cRc = 0;
unsigned int rc, wRc = 0, cRc = 0;
unsigned total, actionTaken = 0;
int handle;
long i;
@@ -72,7 +72,7 @@ void Fragmentation(const char* path, size_t clusterSize)
return;
}
rc = chdir("FRAGS");
chdir("FRAGS");
rc = _dos_creatnew("HALFCLST", _A_NORMAL, &handle);
if(!rc)
@@ -221,7 +221,7 @@ void Fragmentation(const char* path, size_t clusterSize)
}
printf("\tDeleting \"TWO1\".\n");
rc = unlink("TWO1");
unlink("TWO1");
printf("\tDeleting \"TWO3\".\n");
rc = unlink("TWO3");

View File

@@ -47,7 +47,7 @@ Copyright (C) 2011-2021 Natalia Portillo
void Timestamps(const char* path)
{
char driveNo = path[0] - '@';
int rc = 0, wRc = 0, cRc = 0, tRc = 0;
unsigned int rc, wRc = 0, cRc = 0, tRc = 0;
unsigned actionTaken, total;
int handle;
char message[300];

View File

@@ -43,20 +43,20 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
char driveNo = path[0] - '@';
struct diskfree_t oldFreeSpace;
struct diskfree_ex_t freeSpace;
unsigned int ret;
unsigned int rc;
memset(&oldFreeSpace, 0, sizeof(struct diskfree_t));
memset(&freeSpace, 0, sizeof(struct diskfree_ex_t));
if(driveNo > 32) driveNo -= 32;
ret = _dos_getdiskfree_ex(driveNo, &freeSpace);
rc = _dos_getdiskfree_ex(driveNo, &freeSpace);
if(ret)
if(rc)
{
if(errno == ENOSYS)
{
ret = _dos_getdiskfree(driveNo, &oldFreeSpace);
rc = _dos_getdiskfree(driveNo, &oldFreeSpace);
freeSpace.sectorsPerCluster = oldFreeSpace.sectors_per_cluster;
freeSpace.freeClusters = oldFreeSpace.avail_clusters;
freeSpace.bytesPerSector = oldFreeSpace.bytes_per_sector;
@@ -69,7 +69,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
}
}
if(ret == 0)
if(rc == 0)
{
printf("\tBytes per sector: %lu\n", freeSpace.bytesPerSector);
printf("\tSectors per cluster: %lu (%lu bytes)\n",