• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:source

5 *   Copyright (C) 2000-2015, International Business Machines
9 * encoding: UTF-8
31 /* ISO 8859-1 --------------------------------------------------------------- */
33 /* This is a table-less and callback-less version of ucnv_MBCSSingleToBMPWithOffsets(). */
38 const uint8_t *source; in _Latin1ToUnicodeWithOffsets() local
46 source=(const uint8_t *)pArgs->source; in _Latin1ToUnicodeWithOffsets()
47 target=pArgs->target; in _Latin1ToUnicodeWithOffsets()
48 targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target); in _Latin1ToUnicodeWithOffsets()
49 offsets=pArgs->offsets; in _Latin1ToUnicodeWithOffsets()
57 length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source); in _Latin1ToUnicodeWithOffsets()
73 target[0]=source[0]; in _Latin1ToUnicodeWithOffsets()
74 target[1]=source[1]; in _Latin1ToUnicodeWithOffsets()
75 target[2]=source[2]; in _Latin1ToUnicodeWithOffsets()
76 target[3]=source[3]; in _Latin1ToUnicodeWithOffsets()
77 target[4]=source[4]; in _Latin1ToUnicodeWithOffsets()
78 target[5]=source[5]; in _Latin1ToUnicodeWithOffsets()
79 target[6]=source[6]; in _Latin1ToUnicodeWithOffsets()
80 target[7]=source[7]; in _Latin1ToUnicodeWithOffsets()
82 source+=8; in _Latin1ToUnicodeWithOffsets()
83 } while(--count>0); in _Latin1ToUnicodeWithOffsets()
96 } while(--loops>0); in _Latin1ToUnicodeWithOffsets()
102 *target++=*source++; in _Latin1ToUnicodeWithOffsets()
103 --targetCapacity; in _Latin1ToUnicodeWithOffsets()
107 pArgs->source=(const char *)source; in _Latin1ToUnicodeWithOffsets()
108 pArgs->target=target; in _Latin1ToUnicodeWithOffsets()
114 --length; in _Latin1ToUnicodeWithOffsets()
116 pArgs->offsets=offsets; in _Latin1ToUnicodeWithOffsets()
120 /* This is a table-less and callback-less version of ucnv_MBCSSingleGetNextUChar(). */
124 const uint8_t *source=(const uint8_t *)pArgs->source; in _Latin1GetNextUChar() local
125 if(source<(const uint8_t *)pArgs->sourceLimit) { in _Latin1GetNextUChar()
126 pArgs->source=(const char *)(source+1); in _Latin1GetNextUChar()
127 return *source; in _Latin1GetNextUChar()
135 /* This is a table-less version of ucnv_MBCSSingleFromBMPWithOffsets(). */
140 const UChar *source, *sourceLimit; in _Latin1FromUnicodeWithOffsets() local
151 cnv=pArgs->converter; in _Latin1FromUnicodeWithOffsets()
152 source=pArgs->source; in _Latin1FromUnicodeWithOffsets()
153 sourceLimit=pArgs->sourceLimit; in _Latin1FromUnicodeWithOffsets()
154 target=oldTarget=(uint8_t *)pArgs->target; in _Latin1FromUnicodeWithOffsets()
155 targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target); in _Latin1FromUnicodeWithOffsets()
156 offsets=pArgs->offsets; in _Latin1FromUnicodeWithOffsets()
158 if(cnv->sharedData==&_Latin1Data) { in _Latin1FromUnicodeWithOffsets()
159 max=0xff; /* Latin-1 */ in _Latin1FromUnicodeWithOffsets()
161 max=0x7f; /* US-ASCII */ in _Latin1FromUnicodeWithOffsets()
165 cp=cnv->fromUChar32; in _Latin1FromUnicodeWithOffsets()
167 /* sourceIndex=-1 if the current character began in the previous buffer */ in _Latin1FromUnicodeWithOffsets()
168 sourceIndex= cp==0 ? 0 : -1; in _Latin1FromUnicodeWithOffsets()
174 length=(int32_t)(sourceLimit-source); in _Latin1FromUnicodeWithOffsets()
192 oredChars=u=*source++; in _Latin1FromUnicodeWithOffsets()
194 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
196 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
198 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
200 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
202 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
204 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
206 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
208 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
210 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
212 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
214 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
216 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
218 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
220 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
222 oredChars|=u=*source++; in _Latin1FromUnicodeWithOffsets()
228 source-=16; in _Latin1FromUnicodeWithOffsets()
229 target-=16; in _Latin1FromUnicodeWithOffsets()
232 } while(--count>0); in _Latin1FromUnicodeWithOffsets()
233 count=loops-count; in _Latin1FromUnicodeWithOffsets()
234 targetCapacity-=16*count; in _Latin1FromUnicodeWithOffsets()
255 --count; in _Latin1FromUnicodeWithOffsets()
263 while(targetCapacity>0 && (c=*source++)<=max) { in _Latin1FromUnicodeWithOffsets()
266 --targetCapacity; in _Latin1FromUnicodeWithOffsets()
275 if(source<sourceLimit) { in _Latin1FromUnicodeWithOffsets()
277 UChar trail=*source; in _Latin1FromUnicodeWithOffsets()
279 ++source; in _Latin1FromUnicodeWithOffsets()
289 cnv->fromUChar32=cp; in _Latin1FromUnicodeWithOffsets()
298 cnv->fromUChar32=cp; in _Latin1FromUnicodeWithOffsets()
304 size_t count=target-oldTarget; in _Latin1FromUnicodeWithOffsets()
307 --count; in _Latin1FromUnicodeWithOffsets()
311 if(U_SUCCESS(*pErrorCode) && source<sourceLimit && target>=(uint8_t *)pArgs->targetLimit) { in _Latin1FromUnicodeWithOffsets()
317 pArgs->source=source; in _Latin1FromUnicodeWithOffsets()
318 pArgs->target=(char *)target; in _Latin1FromUnicodeWithOffsets()
319 pArgs->offsets=offsets; in _Latin1FromUnicodeWithOffsets()
322 /* Convert UTF-8 to Latin-1. Adapted from ucnv_SBCSFromUTF8(). */
328 const uint8_t *source, *sourceLimit; in ucnv_Latin1FromUTF8() local
336 utf8=pToUArgs->converter; in ucnv_Latin1FromUTF8()
337 source=(uint8_t *)pToUArgs->source; in ucnv_Latin1FromUTF8()
338 sourceLimit=(uint8_t *)pToUArgs->sourceLimit; in ucnv_Latin1FromUTF8()
339 target=(uint8_t *)pFromUArgs->target; in ucnv_Latin1FromUTF8()
340 targetCapacity=(int32_t)(pFromUArgs->targetLimit-pFromUArgs->target); in ucnv_Latin1FromUTF8()
342 /* get the converter state from the UTF-8 UConverter */ in ucnv_Latin1FromUTF8()
343 if (utf8->toULength > 0) { in ucnv_Latin1FromUTF8()
344 c=(UChar32)utf8->toUnicodeStatus; in ucnv_Latin1FromUTF8()
348 if(c!=0 && source<sourceLimit) { in ucnv_Latin1FromUTF8()
352 } else if(c>=0xc2 && c<=0xc3 && (t1=(uint8_t)(*source-0x80)) <= 0x3f) { in ucnv_Latin1FromUTF8()
353 ++source; in ucnv_Latin1FromUTF8()
355 --targetCapacity; in ucnv_Latin1FromUTF8()
357 utf8->toUnicodeStatus=0; in ucnv_Latin1FromUTF8()
358 utf8->toULength=0; in ucnv_Latin1FromUTF8()
369 * In the conversion loop compare source with sourceLimit only once in ucnv_Latin1FromUTF8()
370 * per multi-byte character. in ucnv_Latin1FromUTF8()
371 * For Latin-1, adjust sourceLimit only for 1 trail byte because in ucnv_Latin1FromUTF8()
372 * the conversion loop handles at most 2-byte sequences. in ucnv_Latin1FromUTF8()
374 if(source<sourceLimit && U8_IS_LEAD(*(sourceLimit-1))) { in ucnv_Latin1FromUTF8()
375 --sourceLimit; in ucnv_Latin1FromUTF8()
379 while(source<sourceLimit) { in ucnv_Latin1FromUTF8()
381 b=*source++; in ucnv_Latin1FromUTF8()
385 --targetCapacity; in ucnv_Latin1FromUTF8()
388 (t1=(uint8_t)(*source-0x80)) <= 0x3f in ucnv_Latin1FromUTF8()
390 ++source; in ucnv_Latin1FromUTF8()
392 --targetCapacity; in ucnv_Latin1FromUTF8()
395 pToUArgs->source=(char *)(source-1); in ucnv_Latin1FromUTF8()
396 pFromUArgs->target=(char *)target; in ucnv_Latin1FromUTF8()
411 * For Latin-1, there is at most exactly one lead byte because of the in ucnv_Latin1FromUTF8()
414 if(U_SUCCESS(*pErrorCode) && source<(sourceLimit=(uint8_t *)pToUArgs->sourceLimit)) { in ucnv_Latin1FromUTF8()
415 utf8->toUnicodeStatus=utf8->toUBytes[0]=b=*source++; in ucnv_Latin1FromUTF8()
416 utf8->toULength=1; in ucnv_Latin1FromUTF8()
417 utf8->mode=U8_COUNT_BYTES(b); in ucnv_Latin1FromUTF8()
421 pToUArgs->source=(char *)source; in ucnv_Latin1FromUTF8()
422 pFromUArgs->target=(char *)target; in ucnv_Latin1FromUTF8()
433 sa->addRange(sa->set, 0, 0xff); in _Latin1GetUnicodeSet()
466 "ISO-8859-1",
477 /* US-ASCII ----------------------------------------------------------------- */
480 /* This is a table-less version of ucnv_MBCSSingleToBMPWithOffsets(). */
484 const uint8_t *source, *sourceLimit; in _ASCIIToUnicodeWithOffsets() local
494 source=(const uint8_t *)pArgs->source; in _ASCIIToUnicodeWithOffsets()
495 sourceLimit=(const uint8_t *)pArgs->sourceLimit; in _ASCIIToUnicodeWithOffsets()
496 target=oldTarget=pArgs->target; in _ASCIIToUnicodeWithOffsets()
497 targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target); in _ASCIIToUnicodeWithOffsets()
498 offsets=pArgs->offsets; in _ASCIIToUnicodeWithOffsets()
500 /* sourceIndex=-1 if the current character began in the previous buffer */ in _ASCIIToUnicodeWithOffsets()
507 length=(int32_t)(sourceLimit-source); in _ASCIIToUnicodeWithOffsets()
519 oredChars=target[0]=source[0]; in _ASCIIToUnicodeWithOffsets()
520 oredChars|=target[1]=source[1]; in _ASCIIToUnicodeWithOffsets()
521 oredChars|=target[2]=source[2]; in _ASCIIToUnicodeWithOffsets()
522 oredChars|=target[3]=source[3]; in _ASCIIToUnicodeWithOffsets()
523 oredChars|=target[4]=source[4]; in _ASCIIToUnicodeWithOffsets()
524 oredChars|=target[5]=source[5]; in _ASCIIToUnicodeWithOffsets()
525 oredChars|=target[6]=source[6]; in _ASCIIToUnicodeWithOffsets()
526 oredChars|=target[7]=source[7]; in _ASCIIToUnicodeWithOffsets()
533 source+=8; in _ASCIIToUnicodeWithOffsets()
535 } while(--count>0); in _ASCIIToUnicodeWithOffsets()
536 count=loops-count; in _ASCIIToUnicodeWithOffsets()
537 targetCapacity-=count*8; in _ASCIIToUnicodeWithOffsets()
551 --count; in _ASCIIToUnicodeWithOffsets()
558 while(targetCapacity>0 && (c=*source++)<=0x7f) { in _ASCIIToUnicodeWithOffsets()
560 --targetCapacity; in _ASCIIToUnicodeWithOffsets()
565 UConverter *cnv=pArgs->converter; in _ASCIIToUnicodeWithOffsets()
566 cnv->toUBytes[0]=c; in _ASCIIToUnicodeWithOffsets()
567 cnv->toULength=1; in _ASCIIToUnicodeWithOffsets()
569 } else if(source<sourceLimit && target>=pArgs->targetLimit) { in _ASCIIToUnicodeWithOffsets()
576 size_t count=target-oldTarget; in _ASCIIToUnicodeWithOffsets()
579 --count; in _ASCIIToUnicodeWithOffsets()
584 pArgs->source=(const char *)source; in _ASCIIToUnicodeWithOffsets()
585 pArgs->target=target; in _ASCIIToUnicodeWithOffsets()
586 pArgs->offsets=offsets; in _ASCIIToUnicodeWithOffsets()
589 /* This is a table-less version of ucnv_MBCSSingleGetNextUChar(). */
593 const uint8_t *source; in _ASCIIGetNextUChar() local
596 source=(const uint8_t *)pArgs->source; in _ASCIIGetNextUChar()
597 if(source<(const uint8_t *)pArgs->sourceLimit) { in _ASCIIGetNextUChar()
598 b=*source++; in _ASCIIGetNextUChar()
599 pArgs->source=(const char *)source; in _ASCIIGetNextUChar()
603 UConverter *cnv=pArgs->converter; in _ASCIIGetNextUChar()
604 cnv->toUBytes[0]=b; in _ASCIIGetNextUChar()
605 cnv->toULength=1; in _ASCIIGetNextUChar()
616 /* "Convert" UTF-8 to US-ASCII: Validate and copy. */
621 const uint8_t *source, *sourceLimit; in ucnv_ASCIIFromUTF8() local
627 if(pToUArgs->converter->toULength > 0) { in ucnv_ASCIIFromUTF8()
628 /* no handling of partial UTF-8 characters here, fall back to pivoting */ in ucnv_ASCIIFromUTF8()
634 source=(const uint8_t *)pToUArgs->source; in ucnv_ASCIIFromUTF8()
635 sourceLimit=(const uint8_t *)pToUArgs->sourceLimit; in ucnv_ASCIIFromUTF8()
636 target=(uint8_t *)pFromUArgs->target; in ucnv_ASCIIFromUTF8()
637 targetCapacity=(int32_t)(pFromUArgs->targetLimit-pFromUArgs->target); in ucnv_ASCIIFromUTF8()
643 length=(int32_t)(sourceLimit-source); in ucnv_ASCIIFromUTF8()
655 oredChars=*target++=*source++; in ucnv_ASCIIFromUTF8()
656 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
657 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
658 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
659 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
660 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
661 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
662 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
663 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
664 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
665 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
666 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
667 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
668 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
669 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
670 oredChars|=*target++=*source++; in ucnv_ASCIIFromUTF8()
675 source-=16; in ucnv_ASCIIFromUTF8()
676 target-=16; in ucnv_ASCIIFromUTF8()
679 } while(--count>0); in ucnv_ASCIIFromUTF8()
680 count=loops-count; in ucnv_ASCIIFromUTF8()
681 targetCapacity-=16*count; in ucnv_ASCIIFromUTF8()
686 while(targetCapacity>0 && (c=*source)<=0x7f) { in ucnv_ASCIIFromUTF8()
687 ++source; in ucnv_ASCIIFromUTF8()
689 --targetCapacity; in ucnv_ASCIIFromUTF8()
693 /* non-ASCII character, handle in standard converter */ in ucnv_ASCIIFromUTF8()
695 } else if(source<sourceLimit && target>=(const uint8_t *)pFromUArgs->targetLimit) { in ucnv_ASCIIFromUTF8()
701 pToUArgs->source=(const char *)source; in ucnv_ASCIIFromUTF8()
702 pFromUArgs->target=(char *)target; in ucnv_ASCIIFromUTF8()
713 sa->addRange(sa->set, 0, 0x7f); in _ASCIIGetUnicodeSet()
745 "US-ASCII",