summaryrefslogtreecommitdiff
path: root/enc/trans/utf_16_32.c
diff options
context:
space:
mode:
Diffstat (limited to 'enc/trans/utf_16_32.c')
-rw-r--r--enc/trans/utf_16_32.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/enc/trans/utf_16_32.c b/enc/trans/utf_16_32.c
index 1eb04c1519..0247e5dce6 100644
--- a/enc/trans/utf_16_32.c
+++ b/enc/trans/utf_16_32.c
@@ -12,21 +12,21 @@ fun_so_from_utf_16be(const unsigned char* s, unsigned char* o)
}
else if (s[0]<0x08) {
o[0] = 0xC0 | (s[0]<<2) | (s[1]>>6);
- o[1] = 0x80 | s[1]&0x3F;
+ o[1] = 0x80 | (s[1]&0x3F);
return 2;
}
else if ((s[0]&0xF8)!=0xD8) {
o[0] = 0xE0 | s[0]>>4;
o[1] = 0x80 | ((s[0]&0x0F)<<2) | (s[1]>>6);
- o[2] = 0x80 | s[1]&0x3F;
+ o[2] = 0x80 | (s[1]&0x3F);
return 3;
}
else {
unsigned int u = (((s[0]&0x03)<<2)|(s[1]>>6)) + 1;
o[0] = 0xF0 | u>>2;
- o[1] = 0x80 | ((u&0x03)<<4) | (s[1]>>2)&0x0F;
+ o[1] = 0x80 | ((u&0x03)<<4) | ((s[1]>>2)&0x0F);
o[2] = 0x80 | ((s[1]&0x03)<<4) | ((s[2]&0x03)<<2) | (s[3]>>6);
- o[3] = 0x80 | s[3]&0x3F;
+ o[3] = 0x80 | (s[3]&0x3F);
return 4;
}
}
@@ -41,16 +41,16 @@ fun_so_to_utf_16be(const unsigned char* s, unsigned char* o)
}
else if ((s[0]&0xE0)==0xC0) {
o[0] = (s[0]>>2)&0x07;
- o[1] = ((s[0]&0x03)<<6) | s[1]&0x3F;
+ o[1] = ((s[0]&0x03)<<6) | (s[1]&0x3F);
return 2;
}
else if ((s[0]&0xF0)==0xE0) {
- o[0] = (s[0]<<4) | (s[1]>>2)^0x20;
- o[1] = (s[1]<<6) | s[2]^0x80;
+ o[0] = (s[0]<<4) | ((s[1]>>2)^0x20);
+ o[1] = (s[1]<<6) | (s[2]^0x80);
return 2;
}
else {
- int w = (((s[0]&0x07)<<2) | (s[1]>>4)&0x03) - 1;
+ int w = (((s[0]&0x07)<<2) | ((s[1]>>4)&0x03)) - 1;
o[0] = 0xD8 | (w>>2);
o[1] = (w<<6) | ((s[1]&0x0F)<<2) | ((s[2]>>4)-8);
o[2] = 0xDC | ((s[2]>>2)&0x03);
@@ -68,21 +68,21 @@ fun_so_from_utf_16le(const unsigned char* s, unsigned char* o)
}
else if (s[1]<0x08) {
o[0] = 0xC0 | (s[1]<<2) | (s[0]>>6);
- o[1] = 0x80 | s[0]&0x3F;
+ o[1] = 0x80 | (s[0]&0x3F);
return 2;
}
else if ((s[1]&0xF8)!=0xD8) {
o[0] = 0xE0 | s[1]>>4;
o[1] = 0x80 | ((s[1]&0x0F)<<2) | (s[0]>>6);
- o[2] = 0x80 | s[0]&0x3F;
+ o[2] = 0x80 | (s[0]&0x3F);
return 3;
}
else {
unsigned int u = (((s[1]&0x03)<<2)|(s[0]>>6)) + 1;
o[0] = 0xF0 | u>>2;
- o[1] = 0x80 | ((u&0x03)<<4) | (s[0]>>2)&0x0F;
+ o[1] = 0x80 | ((u&0x03)<<4) | ((s[0]>>2)&0x0F);
o[2] = 0x80 | ((s[0]&0x03)<<4) | ((s[3]&0x03)<<2) | (s[2]>>6);
- o[3] = 0x80 | s[2]&0x3F;
+ o[3] = 0x80 | (s[2]&0x3F);
return 4;
}
}
@@ -97,16 +97,16 @@ fun_so_to_utf_16le(const unsigned char* s, unsigned char* o)
}
else if ((s[0]&0xE0)==0xC0) {
o[1] = (s[0]>>2)&0x07;
- o[0] = ((s[0]&0x03)<<6) | s[1]&0x3F;
+ o[0] = ((s[0]&0x03)<<6) | (s[1]&0x3F);
return 2;
}
else if ((s[0]&0xF0)==0xE0) {
- o[1] = (s[0]<<4) | (s[1]>>2)^0x20;
- o[0] = (s[1]<<6) | s[2]^0x80;
+ o[1] = (s[0]<<4) | ((s[1]>>2)^0x20);
+ o[0] = (s[1]<<6) | (s[2]^0x80);
return 2;
}
else {
- int w = (((s[0]&0x07)<<2) | (s[1]>>4)&0x03) - 1;
+ int w = (((s[0]&0x07)<<2) | ((s[1]>>4)&0x03)) - 1;
o[1] = 0xD8 | (w>>2);
o[0] = (w<<6) | ((s[1]&0x0F)<<2) | ((s[2]>>4)-8);
o[3] = 0xDC | ((s[2]>>2)&0x03);