ICU-20351 A few more MSVC warning cleanups. (Mostly adding static_cast)

This commit is contained in:
Jeff Genovy 2019-02-20 19:38:58 -08:00 committed by Jeff Genovy
parent 4711383bd8
commit 3ebd817504
3 changed files with 6 additions and 6 deletions

View File

@ -47,7 +47,7 @@ UBool FormattedValueFieldPositionIteratorImpl::nextPosition(
UErrorCode&) const { UErrorCode&) const {
U_ASSERT(fFields.size() % 4 == 0); U_ASSERT(fFields.size() % 4 == 0);
int32_t numFields = fFields.size() / 4; int32_t numFields = fFields.size() / 4;
int32_t i = cfpos.getInt64IterationContext(); int32_t i = static_cast<int32_t>(cfpos.getInt64IterationContext());
for (; i < numFields; i++) { for (; i < numFields; i++) {
UFieldCategory category = static_cast<UFieldCategory>(fFields.elementAti(i * 4)); UFieldCategory category = static_cast<UFieldCategory>(fFields.elementAti(i * 4));
int32_t field = fFields.elementAti(i * 4 + 1); int32_t field = fFields.elementAti(i * 4 + 1);

View File

@ -2323,13 +2323,13 @@ static void TestParseCaseSensitive(void) {
assertSuccess("Creating UNumberFormat", &status); assertSuccess("Creating UNumberFormat", &status);
double result = unum_parseDouble(fmt, u"1e2", -1, NULL, &status); double result = unum_parseDouble(fmt, u"1e2", -1, NULL, &status);
assertSuccess("Parsing with UNumberFormat, case insensitive", &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); unum_setAttribute(fmt, UNUM_PARSE_CASE_SENSITIVE, 1);
int32_t ppos = 0; int32_t ppos = 0;
result = unum_parseDouble(fmt, u"1e2", -1, &ppos, &status); result = unum_parseDouble(fmt, u"1e2", -1, &ppos, &status);
assertSuccess("Parsing with UNumberFormat, case sensitive", &status); assertSuccess("Parsing with UNumberFormat, case sensitive", &status);
assertIntEquals("Position with case sensitive", 1, ppos); 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); unum_close(fmt);
} }

View File

@ -1500,7 +1500,7 @@ void LocaleBuilderTest::TestSetExtensionValidateOthersWellFormed() {
}; };
const char * aToZ = "abcdefghijklmnopqrstuvwxyz"; const char * aToZ = "abcdefghijklmnopqrstuvwxyz";
const int32_t aToZLen = uprv_strlen(aToZ); const int32_t aToZLen = static_cast<int32_t>(uprv_strlen(aToZ));
int32_t i = 0; int32_t i = 0;
for (const char* extension : wellFormedExtensions) { for (const char* extension : wellFormedExtensions) {
char ch = aToZ[i]; char ch = aToZ[i];
@ -1517,7 +1517,7 @@ void LocaleBuilderTest::TestSetExtensionValidateOthersWellFormed() {
const char* someChars = const char* someChars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()-_=+;:,.<>?"; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()-_=+;:,.<>?";
const int32_t someCharsLen = uprv_strlen(someChars); const int32_t someCharsLen = static_cast<int32_t>(uprv_strlen(someChars));
for (int32_t i = 0; i < someCharsLen; i++) { for (int32_t i = 0; i < someCharsLen; i++) {
char ch = someChars[i]; char ch = someChars[i];
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
@ -1553,7 +1553,7 @@ void LocaleBuilderTest::TestSetExtensionValidateOthersIllFormed() {
"87654321-a-0-3", // First subtag too long "87654321-a-0-3", // First subtag too long
}; };
const char * aToZ = "abcdefghijklmnopqrstuvwxyz"; const char * aToZ = "abcdefghijklmnopqrstuvwxyz";
const int32_t aToZLen = uprv_strlen(aToZ); const int32_t aToZLen = static_cast<int32_t>(uprv_strlen(aToZ));
int32_t i = 0; int32_t i = 0;
for (const char* ill : illFormed) { for (const char* ill : illFormed) {
char ch = aToZ[i]; char ch = aToZ[i];