Lines Matching refs:cnv
158 ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status)
192 if (cnv == NULL) {
199 ucnv_getName(cnv, status), cnv, stackBuffer);
201 if (cnv->sharedData->impl->safeClone != NULL) {
204 cnv->sharedData->impl->safeClone(cnv, NULL, &bufferSizeNeeded, status);
271 uprv_memcpy(localConverter, cnv, sizeof(UConverter));
275 if (cnv->subChars == (uint8_t *)cnv->subUChars) {
284 uprv_memcpy(localConverter->subChars, cnv->subChars, UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
288 if (cnv->sharedData->impl->safeClone != NULL) {
290 localConverter = cnv->sharedData->impl->safeClone(cnv, localConverter, pBufferSize, status);
303 if (cnv->sharedData->isReferenceCounted) {
304 ucnv_incrementRefCount(cnv->sharedData);
315 cnv->fromCharErrorBehaviour(cnv->toUContext, &toUArgs, NULL, 0, UCNV_CLONE, &cbErr);
317 cnv->fromUCharErrorBehaviour(cnv->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_CLONE, &cbErr);
324 ucnv_clone(const UConverter* cnv, UErrorCode *status)
326 return ucnv_safeClone(cnv, nullptr, nullptr, status);
481 ucnv_setSubstString(UConverter *cnv,
494 clone = ucnv_safeClone(cnv, cloneBuffer, &cloneSize, err);
502 if (cnv->sharedData->impl->writeSub == NULL
504 || (cnv->sharedData->staticData->conversionType == UCNV_MBCS &&
505 ucnv_MBCSGetType(cnv) != UCNV_EBCDIC_STATEFUL)
539 if (cnv->subChars == (uint8_t *)cnv->subUChars) {
541 cnv->subChars = (uint8_t *)uprv_malloc(UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
542 if (cnv->subChars == NULL) {
543 cnv->subChars = (uint8_t *)cnv->subUChars;
547 uprv_memset(cnv->subChars, 0, UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
553 cnv->subCharLen = 0;
555 uprv_memcpy(cnv->subChars, subChars, length8);
557 cnv->subCharLen = (int8_t)length8;
559 cnv->subCharLen = (int8_t)-length;
564 cnv->subChar1 = 0;
835 UConverter *cnv;
849 cnv=pArgs->converter;
857 fromUnicode=cnv->sharedData->impl->fromUnicode;
859 fromUnicode=cnv->sharedData->impl->fromUnicodeWithOffsets;
862 fromUnicode=cnv->sharedData->impl->fromUnicode;
868 if(cnv->preFromULength>=0) {
887 uprv_memcpy(replay, cnv->preFromU, -cnv->preFromULength*U_SIZEOF_UCHAR);
889 pArgs->sourceLimit=replay-cnv->preFromULength;
893 cnv->preFromULength=0;
917 * need not check cnv->preFromULength==0 because a replay (<0) will cause
923 cnv->fromUChar32==0);
965 if(cnv->preFromULength<0) {
976 uprv_memcpy(replay, cnv->preFromU, -cnv->preFromULength*U_SIZEOF_UCHAR);
978 pArgs->sourceLimit=replay-cnv->preFromULength;
980 if((sourceIndex+=cnv->preFromULength)<0) {
984 cnv->preFromULength=0;
1012 } else if(pArgs->flush && cnv->fromUChar32!=0) {
1036 _reset(cnv, UCNV_RESET_FROM_UNICODE, false);
1069 U_ASSERT(cnv->preFromULength==0);
1073 u_memcpy(cnv->preFromU, pArgs->source, length);
1074 cnv->preFromULength=(int8_t)-length;
1091 codePoint=cnv->fromUChar32;
1093 U16_APPEND_UNSAFE(cnv->invalidUCharBuffer, errorInputLength, codePoint);
1094 cnv->invalidUCharLength=(int8_t)errorInputLength;
1097 cnv->fromUChar32=0;
1100 cnv->fromUCharErrorBehaviour(cnv->fromUContext, pArgs,
1101 cnv->invalidUCharBuffer, errorInputLength, codePoint,
1120 * Call this function if(cnv->charErrorBufferLength>0).
1124 ucnv_outputOverflowFromUnicode(UConverter *cnv,
1139 overflow=(char *)cnv->charErrorBuffer;
1140 length=cnv->charErrorBufferLength;
1151 cnv->charErrorBufferLength=(int8_t)j;
1168 cnv->charErrorBufferLength=0;
1177 ucnv_fromUnicode(UConverter *cnv,
1192 if(cnv==NULL || target==NULL || source==NULL) {
1238 if( cnv->charErrorBufferLength>0 &&
1239 ucnv_outputOverflowFromUnicode(cnv, target, targetLimit, &offsets, err)
1246 if(!flush && s==sourceLimit && cnv->preFromULength>=0) {
1260 args.converter=cnv;
1280 UConverter *cnv;
1294 cnv=pArgs->converter;
1302 toUnicode=cnv->sharedData->impl->toUnicode;
1304 toUnicode=cnv->sharedData->impl->toUnicodeWithOffsets;
1307 toUnicode=cnv->sharedData->impl->toUnicode;
1313 if(cnv->preToULength>=0) {
1332 uprv_memcpy(replay, cnv->preToU, -cnv->preToULength);
1334 pArgs->sourceLimit=replay-cnv->preToULength;
1338 cnv->preToULength=0;
1362 * need not check cnv->preToULength==0 because a replay (<0) will cause
1368 cnv->toULength==0);
1410 if(cnv->preToULength<0) {
1421 uprv_memcpy(replay, cnv->preToU, -cnv->preToULength);
1423 pArgs->sourceLimit=replay-cnv->preToULength;
1425 if((sourceIndex+=cnv->preToULength)<0) {
1429 cnv->preToULength=0;
1457 } else if(pArgs->flush && cnv->toULength>0) {
1481 _reset(cnv, UCNV_RESET_TO_UNICODE, false);
1516 U_ASSERT(cnv->preToULength==0);
1520 uprv_memcpy(cnv->preToU, pArgs->source, length);
1521 cnv->preToULength=(int8_t)-length;
1534 errorInputLength=cnv->invalidCharLength=cnv->toULength;
1536 uprv_memcpy(cnv->invalidCharBuffer, cnv->toUBytes, errorInputLength);
1540 cnv->toULength=0;
1543 if(cnv->toUCallbackReason==UCNV_ILLEGAL && *err==U_INVALID_CHAR_FOUND) {
1544 cnv->toUCallbackReason = UCNV_UNASSIGNED;
1546 cnv->fromCharErrorBehaviour(cnv->toUContext, pArgs,
1547 cnv->invalidCharBuffer, errorInputLength,
1548 cnv->toUCallbackReason,
1550 cnv->toUCallbackReason = UCNV_ILLEGAL; /* reset to default value */
1566 * Call this function if(cnv->UCharErrorBufferLength>0).
1570 ucnv_outputOverflowToUnicode(UConverter *cnv,
1585 overflow=cnv->UCharErrorBuffer;
1586 length=cnv->UCharErrorBufferLength;
1597 cnv->UCharErrorBufferLength=(int8_t)j;
1614 cnv->UCharErrorBufferLength=0;
1623 ucnv_toUnicode(UConverter *cnv,
1638 if(cnv==NULL || target==NULL || source==NULL) {
1684 if( cnv->UCharErrorBufferLength>0 &&
1685 ucnv_outputOverflowToUnicode(cnv, target, targetLimit, &offsets, err)
1692 if(!flush && s==sourceLimit && cnv->preToULength>=0) {
1706 args.converter=cnv;
1724 ucnv_fromUChars(UConverter *cnv,
1737 if( cnv==NULL ||
1746 ucnv_resetFromUnicode(cnv);
1757 ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, true, pErrorCode);
1768 ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, true, pErrorCode);
1780 ucnv_toUChars(UConverter *cnv,
1793 if( cnv==NULL ||
1802 ucnv_resetToUnicode(cnv);
1813 ucnv_toUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, true, pErrorCode);
1825 ucnv_toUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, true, pErrorCode);
1840 ucnv_getNextUChar(UConverter *cnv,
1854 if(cnv==NULL || source==NULL) {
1885 if(cnv->UCharErrorBufferLength>0) {
1888 overflow=cnv->UCharErrorBuffer;
1890 length=cnv->UCharErrorBufferLength;
1894 if((cnv->UCharErrorBufferLength=(int8_t)(length-i))>0) {
1895 uprv_memmove(cnv->UCharErrorBuffer, cnv->UCharErrorBuffer+i,
1896 cnv->UCharErrorBufferLength*U_SIZEOF_UCHAR);
1917 args.converter=cnv;
1935 if(cnv->toULength==0 && cnv->sharedData->impl->getNextUChar!=NULL) {
1936 c=cnv->sharedData->impl->getNextUChar(&args, err);
1940 _reset(cnv, UCNV_RESET_TO_UNICODE, false);
1987 if(cnv->UCharErrorBufferLength>0) {
1989 if(U16_IS_TRAIL(c2=cnv->UCharErrorBuffer[0])) {
1994 if((--cnv->UCharErrorBufferLength)>0) {
1995 uprv_memmove(cnv->UCharErrorBuffer, cnv->UCharErrorBuffer+1,
1996 cnv->UCharErrorBufferLength*U_SIZEOF_UCHAR);
2026 if((length=cnv->UCharErrorBufferLength)>0) {
2027 uprv_memmove(cnv->UCharErrorBuffer+delta, cnv->UCharErrorBuffer,
2030 cnv->UCharErrorBufferLength=(int8_t)(length+delta);
2032 cnv->UCharErrorBuffer[0]=buffer[i++];
2034 cnv->UCharErrorBuffer[1]=buffer[i];
2528 UConverter *cnv,
2540 if( cnv==NULL || source==NULL || sourceLength<-1 ||
2561 /* cnv->Unicode->algo */
2562 ucnv_resetToUnicode(cnv);
2564 from=cnv;
2566 /* algo->Unicode->cnv */
2567 ucnv_resetFromUnicode(cnv);
2569 to=cnv;
2584 UConverter *cnv,
2588 return ucnv_convertAlgorithmic(true, algorithmicType, cnv,
2595 ucnv_fromAlgorithmic(UConverter *cnv,
2600 return ucnv_convertAlgorithmic(false, algorithmicType, cnv,
2634 static const UAmbiguousConverter *ucnv_getAmbiguous(const UConverter *cnv)
2640 if(cnv==NULL) {
2645 name=ucnv_getName(cnv, &errorCode);
2662 ucnv_fixFileSeparator(const UConverter *cnv,
2669 if(cnv==NULL || source==NULL || sourceLength<=0 || (a=ucnv_getAmbiguous(cnv))==NULL)
2683 ucnv_isAmbiguous(const UConverter *cnv) {
2684 return (UBool)(ucnv_getAmbiguous(cnv)!=NULL);
2688 ucnv_setFallback(UConverter *cnv, UBool usesFallback)
2690 cnv->useFallback = usesFallback;
2694 ucnv_usesFallback(const UConverter *cnv)
2696 return cnv->useFallback;
2843 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status)
2848 if(cnv == NULL){
2853 if(cnv->preFromUFirstCP >= 0){
2854 return U16_LENGTH(cnv->preFromUFirstCP)+cnv->preFromULength ;
2855 }else if(cnv->preFromULength < 0){
2856 return -cnv->preFromULength ;
2857 }else if(cnv->fromUChar32 > 0){
2865 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status){
2870 if(cnv == NULL){
2875 if(cnv->preToULength > 0){
2876 return cnv->preToULength ;
2877 }else if(cnv->preToULength < 0){
2878 return -cnv->preToULength;
2879 }else if(cnv->toULength > 0){
2880 return cnv->toULength;
2886 ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status){
2891 if (cnv == NULL) {
2896 switch (ucnv_getType(cnv)) {