From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 05/11] dialog: Patch incorrect use of toupper()
Date: Thu, 10 Apr 2014 11:44:31 +0200 [thread overview]
Message-ID: <534667FF.8050807@mind.be> (raw)
In-Reply-To: <CAAXf6LUcspf0U_GUd0X3QQd+3Qb_Gj_G0hq+MjPO5iLQ5Vw5Xg@mail.gmail.com>
On 10/04/14 10:40, Thomas De Schampheleire wrote:
> Hi,
>
> On Fri, Apr 4, 2014 at 8:45 AM, Arnout Vandecappelle <arnout@mind.be> wrote:
>> On 03/04/14 23:32, Yann E. MORIN wrote:
>>> Paul, All,
>>>
>>> On 2014-04-03 23:01 +0200, Paul Cercueil spake thusly:
[snip]
>>> However, this change is still corect, since it makes it explicit that we
>>> want an unsigned char.
>>
>> But then we should change all the packages that use toupper and
>> tolower... (and also isdigit and isalnum and ...).
>>
>> Basically, if toupper() asserts in this case, it's a bug in the
>> toolchain, not in the package.
>
> I wouldn't classify it as a bug in the toolchain, but rather as an
> unfortunate API choice in toupper and friends, or alternatively as an
> unfortunate failing of the C specification to explicitly define 'char'
> as being signed or unsigned.
Yeah, the bane of backward compatibility... Some of these functions
existed before there were prototypes in C.
Still, I'd say that not allowing a negative signed char value for these
functions is incorrect. uClibc at least _tries_ to handle it:
[libc/misc/ctype/ctype.c]
#ifdef __UCLIBC_HAS_CTYPE_SIGNED__
#if EOF >= CHAR_MIN
#define CTYPE_DOMAIN_CHECK(C) \
(((unsigned int)((C) - CHAR_MIN)) <= (UCHAR_MAX - CHAR_MIN))
#else
#define CTYPE_DOMAIN_CHECK(C) \
((((unsigned int)((C) - CHAR_MIN)) <= (UCHAR_MAX - CHAR_MIN)) ||
((C) == EOF))
#endif
#else /* __UCLIBC_HAS_CTYPE_SIGNED__ */
#if EOF == -1
#define CTYPE_DOMAIN_CHECK(C) \
(((unsigned int)((C) - EOF)) <= (UCHAR_MAX - EOF))
#else
#define CTYPE_DOMAIN_CHECK(C) \
((((unsigned int)(C)) <= UCHAR_MAX) || ((C) == EOF))
#endif
#endif /* __UCLIBC_HAS_CTYPE_SIGNED__ */
Regards,
Arnout
--
Arnout Vandecappelle arnout@mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
next prev parent reply other threads:[~2014-04-10 9:44 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-03 21:01 [Buildroot] [PATCH 01/11] toolchain: Make vendor configurable Paul Cercueil
2014-04-03 21:01 ` [Buildroot] [PATCH 02/11] arch: MIPS: Add config option BR2_GCC_TARGET_TUNE Paul Cercueil
2014-04-03 21:19 ` Yann E. MORIN
2014-04-03 21:50 ` Paul Cercueil
2014-04-03 22:12 ` Yann E. MORIN
2014-04-05 15:53 ` Paul Cercueil
2014-04-05 16:47 ` Yann E. MORIN
2014-04-07 13:53 ` Markos Chandras
2014-04-03 21:01 ` [Buildroot] [PATCH 03/11] gdb: Patch for "unrecognized real-time signal" bug Paul Cercueil
2014-10-12 14:06 ` Vincent Olivert Riera
2014-10-12 15:57 ` Thomas Petazzoni
2014-04-03 21:01 ` [Buildroot] [PATCH 04/11] gdb: Fix on-target threads debugging Paul Cercueil
2014-04-03 21:23 ` Yann E. MORIN
2014-04-03 21:01 ` [Buildroot] [PATCH 05/11] dialog: Patch incorrect use of toupper() Paul Cercueil
2014-04-03 21:32 ` Yann E. MORIN
2014-04-04 6:45 ` Arnout Vandecappelle
2014-04-08 16:56 ` Paul Cercueil
2014-04-10 8:40 ` Thomas De Schampheleire
2014-04-10 9:44 ` Arnout Vandecappelle [this message]
2014-07-19 14:06 ` Thomas De Schampheleire
2014-08-15 23:00 ` Paul Cercueil
2014-04-03 21:01 ` [Buildroot] [PATCH 06/11] libao: Remove OSS plugin when ALSA is enabled Paul Cercueil
2014-04-03 21:37 ` Yann E. MORIN
2014-04-03 21:01 ` [Buildroot] [PATCH 07/11] fmtools: Switch to 2.x series Paul Cercueil
2014-04-03 21:45 ` Yann E. MORIN
2014-04-06 13:26 ` Thomas Petazzoni
2014-04-03 21:01 ` [Buildroot] [PATCH 08/11] python-pygame: Make installation of examples optional Paul Cercueil
2014-04-03 21:48 ` Yann E. MORIN
2014-04-04 6:14 ` Arnout Vandecappelle
2014-04-03 21:01 ` [Buildroot] [PATCH 09/11] util-linux: Add config switches for some more binaries Paul Cercueil
2014-04-03 21:55 ` Yann E. MORIN
2014-04-03 22:00 ` Paul Cercueil
2014-04-03 21:01 ` [Buildroot] [PATCH 10/11] luajit: Allow to build on Mips and Mipsel platforms Paul Cercueil
2014-04-04 21:41 ` Thomas Petazzoni
2014-04-03 21:01 ` [Buildroot] [PATCH 11/11] stress: Patch to fix documentation source Paul Cercueil
2014-04-03 21:12 ` [Buildroot] [PATCH 01/11] toolchain: Make vendor configurable Yann E. MORIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=534667FF.8050807@mind.be \
--to=arnout@mind.be \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox