Fix sign of array subscript

Must be unsigned to avoid indexing on negative numbers.
This commit is contained in:
Kawe Mazidjatari 2023-04-08 18:28:39 +02:00
parent 21ea4dff52
commit f62092d6f2

View File

@ -15,7 +15,7 @@
#include "tier1/characterset.h"
// memdbgon must be the last include file in a .cpp file!!!
//#include "tier0/memdbgon.h"
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Purpose: builds a simple lookup table of a group of important characters
@ -24,7 +24,7 @@
//-----------------------------------------------------------------------------
void CharacterSetBuild(characterset_t* pSetBuffer, const char* pszSetString)
{
int i = 0;
unsigned int i = 0;
// Test our pointers
if (!pSetBuffer || !pszSetString)
@ -34,7 +34,8 @@ void CharacterSetBuild(characterset_t* pSetBuffer, const char* pszSetString)
while (pszSetString[i])
{
pSetBuffer->set[pszSetString[i]] = 1;
unsigned char ch = (unsigned char)pszSetString[i];
pSetBuffer->set[ch] = 1;
i++;
}
}