Skip to content

Commit

Permalink
Assert on collision of hashes of resource types or filenames.
Browse files Browse the repository at this point in the history
This should be a minor improvement over silently retreiving the wrong resource on filename hash collisions.
  • Loading branch information
Cyp committed Aug 2, 2012
1 parent 398f77e commit 74c153c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/framework/frameresource.cpp
Expand Up @@ -419,6 +419,7 @@ bool resLoadFile(const char *pType, const char *pFile)
{
if (psT->HashedType == HashedType)
{
ASSERT(strcmp(psT->aType, pType) == 0, "Hash collision \"%s\" vs \"%s\"", psT->aType, pType);
break;
}
}
Expand All @@ -435,7 +436,8 @@ bool resLoadFile(const char *pType, const char *pFile)
{
if(psRes->HashedID == HashedName)
{
debug(LOG_WZ, "resLoadFile: Duplicate file name: %s (hash %x) for type %s",
ASSERT(strcasecmp(psRes->aID, pFile) == 0, "Hash collision \"%s\" vs \"%s\"", psRes->aID, pFile);
debug(LOG_WZ, "Duplicate file name: %s (hash %x) for type %s",
pFile, HashedName, psT->aType);
// assume that they are actually both the same and silently fail
// lovely little hack to allow some files to be loaded from disk (believe it or not!).
Expand Down

0 comments on commit 74c153c

Please sign in to comment.