-/**
- * Calls invalid char callback when an invalid character sequence is encountered.
- * It presumes that the converter has a callback to call.
- *
- * @returns true when callback fails
- */
-static UBool
-T_UConverter_toUnicode_InvalidChar_Callback(UConverterToUnicodeArgs * args,
- UConverterCallbackReason reason,
- UErrorCode *err)
-{
- UConverter *converter = args->converter;
-
- if (U_SUCCESS(*err))
- {
- if (reason == UCNV_ILLEGAL) {
- *err = U_ILLEGAL_CHAR_FOUND;
- } else {
- *err = U_INVALID_CHAR_FOUND;
- }
- }
-
- /* copy the toUBytes to the invalidCharBuffer */
- uprv_memcpy(converter->invalidCharBuffer,
- converter->toUBytes,
- converter->invalidCharLength);
-
- /* Call the ErrorFunction */
- args->converter->fromCharErrorBehaviour(converter->toUContext,
- args,
- converter->invalidCharBuffer,
- converter->invalidCharLength,
- reason,
- err);
-
- return (UBool)U_FAILURE(*err);
-}
-
-static UBool
-T_UConverter_toUnicode_InvalidChar_OffsetCallback(UConverterToUnicodeArgs * args,
- int32_t currentOffset,
- UConverterCallbackReason reason,
- UErrorCode *err)
-{
- int32_t *saveOffsets = args->offsets;
- UBool result;
-
- result = T_UConverter_toUnicode_InvalidChar_Callback(args, reason, err);
-
- while (saveOffsets < args->offsets)
- {
- *(saveOffsets++) = currentOffset;
- }
- return result;
-}