Changeset View
Changeset View
Standalone View
Standalone View
head/lib/libedit/read.c
Show First 20 Lines • Show All 357 Lines • ▼ Show 20 Lines | case (size_t)-1: | ||||
cbp = 0; | cbp = 0; | ||||
break; | break; | ||||
} else { | } else { | ||||
/* Invalid byte, discard it. */ | /* Invalid byte, discard it. */ | ||||
cbp = 0; | cbp = 0; | ||||
goto again; | goto again; | ||||
} | } | ||||
case (size_t)-2: | case (size_t)-2: | ||||
/* | if (cbp >= MB_LEN_MAX) { | ||||
* We don't support other multibyte charsets. | |||||
* The second condition shouldn't happen | |||||
* and is here merely for additional safety. | |||||
*/ | |||||
if ((el->el_flags & CHARSET_IS_UTF8) == 0 || | |||||
cbp >= MB_LEN_MAX) { | |||||
errno = EILSEQ; | errno = EILSEQ; | ||||
*cp = L'\0'; | *cp = L'\0'; | ||||
return -1; | return -1; | ||||
} | } | ||||
/* Incomplete sequence, read another byte. */ | /* Incomplete sequence, read another byte. */ | ||||
goto again; | goto again; | ||||
default: | default: | ||||
/* Valid character, process it. */ | /* Valid character, process it. */ | ||||
▲ Show 20 Lines • Show All 359 Lines • Show Last 20 Lines |