fgetwc.c (fcc51917875e7f6d7d620c6a3e8268dcc6306baf) | fgetwc.c (f9ceea9bf17bc8d7b0020c409743f162c3c5eebd) |
---|---|
1/*- 2 * Copyright (c) 2002-2004 Tim J. Robbins. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 21 unchanged lines hidden (view full) --- 30#include "namespace.h" 31#include <errno.h> 32#include <stdio.h> 33#include <stdlib.h> 34#include <wchar.h> 35#include "un-namespace.h" 36#include "libc_private.h" 37#include "local.h" | 1/*- 2 * Copyright (c) 2002-2004 Tim J. Robbins. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 21 unchanged lines hidden (view full) --- 30#include "namespace.h" 31#include <errno.h> 32#include <stdio.h> 33#include <stdlib.h> 34#include <wchar.h> 35#include "un-namespace.h" 36#include "libc_private.h" 37#include "local.h" |
38#include "mblocal.h" |
|
38 39/* 40 * MT-safe version. 41 */ 42wint_t 43fgetwc(FILE *fp) 44{ 45 wint_t r; --- 19 unchanged lines hidden (view full) --- 65 return (WEOF); 66 if (MB_CUR_MAX == 1) { 67 /* Fast path for single-byte encodings. */ 68 wc = *fp->_p++; 69 fp->_r--; 70 return (wc); 71 } 72 do { | 39 40/* 41 * MT-safe version. 42 */ 43wint_t 44fgetwc(FILE *fp) 45{ 46 wint_t r; --- 19 unchanged lines hidden (view full) --- 66 return (WEOF); 67 if (MB_CUR_MAX == 1) { 68 /* Fast path for single-byte encodings. */ 69 wc = *fp->_p++; 70 fp->_r--; 71 return (wc); 72 } 73 do { |
73 nconv = mbrtowc(&wc, fp->_p, fp->_r, &fp->_extra->mbstate); | 74 nconv = __mbrtowc(&wc, fp->_p, fp->_r, &fp->_extra->mbstate); |
74 if (nconv == (size_t)-1) 75 break; 76 else if (nconv == (size_t)-2) 77 continue; 78 else if (nconv == 0) { 79 /* 80 * Assume that the only valid representation of 81 * the null wide character is a single null byte. --- 14 unchanged lines hidden --- | 75 if (nconv == (size_t)-1) 76 break; 77 else if (nconv == (size_t)-2) 78 continue; 79 else if (nconv == 0) { 80 /* 81 * Assume that the only valid representation of 82 * the null wide character is a single null byte. --- 14 unchanged lines hidden --- |