ICU-3905 Fix some compiler warnings

X-SVN-Rev: 16760
This commit is contained in:
George Rhoten 2004-11-04 23:43:46 +00:00
parent 59ccce5787
commit 62e47ceb17
6 changed files with 10 additions and 23 deletions

View File

@ -61,12 +61,12 @@ static void InitStrings( void )
return;
for (i=0; i < cnt_testCases; i++ ) {
uint32_t strSize = strlen(txt_testCasePatterns[i]) + 1;
uint32_t strSize = (uint32_t)strlen(txt_testCasePatterns[i]) + 1;
testCasePatterns[i]=(UChar*)malloc(sizeof(UChar) * strSize);
u_uastrncpy(testCasePatterns[i], txt_testCasePatterns[i], strSize);
}
for (i=0; i < cnt_testCases; i++ ) {
uint32_t strSize = strlen(txt_testResultStrings[i]) + 1;
uint32_t strSize = (uint32_t)strlen(txt_testResultStrings[i]) + 1;
testResultStrings[i] = (UChar*)malloc(sizeof(UChar) * strSize);
u_uastrncpy(testResultStrings[i], txt_testResultStrings[i], strSize);
}

View File

@ -142,6 +142,7 @@ static char *toCharString(const UChar* unichars)
}
else {
sprintf(temp, "\\u%04x", ch);
temp += 6; /* \uxxxx */
}
}
*temp = 0;

View File

@ -1051,7 +1051,7 @@ ConversionTest::FromUnicodeCase(ConversionCase &cc, UConverterFromUCallback call
// set the subchar
int32_t length;
if((length=strlen(cc.subchar))!=0) {
if((length=(int32_t)strlen(cc.subchar))!=0) {
ucnv_setSubstChars(cnv, cc.subchar, (int8_t)length, &errorCode);
if(U_FAILURE(errorCode)) {
errln("fromUnicode[%d](%s cb=\"%s\" fb=%d flush=%d) ucnv_setSubChars() failed - %s",

View File

@ -194,33 +194,19 @@ BreakIterator * StringSearchTest::getBreakIterator(const char *breaker)
char * StringSearchTest::toCharString(const UnicodeString &text)
{
UChar unichars[512];
static char result[1024];
int count = 0;
int index = 0;
int count = 0;
int length = text.length();
text.extract(0, text.length(), unichars, 0);
for (; count < length; count ++) {
UChar ch = unichars[count];
UChar ch = text[count];
if (ch >= 0x20 && ch <= 0x7e) {
result[index ++] = (char)ch;
}
else {
char digit[5];
int zerosize;
result[index ++] = '\\';
result[index ++] = 'u';
sprintf(digit, "%x", ch);
zerosize = 4 - strlen(digit);
while (zerosize != 0) {
result[index ++] = '0';
zerosize --;
}
result[index] = 0;
strcat(result, digit);
index += strlen(digit);
sprintf(result+index, "\\u%04x", ch);
index += 6; /* \uxxxx */
}
}
result[index] = 0;

View File

@ -266,7 +266,7 @@ public:
{
CollatorInfo** p;
for (p = info; *p; ++p) {}
count = p - info;
count = (int32_t)(p - info);
}
~TestFactory() {

View File

@ -50,7 +50,7 @@ TextFile::TextFile(const char* _name, const char* _encoding, UErrorCode& ec) :
if (U_FAILURE(ec)) {
return;
}
if (!ensureCapacity(uprv_strlen(testDir) + uprv_strlen(name) + 1)) {
if (!ensureCapacity((int32_t)(uprv_strlen(testDir) + uprv_strlen(name) + 1))) {
ec = U_MEMORY_ALLOCATION_ERROR;
return;
}