From 0981f6185a68936b98570014dada4aae2e8f7ac9 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Fri, 11 Aug 2000 17:39:22 +0000 Subject: [PATCH] ICU-535 fixed some compiler warnings X-SVN-Rev: 2194 --- icu4c/source/test/cintltst/ncnvfbts.c | 649 +++++++++++++------------- icu4c/source/test/cintltst/ncnvfbts.h | 4 +- 2 files changed, 326 insertions(+), 327 deletions(-) diff --git a/icu4c/source/test/cintltst/ncnvfbts.c b/icu4c/source/test/cintltst/ncnvfbts.c index 0c399ee75a5..5caa1e908d2 100644 --- a/icu4c/source/test/cintltst/ncnvfbts.c +++ b/icu4c/source/test/cintltst/ncnvfbts.c @@ -108,326 +108,326 @@ void setNuConvTestName(const char *codepage, const char *direction) } -UBool testConvertFromUnicode(const UChar *source, int sourceLen, const char *expect, int expectLen, - const char *codepage, UBool fallback, int32_t *expectOffsets) +UBool testConvertFromUnicode(const UChar *source, int sourceLen, const uint8_t *expect, int expectLen, + const char *codepage, UBool fallback, int32_t *expectOffsets) { - - - UErrorCode status = U_ZERO_ERROR; - UConverter *conv = 0; - char junkout[NEW_MAX_BUFFER]; /* FIX */ - int32_t junokout[NEW_MAX_BUFFER]; /* FIX */ - const UChar *src; - char *end; - char *targ; - int32_t *offs; - int i; - int32_t realBufferSize; - char *realBufferEnd; - const UChar *realSourceEnd; - const UChar *sourceLimit; - UBool checkOffsets = TRUE; - UBool doFlush; - UBool action=FALSE; - char junk[9999]; - char offset_str[9999]; - char *p; - - - for(i=0;i %d chars out]. \nResult :", - sourceLen, targ-junkout); - if(VERBOSITY) - { - - junk[0] = 0; - offset_str[0] = 0; - for(p = junkout;p %d chars out]. \nResult :", + sourceLen, targ-junkout); + if(VERBOSITY) + { + char junk[9999]; + char offset_str[9999]; + + junk[0] = 0; + offset_str[0] = 0; + for(p = junkout;p %d chars.\nResult :", - sourcelen, targ-junkout); - if(VERBOSITY) - { - - junk[0] = 0; - offset_str[0] = 0; + if(U_FAILURE(status)) + { + log_err("Problem doing toUnicode, errcode %s %s\n", myErrorName(status), gNuConvTestName); + return FALSE; + } - for(p = junkout;p %d chars.\nResult :", + sourcelen, targ-junkout); + if(VERBOSITY) + { - if ( checkOffsets ) - { - log_verbose("\nOffsets:"); - log_verbose(offset_str); - } - log_verbose("\n"); - } - ucnv_close(conv); + junk[0] = 0; + offset_str[0] = 0; - log_verbose("comparing %d uchars (%d bytes)..\n",expectlen,expectlen*2); + for(p = junkout;p ibm-1362(DBCS) with FallBack did not match.\n"); + expectedIBM1362, sizeof(expectedIBM1362), "ibm-1362", TRUE, toIBM1362Offs )) + log_err("u-> ibm-1362(DBCS) with FallBack did not match.\n"); if(!testConvertToUnicode(expectedIBM1362, sizeof(expectedIBM1362), retrievedDBCSText, sizeof(retrievedDBCSText)/sizeof(retrievedDBCSText[0]),"ibm-1362", TRUE, fromIBM1362offs )) - log_err("ibm-1362->u(DBCS) with Fallback did not match.\n"); + log_err("ibm-1362->u(DBCS) with Fallback did not match.\n"); /*MBCS*/ if(!testConvertFromUnicode(MBCSText, sizeof(MBCSText)/sizeof(MBCSText[0]), - expectedIBM1370, sizeof(expectedIBM1370), "ibm-1370", TRUE, toIBM1370Offs )) - log_err("u-> ibm-1370(MBCS) with FallBack did not match.\n"); + expectedIBM1370, sizeof(expectedIBM1370), "ibm-1370", TRUE, toIBM1370Offs )) + log_err("u-> ibm-1370(MBCS) with FallBack did not match.\n"); if(!testConvertToUnicode(expectedIBM1370, sizeof(expectedIBM1370), retrievedMBCSText, sizeof(retrievedMBCSText)/sizeof(retrievedMBCSText[0]),"ibm-1370", TRUE, fromIBM1370offs )) - log_err("ibm-1370->u(MBCS) with Fallback did not match.\n"); + log_err("ibm-1370->u(MBCS) with Fallback did not match.\n"); /*commented untill data table is available*/ log_verbose("toUnicode fallback with fallback data for MBCS\n"); { - const char IBM1370input[] = { - (char)0xf4, (char)0x87, (char)0xa4, (char)0x4a, (char)0xf4, (char)0x88, (char)0xa4, (char)0x4b, - (char)0xf9, (char)0x92, (char)0xdc, (char)0xb0, }; + const uint8_t IBM1370input[] = { + 0xf4, 0x87, 0xa4, 0x4a, 0xf4, 0x88, 0xa4, 0x4b, + 0xf9, 0x92, 0xdc, 0xb0, }; UChar expectedUnicodeText[]= { 0x5165, 0x5165, 0x516b, 0x516b, 0x9ef9, 0x9ef9}; int32_t fromIBM1370offs [] = { 0, 2, 4, 6, 8, 10}; @@ -548,18 +548,18 @@ void TestConvertFallBackWithBufferSizes(int32_t outsize, int32_t insize ) if(!testConvertToUnicode(IBM1370input, sizeof(IBM1370input), expectedUnicodeText, sizeof(expectedUnicodeText)/sizeof(expectedUnicodeText[0]),"ibm-1370", TRUE, fromIBM1370offs )) - log_err("ibm-1370->u(MBCS) with Fallback did not match.\n"); + log_err("ibm-1370->u(MBCS) with Fallback did not match.\n"); if(!testConvertToUnicode(IBM1370input, sizeof(IBM1370input), expectedFallbackFalse, sizeof(expectedFallbackFalse)/sizeof(expectedFallbackFalse[0]),"ibm-1370", FALSE, fromIBM1370offs )) - log_err("ibm-1370->u(MBCS) with Fallback did not match.\n"); + log_err("ibm-1370->u(MBCS) with Fallback did not match.\n"); } log_verbose("toUnicode fallback with fallback data for euc-tw\n"); { - const char euc_tw_input[] = { - (char)0xA7, (char)0xCC, (char)0x8E, (char)0xA2, (char)0xA1, (char)0xAB, - (char)0xA8, (char)0xC7, (char)0xC8, (char)0xDE, - (char)0xA8, (char)0xCD, (char)0x8E, (char)0xA2, (char)0xA2, (char)0xEA,}; + const uint8_t euc_tw_input[] = { + 0xA7, 0xCC, 0x8E, 0xA2, 0xA1, 0xAB, + 0xA8, 0xC7, 0xC8, 0xDE, + 0xA8, 0xCD, 0x8E, 0xA2, 0xA2, 0xEA,}; UChar expectedUnicodeText[]= { 0x5C6E, 0x5C6E, 0x81FC, 0x81FC, 0x8278, 0x8278}; int32_t from_euc_tw_offs [] = { 0, 2, 6, 8, 10, 12}; @@ -567,11 +567,11 @@ void TestConvertFallBackWithBufferSizes(int32_t outsize, int32_t insize ) if(!testConvertToUnicode(euc_tw_input, sizeof(euc_tw_input), expectedUnicodeText, sizeof(expectedUnicodeText)/sizeof(expectedUnicodeText[0]),"euc-tw", TRUE, from_euc_tw_offs )) - log_err("from euc-tw->u with Fallback did not match.\n"); - + log_err("from euc-tw->u with Fallback did not match.\n"); + if(!testConvertToUnicode(euc_tw_input, sizeof(euc_tw_input), expectedFallbackFalse, sizeof(expectedFallbackFalse)/sizeof(expectedFallbackFalse[0]),"euc-tw", FALSE, from_euc_tw_offs )) - log_err("from euc-tw->u with Fallback false did not match.\n"); + log_err("from euc-tw->u with Fallback false did not match.\n"); } @@ -579,34 +579,33 @@ void TestConvertFallBackWithBufferSizes(int32_t outsize, int32_t insize ) { UChar inputText[]= { 0x0001, 0x008e, 0x203e, 0x2223, 0xff5c, 0x5296, 0x5C6E, 0x5C6E, 0x81FC, 0x81FC, 0x8278, 0x8278, 0xEDEC}; - const char expected_euc_tw[] = { - (char)0x01, (char)0xfd, (char)0xfe, (char)0xa2, (char)0xa3, - (char)0xa2, (char)0xde, (char)0xa2, (char)0xde, - (char)0x8e, (char)0xa2, (char)0xe5, (char)0xb9, - (char)0x8e, (char)0xa2, (char)0xa1, (char)0xab, (char)0x8e, (char)0xa2, (char)0xa1, (char)0xab, - (char)0xc8, (char)0xde, (char)0xc8, (char)0xde, - (char)0x8e, (char)0xa2, (char)0xa2, (char)0xea, (char)0x8e, (char)0xa2, (char)0xa2, (char)0xea, - (char)0x8e, (char)0xac, (char)0xc6, (char)0xf7}; + const uint8_t expected_euc_tw[] = { + 0x01, 0xfd, 0xfe, 0xa2, 0xa3, + 0xa2, 0xde, 0xa2, 0xde, + 0x8e, 0xa2, 0xe5, 0xb9, + 0x8e, 0xa2, 0xa1, 0xab, 0x8e, 0xa2, 0xa1, 0xab, + 0xc8, 0xde, 0xc8, 0xde, + 0x8e, 0xa2, 0xa2, 0xea, 0x8e, 0xa2, 0xa2, 0xea, + 0x8e, 0xac, 0xc6, 0xf7}; int32_t to_euc_tw_offs [] = { 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12}; if(!testConvertFromUnicode(inputText, sizeof(inputText)/sizeof(inputText[0]), - expected_euc_tw, sizeof(expected_euc_tw), "euc-tw", TRUE, to_euc_tw_offs )) - log_err("u-> euc-tw with FallBack did not match.\n"); - + expected_euc_tw, sizeof(expected_euc_tw), "euc-tw", TRUE, to_euc_tw_offs )) + log_err("u-> euc-tw with FallBack did not match.\n"); + } /*MBCS 1363*/ if(!testConvertFromUnicode(MBCSText1363, sizeof(MBCSText1363)/sizeof(MBCSText1363[0]), - expectedIBM1363, sizeof(expectedIBM1363), "ibm-1363", TRUE, toIBM1363Offs )) - log_err("u-> ibm-1363(MBCS) with FallBack did not match.\n"); + expectedIBM1363, sizeof(expectedIBM1363), "ibm-1363", TRUE, toIBM1363Offs )) + log_err("u-> ibm-1363(MBCS) with FallBack did not match.\n"); if(!testConvertToUnicode(expectedIBM1363, sizeof(expectedIBM1363), retrievedMBCSText1363, sizeof(retrievedMBCSText1363)/sizeof(retrievedMBCSText1363[0]),"ibm-1363", TRUE, fromIBM1363offs )) - log_err("ibm-1363->u(MBCS) with Fallback did not match.\n"); - - - - -} - \ No newline at end of file + log_err("ibm-1363->u(MBCS) with Fallback did not match.\n"); + + + + +} diff --git a/icu4c/source/test/cintltst/ncnvfbts.h b/icu4c/source/test/cintltst/ncnvfbts.h index 9eb4f3efc36..446fa908b69 100644 --- a/icu4c/source/test/cintltst/ncnvfbts.h +++ b/icu4c/source/test/cintltst/ncnvfbts.h @@ -20,9 +20,9 @@ void TestConverterFallBack(void); void TestConvertFallBackWithBufferSizes(int32_t outsize, int32_t insize ); -static UBool testConvertFromUnicode(const UChar *source, int sourceLen, const char *expect, int expectLen, +static UBool testConvertFromUnicode(const UChar *source, int sourceLen, const uint8_t *expect, int expectLen, const char *codepage, UBool fallback, int32_t *expectOffsets); -static UBool testConvertToUnicode( const char *source, int sourcelen, const UChar *expect, int expectlen, +static UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *expect, int expectlen, const char *codepage, UBool fallback, int32_t *expectOffsets);