Fixed a bug related to "mask dataless" mode where archives weren't getting

reconstructed properly.

Altered "fake" thread initialization to have a *really* invalid file offset
in case somebody tries to use it for math.
This commit is contained in:
Andy McFadden 2003-02-24 06:31:11 +00:00
parent cb96779bd7
commit 36f47b866c
2 changed files with 8 additions and 7 deletions

View File

@ -1053,6 +1053,7 @@ Nu_ReadRecordHeader(NuArchive* pArchive, NuRecord* pRecord)
pRecord->recHeaderLength =
bytesRead + pRecord->recTotalThreads * kNuThreadHeaderSize;
pRecord->recHeaderLength -= pRecord->fakeThreads * kNuThreadHeaderSize;
err = Nu_ComputeThreadData(pArchive, pRecord);
BailError(err);
@ -1267,6 +1268,7 @@ Nu_WriteRecordHeader(NuArchive* pArchive, NuRecord* pRecord, FILE* fp)
*/
pRecord->recHeaderLength =
bytesWritten + pRecord->recTotalThreads * kNuThreadHeaderSize;
pRecord->recHeaderLength -= pRecord->fakeThreads * kNuThreadHeaderSize;
err = Nu_ComputeThreadData(pArchive, pRecord);
BailError(err);
@ -1738,11 +1740,10 @@ Nu_ExtractRecordByPtr(NuArchive* pArchive, NuRecord* pRecord)
* thread at all. It doesn't correctly deal with them when extracting
* though, so it appears this behavior wasn't entirely expected.)
*
* NOTE: this might be doing the (slightly) wrong thing if the storage
* type of the file indicates that it was forked. We might need to be
* extracting zero-byte data *and* resource forks here. Only matters
* if we want to be able to reconstruct the original archive contents
* from what we extracted. ++ATM 20030110
* If it's a forked file, we also need to create an empty rsrc file.
*
* If valMaskDataless is enabled, this won't fire, because we "forge"
* appropriate threads.
*
* Note there's another one of these below, in Nu_StreamExtract.
*/

View File

@ -279,7 +279,7 @@ Nu_ReadThreadHeaders(NuArchive* pArchive, NuRecord* pRecord, ushort* pCrc)
pThread->thCompThreadEOF = 0;
pThread->actualThreadEOF = 0;
pThread->threadIdx = Nu_GetNextThreadIdx(pArchive);
pThread->fileOffset = -1;
pThread->fileOffset = -99999999;
if (needRsrc) {
pThread++;
@ -291,7 +291,7 @@ Nu_ReadThreadHeaders(NuArchive* pArchive, NuRecord* pRecord, ushort* pCrc)
pThread->thCompThreadEOF = 0;
pThread->actualThreadEOF = 0;
pThread->threadIdx = Nu_GetNextThreadIdx(pArchive);
pThread->fileOffset = -1;
pThread->fileOffset = -99999999;
}
}