]> granicus.if.org Git - icu/commitdiff
ICU-8595 Compiler warning fixes for UResType
authorAndy Heninger <andy.heninger@gmail.com>
Fri, 8 Jul 2011 01:14:44 +0000 (01:14 +0000)
committerAndy Heninger <andy.heninger@gmail.com>
Fri, 8 Jul 2011 01:14:44 +0000 (01:14 +0000)
X-SVN-Rev: 30295

icu4c/source/common/uresbund.cpp
icu4c/source/common/uresdata.h

index 93bc559030404f5909a5428bff9a2638058fa0dc..bb03948b51a875fc8589ad1f7dbc704023cae8aa 100644 (file)
@@ -976,7 +976,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
                             } else if(idx != -1) {
                                 /* if there is no key, but there is an index, try to get by the index */
                                 /* here we have either a table or an array, so get the element */
-                                UResType type = RES_GET_TYPE(r);
+                                UResType type = (UResType)RES_GET_TYPE(r);
                                 if(URES_IS_TABLE(type)) {
                                     r = res_getTableItemByIndex(&(mainRes->fResData), r, idx, (const char **)&aKey);
                                 } else { /* array */
@@ -1695,7 +1695,7 @@ ures_getByKeyWithFallback(const UResourceBundle *resB,
         return fillIn;
     }
 
-    type = RES_GET_TYPE(resB->fRes);
+    type = (UResType)RES_GET_TYPE(resB->fRes);
     if(URES_IS_TABLE(type)) {
         int32_t t;
         res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
@@ -1773,7 +1773,7 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, con
         return fillIn;
     }
 
-    type = RES_GET_TYPE(resB->fRes);
+    type = (UResType)RES_GET_TYPE(resB->fRes);
     if(URES_IS_TABLE(type)) {
         int32_t t;
         res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
@@ -1827,7 +1827,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
         return NULL;
     }
 
-    type = RES_GET_TYPE(resB->fRes);
+    type = (UResType)RES_GET_TYPE(resB->fRes);
     if(URES_IS_TABLE(type)) {
         int32_t t=0;
 
index 6fdc7123d0a3720be4ba6e958491e8b0e313bf48..2bedf00426a326c82416db0742f966e2b06d25b1 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ******************************************************************************
 *                                                                            *
-* Copyright (C) 1999-2009, International Business Machines                   *
+* Copyright (C) 1999-2011, International Business Machines                   *
 *                Corporation and others. All Rights Reserved.                *
 *                                                                            *
 ******************************************************************************
@@ -61,7 +61,7 @@ typedef uint32_t Resource;
 
 #define RES_BOGUS 0xffffffff
 
-#define RES_GET_TYPE(res) ((UResType)((res)>>28UL))
+#define RES_GET_TYPE(res) ((int32_t)((res)>>28UL))
 #define RES_GET_OFFSET(res) ((res)&0x0fffffff)
 #define RES_GET_POINTER(pRoot, res) ((pRoot)+RES_GET_OFFSET(res))
 
@@ -69,8 +69,8 @@ typedef uint32_t Resource;
 #define RES_GET_INT(res) (((int32_t)((res)<<4L))>>4L)
 #define RES_GET_UINT(res) ((res)&0x0fffffff)
 
-#define URES_IS_ARRAY(type) ((type)==URES_ARRAY || (type)==URES_ARRAY16)
-#define URES_IS_TABLE(type) ((type)==URES_TABLE || (type)==URES_TABLE16 || (type)==URES_TABLE32)
+#define URES_IS_ARRAY(type) ((int32_t)(type)==URES_ARRAY || (int32_t)(type)==URES_ARRAY16)
+#define URES_IS_TABLE(type) ((int32_t)(type)==URES_TABLE || (int32_t)(type)==URES_TABLE16 || (int32_t)(type)==URES_TABLE32)
 #define URES_IS_CONTAINER(type) (URES_IS_TABLE(type) || URES_IS_ARRAY(type))
 
 #define URES_MAKE_RESOURCE(type, offset) (((Resource)(type)<<28)|(Resource)(offset))