ICU-4288 Fix some compiler warnings.

X-SVN-Rev: 16930
This commit is contained in:
George Rhoten 2004-12-08 23:02:08 +00:00
parent 5c4521733e
commit 2f7b1cd736
7 changed files with 26 additions and 26 deletions

View File

@ -718,7 +718,7 @@ writeString(const UChar *s, int32_t length, uint8_t *p) {
UTF_NEXT_CHAR(s, i, length, c);
p+=writePacked(encodeBocu1(&prev, c), p);
}
return p-p0;
return (int32_t)(p-p0);
}
/**

View File

@ -1604,7 +1604,7 @@ static void TestKeywordSetError(void)
for(i=0;i<=2;i++) {
/* 1- test a short buffer with growing text */
blen=strlen(kwSetTestCases[i].l)+1;
blen=(int32_t)strlen(kwSetTestCases[i].l)+1;
memset(buffer,'%',1023);
strcpy(buffer,kwSetTestCases[i].l);
status = U_ZERO_ERROR;
@ -1626,7 +1626,7 @@ static void TestKeywordSetError(void)
for(i=3;i<=4;i++) {
/* 2- test a short buffer - text the same size or shrinking */
blen=strlen(kwSetTestCases[i].l)+1;
blen=(int32_t)strlen(kwSetTestCases[i].l)+1;
memset(buffer,'%',1023);
strcpy(buffer,kwSetTestCases[i].l);
status = U_ZERO_ERROR;
@ -2060,8 +2060,8 @@ static int32_t _cmpversion(const char* version) {
* prefix + '_' + x, then return 1. Otherwise return a value < 0.
*/
static UBool _loccmp(const char* string, const char* prefix) {
int32_t slen = uprv_strlen(string),
plen = uprv_strlen(prefix);
int32_t slen = (int32_t)uprv_strlen(string),
plen = (int32_t)uprv_strlen(prefix);
int32_t c = uprv_strncmp(string, prefix, plen);
/* 'root' is less than everything */
if (uprv_strcmp(prefix, "root") == 0) {

View File

@ -760,8 +760,8 @@ static void logFailure (const char *platform, const char *test,
uint32_t i = 0;
char sEsc[256], s[256], tEsc[256], t[256], b[256], output[512], relation[256];
static int maxOutputLength = 0;
int outputLength;
static int32_t maxOutputLength = 0;
int32_t outputLength;
*sEsc = *tEsc = *s = *t = 0;
if(error == TRUE) {
@ -830,7 +830,7 @@ static void logFailure (const char *platform, const char *test,
strcat(output, getRelationSymbol(realRes, realStrength, relation));
strcat(output, tEsc);
outputLength = strlen(output);
outputLength = (int32_t)strlen(output);
if(outputLength > maxOutputLength) {
maxOutputLength = outputLength;
U_ASSERT(outputLength < sizeof(output));

View File

@ -2684,7 +2684,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, targ-junkout);
printSeqErr(junkout, (int32_t)(targ-junkout));
printSeqErr(expect, expectLen);
return FALSE;
}
@ -2695,7 +2695,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, targ-junkout);
printSeqErr(junkout, (int32_t)(targ-junkout));
log_err("Got Offsets: ");
for(p=junkout;p<targ;p++)
log_err("%d,", junokout[p-junkout]);
@ -3061,7 +3061,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, targ-junkout);
printSeqErr(junkout, (int32_t)(targ-junkout));
printSeqErr(expect, expectLen);
return FALSE;
}
@ -3072,7 +3072,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, targ-junkout);
printSeqErr(junkout, (int32_t)(targ-junkout));
log_err("Got Offsets: ");
for(p=junkout;p<targ;p++)
log_err("%d,", junokout[p-junkout]);

View File

@ -250,7 +250,7 @@ static UBool testConvertFromUnicode(const UChar *source, int sourceLen, const u
{
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((const unsigned char*)junkout, targ-junkout);
printSeqErr((const unsigned char*)junkout, (int32_t)(targ-junkout));
printSeqErr((const unsigned char*)expect, expectLen);
return FALSE;
}
@ -261,7 +261,7 @@ static UBool testConvertFromUnicode(const UChar *source, int sourceLen, const u
if(uprv_memcmp(junokout,expectOffsets,(targ-junkout) * sizeof(int32_t) )){
log_err("\ndid not get the expected offsets while %s \n", gNuConvTestName);
log_err("Got : ");
printSeqErr((const unsigned char*)junkout, targ-junkout);
printSeqErr((const unsigned char*)junkout, (int32_t)(targ-junkout));
for(p=junkout;p<targ;p++)
log_err("%d, ", junokout[p-junkout]);
log_err("\nExpected: ");

View File

@ -887,7 +887,7 @@ static UBool convertFromU( const UChar *source, int sourceLen, const uint8_t *e
{
log_err("Expected %d chars out, got %d FROM Unicode to %s\n", expectLen, targ-buffer, codepage);
log_verbose("Expected %d chars out, got %d FROM Unicode to %s\n", expectLen, targ-buffer, codepage);
printSeqErr((const unsigned char *)buffer, targ-buffer);
printSeqErr((const unsigned char *)buffer, (int32_t)(targ-buffer));
printSeqErr((const unsigned char*)expect, expectLen);
return FALSE;
}
@ -909,7 +909,7 @@ static UBool convertFromU( const UChar *source, int sourceLen, const uint8_t *e
if(memcmp(offsetBuffer,expectOffsets,(targ-buffer) * sizeof(int32_t) )){
log_err("did not get the expected offsets. for FROM Unicode to %s\n", codepage);
log_info("\nGot : ");
printSeqErr((const unsigned char*)buffer, targ-buffer);
printSeqErr((const unsigned char*)buffer, (int32_t)(targ-buffer));
for(p=buffer;p<targ;p++)
log_info("%d, ", offsetBuffer[p-buffer]);
log_info("\nExpected: ");
@ -1151,7 +1151,7 @@ static UBool testConvertFromU( const UChar *source, int sourceLen, const uint8_
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);
log_info("\nGot:");
printSeqErr((const unsigned char*)junkout, targ-junkout);
printSeqErr((const unsigned char*)junkout, (int32_t)(targ-junkout));
log_info("\nExpected:");
printSeqErr((const unsigned char*)expect, expectLen);
return FALSE;
@ -1163,7 +1163,7 @@ static UBool testConvertFromU( const UChar *source, int sourceLen, const uint8_
if(memcmp(junokout,expectOffsets,(targ-junkout) * sizeof(int32_t) )){
log_err("did not get the expected offsets. %s", gNuConvTestName);
log_err("Got : ");
printSeqErr((const unsigned char*)junkout, targ-junkout);
printSeqErr((const unsigned char*)junkout, (int32_t)(targ-junkout));
for(p=junkout;p<targ;p++)
log_err("%d, ", junokout[p-junkout]);
log_err("\nExpected: ");

View File

@ -403,7 +403,7 @@ static ETestConvertResult testConvertFromU( const UChar *source, int sourceLen,
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);
printf("\nGot:");
printSeqErr((const unsigned char*)junkout, targ-junkout);
printSeqErr((const unsigned char*)junkout, (int32_t)(targ-junkout));
printf("\nExpected:");
printSeqErr((const unsigned char*)expect, expectLen);
return TC_MISMATCH;
@ -413,7 +413,7 @@ static ETestConvertResult testConvertFromU( const UChar *source, int sourceLen,
log_verbose("comparing %d offsets..\n", targ-junkout);
if(memcmp(junokout,expectOffsets,(targ-junkout) * sizeof(int32_t) )){
log_err("did not get the expected offsets. %s\n", gNuConvTestName);
printSeqErr((const unsigned char*)junkout, targ-junkout);
printSeqErr((const unsigned char*)junkout, (int32_t)(targ-junkout));
log_err("\n");
log_err("Got : ");
for(p=junkout;p<targ;p++) {
@ -1405,7 +1405,7 @@ static void TestAmbiguous()
return;
}
/* convert target from SJIS to Unicode */
sjisLength = ucnv_toUChars(sjis_cnv, sjisResult, sizeof(sjisResult)/U_SIZEOF_UCHAR, target, strlen(target), &status);
sjisLength = ucnv_toUChars(sjis_cnv, sjisResult, sizeof(sjisResult)/U_SIZEOF_UCHAR, target, (int32_t)strlen(target), &status);
if (U_FAILURE(status))
{
log_err("Failed to convert the SJIS string.\n");
@ -1414,7 +1414,7 @@ static void TestAmbiguous()
return;
}
/* convert target from Latin-1 to Unicode */
asciiLength = ucnv_toUChars(ascii_cnv, asciiResult, sizeof(asciiResult)/U_SIZEOF_UCHAR, target, strlen(target), &status);
asciiLength = ucnv_toUChars(ascii_cnv, asciiResult, sizeof(asciiResult)/U_SIZEOF_UCHAR, target, (int32_t)strlen(target), &status);
if (U_FAILURE(status))
{
log_err("Failed to convert the Latin-1 string.\n");
@ -2668,14 +2668,14 @@ static void TestToAndFromUChars(const uint16_t* source, const UChar* sourceLimit
uTarget = uBuf;
uTargetLimit = uBuf+ uBufSize*5;
ucnv_reset(cnv);
numCharsInTarget=ucnv_fromUChars( cnv , cTarget, (cTargetLimit-cTarget),uSource,(uSourceLimit-uSource), &errorCode);
numCharsInTarget=ucnv_fromUChars(cnv, cTarget, (int32_t)(cTargetLimit-cTarget), uSource, (int32_t)(uSourceLimit-uSource), &errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_fromUnicode conversion failed reason %s\n", u_errorName(errorCode));
return;
}
cSource = cBuf;
test =uBuf;
ucnv_toUChars(cnv,uTarget,(uTargetLimit-uTarget),cSource,numCharsInTarget,&errorCode);
ucnv_toUChars(cnv,uTarget,(int32_t)(uTargetLimit-uTarget),cSource,numCharsInTarget,&errorCode);
if(U_FAILURE(errorCode)){
log_err("ucnv_toUChars conversion failed, reason %s\n", u_errorName(errorCode));
return;
@ -3275,7 +3275,7 @@ unescape(UChar* dst, int32_t dstLen,const char* src,int32_t srcLen,UErrorCode *s
return 0;
}
if(srcLen==-1){
srcLen = uprv_strlen(src);
srcLen = (int32_t)uprv_strlen(src);
}
for (; srcIndex<srcLen; ) {
@ -3555,7 +3555,7 @@ TestSCSU() {
int32_t cSrcLen,srcLen;
UChar* src;
/* UConverter* cnv = ucnv_open("SCSU",&status); */
cSrcLen= srcLen = uprv_strlen(fTestCases[i]);
cSrcLen = srcLen = (int32_t)uprv_strlen(fTestCases[i]);
src = (UChar*) malloc((sizeof(UChar) * srcLen) + sizeof(UChar));
srcLen=unescape(src,srcLen,cSrc,cSrcLen,&status);
log_verbose("Testing roundtrip for src: %s at index :%d\n",cSrc,i);