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 /source/blender/blenlib
parent0de4c3c0eba8c0759dfd09553a551600b0166ef4 (diff)
MSVC compiler is non-posix for some string operations...
Created a BLI_strcasestr and used existing BLI_strcasecmp in code now.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_blenlib.h1
-rw-r--r--source/blender/blenlib/intern/util.c22
2 files changed, 23 insertions, 0 deletions
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;