From 3ebd81750479f745e97fe382daaeecd7e3a81187 Mon Sep 17 00:00:00 2001 From: Jeff Genovy Date: Wed, 20 Feb 2019 19:38:58 -0800 Subject: [PATCH] ICU-20351 A few more MSVC warning cleanups. (Mostly adding static_cast) --- icu4c/source/i18n/formattedval_iterimpl.cpp | 2 +- icu4c/source/test/cintltst/cnumtst.c | 4 ++-- icu4c/source/test/intltest/localebuildertest.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/icu4c/source/i18n/formattedval_iterimpl.cpp b/icu4c/source/i18n/formattedval_iterimpl.cpp index 0b148bd1be..75328fae88 100644 --- a/icu4c/source/i18n/formattedval_iterimpl.cpp +++ b/icu4c/source/i18n/formattedval_iterimpl.cpp @@ -47,7 +47,7 @@ UBool FormattedValueFieldPositionIteratorImpl::nextPosition( UErrorCode&) const { U_ASSERT(fFields.size() % 4 == 0); int32_t numFields = fFields.size() / 4; - int32_t i = cfpos.getInt64IterationContext(); + int32_t i = static_cast(cfpos.getInt64IterationContext()); for (; i < numFields; i++) { UFieldCategory category = static_cast(fFields.elementAti(i * 4)); int32_t field = fFields.elementAti(i * 4 + 1); diff --git a/icu4c/source/test/cintltst/cnumtst.c b/icu4c/source/test/cintltst/cnumtst.c index 34d15d33ab..0abdd67423 100644 --- a/icu4c/source/test/cintltst/cnumtst.c +++ b/icu4c/source/test/cintltst/cnumtst.c @@ -2323,13 +2323,13 @@ static void TestParseCaseSensitive(void) { assertSuccess("Creating UNumberFormat", &status); double result = unum_parseDouble(fmt, u"1e2", -1, NULL, &status); assertSuccess("Parsing with UNumberFormat, case insensitive", &status); - assertIntEquals("Result with case sensitive", 100, result); + assertIntEquals("Result with case sensitive", 100, (int64_t)result); unum_setAttribute(fmt, UNUM_PARSE_CASE_SENSITIVE, 1); int32_t ppos = 0; result = unum_parseDouble(fmt, u"1e2", -1, &ppos, &status); assertSuccess("Parsing with UNumberFormat, case sensitive", &status); assertIntEquals("Position with case sensitive", 1, ppos); - assertIntEquals("Result with case sensitive", 1, result); + assertIntEquals("Result with case sensitive", 1, (int64_t)result); unum_close(fmt); } diff --git a/icu4c/source/test/intltest/localebuildertest.cpp b/icu4c/source/test/intltest/localebuildertest.cpp index f99057fa11..cf3bd74887 100644 --- a/icu4c/source/test/intltest/localebuildertest.cpp +++ b/icu4c/source/test/intltest/localebuildertest.cpp @@ -1500,7 +1500,7 @@ void LocaleBuilderTest::TestSetExtensionValidateOthersWellFormed() { }; const char * aToZ = "abcdefghijklmnopqrstuvwxyz"; - const int32_t aToZLen = uprv_strlen(aToZ); + const int32_t aToZLen = static_cast(uprv_strlen(aToZ)); int32_t i = 0; for (const char* extension : wellFormedExtensions) { char ch = aToZ[i]; @@ -1517,7 +1517,7 @@ void LocaleBuilderTest::TestSetExtensionValidateOthersWellFormed() { const char* someChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()-_=+;:,.<>?"; - const int32_t someCharsLen = uprv_strlen(someChars); + const int32_t someCharsLen = static_cast(uprv_strlen(someChars)); for (int32_t i = 0; i < someCharsLen; i++) { char ch = someChars[i]; UErrorCode status = U_ZERO_ERROR; @@ -1553,7 +1553,7 @@ void LocaleBuilderTest::TestSetExtensionValidateOthersIllFormed() { "87654321-a-0-3", // First subtag too long }; const char * aToZ = "abcdefghijklmnopqrstuvwxyz"; - const int32_t aToZLen = uprv_strlen(aToZ); + const int32_t aToZLen = static_cast(uprv_strlen(aToZ)); int32_t i = 0; for (const char* ill : illFormed) { char ch = aToZ[i];