Code refactor.

This commit is contained in:
2021-04-11 00:44:29 +01:00
parent d3b8e65bdd
commit 09e7535190
13 changed files with 49 additions and 26 deletions

28
setter/.idea/deployment.xml generated Normal file
View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
<serverData>
<paths name="Haiku (remote) (ae2ed873-6206-45f4-adc0-01b9159fe586)">
<serverdata>
<mappings>
<mapping deploy="/tmp/tmp.ykC3wFwbNa" local="$PROJECT_DIR$" />
</mappings>
<excludedPaths>
<excludedPath local="true" path="$PROJECT_DIR$/cmake-build-retro68k-m68k" />
<excludedPath local="true" path="$PROJECT_DIR$/cmake-build-debug" />
<excludedPath local="true" path="$PROJECT_DIR$/cmake-build-macos-remote" />
<excludedPath local="true" path="$PROJECT_DIR$/cmake-build-netbsd-remote" />
<excludedPath local="true" path="$PROJECT_DIR$/cmake-build-freebsd-remote" />
<excludedPath local="true" path="$PROJECT_DIR$/cmake-build-retro68k-ppc" />
<excludedPath local="true" path="$PROJECT_DIR$/cmake-build-haiku-remote" />
<excludedPath local="true" path="$PROJECT_DIR$/cmake-build-djgpp" />
<excludedPath local="true" path="$PROJECT_DIR$/cmake-build-openbsd-remote" />
<excludedPath local="true" path="$PROJECT_DIR$/cmake-build-dragonfly-bsd-remote" />
<excludedPath local="true" path="$PROJECT_DIR$/cmake-build-mingw-x86" />
<excludedPath local="true" path="$PROJECT_DIR$/cmake-build-mingw-x64" />
</excludedPaths>
</serverdata>
</paths>
</serverData>
</component>
</project>

View File

@@ -3,12 +3,7 @@
<component name="AutoUploadManager"> <component name="AutoUploadManager">
<option name="hosts"> <option name="hosts">
<list> <list>
<option value="6834515e-565c-4405-977e-ca79cd736f72" /> <option value="ae2ed873-6206-45f4-adc0-01b9159fe586" />
<option value="24494d08-8126-4c70-a92a-dfedaa4edc52" />
<option value="bf5645fe-ad70-480a-80ed-0dbee60589a4" />
<option value="b74ed85d-448d-4c44-bb80-fd5d39945ce2" />
<option value="bd4d21cb-219d-4aba-a987-5c3fd4707be6" />
<option value="9f90c805-053c-4a32-806f-fe7420fe9284" />
</list> </list>
</option> </option>
</component> </component>

View File

@@ -112,4 +112,3 @@ static const os2_attr_tests_t os2_attrs[KNOWN_OS2_ATTRS] = {
}; };
#endif // AARU_FSTESTER_SETTER_SRC_OS2_ATTR_H_ #endif // AARU_FSTESTER_SETTER_SRC_OS2_ATTR_H_

View File

@@ -44,7 +44,7 @@ void DeleteFiles(const char* path)
ACTION_RET actionTaken = 0; ACTION_RET actionTaken = 0;
HFILE handle; HFILE handle;
// 16 bit // 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86)) #if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT driveNo = path[0] - '@'; USHORT driveNo = path[0] - '@';
#else // 32 bit #else // 32 bit

View File

@@ -42,7 +42,7 @@ void DirectoryDepth(const char* path)
char filename[9]; char filename[9];
int pos = 2; int pos = 2;
// 16 bit // 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86)) #if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT driveNo = path[0] - '@'; USHORT driveNo = path[0] - '@';
#else // 32 bit #else // 32 bit

View File

@@ -44,7 +44,7 @@ void Filenames(const char* path)
char message[300]; char message[300];
int pos = 0; int pos = 0;
// 16 bit // 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86)) #if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT driveNo = path[0] - '@'; USHORT driveNo = path[0] - '@';
#else // 32 bit #else // 32 bit

View File

@@ -44,7 +44,7 @@ void MillionFiles(const char* path)
ACTION_RET actionTaken = 0; ACTION_RET actionTaken = 0;
HFILE handle; HFILE handle;
// 16 bit // 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86)) #if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT driveNo = path[0] - '@'; USHORT driveNo = path[0] - '@';
#else // 32 bit #else // 32 bit

View File

@@ -49,7 +49,7 @@ void Fragmentation(const char* path, size_t clusterSize)
HFILE handle; HFILE handle;
long i; long i;
// 16 bit // 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86)) #if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT driveNo = path[0] - '@'; USHORT driveNo = path[0] - '@';
#else // 32 bit #else // 32 bit

View File

@@ -24,5 +24,6 @@ Copyright (C) 2011-2021 Natalia Portillo
#include "../include/defs.h" #include "../include/defs.h"
void FilePermissions(const char* path) { /* Do nothing, not supported by target operating system */ } void FilePermissions(const char* path)
{ /* Do nothing, not supported by target operating system */
}

View File

@@ -24,4 +24,6 @@ Copyright (C) 2011-2021 Natalia Portillo
#include "../include/defs.h" #include "../include/defs.h"
void ResourceFork(const char* path) { /* Do nothing, not supported by target operating system */ } void ResourceFork(const char* path)
{ /* Do nothing, not supported by target operating system */
}

View File

@@ -30,9 +30,9 @@ Copyright (C) 2011-2021 Natalia Portillo
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "../os2defs.h"
#include "../include/consts.h" #include "../include/consts.h"
#include "../include/defs.h" #include "../include/defs.h"
#include "os2defs.h"
void Sparse(const char* path) void Sparse(const char* path)
{ /* Do nothing, not supported by target operating system */ { /* Do nothing, not supported by target operating system */

View File

@@ -45,7 +45,7 @@ void Timestamps(const char* path)
HFILE handle; HFILE handle;
char message[300]; char message[300];
// 16 bit // 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86)) #if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT status_size = sizeof(FILESTATUS); USHORT status_size = sizeof(FILESTATUS);
FILESTATUS status; FILESTATUS status;

View File

@@ -45,7 +45,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
USHORT usVolSerialHigh; USHORT usVolSerialHigh;
USHORT usVolSerialLow; USHORT usVolSerialLow;
// 16 bit // 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86)) #if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
USHORT cbData = sizeof(bData); USHORT cbData = sizeof(bData);
USHORT driveNo = path[0] - '@'; USHORT driveNo = path[0] - '@';
@@ -58,7 +58,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
*clusterSize = 0; *clusterSize = 0;
// 16 bit // 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86)) #if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
rc = DosQFSAttach((PSZ)path, 0, FSAIL_QUERYNAME, (PVOID)&bData, &cbData, 0); rc = DosQFSAttach((PSZ)path, 0, FSAIL_QUERYNAME, (PVOID)&bData, &cbData, 0);
#else // 32 bit #else // 32 bit
@@ -72,7 +72,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
if(rc) log_write("Error %d requesting volume information.\n", rc); if(rc) log_write("Error %d requesting volume information.\n", rc);
else else
{ {
// 16 bit // 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86)) #if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
fsdName = &bData[4 + (USHORT)bData[2] + 1 + 2]; fsdName = &bData[4 + (USHORT)bData[2] + 1 + 2];
#else // 32 bit #else // 32 bit
@@ -83,7 +83,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
pfsAllocateBuffer = (PFSALLOCATE)malloc(sizeof(FSALLOCATE)); pfsAllocateBuffer = (PFSALLOCATE)malloc(sizeof(FSALLOCATE));
// 16 bit // 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86)) #if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
rc = DosQFSInfo(driveNo, 1, (PBYTE)pfsAllocateBuffer, sizeof(FSALLOCATE)); rc = DosQFSInfo(driveNo, 1, (PBYTE)pfsAllocateBuffer, sizeof(FSALLOCATE));
#else // 32 bit #else // 32 bit
@@ -111,7 +111,7 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
pfsInfo = (PFSINFO)malloc(sizeof(FSINFO)); pfsInfo = (PFSINFO)malloc(sizeof(FSINFO));
// 16 bit // 16 bit
#if(defined(__I86__) || defined(__i86__) || defined(_M_I86)) #if(defined(__I86__) || defined(__i86__) || defined(_M_I86))
rc = DosQFSInfo(driveNo, 2, (PBYTE)pfsInfo, sizeof(FSINFO)); rc = DosQFSInfo(driveNo, 2, (PBYTE)pfsInfo, sizeof(FSINFO));
#else // 32 bit #else // 32 bit
@@ -122,11 +122,9 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
else else
{ {
usVolSerialHigh = *((PUSHORT)&pfsInfo->ftimeCreation); usVolSerialHigh = *((PUSHORT)&pfsInfo->ftimeCreation);
usVolSerialLow = *((PUSHORT)&pfsInfo->fdateCreation); usVolSerialLow = *((PUSHORT)&pfsInfo->fdateCreation);
log_write("\tVolume label: %s\n", pfsInfo->vol.szVolLabel); log_write("\tVolume label: %s\n", pfsInfo->vol.szVolLabel);
log_write("\tVolume created on %04X:%04X\n", log_write("\tVolume created on %04X:%04X\n", usVolSerialHigh, usVolSerialLow);
usVolSerialHigh,
usVolSerialLow);
} }
free(pfsInfo); free(pfsInfo);