100 for (p =
string; *p != 0; p++);
104 for (p =
string; length-- > 0; p++)
108 if (c < 128)
continue;
109 if (c < 0xc0)
return p - string;
111 if (ab > 3)
return p - string;
112 if (length < ab)
return p + 1 + length - string;
116 if ((*(++p) & 0xc0) != 0x80)
return p - string;
126 if ((c & 0x3e) == 0)
return p - string;
133 if ((c == 0xe0 && (*p & 0x20) == 0) ||
134 (c == 0xed && *p >= 0xa0))
142 if ((c == 0xf0 && (*p & 0x30) == 0) ||
144 (c == 0xf4 && *p > 0x8f))
155 if (c == 0xf8 && (*p & 0x38) == 0)
return p - string;
160 if (c == 0xfe || c == 0xff ||
161 (c == 0xfc && (*p & 0x3c) == 0))
return p - string;
170 if ((*(++p) & 0xc0) != 0x80)
return p - string;