MCPcopy Create free account
hub / github.com/diasurgical/devilution / FreeFileHandle

Function FreeFileHandle

3rdParty/StormLib/src/SBaseCommon.cpp:1555–1579  ·  view source on GitHub ↗

Frees the structure for MPQ file

Source from the content-addressed store, hash-verified

1553
1554// Frees the structure for MPQ file
1555void FreeFileHandle(TMPQFile *& hf)
1556{
1557 if(hf != NULL)
1558 {
1559 // If we have patch file attached to this one, free it first
1560 if(hf->hfPatch != NULL)
1561 FreeFileHandle(hf->hfPatch);
1562
1563 // Then free all buffers allocated in the file structure
1564 if(hf->pbFileData != NULL)
1565 STORM_FREE(hf->pbFileData);
1566 if(hf->pPatchInfo != NULL)
1567 STORM_FREE(hf->pPatchInfo);
1568 if(hf->SectorOffsets != NULL)
1569 STORM_FREE(hf->SectorOffsets);
1570 if(hf->SectorChksums != NULL)
1571 STORM_FREE(hf->SectorChksums);
1572 if(hf->pbFileSector != NULL)
1573 STORM_FREE(hf->pbFileSector);
1574 if(hf->pStream != NULL)
1575 FileStream_Close(hf->pStream);
1576 STORM_FREE(hf);
1577 hf = NULL;
1578 }
1579}
1580
1581// Frees the MPQ archive
1582void FreeArchiveHandle(TMPQArchive *& ha)

Callers 2

InvalidateInternalFileFunction · 0.85
SFileCloseFileFunction · 0.85

Calls 1

FileStream_CloseFunction · 0.85

Tested by

no test coverage detected