make is_valid_unicode() catch more invalid Unicode
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3003 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
738893f9c7
commit
79d9795c80
|
@ -134,10 +134,10 @@ CVS code -
|
||||||
get_key_buffer(), check_statusblank(), nanogetstr(),
|
get_key_buffer(), check_statusblank(), nanogetstr(),
|
||||||
titlebar(), statusbar(), bottombars(), edit_refresh(),
|
titlebar(), statusbar(), bottombars(), edit_refresh(),
|
||||||
do_yesno(), and do_help(). (DLR)
|
do_yesno(), and do_help(). (DLR)
|
||||||
- Treat the Unicode characters D800-DFFF and FFFE-FFFF as
|
- Treat the Unicode characters D800-DFFF, FDD0-FDEF, and
|
||||||
invalid, since the C library's multibyte functions don't seem
|
xxFFFE-xxFFFF, as invalid, since the C library's multibyte
|
||||||
to. New function is_valid_unicode(); changes to mbrep() and
|
functions don't seem to. New function is_valid_unicode();
|
||||||
make_mbchar(). (DLR)
|
changes to mbrep() and make_mbchar(). (DLR)
|
||||||
- Store Unicode values in longs instead of ints, and cover the
|
- Store Unicode values in longs instead of ints, and cover the
|
||||||
entire range of Unicode. Changes to make_mbchar(),
|
entire range of Unicode. Changes to make_mbchar(),
|
||||||
is_valid_unicode(), parse_kbinput(), get_unicode_kbinput(),
|
is_valid_unicode(), parse_kbinput(), get_unicode_kbinput(),
|
||||||
|
|
|
@ -884,12 +884,12 @@ bool has_blank_mbchars(const char *s)
|
||||||
#endif /* !DISABLE_JUSTIFY */
|
#endif /* !DISABLE_JUSTIFY */
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
/* Return TRUE if wc is valid Unicode (i.e, it's not negative or in the
|
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
|
||||||
* ranges D800-DFFF or FFFE-FFFF), and FALSE otherwise. */
|
|
||||||
bool is_valid_unicode(wchar_t wc)
|
bool is_valid_unicode(wchar_t wc)
|
||||||
{
|
{
|
||||||
return (0 <= wc && (wc <= 0xD7FF || 0xE000 <= wc) && (wc <=
|
return ((0 <= wc && wc <= 0x10FFFF) && (wc <= 0xD7FF || 0xE000 <=
|
||||||
0xFFFD || 0x10000 <= wc));
|
wc) && (wc <= 0xFDCF || 0xFDF0 <= wc) && ((wc & 0xFFFF) <=
|
||||||
|
0xFFFD));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue