X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <416096c60907280256k18d164cy7fcd976b6c32383f@mail.gmail.com> References: <416096c60907271456x5e8cb3f7y64433d542ec6cdcb AT mail DOT gmail DOT com> <20090728091413 DOT GJ18621 AT calimero DOT vinschen DOT de> <94b5b62d0907280250q3321f62ft6cc542367dbc68d2 AT mail DOT gmail DOT com> <416096c60907280256k18d164cy7fcd976b6c32383f AT mail DOT gmail DOT com> Date: Tue, 28 Jul 2009 07:06:02 -0300 Message-ID: <94b5b62d0907280306r28955d01g27c5ea5cc8dd9530@mail.gmail.com> Subject: Re: bug in mbrtowc? From: Pedro Izecksohn To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 To initialize wchar_t wc=3D(wchar_t)0; may also help. On Tue, Jul 28, 2009 at 6:56 AM, Andy Koppe wrote: > 2009/7/28 Pedro Izecksohn: >> =C2=A0The bug is in O.P.'s code as &s is not being passed to mbrtowc. > > From http://www.opengroup.org/onlinepubs/009695399/functions/mbrtowc.html: > "If ps is a null pointer, the mbrtowc() function shall use its own > internal mbstate_t object, which shall be initialized at program > start-up to the initial conversion state." > > The test also fails when passing &s instead. (I'd accidentally left in > the local mb_state.) > > Andy -- 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