10bce321e4a7a970f482c5e6d603cb59557f4d84
[sven/exfat-utils.git] / debian / patches / utf16-fix
1 Applied upstream in r283.
2 http://code.google.com/p/exfat/source/detail?r=283
3 Closes Debian bug #672898.
4 Thanks to Vladimir Serbinenko <phcoder@gmail.com>.
5 --- a/libexfat/utf.c
6 +++ b/libexfat/utf.c
7 @@ -89,6 +89,7 @@ static const le16_t* utf16_to_wchar(cons
8                         return NULL;
9                 *wc = ((wchar_t) (le16_to_cpu(input[0]) & 0x3ff) << 10);
10                 *wc |= (le16_to_cpu(input[1]) & 0x3ff);
11 +               *wc += 0x10000;
12                 return input + 2;
13         }
14         else
15 @@ -186,6 +187,7 @@ static le16_t* wchar_to_utf16(le16_t* ou
16         }
17         if (outsize < 2)
18                 return NULL;
19 +       wc -= 0x10000;
20         output[0] = cpu_to_le16(0xd800 | ((wc >> 10) & 0x3ff));
21         output[1] = cpu_to_le16(0xdc00 | (wc & 0x3ff));
22         return output + 2;