return crc ^ CRC_XOR_VALUE;
}
+unsigned short CRC_Block_CaseInsensitive(const unsigned char *data, size_t size)
+{
+ unsigned short crc = CRC_INIT_VALUE;
+ while (size--)
+ crc = (crc << 8) ^ crctable[(crc >> 8) ^ (tolower(*data++))];
+ return crc ^ CRC_XOR_VALUE;
+}
+
// QuakeWorld
static unsigned char chktbl[1024 + 4] =
{
void Com_HexDumpToConsole(const unsigned char *data, int size);
unsigned short CRC_Block(const unsigned char *data, size_t size);
+unsigned short CRC_Block_CaseInsensitive(const unsigned char *data, size_t size); // for hash lookup functions that use strcasecmp for comparison
unsigned char COM_BlockSequenceCRCByteQW(unsigned char *base, int length, int sequence);
static void Q3Shader_AddToHash (q3shaderinfo_t* shader)
{
- unsigned short hash = CRC_Block ((const unsigned char *)shader->name, strlen (shader->name));
+ unsigned short hash = CRC_Block_CaseInsensitive ((const unsigned char *)shader->name, strlen (shader->name));
q3shader_hash_entry_t* entry = q3shader_data->hash + (hash % Q3SHADER_HASH_SIZE);
q3shader_hash_entry_t* lastEntry = NULL;
while (entry != NULL)
q3shaderinfo_t *Mod_LookupQ3Shader(const char *name)
{
- unsigned short hash = CRC_Block ((const unsigned char *)name, strlen (name));
+ unsigned short hash = CRC_Block_CaseInsensitive ((const unsigned char *)name, strlen (name));
q3shader_hash_entry_t* entry = q3shader_data->hash + (hash % Q3SHADER_HASH_SIZE);
while (entry != NULL)
{