summaryrefslogtreecommitdiff
path: root/xmlstring.c
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2004-10-13 08:57:08 +0000
committerMike Hommey <mh@glandium.org>2004-10-13 08:57:08 +0000
commit0732be88d054db33fa0ca479eab9988c8e6be42e (patch)
tree8b9cf70e04bd32115caebeb74cb0d841d1eced3b /xmlstring.c
parent09deb06614c3408ec0816a3c88920138bae2083c (diff)
downloadlibxml2-0732be88d054db33fa0ca479eab9988c8e6be42e.tar.gz
Load /tmp/tmp.zzO3vU/libxml2-2.6.14 intoupstream/2.6.14
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'xmlstring.c')
-rw-r--r--xmlstring.c12
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)