ICU-535 fixed some compiler warnings

X-SVN-Rev: 2154
This commit is contained in:
George Rhoten 2000-08-09 23:34:41 +00:00
parent 2a8843171c
commit 2d12649bce
9 changed files with 84 additions and 92 deletions

View file

@ -47,17 +47,15 @@ static void doAssert(int condition, const char *message)
}
}
void TestGetDefaultRules(){
int32_t size=0;
uint32_t size=0;
UErrorCode status=U_ZERO_ERROR;
UCollator *coll=NULL;
UCollator *coll2=NULL;
int32_t len1 = 0, len2=0;
uint8_t *binColData = NULL;
uint8_t *binColData = NULL;
UResourceBundle *res = NULL;
UResourceBundle *binColl = NULL;
uint8_t *binResult = NULL;
UChar *rules=NULL;
UResourceBundle *binColl = NULL;
uint8_t *binResult = NULL;
@ -65,28 +63,28 @@ void TestGetDefaultRules(){
log_verbose("Test the function ucol_getDefaultRulesArray()\n");
coll = ucol_openRules(defaultRulesArray, size, UCOL_DECOMP_CAN, 0, &status);
ucol_setNormalization(coll, UCOL_DEFAULT_NORMALIZATION);
if(U_SUCCESS(status) && coll !=NULL) {
binColData = (uint8_t*)ucol_cloneRuleData(coll, &len1, &status);
ucol_setNormalization(coll, UCOL_DEFAULT_NORMALIZATION);
if(U_SUCCESS(status) && coll !=NULL) {
binColData = (uint8_t*)ucol_cloneRuleData(coll, &len1, &status);
}
status=U_ZERO_ERROR;
res=ures_open(NULL, "root", &status);
if(U_FAILURE(status)){
log_err("ERROR: Failed to get resource for \"root Locale\" with %s", myErrorName(status));
return;
}
if(U_FAILURE(status)){
log_err("ERROR: Failed to get resource for \"root Locale\" with %s", myErrorName(status));
return;
}
binColl=ures_getByKey(res, "%%Collation", binColl, &status);
if(U_SUCCESS(status)){
binResult=(uint8_t*)ures_getBinary(binColl, &len2, &status);
binResult=(uint8_t*)ures_getBinary(binColl, &len2, &status);
if(U_FAILURE(status)){
log_err("ERROR: ures_getBinary() failed\n");
}
}else{
log_err("ERROR: ures_getByKey(locale(default), %%Collation) failed");
}
log_err("ERROR: ures_getByKey(locale(default), %%Collation) failed");
}
if(len1 != len2){
@ -193,14 +191,14 @@ void TestProperty()
status=U_ZERO_ERROR;
disName=(UChar*)malloc(sizeof(UChar) * (len+1));
ucol_getDisplayName("en_US", "de_DE", disName, len+1, &status);
log_verbose("the display name for default collation in german: %s\n", austrdup(disName) );
free(disName);
}
if(U_FAILURE(status)){
log_err("ERROR: in getDisplayName: %s\n", myErrorName(status));
return;
}
log_verbose("the display name for default collation in german: %s\n", austrdup(disName) );
log_verbose("Default collation getDisplayName ended.\n");
free(disName);
log_verbose("ucol_getRules() testing ...\n");
ucol_getRules(col, &tempLength);
@ -233,14 +231,14 @@ void TestProperty()
status=U_ZERO_ERROR;
disName=(UChar*)malloc(sizeof(UChar) * (len+1));
ucol_getDisplayName("fr_FR", "en_US", disName, len+1, &status);
log_verbose("the display name for french collation in english: %s\n", austrdup(disName) );
free(disName);
}
if(U_FAILURE(status)){
log_err("ERROR: in getDisplayName: %s\n", myErrorName(status));
return;
}
log_verbose("the display name for french collation in german: %s\n", austrdup(disName) );
log_verbose("Default collation getDisplayName ended.\n");
free(disName);

View file

@ -219,7 +219,6 @@ testReordering(UBiDi *pBiDi, int testNumber) {
UBiDiLevel levels[200];
UTextOffset i, length=ubidi_getLength(pBiDi);
UTextOffset runCount, visualIndex, logicalStart, runLength;
int result=0;
UBool odd;
if(length<=0) {
@ -264,7 +263,7 @@ testReordering(UBiDi *pBiDi, int testNumber) {
log_verbose("\n----%2d runs:", runCount);
for(i=0; i<runCount; ++i) {
odd=ubidi_getVisualRun(pBiDi, i, &logicalStart, &runLength);
odd=(UBool)(ubidi_getVisualRun(pBiDi, i, &logicalStart, &runLength));
log_verbose(" (%c @%d[%d])", odd ? 'R' : 'L', logicalStart, runLength);
}
log_verbose("\n");

View file

@ -49,23 +49,17 @@ void TestConvert()
{
char myptr[4];
char save[4];
char subchar [4] = {(char)0xBE, (char)0xEF};
int32_t testLong1 = 0;
int16_t rest = 0;
FILE* f = NULL;
FILE* f2 = NULL;
int32_t uniLen = 0;
int32_t len = 0;
int32_t x = 0;
FILE* ucs_file_in = NULL;
UChar BOM = 0x0000;
UChar myUChar = 0x0000;
char myChar = 0x00;
char mytarget[MAX_FILE_LEN];
char* mytarget_1=mytarget;
char* mytarget_use = mytarget;
UChar* consumedUni = NULL;
char* consumedChar = NULL;
char* consumed = NULL;
char output_cp_buffer [MAX_FILE_LEN];
UChar ucs_file_buffer [MAX_FILE_LEN];
@ -74,9 +68,7 @@ void TestConvert()
UChar* my_ucs_file_buffer_1=my_ucs_file_buffer;
int32_t i = 0;
int8_t ii = 0;
uint16_t ij = 0;
int32_t j = 0;
int32_t k = 0;
uint16_t codepage_index = 0;
uint16_t count;
int32_t cp = 0;
@ -86,8 +78,6 @@ void TestConvert()
UConverterFromUCallback MIA1, MIA1_2;
UConverterToUCallback MIA2, MIA2_2;
void *MIA1Context, *MIA1Context2, *MIA2Context, *MIA2Context2;
UChar myUnitarget[MAX_FILE_LEN];
UChar *myUnitarget_1 = myUnitarget;
UConverter* someConverters[5];
UConverter* myConverter = 0;
UChar* displayname = 0;
@ -125,7 +115,7 @@ void TestConvert()
};
const int32_t CodePagesAsciiControls[NUM_CODEPAGE] =
/* const int32_t CodePagesAsciiControls[NUM_CODEPAGE] =
{
0xFFFFFFFF
@ -135,7 +125,7 @@ void TestConvert()
const int32_t CodePagesOtherControls[NUM_CODEPAGE] =
{
0x00000005
};
};*/
const int8_t CodePagesMinChars[NUM_CODEPAGE] =
@ -168,7 +158,7 @@ void TestConvert()
};
const UConverterToUCallback CodePagesMissingCharAction[NUM_CODEPAGE] =
/* const UConverterToUCallback CodePagesMissingCharAction[NUM_CODEPAGE] =
{
UCNV_TO_U_CALLBACK_SUBSTITUTE
};
@ -176,16 +166,26 @@ void TestConvert()
const UConverterFromUCallback CodePagesMissingUnicodeAction[NUM_CODEPAGE] =
{
UCNV_FROM_U_CALLBACK_SUBSTITUTE
};
};*/
const char* CodePagesLocale[NUM_CODEPAGE] =
{
"ko_KR"
};
UChar CodePagesFlakySequence[NUM_CODEPAGE][20] =
/* UChar CodePagesFlakySequence[NUM_CODEPAGE][20] =
{
{(UChar)0xAC10,(UChar)0xAC11, (UChar)0xAC12, (UChar)0xAC13 , (UChar)0xAC14, (UChar)0xAC15, (UChar)0xAC16, (UChar)0xAC17, (UChar)0xd7a4 /*Offensive Codepoint*/, (UChar)0xAC14, (UChar)0xAC15}
{(UChar)0xAC10,
(UChar)0xAC11,
(UChar)0xAC12,
(UChar)0xAC13,
(UChar)0xAC14,
(UChar)0xAC15,
(UChar)0xAC16,
(UChar)0xAC17,
(UChar)0xd7a4, /*Offensive Codepoint*/
/* (UChar)0xAC14,
(UChar)0xAC15}
};
char CodePagesFlakyCharSequence[NUM_CODEPAGE][20] =
@ -195,10 +195,10 @@ void TestConvert()
(char)0xB0, (char)0xAA,
(char)0xB0, (char)0xAB,
(char)0xb0, (char)0xff,/*Offensive Codepoint*/
(char)0xB0, (char)0xAC,
/* (char)0xB0, (char)0xAC,
(char)0xB0, (char)0xAD
}
};
};*/
UConverterFromUCallback oldFromUAction = NULL;
UConverterToUCallback oldToUAction = NULL;
@ -335,7 +335,7 @@ void TestConvert()
targetLimit=0;
targetCapacity=ucnv_convert("ibm-1364", "ibm-1363", NULL, targetLimit , source, sourceLimit, &err);
if(err = U_BUFFER_OVERFLOW_ERROR){
if(err == U_BUFFER_OVERFLOW_ERROR){
err=U_ZERO_ERROR;
targetLimit=targetCapacity+1;
target=(char*)malloc(sizeof(char) * targetLimit);
@ -551,7 +551,7 @@ void TestConvert()
ucnv_getSubstChars(myConverter, myptr, &ii, &err);
for(x=0;x<ii;x++)
rest = ((unsigned char)rest << 8) + (unsigned char)myptr[x];
rest = (int16_t)(((unsigned char)rest << 8) + (unsigned char)myptr[x]);
if (rest==CodePagesSubstitutionChars[codepage_index])
log_verbose("Substitution character ok\n");
else
@ -776,11 +776,11 @@ void TestConvert()
{
myUChar = ucs_file_buffer[i-1];
ucs_file_buffer[i-1] = (BOM==0xFEFF)?myUChar:((myUChar >> 8) | (myUChar << 8)); /*adjust if BIG_ENDIAN*/
ucs_file_buffer[i-1] = (UChar)((BOM==0xFEFF)?myUChar:((myUChar >> 8) | (myUChar << 8))); /*adjust if BIG_ENDIAN*/
}
myUChar = ucs_file_buffer[i-1];
ucs_file_buffer[i-1] = (BOM==0xFEFF)?myUChar:((myUChar >> 8) | (myUChar << 8)); /*adjust if BIG_ENDIAN Corner Case*/
ucs_file_buffer[i-1] = (UChar)((BOM==0xFEFF)?myUChar:((myUChar >> 8) | (myUChar << 8))); /*adjust if BIG_ENDIAN Corner Case*/
/*testing ucnv_fromUChars() and ucnv_toUChars() */

View file

@ -310,7 +310,6 @@ void TestDataDirectory()
char oldDirectory[80];
const char *temp,*testValue1,*testValue2,*testValue3;
UErrorCode err = U_ZERO_ERROR;
const char path[40] ="d:\\icu\\source\\test\\intltest" U_FILE_SEP_STRING; /*give the required path */
log_verbose("Testing getDataDirectory()\n");

View file

@ -8,7 +8,7 @@
* File CMSGTST.C
*
* Modification History:
* Name Description
* Name Description
* Madhu Katragadda Creation
*********************************************************************************
*/
@ -317,17 +317,17 @@ void TestMsgFormatChoice()
resultlength=resultLengthOut+1;
result=(UChar*)malloc(sizeof(UChar) * resultlength);
u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, 100., str);
if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#6\n");
else{
log_err("FAIL: Error in MessageFormat on test#6\n GOT %s EXPECTED %s\n", austrdup(result),
austrdup(expected) );
}
free(result);
}
if(U_FAILURE(status)){
log_err("ERROR: failure in message format on test#6 : %s\n", myErrorName(status));
}
if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#6\n");
else{
log_err("FAIL: Error in MessageFormat on test#6\n GOT %s EXPECTED %s\n", austrdup(result),
austrdup(expected) );
}
free(result);
log_verbose("Testing message format with choice test #7\n:");
u_uastrcpy(expected, "The disk MyDisk contains no files");
@ -339,18 +339,19 @@ void TestMsgFormatChoice()
resultlength=resultLengthOut+1;
result=(UChar*)malloc(sizeof(UChar) * resultlength);
u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, 0., str);
if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#7\n");
else{
log_err("FAIL: Error in MessageFormat on test#7\n GOT: %s EXPECTED %s\n", austrdup(result),
austrdup(expected) );
}
free(result);
}
if(U_FAILURE(status)){
log_err("ERROR: failure in message format on test#7 : %s\n", myErrorName(status));
}
if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#7\n");
else{
log_err("FAIL: Error in MessageFormat on test#7\n GOT: %s EXPECTED %s\n", austrdup(result),
austrdup(expected) );
}
free(result);
log_verbose("Testing message format with choice test #8\n:");
u_uastrcpy(expected, "The disk MyDisk contains one file");
resultlength=0;
@ -361,18 +362,20 @@ void TestMsgFormatChoice()
resultlength=resultLengthOut+1;
result=(UChar*)malloc(sizeof(UChar) * resultlength);
u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, 1., str);
if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#8\n");
else{
log_err("FAIL: Error in MessageFormat on test#8\n GOT %s EXPECTED: %s\n", austrdup(result),
austrdup(expected) );
}
free(result);
}
if(U_FAILURE(status)){
log_err("ERROR: failure in message format on test#8 : %s\n", myErrorName(status));
}
if(u_strcmp(result, expected)==0)
log_verbose("PASS: MessagFormat successful on test#8\n");
else{
log_err("FAIL: Error in MessageFormat on test#8\n GOT %s EXPECTED: %s\n", austrdup(result),
austrdup(expected) );
}
free(result);
free(str);
}
@ -479,7 +482,6 @@ void TestMessageFormatWithValist( void )
void CallParseMessage(const char* locale, UChar* pattern, int32_t patternLength,
UChar* source, int32_t sourceLength, UErrorCode *status, ...)
{
int32_t len = 0;
va_list ap;
va_start(ap, status);
u_vparseMessage(locale, pattern, patternLength, source, sourceLength, ap, status);

View file

@ -51,7 +51,7 @@ itoa1(int32_t i, char* buf)
/* Output digits in reverse order */
p = buf;
do {
*p++ = '0' + (i % 10);
*p++ = (char)('0' + (i % 10));
i /= 10;
}
while(i);

View file

@ -39,8 +39,8 @@
static uint32_t
randul()
{
uint32_t l;
int32_t i;
uint32_t l;
int32_t i;
static UBool initialized = FALSE;
if (!initialized)
{
@ -87,7 +87,7 @@ itoa1(int32_t i, char* buf)
/* Output digits in reverse order */
p = buf;
do {
*p++ = '0' + (i % 10);
*p++ = (char)('0' + (i % 10));
i /= 10;
}
while(i);
@ -197,7 +197,7 @@ void TestNewTypes() {
char action[256];
char testdatapath[256];
const char* directory = ctest_getTestDirectory();
UErrorCode status = U_ZERO_ERROR,expected_resource_status = U_ZERO_ERROR;
UErrorCode status = U_ZERO_ERROR;
UResourceBundle* res = NULL;
uint8_t *binResult = NULL;
int32_t len = 0;
@ -319,7 +319,6 @@ void TestAPI(){
UErrorCode status=U_ZERO_ERROR;
const char* directory=NULL;
int32_t len=0;
uint32_t intValue=0;
const char* key=NULL;
const UChar* value=NULL;
char testdatapath[256];

View file

@ -29,7 +29,7 @@ static void TestUCMP32API();
void
void
addCompactArrayTest(TestNode** root)
{
addTest(root, &TestUCMP16API, "ucmptst/TestUCMP16API");
@ -64,7 +64,6 @@ void TestUCMP16API(){
CompactShortArray* ucmp16Array=NULL;
CompactShortArray* ucmp16Array1=NULL;
CompactShortArray* ucmp16Array2=NULL;
UErrorCode status=U_ZERO_ERROR;
int32_t count=0, i=0;
int16_t const TEST_DEFAULT_VALUE = 0xff;
@ -131,7 +130,7 @@ void TestUCMP16API(){
/* ucmp16_set*/
ucmp16_set(ucmp16Array, 0, TEST_DEFAULT_VALUE);
values=(int16_t*)ucmp16_getArray(ucmp16Array);
values=(uint16_t*)ucmp16_getArray(ucmp16Array);
if(values[0] != TEST_DEFAULT_VALUE){
log_err("ERROR: ucmp16_set() failed\n");
}
@ -141,7 +140,7 @@ void TestUCMP16API(){
/*ucmp16_set where the value != defaultValue*/
ucmp16_compact(ucmp16Array);
ucmp16_set(ucmp16Array, 0, 0xfe);
values=(int16_t*)ucmp16_getArray(ucmp16Array);
values=(uint16_t*)ucmp16_getArray(ucmp16Array);
if(values[0] != 0xfe){
log_err("ERROR: ucmp16_set() failed\n");
}
@ -149,7 +148,7 @@ void TestUCMP16API(){
/*ucmp16_setRange*/
ucmp16_compact(ucmp16Array);
ucmp16_setRange(ucmp16Array, 0, 10, 0xff);
values=(int16_t*)ucmp16_getArray(ucmp16Array);
values=(uint16_t*)ucmp16_getArray(ucmp16Array);
for(i=0; i<10; i++){
if(values[0] != 0xff){
log_err("ERROR: ucmp16_set() failed\n");
@ -159,7 +158,7 @@ void TestUCMP16API(){
/*ucmp16_setRange where the value != defaultValue*/
ucmp16_compact(ucmp16Array);
ucmp16_setRange(ucmp16Array, 0, 10, 0xfe);
values=(int16_t*)ucmp16_getArray(ucmp16Array);
values=(uint16_t*)ucmp16_getArray(ucmp16Array);
for(i=0; i<10; i++){
if(values[0] != 0xfe){
log_err("ERROR: ucmp16_set() failed\n");
@ -188,11 +187,10 @@ void TestUCMP8API(){
CompactByteArray* ucmp8Array=NULL;
CompactByteArray* ucmp8Array1=NULL;
CompactByteArray* ucmp8Array2=NULL;
UErrorCode status=U_ZERO_ERROR;
int32_t i=0;
int8_t *values;
int8_t *valuesSet;
int8_t const TEST_DEFAULT_VALUE = (char)0xFF;
int8_t const TEST_DEFAULT_VALUE = (int8_t)0xFF;
/*ucmp8_open*/
@ -246,7 +244,7 @@ void TestUCMP8API(){
/*ucmp8_set*/
ucmp8_set(ucmp8Array1, 0, (char)0xFE);
valuesSet=(int8_t*)ucmp8_getArray(ucmp8Array1);
if(valuesSet[0] != (char)0xFE ){
if(valuesSet[0] != (int8_t)0xFE ){
log_err("ERROR: ucmp8_set() failed\n");
}
if(ucmp8Array1->fCompact == TRUE){
@ -257,7 +255,7 @@ void TestUCMP8API(){
ucmp8_compact(ucmp8Array1, 1);
ucmp8_set(ucmp8Array1, 0, (char)0xFD);
valuesSet=(int8_t*)ucmp8_getArray(ucmp8Array1);
if(valuesSet[0] != (char)0xFD ){
if(valuesSet[0] != (int8_t)0xFD ){
log_err("ERROR: ucmp8_set() failed\n");
}
if(ucmp8Array1->fCompact == TRUE){
@ -268,7 +266,7 @@ void TestUCMP8API(){
ucmp8_setRange(ucmp8Array1, 0, 10, (char)0xFD);
valuesSet=(int8_t*)ucmp8_getArray(ucmp8Array1);
for(i =0 ; i< 10; i++ ){
if(valuesSet[0] != (char)0xFD ){
if(valuesSet[0] != (int8_t)0xFD ){
log_err("ERROR: ucmp8_set() failed\n");
break;
}
@ -282,7 +280,6 @@ void TestUCMP8API(){
void TestUCMP32API(){
CompactIntArray* ucmp32Array=NULL;
UErrorCode status=U_ZERO_ERROR;
int32_t i=0;
int32_t *values;
int32_t const TEST_DEFAULT_VALUE = 0xFFFF;

View file

@ -48,11 +48,10 @@ void TestUDataOpen(){
UDataMemory *result;
UErrorCode status=U_ZERO_ERROR;
const char* memMap[][2]={
{"tz", "dat"},
{"cnvalias", "dat"},
{"unames", "dat"},
{"ibm-1141", "cnv"}
{"tz", "dat"},
{"cnvalias", "dat"},
{"unames", "dat"},
{"ibm-1141", "cnv"}
};
const char* name = "test";
const char* type="dat";
@ -403,7 +402,6 @@ void TestUDataGetInfo() {
void TestUDataGetMemory() {
FILE *fHandler =NULL;
UDataMemory *result;
const uint16_t *table=NULL;
uint16_t* intValue=0;