Use more integers with explicit widths

Updated some structs and a few DiskImg APIs, primarily file type,
aux type, and access flags.
This commit is contained in:
Andy McFadden 2015-01-04 18:20:59 -08:00
parent 84706d7ea4
commit d94b707489
10 changed files with 90 additions and 90 deletions

View File

@ -186,10 +186,10 @@ private:
* The header at the front of an ACU archive.
*/
typedef struct AcuMasterHeader {
unsigned short fileCount;
unsigned short unknown1; // 0x01 00 -- might be "version 1?"
unsigned char fZink[6]; // "fZink", low ASCII
unsigned char unknown2[11]; // 0x01 36 00 00 00 00 00 00 00 00 dd
uint16_t fileCount;
uint16_t unknown1; // 0x01 00 -- might be "version 1?"
uint8_t fZink[6]; // "fZink", low ASCII
uint8_t unknown2[11]; // 0x01 36 00 00 00 00 00 00 00 00 dd
} AcuMasterHeader;
/*
@ -203,24 +203,24 @@ private:
struct AcuFileEntry;
friend struct AcuFileEntry;
typedef struct AcuFileEntry {
unsigned char compressionType;
unsigned short dataChecksum; // ??
unsigned short blockCount; // total blocks req'd to hold file
unsigned long dataStorageLen; // length of data within archive
unsigned short access;
unsigned short fileType;
unsigned long auxType;
unsigned char storageType;
unsigned long dataEof;
unsigned short prodosModDate;
unsigned short prodosModTime;
uint8_t compressionType;
uint16_t dataChecksum; // ??
uint16_t blockCount; // total blocks req'd to hold file
uint32_t dataStorageLen; // length of data within archive
uint16_t access;
uint16_t fileType;
uint32_t auxType;
uint8_t storageType;
uint32_t dataEof;
uint16_t prodosModDate;
uint16_t prodosModTime;
NuDateTime modWhen; // computed from previous two fields
unsigned short prodosCreateDate;
unsigned short prodosCreateTime;
uint16_t prodosCreateDate;
uint16_t prodosCreateTime;
NuDateTime createWhen; // computed from previous two fields
unsigned short fileNameLen;
unsigned short headerChecksum; // ??
char fileName[kAcuMaxFileName+1];
uint16_t fileNameLen;
uint16_t headerChecksum; // ??
char fileName[kAcuMaxFileName+1]; // ASCII
// possibilities for mystery fields:
// - OS type (note ProDOS is $00)

View File

@ -202,12 +202,12 @@ public:
char GetFssep(void) const { return fFssep; }
void SetFssep(char fssep) { fFssep = fssep; }
long GetFileType(void) const { return fFileType; }
void SetFileType(long type) { fFileType = type; }
long GetAuxType(void) const { return fAuxType; }
void SetAuxType(long type) { fAuxType = type; }
long GetAccess(void) const { return fAccess; }
void SetAccess(long access) { fAccess = access; }
uint32_t GetFileType(void) const { return fFileType; }
void SetFileType(uint32_t type) { fFileType = type; }
uint32_t GetAuxType(void) const { return fAuxType; }
void SetAuxType(uint32_t type) { fAuxType = type; }
uint32_t GetAccess(void) const { return fAccess; }
void SetAccess(uint32_t access) { fAccess = access; }
time_t GetCreateWhen(void) const { return fCreateWhen; }
void SetCreateWhen(time_t when) { fCreateWhen = when; }
time_t GetModWhen(void) const { return fModWhen; }
@ -302,9 +302,9 @@ private:
char fFssep;
WCHAR* fSubVolName; // sub-volume prefix, or NULL if none
WCHAR* fDisplayName; // combination of sub-vol and path
long fFileType;
long fAuxType;
long fAccess;
uint32_t fFileType;
uint32_t fAuxType;
uint32_t fAccess;
time_t fCreateWhen;
time_t fModWhen;
RecordKind fRecordKind; // forked file, disk image, ??

View File

@ -2164,8 +2164,8 @@ bail:
*
* Changing the aux type is only allowed for BIN files.
*/
DIError DiskFSDOS33::SetFileInfo(A2File* pGenericFile, long fileType, long auxType,
long accessFlags)
DIError DiskFSDOS33::SetFileInfo(A2File* pGenericFile, uint32_t fileType,
uint32_t auxType, uint32_t accessFlags)
{
DIError dierr = kDIErrNone;
A2FileDOS* pFile = (A2FileDOS*) pGenericFile;
@ -2410,7 +2410,7 @@ A2FileDOS::~A2FileDOS(void)
* because I can't find any information on the REL format. However, Copy ][+
* does convert to REL, and the Binary ][ standard says I should as well.
*/
long A2FileDOS::GetFileType(void) const
uint32_t A2FileDOS::GetFileType(void) const
{
long retval;
@ -2501,7 +2501,7 @@ long A2FileDOS::GetFileType(void) const
/*
* Match the ProDOS equivalents of "locked" and "unlocked".
*/
long A2FileDOS::GetAccess(void) const
uint32_t A2FileDOS::GetAccess(void) const
{
if (fLocked)
return DiskFS::kFileAccessLocked; // 0x01 read

View File

@ -1208,8 +1208,8 @@ public:
/*
* Alter file attributes.
*/
virtual DIError SetFileInfo(A2File* pFile, long fileType, long auxType,
long accessFlags)
virtual DIError SetFileInfo(A2File* pFile, uint32_t fileType,
uint32_t auxType, uint32_t accessFlags)
{ return kDIErrNotSupported; }
/*
@ -1472,9 +1472,9 @@ public:
virtual const char* GetFileName(void) const = 0; // name of this file
virtual const char* GetPathName(void) const = 0; // full path
virtual char GetFssep(void) const = 0; // '\0' if none
virtual long GetFileType(void) const = 0;
virtual long GetAuxType(void) const = 0;
virtual long GetAccess(void) const = 0; // ProDOS-style perms
virtual uint32_t GetFileType(void) const = 0;
virtual uint32_t GetAuxType(void) const = 0;
virtual uint32_t GetAccess(void) const = 0; // ProDOS-style perms
virtual time_t GetCreateWhen(void) const = 0;
virtual time_t GetModWhen(void) const = 0;
virtual di_off_t GetDataLength(void) const = 0; // len of data fork

View File

@ -1244,8 +1244,8 @@ public:
virtual DIError CreateFile(const CreateParms* pParms, A2File** ppNewFile) override;
virtual DIError DeleteFile(A2File* pFile) override;
virtual DIError RenameFile(A2File* pFile, const char* newName) override;
virtual DIError SetFileInfo(A2File* pFile, long fileType, long auxType,
long accessFlags) override;
virtual DIError SetFileInfo(A2File* pFile, uint32_t fileType,
uint32_t auxType, uint32_t accessFlags) override;
virtual DIError RenameVolume(const char* newName) override;
/*
@ -1449,9 +1449,9 @@ public:
virtual const char* GetFileName(void) const override { return fFileName; }
virtual const char* GetPathName(void) const override { return fFileName; }
virtual char GetFssep(void) const override { return '\0'; }
virtual long GetFileType(void) const override;
virtual long GetAuxType(void) const override { return fAuxType; }
virtual long GetAccess(void) const override;
virtual uint32_t GetFileType(void) const override;
virtual uint32_t GetAuxType(void) const override { return fAuxType; }
virtual uint32_t GetAccess(void) const override;
virtual time_t GetCreateWhen(void) const override { return 0; }
virtual time_t GetModWhen(void) const override { return 0; }
virtual di_off_t GetDataLength(void) const override { return fLength; }
@ -1560,8 +1560,8 @@ public:
A2File** ppNewFile) override;
virtual DIError DeleteFile(A2File* pFile) override;
virtual DIError RenameFile(A2File* pFile, const char* newName) override;
virtual DIError SetFileInfo(A2File* pFile, long fileType, long auxType,
long accessFlags) override;
virtual DIError SetFileInfo(A2File* pFile, uint32_t fileType,
uint32_t auxType, uint32_t accessFlags) override;
virtual DIError RenameVolume(const char* newName) override;
// assorted constants
@ -1819,9 +1819,9 @@ public:
virtual const char* GetFileName(void) const override { return fDirEntry.fileName; }
virtual const char* GetPathName(void) const override { return fPathName; }
virtual char GetFssep(void) const override { return kFssep; }
virtual long GetFileType(void) const override { return fDirEntry.fileType; }
virtual long GetAuxType(void) const override { return fDirEntry.auxType; }
virtual long GetAccess(void) const override { return fDirEntry.access; }
virtual uint32_t GetFileType(void) const override { return fDirEntry.fileType; }
virtual uint32_t GetAuxType(void) const override { return fDirEntry.auxType; }
virtual uint32_t GetAccess(void) const override { return fDirEntry.access; }
virtual time_t GetCreateWhen(void) const override;
virtual time_t GetModWhen(void) const override;
virtual di_off_t GetDataLength(void) const override {
@ -1986,8 +1986,8 @@ public:
virtual DIError CreateFile(const CreateParms* pParms, A2File** ppNewFile) override;
virtual DIError DeleteFile(A2File* pFile) override;
virtual DIError RenameFile(A2File* pFile, const char* newName) override;
virtual DIError SetFileInfo(A2File* pFile, long fileType, long auxType,
long accessFlags) override;
virtual DIError SetFileInfo(A2File* pFile, uint32_t fileType,
uint32_t auxType, uint32_t accessFlags) override;
virtual DIError RenameVolume(const char* newName) override;
static bool IsValidVolumeName(const char* name);
@ -2119,9 +2119,9 @@ public:
virtual const char* GetFileName(void) const override { return fFileName; }
virtual const char* GetPathName(void) const override { return fFileName; }
virtual char GetFssep(void) const override { return '\0'; }
virtual long GetFileType(void) const override;
virtual long GetAuxType(void) const override { return 0; }
virtual long GetAccess(void) const override { return DiskFS::kFileAccessUnlocked; }
virtual uint32_t GetFileType(void) const override;
virtual uint32_t GetAuxType(void) const override { return 0; }
virtual uint32_t GetAccess(void) const override { return DiskFS::kFileAccessUnlocked; }
virtual time_t GetCreateWhen(void) const override { return 0; }
virtual time_t GetModWhen(void) const override;
virtual di_off_t GetDataLength(void) const override { return fLength; }
@ -2329,9 +2329,9 @@ public:
virtual const char* GetFileName(void) const override { return fFileName; }
virtual const char* GetPathName(void) const override { return fFileName; }
virtual char GetFssep(void) const override { return '\0'; }
virtual long GetFileType(void) const override { return 0; }
virtual long GetAuxType(void) const override { return 0; }
virtual long GetAccess(void) const override {
virtual uint32_t GetFileType(void) const override { return 0; }
virtual uint32_t GetAuxType(void) const override { return 0; }
virtual uint32_t GetAccess(void) const override {
if (fReadOnly)
return DiskFS::kFileAccessLocked;
else
@ -2494,9 +2494,9 @@ public:
virtual const char* GetFileName(void) const override { return fFileName; }
virtual const char* GetPathName(void) const override { return fFileName; }
virtual char GetFssep(void) const override { return '\0'; }
virtual long GetFileType(void) const override;
virtual long GetAuxType(void) const override { return fLoadAddr; }
virtual long GetAccess(void) const override { return DiskFS::kFileAccessUnlocked; }
virtual uint32_t GetFileType(void) const override;
virtual uint32_t GetAuxType(void) const override { return fLoadAddr; }
virtual uint32_t GetAccess(void) const override { return DiskFS::kFileAccessUnlocked; }
virtual time_t GetCreateWhen(void) const override { return 0; }
virtual time_t GetModWhen(void) const override { return 0; };
virtual di_off_t GetDataLength(void) const override { return fLength; }
@ -2573,8 +2573,8 @@ public:
virtual DIError CreateFile(const CreateParms* pParms, A2File** ppNewFile) override;
virtual DIError DeleteFile(A2File* pFile) override;
virtual DIError RenameFile(A2File* pFile, const char* newName) override;
virtual DIError SetFileInfo(A2File* pFile, long fileType, long auxType,
long accessFlags) override;
virtual DIError SetFileInfo(A2File* pFile, uint32_t fileType,
uint32_t auxType, uint32_t accessFlags) override;
virtual DIError RenameVolume(const char* newName);
#endif
@ -2743,9 +2743,9 @@ public:
virtual const char* GetFileName(void) const override { return fFileName; }
virtual const char* GetPathName(void) const override { return fPathName; }
virtual char GetFssep(void) const override { return kFssep; }
virtual long GetFileType(void) const override;
virtual long GetAuxType(void) const override;
virtual long GetAccess(void) const override { return fAccess; }
virtual uint32_t GetFileType(void) const override;
virtual uint32_t GetAuxType(void) const override;
virtual uint32_t GetAccess(void) const override { return fAccess; }
virtual time_t GetCreateWhen(void) const override { return fCreateWhen; }
virtual time_t GetModWhen(void) const override { return fModWhen; }
virtual di_off_t GetDataLength(void) const override { return fDataLength; }
@ -2789,21 +2789,21 @@ public:
virtual void SetParent(A2File* pParent) override { fpParent = pParent; }
virtual A2File* GetParent(void) const override { return fpParent; }
char* GetLibHFSPathName(void) const;
static void ConvertTypeToHFS(long fileType, long auxType,
static void ConvertTypeToHFS(uint32_t fileType, uint32_t auxType,
char* pType, char* pCreator);
#endif
bool fIsDir;
bool fIsVolumeDir;
long fType;
long fCreator;
uint32_t fType;
uint32_t fCreator;
char fFileName[kMaxFileName+1];
char* fPathName;
di_off_t fDataLength;
di_off_t fRsrcLength;
time_t fCreateWhen;
time_t fModWhen;
long fAccess;
uint32_t fAccess;
private:
#ifdef EXCISE_GPL_CODE
@ -3009,9 +3009,9 @@ public:
virtual const char* GetFileName(void) const override { return fFileName; }
virtual const char* GetPathName(void) const override { return fFileName; }
virtual char GetFssep(void) const override { return '\0'; }
virtual long GetFileType(void) const override;
virtual long GetAuxType(void) const override { return fAuxType; }
virtual long GetAccess(void) const override { return DiskFS::kFileAccessUnlocked; }
virtual uint32_t GetFileType(void) const override;
virtual uint32_t GetAuxType(void) const override { return fAuxType; }
virtual uint32_t GetAccess(void) const override { return DiskFS::kFileAccessUnlocked; }
virtual time_t GetCreateWhen(void) const override { return 0; }
virtual time_t GetModWhen(void) const override { return 0; }
virtual di_off_t GetDataLength(void) const override { return fLength; }
@ -3185,9 +3185,9 @@ public:
virtual const char* GetFileName(void) const override { return fFileName; }
virtual const char* GetPathName(void) const override { return fFileName; }
virtual char GetFssep(void) const override { return '\0'; }
virtual long GetFileType(void) const override { return 0; };
virtual long GetAuxType(void) const override { return 0; }
virtual long GetAccess(void) const override { return DiskFS::kFileAccessUnlocked; }
virtual uint32_t GetFileType(void) const override { return 0; };
virtual uint32_t GetAuxType(void) const override { return 0; }
virtual uint32_t GetAccess(void) const override { return DiskFS::kFileAccessUnlocked; }
virtual time_t GetCreateWhen(void) const override { return 0; }
virtual time_t GetModWhen(void) const override { return 0; }
virtual di_off_t GetDataLength(void) const override { return fLength; }

View File

@ -427,7 +427,7 @@ A2FileGutenberg::~A2FileGutenberg(void)
* Convert the filetype enum to a ProDOS type.
*
*/
long A2FileGutenberg::GetFileType(void) const
uint32_t A2FileGutenberg::GetFileType(void) const
{
return 0x04; // TXT;
}

View File

@ -1551,8 +1551,8 @@ bail:
/*
* Set file attributes.
*/
DIError DiskFSHFS::SetFileInfo(A2File* pGenericFile, long fileType, long auxType,
long accessFlags)
DIError DiskFSHFS::SetFileInfo(A2File* pGenericFile, uint32_t fileType,
uint32_t auxType, uint32_t accessFlags)
{
DIError dierr = kDIErrNone;
A2FileHFS* pFile = (A2FileHFS*) pGenericFile;
@ -1653,7 +1653,7 @@ inline int FromHex(char hexVal)
* equivalent, and CiderPress really doesn't need the "raw" file type. If
* it becomes annoying, we can add a DiskFSParameter to control it.
*/
long A2FileHFS::GetFileType(void) const
uint32_t A2FileHFS::GetFileType(void) const
{
if (fCreator != kPdosType)
return fType;
@ -1693,7 +1693,7 @@ long A2FileHFS::GetFileType(void) const
/*
* If this has a ProDOS aux type, convert it.
*/
long A2FileHFS::GetAuxType(void) const
uint32_t A2FileHFS::GetAuxType(void) const
{
if (fCreator != kPdosType)
return fCreator;
@ -1762,7 +1762,7 @@ char* A2FileHFS::GetLibHFSPathName(void) const
* conversions discard the file's aux type and therefore are unsuitable,
* and the conversion of SRC throws away its identity.
*/
/*static*/ void A2FileHFS::ConvertTypeToHFS(long fileType, long auxType,
/*static*/ void A2FileHFS::ConvertTypeToHFS(uint32_t fileType, uint32_t auxType,
char* pType, char* pCreator)
{
if (fileType == 0x00 && auxType == 0x0000) {

View File

@ -1275,8 +1275,8 @@ bail:
* but we don't allow the full range of ProDOS types. Attempting to change
* to an unsupported type results in "PDA" being used.
*/
DIError DiskFSPascal::SetFileInfo(A2File* pGenericFile, long fileType, long auxType,
long accessFlags)
DIError DiskFSPascal::SetFileInfo(A2File* pGenericFile, uint32_t fileType,
uint32_t auxType, uint32_t accessFlags)
{
DIError dierr = kDIErrNone;
A2FilePascal* pFile = (A2FilePascal*) pGenericFile;
@ -1393,7 +1393,7 @@ uint8_t* DiskFSPascal::FindDirEntry(A2FilePascal* pFile)
/*
* Convert Pascal file type to ProDOS file type.
*/
long A2FilePascal::GetFileType(void) const
uint32_t A2FilePascal::GetFileType(void) const
{
switch (fFileType) {
case kTypeUntyped: return 0x00; // NON

View File

@ -3607,8 +3607,8 @@ DIError DiskFSProDOS::RegeneratePathName(A2FileProDOS* pFile)
* This does, of course, mean that there's no meaning in attempts to change
* the file access permissions of the volume directory.
*/
DIError DiskFSProDOS::SetFileInfo(A2File* pGenericFile, long fileType,
long auxType, long accessFlags)
DIError DiskFSProDOS::SetFileInfo(A2File* pGenericFile, uint32_t fileType,
uint32_t auxType, uint32_t accessFlags)
{
DIError dierr = kDIErrNone;
A2FileProDOS* pFile = (A2FileProDOS*) pGenericFile;

View File

@ -438,9 +438,9 @@ void DiskFSRDOS::SetSectorUsage(long track, long sector,
/*
* Convert RDOS file type to ProDOS file type.
*/
long A2FileRDOS::GetFileType(void) const
uint32_t A2FileRDOS::GetFileType(void) const
{
long retval;
uint32_t retval;
switch (fFileType) {
case kTypeText: retval = 0x04; break; // TXT