mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 19:20:38 +00:00
Fix Linux compilation
- replaced stricmp with strcasecmp and strncasecmp https://linux.die.net/man/3/strcasecmp - replaced all Microsoft specific types with standard ones - replaced all instances of MAX_PATH with BMAX_PATH
This commit is contained in:
parent
13a1861c8d
commit
a28119ae30
2 changed files with 17 additions and 17 deletions
|
@ -116,7 +116,7 @@ const int kTagCount = sizeof(tags) / sizeof(tag_t);
|
||||||
|
|
||||||
int qsort_compar(const void *a, const void *b)
|
int qsort_compar(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
return stricmp((const char*)a, (const char*)b);
|
return strcasecmp((const char*)a, (const char*)b);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SortTags()
|
void SortTags()
|
||||||
|
@ -171,7 +171,7 @@ void RFS::Open(const char *fileName)
|
||||||
ThrowError("Error opening file %s", _fileName);
|
ThrowError("Error opening file %s", _fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fileSize = filelength(hFile);
|
int fileSize = kfilelength(hFile);
|
||||||
_ptr = (char*)Resource::Alloc(fileSize);
|
_ptr = (char*)Resource::Alloc(fileSize);
|
||||||
if (_ptr == NULL) {
|
if (_ptr == NULL) {
|
||||||
ThrowError("Not enough memory to read %s", _fileName);
|
ThrowError("Not enough memory to read %s", _fileName);
|
||||||
|
@ -314,14 +314,14 @@ uint8_t RFS::GetNextTag()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scriptValue = 0;
|
scriptValue = 0;
|
||||||
BOOL isNegative = FALSE; // or 'isSigned' ?
|
bool isNegative = false; // or 'isSigned' ?
|
||||||
|
|
||||||
// is it a negative number?
|
// is it a negative number?
|
||||||
if (_curChar == '-')
|
if (_curChar == '-')
|
||||||
{
|
{
|
||||||
Increment();
|
Increment();
|
||||||
|
|
||||||
isNegative = TRUE;
|
isNegative = true;
|
||||||
|
|
||||||
if (!isdigit(_curChar)) {
|
if (!isdigit(_curChar)) {
|
||||||
UnsetMark();
|
UnsetMark();
|
||||||
|
@ -407,7 +407,7 @@ uint8_t RFS::GetNextTag()
|
||||||
}
|
}
|
||||||
|
|
||||||
// eax = strnicmp(tags[i]._value, scriptBuffer, ebp);
|
// eax = strnicmp(tags[i]._value, scriptBuffer, ebp);
|
||||||
eax = strnicmp(scriptBuffer, tags[i]._value, ebp);
|
eax = strncasecmp(scriptBuffer, tags[i]._value, ebp);
|
||||||
|
|
||||||
//if (eax >= 0) {
|
//if (eax >= 0) {
|
||||||
if (eax == 0) {
|
if (eax == 0) {
|
||||||
|
@ -468,7 +468,7 @@ void ParseScript(char *scriptFileName)
|
||||||
gParseLevel = 0;
|
gParseLevel = 0;
|
||||||
dword_44CE0[0] = 0;
|
dword_44CE0[0] = 0;
|
||||||
|
|
||||||
BOOL parsing = TRUE;
|
bool parsing = true;
|
||||||
|
|
||||||
while (parsing)
|
while (parsing)
|
||||||
{
|
{
|
||||||
|
@ -485,7 +485,7 @@ void ParseScript(char *scriptFileName)
|
||||||
}
|
}
|
||||||
case kTagEnd:
|
case kTagEnd:
|
||||||
{
|
{
|
||||||
parsing = FALSE;
|
parsing = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kTagComment:
|
case kTagComment:
|
||||||
|
@ -539,7 +539,7 @@ void ParseScript(char *scriptFileName)
|
||||||
strcpy(inp, scriptBuffer);
|
strcpy(inp, scriptBuffer);
|
||||||
char nFlags = 0;
|
char nFlags = 0;
|
||||||
int ID = 0;
|
int ID = 0;
|
||||||
BOOL isDefine = FALSE;
|
bool isDefine = false;
|
||||||
|
|
||||||
tag = rfs.GetNextTag();
|
tag = rfs.GetNextTag();
|
||||||
if (tag == kTagAs)
|
if (tag == kTagAs)
|
||||||
|
@ -556,7 +556,7 @@ void ParseScript(char *scriptFileName)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
isDefine = TRUE;
|
isDefine = true;
|
||||||
tag = rfs.GetNextTag();
|
tag = rfs.GetNextTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,13 +626,13 @@ void ParseScript(char *scriptFileName)
|
||||||
rfs.SetMark();
|
rfs.SetMark();
|
||||||
strcpy(char256_1, scriptBuffer);
|
strcpy(char256_1, scriptBuffer);
|
||||||
|
|
||||||
BOOL bGotDefine = FALSE;
|
bool bGotDefine = false;
|
||||||
|
|
||||||
// check if this was defined via command prompt arguments
|
// check if this was defined via command prompt arguments
|
||||||
for (int i = 0; i < nCmdDefines; i++)
|
for (int i = 0; i < nCmdDefines; i++)
|
||||||
{
|
{
|
||||||
if (stricmp(gCmdDefines[i]._text, char256_1) == 0) { // string is equivalent
|
if (strcasecmp(gCmdDefines[i]._text, char256_1) == 0) { // string is equivalent
|
||||||
bGotDefine = TRUE;
|
bGotDefine = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -719,7 +719,7 @@ void ParseScript(char *scriptFileName)
|
||||||
char nFlags = 0;
|
char nFlags = 0;
|
||||||
int ID = 0;
|
int ID = 0;
|
||||||
|
|
||||||
BOOL isDefine = FALSE;
|
bool isDefine = false;
|
||||||
|
|
||||||
tag = rfs.GetNextTag();
|
tag = rfs.GetNextTag();
|
||||||
|
|
||||||
|
@ -738,7 +738,7 @@ void ParseScript(char *scriptFileName)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
isDefine = TRUE;
|
isDefine = true;
|
||||||
tag = rfs.GetNextTag();
|
tag = rfs.GetNextTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -888,7 +888,7 @@ void sub_11C10(char *pzScriptDir, char *fileName, char flags, int ID)
|
||||||
dirr = Bopendir("./");
|
dirr = Bopendir("./");
|
||||||
if (dirr)
|
if (dirr)
|
||||||
{
|
{
|
||||||
while (dirent = Breaddir(dirr))
|
while ((dirent = Breaddir(dirr)))
|
||||||
{
|
{
|
||||||
if (!Bwildmatch(dirent->name, fileName))
|
if (!Bwildmatch(dirent->name, fileName))
|
||||||
continue;
|
continue;
|
||||||
|
@ -905,7 +905,7 @@ void sub_11C10(char *pzScriptDir, char *fileName, char flags, int ID)
|
||||||
dirr = Bopendir(pzScriptDir);
|
dirr = Bopendir(pzScriptDir);
|
||||||
if (dirr)
|
if (dirr)
|
||||||
{
|
{
|
||||||
while (dirent = Breaddir(dirr))
|
while ((dirent = Breaddir(dirr)))
|
||||||
{
|
{
|
||||||
if (!Bwildmatch(dirent->name, fileName))
|
if (!Bwildmatch(dirent->name, fileName))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -578,7 +578,7 @@ void Resource::Read(DICTNODE *n, void *p)
|
||||||
if (n->path)
|
if (n->path)
|
||||||
Bstrncpy(filename, n->path, BMAX_PATH-1);
|
Bstrncpy(filename, n->path, BMAX_PATH-1);
|
||||||
else
|
else
|
||||||
Bsnprintf(filename, MAX_PATH-1, "%s.%s", n->name, n->type);
|
Bsnprintf(filename, BMAX_PATH-1, "%s.%s", n->name, n->type);
|
||||||
int fhandle = kopen4loadfrommod(filename, 0);
|
int fhandle = kopen4loadfrommod(filename, 0);
|
||||||
if (fhandle == -1 || (uint32_t)kread(fhandle, p, n->size) != n->size)
|
if (fhandle == -1 || (uint32_t)kread(fhandle, p, n->size) != n->size)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue