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:
Diffstat (limited to 'source/blender/blenlib/intern/string.c')
-rw-r--r--source/blender/blenlib/intern/string.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 2f67b0e57a3..f62ffe9e985 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -534,13 +534,24 @@ char *BLI_strncasestr(const char *s, const char *find, size_t len)
if ((c = *find++) != 0) {
c = tolower(c);
- do {
+ if (len > 1) {
do {
- if ((sc = *s++) == 0)
- return (NULL);
- sc = tolower(sc);
- } while (sc != c);
- } while (BLI_strncasecmp(s, find, len - 1) != 0);
+ do {
+ if ((sc = *s++) == 0)
+ return NULL;
+ sc = tolower(sc);
+ } while (sc != c);
+ } while (BLI_strncasecmp(s, find, len - 1) != 0);
+ }
+ else {
+ {
+ do {
+ if ((sc = *s++) == 0)
+ return NULL;
+ sc = tolower(sc);
+ } while (sc != c);
+ }
+ }
s--;
}
return ((char *)s);