diff options
author | Jim Meyering <jim@meyering.net> | 1996-09-23 03:02:04 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1996-09-23 03:02:04 +0000 |
commit | 85cddd311953c1d1070b2be8698083daa6cd59ab (patch) | |
tree | 9e9487591f04f770d05fe0de71aeff2ebb08f016 /src/sort.c | |
parent | 3661c96081944ff8b17611ba915be68c824e4869 (diff) | |
download | coreutils-85cddd311953c1d1070b2be8698083daa6cd59ab.tar.xz |
(keycompare): Declare translate to be unsigned char *.
Otherwise, sign extension caused misordering when using e.g. -f.
Diffstat (limited to 'src/sort.c')
-rw-r--r-- | src/sort.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sort.c b/src/sort.c index 4614c890a..90c28567d 100644 --- a/src/sort.c +++ b/src/sort.c @@ -987,7 +987,8 @@ getmonth (const char *s, int len) static int keycompare (const struct line *a, const struct line *b) { - register char *texta, *textb, *lima, *limb, *translate; + register char *texta, *textb, *lima, *limb; + register unsigned char *translate; register int *ignore; struct keyfield *key; int diff = 0, iter = 0, lena, lenb; @@ -995,7 +996,7 @@ keycompare (const struct line *a, const struct line *b) for (key = keyhead.next; key; key = key->next, ++iter) { ignore = key->ignore; - translate = key->translate; + translate = (unsigned char *) key->translate; /* Find the beginning and limit of each field. */ if (iter || a->keybeg == NULL || b->keybeg == NULL) @@ -1137,7 +1138,7 @@ keycompare (const struct line *a, const struct line *b) CMP_WITH_IGNORE (translate[UCHAR (*texta)], translate[UCHAR (*textb)]); else if (ignore) - CMP_WITH_IGNORE (*texta, *textb); + CMP_WITH_IGNORE (UCHAR (*texta), UCHAR (*textb)); else if (translate) while (texta < lima && textb < limb) { |