From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7944 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Byte-based C locale, draft 2 Date: Tue, 16 Jun 2015 00:35:02 -0400 Message-ID: <20150616043502.GF1173@brightrain.aerifal.cx> References: <20150606214007.GA17398@brightrain.aerifal.cx> <20150607025025.GC17573@brightrain.aerifal.cx> <20150613070655.GJ17573@brightrain.aerifal.cx> <20150616042639.GE1173@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="+pHx0qQiF2pBVqBT" X-Trace: ger.gmane.org 1434429317 5558 80.91.229.3 (16 Jun 2015 04:35:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Jun 2015 04:35:17 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7957-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jun 16 06:35:17 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Z4iaj-0008Su-6y for gllmg-musl@m.gmane.org; Tue, 16 Jun 2015 06:35:17 +0200 Original-Received: (qmail 3816 invoked by uid 550); 16 Jun 2015 04:35:15 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 3796 invoked from network); 16 Jun 2015 04:35:15 -0000 Content-Disposition: inline In-Reply-To: <20150616042639.GE1173@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:7944 Archived-At: --+pHx0qQiF2pBVqBT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 16, 2015 at 12:26:39AM -0400, Rich Felker wrote: > On Sat, Jun 13, 2015 at 03:06:55AM -0400, Rich Felker wrote: > > diff --git a/src/multibyte/btowc.c b/src/multibyte/btowc.c > > index 9d2c3b1..8de060f 100644 > > --- a/src/multibyte/btowc.c > > +++ b/src/multibyte/btowc.c > > @@ -1,7 +1,10 @@ > > -#include > > #include > > +#include > > +#include "internal.h" > > > > wint_t btowc(int c) > > { > > - return c<128U ? c : EOF; > > + if (c < 128U) return c; > > + if (MB_CUR_MAX==1) return CODEUNIT(c); > > + return WEOF; > > } > > This was mildly buggy before the patch, and worse with it -- c==EOF > will no longer produce WEOF. Fixed the old bug and updating the patch. Updated version of this file's patch (against the fixed old code which I already committed) is attached. Rich --+pHx0qQiF2pBVqBT Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bytelocale_new_btowc.diff" diff --git a/src/multibyte/btowc.c b/src/multibyte/btowc.c index 29cb798..a7369a1 100644 --- a/src/multibyte/btowc.c +++ b/src/multibyte/btowc.c @@ -1,8 +1,11 @@ #include #include +#include +#include "internal.h" wint_t btowc(int c) { - c = (unsigned char)c; - return c<128U ? c : EOF; + if ((unsigned char)c < 128) return (unsigned char)c; + if (MB_CUR_MAX==1 && c!=EOF) return CODEUNIT(c); + return WEOF; } --+pHx0qQiF2pBVqBT--