mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
sort: fix unportable cast of unsigned char * -> char *
* src/sort.c (fold_toupper): Change this back from char to
unsigned char, fixing a portability issue introduced in commit
59e2e55d0f dated February 26, as the
C Standard doesn't let you convert from unsigned char * to char *
without a cast, and the (in theory more portable) style here is to
convert char values, not pointer values.
(getmonth): Convert char to unsigned char when needed for
comparison.
This commit is contained in:
@@ -268,7 +268,7 @@ static bool nonprinting[UCHAR_LIM];
|
||||
static bool nondictionary[UCHAR_LIM];
|
||||
|
||||
/* Translation table folding lower case to upper. */
|
||||
static unsigned char fold_toupper[UCHAR_LIM];
|
||||
static char fold_toupper[UCHAR_LIM];
|
||||
|
||||
#define MONTHS_PER_YEAR 12
|
||||
|
||||
@@ -1952,12 +1952,12 @@ getmonth (char const *month, char **ea)
|
||||
*ea = (char *) m;
|
||||
return monthtab[ix].val;
|
||||
}
|
||||
if (fold_toupper[to_uchar (*m)] < to_uchar (*n))
|
||||
if (to_uchar (fold_toupper[to_uchar (*m)]) < to_uchar (*n))
|
||||
{
|
||||
hi = ix;
|
||||
break;
|
||||
}
|
||||
else if (fold_toupper[to_uchar (*m)] > to_uchar (*n))
|
||||
else if (to_uchar (fold_toupper[to_uchar (*m)]) > to_uchar (*n))
|
||||
{
|
||||
lo = ix + 1;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user