Subversion Repositories Kolibri OS

Rev

Rev 4874 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4874 Rev 4921
Line 40... Line 40...
40
}
40
}
Line 41... Line 41...
41
 
41
 
42
#ifndef _REENT_ONLY
42
#ifndef _REENT_ONLY
43
size_t
43
size_t
44
_DEFUN (wcrtomb, (s, wc, ps),
44
_DEFUN (wcrtomb, (s, wc, ps),
45
	char *s _AND
45
	char *__restrict s _AND
46
	wchar_t wc _AND
46
	wchar_t wc _AND
47
	mbstate_t *ps)
47
	mbstate_t *__restrict ps)
48
{
48
{
49
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
49
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
50
  return _wcrtomb_r (_REENT, s, wc, ps);
50
  return _wcrtomb_r (_REENT, s, wc, ps);
51
#else
51
#else
-
 
52
  int retval = 0;
52
  int retval = 0;
53
  struct _reent *reent = _REENT;
Line 53... Line 54...
53
  char buf[10];
54
  char buf[10];
54
 
55
 
55
#ifdef _MB_CAPABLE
56
#ifdef _MB_CAPABLE
56
  if (ps == NULL)
57
  if (ps == NULL)
57
    {
58
    {
58
      _REENT_CHECK_MISC(_REENT);
59
      _REENT_CHECK_MISC(reent);
59
      ps = &(_REENT_WCRTOMB_STATE(_REENT));
60
      ps = &(_REENT_WCRTOMB_STATE(reent));
Line 60... Line 61...
60
    }
61
    }
61
#endif
62
#endif
62
 
63
 
63
  if (s == NULL)
64
  if (s == NULL)
Line 64... Line 65...
64
    retval = __wctomb (_REENT, buf, L'\0', __locale_charset (), ps);
65
    retval = __wctomb (reent, buf, L'\0', __locale_charset (), ps);
65
  else
66
  else
66
    retval = __wctomb (_REENT, s, wc, __locale_charset (), ps);
67
    retval = __wctomb (reent, s, wc, __locale_charset (), ps);
67
 
68
 
68
  if (retval == -1)
69
  if (retval == -1)
69
    {
70
    {
70
      ps->__count = 0;
71
      ps->__count = 0;
71
      _REENT->_errno = EILSEQ;
72
      reent->_errno = EILSEQ;
72
      return (size_t)(-1);
73
      return (size_t)(-1);