delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
X-Trace-PostClient-IP: | 68.147.225.57 |
From: | Brian Inglis <Brian DOT Inglis AT SystematicSW DOT Invalid> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Bug in mbstowcs() in DJGPP's C library |
Organization: | Systematic Software |
Message-ID: | <33k383ptj4ch90bdt8fs8jiakcjovmojef@4ax.com> |
References: | <ioF*uuQNr AT news DOT chiark DOT greenend DOT org DOT uk> <86pabupynhr DOT fsf AT sirppi DOT helsinki DOT fi> |
X-Newsreader: | Forte Agent 1.93/32.576 English (American) |
MIME-Version: | 1.0 |
Lines: | 39 |
Date: | Wed, 27 Jun 2007 03:00:26 GMT |
NNTP-Posting-Host: | 64.59.135.176 |
X-Complaints-To: | abuse AT shaw DOT ca |
X-Trace: | pd7urf3no 1182913226 64.59.135.176 (Tue, 26 Jun 2007 21:00:26 MDT) |
NNTP-Posting-Date: | Tue, 26 Jun 2007 21:00:26 MDT |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
fOn 25 Jun 2007 01:52:00 +0300 in comp.os.msdos.djgpp, Esa A E Peuha <esa DOT peuha AT helsinki DOT fi> wrote: >Simon Tatham <anakin AT pobox DOT com> writes: > >> I believe mbstowcs() in DJGPP's C library is behaving incorrectly. >> It appears to be unwilling to fill its entire output buffer with >> non-zero wide characters, preferring to stop one character short of >> the end of the buffer > >That's correct. > >> and write a NUL. > >But this isn't; from the current source > >size_t >mbstowcs(wchar_t *wcs, const char *s, size_t n) >{ > size_t i; > for (i=0; (i+1<n) && s[i]; i++) > wcs[i] = s[i]; > if (i+1<n) > wcs[i] = 0; > return i; >} > >it's obvious that the function simply treats its numeric argument as >one less than it actually is. mbstowcs() should be using the support(ed) function mbtowc() to do wide character conversion to "do the right thing" and allow mbs and wcs support to be added to the lower level function in future. -- Thanks. Take care, Brian Inglis Calgary, Alberta, Canada Brian DOT Inglis AT CSi DOT com (Brian[dot]Inglis{at}SystematicSW[dot]ab[dot]ca) fake address use address above to reply
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |