From 822eb4e6225f34a3e980c0c4937a5f2c2694a081 Mon Sep 17 00:00:00 2001 From: Jeff Genovy <29107334+jefgen@users.noreply.github.com> Date: Tue, 31 Mar 2020 13:01:55 -0700 Subject: [PATCH] ICU-20979 Fixing minor MSVC warnings --- icu4c/source/common/locid.cpp | 2 +- icu4c/source/i18n/ucol_sit.cpp | 2 +- icu4c/source/test/intltest/rbbitst.cpp | 5 +++-- icu4c/source/test/intltest/strtest.cpp | 6 +++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/icu4c/source/common/locid.cpp b/icu4c/source/common/locid.cpp index 04723dcd5a5..753a452120e 100644 --- a/icu4c/source/common/locid.cpp +++ b/icu4c/source/common/locid.cpp @@ -722,7 +722,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize) if (U_SUCCESS(status)) { CharString newVar; if (begin != variants) { - newVar.append(variants, begin - variants - 1, status); + newVar.append(variants, static_cast(begin - variants - 1), status); } if (end != nullptr) { if (begin != variants) { diff --git a/icu4c/source/i18n/ucol_sit.cpp b/icu4c/source/i18n/ucol_sit.cpp index ca41fda682a..92f332d6d06 100644 --- a/icu4c/source/i18n/ucol_sit.cpp +++ b/icu4c/source/i18n/ucol_sit.cpp @@ -193,7 +193,7 @@ _processRFC3066Locale(CollatorSpec *spec, uint32_t, const char* string, *status = U_BUFFER_OVERFLOW_ERROR; return string; } else { - spec->locale.copyFrom(CharString(string, end-string, *status), *status); + spec->locale.copyFrom(CharString(string, static_cast(end-string), *status), *status); return end+1; } } diff --git a/icu4c/source/test/intltest/rbbitst.cpp b/icu4c/source/test/intltest/rbbitst.cpp index 0ca89f6d64f..92e7adef592 100644 --- a/icu4c/source/test/intltest/rbbitst.cpp +++ b/icu4c/source/test/intltest/rbbitst.cpp @@ -1639,8 +1639,9 @@ std::string RBBIMonkeyKind::classNameFromCodepoint(const UChar32 c) { unsigned int RBBIMonkeyKind::maxClassNameSize() { unsigned int maxSize = 0; for (int aClassNum = 0; aClassNum < charClasses()->size(); aClassNum++) { - if (classNames[aClassNum].size() > maxSize) { - maxSize = classNames[aClassNum].size(); + auto aClassNumSize = static_cast(classNames[aClassNum].size()); + if (aClassNumSize > maxSize) { + maxSize = aClassNumSize; } } return maxSize; diff --git a/icu4c/source/test/intltest/strtest.cpp b/icu4c/source/test/intltest/strtest.cpp index cf00cd4241d..1185d31c352 100644 --- a/icu4c/source/test/intltest/strtest.cpp +++ b/icu4c/source/test/intltest/strtest.cpp @@ -166,7 +166,7 @@ void StringTest::TestUpperOrdinal() { for (int32_t i = 0;; ++i) { char ic = nativeInvChars[i]; - uint8_t ac = asciiInvChars[i]; + uint8_t ac = static_cast(asciiInvChars[i]); int32_t expected = ac - 'A'; int32_t actual = uprv_upperOrdinal(ic); if (0 <= expected && expected <= 25) { @@ -188,7 +188,7 @@ void StringTest::TestLowerOrdinal() { for (int32_t i = 0;; ++i) { char ic = nativeInvChars[i]; - uint8_t ac = asciiInvChars[i]; + uint8_t ac = static_cast(asciiInvChars[i]); int32_t expected = ac - 'a'; int32_t actual = uprv_lowerOrdinal(ic); if (0 <= expected && expected <= 25) { @@ -506,7 +506,7 @@ StringTest::TestStringPieceOther() { Other other; StringPiece piece(other); - assertEquals("size()", piece.size(), other.size()); + assertEquals("size()", piece.size(), static_cast(other.size())); assertEquals("data()", piece.data(), other.data()); } -- 2.40.0