diff options
author | Ton Roosendaal <ton@blender.org> | 2005-08-13 21:53:37 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-08-13 21:53:37 +0400 |
commit | e1584df90ba770a464c103bb18753e4b94cf81c9 (patch) | |
tree | 751687592922a336204af054e92c296b918c1f51 /source/blender/src/poseobject.c | |
parent | 9e6ad3dffc867be36f758f593c2db78cef3d0250 (diff) |
Removed strcasestr() with version as found on web, opensolaris. It had a
bug though! :)
For people interested: both lines with tolower() had to be added...
Diffstat (limited to 'source/blender/src/poseobject.c')
-rw-r--r-- | source/blender/src/poseobject.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/source/blender/src/poseobject.c b/source/blender/src/poseobject.c index 89f4c9f2ffa..76a0e36c612 100644 --- a/source/blender/src/poseobject.c +++ b/source/blender/src/poseobject.c @@ -441,6 +441,26 @@ void copy_posebuf (void) } +static char *strcasestr_(register char *s, register char *find) +{ + register char c, sc; + register size_t len; + + if ((c = *find++) != 0) { + c= tolower(c); + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + sc= tolower(sc); + } while (sc != c); + } while (BLI_strncasecmp(s, find, len) != 0); + s--; + } + return ((char *) s); +} + #define IS_SEPARATOR(a) (a=='.' || a==' ' || a=='-' || a=='_') /* finds the best possible flipped name, removing number extensions. For renaming; check for unique names afterwards */ @@ -485,7 +505,7 @@ static void flip_name (char *name) prefix[len-1]= 0; strcpy(replace, "L"); break; - } + } } /* case; beginning with r R l L , with separator after it */ else if( IS_SEPARATOR(name[1]) ) { @@ -514,8 +534,8 @@ static void flip_name (char *name) } else if(len > 5) { /* hrms, why test for a separator? lets do the rule 'ultimate left or right' */ - index = strcasestr (prefix, "right"); - if (index==prefix || index==prefix-5) { + index = strcasestr_(prefix, "right"); + if (index==prefix || index==prefix+len-5) { if(index[0]=='r') strcpy (replace, "left"); else { @@ -528,8 +548,8 @@ static void flip_name (char *name) strcpy (suffix, index+5); } else { - index = strcasestr (prefix, "left"); - if (index==prefix || index==prefix-4) { + index = strcasestr_(prefix, "left"); + if (index==prefix || index==prefix+len-4) { if(index[0]=='l') strcpy (replace, "right"); else { |