ICU-10401 Fix some warnings in MSVC build

X-SVN-Rev: 38191
This commit is contained in:
Michael Ow 2016-01-22 18:47:55 +00:00
parent f5d28f72d2
commit df945dc264
3 changed files with 25 additions and 25 deletions

View file

@ -1,6 +1,6 @@
/**
*******************************************************************************
* Copyright (C) 2006-2015, International Business Machines Corporation
* Copyright (C) 2006-2016, International Business Machines Corporation
* and others. All Rights Reserved.
*******************************************************************************
*/
@ -70,13 +70,13 @@ DictionaryBreakEngine::findBreaks( UText *text,
rangeStart = current;
if (!isDict) {
utext_next32(text);
rangeStart = utext_getNativeIndex(text);
rangeStart = (int32_t)utext_getNativeIndex(text);
}
}
// rangeEnd = start + 1;
utext_setNativeIndex(text, start);
utext_next32(text);
rangeEnd = utext_getNativeIndex(text);
rangeEnd = (int32_t)utext_getNativeIndex(text);
}
else {
while((current = (int32_t)utext_getNativeIndex(text)) < endPos && fSet.contains(c)) {
@ -335,9 +335,9 @@ foundBest:
UChar32 pc;
int32_t chars = 0;
for (;;) {
int32_t pcIndex = utext_getNativeIndex(text);
int32_t pcIndex = (int32_t)utext_getNativeIndex(text);
pc = utext_next32(text);
int32_t pcSize = utext_getNativeIndex(text) - pcIndex;
int32_t pcSize = (int32_t)utext_getNativeIndex(text) - pcIndex;
chars += pcSize;
remaining -= pcSize;
if (remaining <= 0) {
@ -390,9 +390,9 @@ foundBest:
if (!fSuffixSet.contains(utext_previous32(text))) {
// Skip over previous end and PAIYANNOI
utext_next32(text);
int32_t paiyannoiIndex = utext_getNativeIndex(text);
int32_t paiyannoiIndex = (int32_t)utext_getNativeIndex(text);
utext_next32(text);
cuWordLength += utext_getNativeIndex(text) - paiyannoiIndex; // Add PAIYANNOI to word
cuWordLength += (int32_t)utext_getNativeIndex(text) - paiyannoiIndex; // Add PAIYANNOI to word
uc = utext_current32(text); // Fetch next character
}
else {
@ -404,9 +404,9 @@ foundBest:
if (utext_previous32(text) != THAI_MAIYAMOK) {
// Skip over previous end and MAIYAMOK
utext_next32(text);
int32_t maiyamokIndex = utext_getNativeIndex(text);
int32_t maiyamokIndex = (int32_t)utext_getNativeIndex(text);
utext_next32(text);
cuWordLength += utext_getNativeIndex(text) - maiyamokIndex; // Add MAIYAMOK to word
cuWordLength += (int32_t)utext_getNativeIndex(text) - maiyamokIndex; // Add MAIYAMOK to word
}
else {
// Restore prior position
@ -568,9 +568,9 @@ foundBest:
UChar32 uc;
int32_t chars = 0;
for (;;) {
int32_t pcIndex = utext_getNativeIndex(text);
int32_t pcIndex = (int32_t)utext_getNativeIndex(text);
pc = utext_next32(text);
int32_t pcSize = utext_getNativeIndex(text) - pcIndex;
int32_t pcSize = (int32_t)utext_getNativeIndex(text) - pcIndex;
chars += pcSize;
remaining -= pcSize;
if (remaining <= 0) {
@ -761,9 +761,9 @@ foundBest:
UChar32 uc;
int32_t chars = 0;
for (;;) {
int32_t pcIndex = utext_getNativeIndex(text);
int32_t pcIndex = (int32_t)utext_getNativeIndex(text);
pc = utext_next32(text);
int32_t pcSize = utext_getNativeIndex(text) - pcIndex;
int32_t pcSize = (int32_t)utext_getNativeIndex(text) - pcIndex;
chars += pcSize;
remaining -= pcSize;
if (remaining <= 0) {
@ -967,9 +967,9 @@ foundBest:
UChar32 uc;
int32_t chars = 0;
for (;;) {
int32_t pcIndex = utext_getNativeIndex(text);
int32_t pcIndex = (int32_t)utext_getNativeIndex(text);
pc = utext_next32(text);
int32_t pcSize = utext_getNativeIndex(text) - pcIndex;
int32_t pcSize = (int32_t)utext_getNativeIndex(text) - pcIndex;
chars += pcSize;
remaining -= pcSize;
if (remaining <= 0) {
@ -1166,14 +1166,14 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
int32_t limit = rangeEnd;
U_ASSERT(limit <= utext_nativeLength(inText));
if (limit > utext_nativeLength(inText)) {
limit = utext_nativeLength(inText);
limit = (int32_t)utext_nativeLength(inText);
}
inputMap.adoptInsteadAndCheckErrorCode(new UVector32(status), status);
if (U_FAILURE(status)) {
return 0;
}
while (utext_getNativeIndex(inText) < limit) {
int32_t nativePosition = utext_getNativeIndex(inText);
int32_t nativePosition = (int32_t)utext_getNativeIndex(inText);
UChar32 c = utext_next32(inText);
U_ASSERT(c != U_SENTINEL);
inString.append(c);

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2014, International Business Machines
* Copyright (C) 2014-2016, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* dictionarydata.h
@ -45,13 +45,13 @@ int32_t UCharsDictionaryMatcher::matches(UText *text, int32_t maxLength, int32_t
int32_t *prefix) const {
UCharsTrie uct(characters);
int32_t startingTextIndex = utext_getNativeIndex(text);
int32_t startingTextIndex = (int32_t)utext_getNativeIndex(text);
int32_t wordCount = 0;
int32_t codePointsMatched = 0;
for (UChar32 c = utext_next32(text); c >= 0; c=utext_next32(text)) {
UStringTrieResult result = (codePointsMatched == 0) ? uct.first(c) : uct.next(c);
int32_t lengthMatched = utext_getNativeIndex(text) - startingTextIndex;
int32_t lengthMatched = (int32_t)utext_getNativeIndex(text) - startingTextIndex;
codePointsMatched += 1;
if (USTRINGTRIE_HAS_VALUE(result)) {
if (wordCount < limit) {
@ -112,13 +112,13 @@ int32_t BytesDictionaryMatcher::matches(UText *text, int32_t maxLength, int32_t
int32_t *lengths, int32_t *cpLengths, int32_t *values,
int32_t *prefix) const {
BytesTrie bt(characters);
int32_t startingTextIndex = utext_getNativeIndex(text);
int32_t startingTextIndex = (int32_t)utext_getNativeIndex(text);
int32_t wordCount = 0;
int32_t codePointsMatched = 0;
for (UChar32 c = utext_next32(text); c >= 0; c=utext_next32(text)) {
UStringTrieResult result = (codePointsMatched == 0) ? bt.first(transform(c)) : bt.next(transform(c));
int32_t lengthMatched = utext_getNativeIndex(text) - startingTextIndex;
int32_t lengthMatched = (int32_t)utext_getNativeIndex(text) - startingTextIndex;
codePointsMatched += 1;
if (USTRINGTRIE_HAS_VALUE(result)) {
if (wordCount < limit) {

View file

@ -1,6 +1,6 @@
/*
***************************************************************************
* Copyright (C) 1999-2014 International Business Machines Corporation
* Copyright (C) 1999-2016 International Business Machines Corporation
* and others. All rights reserved.
***************************************************************************
*/
@ -715,7 +715,7 @@ int32_t RuleBasedBreakIterator::following(int32_t offset) {
// Move requested offset to a code point start. It might be on a trail surrogate,
// or on a trail byte if the input is UTF-8.
utext_setNativeIndex(fText, offset);
offset = utext_getNativeIndex(fText);
offset = (int32_t)utext_getNativeIndex(fText);
// if we have cached break positions and offset is in the range
// covered by them, use them
@ -826,7 +826,7 @@ int32_t RuleBasedBreakIterator::preceding(int32_t offset) {
// Move requested offset to a code point start. It might be on a trail surrogate,
// or on a trail byte if the input is UTF-8.
utext_setNativeIndex(fText, offset);
offset = utext_getNativeIndex(fText);
offset = (int32_t)utext_getNativeIndex(fText);
// if we have cached break positions and offset is in the range
// covered by them, use them