- {
- int32_t saveIndex=0;
- int32_t currentOffset = (args->offsets) ? *(offsets-1)+1:0;
- char * saveTarget = args->target;
- const UChar* saveSource = args->source;
- int32_t *saveOffsets = args->offsets;
-
- args->converter->invalidUCharLength = 0;
-
- if(mySourceChar>0xffff){
- args->converter->invalidUCharBuffer[args->converter->invalidUCharLength++] =(uint16_t)(((mySourceChar)>>10)+0xd7c0);
- args->converter->invalidUCharBuffer[args->converter->invalidUCharLength++] =(uint16_t)(((mySourceChar)&0x3ff)|0xdc00);
- }
- else{
- args->converter->invalidUCharBuffer[args->converter->invalidUCharLength++] =(UChar)mySourceChar;
- }
-
- myConverterData->isTargetUCharDBCS = (UBool)isTargetUCharDBCS;
- args->target += myTargetIndex;
- args->source += mySourceIndex;
- args->offsets = args->offsets?offsets:0;
-
-
- saveIndex = myTargetIndex;
- /*copies current values for the ErrorFunctor to update */
- /*Calls the ErrorFunctor */
- args->converter->fromUCharErrorBehaviour ( args->converter->fromUContext,
- args,
- args->converter->invalidUCharBuffer,
- args->converter->invalidUCharLength,
- (UChar32) (mySourceChar),
- reason,
- err);
- /*Update the local Indexes so that the conversion
- *can restart at the right points
- */
- myTargetIndex = (int32_t)(args->target - (char*)myTarget);
- mySourceIndex = (int32_t)(args->source - mySource);
- args->offsets = saveOffsets;
- saveIndex = myTargetIndex - saveIndex;
- if(args->offsets){
- args->offsets = saveOffsets;
- while(saveIndex-->0){
- *offsets = currentOffset;
- offsets++;
- }
- }
- isTargetUCharDBCS=myConverterData->isTargetUCharDBCS;
- args->source = saveSource;
- args->target = saveTarget;
- args->offsets = saveOffsets;
- args->converter->fromUSurrogateLead=0x00;
- if (U_FAILURE (*err))
- break;
-
- }