mirror of
https://sourceware.org/git/glibc.git
synced 2025-12-24 17:51:17 +03:00
Update.
1998-04-21 19:05 Ulrich Drepper <drepper@cygnus.com> * iconv/gconv.h (struct gconv_step): Add element stateful. * iconv/gconv_builtin.c (__gconv_builtin_trans): Initialize stateful to zero for all internal conversions. * iconv/skeleton.c: Initialize stateful depending on whether or not RESET_STATE is defined to one or zero respectively. * stdlib/mblen.c: Use stateful element of currently selected converter for result if S is NULL. * stdlib/mbtowc.c: Likewise. * stdlib/wctomb.c: Likewise.
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include <gconv.h>
|
||||
#include <wcsmbs/wcsmbsload.h>
|
||||
|
||||
|
||||
/* Common state for all non-restartable conversion functions. */
|
||||
@@ -38,12 +40,14 @@ mbtowc (wchar_t *pwc, const char *s, size_t n)
|
||||
|
||||
/* If S is NULL the function has to return null or not null
|
||||
depending on the encoding having a state depending encoding or
|
||||
not. This is nonsense because any multibyte encoding has a
|
||||
state. The ISO C amendment 1 corrects this while introducing the
|
||||
restartable functions. We simply say here all encodings have a
|
||||
state. */
|
||||
not. */
|
||||
if (s == NULL)
|
||||
result = 1;
|
||||
{
|
||||
/* Make sure we use the correct value. */
|
||||
update_conversion_ptrs ();
|
||||
|
||||
result = __wcsmbs_gconv_fcts.towc->stateful;
|
||||
}
|
||||
else if (*s == '\0')
|
||||
{
|
||||
if (pwc != NULL)
|
||||
|
||||
Reference in New Issue
Block a user