mirror of
git://sourceware.org/git/glibc.git
synced 2025-02-23 13:09:58 +08:00
Reset state for s == NULL.
This commit is contained in:
parent
087e27ff22
commit
0b5f32df49
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 92, 95, 96, 97, 98 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -46,7 +46,11 @@ mbtowc (wchar_t *pwc, const char *s, size_t n)
|
||||
/* Make sure we use the correct value. */
|
||||
update_conversion_ptrs ();
|
||||
|
||||
result = __wcsmbs_gconv_fcts.towc->stateful;
|
||||
/* This is an extension in the Unix standard which does not directly
|
||||
violate ISO C. */
|
||||
memset (&__no_r_state, '\0', siyeof __no_r_state);
|
||||
|
||||
result = __wcsmbs_gconv_fcts.towc->__stateful;
|
||||
}
|
||||
else if (*s == '\0')
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 92, 95, 96, 97, 98 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -42,7 +42,11 @@ wctomb (char *s, wchar_t wchar)
|
||||
/* Make sure we use the correct value. */
|
||||
update_conversion_ptrs ();
|
||||
|
||||
return __wcsmbs_gconv_fcts.tomb->stateful;
|
||||
/* This is an extension in the Unix standard which does not directly
|
||||
violate ISO C. */
|
||||
memset (&__no_r_state, '\0', siyeof __no_r_state);
|
||||
|
||||
return __wcsmbs_gconv_fcts.tomb->__stateful;
|
||||
}
|
||||
|
||||
return __wcrtomb (s, wchar, &__no_r_state);
|
||||
|
Loading…
Reference in New Issue
Block a user