X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Sun, 2 May 2010 13:51:17 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: wctob function overwrites caller-owned register Message-ID: <20100502115117.GG1845@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <201005021243 DOT 16515 DOT bruno AT clisp DOT org> <20100502112837 DOT GD1845 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20100502112837.GD1845@calimero.vinschen.de> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On May 2 13:28, Corinna Vinschen wrote: > Thanks for the report. This is actually a newlib bug. I'm going to > replace the above function with: > [...] No, hang on. This function is a single big bug. Here's the replacement I'll check in: int wctob (wint_t wc) { mbstate_t mbs; unsigned char pmb[MB_LEN_MAX]; if (wc == WEOF) return EOF; /* Put mbs in initial state. */ memset (&mbs, '\0', sizeof (mbs)); _REENT_CHECK_MISC(_REENT); return __wctomb (_REENT, (char *) pmb, wc, __locale_charset (), &mbs) == 1 ? (int) pmb[0] : EOF; } Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple