• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/minidlna/libid3tag-0.15.0b/

Lines Matching defs:utf16

19  * $Id: utf16.c,v 1.8 2003/04/19 00:14:33 rob Exp $
31 # include "utf16.h"
35 * NAME: utf16->length()
36 * DESCRIPTION: return the number of ucs4 chars represented by a utf16 string
38 id3_length_t id3_utf16_length(id3_utf16_t const *utf16)
42 while (*utf16) {
43 if (utf16[0] < 0xd800 || utf16[0] > 0xdfff)
45 else if (utf16[0] >= 0xd800 && utf16[0] <= 0xdbff &&
46 utf16[1] >= 0xdc00 && utf16[1] <= 0xdfff) {
48 ++utf16;
51 ++utf16;
58 * NAME: utf16->size()
59 * DESCRIPTION: return the encoding size of a utf16 string
61 id3_length_t id3_utf16_size(id3_utf16_t const *utf16)
63 id3_utf16_t const *ptr = utf16;
68 return ptr - utf16 + 1;
72 * NAME: utf16->ucs4duplicate()
73 * DESCRIPTION: duplicate and decode a utf16 string into ucs4
75 id3_ucs4_t *id3_utf16_ucs4duplicate(id3_utf16_t const *utf16)
79 ucs4 = malloc((id3_utf16_length(utf16) + 1) * sizeof(*ucs4));
81 id3_utf16_decode(utf16, ucs4);
87 * NAME: utf16->decodechar()
88 * DESCRIPTION: decode a series of utf16 chars into a single ucs4 char
90 id3_length_t id3_utf16_decodechar(id3_utf16_t const *utf16, id3_ucs4_t *ucs4)
92 id3_utf16_t const *start = utf16;
95 if (utf16[0] < 0xd800 || utf16[0] > 0xdfff) {
96 *ucs4 = utf16[0];
97 return utf16 - start + 1;
99 else if (utf16[0] >= 0xd800 && utf16[0] <= 0xdbff &&
100 utf16[1] >= 0xdc00 && utf16[1] <= 0xdfff) {
101 *ucs4 = (((utf16[0] & 0x03ffL) << 10) |
102 ((utf16[1] & 0x03ffL) << 0)) + 0x00010000L;
103 return utf16 - start + 2;
106 ++utf16;
111 * NAME: utf16->encodechar()
112 * DESCRIPTION: encode a single ucs4 char into a series of up to 2 utf16 chars
114 id3_length_t id3_utf16_encodechar(id3_utf16_t *utf16, id3_ucs4_t ucs4)
117 utf16[0] = ucs4;
124 utf16[0] = ((ucs4 >> 10) & 0x3ff) | 0xd800;
125 utf16[1] = ((ucs4 >> 0) & 0x3ff) | 0xdc00;
132 return id3_utf16_encodechar(utf16, ID3_UCS4_REPLACEMENTCHAR);
136 * NAME: utf16->decode()
137 * DESCRIPTION: decode a complete utf16 string into a ucs4 string
139 void id3_utf16_decode(id3_utf16_t const *utf16, id3_ucs4_t *ucs4)
142 utf16 += id3_utf16_decodechar(utf16, ucs4);
147 * NAME: utf16->encode()
148 * DESCRIPTION: encode a complete ucs4 string into a utf16 string
150 void id3_utf16_encode(id3_utf16_t *utf16, id3_ucs4_t const *ucs4)
153 utf16 += id3_utf16_encodechar(utf16, *ucs4);
158 * NAME: utf16->put()
159 * DESCRIPTION: serialize a single utf16 character
161 id3_length_t id3_utf16_put(id3_byte_t **ptr, id3_utf16_t utf16,
168 (*ptr)[0] = (utf16 >> 8) & 0xff;
169 (*ptr)[1] = (utf16 >> 0) & 0xff;
173 (*ptr)[0] = (utf16 >> 0) & 0xff;
174 (*ptr)[1] = (utf16 >> 8) & 0xff;
185 * NAME: utf16->get()
186 * DESCRIPTION: deserialize a single utf16 character
191 id3_utf16_t utf16;
196 utf16 =
202 utf16 =
210 return utf16;
214 * NAME: utf16->serialize()
215 * DESCRIPTION: serialize a ucs4 string using utf16 encoding
222 id3_utf16_t utf16[2], *out;
228 switch (id3_utf16_encodechar(out = utf16, *ucs4++)) {
242 * NAME: utf16->deserialize()
243 * DESCRIPTION: deserialize a ucs4 string using utf16 encoding
249 id3_utf16_t *utf16ptr, *utf16;
254 utf16 = malloc((length / 2 + 1) * sizeof(*utf16));
255 if (utf16 == 0)
273 utf16ptr = utf16;
279 ucs4 = malloc((id3_utf16_length(utf16) + 1) * sizeof(*ucs4));
281 id3_utf16_decode(utf16, ucs4);
283 free(utf16);