Lines Matching refs:source

14  * This source code is provided as is by Unicode, Inc. No claims are
39 source sequences, enhanced error detection, added casts
121 const UTF32* source = *sourceStart;
123 while (source < sourceEnd) {
128 ch = *source++;
133 --source; /* return to the illegal value itself */
151 --source; /* Back up source pointer! */
159 *sourceStart = source;
170 const UTF16* source = *sourceStart;
173 while (source < sourceEnd) {
174 const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
175 ch = *source++;
178 /* If the 16 bits following the high surrogate are in the source buffer... */
179 if (source < sourceEnd) {
180 ch2 = *source;
185 ++source;
187 --source; /* return to the illegal value itself */
192 --source; /* return to the high surrogate */
199 --source; /* return to the illegal value itself */
205 source = oldSource; /* Back up source pointer! */
210 *sourceStart = source;
224 const UTF16* source = *sourceStart;
226 while (source < sourceEnd) {
231 const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
232 ch = *source++;
235 /* If the 16 bits following the high surrogate are in the source buffer... */
236 if (source < sourceEnd) {
237 UTF32 ch2 = *source;
242 ++source;
244 --source; /* return to the illegal value itself */
249 --source; /* return to the high surrogate */
256 --source; /* return to the illegal value itself */
272 source = oldSource; /* Back up source pointer! */
283 *sourceStart = source;
294 const UTF32* source = *sourceStart;
296 while (source < sourceEnd) {
301 ch = *source++;
305 --source; /* return to the illegal value itself */
325 --source; /* Back up source pointer! */
336 *sourceStart = source;
347 * length = trailingBytesForUTF8[*source]+1;
354 static Boolean isLegalUTF8(const UTF8 *source, int length) {
356 const UTF8 *srcptr = source+length;
364 switch (*source) {
373 case 1: if (*source >= 0x80 && *source < 0xC2) return false;
375 if (*source > 0xF4) return false;
385 Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
386 int length = trailingBytesForUTF8[*source]+1;
387 if (length > sourceEnd - source) {
390 return isLegalUTF8(source, length);
409 Boolean isLegalUTF8String(const UTF8 **source, const UTF8 *sourceEnd) {
410 while (*source != sourceEnd) {
411 int length = trailingBytesForUTF8[**source] + 1;
412 if (length > sourceEnd - *source || !isLegalUTF8(*source, length))
414 *source += length;
425 const UTF8* source = *sourceStart;
427 while (source < sourceEnd) {
429 unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
430 if (extraBytesToRead >= sourceEnd - source) {
434 if (!isLegalUTF8(source, extraBytesToRead+1)) {
442 case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
443 case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
444 case 3: ch += *source++; ch <<= 6;
445 case 2: ch += *source++; ch <<= 6;
446 case 1: ch += *source++; ch <<= 6;
447 case 0: ch += *source++;
452 source -= (extraBytesToRead+1); /* Back up source pointer! */
459 source -= (extraBytesToRead+1); /* return to the illegal value itself */
471 source -= (extraBytesToRead+1); /* return to the start */
479 source -= (extraBytesToRead+1); /* Back up source pointer! */
487 *sourceStart = source;
498 const UTF8* source = *sourceStart;
500 while (source < sourceEnd) {
502 unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
503 if (extraBytesToRead >= sourceEnd - source) {
507 if (!isLegalUTF8(source, extraBytesToRead+1)) {
515 case 5: ch += *source++; ch <<= 6;
516 case 4: ch += *source++; ch <<= 6;
517 case 3: ch += *source++; ch <<= 6;
518 case 2: ch += *source++; ch <<= 6;
519 case 1: ch += *source++; ch <<= 6;
520 case 0: ch += *source++;
525 source -= (extraBytesToRead+1); /* Back up the source pointer! */
535 source -= (extraBytesToRead+1); /* return to the illegal value itself */
549 *sourceStart = source;
563 ch += *source++;