From fb50cf54e58ea99fd0788a540f7b86d2ba7e36b8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 5 Jul 2001 00:57:42 +0000 Subject: optimised the 7 bit case for utf8 conversion (This used to be commit 0c61e54f152eca6b7607fcce9ea512bc60a19060) --- source3/lib/iconv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c index a5a7a847b5..07d42eed8f 100644 --- a/source3/lib/iconv.c +++ b/source3/lib/iconv.c @@ -368,7 +368,10 @@ static size_t utf8_pull(char **inbuf, size_t *inbytesleft, unsigned char *uc = (unsigned char *)*outbuf; int len = 1; - if ((c[0] & 0xf0) == 0xe0) { + if ((c[0] & 0x80) == 0) { + uc[0] = c[0]; + uc[1] = 0; + } else if ((c[0] & 0xf0) == 0xe0) { if (*inbytesleft < 3) { DEBUG(0,("short utf8 char\n")); goto badseq; @@ -384,9 +387,6 @@ static size_t utf8_pull(char **inbuf, size_t *inbytesleft, uc[1] = (c[0]>>2) & 0x7; uc[0] = (c[0]<<6) | (c[1]&0x3f); len = 2; - } else { - uc[0] = c[0]; - uc[1] = 0; } (*inbuf) += len; -- cgit