Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib/wctomb_r.c')
-rw-r--r--newlib/libc/stdlib/wctomb_r.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/newlib/libc/stdlib/wctomb_r.c b/newlib/libc/stdlib/wctomb_r.c
index 7cd84b6fa..4bcabee5d 100644
--- a/newlib/libc/stdlib/wctomb_r.c
+++ b/newlib/libc/stdlib/wctomb_r.c
@@ -4,6 +4,9 @@
#include <locale.h>
#include "mbctype.h"
+/* for some conversions, we use the __count field as a place to store a state value */
+#define __state __count
+
int
_DEFUN (_wctomb_r, (r, s, wchar, state),
struct _reent *r _AND
@@ -126,10 +129,10 @@ _DEFUN (_wctomb_r, (r, s, wchar, state),
/* first byte is non-zero..validate multi-byte char */
if (_isjis (char1) && _isjis (char2))
{
- if (state->__count == 0)
+ if (state->__state == 0)
{
/* must switch from ASCII to JIS state */
- state->__count = 1;
+ state->__state = 1;
*s++ = ESC_CHAR;
*s++ = '$';
*s++ = 'B';
@@ -144,10 +147,10 @@ _DEFUN (_wctomb_r, (r, s, wchar, state),
}
else
{
- if (state->__count != 0)
+ if (state->__state != 0)
{
/* must switch from JIS to ASCII state */
- state->__count = 0;
+ state->__state = 0;
*s++ = ESC_CHAR;
*s++ = '(';
*s++ = 'B';