summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-07-05 00:57:42 +0000
committerAndrew Tridgell <tridge@samba.org>2001-07-05 00:57:42 +0000
commitfb50cf54e58ea99fd0788a540f7b86d2ba7e36b8 (patch)
treeade19e3eac944464344f5096c00467e7aac1398f
parentee3119cee66ec58896cada0ca5998faff05387bd (diff)
downloadsamba-fb50cf54e58ea99fd0788a540f7b86d2ba7e36b8.tar.gz
samba-fb50cf54e58ea99fd0788a540f7b86d2ba7e36b8.tar.bz2
samba-fb50cf54e58ea99fd0788a540f7b86d2ba7e36b8.zip
optimised the 7 bit case for utf8 conversion
(This used to be commit 0c61e54f152eca6b7607fcce9ea512bc60a19060)
-rw-r--r--source3/lib/iconv.c8
1 files changed, 4 insertions, 4 deletions
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;