Home | History | Annotate | Download | only in common

Lines Matching refs:source

41 Conversions between UTF32, UTF-16, and UTF-8. Source code file.
47 source sequences, enhanced error detection, added casts
85 const UTF32* source = *sourceStart;
87 while (source < sourceEnd) {
92 ch = *source++;
97 --source; /* return to the illegal value itself */
115 --source; /* Back up source pointer! */
123 *sourceStart = source;
133 const UTF16* source = *sourceStart;
136 while (source < sourceEnd) {
137 const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
138 ch = *source++;
141 /* If the 16 bits following the high surrogate are in the source buffer... */
142 if (source < sourceEnd) {
143 ch2 = *source;
148 ++source;
150 --source; /* return to the illegal value itself */
155 --source; /* return to the high surrogate */
162 --source; /* return to the illegal value itself */
168 source = oldSource; /* Back up source pointer! */
173 *sourceStart = source;
236 const UTF16* source = *sourceStart;
238 while (source < sourceEnd) {
243 const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
244 ch = *source++;
247 /* If the 16 bits following the high surrogate are in the source buffer... */
248 if (source < sourceEnd) {
249 UTF32 ch2 = *source;
254 ++source;
256 --source; /* return to the illegal value itself */
261 --source; /* return to the high surrogate */
268 --source; /* return to the illegal value itself */
284 source = oldSource; /* Back up source pointer! */
295 *sourceStart = source;
306 * length = trailingBytesForUTF8[*source]+1;
313 static Boolean isLegalUTF8(const UTF8 *source, int length) {
315 const UTF8 *srcptr = source+length;
323 switch (*source) {
332 case 1: if (*source >= 0x80 && *source < 0xC2) return false;
334 if (*source > 0xF4) return false;
344 Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
345 int length = trailingBytesForUTF8[*source]+1;
346 if (source+length > sourceEnd) {
349 return isLegalUTF8(source, length);
357 const UTF8* source = *sourceStart;
359 while (source < sourceEnd) {
361 unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
362 if (source + extraBytesToRead >= sourceEnd) {
366 if (! isLegalUTF8(source, extraBytesToRead+1)) {
374 case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
375 case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
376 case 3: ch += *source++; ch <<= 6;
377 case 2: ch += *source++; ch <<= 6;
378 case 1: ch += *source++; ch <<= 6;
379 case 0: ch += *source++;
384 source -= (extraBytesToRead+1); /* Back up source pointer! */
391 source -= (extraBytesToRead+1); /* return to the illegal value itself */
403 source -= (extraBytesToRead+1); /* return to the start */
411 source -= (extraBytesToRead+1); /* Back up source pointer! */
419 *sourceStart = source;
429 const UTF32* source = *sourceStart;
431 while (source < sourceEnd) {
436 ch = *source++;
440 --source; /* return to the illegal value itself */
460 --source; /* Back up source pointer! */
471 *sourceStart = source;
481 const UTF8* source = *sourceStart;
483 while (source < sourceEnd) {
485 unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
486 if (source + extraBytesToRead >= sourceEnd) {
490 if (! isLegalUTF8(source, extraBytesToRead+1)) {
498 case 5: ch += *source++; ch <<= 6;
499 case 4: ch += *source++; ch <<= 6;
500 case 3: ch += *source++; ch <<= 6;
501 case 2: ch += *source++; ch <<= 6;
502 case 1: ch += *source++; ch <<= 6;
503 case 0: ch += *source++;
508 source -= (extraBytesToRead+1); /* Back up the source pointer! */
518 source -= (extraBytesToRead+1); /* return to the illegal value itself */
532 *sourceStart = source;
546 ch += *source++;