HEIMDAL:lib/wind: fix wind_ucs4utf8() and wind_ucs2utf8()
authorStefan Metzmacher <metze@samba.org>
Tue, 15 Nov 2011 14:57:10 +0000 (15:57 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 15 Nov 2011 23:26:41 +0000 (00:26 +0100)
Pair-Programmed-With: Arvid Requate <requate@univention.de>

metze

source4/heimdal/lib/wind/utf8.c

index 6907b3c9d3ab7bcd6994252520dd41cfb5e724b5..fce6defd822a4ee05d5de717c038d6060351bb3a 100644 (file)
@@ -204,13 +204,13 @@ wind_ucs4utf8(const uint32_t *in, size_t in_len, char *out, size_t *out_len)
            switch(len) {
            case 4:
                out[3] = (ch | 0x80) & 0xbf;
-               ch = ch << 6;
+               ch = ch >> 6;
            case 3:
                out[2] = (ch | 0x80) & 0xbf;
-               ch = ch << 6;
+               ch = ch >> 6;
            case 2:
                out[1] = (ch | 0x80) & 0xbf;
-               ch = ch << 6;
+               ch = ch >> 6;
            case 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) {
            case 3:
                out[2] = (ch | 0x80) & 0xbf;
-               ch = ch << 6;
+               ch = ch >> 6;
            case 2:
                out[1] = (ch | 0x80) & 0xbf;
-               ch = ch << 6;
+               ch = ch >> 6;
            case 1:
                out[0] = ch | first_char[len - 1];
            }