MCPcopy Create free account
hub / github.com/dborth/fceugx / SzExtractFile

Function SzExtractFile

source/gcunzip.cpp:493–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491***************************************************************************/
492
493size_t SzExtractFile(int i, unsigned char *buffer)
494{
495 // prepare some variables
496 SzBlockIndex = 0xFFFFFFFF;
497 SzOffset = 0;
498
499 // Unzip the file
500
501 SzRes = SzExtract2(
502 &SzArchiveStream.InStream,
503 &SzDb,
504 i, // index of file
505 &SzBlockIndex, // index of solid block
506 &buffer,
507 &SzBufferSize,
508 &SzOffset, // offset of stream for required file in *outBuffer
509 &SzOutSizeProcessed, // size of file in *outBuffer
510 &SzAllocImp,
511 &SzAllocTempImp);
512
513 // close 7Zip archive and free memory
514 SzClose();
515
516 CancelAction();
517
518 // check for errors
519 if(SzRes != SZ_OK)
520 {
521 // display error message
522 SzDisplayError(SzRes);
523 return 0;
524 }
525 else
526 {
527 return SzOutSizeProcessed;
528 }
529}

Callers 1

LoadSzFileFunction · 0.85

Calls 4

SzExtract2Function · 0.85
SzCloseFunction · 0.85
CancelActionFunction · 0.85
SzDisplayErrorFunction · 0.85

Tested by

no test coverage detected