mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-05-03 23:42:07 +00:00
M_TokenizerOpen: pass size in as argument instead of calling strlen implicitly
This function is used for parsing TEXTMAP and the data is not NUL-terminated.
This commit is contained in:
parent
78a727e9cb
commit
56e710266c
4 changed files with 5 additions and 5 deletions
|
|
@ -500,7 +500,7 @@ char *M_GetToken(const char *inputString);
|
||||||
void M_UnGetToken(void);
|
void M_UnGetToken(void);
|
||||||
UINT32 M_GetTokenPos(void);
|
UINT32 M_GetTokenPos(void);
|
||||||
|
|
||||||
void M_TokenizerOpen(const char *inputString);
|
void M_TokenizerOpen(const char *inputString, size_t inputLength);
|
||||||
void M_TokenizerClose(void);
|
void M_TokenizerClose(void);
|
||||||
const char *M_TokenizerRead(UINT32 i);
|
const char *M_TokenizerRead(UINT32 i);
|
||||||
UINT32 M_TokenizerGetEndPos(void);
|
UINT32 M_TokenizerGetEndPos(void);
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ static boolean RankCapsules_LoadMapData(const virtres_t *virt)
|
||||||
if (g_rankCapsules_udmf) // Count how many entries for each type we got in textmap.
|
if (g_rankCapsules_udmf) // Count how many entries for each type we got in textmap.
|
||||||
{
|
{
|
||||||
virtlump_t *textmap = vres_Find(virt, "TEXTMAP");
|
virtlump_t *textmap = vres_Find(virt, "TEXTMAP");
|
||||||
M_TokenizerOpen((char *)textmap->data);
|
M_TokenizerOpen((char *)textmap->data, textmap->size);
|
||||||
if (!RankCapsules_TextmapCount(textmap->size))
|
if (!RankCapsules_TextmapCount(textmap->size))
|
||||||
{
|
{
|
||||||
M_TokenizerClose();
|
M_TokenizerClose();
|
||||||
|
|
|
||||||
|
|
@ -2276,7 +2276,7 @@ static UINT32 tokenizerInputLength = 0;
|
||||||
static UINT8 tokenizerInComment = 0; // 0 = not in comment, 1 = // Single-line, 2 = /* Multi-line */
|
static UINT8 tokenizerInComment = 0; // 0 = not in comment, 1 = // Single-line, 2 = /* Multi-line */
|
||||||
static boolean tokenizerIsString = false; // did we strip quotes from this token?
|
static boolean tokenizerIsString = false; // did we strip quotes from this token?
|
||||||
|
|
||||||
void M_TokenizerOpen(const char *inputString)
|
void M_TokenizerOpen(const char *inputString, size_t inputLength)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
|
@ -2286,7 +2286,7 @@ void M_TokenizerOpen(const char *inputString)
|
||||||
tokenCapacity[i] = 1024;
|
tokenCapacity[i] = 1024;
|
||||||
tokenizerToken[i] = (char*)Z_Malloc(tokenCapacity[i] * sizeof(char), PU_STATIC, NULL);
|
tokenizerToken[i] = (char*)Z_Malloc(tokenCapacity[i] * sizeof(char), PU_STATIC, NULL);
|
||||||
}
|
}
|
||||||
tokenizerInputLength = strlen(tokenizerInput);
|
tokenizerInputLength = inputLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
void M_TokenizerClose(void)
|
void M_TokenizerClose(void)
|
||||||
|
|
|
||||||
|
|
@ -3459,7 +3459,7 @@ static boolean P_LoadMapData(const virtres_t *virt)
|
||||||
if (udmf) // Count how many entries for each type we got in textmap.
|
if (udmf) // Count how many entries for each type we got in textmap.
|
||||||
{
|
{
|
||||||
virtlump_t *textmap = vres_Find(virt, "TEXTMAP");
|
virtlump_t *textmap = vres_Find(virt, "TEXTMAP");
|
||||||
M_TokenizerOpen((char *)textmap->data);
|
M_TokenizerOpen((char *)textmap->data, textmap->size);
|
||||||
if (!TextmapCount(textmap->size))
|
if (!TextmapCount(textmap->size))
|
||||||
{
|
{
|
||||||
M_TokenizerClose();
|
M_TokenizerClose();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue