- if (c < 0x80) /* Includes EOF */
- return c;
- if (c < 0xc0) /* Incorrect combination */
- return UNI_REPLACEMENT;
- if (c >= 0xf0) /* Too large, skip it */
- {
- while ((c = bgetc(b)) >= 0x80 && c < 0xc0)
- ;
- goto wrong;
- }
- if (c >= 0xe0) /* 3 bytes */
- {
- code = c & 0x0f;
- if ((c = bgetc(b)) < 0x80 || c >= 0xc0)
- goto wrong;
- code = (code << 6) | (c & 0x3f);
- if ((c = bgetc(b)) < 0x80 || c >= 0xc0)
- goto wrong;
- code = (code << 6) | (c & 0x3f);
- }
- else /* 2 bytes */