wctob.c | wctob.c | |||
---|---|---|---|---|
/* Convert wide character to unibyte character. | /* Convert wide character to unibyte character. | |||
Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. | Copyright (C) 2008, 2010-2014 Free Software Foundation, Inc. | |||
Written by Bruno Haible <bruno@clisp.org>, 2008. | Written by Bruno Haible <bruno@clisp.org>, 2008. | |||
This program is free software: you can redistribute it and/or modify | This program is free software: you can redistribute it and/or modify | |||
it under the terms of the GNU General Public License as published by | it under the terms of the GNU General Public License as published by | |||
the Free Software Foundation; either version 3 of the License, or | the Free Software Foundation; either version 3 of the License, or | |||
(at your option) any later version. | (at your option) any later version. | |||
This program is distributed in the hope that it will be useful, | This program is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
skipping to change at line 33 | skipping to change at line 33 | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
int | int | |||
wctob (wint_t wc) | wctob (wint_t wc) | |||
{ | { | |||
char buf[64]; | char buf[64]; | |||
if (!(MB_CUR_MAX <= sizeof (buf))) | if (!(MB_CUR_MAX <= sizeof (buf))) | |||
abort (); | abort (); | |||
if (wctomb (buf, wc) == 1) | /* Handle the case where WEOF is a value that does not fit in a wchar_t. | |||
return (unsigned char) buf[0]; | */ | |||
else | if (wc == (wchar_t)wc) | |||
return EOF; | if (wctomb (buf, (wchar_t)wc) == 1) | |||
return (unsigned char) buf[0]; | ||||
return EOF; | ||||
} | } | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 7 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |