diff options
author | Stef Walter <stef@thewalter.net> | 2004-04-25 23:55:49 +0000 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2004-04-25 23:55:49 +0000 |
commit | e0f1ee22b9aae014c8dcdf1ba98bbdaffb716b0d (patch) | |
tree | 1c08888d11ceb7d113f80c6ca12476a1379a5606 /src/unicode.c | |
parent | fe65c5925cc12d82a04c2517456848fee06b4bf2 (diff) |
Fixes. Updates
Diffstat (limited to 'src/unicode.c')
-rw-r--r-- | src/unicode.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/unicode.c b/src/unicode.c index f6197b6..b715a47 100644 --- a/src/unicode.c +++ b/src/unicode.c @@ -1,6 +1,6 @@ #include "usuals.h" -#include <wchar.h> +#include "ntfs.h" /* * Transcode UCS2 to UTF8. @@ -9,13 +9,13 @@ * resulting length is unpredictable, this function * allocates it's own memory. */ -char* unicode_transcode16to8(const wchar_t* src, size_t len) +char* unicode_transcode16to8(const ntfs_char* src, size_t len) { char* ret = NULL; size_t alloc = 0; size_t pos = 0; - const wchar_t* c; - const wchar_t* e; + const ntfs_char* c; + const ntfs_char* e; /* Allocate 1.25 times the length initially */ alloc = len + (len / 4) + 1; @@ -67,7 +67,7 @@ char* unicode_transcode16to8(const wchar_t* src, size_t len) * Since a semi predictable length of the resulting data is * known, the caller should allocate the memory for this conversion. */ -wchar_t* unicode_transcode8to16(const char* src, wchar_t* out, size_t len) +ntfs_char* unicode_transcode8to16(const char* src, ntfs_char* out, size_t len) { /* Note: out should always be at least as long as src in chars */ @@ -91,10 +91,10 @@ wchar_t* unicode_transcode8to16(const char* src, wchar_t* out, size_t len) (c[2] & 0xC0) == 0x80 && (c[3] & 0xC0) == 0x80) { - out[pos++] = (wchar_t)(((wchar_t)c[0] & 7) << 18 | - ((wchar_t)c[1] & 63) << 12 | - ((wchar_t)c[2] & 63) << 6 | - ((wchar_t)c[3] & 63)); + out[pos++] = (ntfs_char)(((ntfs_char)c[0] & 7) << 18 | + ((ntfs_char)c[1] & 63) << 12 | + ((ntfs_char)c[2] & 63) << 6 | + ((ntfs_char)c[3] & 63)); c += 3; } @@ -104,9 +104,9 @@ wchar_t* unicode_transcode8to16(const char* src, wchar_t* out, size_t len) (c[1] & 0xC0) == 0x80 && (c[2] & 0xC0) == 0x80) { - out[pos++] = (wchar_t)(((wchar_t)c[0] & 15) << 12 | - ((wchar_t)c[1] & 63) << 6 | - ((wchar_t)c[2] & 63)); + out[pos++] = (ntfs_char)(((ntfs_char)c[0] & 15) << 12 | + ((ntfs_char)c[1] & 63) << 6 | + ((ntfs_char)c[2] & 63)); c += 2; } @@ -115,15 +115,15 @@ wchar_t* unicode_transcode8to16(const char* src, wchar_t* out, size_t len) (c[0] & 0xE0) == 0xC0 && (c[1] & 0xC0) == 0x80) { - out[pos++] = (wchar_t)(((wchar_t)c[0] & 31) << 6 | - ((wchar_t)c[1] & 63)); + out[pos++] = (ntfs_char)(((ntfs_char)c[0] & 31) << 6 | + ((ntfs_char)c[1] & 63)); c += 1; } /* First bit set */ else if(!(c[0] & 0x80)) { - out[pos++] = (wchar_t)c[0]; + out[pos++] = (ntfs_char)c[0]; } /* Invalid encoding */ |