mirror of https://github.com/aap/librw.git
implemented a case insensitive strncmp
This commit is contained in:
parent
41226ef0c6
commit
cb40fd1555
|
@ -227,7 +227,7 @@ UVAnimDictionary::find(const char *name)
|
|||
FORLIST(lnk, this->animations){
|
||||
Animation *anim = UVAnimDictEntry::fromDict(lnk)->anim;
|
||||
UVAnimCustomData *custom = (UVAnimCustomData*)anim->customData;
|
||||
if(strncmp(custom->name, name, 32) == 0) // strncmp correct?
|
||||
if(strncmp_ci(custom->name, name, 32) == 0)
|
||||
return anim;
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -53,7 +53,7 @@ TexDictionary::find(const char *name)
|
|||
{
|
||||
FORLIST(lnk, this->textures){
|
||||
Texture *tex = Texture::fromDict(lnk);
|
||||
if(strncmp(tex->name, name, 32) == 0)
|
||||
if(strncmp_ci(tex->name, name, 32) == 0)
|
||||
return tex;
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cctype>
|
||||
|
||||
#include "rwbase.h"
|
||||
#include "rwplugin.h"
|
||||
|
@ -67,6 +68,22 @@ initialize(void)
|
|||
Frame::dirtyList.init();
|
||||
}
|
||||
|
||||
// lazy implementation
|
||||
int
|
||||
strncmp_ci(const char *s1, const char *s2, int n)
|
||||
{
|
||||
char c1, c2;
|
||||
while(n--){
|
||||
c1 = tolower(*s1);
|
||||
c2 = tolower(*s2);
|
||||
if(c1 != c2)
|
||||
return c1 - c2;
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Quat
|
||||
mult(const Quat &q, const Quat &p)
|
||||
{
|
||||
|
|
|
@ -281,6 +281,8 @@ extern char *debugFile;
|
|||
|
||||
void initialize(void);
|
||||
|
||||
int strncmp_ci(const char *s1, const char *s2, int n);
|
||||
|
||||
// 0x04000000 3.1
|
||||
// 0x08000000 3.2
|
||||
// 0x0C000000 3.3
|
||||
|
|
Loading…
Reference in New Issue