From 0b7dcd69c801a7439de5bfc53ae4005ec3846634 Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Mon, 22 Feb 2010 21:24:09 +0000 Subject: Remove tabs in firmware path (taking into account the original spacing). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24864 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/strnatcmp.c | 112 ++++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 56 deletions(-) (limited to 'firmware/common/strnatcmp.c') diff --git a/firmware/common/strnatcmp.c b/firmware/common/strnatcmp.c index 93a649358f..0084ff3582 100644 --- a/firmware/common/strnatcmp.c +++ b/firmware/common/strnatcmp.c @@ -75,26 +75,26 @@ compare_right(char const *a, char const *b) int ca, cb; /* The longest run of digits wins. That aside, the greatest - value wins, but we can't know that it will until we've scanned - both numbers to know that they have the same magnitude, so we - remember it in BIAS. */ + value wins, but we can't know that it will until we've scanned + both numbers to know that they have the same magnitude, so we + remember it in BIAS. */ for (;; a++, b++) { ca = to_int(*a); cb = to_int(*b); - if (!nat_isdigit(ca) && !nat_isdigit(cb)) - return bias; - else if (!nat_isdigit(ca)) - return -1; - else if (!nat_isdigit(cb)) - return +1; - else if (ca < cb) { - if (!bias) - bias = -1; - } else if (ca > cb) { - if (!bias) - bias = +1; - } else if (!ca && !cb) - return bias; + if (!nat_isdigit(ca) && !nat_isdigit(cb)) + return bias; + else if (!nat_isdigit(ca)) + return -1; + else if (!nat_isdigit(cb)) + return +1; + else if (ca < cb) { + if (!bias) + bias = -1; + } else if (ca > cb) { + if (!bias) + bias = +1; + } else if (!ca && !cb) + return bias; } return 0; @@ -107,18 +107,18 @@ compare_left(char const *a, char const *b) /* Compare two left-aligned numbers: the first to have a different value wins. */ for (;; a++, b++) { - if (!nat_isdigit(*a) && !nat_isdigit(*b)) - return 0; - else if (!nat_isdigit(*a)) - return -1; - else if (!nat_isdigit(*b)) - return +1; - else if (*a < *b) - return -1; - else if (*a > *b) - return +1; + if (!nat_isdigit(*a) && !nat_isdigit(*b)) + return 0; + else if (!nat_isdigit(*a)) + return -1; + else if (!nat_isdigit(*b)) + return +1; + else if (*a < *b) + return -1; + else if (*a > *b) + return +1; } - + return 0; } @@ -134,39 +134,39 @@ static int strnatcmp0(char const *a, char const *b, int fold_case) ca = to_int(a[ai]); cb = to_int(b[bi]); - /* process run of digits */ - if (nat_isdigit(ca) && nat_isdigit(cb)) { - fractional = (ca == '0' || cb == '0'); - - if (fractional) { - if ((result = compare_left(a+ai, b+bi)) != 0) - return result; - } else { - if ((result = compare_right(a+ai, b+bi)) != 0) - return result; - } - } - - if (!ca && !cb) { - /* The strings compare the same. Call str[case]cmp() to ensure + /* process run of digits */ + if (nat_isdigit(ca) && nat_isdigit(cb)) { + fractional = (ca == '0' || cb == '0'); + + if (fractional) { + if ((result = compare_left(a+ai, b+bi)) != 0) + return result; + } else { + if ((result = compare_right(a+ai, b+bi)) != 0) + return result; + } + } + + if (!ca && !cb) { + /* 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) { - ca = nat_unify_case(ca); - cb = nat_unify_case(cb); - } - - if (ca < cb) - return -1; - else if (ca > cb) - return +1; - - ++ai; ++bi; + } + + if (fold_case) { + ca = nat_unify_case(ca); + cb = nat_unify_case(cb); + } + + if (ca < cb) + return -1; + else if (ca > cb) + return +1; + + ++ai; ++bi; } } -- cgit v1.2.3