mirror of
https://github.com/fadden/ciderpress.git
synced 2024-10-31 16:04:54 +00:00
Allow files larger than 16MB to be added to HFS volumes
Ideally this would add a "what's your limit" call to the disk image library, but this will do for now.
This commit is contained in:
parent
8ecb8e35eb
commit
8d5e07e683
@ -1581,14 +1581,15 @@ CString DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL)
|
||||
else
|
||||
convHA = GenericEntry::kConvertHAOff;
|
||||
|
||||
errMsg = LoadFile(pDataDetails->GetLocalPathName(), &dataBuf, &dataLen,
|
||||
convEOL, convHA);
|
||||
errMsg = LoadFile(pDataDetails->GetLocalPathName(), pDiskFS,
|
||||
&dataBuf, &dataLen, convEOL, convHA);
|
||||
if (!errMsg.IsEmpty())
|
||||
goto bail;
|
||||
}
|
||||
if (pRsrcDetails != NULL) {
|
||||
/* no text conversion on resource forks */
|
||||
errMsg = LoadFile(pRsrcDetails->GetLocalPathName(), &rsrcBuf, &rsrcLen,
|
||||
errMsg = LoadFile(pRsrcDetails->GetLocalPathName(), pDiskFS,
|
||||
&rsrcBuf, &rsrcLen,
|
||||
GenericEntry::kConvertEOLOff, GenericEntry::kConvertHAOff);
|
||||
if (!errMsg.IsEmpty())
|
||||
goto bail;
|
||||
@ -1624,7 +1625,10 @@ bail:
|
||||
|
||||
// TODO: really ought to update the progress counter, especially when reading
|
||||
// really large files.
|
||||
CString DiskArchive::LoadFile(const WCHAR* pathName, uint8_t** pBuf, long* pLen,
|
||||
// TODO: shouldn't be loading really large files into memory. ProDOS is fine
|
||||
// (16MB limit), HFS could be problematic in a 32-bit app.
|
||||
CString DiskArchive::LoadFile(const WCHAR* pathName, DiskFS* pDiskFS,
|
||||
uint8_t** pBuf, long* pLen,
|
||||
GenericEntry::ConvertEOL conv, GenericEntry::ConvertHighASCII convHA) const
|
||||
{
|
||||
const char kCharLF = '\n';
|
||||
@ -1666,8 +1670,15 @@ CString DiskArchive::LoadFile(const WCHAR* pathName, uint8_t** pBuf, long* pLen,
|
||||
*pBuf = NULL;
|
||||
*pLen = 0;
|
||||
goto bail;
|
||||
} else if (fileLen > 0x00ffffff) {
|
||||
errMsg = L"Cannot add files larger than 16MB to a disk image.";
|
||||
}
|
||||
// TODO: we want to limit the file length based on the filesystem type,
|
||||
// so we don't initiate an operation that can't possibly succeed. We
|
||||
// should be able to query the DiskImg for its max file size, but that
|
||||
// API doesn't currently exist. For now, limit anything other than HFS
|
||||
// to 16MB.
|
||||
if (pDiskFS->GetDiskImg()->GetFSFormat() != DiskImg::kFormatMacHFS &&
|
||||
fileLen > 0x00ffffff) {
|
||||
errMsg = L"Cannot add files larger than 16MB to a non-HFS disk image.";
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ private:
|
||||
*
|
||||
* Returns an empty string on success, or an error message on failure.
|
||||
*/
|
||||
CString LoadFile(const WCHAR* pathName, uint8_t** pBuf, long* pLen,
|
||||
CString LoadFile(const WCHAR* pathName, DiskFS* pDiskFS, uint8_t** pBuf, long* pLen,
|
||||
GenericEntry::ConvertEOL conv, GenericEntry::ConvertHighASCII convHA) const;
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user