From 4502c7670c0c49b9b3f4dc3bcc43a722f4ff5c94 Mon Sep 17 00:00:00 2001 From: Ram Viswanadha Date: Sat, 22 Sep 2001 01:54:21 +0000 Subject: [PATCH] ICU-452 Fix compiler warnings and make tests pass on Solaris and Alpha X-SVN-Rev: 5896 --- icu4c/source/common/ustrtrns.c | 14 ++++++-------- icu4c/source/test/cintltst/cucdtst.c | 3 ++- icu4c/source/test/cintltst/custrtrn.c | 13 ++++++++++--- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/icu4c/source/common/ustrtrns.c b/icu4c/source/common/ustrtrns.c index f1318b8d5da..74eef85d15c 100644 --- a/icu4c/source/common/ustrtrns.c +++ b/icu4c/source/common/ustrtrns.c @@ -404,7 +404,7 @@ _strToWCS(wchar_t *dest, *pErrorCode=U_ZERO_ERROR; tempBuf = saveBuf; /* we dont have enough room on the stack grow the buffer */ - u_growAnyBufferFromStatic(stackBuffer, &tempBuf, &tempBufCapacity, + u_growAnyBufferFromStatic(stackBuffer,(void**) &tempBuf, &tempBufCapacity, (tempBufCapacity+_STACK_BUFFER_CAPACITY), count,sizeof(char)); saveBuf = tempBuf; @@ -497,7 +497,6 @@ u_strToWCS(wchar_t *dest, int32_t srcLength, UErrorCode *pErrorCode){ - const UChar *pSrcLimit =NULL; const UChar *pSrc = src; /* args check */ @@ -559,7 +558,6 @@ _strFromWCS( UChar *dest, UChar* pTargetLimit = NULL; UChar uStack [_STACK_BUFFER_CAPACITY]; - int32_t uStackCap = _STACK_BUFFER_CAPACITY ; wchar_t wStack[_STACK_BUFFER_CAPACITY]; wchar_t* pWStack = wStack; @@ -588,7 +586,7 @@ _strFromWCS( UChar *dest, goto cleanup; }else if(retVal == cStackCap){ /* Should rarely occur */ - u_growAnyBufferFromStatic(cStack,&pCSrc,&cStackCap, + u_growAnyBufferFromStatic(cStack,(void**)&pCSrc,&cStackCap, cStackCap*2,0,sizeof(char)); pCSave = pCSrc; }else{ @@ -622,7 +620,7 @@ _strFromWCS( UChar *dest, int32_t len = (pCSrc-pCSave); pCSrc = pCSave; /* we do not have enough room so grow the buffer*/ - u_growAnyBufferFromStatic(cStack,&pCSrc,&cStackCap, + u_growAnyBufferFromStatic(cStack,(void**)&pCSrc,&cStackCap, 2*cStackCap+(nulLen*MB_CUR_MAX),len,sizeof(char)); pCSave = pCSrc; @@ -669,7 +667,7 @@ _strFromWCS( UChar *dest, int32_t len = (pCSrc-pCSave); pCSrc = pCSave; /* we do not have enough room so grow the buffer*/ - u_growAnyBufferFromStatic(cStack,&pCSrc,&cStackCap, + u_growAnyBufferFromStatic(cStack,(void**)&pCSrc,&cStackCap, cStackCap+(nulLen*MB_CUR_MAX),len,sizeof(char)); pCSave = pCSrc; @@ -703,7 +701,7 @@ _strFromWCS( UChar *dest, conv= u_getDefaultConverter(pErrorCode); /* convert and write to the target */ - ucnv_toUnicode(conv,&pTarget,pTargetLimit,&pCSrc,pCSrcLimit,NULL,FALSE,pErrorCode); + ucnv_toUnicode(conv,&pTarget,pTargetLimit,(const char**)&pCSrc,pCSrcLimit,NULL,FALSE,pErrorCode); /* count the number converted */ count=pTarget - dest; @@ -715,7 +713,7 @@ _strFromWCS( UChar *dest, pTargetLimit = uStack + _STACK_BUFFER_CAPACITY; /* convert to stack buffer*/ - ucnv_toUnicode(conv,&pTarget,pTargetLimit,&pCSrc,pCSrcLimit,NULL,FALSE,pErrorCode); + ucnv_toUnicode(conv,&pTarget,pTargetLimit,(const char**)&pCSrc,pCSrcLimit,NULL,FALSE,pErrorCode); /* increment count to number written to stack */ count+= pTarget - uStack; diff --git a/icu4c/source/test/cintltst/cucdtst.c b/icu4c/source/test/cintltst/cucdtst.c index 4f2ba2ea54e..b841def6b6a 100644 --- a/icu4c/source/test/cintltst/cucdtst.c +++ b/icu4c/source/test/cintltst/cucdtst.c @@ -1983,4 +1983,5 @@ static void TestUScriptCodeAPI(){ log_err("uscript_getScript failed.\n"); } } - } \ No newline at end of file + } + diff --git a/icu4c/source/test/cintltst/custrtrn.c b/icu4c/source/test/cintltst/custrtrn.c index 52d17409f2f..39c554f807c 100644 --- a/icu4c/source/test/cintltst/custrtrn.c +++ b/icu4c/source/test/cintltst/custrtrn.c @@ -385,6 +385,9 @@ static const uint16_t src16j[] = { 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x000D, 0x000A, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x000D, 0x000A, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x000D, 0x000A, + 0x0000, + /* Test only ASCII */ + /* 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, @@ -393,7 +396,7 @@ static const uint16_t src16j[] = { 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x0054, 0x0000 - + */ }; static const uint16_t src16WithNulls[] = { 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0000, @@ -404,6 +407,8 @@ static const uint16_t src16WithNulls[] = { 0x0058, 0x0059, 0x005A, 0x000D, 0x000A, 0x0000, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0000, 0x0058, 0x0059, 0x005A, 0x000D, 0x000A, 0x0000, + /* test only ASCII */ + /* 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, @@ -411,7 +416,7 @@ static const uint16_t src16WithNulls[] = { 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, - 0x0054, 0x0000 + 0x0054, 0x0000 */ }; static void Test_UChar_WCHART_API(void){ @@ -557,4 +562,6 @@ static void Test_UChar_WCHART_API(void){ uprv_free(uDest); } -} \ No newline at end of file +} + + \ No newline at end of file