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

Function AllocateFileName

3rdParty/StormLib/src/SBaseFileTable.cpp:1883–1914  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1881}
1882
1883void AllocateFileName(TMPQArchive * ha, TFileEntry * pFileEntry, const char * szFileName)
1884{
1885 // Sanity check
1886 assert(pFileEntry != NULL);
1887
1888 // If the file name is pseudo file name, free it at this point
1889 if(IsPseudoFileName(pFileEntry->szFileName, NULL))
1890 {
1891 if(pFileEntry->szFileName != NULL)
1892 STORM_FREE(pFileEntry->szFileName);
1893 pFileEntry->szFileName = NULL;
1894 }
1895
1896 // Only allocate new file name if it's not there yet
1897 if(pFileEntry->szFileName == NULL)
1898 {
1899 pFileEntry->szFileName = STORM_ALLOC(char, strlen(szFileName) + 1);
1900 if(pFileEntry->szFileName != NULL)
1901 strcpy(pFileEntry->szFileName, szFileName);
1902 }
1903
1904#ifdef FULL
1905 // We also need to create the file name hash
1906 if(ha->pHetTable != NULL)
1907 {
1908 ULONGLONG AndMask64 = ha->pHetTable->AndMask64;
1909 ULONGLONG OrMask64 = ha->pHetTable->OrMask64;
1910
1911 pFileEntry->FileNameHash = (HashStringJenkins(szFileName) & AndMask64) | OrMask64;
1912 }
1913#endif
1914}
1915
1916TFileEntry * AllocateFileEntry(TMPQArchive * ha, const char * szFileName, LCID lcLocale, LPDWORD PtrHashIndex)
1917{

Callers 4

AllocateFileEntryFunction · 0.85
RenameFileEntryFunction · 0.85
SFileOpenFileExFunction · 0.85
CreatePseudoFileNameFunction · 0.85

Calls 2

IsPseudoFileNameFunction · 0.85
HashStringJenkinsFunction · 0.85

Tested by

no test coverage detected