This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
[lode.leroy: BUG: mbsrtowcs does not conform to spec]
- From: Christopher Faylor <cgf-no-personal-reply-please at cygwin dot com>
- To: newlib at sources dot redhat dot com
- Cc: lode dot leroy at advalvas dot be
- Date: Wed, 21 Jan 2004 10:02:04 -0500
- Subject: [lode.leroy: BUG: mbsrtowcs does not conform to spec]
- Reply-to: newlib at sourceware dot org
----- Forwarded message from lode.leroy
The spec says that mbsrtowcs() should return the length of the string
_even_when_the_output_buffer_is_NULL_ .
currently mbsrtowcs(NULL, ...) returns 0.
#include <stdio.h>
#include <wchar.h>
#include <string.h>
main()
{
int len;
char* s = "test";
mbstate_t mbstate;
memset(&mbstate, 0, sizeof(mbstate));
len = mbsrtowcs(NULL, (const char **)&s, 0, &mbstate);
printf("s='%s' - strlen(s)=%d - mbstowcs(s)=%d\n", s, strlen(s), len);
}
cygwin$ ./mbsrtowcs
s='test' - strlen(s)=4 - mbstowcs(s)=0
linux$ ./mbsrtowcs
s='test' - strlen(s)=4 - mbstowcs(s)=4
----------------------------------------------------------------------------------
Plaats je zoekertjes GRATIS op AdValvas
Placez votre petite annonce GRATUITEMENT sur AdValvas
http://www.advalvas.be
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
----- End forwarded message -----