Frees the MPQ archive
| 1580 | |
| 1581 | // Frees the MPQ archive |
| 1582 | void FreeArchiveHandle(TMPQArchive *& ha) |
| 1583 | { |
| 1584 | if(ha != NULL) |
| 1585 | { |
| 1586 | // First of all, free the patch archive, if any |
| 1587 | if(ha->haPatch != NULL) |
| 1588 | FreeArchiveHandle(ha->haPatch); |
| 1589 | |
| 1590 | // Free the patch prefix, if any |
| 1591 | if(ha->pPatchPrefix != NULL) |
| 1592 | STORM_FREE(ha->pPatchPrefix); |
| 1593 | |
| 1594 | // Close the file stream |
| 1595 | FileStream_Close(ha->pStream); |
| 1596 | ha->pStream = NULL; |
| 1597 | |
| 1598 | // Free the file names from the file table |
| 1599 | if(ha->pFileTable != NULL) |
| 1600 | { |
| 1601 | for(DWORD i = 0; i < ha->dwFileTableSize; i++) |
| 1602 | { |
| 1603 | if(ha->pFileTable[i].szFileName != NULL) |
| 1604 | STORM_FREE(ha->pFileTable[i].szFileName); |
| 1605 | ha->pFileTable[i].szFileName = NULL; |
| 1606 | } |
| 1607 | |
| 1608 | // Then free all buffers allocated in the archive structure |
| 1609 | STORM_FREE(ha->pFileTable); |
| 1610 | } |
| 1611 | |
| 1612 | if(ha->pHashTable != NULL) |
| 1613 | STORM_FREE(ha->pHashTable); |
| 1614 | #ifdef FULL |
| 1615 | if(ha->pHetTable != NULL) |
| 1616 | FreeHetTable(ha->pHetTable); |
| 1617 | #endif |
| 1618 | STORM_FREE(ha); |
| 1619 | ha = NULL; |
| 1620 | } |
| 1621 | } |
| 1622 | |
| 1623 | bool IsInternalMpqFileName(const char * szFileName) |
| 1624 | { |
no test coverage detected