Home | History | Annotate | Download | only in Support

Lines Matching refs:source

5  * This file is distributed under the University of Illinois Open Source
14 * This source code is provided as is by Unicode, Inc. No claims are
33 Conversions between UTF32, UTF-16, and UTF-8. Source code file.
39 source sequences, enhanced error detection, added casts
122 const UTF32* source = *sourceStart;
124 while (source < sourceEnd) {
129 ch = *source++;
134 --source; /* return to the illegal value itself */
152 --source; /* Back up source pointer! */
160 *sourceStart = source;
171 const UTF16* source = *sourceStart;
174 while (source < sourceEnd) {
175 const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
176 ch = *source++;
179 /* If the 16 bits following the high surrogate are in the source buffer... */
180 if (source < sourceEnd) {
181 ch2 = *source;
186 ++source;
188 --source; /* return to the illegal value itself */
193 --source; /* return to the high surrogate */
200 --source; /* return to the illegal value itself */
206 source = oldSource; /* Back up source pointer! */
211 *sourceStart = source;
225 const UTF16* source = *sourceStart;
227 while (source < sourceEnd) {
232 const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
233 ch = *source++;
236 /* If the 16 bits following the high surrogate are in the source buffer... */
237 if (source < sourceEnd) {
238 UTF32 ch2 = *source;
243 ++source;
245 --source; /* return to the illegal value itself */
250 --source; /* return to the high surrogate */
257 --source; /* return to the illegal value itself */
273 source = oldSource; /* Back up source pointer! */
284 *sourceStart = source;
295 const UTF32* source = *sourceStart;
297 while (source < sourceEnd) {
302 ch = *source++;
306 --source; /* return to the illegal value itself */
326 --source; /* Back up source pointer! */
337 *sourceStart = source;
348 * length = trailingBytesForUTF8[*source]+1;
355 static Boolean isLegalUTF8(const UTF8 *source, int length) {
357 const UTF8 *srcptr = source+length;
365 switch (*source) {
374 case 1: if (*source >= 0x80 && *source < 0xC2) return false;
376 if (*source > 0xF4) return false;
386 Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
387 int length = trailingBytesForUTF8[*source]+1;
388 if (length > sourceEnd - source) {
391 return isLegalUTF8(source, length);
397 source,
401 assert(!isLegalUTF8Sequence(source, sourceEnd));
412 if (source == sourceEnd)
420 b1 = *source;
421 ++source;
430 if (source == sourceEnd)
433 b2 = *source;
434 ++source;
450 if (source == sourceEnd)
453 b3 = *source;
460 if (source == sourceEnd)
463 b3 = *source;
470 if (source == sourceEnd)
473 b3 = *source;
503 Boolean isLegalUTF8String(const UTF8 **source, const UTF8 *sourceEnd) {
504 while (*source != sourceEnd) {
505 int length = trailingBytesForUTF8[**source] + 1;
506 if (length > sourceEnd - *source || !isLegalUTF8(*source, length))
508 *source += length;
519 const UTF8* source = *sourceStart;
521 while (source < sourceEnd) {
523 unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
524 if (extraBytesToRead >= sourceEnd - source) {
528 if (!isLegalUTF8(source, extraBytesToRead+1)) {
536 case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
537 case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
538 case 3: ch += *source++; ch <<= 6;
539 case 2: ch += *source++; ch <<= 6;
540 case 1: ch += *source++; ch <<= 6;
541 case 0: ch += *source++;
546 source -= (extraBytesToRead+1); /* Back up source pointer! */
553 source -= (extraBytesToRead+1); /* return to the illegal value itself */
565 source -= (extraBytesToRead+1); /* return to the start */
573 source -= (extraBytesToRead+1); /* Back up source pointer! */
581 *sourceStart = source;
593 const UTF8* source = *sourceStart;
595 while (source < sourceEnd) {
597 unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
598 if (extraBytesToRead >= sourceEnd - source) {
609 source += findMaximalSubpartOfIllFormedUTF8Sequence(source,
620 if (!isLegalUTF8(source, extraBytesToRead+1)) {
630 source += findMaximalSubpartOfIllFormedUTF8Sequence(source,
640 case 5: ch += *source++; ch <<= 6;
641 case 4: ch += *source++; ch <<= 6;
642 case 3: ch += *source++; ch <<= 6;
643 case 2: ch += *source++; ch <<= 6;
644 case 1: ch += *source++; ch <<= 6;
645 case 0: ch += *source++;
656 source -= (extraBytesToRead+1); /* return to the illegal value itself */
670 *sourceStart = source;
700 ch += *source++;