MCPcopy Create free account
hub / github.com/JACoders/OpenJK / FS_HashFileName

Function FS_HashFileName

code/qcommon/files.cpp:309–327  ·  view source on GitHub ↗

================ return a hash value for the filename ================ */

Source from the content-addressed store, hash-verified

307================
308*/
309static long FS_HashFileName( const char *fname, int hashSize ) {
310 int i;
311 long hash;
312 char letter;
313
314 hash = 0;
315 i = 0;
316 while (fname[i] != '\0') {
317 letter = tolower(fname[i]);
318 if (letter =='.') break; // don't include extension
319 if (letter =='\\') letter = '/'; // damn path names
320 if (letter == PATH_SEP) letter = '/'; // damn path names
321 hash+=(long)(letter)*(i+119);
322 i++;
323 }
324 hash = (hash ^ (hash >> 10) ^ (hash >> 20));
325 hash &= (hashSize-1);
326 return hash;
327}
328
329static fileHandle_t FS_HandleForFile(void) {
330 int i;

Callers 4

FS_FOpenFileReadFunction · 0.70
FS_FileIsInPAKFunction · 0.70
FS_LoadZipFileFunction · 0.70
FS_Which_fFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected