]> git.ipfire.org Git - thirdparty/coreutils.git/commit
numfmt: fix isblank() usage for some unibyte locales
authorAssaf Gordon <assafgordon@gmail.com>
Tue, 15 Jul 2014 16:25:03 +0000 (12:25 -0400)
committerPádraig Brady <P@draigBrady.com>
Wed, 16 Jul 2014 21:35:17 +0000 (22:35 +0100)
commit061882d73b4f11f7b7f7151754e617234edc6f7a
treed527f75dcf25f2ded0233eb0f7728b958c91a30c
parent37b36018d3f5f276622a9888e32623f9410a80e0
numfmt: fix isblank() usage for some unibyte locales

* src/numfmt.c (simple_strtod_int): Replace isdigit() with c_isdigit()
to avoid locale concerns and -Wchar-subscripts warnings on cygwin.
Remove the now redundant locale guard.
(simple_strtod_human): Cast characters to unsigned so that the promoted
int value passed to isblank() is positive, allowing it to work correctly
for all characters in unibyte locales.  Previously character 0xA0,
i.e. non-breaking space, would be misclassified for example.
(process_suffixed_number): Likewise.
(skip_fields): Likewise.
Both issues were triggered by the -Wchar-subscripts warning on GCC 4.8.3
on cygwin, due to the is*() implementations used there, but the issue
is present on all platforms defaulting to signed chars.
* NEWS: Mention the bug fix.

Reported by Eric Blake
NEWS
src/numfmt.c