diff options
Diffstat (limited to 'source/blender/blenlib/intern/string.c')
-rw-r--r-- | source/blender/blenlib/intern/string.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 76193ba9a13..d6331d6eeb8 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -66,7 +66,7 @@ char *BLI_strdupcat(const char *str1, const char *str2) return n; } -char *BLI_strncpy(char *dst, const char *src, int maxncpy) { +char *BLI_strncpy(char *dst, const char *src, const int maxncpy) { int srclen= strlen(src); int cpylen= (srclen>(maxncpy-1))?(maxncpy-1):srclen; @@ -311,8 +311,13 @@ int BLI_natstrcmp(const char *s1, const char *s2) c1 = tolower(s1[d1]); c2 = tolower(s2[d2]); } - - if (c1<c2) { + + /* first check for '.' so "foo.bar" comes before "foo 1.bar" */ + if(c1=='.' && c2!='.') + return -1; + if(c1!='.' && c2=='.') + return 1; + else if (c1<c2) { return -1; } else if (c1>c2) { return 1; |