From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20830 invoked from network); 22 Feb 2005 10:48:53 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 22 Feb 2005 10:48:53 -0000 Received: (qmail 35128 invoked from network); 22 Feb 2005 10:48:45 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 22 Feb 2005 10:48:45 -0000 Received: (qmail 17528 invoked by alias); 22 Feb 2005 10:48:43 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20840 Received: (qmail 17513 invoked from network); 22 Feb 2005 10:48:42 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 22 Feb 2005 10:48:42 -0000 Received: (qmail 34854 invoked from network); 22 Feb 2005 10:48:42 -0000 Received: from mailhost1.csr.com (HELO MAILSWEEPER01.csr.com) (81.105.217.43) by a.mx.sunsite.dk with SMTP; 22 Feb 2005 10:48:31 -0000 Received: from exchange03.csr.com (unverified [10.100.137.60]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Tue, 22 Feb 2005 10:47:02 +0000 Received: from news01.csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 22 Feb 2005 10:49:23 +0000 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.1/8.12.11) with ESMTP id j1MAmcc1006268 for ; Tue, 22 Feb 2005 10:48:38 GMT Received: from csr.com (pws@localhost) by news01.csr.com (8.13.1/8.13.1/Submit) with ESMTP id j1MAmcQa006265 for ; Tue, 22 Feb 2005 10:48:38 GMT Message-Id: <200502221048.j1MAmcQa006265@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk Subject: Re: Latest CVS + ZLE_UNICODE_SUPPORT on RHEL3 In-reply-to: <200502221012.j1MACuEe005779@news01.csr.com> References: <20050221133700.27647.qmail@flock1.newmail.ru> <200502211429.j1LETYIr015931@news01.csr.com> <200502212213.28160.arvidjaar@newmail.ru> <200502221012.j1MACuEe005779@news01.csr.com> Date: Tue, 22 Feb 2005 10:48:38 +0000 From: Peter Stephenson X-OriginalArrivalTime: 22 Feb 2005 10:49:23.0810 (UTC) FILETIME=[2BDB1420:01C518CC] X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.5 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.5 Peter Stephenson wrote: > Andrey Borzenkov wrote: > > Oh, and for some reasons mbrtowc(&outchar, &cnull, 1, &ps) segfaulted on me > > (Mandrake cooker). > > Hmmm... that was the only way I could see to ensure the shift state was > initialised. The documentation suggested ps was otherwise assumed to be > valid, which it can't be for the first character. However, I may be > missing the intention. I looked further. The glibc documentation says An mbstate_t object a can be initialized to the initial state by zeroing it, for example using memset(&a, 0, sizeof(a)); but the standard gives no indication this is portable (though clearly it would be a perfectly acceptable extension). The standard does refer obscurely to a "zero-valued mbstate_t" object in the documentation for mbsinit() (which, maddeningly, tests whether the object is in the initial state but doesn't set it). However, that's not the same thing as saying you can memset() an mbstate_t value to zero --- for example, a zero-valued floating point number is not necessarily represented by a set of zero bytes. Still, maybe that's the best we're going to get? Alternatively, since we're not going to be using this in multiple threads, we could use a NULL pointer and rely on the internal state. However, I would then be worried about what happened after we'd read an invalid character; we might end up screwing up input permanently. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. **********************************************************************