lib/wind: fix wind_ucs4utf8() and wind_ucs2utf8()

Pair-Programmed-With: Arvid Requate <requate@univention.de>

metze

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
This commit is contained in:
Stefan Metzmacher
2011-11-15 15:57:10 +01:00
committed by Love Hornquist Astrand
parent 124eccf014
commit dcd34e5967

View File

@@ -204,13 +204,13 @@ wind_ucs4utf8(const uint32_t *in, size_t in_len, char *out, size_t *out_len)
switch(len) { switch(len) {
case 4: case 4:
out[3] = (ch | 0x80) & 0xbf; out[3] = (ch | 0x80) & 0xbf;
ch = ch << 6; ch = ch >> 6;
case 3: case 3:
out[2] = (ch | 0x80) & 0xbf; out[2] = (ch | 0x80) & 0xbf;
ch = ch << 6; ch = ch >> 6;
case 2: case 2:
out[1] = (ch | 0x80) & 0xbf; out[1] = (ch | 0x80) & 0xbf;
ch = ch << 6; ch = ch >> 6;
case 1: case 1:
out[0] = ch | first_char[len - 1]; out[0] = ch | first_char[len - 1];
} }
@@ -479,10 +479,10 @@ wind_ucs2utf8(const uint16_t *in, size_t in_len, char *out, size_t *out_len)
switch(len) { switch(len) {
case 3: case 3:
out[2] = (ch | 0x80) & 0xbf; out[2] = (ch | 0x80) & 0xbf;
ch = ch << 6; ch = ch >> 6;
case 2: case 2:
out[1] = (ch | 0x80) & 0xbf; out[1] = (ch | 0x80) & 0xbf;
ch = ch << 6; ch = ch >> 6;
case 1: case 1:
out[0] = ch | first_char[len - 1]; out[0] = ch | first_char[len - 1];
} }