ICU-535 fixed some compiler warnings

X-SVN-Rev: 2182
This commit is contained in:
George Rhoten 2000-08-11 02:08:59 +00:00
parent c094c8a0eb
commit ebd5136aac
11 changed files with 59 additions and 59 deletions

View File

@ -96,7 +96,7 @@ void ComposedCharIter::getDecomposition(UnicodeString& result) const
result.truncate(0);
uint16_t offset = ucmp16_getu(DecompData::offsets, curChar);
uint16_t index = offset & DecompData::DECOMP_MASK;
uint16_t index = (uint16_t)(offset & DecompData::DECOMP_MASK);
if (index > minDecomp) {
if ((offset & DecompData::DECOMP_RECURSE) != 0) {
// Let Normalizer::decompose() handle recursive decomp

View File

@ -909,7 +909,7 @@ U_CFUNC UChar32 T_UConverter_getNextUChar_UTF16_BE(UConverterToUnicodeArgs* args
}
/*Gets the corresponding codepoint*/
first = ((uint16_t)(*(args->source)) << 8) |((uint8_t)*((args->source)+1));
first = (uint16_t)(((uint16_t)(*(args->source)) << 8) |((uint8_t)*((args->source)+1)));
myUChar = first;
args->source += 2;
@ -922,7 +922,7 @@ U_CFUNC UChar32 T_UConverter_getNextUChar_UTF16_BE(UConverterToUnicodeArgs* args
}
/* get the second surrogate and assemble the code point */
second = ((uint16_t)(*(args->source)) << 8) |((uint8_t)*(args->source+1));
second = (uint16_t)(((uint16_t)(*(args->source)) << 8) |((uint8_t)*(args->source+1)));
/* ignore unmatched surrogates and just deliver the first one in such a case */
if(UTF_IS_SECOND_SURROGATE(second)) {
@ -1093,7 +1093,7 @@ U_CFUNC UChar32 T_UConverter_getNextUChar_UTF16_LE(UConverterToUnicodeArgs* args
}
/*Gets the corresponding codepoint*/
first = ((uint16_t)*((args->source)+1) << 8) | ((uint8_t)(*(args->source)));
first = (uint16_t)(((uint16_t)*((args->source)+1) << 8) | ((uint8_t)(*(args->source))));
myUChar=first;
/*updates the source*/
args->source += 2;
@ -1109,7 +1109,7 @@ U_CFUNC UChar32 T_UConverter_getNextUChar_UTF16_LE(UConverterToUnicodeArgs* args
}
/* get the second surrogate and assemble the code point */
second = ((uint16_t)*(args->source+1) << 8) |((uint8_t)(*(args->source)));
second = (uint16_t)(((uint16_t)*(args->source+1) << 8) |((uint8_t)(*(args->source))));
/* ignore unmatched surrogates and just deliver the first one in such a case */
if(UTF_IS_SECOND_SURROGATE(second))

View File

@ -306,7 +306,7 @@ DictionaryBasedBreakIterator::divideUpDictionaryRange(int32_t startPos, int32_t
// initialize (we always exit the loop with a break statement)
c = text->current();
while (TRUE) {
for (;;) {
// if we can transition to state "-1" from our current state, we're
// on the last character of a legal word. Push that position onto

View File

@ -1999,7 +1999,7 @@ GregorianCalendar::inDaylightTime(UErrorCode& status) const
// Force an update of the state of the Calendar.
((GregorianCalendar*)this)->complete(status); // cast away const
return U_SUCCESS(status) ? (internalGet(DST_OFFSET) != 0) : FALSE;
return (UBool)(U_SUCCESS(status) ? (internalGet(DST_OFFSET) != 0) : FALSE);
}
// -------------------------------------

View File

@ -89,8 +89,8 @@ public:
TransliterationRuleData(const TransliterationRuleData&);
~TransliterationRuleData();
const UnicodeSet* lookupSet(UChar standIn) const;
const UnicodeSet* lookupSet(UChar standIn) const;
/**
* Return the zero-based index of the segment represented by the given
@ -104,7 +104,7 @@ public:
* The reference must be in the range 1..9.
*/
UChar getSegmentStandin(int32_t ref) const {
return segmentBase + ref - 1;
return (UChar)(segmentBase + ref - 1);
}
};

View File

@ -175,7 +175,7 @@ int16_t TransliterationRule::getIndexValue(const TransliterationRuleData& data)
return -1;
}
UChar c = pattern.charAt(anteContextLength);
return data.lookupSet(c) == NULL ? (c & 0xFF) : -1;
return (int16_t)(data.lookupSet(c) == NULL ? (c & 0xFF) : -1);
}
/**

View File

@ -9,7 +9,7 @@
* Modification History:
*
* Date Name Description
* 07/12/2000 Madhu Creation
* 07/12/2000 Madhu Creation
*******************************************************************************
*/
@ -32,12 +32,12 @@ addPUtilTest(TestNode** root)
{
addTest(root, &TestPUtilAPI, "putiltst/TestPUtilAPI");
addTest(root, &testIEEEremainder, "putiltst/testIEEEremainder");
}
void TestPUtilAPI(){
double n1=0.0, y1=0.0, expn1, expy1;
int result=0;
double value1 = 0.021;
@ -47,7 +47,7 @@ void TestPUtilAPI(){
char versionString[10];
char *str=0;
UBool isTrue=FALSE;
log_verbose("Testing the API uprv_modf()\n");
y1 = uprv_modf(value1, &n1);
expn1=0;
@ -62,15 +62,15 @@ void TestPUtilAPI(){
log_verbose("Testing the API uprv_fmod()\n");
expn1=uprv_fmod(30.50, 15.00);
doAssert(expn1, 0.5, "uprv_fmod(30.50, 15.00) failed.");
log_verbose("Testing the API uprv_ceil()\n");
expn1=uprv_ceil(value1);
doAssert(expn1, 1, "uprv_ceil(0.021) failed.");
log_verbose("Testing the API uprv_floor()\n");
expn1=uprv_floor(value1);
doAssert(expn1, 0, "uprv_floor(0.021) failed.");
log_verbose("Testing the API uprv_fabs()\n");
expn1=uprv_fabs((2.02-1.345));
doAssert(expn1, 0.675, "uprv_fabs(2.02-1.345) failed.");
@ -81,27 +81,27 @@ void TestPUtilAPI(){
log_verbose("Testing the API uprv_fmax() with x value= NaN\n");
expn1=uprv_fmax(uprv_getNaN(), 1.2);
doAssert(expn1, uprv_getNaN(), "uprv_fmax(uprv_getNaN(), 1.2) failed. when one parameter is NaN");
log_verbose("Testing the API uprv_fmin()\n");
doAssert(uprv_fmin(2.4, 1.2), 1.2, "uprv_fmin(2.4, 1.2) failed.");
log_verbose("Testing the API uprv_fmin() with x value= NaN\n");
expn1=uprv_fmin(uprv_getNaN(), 1.2);
doAssert(expn1, uprv_getNaN(), "uprv_fmin(uprv_getNaN(), 1.2) failed. when one parameter is NaN");
log_verbose("Testing the API uprv_max()\n");
doAssert(uprv_max(4, 2), 4, "uprv_max(4, 2) failed.");
log_verbose("Testing the API uprv_min()\n");
doAssert(uprv_min(-4, 2), -4, "uprv_min(-4, 2) failed.");
log_verbose("Testing the API uprv_trunc()\n");
doAssert(uprv_trunc(12.3456), 12, "uprv_trunc(12.3456) failed.");
doAssert(uprv_trunc(12.234E2), 1223, "uprv_trunc(12.234E2) failed.");
doAssert(uprv_trunc(uprv_getNaN()), uprv_getNaN(), "uprv_trunc(uprv_getNaN()) failed. with parameter=NaN");
doAssert(uprv_trunc(uprv_getInfinity()), uprv_getInfinity(), "uprv_trunc(uprv_getInfinity()) failed. with parameter=Infinity");
log_verbose("Testing the API uprv_pow10()\n");
doAssert(uprv_pow10(4), 10000, "uprv_pow10(4) failed.");
@ -294,7 +294,7 @@ void testIEEEremainder()
double pinf = uprv_getInfinity();
double ninf = -uprv_getInfinity();
double nan = uprv_getNaN();
double pzero = 0.0;
/* double pzero = 0.0;*/
double nzero = 0.0;
nzero *= -1;

View File

@ -44,10 +44,10 @@ static void dotestname(const char *name, const char *standard, const char *expec
void TestStandardNames()
{
#if 0
int i, count;
UErrorCode err;
#if 0
/* Iterate over all standards. */
for (i = 0, count = ucnv_countStandards(); i < count; ++i) {

View File

@ -188,9 +188,9 @@ void TestUCMP8API(){
CompactByteArray* ucmp8Array1=NULL;
CompactByteArray* ucmp8Array2=NULL;
int32_t i=0;
int8_t *values;
int8_t *valuesSet;
int8_t const TEST_DEFAULT_VALUE = (int8_t)0xFF;
uint8_t *values;
uint8_t *valuesSet;
uint8_t const TEST_DEFAULT_VALUE = (uint8_t)0xFF;
/*ucmp8_open*/
@ -228,7 +228,7 @@ void TestUCMP8API(){
if(ucmp8_getkBlockCount() != 128 ){
log_err("Error in ucmp8_getkBlockCount()\n");
}
values=(int8_t*)ucmp8_getArray(ucmp8Array1);
values=(uint8_t*)ucmp8_getArray(ucmp8Array1);
if(values[0] !=TEST_DEFAULT_VALUE){
log_err("Error: getArray() or init failed\n");
}
@ -242,9 +242,9 @@ void TestUCMP8API(){
log_err("Error: ucmp8_compact failed\n");
}
/*ucmp8_set*/
ucmp8_set(ucmp8Array1, 0, (char)0xFE);
valuesSet=(int8_t*)ucmp8_getArray(ucmp8Array1);
if(valuesSet[0] != (int8_t)0xFE ){
ucmp8_set(ucmp8Array1, 0, (char)0xFE);
valuesSet=(uint8_t*)ucmp8_getArray(ucmp8Array1);
if(valuesSet[0] != (uint8_t)0xFE ){
log_err("ERROR: ucmp8_set() failed\n");
}
if(ucmp8Array1->fCompact == TRUE){
@ -253,9 +253,9 @@ void TestUCMP8API(){
/*ucmp8_set*/
ucmp8_compact(ucmp8Array1, 1);
ucmp8_set(ucmp8Array1, 0, (char)0xFD);
valuesSet=(int8_t*)ucmp8_getArray(ucmp8Array1);
if(valuesSet[0] != (int8_t)0xFD ){
ucmp8_set(ucmp8Array1, 0, (char)0xFD);
valuesSet=(uint8_t*)ucmp8_getArray(ucmp8Array1);
if(valuesSet[0] != (uint8_t)0xFD ){
log_err("ERROR: ucmp8_set() failed\n");
}
if(ucmp8Array1->fCompact == TRUE){
@ -264,9 +264,9 @@ void TestUCMP8API(){
/*ucmp8_setRange*/
ucmp8_compact(ucmp8Array1, 1);
ucmp8_setRange(ucmp8Array1, 0, 10, (char)0xFD);
valuesSet=(int8_t*)ucmp8_getArray(ucmp8Array1);
valuesSet=(uint8_t*)ucmp8_getArray(ucmp8Array1);
for(i =0 ; i< 10; i++ ){
if(valuesSet[0] != (int8_t)0xFD ){
if(valuesSet[0] != (uint8_t)0xFD ){
log_err("ERROR: ucmp8_set() failed\n");
break;
}

View File

@ -88,14 +88,14 @@ void TestCharLength()
int16_t i;
UBool multiple;
for(i=0; i<sizeof(codepoint)/sizeof(codepoint[0]); i=i+2){
for(i=0; i<sizeof(codepoint)/sizeof(codepoint[0]); i=(int16_t)(i+2)){
UChar32 c=codepoint[i+1];
if(UTF16_CHAR_LENGTH(c) != (uint16_t)codepoint[i]){
log_err("The no: of code units for %lx:- Expected: %d Got: %d\n", c, codepoint[i], UTF16_CHAR_LENGTH(c));
}else{
log_verbose("The no: of code units for %lx is %d\n",c, UTF16_CHAR_LENGTH(c) );
}
multiple=codepoint[i] == 1 ? FALSE : TRUE;
multiple=(UBool)(codepoint[i] == 1 ? FALSE : TRUE);
if(UTF16_NEED_MULTIPLE_UCHAR(c) != multiple){
log_err("ERROR: UTF16_NEED_MULTIPLE_UCHAR failed for %lx\n", c);
}
@ -147,15 +147,15 @@ void TestGetChar()
log_err("ERROR: UTF16_GET_CHAR_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i], c);
}
}
UTF16_GET_CHAR_SAFE(input, 0, offset, sizeof(input)/U_SIZEOF_UCHAR, c, FALSE);
if(c != result[i+1]){
log_err("ERROR: UTF16_GET_CHAR_SAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i+1], c);
}
UTF16_GET_CHAR_SAFE(input, 0, offset, sizeof(input)/U_SIZEOF_UCHAR, c, TRUE);
if(c != result[i+2]){
log_err("ERROR: UTF16_GET_CHAR_SAFE(strict) failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i+2], c);
}
i=i+3;
UTF16_GET_CHAR_SAFE(input, 0, offset, sizeof(input)/U_SIZEOF_UCHAR, c, FALSE);
if(c != result[i+1]){
log_err("ERROR: UTF16_GET_CHAR_SAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i+1], c);
}
UTF16_GET_CHAR_SAFE(input, 0, offset, sizeof(input)/U_SIZEOF_UCHAR, c, TRUE);
if(c != result[i+2]){
log_err("ERROR: UTF16_GET_CHAR_SAFE(strict) failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i+2], c);
}
i=(uint16_t)(i+3);
}
}
@ -225,7 +225,7 @@ void TestNextPrevChar(){
if(c != result[i+2]){
log_err("ERROR: UTF16_NEXT_CHAR_SAFE(strict) failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+2], c);
}
i=i+6;
i=(uint16_t)(i+6);
}
i=0;
for(offset=(uint16_t)sizeof(input)/U_SIZEOF_UCHAR; offset > 0; --offset){
@ -256,7 +256,7 @@ void TestNextPrevChar(){
if(c != result[i+5]){
log_err("ERROR: UTF16_PREV_CHAR_SAFE(strict) failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+5], c);
}
i=i+6;
i=(uint16_t)(i+6);
}
}
@ -431,7 +431,7 @@ void TestAppendChar(){
uint16_t i, count=0;
UChar *str=malloc(sizeof(UChar) * (u_strlen(s)+1));
uint16_t offset;
for(i=0; i<sizeof(test)/sizeof(test[0]); i=i+2){
for(i=0; i<sizeof(test)/sizeof(test[0]); i=(uint16_t)(i+2)){
if(count<5){
u_strcpy(str, s);
offset=(uint16_t)test[i];

View File

@ -64,7 +64,7 @@ static int INDENT_LEVEL = 0;
/*-------------------------------------------*/
/* strncmp that also makes sure there's a \0 at s2[0] */
int strncmp_nullcheck( const char* s1,
static int strncmp_nullcheck( const char* s1,
const char* s2,
int n )
{
@ -72,7 +72,7 @@ int strncmp_nullcheck( const char* s1,
else return strncmp ( s1, s2, n );
}
void getNextLevel( const char* name,
static void getNextLevel( const char* name,
int* nameLen,
const char** nextName )
{
@ -91,7 +91,7 @@ void getNextLevel( const char* name,
else *nameLen = strlen(name);
}
TestNode *createTestNode( )
static TestNode *createTestNode( )
{
TestNode *newNode;
@ -208,7 +208,7 @@ TestNode *addTestNode ( TestNode *root, const char *name )
}
}
void iterateTestsWithLevel ( const TestNode* root,
static void iterateTestsWithLevel ( const TestNode* root,
int len,
const TestNode** list,
TestMode mode)
@ -511,7 +511,7 @@ int processArgs(const TestNode* root,
* Display program invocation arguments
*/
void help ( const char *argv0 )
static void help ( const char *argv0 )
{
printf("Usage: %s [ -l ] [ -v ] [ -verbose] [-a] [ -all] [-n] \n [ -no_err_msg] [ -h ] [ /path/to/test ]\n",
argv0);