Lines Matching refs:converter

148 and created from a converter that is shared across threads.
192 UTRACE_DATA3(UTRACE_OPEN_CLOSE, "clone converter %s at %p into stackBuffer %p",
289 Checking whether it's an algorithic converter is okay
303 toUArgs.converter = fromUArgs.converter = localConverter;
319 ucnv_close (UConverter * converter)
325 if (converter == NULL)
331 UTRACE_DATA3(UTRACE_OPEN_CLOSE, "close converter %s at %p, isCopyLocal=%b",
332 ucnv_getName(converter, &errorCode), converter, converter->isCopyLocal);
337 /* first, notify the callback functions that the converter is closed */
338 if (converter->fromCharErrorBehaviour != UCNV_TO_U_DEFAULT_CALLBACK) {
350 toUArgs.converter = converter;
352 converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, NULL, 0, UCNV_CLOSE, &errorCode);
354 if (converter->fromUCharErrorBehaviour != UCNV_FROM_U_DEFAULT_CALLBACK) {
365 fromUArgs.converter = converter;
367 converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_CLOSE, &errorCode);
370 if (converter->sharedData->impl->close != NULL) {
371 converter->sharedData->impl->close(converter);
374 if (converter->subChars != (uint8_t *)converter->subUChars) {
375 uprv_free(converter->subChars);
379 Checking whether it's an algorithic converter is okay
383 if (converter->sharedData->referenceCounter != ~0) {
384 ucnv_unloadSharedDataIfReady(converter->sharedData);
387 if(!converter->isCopyLocal){
388 uprv_free(converter);
417 ucnv_getSubstChars (const UConverter * converter,
425 if (converter->subCharLen <= 0) {
431 if (*len < converter->subCharLen) /*not enough space in subChars */
437 uprv_memcpy (mySubChar, converter->subChars, converter->subCharLen); /*fills in the subchars */
438 *len = converter->subCharLen; /*store # of bytes copied to buffer */
442 ucnv_setSubstChars (UConverter * converter,
451 if ((len > converter->sharedData->staticData->maxBytesPerChar)
452 || (len < converter->sharedData->staticData->minBytesPerChar))
458 uprv_memcpy (converter->subChars, mySubChar, len); /*copies the subchars */
459 converter->subCharLen = len; /*sets the new len */
466 converter->subChar1 = 0;
499 /* The converter is not stateful. Store the charset bytes as a fixed string. */
503 * The converter has a non-default writeSub() function, indicating
510 * Should not occur. The converter should output at least one byte
558 /*resets the internal states of a converter
559 *goal : have the same behaviour than a freshly created converter
561 static void _reset(UConverter *converter, UConverterResetChoice choice,
563 if(converter == NULL) {
568 /* first, notify the callback functions that the converter is reset */
571 if(choice<=UCNV_RESET_TO_UNICODE && converter->fromCharErrorBehaviour != UCNV_TO_U_DEFAULT_CALLBACK) {
582 toUArgs.converter = converter;
584 converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, NULL, 0, UCNV_RESET, &errorCode);
586 if(choice!=UCNV_RESET_TO_UNICODE && converter->fromUCharErrorBehaviour != UCNV_FROM_U_DEFAULT_CALLBACK) {
597 fromUArgs.converter = converter;
599 converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_RESET, &errorCode);
603 /* now reset the converter itself */
605 converter->toUnicodeStatus = converter->sharedData->toUnicodeStatus;
606 converter->mode = 0;
607 converter->toULength = 0;
608 converter->invalidCharLength = converter->UCharErrorBufferLength = 0;
609 converter->preToULength = 0;
612 converter->fromUnicodeStatus = 0;
613 converter->fromUChar32 = 0;
614 converter->invalidUCharLength = converter->charErrorBufferLength = 0;
615 converter->preFromUFirstCP = U_SENTINEL;
616 converter->preFromULength = 0;
619 if (converter->sharedData->impl->reset != NULL) {
621 converter->sharedData->impl->reset(converter, choice);
626 ucnv_reset(UConverter *converter)
628 _reset(converter, UCNV_RESET_BOTH, TRUE);
632 ucnv_resetToUnicode(UConverter *converter)
634 _reset(converter, UCNV_RESET_TO_UNICODE, TRUE);
638 ucnv_resetFromUnicode(UConverter *converter)
640 _reset(converter, UCNV_RESET_FROM_UNICODE, TRUE);
644 ucnv_getMaxCharSize (const UConverter * converter)
646 return converter->maxBytesPerUChar;
651 ucnv_getMinCharSize (const UConverter * converter)
653 return converter->sharedData->staticData->minBytesPerChar;
657 ucnv_getName (const UConverter * converter, UErrorCode * err)
662 if(converter->sharedData->impl->getName){
663 const char* temp= converter->sharedData->impl->getName(converter);
667 return converter->sharedData->staticData->name;
671 ucnv_getCCSID(const UConverter * converter,
678 ccsid = converter->sharedData->staticData->codepage;
682 const char *standardName = ucnv_getStandardName(ucnv_getName(converter, err), "IBM", err);
695 ucnv_getPlatform (const UConverter * converter,
701 return (UConverterPlatform)converter->sharedData->staticData->platform;
705 ucnv_getToUCallBack (const UConverter * converter,
709 *action = converter->fromCharErrorBehaviour;
710 *context = converter->toUContext;
714 ucnv_getFromUCallBack (const UConverter * converter,
718 *action = converter->fromUCharErrorBehaviour;
719 *context = converter->fromUContext;
723 ucnv_setToUCallBack (UConverter * converter,
732 if (oldAction) *oldAction = converter->fromCharErrorBehaviour;
733 converter->fromCharErrorBehaviour = newAction;
734 if (oldContext) *oldContext = converter->toUContext;
735 converter->toUContext = newContext;
739 ucnv_setFromUCallBack (UConverter * converter,
748 if (oldAction) *oldAction = converter->fromUCharErrorBehaviour;
749 converter->fromUCharErrorBehaviour = newAction;
750 if (oldContext) *oldContext = converter->fromUContext;
751 converter->fromUContext = newContext;
807 * source units, then they must be "replayed", i.e., fed back into the converter.
816 * It is conceivable that a callback function could call the converter
840 cnv=pArgs->converter;
845 /* get the converter implementation function */
905 * set a flag for whether the converter
942 * if a converter handles offsets and updates the offsets
1026 /* reset the converter without calling the callback function */
1087 /* set the converter state to deal with the next character */
1250 /* prepare the converter arguments */
1251 args.converter=cnv;
1285 cnv=pArgs->converter;
1290 /* get the converter implementation function */
1350 * set a flag for whether the converter
1387 * if a converter handles offsets and updates the offsets
1471 /* reset the converter without calling the callback function */
1530 /* set the converter state to deal with the next character */
1696 /* prepare the converter arguments */
1697 args.converter=cnv;
1903 * in case the converter outputs single surrogates from complete
1911 * do not simply return even if s==sourceLimit because the converter may
1915 /* prepare the converter arguments */
1916 args.converter=cnv;
1938 /* reset the converter without calling the callback function */
2176 /* prepare the converter arguments */
2177 fromUArgs.converter=targetCnv;
2184 toUArgs.converter=sourceCnv;
2551 /* create the algorithmic converter */
2558 /* reset the other converter */
2606 ucnv_getType(const UConverter* converter)
2608 int8_t type = converter->sharedData->staticData->conversionType;
2611 return ucnv_MBCSGetType(converter);
2618 ucnv_getStarters(const UConverter* converter,
2626 if(converter->sharedData->impl->getStarters != NULL) {
2627 converter->sharedData->impl->getStarters(converter, starters, err);
2699 ucnv_getInvalidChars (const UConverter * converter,
2708 if (len == NULL || errBytes == NULL || converter == NULL)
2713 if (*len < converter->invalidCharLength)
2718 if ((*len = converter->invalidCharLength) > 0)
2720 uprv_memcpy (errBytes, converter->invalidCharBuffer, *len);
2725 ucnv_getInvalidUChars (const UConverter * converter,
2734 if (len == NULL || errChars == NULL || converter == NULL)
2739 if (*len < converter->invalidUCharLength)
2744 if ((*len = converter->invalidUCharLength) > 0)
2746 uprv_memcpy (errChars, converter->invalidUCharBuffer, sizeof(UChar) * (*len));