Home | History | Annotate | Download | only in unicode

Lines Matching defs:source

6  * This source code is provided as is by Unicode, Inc. No claims are
25 Conversions between UTF32, UTF-16, and UTF-8. Source code file.
31 source sequences, enhanced error detection, added casts
65 const UTF32* source = *sourceStart;
67 while (source < sourceEnd) {
72 ch = *source++;
77 --source; /* return to the illegal value itself */
95 --source; /* Back up source pointer! */
103 *sourceStart = source;
114 const UTF16* source = *sourceStart;
117 while (source < sourceEnd) {
118 const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
119 ch = *source++;
122 /* If the 16 bits following the high surrogate are in the source buffer... */
123 if (source < sourceEnd) {
124 ch2 = *source;
129 ++source;
131 --source; /* return to the illegal value itself */
136 --source; /* return to the high surrogate */
143 --source; /* return to the illegal value itself */
149 source = oldSource; /* Back up source pointer! */
154 *sourceStart = source;
218 const UTF16* source = *sourceStart;
220 while (source < sourceEnd) {
225 const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
226 ch = *source++;
229 /* If the 16 bits following the high surrogate are in the source buffer... */
230 if (source < sourceEnd) {
231 UTF32 ch2 = *source;
236 ++source;
238 --source; /* return to the illegal value itself */
243 --source; /* return to the high surrogate */
250 --source; /* return to the illegal value itself */
276 source = oldSource; /* Back up source pointer! */
287 *sourceStart = source;
298 * length = trailingBytesForUTF8[*source]+1;
305 inline Boolean isLegalUTF8(const UTF8 *source, int length) {
307 const UTF8 *srcptr = source+length;
315 switch (*source) {
324 case 1: if (*source >= 0x80 && *source < 0xC2) return false;
326 if (*source > 0xF4) return false;
336 Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
337 int length = trailingBytesForUTF8[*source]+1;
338 if (source+length > sourceEnd) {
341 return isLegalUTF8(source, length);
350 const UTF8* source = *sourceStart;
352 while (source < sourceEnd) {
354 unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
355 if (source + extraBytesToRead >= sourceEnd) {
359 if (! isLegalUTF8(source, extraBytesToRead+1)) {
367 case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
368 case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
369 case 3: ch += *source++; ch <<= 6;
370 case 2: ch += *source++; ch <<= 6;
371 case 1: ch += *source++; ch <<= 6;
372 case 0: ch += *source++;
377 source -= (extraBytesToRead+1); /* Back up source pointer! */
384 source -= (extraBytesToRead+1); /* return to the illegal value itself */
396 source -= (extraBytesToRead+1); /* return to the start */
404 source -= (extraBytesToRead+1); /* Back up source pointer! */
412 *sourceStart = source;
423 const UTF32* source = *sourceStart;
425 while (source < sourceEnd) {
430 ch = *source++;
434 --source; /* return to the illegal value itself */
454 --source; /* Back up source pointer! */
465 *sourceStart = source;
476 const UTF8* source = *sourceStart;
478 while (source < sourceEnd) {
480 unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
481 if (source + extraBytesToRead >= sourceEnd) {
485 if (! isLegalUTF8(source, extraBytesToRead+1)) {
493 case 5: ch += *source++; ch <<= 6;
494 case 4: ch += *source++; ch <<= 6;
495 case 3: ch += *source++; ch <<= 6;
496 case 2: ch += *source++; ch <<= 6;
497 case 1: ch += *source++; ch <<= 6;
498 case 0: ch += *source++;
503 source -= (extraBytesToRead+1); /* Back up the source pointer! */
513 source -= (extraBytesToRead+1); /* return to the illegal value itself */
527 *sourceStart = source;
541 ch += *source++;