Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-11-07 19:27:31 +0300
committerTon Roosendaal <ton@blender.org>2006-11-07 19:27:31 +0300
commit7de24b7ea84c04ad5d056471f3b39d3664b00a77 (patch)
tree8dc675db98d3726c5a530b846eed5f439711c37c
parent0de4c3c0eba8c0759dfd09553a551600b0166ef4 (diff)
MSVC compiler is non-posix for some string operations...
Created a BLI_strcasestr and used existing BLI_strcasecmp in code now.
-rw-r--r--source/blender/blenkernel/intern/armature.c23
-rw-r--r--source/blender/blenlib/BLI_blenlib.h1
-rw-r--r--source/blender/blenlib/intern/util.c22
-rw-r--r--source/blender/src/outliner.c4
4 files changed, 27 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 4ea02565b9b..9462c508084 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -243,25 +243,6 @@ Bone *get_named_bone (bArmature *arm, const char *name)
return bone;
}
-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=='_')
@@ -340,7 +321,7 @@ void bone_flip_name (char *name, int strip_number)
}
else if(len > 5) {
/* hrms, why test for a separator? lets do the rule 'ultimate left or right' */
- index = strcasestr_(prefix, "right");
+ index = BLI_strcasestr(prefix, "right");
if (index==prefix || index==prefix+len-5) {
if(index[0]=='r')
strcpy (replace, "left");
@@ -354,7 +335,7 @@ void bone_flip_name (char *name, int strip_number)
strcpy (suffix, index+5);
}
else {
- index = strcasestr_(prefix, "left");
+ index = BLI_strcasestr(prefix, "left");
if (index==prefix || index==prefix+len-4) {
if(index[0]=='l')
strcpy (replace, "right");
diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h
index 564b250da81..1a35cad3a03 100644
--- a/source/blender/blenlib/BLI_blenlib.h
+++ b/source/blender/blenlib/BLI_blenlib.h
@@ -349,6 +349,7 @@ void BLI_setErrorCallBack(void (*f)(char*));
*/
void BLI_setInterruptCallBack(int (*f)(void));
+char *BLI_strcasestr(const char *s, const char *find);
int BLI_strcasecmp(const char *s1, const char *s2);
int BLI_strncasecmp(const char *s1, const char *s2, int n);
void BLI_timestr(double time, char *str);
diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c
index b26f9b5b3d8..39ddc8d2bbd 100644
--- a/source/blender/blenlib/intern/util.c
+++ b/source/blender/blenlib/intern/util.c
@@ -1382,6 +1382,28 @@ char* BLI_getbundle(void) {
}
#endif
+/* strcasestr not available in MSVC */
+char *BLI_strcasestr(const char *s, const 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);
+}
+
+
int BLI_strcasecmp(const char *s1, const char *s2) {
int i;
diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c
index 640958bd3ed..673ee677be6 100644
--- a/source/blender/src/outliner.c
+++ b/source/blender/src/outliner.c
@@ -1910,11 +1910,11 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na
/* determine if match */
if(flags==OL_FIND)
- found= strcasestr(te->name, name)!=NULL;
+ found= BLI_strcasestr(te->name, name)!=NULL;
else if(flags==OL_FIND_CASE)
found= strstr(te->name, name)!=NULL;
else if(flags==OL_FIND_COMPLETE)
- found= strcasecmp(te->name, name)==0;
+ found= BLI_strcasecmp(te->name, name)==0;
else
found= strcmp(te->name, name)==0;