mirror of
https://github.com/fadden/ciderpress.git
synced 2024-11-27 08:49:20 +00:00
Merge pull request #47 from markdavidlong/dosnames
Raw Filename Accessor in A2File, et al.
This commit is contained in:
commit
27cefa61d3
4
.gitignore
vendored
4
.gitignore
vendored
@ -26,3 +26,7 @@ tags
|
|||||||
# VIM
|
# VIM
|
||||||
*~
|
*~
|
||||||
*.swp
|
*.swp
|
||||||
|
|
||||||
|
# Doxygen
|
||||||
|
|
||||||
|
diskimg/doc/
|
||||||
|
@ -835,6 +835,9 @@ DIError DiskFSDOS33::ProcessCatalogSector(int catTrack, int catSect,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(pFile->fRawFileName, &pEntry[0x03], A2FileDOS::kMaxFileName);
|
||||||
|
pFile->fRawFileName[A2FileDOS::kMaxFileName] = '\0';
|
||||||
|
|
||||||
memcpy(pFile->fFileName, &pEntry[0x03], A2FileDOS::kMaxFileName);
|
memcpy(pFile->fFileName, &pEntry[0x03], A2FileDOS::kMaxFileName);
|
||||||
pFile->fFileName[A2FileDOS::kMaxFileName] = '\0';
|
pFile->fFileName[A2FileDOS::kMaxFileName] = '\0';
|
||||||
pFile->FixFilename();
|
pFile->FixFilename();
|
||||||
@ -860,7 +863,6 @@ DIError DiskFSDOS33::ProcessCatalogSector(int catTrack, int catSect,
|
|||||||
return kDIErrNone;
|
return kDIErrNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform consistency checks on the filesystem.
|
* Perform consistency checks on the filesystem.
|
||||||
*
|
*
|
||||||
@ -2869,6 +2871,19 @@ bail:
|
|||||||
return dierr;
|
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) const {
|
||||||
|
if (size) {
|
||||||
|
*size = strlen(fRawFileName);
|
||||||
|
}
|
||||||
|
return fRawFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ===========================================================================
|
* ===========================================================================
|
||||||
|
@ -292,6 +292,12 @@ void DiskImg::SetCustomNibbleDescr(const NibbleDescr* pDescr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* A2File::GetRawFileName(size_t* size) const { // get unmodified file name
|
||||||
|
if (size) {
|
||||||
|
*size = strlen(GetFileName());
|
||||||
|
}
|
||||||
|
return GetFileName();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open a volume or a file on disk.
|
* Open a volume or a file on disk.
|
||||||
|
@ -1474,6 +1474,11 @@ public:
|
|||||||
* means that embedded nulls in HFS filenames (which are discouraged but
|
* means that embedded nulls in HFS filenames (which are discouraged but
|
||||||
* allowed) will be lost.
|
* allowed) will be lost.
|
||||||
*
|
*
|
||||||
|
* The original unmodified filename is availale through GetRawFileName,
|
||||||
|
* 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
|
* We do guarantee that the contents of subdirectories are grouped
|
||||||
* together. This makes it much easier to construct a hierarchy out of
|
* together. This makes it much easier to construct a hierarchy out of
|
||||||
* the linear list. This becomes important when dynamically adding
|
* the linear list. This becomes important when dynamically adding
|
||||||
@ -1481,6 +1486,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual const char* GetFileName(void) const = 0; // name of this file
|
virtual const char* GetFileName(void) const = 0; // name of this file
|
||||||
virtual const char* GetPathName(void) const = 0; // full path
|
virtual const char* GetPathName(void) const = 0; // full path
|
||||||
|
virtual const char* GetRawFileName(size_t* size = NULL) const; // get unmodified file name
|
||||||
virtual char GetFssep(void) const = 0; // '\0' if none
|
virtual char GetFssep(void) const = 0; // '\0' if none
|
||||||
virtual uint32_t GetFileType(void) const = 0;
|
virtual uint32_t GetFileType(void) const = 0;
|
||||||
virtual uint32_t GetAuxType(void) const = 0;
|
virtual uint32_t GetAuxType(void) const = 0;
|
||||||
|
@ -1444,6 +1444,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual const char* GetFileName(void) const override { return fFileName; }
|
virtual const char* GetFileName(void) const override { return fFileName; }
|
||||||
virtual const char* GetPathName(void) const override { return fFileName; }
|
virtual const char* GetPathName(void) const override { return fFileName; }
|
||||||
|
virtual const char* GetRawFileName(size_t* size = NULL) const override;
|
||||||
virtual char GetFssep(void) const override { return '\0'; }
|
virtual char GetFssep(void) const override { return '\0'; }
|
||||||
virtual uint32_t GetFileType(void) const override;
|
virtual uint32_t GetFileType(void) const override;
|
||||||
virtual uint32_t GetAuxType(void) const override { return fAuxType; }
|
virtual uint32_t GetAuxType(void) const override { return fAuxType; }
|
||||||
@ -1482,6 +1483,7 @@ private:
|
|||||||
short fTSListSector;
|
short fTSListSector;
|
||||||
uint16_t fLengthInSectors;
|
uint16_t fLengthInSectors;
|
||||||
bool fLocked;
|
bool fLocked;
|
||||||
|
char fRawFileName[kMaxFileName + 1]; // "raw" version
|
||||||
char fFileName[kMaxFileName+1]; // "fixed" version
|
char fFileName[kMaxFileName+1]; // "fixed" version
|
||||||
FileType fFileType;
|
FileType fFileType;
|
||||||
|
|
||||||
@ -2493,6 +2495,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual const char* GetFileName(void) const override { return fFileName; }
|
virtual const char* GetFileName(void) const override { return fFileName; }
|
||||||
virtual const char* GetPathName(void) const override { return fFileName; }
|
virtual const char* GetPathName(void) const override { return fFileName; }
|
||||||
|
virtual const char* GetRawFileName(size_t* size = NULL) const override;
|
||||||
virtual char GetFssep(void) const override { return '\0'; }
|
virtual char GetFssep(void) const override { return '\0'; }
|
||||||
virtual uint32_t GetFileType(void) const override;
|
virtual uint32_t GetFileType(void) const override;
|
||||||
virtual uint32_t GetAuxType(void) const override { return fLoadAddr; }
|
virtual uint32_t GetAuxType(void) const override { return fLoadAddr; }
|
||||||
@ -2518,6 +2521,7 @@ public:
|
|||||||
|
|
||||||
/* fields pulled out of directory block */
|
/* fields pulled out of directory block */
|
||||||
char fFileName[kMaxFileName+1];
|
char fFileName[kMaxFileName+1];
|
||||||
|
char fRawFileName[kMaxFileName + 1];
|
||||||
FileType fFileType;
|
FileType fFileType;
|
||||||
uint16_t fNumSectors;
|
uint16_t fNumSectors;
|
||||||
uint16_t fLoadAddr;
|
uint16_t fLoadAddr;
|
||||||
|
@ -1145,7 +1145,7 @@ DIError WrapperDiskCopy42::WriteHeader(GenericFD* pGFD, const DC42Header* pHeade
|
|||||||
* magic string. To be safe, we only increment it if it starts with '-'.
|
* magic string. To be safe, we only increment it if it starts with '-'.
|
||||||
* (Need access to a Macintosh to test this.)
|
* (Need access to a Macintosh to test this.)
|
||||||
*/
|
*/
|
||||||
hdrBuf[0] = strlen(pHeader->diskName);
|
hdrBuf[0] = (uint8_t) (strlen(pHeader->diskName) & 0xff);
|
||||||
if (pHeader->diskName[0] == '-' && hdrBuf[0] < (kDC42NameLen-1))
|
if (pHeader->diskName[0] == '-' && hdrBuf[0] < (kDC42NameLen-1))
|
||||||
hdrBuf[0]++;
|
hdrBuf[0]++;
|
||||||
memcpy(&hdrBuf[1], pHeader->diskName, hdrBuf[0]);
|
memcpy(&hdrBuf[1], pHeader->diskName, hdrBuf[0]);
|
||||||
|
@ -344,6 +344,9 @@ DIError DiskFSRDOS::ReadCatalog(void)
|
|||||||
|
|
||||||
pFile = new A2FileRDOS(this);
|
pFile = new A2FileRDOS(this);
|
||||||
|
|
||||||
|
memcpy(pFile->fRawFileName, dirPtr, A2FileRDOS::kMaxFileName);
|
||||||
|
pFile->fRawFileName[A2FileRDOS::kMaxFileName] = '\0';
|
||||||
|
|
||||||
memcpy(pFile->fFileName, dirPtr, A2FileRDOS::kMaxFileName);
|
memcpy(pFile->fFileName, dirPtr, A2FileRDOS::kMaxFileName);
|
||||||
pFile->fFileName[A2FileRDOS::kMaxFileName] = '\0';
|
pFile->fFileName[A2FileRDOS::kMaxFileName] = '\0';
|
||||||
pFile->FixFilename();
|
pFile->FixFilename();
|
||||||
@ -521,6 +524,19 @@ DIError A2FileRDOS::Open(A2FileDescr** ppOpenFile, bool readOnly,
|
|||||||
return kDIErrNone;
|
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) const {
|
||||||
|
if (size) {
|
||||||
|
*size = strlen(fRawFileName);
|
||||||
|
}
|
||||||
|
return fRawFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ===========================================================================
|
* ===========================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user