]> granicus.if.org Git - icu/commitdiff
ICU-10401 Fix some warnings in MSVC build
authorMichael Ow <mow@svn.icu-project.org>
Fri, 22 Jan 2016 18:47:55 +0000 (18:47 +0000)
committerMichael Ow <mow@svn.icu-project.org>
Fri, 22 Jan 2016 18:47:55 +0000 (18:47 +0000)
X-SVN-Rev: 38191

icu4c/source/common/dictbe.cpp
icu4c/source/common/dictionarydata.cpp
icu4c/source/common/rbbi.cpp

index f1c874d4ad16445578ae4b6d4889c6d9b2620844..9395ca78a0d018efd95faee27cc1a70ab9ee6ae3 100644 (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);
index cb594c6bb2c1d0c377d49c6608bb00c972459172..c0e6662de6b7a17b2d3772575562cee9c5017df2 100644 (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) {
index 19494af26a564a38909aac4af915be6d459f8b9c..6f3df2c4b704fd670307856561ff1e70381a5713 100644 (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