fgetwc.c (b652778e426d00b6a1df29bbd86869db86f36e25) | fgetwc.c (d34d90a89d0d34657f1de602abb861bba1a571d8) |
---|---|
1/*- 2 * Copyright (c) 2002-2004 Tim J. Robbins. 3 * All rights reserved. 4 * 5 * Copyright (c) 2011 The FreeBSD Foundation 6 * All rights reserved. 7 * Portions of this software were developed by David Chisnall 8 * under sponsorship from the FreeBSD Foundation. --- 65 unchanged lines hidden (view full) --- 74 */ 75wint_t 76__fgetwc_mbs(FILE *fp, mbstate_t *mbs, int *nread, locale_t locale) 77{ 78 wchar_t wc; 79 size_t nconv; 80 struct xlocale_ctype *l = XLOCALE_CTYPE(locale); 81 | 1/*- 2 * Copyright (c) 2002-2004 Tim J. Robbins. 3 * All rights reserved. 4 * 5 * Copyright (c) 2011 The FreeBSD Foundation 6 * All rights reserved. 7 * Portions of this software were developed by David Chisnall 8 * under sponsorship from the FreeBSD Foundation. --- 65 unchanged lines hidden (view full) --- 74 */ 75wint_t 76__fgetwc_mbs(FILE *fp, mbstate_t *mbs, int *nread, locale_t locale) 77{ 78 wchar_t wc; 79 size_t nconv; 80 struct xlocale_ctype *l = XLOCALE_CTYPE(locale); 81 |
82 if (fp->_r <= 0 && __srefill(fp)) { 83 *nread = 0; 84 return (WEOF); 85 } 86 if (MB_CUR_MAX == 1) { 87 /* Fast path for single-byte encodings. */ 88 wc = *fp->_p++; 89 fp->_r--; 90 *nread = 1; 91 return (wc); 92 } | |
93 *nread = 0; | 82 *nread = 0; |
83 if (fp->_r <= 0 && __srefill(fp)) 84 return (WEOF); |
|
94 do { 95 nconv = l->__mbrtowc(&wc, fp->_p, fp->_r, mbs); 96 if (nconv == (size_t)-1) 97 break; 98 else if (nconv == (size_t)-2) 99 continue; 100 else if (nconv == 0) { 101 fp->_p++; --- 14 unchanged lines hidden --- | 85 do { 86 nconv = l->__mbrtowc(&wc, fp->_p, fp->_r, mbs); 87 if (nconv == (size_t)-1) 88 break; 89 else if (nconv == (size_t)-2) 90 continue; 91 else if (nconv == 0) { 92 fp->_p++; --- 14 unchanged lines hidden --- |