Logo Search packages:      
Sourcecode: fuse-umfuse-fat version File versions  Download package

int unicode_utf16le_to_wchar ( wchar_t *restrict  result,
const uint16_t *restrict  string,
size_t  size 

UTF-16LE to wide character.

result where to store the converted wide character;
string buffer containing the UTF-16 character to convert;
size max number of uint16_t units of string to examine;
Return values:
>0 the length in uint16_t units of the processed UTF-16 character, the wide character is stored in result;
-EILSEQ invalid UTF-16 word sequence;
-ENAMETOOLONG size too small to parse the UTF-16 character.
This is the little endian version of unicode_utf16be_to_wchar()

Definition at line 69 of file utf16le.c.

      uint16_t v;
      if (!size) return -ENAMETOOLONG;
      v = little_endian_16(*string);
      if ((v & 0xFC00) != 0xD800)
            *result = (wchar_t) v;
            return 1;
      if (size < 2) return -ENAMETOOLONG;
      *result = ((v & 0x03FF) << 10) + 0x010000;
      v = little_endian_16(*(++string));
      if ((v & 0xFC00) != 0xDC00) return -EILSEQ;
      *result |= v & 0x03FF;
      return 2;

Generated by  Doxygen 1.6.0   Back to index