ICU-1019 add const to the context pointers

X-SVN-Rev: 5105
This commit is contained in:
George Rhoten 2001-06-26 22:51:14 +00:00
parent 38e4f30d5d
commit 35591e5501
15 changed files with 187 additions and 186 deletions

View File

@ -327,14 +327,14 @@ UnicodeConverter::getCodepage(UErrorCode& err) const
void
UnicodeConverter::getMissingCharAction(UConverterToUCallback *action,
void **context) const
const void **context) const
{
ucnv_getToUCallBack(myUnicodeConverter, action, context);
}
void
UnicodeConverter::getMissingUnicodeAction(UConverterFromUCallback *action,
void **context) const
const void **context) const
{
ucnv_getFromUCallBack(myUnicodeConverter, action, context);
}
@ -342,20 +342,20 @@ UnicodeConverter::getMissingUnicodeAction(UConverterFromUCallback *action,
void
UnicodeConverter::setMissingCharAction(UConverterToUCallback newAction,
void *newContext,
UConverterToUCallback *oldAction,
void **oldContext,
UErrorCode& err)
const void *newContext,
UConverterToUCallback *oldAction,
const void **oldContext,
UErrorCode& err)
{
ucnv_setToUCallBack(myUnicodeConverter, newAction, newContext, oldAction, oldContext, &err);
}
void
UnicodeConverter::setMissingUnicodeAction(UConverterFromUCallback newAction,
void* newContext,
UConverterFromUCallback *oldAction,
void** oldContext,
UErrorCode& err)
const void* newContext,
UConverterFromUCallback *oldAction,
const void** oldContext,
UErrorCode& err)
{
ucnv_setFromUCallBack(myUnicodeConverter, newAction, newContext, oldAction, oldContext, &err);
}

View File

@ -562,7 +562,7 @@ UConverterPlatform ucnv_getPlatform (const UConverter * converter,
U_CAPI void U_EXPORT2
ucnv_getToUCallBack (const UConverter * converter,
UConverterToUCallback *action,
void **context)
const void **context)
{
*action = converter->fromCharErrorBehaviour;
*context = converter->toUContext;
@ -571,7 +571,7 @@ U_CAPI void U_EXPORT2
U_CAPI void U_EXPORT2
ucnv_getFromUCallBack (const UConverter * converter,
UConverterFromUCallback *action,
void **context)
const void **context)
{
*action = converter->fromUCharErrorBehaviour;
*context = converter->fromUContext;
@ -579,9 +579,9 @@ U_CAPI void U_EXPORT2
void ucnv_setToUCallBack (UConverter * converter,
UConverterToUCallback newAction,
void* newContext,
const void* newContext,
UConverterToUCallback *oldAction,
void** oldContext,
const void** oldContext,
UErrorCode * err)
{
if (U_FAILURE (*err))
@ -594,9 +594,9 @@ void ucnv_setToUCallBack (UConverter * converter,
void ucnv_setFromUCallBack (UConverter * converter,
UConverterFromUCallback newAction,
void* newContext,
const void* newContext,
UConverterFromUCallback *oldAction,
void** oldContext,
const void** oldContext,
UErrorCode * err)
{

View File

@ -116,7 +116,7 @@ struct UConverter {
* Error function pointer called when conversion issues
* occur during a ucnv_fromUnicode call
*/
void (*fromUCharErrorBehaviour) (void *context,
void (*fromUCharErrorBehaviour) (const void *context,
UConverterFromUnicodeArgs *args,
const UChar *codeUnits,
int32_t length,
@ -127,15 +127,15 @@ struct UConverter {
* Error function pointer called when conversion issues
* occur during a T_UConverter_toUnicode call
*/
void (*fromCharErrorBehaviour) (void *context,
void (*fromCharErrorBehaviour) (const void *context,
UConverterToUnicodeArgs *args,
const char *codeUnits,
int32_t length,
UConverterCallbackReason reason,
UErrorCode *);
void *fromUContext;
void *toUContext;
const void *fromUContext;
const void *toUContext;
UBool isCopyLocal; /* TRUE if created by safeClone with no allocation or ref count */
UConverterSharedData *sharedData; /* Pointer to the shared immutable part of the converter object */

View File

@ -78,7 +78,7 @@ itou (UChar * buffer, uint32_t i, uint32_t radix, int32_t pad)
/*Function Pointer STOPS at the ILLEGAL_SEQUENCE */
void UCNV_FROM_U_CALLBACK_STOP (
void *context,
const void *context,
UConverterFromUnicodeArgs *fromUArgs,
const UChar* codeUnits,
int32_t length,
@ -93,7 +93,7 @@ void UCNV_FROM_U_CALLBACK_STOP (
/*Function Pointer STOPS at the ILLEGAL_SEQUENCE */
void UCNV_TO_U_CALLBACK_STOP (
void *context,
const void *context,
UConverterToUnicodeArgs *toUArgs,
const char* codePoints,
int32_t length,
@ -105,7 +105,7 @@ void UCNV_TO_U_CALLBACK_STOP (
}
void UCNV_FROM_U_CALLBACK_SKIP (
void *context,
const void *context,
UConverterFromUnicodeArgs *fromUArgs,
const UChar* codeUnits,
int32_t length,
@ -140,7 +140,7 @@ void UCNV_FROM_U_CALLBACK_SKIP (
}
void UCNV_FROM_U_CALLBACK_SUBSTITUTE (
void *context,
const void *context,
UConverterFromUnicodeArgs *fromArgs,
const UChar* codeUnits,
int32_t length,
@ -183,7 +183,7 @@ void UCNV_FROM_U_CALLBACK_SUBSTITUTE (
*we revert to substituting with subchar)
*/
void UCNV_FROM_U_CALLBACK_ESCAPE (
void *context,
const void *context,
UConverterFromUnicodeArgs *fromArgs,
const UChar *codeUnits,
int32_t length,
@ -199,10 +199,10 @@ void UCNV_FROM_U_CALLBACK_ESCAPE (
const UChar *myValueSource = NULL;
UErrorCode err2 = U_ZERO_ERROR;
UConverterFromUCallback original = NULL;
void *originalContext;
const void *originalContext;
UConverterFromUCallback ignoredCallback = NULL;
void *ignoredContext;
const void *ignoredContext;
if (reason > UCNV_IRREGULAR)
{
@ -324,7 +324,7 @@ void UCNV_FROM_U_CALLBACK_ESCAPE (
void UCNV_TO_U_CALLBACK_SKIP (
void *context,
const void *context,
UConverterToUnicodeArgs *toArgs,
const char* codeUnits,
int32_t length,
@ -358,7 +358,7 @@ void UCNV_TO_U_CALLBACK_SKIP (
}
void UCNV_TO_U_CALLBACK_SUBSTITUTE (
void *context,
const void *context,
UConverterToUnicodeArgs *toArgs,
const char* codeUnits,
int32_t length,
@ -399,7 +399,7 @@ void UCNV_TO_U_CALLBACK_SUBSTITUTE (
*and uses that as the substitution sequence
*/
void UCNV_TO_U_CALLBACK_ESCAPE (
void *context,
const void *context,
UConverterToUnicodeArgs *toArgs,
const char* codeUnits,
int32_t length,

View File

@ -339,13 +339,13 @@ _MBCSWriteSub(UConverterFromUnicodeArgs *pArgs,
static void
fromUCallback(UConverter *cnv,
void *context, UConverterFromUnicodeArgs *pArgs,
const void *context, UConverterFromUnicodeArgs *pArgs,
UChar32 codePoint,
UConverterCallbackReason reason, UErrorCode *pErrorCode);
static void
toUCallback(UConverter *cnv,
void *context, UConverterToUnicodeArgs *pArgs,
const void *context, UConverterToUnicodeArgs *pArgs,
const char *codeUnits, int32_t length,
UConverterCallbackReason reason, UErrorCode *pErrorCode);
@ -3250,7 +3250,7 @@ const UConverterSharedData _MBCSData={
/* the callback functions handle GB 18030 specially */
static void
fromUCallback(UConverter *cnv,
void *context, UConverterFromUnicodeArgs *pArgs,
const void *context, UConverterFromUnicodeArgs *pArgs,
UChar32 codePoint,
UConverterCallbackReason reason, UErrorCode *pErrorCode) {
int32_t i;
@ -3297,7 +3297,7 @@ fromUCallback(UConverter *cnv,
static void
toUCallback(UConverter *cnv,
void *context, UConverterToUnicodeArgs *pArgs,
const void *context, UConverterToUnicodeArgs *pArgs,
const char *codeUnits, int32_t length,
UConverterCallbackReason reason, UErrorCode *pErrorCode) {
int32_t i;

View File

@ -288,7 +288,7 @@ const char* getName( UErrorCode& err) const;
* @stable
*/
void getMissingCharAction(UConverterToUCallback *action,
void **context) const;
const void **context) const;
/**
* Return the current setting action taken when a unicode character is missing
@ -298,7 +298,7 @@ const char* getName( UErrorCode& err) const;
* @stable
*/
void getMissingUnicodeAction(UConverterFromUCallback *action,
void **context) const;
const void **context) const;
/**
* Sets the current setting action taken when a character from a codepage is
@ -311,9 +311,9 @@ const char* getName( UErrorCode& err) const;
* @stable
*/
void setMissingCharAction(UConverterToUCallback newAction,
void* newContext,
const void* newContext,
UConverterToUCallback *oldAction,
void** oldContext,
const void** oldContext,
UErrorCode& err);
/**
@ -328,9 +328,9 @@ const char* getName( UErrorCode& err) const;
* @stable
*/
void setMissingUnicodeAction(UConverterFromUCallback newAction,
void* newContext,
const void* newContext,
UConverterFromUCallback *oldAction,
void** oldContext,
const void** oldContext,
UErrorCode& err);
/**
* Returns the localized name of the UnicodeConverter, if for any reason it is

View File

@ -112,7 +112,7 @@ typedef enum {
*/
typedef void (*UConverterToUCallback) (
void* context,
const void* context,
UConverterToUnicodeArgs *args,
const char *codePoints,
int32_t length,
@ -132,7 +132,7 @@ typedef void (*UConverterToUCallback) (
*/
typedef void (*UConverterFromUCallback) (
void* context,
const void* context,
UConverterFromUnicodeArgs *args,
const UChar* codeUnits,
int32_t length,
@ -609,7 +609,7 @@ U_CAPI void U_EXPORT2 ucnv_getStarters(const UConverter* converter,
U_CAPI void U_EXPORT2
ucnv_getToUCallBack (const UConverter * converter,
UConverterToUCallback *action,
void **context);
const void **context);
/**
* Gets the current callback function used by the converter when illegal
@ -625,7 +625,7 @@ ucnv_getToUCallBack (const UConverter * converter,
U_CAPI void U_EXPORT2
ucnv_getFromUCallBack (const UConverter * converter,
UConverterFromUCallback *action,
void **context);
const void **context);
/**
* Changes the callback function used by the converter when
@ -644,9 +644,9 @@ ucnv_getFromUCallBack (const UConverter * converter,
U_CAPI void U_EXPORT2
ucnv_setToUCallBack (UConverter * converter,
UConverterToUCallback newAction,
void* newContext,
const void* newContext,
UConverterToUCallback *oldAction,
void** oldContext,
const void** oldContext,
UErrorCode * err);
/**
@ -666,9 +666,9 @@ ucnv_setToUCallBack (UConverter * converter,
U_CAPI void U_EXPORT2
ucnv_setFromUCallBack (UConverter * converter,
UConverterFromUCallback newAction,
void *newContext,
const void *newContext,
UConverterFromUCallback *oldAction,
void **oldContext,
const void **oldContext,
UErrorCode * err);
/**

View File

@ -28,8 +28,8 @@
* \code
* UErrorCode err = U_ZERO_ERROR;
* UConverter* myConverter = ucnv_open("ibm-949", &err);
* void *newContext = NULL;
* void *oldContext;
* const void *newContext = NULL;
* const void *oldContext;
* UConverterFromUCallback oldAction;
*
*
@ -133,7 +133,7 @@ typedef struct {
* @stable
*/
U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP (
void *context,
const void *context,
UConverterFromUnicodeArgs *fromUArgs,
const UChar* codeUnits,
int32_t length,
@ -151,7 +151,7 @@ U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP (
* @stable
*/
U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP (
void *context,
const void *context,
UConverterToUnicodeArgs *fromUArgs,
const char* codeUnits,
int32_t length,
@ -171,7 +171,7 @@ U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP (
* @stable
*/
U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP (
void *context,
const void *context,
UConverterFromUnicodeArgs *fromUArgs,
const UChar* codeUnits,
int32_t length,
@ -194,7 +194,7 @@ U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP (
*/
U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE (
void *context,
const void *context,
UConverterFromUnicodeArgs *fromUArgs,
const UChar* codeUnits,
int32_t length,
@ -243,7 +243,7 @@ U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE (
*/
U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE (
void *context,
const void *context,
UConverterFromUnicodeArgs *fromUArgs,
const UChar* codeUnits,
int32_t length,
@ -265,7 +265,7 @@ U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE (
* @stable
*/
U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP (
void *context,
const void *context,
UConverterToUnicodeArgs *fromUArgs,
const char* codeUnits,
int32_t length,
@ -284,7 +284,7 @@ U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP (
* @stable
*/
U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE (
void *context,
const void *context,
UConverterToUnicodeArgs *fromUArgs,
const char* codeUnits,
int32_t length,
@ -300,7 +300,7 @@ U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE (
*/
U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE (
void *context,
const void *context,
UConverterToUnicodeArgs *fromUArgs,
const char* codeUnits,
int32_t length,

View File

@ -76,7 +76,7 @@ static void TestConvert()
char ucs_file_name[UCS_FILE_NAME_SIZE];
UConverterFromUCallback MIA1, MIA1_2;
UConverterToUCallback MIA2, MIA2_2;
void *MIA1Context, *MIA1Context2, *MIA2Context, *MIA2Context2;
const void *MIA1Context, *MIA1Context2, *MIA2Context, *MIA2Context2;
UConverter* someConverters[5];
UConverter* myConverter = 0;
UChar* displayname = 0;
@ -150,8 +150,8 @@ static void TestConvert()
UConverterFromUCallback oldFromUAction = NULL;
UConverterToUCallback oldToUAction = NULL;
void* oldFromUContext = NULL;
void* oldToUContext = NULL;
const void* oldFromUContext = NULL;
const void* oldToUContext = NULL;
/* Allocate memory */
mytarget = (char*) malloc(MAX_FILE_LEN * sizeof(mytarget[0]));

View File

@ -212,7 +212,7 @@ char *aescstrdup(const UChar* unichars){
int length;
char *newString,*targetLimit,*target;
UConverterFromUCallback cb;
void *p;
const void *p;
UErrorCode errorCode = U_ZERO_ERROR;
UConverter* conv = ucnv_open("US-ASCII",&errorCode);

View File

@ -78,6 +78,7 @@ static void setNuConvTestName(const char *codepage, const char *direction)
}
void addTestConvertErrorCallBack(TestNode** root);
void addTestConvertErrorCallBack(TestNode** root)
{
@ -178,15 +179,15 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
if(!testConvertFromUnicode(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
expskipIBM_949, sizeof(expskipIBM_949), "ibm-949",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, toIBM949Offsskip, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SKIP, toIBM949Offsskip, NULL, 0 ))
log_err("u-> ibm-949 with skip did not match.\n");
if(!testConvertFromUnicode(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]),
expskipIBM_943, sizeof(expskipIBM_943), "ibm-943",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, toIBM943Offsskip, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SKIP, toIBM943Offsskip, NULL, 0 ))
log_err("u-> ibm-943 with skip did not match.\n");
if(!testConvertFromUnicode(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]),
expskipIBM_930, sizeof(expskipIBM_930), "ibm-930",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, toIBM930Offsskip , NULL, 0))
UCNV_FROM_U_CALLBACK_SKIP, toIBM930Offsskip , NULL, 0))
log_err("u-> ibm-930 with skip did not match.\n");
{
@ -404,72 +405,72 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
if(!testConvertFromUnicode(inputTest, sizeof(inputTest)/sizeof(inputTest[0]),
toIBM943, sizeof(toIBM943), "ibm-943",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, offset, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SKIP, offset, NULL, 0 ))
log_err("u-> ibm-943 with skip did not match.\n");
if(!testConvertFromUnicode(euc_jp_inputText, sizeof(euc_jp_inputText)/sizeof(euc_jp_inputText[0]),
to_euc_jp, sizeof(to_euc_jp), "euc-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, fromEUC_JPOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SKIP, fromEUC_JPOffs, NULL, 0 ))
log_err("u-> euc-jp with skip did not match.\n");
if(!testConvertFromUnicode(euc_tw_inputText, sizeof(euc_tw_inputText)/sizeof(euc_tw_inputText[0]),
to_euc_tw, sizeof(to_euc_tw), "euc-tw",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, from_euc_twOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SKIP, from_euc_twOffs, NULL, 0 ))
log_err("u-> euc-tw with skip did not match.\n");
/*iso_2022_jp*/
if(!testConvertFromUnicode(iso_2022_jp_inputText, sizeof(iso_2022_jp_inputText)/sizeof(iso_2022_jp_inputText[0]),
to_iso_2022_jp, sizeof(to_iso_2022_jp), "iso-2022-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_jpOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_jpOffs, NULL, 0 ))
log_err("u-> iso-2022-jp with skip did not match.\n");
if(!testConvertFromUnicode(iso_2022_jp_inputText1, sizeof(iso_2022_jp_inputText1)/sizeof(iso_2022_jp_inputText1[0]),
to_iso_2022_jp1, sizeof(to_iso_2022_jp1), "iso-2022-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_jpOffs1, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_jpOffs1, NULL, 0 ))
log_err("u-> iso-2022-jp with skip did not match.\n");
/* with context */
if(!testConvertFromUnicodeWithContext(iso_2022_jp_inputText2, sizeof(iso_2022_jp_inputText2)/sizeof(iso_2022_jp_inputText2[0]),
to_iso_2022_jp2, sizeof(to_iso_2022_jp2), "iso-2022-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_jpOffs2, NULL, 0,UCNV_SKIP_STOP_ON_ILLEGAL,U_ILLEGAL_CHAR_FOUND ))
UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_jpOffs2, NULL, 0,UCNV_SKIP_STOP_ON_ILLEGAL,U_ILLEGAL_CHAR_FOUND ))
log_err("u-> iso-2022-jp with skip & UCNV_SKIP_STOP_ON_ILLEGAL did not match.\n");
/*iso_2022_cn*/
if(!testConvertFromUnicode(iso_2022_cn_inputText, sizeof(iso_2022_cn_inputText)/sizeof(iso_2022_cn_inputText[0]),
to_iso_2022_cn, sizeof(to_iso_2022_cn), "iso-2022-cn",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_cnOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_cnOffs, NULL, 0 ))
log_err("u-> iso-2022-cn with skip did not match.\n");
/*with context*/
if(!testConvertFromUnicodeWithContext(iso_2022_cn_inputText1, sizeof(iso_2022_cn_inputText1)/sizeof(iso_2022_cn_inputText1[0]),
to_iso_2022_cn1, sizeof(to_iso_2022_cn1), "iso-2022-cn",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_cnOffs1, NULL, 0,UCNV_SKIP_STOP_ON_ILLEGAL,U_ILLEGAL_CHAR_FOUND ))
UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_cnOffs1, NULL, 0,UCNV_SKIP_STOP_ON_ILLEGAL,U_ILLEGAL_CHAR_FOUND ))
log_err("u-> iso-2022-cn with skip & UCNV_SKIP_STOP_ON_ILLEGAL did not match.\n");
/*iso_2022_kr*/
if(!testConvertFromUnicode(iso_2022_kr_inputText, sizeof(iso_2022_kr_inputText)/sizeof(iso_2022_kr_inputText[0]),
to_iso_2022_kr, sizeof(to_iso_2022_kr), "iso-2022-kr",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_krOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_krOffs, NULL, 0 ))
log_err("u-> iso-2022-kr with skip did not match.\n");
/*with context*/
if(!testConvertFromUnicodeWithContext(iso_2022_kr_inputText1, sizeof(iso_2022_kr_inputText1)/sizeof(iso_2022_kr_inputText1[0]),
to_iso_2022_kr1, sizeof(to_iso_2022_kr1), "iso-2022-kr",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_krOffs1, NULL, 0,UCNV_SKIP_STOP_ON_ILLEGAL,U_ILLEGAL_CHAR_FOUND ))
UCNV_FROM_U_CALLBACK_SKIP, from_iso_2022_krOffs1, NULL, 0,UCNV_SKIP_STOP_ON_ILLEGAL,U_ILLEGAL_CHAR_FOUND ))
log_err("u-> iso-2022-kr with skip & UCNV_SKIP_STOP_ON_ILLEGAL did not match.\n");
/*hz*/
if(!testConvertFromUnicode(hz_inputText, sizeof(hz_inputText)/sizeof(hz_inputText[0]),
to_hz, sizeof(to_hz), "HZ",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, from_hzOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SKIP, from_hzOffs, NULL, 0 ))
log_err("u-> HZ with skip did not match.\n");
/*with context*/
if(!testConvertFromUnicodeWithContext(hz_inputText1, sizeof(hz_inputText1)/sizeof(hz_inputText1[0]),
to_hz1, sizeof(to_hz1), "hz",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, from_hzOffs1, NULL, 0,UCNV_SKIP_STOP_ON_ILLEGAL,U_ILLEGAL_CHAR_FOUND ))
UCNV_FROM_U_CALLBACK_SKIP, from_hzOffs1, NULL, 0,UCNV_SKIP_STOP_ON_ILLEGAL,U_ILLEGAL_CHAR_FOUND ))
log_err("u-> hz with skip & UCNV_SKIP_STOP_ON_ILLEGAL did not match.\n");
/*SCSU*/
if(!testConvertFromUnicode(SCSU_inputText, sizeof(SCSU_inputText)/sizeof(SCSU_inputText[0]),
to_SCSU, sizeof(to_SCSU), "SCSU",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, from_SCSUOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SKIP, from_SCSUOffs, NULL, 0 ))
log_err("u-> SCSU with skip did not match.\n");
@ -481,16 +482,16 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
if(!testConvertToUnicode(expskipIBM_949, sizeof(expskipIBM_949),
IBM_949skiptoUnicode, sizeof(IBM_949skiptoUnicode)/sizeof(IBM_949skiptoUnicode),"ibm-949",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, fromIBM949Offs, NULL, 0 ))
UCNV_TO_U_CALLBACK_SKIP, fromIBM949Offs, NULL, 0 ))
log_err("ibm-949->u with skip did not match.\n");
if(!testConvertToUnicode(expskipIBM_943, sizeof(expskipIBM_943),
IBM_943skiptoUnicode, sizeof(IBM_943skiptoUnicode)/sizeof(IBM_943skiptoUnicode[0]),"ibm-943",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, fromIBM943Offs, NULL, 0 ))
UCNV_TO_U_CALLBACK_SKIP, fromIBM943Offs, NULL, 0 ))
log_err("ibm-943->u with skip did not match.\n");
if(!testConvertToUnicode(expskipIBM_930, sizeof(expskipIBM_930),
IBM_930skiptoUnicode, sizeof(IBM_930skiptoUnicode)/sizeof(IBM_930skiptoUnicode[0]),"ibm-930",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, fromIBM930Offs, NULL, 0 ))
UCNV_TO_U_CALLBACK_SKIP, fromIBM930Offs, NULL, 0 ))
log_err("ibm-930->u with skip did not match.\n");
{
@ -631,47 +632,47 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
if(!testConvertToUnicode(sampleTxtEBCIDIC_STATEFUL, sizeof(sampleTxtEBCIDIC_STATEFUL),
EBCIDIC_STATEFUL_toUnicode, sizeof(EBCIDIC_STATEFUL_toUnicode)/sizeof(EBCIDIC_STATEFUL_toUnicode[0]),"ibm-930",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, from_EBCIDIC_STATEFULOffsets, NULL, 0 ))
UCNV_TO_U_CALLBACK_SKIP, from_EBCIDIC_STATEFULOffsets, NULL, 0 ))
log_err("EBCIDIC_STATEFUL->u with skip did not match.\n");
if(!testConvertToUnicode(sampleTxt_euc_jp, sizeof(sampleTxt_euc_jp),
euc_jptoUnicode, sizeof(euc_jptoUnicode)/sizeof(euc_jptoUnicode[0]),"euc-jp",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, from_euc_jpOffs , NULL, 0))
UCNV_TO_U_CALLBACK_SKIP, from_euc_jpOffs , NULL, 0))
log_err("euc-jp->u with skip did not match.\n");
if(!testConvertToUnicode(sampleTxt_euc_tw, sizeof(sampleTxt_euc_tw),
euc_twtoUnicode, sizeof(euc_twtoUnicode)/sizeof(euc_twtoUnicode[0]),"euc-tw",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, from_euc_twOffs , NULL, 0))
UCNV_TO_U_CALLBACK_SKIP, from_euc_twOffs , NULL, 0))
log_err("euc-tw->u with skip did not match.\n");
if(!testConvertToUnicode(sampleTxt_iso_2022_jp, sizeof(sampleTxt_iso_2022_jp),
iso_2022_jptoUnicode, sizeof(iso_2022_jptoUnicode)/sizeof(iso_2022_jptoUnicode[0]),"iso-2022-jp",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, from_iso_2022_jpOffs , NULL, 0))
UCNV_TO_U_CALLBACK_SKIP, from_iso_2022_jpOffs , NULL, 0))
log_err("iso-2022-jp->u with skip did not match.\n");
if(!testConvertToUnicode(sampleTxt_iso_2022_cn, sizeof(sampleTxt_iso_2022_cn),
iso_2022_cntoUnicode, sizeof(iso_2022_cntoUnicode)/sizeof(iso_2022_cntoUnicode[0]),"iso-2022-cn",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, from_iso_2022_cnOffs , NULL, 0))
UCNV_TO_U_CALLBACK_SKIP, from_iso_2022_cnOffs , NULL, 0))
log_err("iso-2022-cn->u with skip did not match.\n");
if(!testConvertToUnicode(sampleTxt_iso_2022_kr, sizeof(sampleTxt_iso_2022_kr),
iso_2022_krtoUnicode, sizeof(iso_2022_krtoUnicode)/sizeof(iso_2022_krtoUnicode[0]),"iso-2022-kr",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, from_iso_2022_krOffs , NULL, 0))
UCNV_TO_U_CALLBACK_SKIP, from_iso_2022_krOffs , NULL, 0))
log_err("iso-2022-kr->u with skip did not match.\n");
if(!testConvertToUnicode(sampleTxt_hz, sizeof(sampleTxt_hz),
hztoUnicode, sizeof(hztoUnicode)/sizeof(hztoUnicode[0]),"HZ",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, from_hzOffs , NULL, 0))
UCNV_TO_U_CALLBACK_SKIP, from_hzOffs , NULL, 0))
log_err("HZ->u with skip did not match.\n");
if(/* broken for icu 1.6 and 1.6.0.1, do not test */uprv_strcmp("1.7", U_ICU_VERSION) != 0 && !testConvertToUnicode(sampleTxtLMBCS, sizeof(sampleTxtLMBCS),
LMBCSToUnicode, sizeof(LMBCSToUnicode)/sizeof(LMBCSToUnicode[0]),"LMBCS-1",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, fromLMBCS , NULL, 0))
UCNV_TO_U_CALLBACK_SKIP, fromLMBCS , NULL, 0))
log_err("LMBCS->u with skip did not match.\n");
}
@ -684,7 +685,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
if(!testConvertToUnicode(sampleText1, sizeof(sampleText1),
expected1, sizeof(expected1)/sizeof(expected1[0]),"utf8",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, offsets1, NULL, 0 ))
UCNV_TO_U_CALLBACK_SKIP, offsets1, NULL, 0 ))
log_err("utf8->u with skip did not match.\n");;
}
@ -696,7 +697,7 @@ static void TestSkip(int32_t inputsize, int32_t outputsize)
if(!testConvertToUnicode(sampleText1, sizeof(sampleText1),
expected1, sizeof(expected1)/sizeof(expected1[0]),"SCSU",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, offsets1, NULL, 0 ))
UCNV_TO_U_CALLBACK_SKIP, offsets1, NULL, 0 ))
log_err("scsu->u with stop did not match.\n");;
}
}
@ -733,15 +734,15 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
/*From Unicode*/
if(!testConvertFromUnicode(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
expstopIBM_949, sizeof(expstopIBM_949), "ibm-949",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP, toIBM949Offsstop, NULL, 0 ))
UCNV_FROM_U_CALLBACK_STOP, toIBM949Offsstop, NULL, 0 ))
log_err("u-> ibm-949 with stop did not match.\n");
if(!testConvertFromUnicode(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]),
expstopIBM_943, sizeof(expstopIBM_943), "ibm-943",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP, toIBM943Offsstop , NULL, 0))
UCNV_FROM_U_CALLBACK_STOP, toIBM943Offsstop , NULL, 0))
log_err("u-> ibm-943 with stop did not match.\n");
if(!testConvertFromUnicode(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]),
expstopIBM_930, sizeof(expstopIBM_930), "ibm-930",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP, toIBM930Offsstop, NULL, 0 ))
UCNV_FROM_U_CALLBACK_STOP, toIBM930Offsstop, NULL, 0 ))
log_err("u-> ibm-930 with stop did not match.\n");
log_verbose("Testing fromUnicode with UCNV_FROM_U_CALLBACK_STOP \n");
@ -809,42 +810,42 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
if(!testConvertFromUnicode(inputTest, sizeof(inputTest)/sizeof(inputTest[0]),
toIBM943, sizeof(toIBM943), "ibm-943",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP, offset, NULL, 0 ))
UCNV_FROM_U_CALLBACK_STOP, offset, NULL, 0 ))
log_err("u-> ibm-943 with stop did not match.\n");
if(!testConvertFromUnicode(euc_jp_inputText, sizeof(euc_jp_inputText)/sizeof(euc_jp_inputText[0]),
to_euc_jp, sizeof(to_euc_jp), "euc-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP, fromEUC_JPOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_STOP, fromEUC_JPOffs, NULL, 0 ))
log_err("u-> euc-jp with stop did not match.\n");
if(!testConvertFromUnicode(euc_tw_inputText, sizeof(euc_tw_inputText)/sizeof(euc_tw_inputText[0]),
to_euc_tw, sizeof(to_euc_tw), "euc-tw",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP, from_euc_twOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_STOP, from_euc_twOffs, NULL, 0 ))
log_err("u-> euc-tw with stop did not match.\n");
if(!testConvertFromUnicode(iso_2022_jp_inputText, sizeof(iso_2022_jp_inputText)/sizeof(iso_2022_jp_inputText[0]),
to_iso_2022_jp, sizeof(to_iso_2022_jp), "iso-2022-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP, from_iso_2022_jpOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_STOP, from_iso_2022_jpOffs, NULL, 0 ))
log_err("u-> iso-2022-jp with stop did not match.\n");
if(!testConvertFromUnicode(iso_2022_jp_inputText, sizeof(iso_2022_jp_inputText)/sizeof(iso_2022_jp_inputText[0]),
to_iso_2022_jp, sizeof(to_iso_2022_jp), "iso-2022-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP, from_iso_2022_jpOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_STOP, from_iso_2022_jpOffs, NULL, 0 ))
log_err("u-> iso-2022-jp with stop did not match.\n");
if(!testConvertFromUnicode(iso_2022_cn_inputText, sizeof(iso_2022_cn_inputText)/sizeof(iso_2022_cn_inputText[0]),
to_iso_2022_cn, sizeof(to_iso_2022_cn), "iso-2022-cn",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP, from_iso_2022_cnOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_STOP, from_iso_2022_cnOffs, NULL, 0 ))
log_err("u-> iso-2022-cn with stop did not match.\n");
if(!testConvertFromUnicode(iso_2022_kr_inputText, sizeof(iso_2022_kr_inputText)/sizeof(iso_2022_kr_inputText[0]),
to_iso_2022_kr, sizeof(to_iso_2022_kr), "iso-2022-kr",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP, from_iso_2022_krOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_STOP, from_iso_2022_krOffs, NULL, 0 ))
log_err("u-> iso-2022-kr with stop did not match.\n");
if(!testConvertFromUnicode(hz_inputText, sizeof(hz_inputText)/sizeof(hz_inputText[0]),
to_hz, sizeof(to_hz), "HZ",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP, from_hzOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_STOP, from_hzOffs, NULL, 0 ))
log_err("u-> HZ with stop did not match.\n");
@ -861,7 +862,7 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
int32_t offsets[]={ 0, 0, 0, 1, 1, 1, 1, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6 };
if(!testConvertFromUnicode(testinput, sizeof(testinput)/sizeof(testinput[0]),
expectedUTF8, sizeof(expectedUTF8), "utf8",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP, offsets, NULL, 0 ))
UCNV_FROM_U_CALLBACK_STOP, offsets, NULL, 0 ))
log_err("u-> utf8 with stop did not match.\n");
}
log_verbose("Testing fromUnicode for SCSU with UCNV_FROM_U_CALLBACK_STOP \n");
@ -878,22 +879,22 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
};
if(!testConvertFromUnicode(SCSU_inputText, sizeof(SCSU_inputText)/sizeof(SCSU_inputText[0]),
to_SCSU, sizeof(to_SCSU), "SCSU",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP, from_SCSUOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_STOP, from_SCSUOffs, NULL, 0 ))
log_err("u-> SCSU with skip did not match.\n");
}
/*to Unicode*/
if(!testConvertToUnicode(expstopIBM_949, sizeof(expstopIBM_949),
IBM_949stoptoUnicode, sizeof(IBM_949stoptoUnicode)/sizeof(IBM_949stoptoUnicode[0]),"ibm-949",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP, fromIBM949Offs, NULL, 0 ))
UCNV_TO_U_CALLBACK_STOP, fromIBM949Offs, NULL, 0 ))
log_err("ibm-949->u with stop did not match.\n");
if(!testConvertToUnicode(expstopIBM_943, sizeof(expstopIBM_943),
IBM_943stoptoUnicode, sizeof(IBM_943stoptoUnicode)/sizeof(IBM_943stoptoUnicode[0]),"ibm-943",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP, fromIBM943Offs, NULL, 0 ))
UCNV_TO_U_CALLBACK_STOP, fromIBM943Offs, NULL, 0 ))
log_err("ibm-943->u with stop did not match.\n");
if(!testConvertToUnicode(expstopIBM_930, sizeof(expstopIBM_930),
IBM_930stoptoUnicode, sizeof(IBM_930stoptoUnicode)/sizeof(IBM_930stoptoUnicode[0]),"ibm-930",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP, fromIBM930Offs, NULL, 0 ))
UCNV_TO_U_CALLBACK_STOP, fromIBM930Offs, NULL, 0 ))
log_err("ibm-930->u with stop did not match.\n");
log_verbose("Testing toUnicode with UCNV_TO_U_CALLBACK_STOP \n");
@ -926,17 +927,17 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
if(!testConvertToUnicode(sampleTxtEBCIDIC_STATEFUL, sizeof(sampleTxtEBCIDIC_STATEFUL),
EBCIDIC_STATEFUL_toUnicode, sizeof(EBCIDIC_STATEFUL_toUnicode)/sizeof(EBCIDIC_STATEFUL_toUnicode[0]),"ibm-930",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP, from_EBCIDIC_STATEFULOffsets, NULL, 0 ))
UCNV_TO_U_CALLBACK_STOP, from_EBCIDIC_STATEFULOffsets, NULL, 0 ))
log_err("EBCIDIC_STATEFUL->u with stop did not match.\n");
if(!testConvertToUnicode(sampleTxt_euc_jp, sizeof(sampleTxt_euc_jp),
euc_jptoUnicode, sizeof(euc_jptoUnicode)/sizeof(euc_jptoUnicode[0]),"euc-jp",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP, from_euc_jpOffs , NULL, 0))
UCNV_TO_U_CALLBACK_STOP, from_euc_jpOffs , NULL, 0))
log_err("euc-jp->u with stop did not match.\n");
if(!testConvertToUnicode(sampleTxt_euc_tw, sizeof(sampleTxt_euc_tw),
euc_twtoUnicode, sizeof(euc_twtoUnicode)/sizeof(euc_twtoUnicode[0]),"euc-tw",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP, from_euc_twOffs, NULL, 0 ))
UCNV_TO_U_CALLBACK_STOP, from_euc_twOffs, NULL, 0 ))
log_err("euc-tw->u with stop did not match.\n");
}
log_verbose("Testing toUnicode for UTF-8 with UCNV_TO_U_CALLBACK_STOP \n");
@ -948,7 +949,7 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
if(!testConvertToUnicode(sampleText1, sizeof(sampleText1),
expected1, sizeof(expected1)/sizeof(expected1[0]),"utf8",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP, offsets1, NULL, 0 ))
UCNV_TO_U_CALLBACK_STOP, offsets1, NULL, 0 ))
log_err("utf8->u with stop did not match.\n");;
}
log_verbose("Testing toUnicode for SCSU with UCNV_TO_U_CALLBACK_STOP \n");
@ -959,7 +960,7 @@ static void TestStop(int32_t inputsize, int32_t outputsize)
if(!testConvertToUnicode(sampleText1, sizeof(sampleText1),
expected1, sizeof(expected1)/sizeof(expected1[0]),"SCSU",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP, offsets1, NULL, 0 ))
UCNV_TO_U_CALLBACK_STOP, offsets1, NULL, 0 ))
log_err("scsu->u with stop did not match.\n");;
}
@ -997,15 +998,15 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
/*from unicode*/
if(!testConvertFromUnicode(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
expsubIBM_949, sizeof(expsubIBM_949), "ibm-949",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SUBSTITUTE, toIBM949Offssub, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SUBSTITUTE, toIBM949Offssub, NULL, 0 ))
log_err("u-> ibm-949 with subst did not match.\n");
if(!testConvertFromUnicode(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]),
expsubIBM_943, sizeof(expsubIBM_943), "ibm-943",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SUBSTITUTE, toIBM943Offssub , NULL, 0))
UCNV_FROM_U_CALLBACK_SUBSTITUTE, toIBM943Offssub , NULL, 0))
log_err("u-> ibm-943 with subst did not match.\n");
if(!testConvertFromUnicode(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]),
expsubIBM_930, sizeof(expsubIBM_930), "ibm-930",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SUBSTITUTE, toIBM930Offssub, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SUBSTITUTE, toIBM930Offssub, NULL, 0 ))
log_err("u-> ibm-930 with subst did not match.\n");
log_verbose("Testing fromUnicode with UCNV_FROM_U_CALLBACK_SUBSTITUTE \n");
@ -1034,17 +1035,17 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
if(!testConvertFromUnicode(inputTest, sizeof(inputTest)/sizeof(inputTest[0]),
toIBM943, sizeof(toIBM943), "ibm-943",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SUBSTITUTE, offset, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SUBSTITUTE, offset, NULL, 0 ))
log_err("u-> ibm-943 with substitute did not match.\n");
if(!testConvertFromUnicode(euc_jp_inputText, sizeof(euc_jp_inputText)/sizeof(euc_jp_inputText[0]),
to_euc_jp, sizeof(to_euc_jp), "euc-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SUBSTITUTE, fromEUC_JPOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SUBSTITUTE, fromEUC_JPOffs, NULL, 0 ))
log_err("u-> euc-jp with substitute did not match.\n");
if(!testConvertFromUnicode(euc_tw_inputText, sizeof(euc_tw_inputText)/sizeof(euc_tw_inputText[0]),
to_euc_tw, sizeof(to_euc_tw), "euc-tw",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SUBSTITUTE, from_euc_twOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SUBSTITUTE, from_euc_twOffs, NULL, 0 ))
log_err("u-> euc-tw with substitute did not match.\n");
}
@ -1067,7 +1068,7 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
};
if(!testConvertFromUnicode(SCSU_inputText, sizeof(SCSU_inputText)/sizeof(SCSU_inputText[0]),
to_SCSU, sizeof(to_SCSU), "SCSU",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SUBSTITUTE, from_SCSUOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SUBSTITUTE, from_SCSUOffs, NULL, 0 ))
log_err("u-> SCSU with skip did not match.\n");
@ -1076,15 +1077,15 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
/*to unicode*/
if(!testConvertToUnicode(expsubIBM_949, sizeof(expsubIBM_949),
IBM_949subtoUnicode, sizeof(IBM_949subtoUnicode)/sizeof(IBM_949subtoUnicode[0]),"ibm-949",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE, fromIBM949Offs, NULL, 0 ))
UCNV_TO_U_CALLBACK_SUBSTITUTE, fromIBM949Offs, NULL, 0 ))
log_err("ibm-949->u with substitute did not match.\n");
if(!testConvertToUnicode(expsubIBM_943, sizeof(expsubIBM_943),
IBM_943subtoUnicode, sizeof(IBM_943subtoUnicode)/sizeof(IBM_943subtoUnicode[0]),"ibm-943",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE, fromIBM943Offs, NULL, 0 ))
UCNV_TO_U_CALLBACK_SUBSTITUTE, fromIBM943Offs, NULL, 0 ))
log_err("ibm-943->u with substitute did not match.\n");
if(!testConvertToUnicode(expsubIBM_930, sizeof(expsubIBM_930),
IBM_930subtoUnicode, sizeof(IBM_930subtoUnicode)/sizeof(IBM_930subtoUnicode[0]),"ibm-930",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE, fromIBM930Offs, NULL, 0 ))
UCNV_TO_U_CALLBACK_SUBSTITUTE, fromIBM930Offs, NULL, 0 ))
log_err("ibm-930->u with substitute did not match.\n");
log_verbose("Testing toUnicode with UCNV_TO_U_CALLBACK_SUBSTITUTE \n");
@ -1118,19 +1119,19 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
if(!testConvertToUnicode(sampleTxtEBCIDIC_STATEFUL, sizeof(sampleTxtEBCIDIC_STATEFUL),
EBCIDIC_STATEFUL_toUnicode, sizeof(EBCIDIC_STATEFUL_toUnicode)/sizeof(EBCIDIC_STATEFUL_toUnicode[0]),"ibm-930",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE, from_EBCIDIC_STATEFULOffsets, NULL, 0 ))
UCNV_TO_U_CALLBACK_SUBSTITUTE, from_EBCIDIC_STATEFULOffsets, NULL, 0 ))
log_err("EBCIDIC_STATEFUL->u with substitute did not match.\n");
if(!testConvertToUnicode(sampleTxt_euc_jp, sizeof(sampleTxt_euc_jp),
euc_jptoUnicode, sizeof(euc_jptoUnicode)/sizeof(euc_jptoUnicode[0]),"euc-jp",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE, from_euc_jpOffs, NULL, 0 ))
UCNV_TO_U_CALLBACK_SUBSTITUTE, from_euc_jpOffs, NULL, 0 ))
log_err("euc-jp->u with substitute did not match.\n");
if(!testConvertToUnicode(sampleTxt_euc_tw, sizeof(sampleTxt_euc_tw),
euc_twtoUnicode, sizeof(euc_twtoUnicode)/sizeof(euc_twtoUnicode[0]),"euc-tw",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE, from_euc_twOffs, NULL, 0 ))
UCNV_TO_U_CALLBACK_SUBSTITUTE, from_euc_twOffs, NULL, 0 ))
log_err("euc-tw->u with substitute did not match.\n");
@ -1144,7 +1145,7 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
if(!testConvertToUnicode(sampleText1, sizeof(sampleText1),
expected1, sizeof(expected1)/sizeof(expected1[0]),"utf8",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets1, NULL, 0 ))
UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets1, NULL, 0 ))
log_err("utf8->u with substitute did not match.\n");;
}
log_verbose("Testing toUnicode for SCSU with UCNV_TO_U_CALLBACK_SUBSTITUTE \n");
@ -1155,7 +1156,7 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
if(!testConvertToUnicode(sampleText1, sizeof(sampleText1),
expected1, sizeof(expected1)/sizeof(expected1[0]),"SCSU",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets1, NULL, 0 ))
UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets1, NULL, 0 ))
log_err("scsu->u with stop did not match.\n");;
}
@ -1170,13 +1171,13 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
static const int32_t offsets2[]={ 1, 3, 5, 7, 10 };
if(!testConvertFromUnicode(u1, ARRAY_LENGTH(u1), s1, ARRAY_LENGTH(s1), "ibm-930",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SUBSTITUTE, offsets1, NULL, 0)
UCNV_FROM_U_CALLBACK_SUBSTITUTE, offsets1, NULL, 0)
) {
log_err("u->ibm-930 subchar/subchar1 did not match.\n");
}
if(!testConvertToUnicode(s2, ARRAY_LENGTH(s2), u2, ARRAY_LENGTH(u2), "ibm-930",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets2, NULL, 0)
UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets2, NULL, 0)
) {
log_err("ibm-930->u subchar/subchar1 did not match.\n");
}
@ -1199,13 +1200,13 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
0, 1, 2, 6, 8, 10, 12, 16, 20, 20, 24, 28, 28 };
if(!testConvertFromUnicode(u1, ARRAY_LENGTH(u1), gb1, ARRAY_LENGTH(gb1), "gb18030",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SUBSTITUTE, offsets1, NULL, 0)
UCNV_FROM_U_CALLBACK_SUBSTITUTE, offsets1, NULL, 0)
) {
log_err("u->gb18030 with substitute did not match.\n");
}
if(!testConvertToUnicode(gb2, ARRAY_LENGTH(gb2), u2, ARRAY_LENGTH(u2), "gb18030",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets2, NULL, 0)
UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets2, NULL, 0)
) {
log_err("gb18030->u with substitute did not match.\n");
}
@ -1225,7 +1226,7 @@ static void TestSub(int32_t inputsize, int32_t outputsize)
};
if(!testConvertToUnicode(utf7, ARRAY_LENGTH(utf7), unicode, ARRAY_LENGTH(unicode), "UTF-7",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets, NULL, 0)
UCNV_TO_U_CALLBACK_SUBSTITUTE, offsets, NULL, 0)
) {
log_err("UTF-7->u with substitute did not match.\n");
}
@ -1258,17 +1259,17 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
/*from Unicode*/
if(!testConvertFromUnicode(sampleText, sizeof(sampleText)/sizeof(sampleText[0]),
expsubwvalIBM_949, sizeof(expsubwvalIBM_949), "ibm-949",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, toIBM949Offs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, toIBM949Offs, NULL, 0 ))
log_err("u-> ibm-949 with subst with value did not match.\n");
if(!testConvertFromUnicode(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]),
expsubwvalIBM_943, sizeof(expsubwvalIBM_943), "ibm-943",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, toIBM943Offs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, toIBM943Offs, NULL, 0 ))
log_err("u-> ibm-943 with sub with value did not match.\n");
if(!testConvertFromUnicode(sampleText2, sizeof(sampleText2)/sizeof(sampleText2[0]),
expsubwvalIBM_930, sizeof(expsubwvalIBM_930), "ibm-930",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, toIBM930Offs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, toIBM930Offs, NULL, 0 ))
log_err("u-> ibm-930 with subst with value did not match.\n");
@ -1528,37 +1529,37 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
if(!testConvertFromUnicode(inputTest, sizeof(inputTest)/sizeof(inputTest[0]),
toIBM943, sizeof(toIBM943), "ibm-943",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, offset, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, offset, NULL, 0 ))
log_err("u-> ibm-943 with subst with value did not match.\n");
if(!testConvertFromUnicode(euc_jp_inputText, sizeof(euc_jp_inputText)/sizeof(euc_jp_inputText[0]),
to_euc_jp, sizeof(to_euc_jp), "euc-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, fromEUC_JPOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, fromEUC_JPOffs, NULL, 0 ))
log_err("u-> euc-jp with subst with value did not match.\n");
if(!testConvertFromUnicode(euc_tw_inputText, sizeof(euc_tw_inputText)/sizeof(euc_tw_inputText[0]),
to_euc_tw, sizeof(to_euc_tw), "euc-tw",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_euc_twOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_euc_twOffs, NULL, 0 ))
log_err("u-> euc-tw with subst with value did not match.\n");
if(!testConvertFromUnicode(iso_2022_jp_inputText, sizeof(iso_2022_jp_inputText)/sizeof(iso_2022_jp_inputText[0]),
to_iso_2022_jp, sizeof(to_iso_2022_jp), "iso-2022-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs, NULL, 0 ))
log_err("u-> iso_2022_jp with subst with value did not match.\n");
if(!testConvertFromUnicode(iso_2022_jp_inputText1, sizeof(iso_2022_jp_inputText1)/sizeof(iso_2022_jp_inputText1[0]),
to_iso_2022_jp1, sizeof(to_iso_2022_jp1), "iso-2022-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs1, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs1, NULL, 0 ))
log_err("u-> iso_2022_jp with subst with value did not match.\n");
if(!testConvertFromUnicode(iso_2022_jp_inputText1, sizeof(iso_2022_jp_inputText1)/sizeof(iso_2022_jp_inputText1[0]),
to_iso_2022_jp1, sizeof(to_iso_2022_jp1), "iso-2022-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs1, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs1, NULL, 0 ))
log_err("u-> iso_2022_jp with subst with value did not match.\n");
if(!testConvertFromUnicode(iso_2022_jp_inputText2, sizeof(iso_2022_jp_inputText2)/sizeof(iso_2022_jp_inputText2[0]),
to_iso_2022_jp2, sizeof(to_iso_2022_jp2), "iso-2022-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs2, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs2, NULL, 0 ))
log_err("u-> iso_2022_jp with subst with value did not match.\n");
/*ESCAPE OPTIONS*/
{
@ -1584,7 +1585,7 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
if(!testConvertFromUnicodeWithContext(iso_2022_jp_inputText2, sizeof(iso_2022_jp_inputText2)/sizeof(iso_2022_jp_inputText2[0]),
to_iso_2022_jp2_v2, sizeof(to_iso_2022_jp2_v2), "iso-2022-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs2_v2, NULL, 0,UCNV_ESCAPE_XML_DEC,U_ZERO_ERROR ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs2_v2, NULL, 0,UCNV_ESCAPE_XML_DEC,U_ZERO_ERROR ))
log_err("u-> iso-2022-jp with skip & UCNV_ESCAPE_XML_DEC did not match.\n");
}
{
@ -1609,7 +1610,7 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
};
if(!testConvertFromUnicodeWithContext(iso_2022_jp_inputText2, sizeof(iso_2022_jp_inputText2)/sizeof(iso_2022_jp_inputText2[0]),
to_iso_2022_jp2_v3, sizeof(to_iso_2022_jp2_v3), "iso-2022-jp",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs2_v3, NULL, 0,UCNV_ESCAPE_XML_HEX,U_ZERO_ERROR ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs2_v3, NULL, 0,UCNV_ESCAPE_XML_HEX,U_ZERO_ERROR ))
log_err("u-> iso-2022-jp with skip & UCNV_ESCAPE_XML_HEX did not match.\n");
}
@ -1635,7 +1636,7 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
};
if(!testConvertFromUnicodeWithContext(iso_2022_cn_inputText4, sizeof(iso_2022_cn_inputText4)/sizeof(iso_2022_cn_inputText4[0]),
to_iso_2022_cn4_v2, sizeof(to_iso_2022_cn4_v2), "iso-2022-cn",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs4_v2, NULL, 0,UCNV_ESCAPE_JAVA,U_ZERO_ERROR ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs4_v2, NULL, 0,UCNV_ESCAPE_JAVA,U_ZERO_ERROR ))
log_err("u-> iso-2022-cn with skip & UCNV_ESCAPE_JAVA did not match.\n");
}
@ -1661,45 +1662,45 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
};
if(!testConvertFromUnicodeWithContext(iso_2022_cn_inputText4, sizeof(iso_2022_cn_inputText4)/sizeof(iso_2022_cn_inputText4[0]),
to_iso_2022_cn4_v3, sizeof(to_iso_2022_cn4_v3), "iso-2022-cn",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs4_v3, NULL, 0,UCNV_ESCAPE_C,U_ZERO_ERROR ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs4_v3, NULL, 0,UCNV_ESCAPE_C,U_ZERO_ERROR ))
log_err("u-> iso-2022-cn with skip & UCNV_ESCAPE_C did not match.\n");
}
if(!testConvertFromUnicode(iso_2022_cn_inputText, sizeof(iso_2022_cn_inputText)/sizeof(iso_2022_cn_inputText[0]),
to_iso_2022_cn, sizeof(to_iso_2022_cn), "iso-2022-cn",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs, NULL, 0 ))
log_err("u-> iso_2022_cn with subst with value did not match.\n");
if(!testConvertFromUnicode(iso_2022_cn_inputText1, sizeof(iso_2022_cn_inputText1)/sizeof(iso_2022_cn_inputText1[0]),
to_iso_2022_cn1, sizeof(to_iso_2022_cn1), "iso-2022-cn",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs1, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs1, NULL, 0 ))
log_err("u-> iso_2022_cn with subst with value did not match.\n");
if(!testConvertFromUnicode(iso_2022_cn_inputText2, sizeof(iso_2022_cn_inputText2)/sizeof(iso_2022_cn_inputText2[0]),
to_iso_2022_cn2, sizeof(to_iso_2022_cn2), "iso-2022-cn",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs2, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs2, NULL, 0 ))
log_err("u-> iso_2022_cn with subst with value did not match.\n");
if(!testConvertFromUnicode(iso_2022_cn_inputText3, sizeof(iso_2022_cn_inputText3)/sizeof(iso_2022_cn_inputText3[0]),
to_iso_2022_cn3, sizeof(to_iso_2022_cn3), "iso-2022-cn",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs3, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs3, NULL, 0 ))
log_err("u-> iso_2022_cn with subst with value did not match.\n");
if(!testConvertFromUnicode(iso_2022_cn_inputText4, sizeof(iso_2022_cn_inputText4)/sizeof(iso_2022_cn_inputText4[0]),
to_iso_2022_cn4, sizeof(to_iso_2022_cn4), "iso-2022-cn",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs4, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs4, NULL, 0 ))
log_err("u-> iso_2022_cn with subst with value did not match.\n");
if(!testConvertFromUnicode(iso_2022_kr_inputText, sizeof(iso_2022_kr_inputText)/sizeof(iso_2022_kr_inputText[0]),
to_iso_2022_kr, sizeof(to_iso_2022_kr), "iso-2022-kr",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_krOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_krOffs, NULL, 0 ))
log_err("u-> iso_2022_kr with subst with value did not match.\n");
if(!testConvertFromUnicode(iso_2022_kr_inputText2, sizeof(iso_2022_kr_inputText2)/sizeof(iso_2022_kr_inputText2[0]),
to_iso_2022_kr2, sizeof(to_iso_2022_kr2), "iso-2022-kr",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_krOffs2, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_iso_2022_krOffs2, NULL, 0 ))
log_err("u-> iso_2022_kr2 with subst with value did not match.\n");
if(!testConvertFromUnicode(hz_inputText, sizeof(hz_inputText)/sizeof(hz_inputText[0]),
to_hz, sizeof(to_hz), "HZ",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_hzOffs, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_hzOffs, NULL, 0 ))
log_err("u-> hz with subst with value did not match.\n");
if(!testConvertFromUnicode(hz_inputText2, sizeof(hz_inputText2)/sizeof(hz_inputText2[0]),
to_hz2, sizeof(to_hz2), "HZ",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_ESCAPE, from_hzOffs2, NULL, 0 ))
UCNV_FROM_U_CALLBACK_ESCAPE, from_hzOffs2, NULL, 0 ))
log_err("u-> hz with subst with value did not match.\n");
}
@ -1811,43 +1812,43 @@ static void TestSubWithValue(int32_t inputsize, int32_t outputsize)
if(!testConvertToUnicode(sampleTxtToU, sizeof(sampleTxtToU),
IBM_943toUnicode, sizeof(IBM_943toUnicode)/sizeof(IBM_943toUnicode[0]),"ibm-943",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_ESCAPE, fromIBM943Offs, NULL, 0 ))
UCNV_TO_U_CALLBACK_ESCAPE, fromIBM943Offs, NULL, 0 ))
log_err("ibm-943->u with substitute with value did not match.\n");
if(!testConvertToUnicode(sampleTxt_EUC_JP, sizeof(sampleTxt_EUC_JP),
EUC_JPtoUnicode, sizeof(EUC_JPtoUnicode)/sizeof(EUC_JPtoUnicode[0]),"euc-jp",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_ESCAPE, fromEUC_JPOffs, NULL, 0))
UCNV_TO_U_CALLBACK_ESCAPE, fromEUC_JPOffs, NULL, 0))
log_err("euc-jp->u with substitute with value did not match.\n");
if(!testConvertToUnicode(sampleTxt_euc_tw, sizeof(sampleTxt_euc_tw),
euc_twtoUnicode, sizeof(euc_twtoUnicode)/sizeof(euc_twtoUnicode[0]),"euc-tw",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_ESCAPE, from_euc_twOffs, NULL, 0))
UCNV_TO_U_CALLBACK_ESCAPE, from_euc_twOffs, NULL, 0))
log_err("euc-tw->u with substitute with value did not match.\n");
if(!testConvertToUnicode(sampleTxt_iso_2022_jp, sizeof(sampleTxt_iso_2022_jp),
iso_2022_jptoUnicode, sizeof(iso_2022_jptoUnicode)/sizeof(iso_2022_jptoUnicode[0]),"iso-2022-jp",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs, NULL, 0))
UCNV_TO_U_CALLBACK_ESCAPE, from_iso_2022_jpOffs, NULL, 0))
log_err("iso-2022-jp->u with substitute with value did not match.\n");
if(!testConvertToUnicode(sampleTxt_iso_2022_cn, sizeof(sampleTxt_iso_2022_cn),
iso_2022_cntoUnicode, sizeof(iso_2022_cntoUnicode)/sizeof(iso_2022_cntoUnicode[0]),"iso-2022-cn",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs, NULL, 0))
UCNV_TO_U_CALLBACK_ESCAPE, from_iso_2022_cnOffs, NULL, 0))
log_err("iso-2022-cn->u with substitute with value did not match.\n");
if(!testConvertToUnicode(sampleTxt_iso_2022_kr, sizeof(sampleTxt_iso_2022_kr),
iso_2022_krtoUnicode, sizeof(iso_2022_krtoUnicode)/sizeof(iso_2022_krtoUnicode[0]),"iso-2022-kr",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_ESCAPE, from_iso_2022_krOffs, NULL, 0))
UCNV_TO_U_CALLBACK_ESCAPE, from_iso_2022_krOffs, NULL, 0))
log_err("iso-2022-kr->u with substitute with value did not match.\n");
if(!testConvertToUnicode(sampleTxt_hz, sizeof(sampleTxt_hz),
hztoUnicode, sizeof(hztoUnicode)/sizeof(hztoUnicode[0]),"HZ",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_ESCAPE, from_hzOffs, NULL, 0))
UCNV_TO_U_CALLBACK_ESCAPE, from_hzOffs, NULL, 0))
log_err("iso-2022-kr->u with substitute with value did not match.\n");
/*got to confirm this*/
if(/* broken for icu 1.6.0.1, do not test */uprv_strcmp("1.7", U_ICU_VERSION) != 0 && !testConvertToUnicode(sampleTxtLMBCS, sizeof(sampleTxtLMBCS),
LMBCSToUnicode, sizeof(LMBCSToUnicode)/sizeof(LMBCSToUnicode[0]),"LMBCS",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_ESCAPE, fromLMBCS, NULL, 0))
UCNV_TO_U_CALLBACK_ESCAPE, fromLMBCS, NULL, 0))
log_err("LMBCS->u with substitute with value did not match.\n");
}
}
@ -1874,24 +1875,24 @@ static void TestLegalAndOthers(int32_t inputsize, int32_t outputsize)
/*checking with a legal value*/
if(!testConvertFromUnicode(legalText, sizeof(legalText)/sizeof(legalText[0]),
templegal949, sizeof(templegal949), "ibm-949",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SKIP, to949legal, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SKIP, to949legal, NULL, 0 ))
log_err("u-> ibm-949 with skip did not match.\n");
/*checking illegal value for ibm-943 with substitute*/
if(!testConvertToUnicode(text943, sizeof(text943),
toUnicode943sub, sizeof(toUnicode943sub)/sizeof(toUnicode943sub[0]),"ibm-943",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE, fromIBM943Offssub, NULL, 0 ))
UCNV_TO_U_CALLBACK_SUBSTITUTE, fromIBM943Offssub, NULL, 0 ))
log_err("ibm-943->u with subst did not match.\n");
/*checking illegal value for ibm-943 with skip */
if(!testConvertToUnicode(text943, sizeof(text943),
toUnicode943skip, sizeof(toUnicode943skip)/sizeof(toUnicode943skip[0]),"ibm-943",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SKIP, fromIBM943Offsskip, NULL, 0 ))
UCNV_TO_U_CALLBACK_SKIP, fromIBM943Offsskip, NULL, 0 ))
log_err("ibm-943->u with skip did not match.\n");
/*checking illegal value for ibm-943 with stop */
if(!testConvertToUnicode(text943, sizeof(text943),
toUnicode943stop, sizeof(toUnicode943stop)/sizeof(toUnicode943stop[0]),"ibm-943",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP, fromIBM943Offsstop, NULL, 0 ))
UCNV_TO_U_CALLBACK_STOP, fromIBM943Offsstop, NULL, 0 ))
log_err("ibm-943->u with stop did not match.\n");
}
@ -1909,7 +1910,7 @@ static void TestSingleByte(int32_t inputsize, int32_t outputsize)
if(!testConvertToUnicode(sampleText, sizeof(sampleText),
toUnicode943sub, sizeof(toUnicode943sub)/sizeof(toUnicode943sub[0]),"ibm-943",
(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE, fromIBM943Offssub, NULL, 0 ))
UCNV_TO_U_CALLBACK_SUBSTITUTE, fromIBM943Offssub, NULL, 0 ))
log_err("ibm-943->u with subst did not match.\n");
}
@ -1931,12 +1932,12 @@ static void TestEBCDIC_STATEFUL_Sub(int32_t inputsize, int32_t outputsize)
if(!testConvertFromUnicode(ebcdic_inputTest, sizeof(ebcdic_inputTest)/sizeof(ebcdic_inputTest[0]),
toIBM930, sizeof(toIBM930), "ibm-930",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SUBSTITUTE, offset_930, NULL, 0 ))
UCNV_FROM_U_CALLBACK_SUBSTITUTE, offset_930, NULL, 0 ))
log_err("u-> ibm-930(EBCDIC_STATEFUL) with subst did not match.\n");
if(!testConvertFromUnicode(ebcdic_inputTest, sizeof(ebcdic_inputTest)/sizeof(ebcdic_inputTest[0]),
toIBM930_subvaried, sizeof(toIBM930_subvaried), "ibm-930",
(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SUBSTITUTE, offset_930_subvaried, mySubChar, 1 ))
UCNV_FROM_U_CALLBACK_SUBSTITUTE, offset_930_subvaried, mySubChar, 1 ))
log_err("u-> ibm-930(EBCDIC_STATEFUL) with subst(setSubChar=0x3f) did not match.\n");
}
@ -1967,7 +1968,7 @@ UBool testConvertFromUnicode(const UChar *source, int sourceLen, const uint8_t
char offset_str[9999];
uint8_t *p;
UConverterFromUCallback oldAction = NULL;
void* oldContext = NULL;
const void* oldContext = NULL;
for(i=0;i<NEW_MAX_BUFFER;i++)
@ -2143,7 +2144,7 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
char offset_str[9999];
UChar *p;
UConverterToUCallback oldAction = NULL;
void* oldContext = NULL;
const void* oldContext = NULL;
int32_t realBufferSize;
UChar *realBufferEnd;
@ -2303,7 +2304,7 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen, const uint8_t *expect, int expectLen,
const char *codepage, UConverterFromUCallback callback , const int32_t *expectOffsets,
const char *mySubChar, int8_t len, void* context, UErrorCode expectedError)
const char *mySubChar, int8_t len, const void* context, UErrorCode expectedError)
{
@ -2326,7 +2327,7 @@ UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen, con
char offset_str[9999];
uint8_t *p;
UConverterFromUCallback oldAction = NULL;
void* oldContext = NULL;
const void* oldContext = NULL;
for(i=0;i<NEW_MAX_BUFFER;i++)
@ -2483,7 +2484,7 @@ UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen, con
}
UBool testConvertToUnicodeWithContext( const uint8_t *source, int sourcelen, const UChar *expect, int expectlen,
const char *codepage, UConverterToUCallback callback, const int32_t *expectOffsets,
const char *mySubChar, int8_t len, void* context, UErrorCode expectedError)
const char *mySubChar, int8_t len, const void* context, UErrorCode expectedError)
{
UErrorCode status = U_ZERO_ERROR;
UConverter *conv = 0;
@ -2501,7 +2502,7 @@ UBool testConvertToUnicodeWithContext( const uint8_t *source, int sourcelen, con
char offset_str[9999];
UChar *p;
UConverterToUCallback oldAction = NULL;
void* oldContext = NULL;
const void* oldContext = NULL;
int32_t realBufferSize;
UChar *realBufferEnd;

View File

@ -50,11 +50,11 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen, const uint8_t *expect, int expectLen,
const char *codepage, UConverterFromUCallback callback , const int32_t *expectOffsets,
const char *mySubChar, int8_t len, void* context, UErrorCode expectedError);
const char *mySubChar, int8_t len, const void* context, UErrorCode expectedError);
UBool testConvertToUnicodeWithContext( const uint8_t *source, int sourcelen, const UChar *expect, int expectlen,
const char *codepage, UConverterToUCallback callback, const int32_t *expectOffsets,
const char *mySubChar, int8_t len, void* context, UErrorCode expectedError);
const char *mySubChar, int8_t len, const void* context, UErrorCode expectedError);
static void printSeq(const uint8_t* a, int len);
static void printUSeq(const UChar* a, int len);

View File

@ -1112,7 +1112,7 @@ static UBool testConvertFromU( const UChar *source, int sourceLen, const uint8_
UBool doFlush;
UConverterFromUCallback oldAction = NULL;
void* oldContext = NULL;
const void* oldContext = NULL;
for(i=0;i<MAX_LENGTH;i++)
junkout[i] = 0xF0;
@ -1284,7 +1284,7 @@ static UBool testConvertToU( const uint8_t *source, int sourcelen, const UChar *
UBool doFlush;
UConverterToUCallback oldAction = NULL;
void* oldContext = NULL;
const void* oldContext = NULL;
for(i=0;i<MAX_LENGTH;i++)

View File

@ -1394,7 +1394,7 @@ static TestUTF8() {
};
UConverterToUCallback cb;
void *p;
const void *p;
const char *source=(const char *)in,*limit=(const char *)in+sizeof(in);
UErrorCode errorCode=U_ZERO_ERROR;
@ -1553,7 +1553,7 @@ TestUTF32BE() {
};
UConverterToUCallback cb;
void *p;
const void *p;
const char *source=(const char *)in, *limit=(const char *)in+sizeof(in);
UErrorCode errorCode=U_ZERO_ERROR;
@ -1622,7 +1622,7 @@ TestUTF32LE() {
};
UConverterToUCallback cb;
void *p;
const void *p;
const char *source=(const char *)in, *limit=(const char *)in+sizeof(in);
UErrorCode errorCode=U_ZERO_ERROR;

View File

@ -64,7 +64,7 @@ void ConvertTest::TestConvert()
char ucs_file_name[UCS_FILE_NAME_SIZE];
UConverterFromUCallback MIA1, MIA1_2;
UConverterToUCallback MIA2, MIA2_2;
void *MIA1Context, *MIA1Context2, *MIA2Context, *MIA2Context2;
const void *MIA1Context, *MIA1Context2, *MIA2Context, *MIA2Context2;
UnicodeConverter* someConverters[5];
/******************************************************************
Checking Unicode -> ksc
@ -131,9 +131,9 @@ void ConvertTest::TestConvert()
};
UConverterFromUCallback fromUAction = NULL;
void* fromUContext = NULL;
const void* fromUContext = NULL;
UConverterToUCallback toUAction = NULL;
void* toUContext = NULL;
const void* toUContext = NULL;
/*Calling all the UnicodeConverter API and checking functionality*/