From 8cef2ca2598cfd0587faf29d0025d68c7dc598ea Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 12 Nov 2017 16:16:33 +0100 Subject: m + add readme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- isutf8.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'isutf8.c') diff --git a/isutf8.c b/isutf8.c index 5f63a49..1e87519 100644 --- a/isutf8.c +++ b/isutf8.c @@ -29,7 +29,7 @@ libsimple_isutf8(const char *string, int allow_modified_nul) if ((c & 0xC0) == 0x80) /* Single-byte character marked as multibyte, or a non-first byte in a multibyte character. */ - return -1; + return 0; /* Multibyte character. */ while ((c & 0x80)) @@ -39,14 +39,14 @@ libsimple_isutf8(const char *string, int allow_modified_nul) if (bytes > 6) /* 31-bit characters can be encoded with 6-bytes, and UTF-8 does not cover higher code points. */ - return -1; + return 0; } else { /* Not first byte of the character. */ if ((c & 0xC0) != 0x80) /* Beginning of new character before a multibyte character has ended. */ - return -1; + return 0; character = (character << 6) | (c & 0x7F); @@ -59,7 +59,7 @@ libsimple_isutf8(const char *string, int allow_modified_nul) character >>= 1, bits++; bits = (!bits && bytes == 2 && allow_modified_nul) ? 8 : bits; if (bits < BYTES_TO_MIN_BITS[bytes] || BYTES_TO_MAX_BITS[bytes] < bits) - return -1; + return 0; read_bytes = bytes = bits = 0; } -- cgit v1.2.3-70-g09d2