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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2014-01-21 17:50:40 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-01-21 17:59:12 +0400
commitdcba34b4119619dccfa03fa8d99971724c87b358 (patch)
tree3cfbbd0b5629e42001e73fe93355f108055d6d72 /source/blender/blenlib/intern/string.c
parent19da32abf33b5d8a579cf7c0c171a7fe3d350aa0 (diff)
Fix T38303: same names with different case sorted unpredictable in the file browser.
The string comparison was in lower case, so the same strings with different case were considered the same which can make qsort give different results on each sort since it's not a stable sort. Now take case into account in comparison.
Diffstat (limited to 'source/blender/blenlib/intern/string.c')
-rw-r--r--source/blender/blenlib/intern/string.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 6b738fab45e..bbc135479ef 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -547,7 +547,13 @@ int BLI_natstrcmp(const char *s1, const char *s2)
d1++;
d2++;
}
- return tiebreaker;
+
+ if (tiebreaker)
+ return tiebreaker;
+
+ /* we might still have a different string because of lower/upper case, in
+ * that case fall back to regular string comparison */
+ return strcmp(s1, s2);
}
void BLI_timestr(double _time, char *str, size_t maxlen)