The "actualThreadEOF" value was getting set incorrectly on newly-added

message threads.  This didn't cause any problems with the archive, but
if you extracted the thread in question without reopening the archive
you ended up getting the whole pre-sized buffer instead of just the part
with data in it.

Load the TOC if needed in Nu_ExtractThread.

When thread extraction fails, don't send an update to the progress
updater if there isn't a progress updater.
This commit is contained in:
Andy McFadden 2003-03-06 01:37:47 +00:00
parent 16460a8d2e
commit 38dafdc774
2 changed files with 4 additions and 2 deletions

View File

@ -347,7 +347,7 @@ Nu_CopyPresizedToArchive(NuArchive* pArchive, NuDataSource* pDataSource,
pThread->thThreadCRC = 0; /* no CRC on pre-sized stuff */ pThread->thThreadCRC = 0; /* no CRC on pre-sized stuff */
pThread->thThreadEOF = srcLen; pThread->thThreadEOF = srcLen;
pThread->thCompThreadEOF = bufferLen; pThread->thCompThreadEOF = bufferLen;
pThread->actualThreadEOF = bufferLen; pThread->actualThreadEOF = srcLen;
/* nuThreadIdx and fileOffset should already be set */ /* nuThreadIdx and fileOffset should already be set */
/* /*

View File

@ -744,7 +744,7 @@ retry_name:
} }
bail: bail:
if (err != kNuErrNone) { if (err != kNuErrNone && pProgressData != nil) {
/* send a final progress message, indicating failure */ /* send a final progress message, indicating failure */
if (err == kNuErrSkipped) if (err == kNuErrSkipped)
pProgressData->state = kNuProgressSkipped; pProgressData->state = kNuProgressSkipped;
@ -825,6 +825,8 @@ Nu_ExtractThread(NuArchive* pArchive, NuThreadIdx threadIdx,
return kNuErrUsage; return kNuErrUsage;
if (threadIdx == 0 || pDataSink == nil) if (threadIdx == 0 || pDataSink == nil)
return kNuErrInvalidArg; return kNuErrInvalidArg;
err = Nu_GetTOCIfNeeded(pArchive);
BailError(err);
/* find the correct record and thread by index */ /* find the correct record and thread by index */
err = Nu_RecordSet_FindByThreadIdx(&pArchive->origRecordSet, threadIdx, err = Nu_RecordSet_FindByThreadIdx(&pArchive->origRecordSet, threadIdx,