You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2002/10/23 23:22:40 UTC

DO NOT REPLY [Bug 13909] New: - Use of non standard mbstowcs feature

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13909>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13909

Use of non standard mbstowcs feature

           Summary: Use of non standard mbstowcs feature
           Product: Xerces-C++
           Version: Nightly build (please specify the date)
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Build
        AssignedTo: xerces-c-dev@xml.apache.org
        ReportedBy: derhally@metrowerks.com


In the XercesLib Win32TransServices.cpp file, plus some other files, there is 
code that makes use of a non standard C99 feature.  Currently when using VC++ 
and GLibC, mbstowcs will return, when passed NULL for the destination parm, the 
number of wide characters that would have been converted if the destination 
param was valid.  In some of the recent C libraries, this functionality no 
longer is valid, and the return value is just zero.

Here is what the C99 standard says:

7.20.8.1 The mbstowcs function
Synopsis

#include <stdlib.h>
size_t mbstowcs(wchar_t * restrict pwcs, const char * restrict s, size_t n);

Description

2 The mbstowcs function converts a sequence of multibyte characters that
begins in the initial shift state from the array pointed to by s into a
sequence of corresponding wide characters and stores not more than n wide
characters into the array pointed to by pwcs. No multibyte characters that
follow a null character (which is converted into a null wide character) will
be examined or converted. Each multibyte character is converted as if by a
call to the mbtowc function, except that the conversion state of the mbtowc
function is not affected.

3 No more than n elements will be modified in the array pointed to by pwcs.
If copying takes place between objects that overlap, the behavior is
undefined.

Returns
4 If an invalid multibyte character is encountered, the mbstowcs function
returns (size_t)(-1). Otherwise, the mbstowcs function returns the number of
array elements modified, not including a terminating null wide character, if
any.258)

258) The array will not be null-terminated if the value returned is n.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org