| delorie.com/archives/browse.cgi | search |
| 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 <corinna-cygwin AT cygwin DOT com> |
| 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 |
| 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 |
| List-Id: | <cygwin.cygwin.com> |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| 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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |