diff options
Diffstat (limited to 'xmlstring.c')
-rw-r--r-- | xmlstring.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/xmlstring.c b/xmlstring.c index 5f239df..65385fb 100644 --- a/xmlstring.c +++ b/xmlstring.c @@ -681,12 +681,14 @@ xmlUTF8Strlen(const xmlChar *utf) { /** * xmlGetUTF8Char: * @utf: a sequence of UTF-8 encoded bytes - * @len: a pointer to @bytes len + * @len: a pointer to the minimum number of bytes present in + * the sequence. This is used to assure the next character + * is completely contained within the sequence. * - * Read one UTF8 Char from @utf + * Read the first UTF8 character from @utf * - * Returns the char value or -1 in case of error, and updates *len with the - * number of bytes consumed + * Returns the char value or -1 in case of error, and sets *len to + * the actual number of bytes consumed (0 in case of error) */ int xmlGetUTF8Char(const unsigned char *utf, int *len) { @@ -773,7 +775,7 @@ xmlCheckUTF8(const unsigned char *utf) * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx valid 4-byte */ for (ix = 0; (c = utf[ix]);) { /* string is 0-terminated */ - if (c & 0x80) { /* 1-byte code, starts with 10 */ + if ((c & 0x80) == 0x00) { /* 1-byte code, starts with 10 */ ix++; } else if ((c & 0xe0) == 0xc0) {/* 2-byte code, starts with 110 */ if ((utf[ix+1] & 0xc0 ) != 0x80) |