From babda88228b629ecff3c748768c6660ecd9cc359 Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Mon, 9 Mar 2009 22:04:40 +0000 Subject: [PATCH] Make strnatcmp() and strnatcasecmp() call strcmp() or strcasecmp() if strings otherwise sort the same. This is done to make sure that strings always sort the same. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20265 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/strnatcmp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/firmware/common/strnatcmp.c b/firmware/common/strnatcmp.c index 4cc3065978..d7ac60414f 100644 --- a/firmware/common/strnatcmp.c +++ b/firmware/common/strnatcmp.c @@ -130,9 +130,12 @@ static int strnatcmp0(char const *a, char const *b, int fold_case) } if (!ca && !cb) { - /* The strings compare the same. Perhaps the caller - will want to call strcmp to break the tie. */ - return 0; + /* The strings compare the same. Call str[case]cmp() to ensure + consistent results. */ + if(fold_case) + return strcasecmp(a,b); + else + return strcmp(a,b); } if (fold_case) {