mirror of
https://github.com/fadden/ciderpress.git
synced 2024-11-26 17:49:21 +00:00
Added file length size option to getRawFileName
This commit is contained in:
parent
fd4ac77bcf
commit
db3ca0a8ca
@ -835,8 +835,8 @@ DIError DiskFSDOS33::ProcessCatalogSector(int catTrack, int catSect,
|
||||
break;
|
||||
}
|
||||
|
||||
memcpy(pFile->fRawName, &pEntry[0x03], A2FileDOS::kMaxFileName);
|
||||
pFile->fRawName[A2FileDOS::kMaxFileName] = '\0';
|
||||
memcpy(pFile->fRawFileName, &pEntry[0x03], A2FileDOS::kMaxFileName);
|
||||
pFile->fRawFileName[A2FileDOS::kMaxFileName] = '\0';
|
||||
|
||||
memcpy(pFile->fFileName, &pEntry[0x03], A2FileDOS::kMaxFileName);
|
||||
pFile->fFileName[A2FileDOS::kMaxFileName] = '\0';
|
||||
@ -863,7 +863,6 @@ DIError DiskFSDOS33::ProcessCatalogSector(int catTrack, int catSect,
|
||||
return kDIErrNone;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Perform consistency checks on the filesystem.
|
||||
*
|
||||
@ -2872,6 +2871,19 @@ bail:
|
||||
return dierr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the raw filename.
|
||||
*
|
||||
* If a pointer to a size_t is passed in, it will be filled with the
|
||||
* raw filename length.
|
||||
*/
|
||||
const char* A2FileDOS::GetRawFileName(size_t* size = NULL) const {
|
||||
if (size) {
|
||||
*size = strlen(fRawFileName);
|
||||
}
|
||||
return fRawFileName;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ===========================================================================
|
||||
|
@ -292,6 +292,12 @@ void DiskImg::SetCustomNibbleDescr(const NibbleDescr* pDescr)
|
||||
}
|
||||
}
|
||||
|
||||
const char* DiskImg::GetRawFileName(size_t* size) const { // get unmodified file name
|
||||
if (size) {
|
||||
*size = strlen(GetFileName());
|
||||
}
|
||||
return GetFileName();
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a volume or a file on disk.
|
||||
|
@ -1475,7 +1475,9 @@ public:
|
||||
* allowed) will be lost.
|
||||
*
|
||||
* The original unmodified filename is availale through GetRawFileName,
|
||||
* though HFS still suffers from embedded nulls.
|
||||
* which can be optionally passed a size_t pointer to get the size
|
||||
* of the raw file name, which is helpful for getting a HFS filename with
|
||||
* embedded nulls.
|
||||
*
|
||||
* We do guarantee that the contents of subdirectories are grouped
|
||||
* together. This makes it much easier to construct a hierarchy out of
|
||||
@ -1484,9 +1486,7 @@ public:
|
||||
*/
|
||||
virtual const char* GetFileName(void) const = 0; // name of this file
|
||||
virtual const char* GetPathName(void) const = 0; // full path
|
||||
virtual const char* GetRawFileName(void) const { // get unmodified file name
|
||||
return GetFileName();
|
||||
}
|
||||
virtual const char* GetRawFileName(size_t* size = NULL) const; // get unmodified file name
|
||||
virtual char GetFssep(void) const = 0; // '\0' if none
|
||||
virtual uint32_t GetFileType(void) const = 0;
|
||||
virtual uint32_t GetAuxType(void) const = 0;
|
||||
|
@ -1444,7 +1444,7 @@ public:
|
||||
*/
|
||||
virtual const char* GetFileName(void) const override { return fFileName; }
|
||||
virtual const char* GetPathName(void) const override { return fFileName; }
|
||||
virtual const char* GetRawFileName(void) const override { return fRawFileName; }
|
||||
virtual const char* GetRawFileName(size_t* size = NULL) const override;
|
||||
virtual char GetFssep(void) const override { return '\0'; }
|
||||
virtual uint32_t GetFileType(void) const override;
|
||||
virtual uint32_t GetAuxType(void) const override { return fAuxType; }
|
||||
@ -2495,7 +2495,7 @@ public:
|
||||
*/
|
||||
virtual const char* GetFileName(void) const override { return fFileName; }
|
||||
virtual const char* GetPathName(void) const override { return fFileName; }
|
||||
virtual const char* GetRawFileName(void) const override { return fRawName; }
|
||||
virtual const char* GetRawFileName(size_t* size = NULL) const override;
|
||||
virtual char GetFssep(void) const override { return '\0'; }
|
||||
virtual uint32_t GetFileType(void) const override;
|
||||
virtual uint32_t GetAuxType(void) const override { return fLoadAddr; }
|
||||
@ -2521,7 +2521,7 @@ public:
|
||||
|
||||
/* fields pulled out of directory block */
|
||||
char fFileName[kMaxFileName+1];
|
||||
char fRawName[kMaxFileName + 1];
|
||||
char fRawFileName[kMaxFileName + 1];
|
||||
FileType fFileType;
|
||||
uint16_t fNumSectors;
|
||||
uint16_t fLoadAddr;
|
||||
|
@ -344,8 +344,8 @@ DIError DiskFSRDOS::ReadCatalog(void)
|
||||
|
||||
pFile = new A2FileRDOS(this);
|
||||
|
||||
memcpy(pFile->fRawName, dirPtr, A2FileRDOS::kMaxFileName);
|
||||
pFile->fRawName[A2FileRDOS::kMaxFileName] = '\0';
|
||||
memcpy(pFile->fRawFileName, dirPtr, A2FileRDOS::kMaxFileName);
|
||||
pFile->fRawFileName[A2FileRDOS::kMaxFileName] = '\0';
|
||||
|
||||
memcpy(pFile->fFileName, dirPtr, A2FileRDOS::kMaxFileName);
|
||||
pFile->fFileName[A2FileRDOS::kMaxFileName] = '\0';
|
||||
@ -524,6 +524,19 @@ DIError A2FileRDOS::Open(A2FileDescr** ppOpenFile, bool readOnly,
|
||||
return kDIErrNone;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the raw filename.
|
||||
*
|
||||
* If a pointer to a size_t is passed in, it will be filled with the
|
||||
* raw filename length.
|
||||
*/
|
||||
const char* A2FileRDOS::GetRawFileName(size_t* size = NULL) const {
|
||||
if (size) {
|
||||
*size = strlen(fRawFileName);
|
||||
}
|
||||
return fRawFileName;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ===========================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user