ICU-4707 Fix some compiler warnings.

X-SVN-Rev: 19635
This commit is contained in:
George Rhoten 2006-05-22 05:01:21 +00:00
parent 7b15f0e402
commit cbb891e5ec
3 changed files with 69 additions and 68 deletions

View file

@ -1,15 +1,16 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2004, International Business Machines Corporation and
* Copyright (c) 1997-2006, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*
********************************************************************************
* File NCCBTST.C
*
* Modification History:
* Name Description
* Madhu Katragadda 7/21/1999 Testing error callback routines
**************************************************************************************
********************************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
@ -2533,28 +2534,28 @@ UBool testConvertFromUnicode(const UChar *source, int sourceLen, const uint8_t
UErrorCode status = U_ZERO_ERROR;
UConverter *conv = 0;
uint8_t junkout[NEW_MAX_BUFFER]; /* FIX */
char junkout[NEW_MAX_BUFFER]; /* FIX */
int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
const UChar *src;
uint8_t *end;
uint8_t *targ;
char *end;
char *targ;
int32_t *offs;
int i;
int32_t realBufferSize;
uint8_t *realBufferEnd;
char *realBufferEnd;
const UChar *realSourceEnd;
const UChar *sourceLimit;
UBool checkOffsets = TRUE;
UBool doFlush;
char junk[9999];
char offset_str[9999];
uint8_t *p;
char *p;
UConverterFromUCallback oldAction = NULL;
const void* oldContext = NULL;
for(i=0;i<NEW_MAX_BUFFER;i++)
junkout[i] = 0xF0;
junkout[i] = (char)0xF0;
for(i=0;i<NEW_MAX_BUFFER;i++)
junokout[i] = 0xFF;
setNuConvTestName(codepage, "FROM");
@ -2684,7 +2685,7 @@ UBool testConvertFromUnicode(const UChar *source, int sourceLen, const uint8_t
{
log_err("Expected %d chars out, got %d %s\n", expectLen, targ-junkout, gNuConvTestName);
log_verbose("Expected %d chars out, got %d %s\n", expectLen, targ-junkout, gNuConvTestName);
printSeqErr(junkout, (int32_t)(targ-junkout));
printSeqErr((const uint8_t *)junkout, (int32_t)(targ-junkout));
printSeqErr(expect, expectLen);
return FALSE;
}
@ -2695,7 +2696,7 @@ UBool testConvertFromUnicode(const UChar *source, int sourceLen, const uint8_t
if(memcmp(junokout,expectOffsets,(targ-junkout) * sizeof(int32_t) )){
log_err("did not get the expected offsets while %s \n", gNuConvTestName);
log_err("Got Output : ");
printSeqErr(junkout, (int32_t)(targ-junkout));
printSeqErr((const uint8_t *)junkout, (int32_t)(targ-junkout));
log_err("Got Offsets: ");
for(p=junkout;p<targ;p++)
log_err("%d,", junokout[p-junkout]);
@ -2719,7 +2720,7 @@ UBool testConvertFromUnicode(const UChar *source, int sourceLen, const uint8_t
log_err("source: ");
printUSeqErr(source, sourceLen);
log_err("Got: ");
printSeqErr(junkout, expectLen);
printSeqErr((const uint8_t *)junkout, expectLen);
log_err("Expected: ");
printSeqErr(expect, expectLen);
return FALSE;
@ -2734,9 +2735,9 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
UConverter *conv = 0;
UChar junkout[NEW_MAX_BUFFER]; /* FIX */
int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
const uint8_t *src;
const uint8_t *realSourceEnd;
const uint8_t *srcLimit;
const char *src;
const char *realSourceEnd;
const char *srcLimit;
UChar *targ;
UChar *end;
int32_t *offs;
@ -2771,7 +2772,7 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
log_verbose("Converter opened..\n");
src = source;
src = (const char *)source;
targ = junkout;
offs = junokout;
@ -2831,8 +2832,8 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
char errChars[50]; /* should be sufficient */
int8_t errLen = 50;
UErrorCode err = U_ZERO_ERROR;
const uint8_t* limit= NULL;
const uint8_t* start= NULL;
const char* limit= NULL;
const char* start= NULL;
ucnv_getInvalidChars(conv,errChars, &errLen, &err);
if(U_FAILURE(err)){
log_err("ucnv_getInvalidChars failed with error : %s\n",u_errorName(err));
@ -2841,7 +2842,7 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
limit = src;
/* length of in invalid chars should be equal to returned length*/
start = src - errLen;
if(uprv_strncmp(errChars,(char*)start,errLen)!=0){
if(uprv_strncmp(errChars,start,errLen)!=0){
log_err("ucnv_getInvalidChars did not return the correct invalid chars for encoding %s \n", ucnv_getName(conv,&err));
}
}
@ -2898,7 +2899,7 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
log_err("0x%04x,", junkout[i]);
log_err("\n");
log_err("From source: ");
for(i=0; i<(src-source); i++)
for(i=0; i<(src-(const char *)source); i++)
log_err(" 0x%02x,", (unsigned char)source[i]);
log_err("\n");
}
@ -2930,28 +2931,28 @@ UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen, con
UErrorCode status = U_ZERO_ERROR;
UConverter *conv = 0;
uint8_t junkout[NEW_MAX_BUFFER]; /* FIX */
char junkout[NEW_MAX_BUFFER]; /* FIX */
int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
const UChar *src;
uint8_t *end;
uint8_t *targ;
char *end;
char *targ;
int32_t *offs;
int i;
int32_t realBufferSize;
uint8_t *realBufferEnd;
char *realBufferEnd;
const UChar *realSourceEnd;
const UChar *sourceLimit;
UBool checkOffsets = TRUE;
UBool doFlush;
char junk[9999];
char offset_str[9999];
uint8_t *p;
char *p;
UConverterFromUCallback oldAction = NULL;
const void* oldContext = NULL;
for(i=0;i<NEW_MAX_BUFFER;i++)
junkout[i] = 0xF0;
junkout[i] = (char)0xF0;
for(i=0;i<NEW_MAX_BUFFER;i++)
junokout[i] = 0xFF;
setNuConvTestName(codepage, "FROM");
@ -3061,7 +3062,7 @@ UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen, con
{
log_err("Expected %d chars out, got %d %s\n", expectLen, targ-junkout, gNuConvTestName);
log_verbose("Expected %d chars out, got %d %s\n", expectLen, targ-junkout, gNuConvTestName);
printSeqErr(junkout, (int32_t)(targ-junkout));
printSeqErr((const uint8_t *)junkout, (int32_t)(targ-junkout));
printSeqErr(expect, expectLen);
return FALSE;
}
@ -3072,7 +3073,7 @@ UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen, con
if(memcmp(junokout,expectOffsets,(targ-junkout) * sizeof(int32_t) )){
log_err("did not get the expected offsets while %s \n", gNuConvTestName);
log_err("Got Output : ");
printSeqErr(junkout, (int32_t)(targ-junkout));
printSeqErr((const uint8_t *)junkout, (int32_t)(targ-junkout));
log_err("Got Offsets: ");
for(p=junkout;p<targ;p++)
log_err("%d,", junokout[p-junkout]);
@ -3096,7 +3097,7 @@ UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen, con
log_err("source: ");
printUSeqErr(source, sourceLen);
log_err("Got: ");
printSeqErr(junkout, expectLen);
printSeqErr((const uint8_t *)junkout, expectLen);
log_err("Expected: ");
printSeqErr(expect, expectLen);
return FALSE;
@ -3110,9 +3111,9 @@ UBool testConvertToUnicodeWithContext( const uint8_t *source, int sourcelen, con
UConverter *conv = 0;
UChar junkout[NEW_MAX_BUFFER]; /* FIX */
int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
const uint8_t *src;
const uint8_t *realSourceEnd;
const uint8_t *srcLimit;
const char *src;
const char *realSourceEnd;
const char *srcLimit;
UChar *targ;
UChar *end;
int32_t *offs;
@ -3147,7 +3148,7 @@ UBool testConvertToUnicodeWithContext( const uint8_t *source, int sourcelen, con
log_verbose("Converter opened..\n");
src = source;
src = (const char *)source;
targ = junkout;
offs = junokout;
@ -3255,7 +3256,7 @@ UBool testConvertToUnicodeWithContext( const uint8_t *source, int sourcelen, con
log_err("0x%04x,", junkout[i]);
log_err("\n");
log_err("From source: ");
for(i=0; i<(src-source); i++)
for(i=0; i<(src-(const char *)source); i++)
log_err(" 0x%02x,", (unsigned char)source[i]);
log_err("\n");
}

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2005, International Business Machines Corporation and
* Copyright (c) 1997-2006, International Business Machines Corporation and
* others. All Rights Reserved.
***************************************************************************/
/*******************************************************************************
@ -130,25 +130,25 @@ static UBool testConvertFromUnicode(const UChar *source, int sourceLen, const u
UErrorCode status = U_ZERO_ERROR;
UConverter *conv = 0;
uint8_t junkout[NEW_MAX_BUFFER]; /* FIX */
char junkout[NEW_MAX_BUFFER]; /* FIX */
int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
const UChar *src;
uint8_t *end;
uint8_t *targ;
char *end;
char *targ;
int32_t *offs;
int i;
int32_t realBufferSize;
uint8_t *realBufferEnd;
char *realBufferEnd;
const UChar *realSourceEnd;
const UChar *sourceLimit;
UBool checkOffsets = TRUE;
UBool doFlush;
UBool action=FALSE;
uint8_t *p;
char *p;
for(i=0;i<NEW_MAX_BUFFER;i++)
junkout[i] = 0xF0;
junkout[i] = (char)0xF0;
for(i=0;i<NEW_MAX_BUFFER;i++)
junokout[i] = 0xFF;
setNuConvTestName(codepage, "FROM");
@ -293,9 +293,9 @@ static UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const U
UConverter *conv = 0;
UChar junkout[NEW_MAX_BUFFER]; /* FIX */
int32_t junokout[NEW_MAX_BUFFER]; /* FIX */
const uint8_t *src;
const uint8_t *realSourceEnd;
const uint8_t *srcLimit;
const char *src;
const char *realSourceEnd;
const char *srcLimit;
UChar *targ;
UChar *end;
int32_t *offs;
@ -329,7 +329,7 @@ static UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const U
log_verbose("Converter opened..\n");
src = source;
src = (const char *)source;
targ = junkout;
offs = junokout;
@ -424,7 +424,7 @@ static UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const U
for(i=0; i<(targ-junkout); i++)
log_err("0x%04X,", junkout[i]);
log_err("");
for(i=0; i<(src-source); i++)
for(i=0; i<(src-(const char *)source); i++)
log_err("0x%04X,", (unsigned char)source[i]);
}
}

View file

@ -3,14 +3,14 @@
* Copyright (c) 1997-2006, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
/*******************************************************************************
*
* File CCONVTST.C
*
* Modification History:
* Name Description
* Madhu Katragadda 7/7/2000 Converter Tests for extended code coverage
*********************************************************************************
********************************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
@ -971,13 +971,13 @@ static UBool convertFromU( const UChar *source, int sourceLen, const uint8_t *e
{
int32_t i=0;
uint8_t *p=0;
char *p=0;
const UChar *src;
uint8_t buffer[MAX_LENGTH];
char buffer[MAX_LENGTH];
int32_t offsetBuffer[MAX_LENGTH];
int32_t *offs=0;
uint8_t *targ;
uint8_t *targetLimit;
char *targ;
char *targetLimit;
UChar *sourceLimit=0;
UErrorCode status = U_ZERO_ERROR;
UConverter *conv = 0;
@ -990,7 +990,7 @@ static UBool convertFromU( const UChar *source, int sourceLen, const uint8_t *e
log_verbose("Converter %s opened..\n", ucnv_getName(conv, &status));
for(i=0; i<MAX_LENGTH; i++){
buffer[i]=0xF0;
buffer[i]=(char)0xF0;
offsetBuffer[i]=0xFF;
}
@ -1062,7 +1062,7 @@ static UBool convertToU( const uint8_t *source, int sourceLen, const UChar *expe
UConverter *conv = 0;
int32_t i=0;
UChar *p=0;
const uint8_t* src;
const char* src;
UChar buffer[MAX_LENGTH];
int32_t offsetBuffer[MAX_LENGTH];
int32_t *offs=0;
@ -1087,7 +1087,7 @@ static UBool convertToU( const uint8_t *source, int sourceLen, const UChar *expe
offsetBuffer[i]=-1;
}
src=source;
src=(const char *)source;
sourceLimit=(uint8_t*)(src+(sourceLen));
targ=buffer;
targetLimit=targ+MAX_LENGTH;
@ -1131,7 +1131,7 @@ static UBool convertToU( const uint8_t *source, int sourceLen, const UChar *expe
for(i=0; i<(targ-buffer); i++)
log_info("0x%04X,", buffer[i]);
log_info("\nFrom Input:");
for(i=0; i<(src-source); i++)
for(i=0; i<(src-(const char *)source); i++)
log_info("0x%02X,", (unsigned char)source[i]);
log_info("\n");
}
@ -1157,16 +1157,16 @@ static UBool testConvertFromU( const UChar *source, int sourceLen, const uint8_
{
UErrorCode status = U_ZERO_ERROR;
UConverter *conv = 0;
uint8_t junkout[MAX_LENGTH]; /* FIX */
char junkout[MAX_LENGTH]; /* FIX */
int32_t junokout[MAX_LENGTH]; /* FIX */
uint8_t *p;
char *p;
const UChar *src;
uint8_t *end;
uint8_t *targ;
char *end;
char *targ;
int32_t *offs;
int i;
int32_t realBufferSize;
uint8_t *realBufferEnd;
char *realBufferEnd;
const UChar *realSourceEnd;
const UChar *sourceLimit;
UBool checkOffsets = TRUE;
@ -1176,7 +1176,7 @@ static UBool testConvertFromU( const UChar *source, int sourceLen, const uint8_
const void* oldContext = NULL;
for(i=0;i<MAX_LENGTH;i++)
junkout[i] = 0xF0;
junkout[i] = (char)0xF0;
for(i=0;i<MAX_LENGTH;i++)
junokout[i] = 0xFF;
@ -1214,7 +1214,7 @@ static UBool testConvertFromU( const UChar *source, int sourceLen, const uint8_
checkOffsets = FALSE;
do
{
{
end = nct_min(targ + gOutBufferSize, realBufferEnd);
sourceLimit = nct_min(src + gInBufferSize, realSourceEnd);
@ -1257,7 +1257,7 @@ static UBool testConvertFromU( const UChar *source, int sourceLen, const uint8_
{
char junk[999];
char offset_str[999];
uint8_t *ptr;
char *ptr;
junk[0] = 0;
offset_str[0] = 0;
@ -1331,9 +1331,9 @@ static UBool testConvertToU( const uint8_t *source, int sourcelen, const UChar *
UConverter *conv = 0;
UChar junkout[MAX_LENGTH]; /* FIX */
int32_t junokout[MAX_LENGTH]; /* FIX */
const uint8_t *src;
const uint8_t *realSourceEnd;
const uint8_t *srcLimit;
const char *src;
const char *realSourceEnd;
const char *srcLimit;
UChar *p;
UChar *targ;
UChar *end;
@ -1373,7 +1373,7 @@ static UBool testConvertToU( const uint8_t *source, int sourcelen, const UChar *
}
/*-------------------------------------*/
src = source;
src = (const char *)source;
targ = junkout;
offs = junokout;
@ -1471,7 +1471,7 @@ static UBool testConvertToU( const uint8_t *source, int sourcelen, const UChar *
for(i=0; i<(targ-junkout); i++)
log_err("%X,", junkout[i]);
log_err("");
for(i=0; i<(src-source); i++)
for(i=0; i<(src-(const char *)source); i++)
log_err("%X,", (unsigned char)source[i]);
}
}