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
149 const UTF32* source = *sourceStart;
151 while (source < sourceEnd) {
156 ch = *source++;
161 --source; /* return to the illegal value itself */
179 --source; /* Back up source pointer! */
187 *sourceStart = source;
198 const UTF16* source = *sourceStart;
201 while (source < sourceEnd) {
202 const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
203 ch = *source++;
206 /* If the 16 bits following the high surrogate are in the source buffer... */
207 if (source < sourceEnd) {
208 ch2 = *source;
213 ++source;
215 --source; /* return to the illegal value itself */
220 --source; /* return to the high surrogate */
227 --source; /* return to the illegal value itself */
233 source = oldSource; /* Back up source pointer! */
238 *sourceStart = source;
252 const UTF16* source = *sourceStart;
254 while (source < sourceEnd) {
259 const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
260 ch = *source++;
263 /* If the 16 bits following the high surrogate are in the source buffer... */
264 if (source < sourceEnd) {
265 UTF32 ch2 = *source;
270 ++source;
272 --source; /* return to the illegal value itself */
277 --source; /* return to the high surrogate */
284 --source; /* return to the illegal value itself */
300 source = oldSource; /* Back up source pointer! */
311 *sourceStart = source;
322 const UTF32* source = *sourceStart;
324 while (source < sourceEnd) {
329 ch = *source++;
333 --source; /* return to the illegal value itself */
353 --source; /* Back up source pointer! */
364 *sourceStart = source;
375 * length = trailingBytesForUTF8[*source]+1;
382 static Boolean isLegalUTF8(const UTF8 *source, int length) {
384 const UTF8 *srcptr = source+length;
392 switch (*source) {
401 case 1: if (*source >= 0x80 && *source < 0xC2) return false;
403 if (*source > 0xF4) return false;
413 Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
414 int length = trailingBytesForUTF8[*source]+1;
415 if (length > sourceEnd - source) {
418 return isLegalUTF8(source, length);
424 findMaximalSubpartOfIllFormedUTF8Sequence(const UTF8 *source,
428 assert(!isLegalUTF8Sequence(source, sourceEnd));
439 if (source == sourceEnd)
447 b1 = *source;
448 ++source;
457 if (source == sourceEnd)
460 b2 = *source;
461 ++source;
477 if (source == sourceEnd)
480 b3 = *source;
487 if (source == sourceEnd)
490 b3 = *source;
497 if (source == sourceEnd)
500 b3 = *source;
530 Boolean isLegalUTF8String(const UTF8 **source, const UTF8 *sourceEnd) {
531 while (*source != sourceEnd) {
532 int length = trailingBytesForUTF8[**source] + 1;
533 if (length > sourceEnd - *source || !isLegalUTF8(*source, length))
535 *source += length;
546 const UTF8* source = *sourceStart;
548 while (source < sourceEnd) {
550 unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
551 if (extraBytesToRead >= sourceEnd - source) {
555 if (!isLegalUTF8(source, extraBytesToRead+1)) {
563 case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
564 case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
565 case 3: ch += *source++; ch <<= 6;
566 case 2: ch += *source++; ch <<= 6;
567 case 1: ch += *source++; ch <<= 6;
568 case 0: ch += *source++;
573 source -= (extraBytesToRead+1); /* Back up source pointer! */
580 source -= (extraBytesToRead+1); /* return to the illegal value itself */
592 source -= (extraBytesToRead+1); /* return to the start */
600 source -= (extraBytesToRead+1); /* Back up source pointer! */
608 *sourceStart = source;
620 const UTF8* source = *sourceStart;
622 while (source < sourceEnd) {
624 unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
625 if (extraBytesToRead >= sourceEnd - source) {
636 source += findMaximalSubpartOfIllFormedUTF8Sequence(source,
647 if (!isLegalUTF8(source, extraBytesToRead+1)) {
657 source += findMaximalSubpartOfIllFormedUTF8Sequence(source,
667 case 5: ch += *source++; ch <<= 6;
668 case 4: ch += *source++; ch <<= 6;
669 case 3: ch += *source++; ch <<= 6;
670 case 2: ch += *source++; ch <<= 6;
671 case 1: ch += *source++; ch <<= 6;
672 case 0: ch += *source++;
683 source -= (extraBytesToRead+1); /* return to the illegal value itself */
697 *sourceStart = source;
727 ch += *source++;