diff --git a/icu4c/source/test/cintltst/cmsgtst.c b/icu4c/source/test/cintltst/cmsgtst.c index 5dc8ac7394c..c41eee59557 100644 --- a/icu4c/source/test/cintltst/cmsgtst.c +++ b/icu4c/source/test/cintltst/cmsgtst.c @@ -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); } diff --git a/icu4c/source/test/cintltst/usrchtst.c b/icu4c/source/test/cintltst/usrchtst.c index 79550ec7607..a5f8127c7d8 100644 --- a/icu4c/source/test/cintltst/usrchtst.c +++ b/icu4c/source/test/cintltst/usrchtst.c @@ -142,6 +142,7 @@ static char *toCharString(const UChar* unichars) } else { sprintf(temp, "\\u%04x", ch); + temp += 6; /* \uxxxx */ } } *temp = 0; diff --git a/icu4c/source/test/intltest/convtest.cpp b/icu4c/source/test/intltest/convtest.cpp index 7b7b69afe6e..791ed3c76c3 100644 --- a/icu4c/source/test/intltest/convtest.cpp +++ b/icu4c/source/test/intltest/convtest.cpp @@ -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", diff --git a/icu4c/source/test/intltest/srchtest.cpp b/icu4c/source/test/intltest/srchtest.cpp index c7b08ae44ca..a673f253014 100644 --- a/icu4c/source/test/intltest/srchtest.cpp +++ b/icu4c/source/test/intltest/srchtest.cpp @@ -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; diff --git a/icu4c/source/test/intltest/svccoll.cpp b/icu4c/source/test/intltest/svccoll.cpp index 7de6e3d3b4b..1274fbd914f 100644 --- a/icu4c/source/test/intltest/svccoll.cpp +++ b/icu4c/source/test/intltest/svccoll.cpp @@ -266,7 +266,7 @@ public: { CollatorInfo** p; for (p = info; *p; ++p) {} - count = p - info; + count = (int32_t)(p - info); } ~TestFactory() { diff --git a/icu4c/source/test/intltest/textfile.cpp b/icu4c/source/test/intltest/textfile.cpp index 2765f2b9257..fe193b0fcbd 100644 --- a/icu4c/source/test/intltest/textfile.cpp +++ b/icu4c/source/test/intltest/textfile.cpp @@ -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; }