summaryrefslogtreecommitdiff
path: root/fs/exfat/utf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exfat/utf.c')
-rw-r--r--fs/exfat/utf.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/exfat/utf.c b/fs/exfat/utf.c
index b1d09e76478..8a28e7621ca 100644
--- a/fs/exfat/utf.c
+++ b/fs/exfat/utf.c
@@ -23,7 +23,7 @@
#include "exfat.h"
#include <errno.h>
-static char* wchar_to_utf8(char* output, wchar_t wc, size_t outsize)
+static char* wchar_to_utf8(char* output, u32 wc, size_t outsize)
{
if (wc <= 0x7f)
{
@@ -82,14 +82,14 @@ static char* wchar_to_utf8(char* output, wchar_t wc, size_t outsize)
return output;
}
-static const le16_t* utf16_to_wchar(const le16_t* input, wchar_t* wc,
+static const le16_t* utf16_to_wchar(const le16_t* input, u32* wc,
size_t insize)
{
if ((le16_to_cpu(input[0]) & 0xfc00) == 0xd800)
{
if (insize < 2 || (le16_to_cpu(input[1]) & 0xfc00) != 0xdc00)
return NULL;
- *wc = ((wchar_t) (le16_to_cpu(input[0]) & 0x3ff) << 10);
+ *wc = ((u32) (le16_to_cpu(input[0]) & 0x3ff) << 10);
*wc |= (le16_to_cpu(input[1]) & 0x3ff);
*wc += 0x10000;
return input + 2;
@@ -108,7 +108,7 @@ int exfat_utf16_to_utf8(char* output, const le16_t* input, size_t outsize,
const le16_t* iend = input + insize;
char* optr = output;
const char* oend = output + outsize;
- wchar_t wc;
+ u32 wc;
while (iptr < iend)
{
@@ -136,7 +136,7 @@ int exfat_utf16_to_utf8(char* output, const le16_t* input, size_t outsize,
return 0;
}
-static const char* utf8_to_wchar(const char* input, wchar_t* wc,
+static const char* utf8_to_wchar(const char* input, u32* wc,
size_t insize)
{
size_t size;
@@ -147,32 +147,32 @@ static const char* utf8_to_wchar(const char* input, wchar_t* wc,
if ((input[0] & 0x80) == 0)
{
- *wc = (wchar_t) input[0];
+ *wc = (u32) input[0];
return input + 1;
}
else if ((input[0] & 0xe0) == 0xc0)
{
- *wc = ((wchar_t) input[0] & 0x1f) << 6;
+ *wc = ((u32) input[0] & 0x1f) << 6;
size = 2;
}
else if ((input[0] & 0xf0) == 0xe0)
{
- *wc = ((wchar_t) input[0] & 0x0f) << 12;
+ *wc = ((u32) input[0] & 0x0f) << 12;
size = 3;
}
else if ((input[0] & 0xf8) == 0xf0)
{
- *wc = ((wchar_t) input[0] & 0x07) << 18;
+ *wc = ((u32) input[0] & 0x07) << 18;
size = 4;
}
else if ((input[0] & 0xfc) == 0xf8)
{
- *wc = ((wchar_t) input[0] & 0x03) << 24;
+ *wc = ((u32) input[0] & 0x03) << 24;
size = 5;
}
else if ((input[0] & 0xfe) == 0xfc)
{
- *wc = ((wchar_t) input[0] & 0x01) << 30;
+ *wc = ((u32) input[0] & 0x01) << 30;
size = 6;
}
else
@@ -192,7 +192,7 @@ static const char* utf8_to_wchar(const char* input, wchar_t* wc,
return input + size;
}
-static le16_t* wchar_to_utf16(le16_t* output, wchar_t wc, size_t outsize)
+static le16_t* wchar_to_utf16(le16_t* output, u32 wc, size_t outsize)
{
if (wc <= 0xffff) /* if character is from BMP */
{
@@ -216,7 +216,7 @@ int exfat_utf8_to_utf16(le16_t* output, const char* input, size_t outsize,
const char* iend = input + insize;
le16_t* optr = output;
const le16_t* oend = output + outsize;
- wchar_t wc;
+ u32 wc;
while (iptr < iend)
{