From: Andy Heninger Date: Fri, 8 Jul 2011 01:14:44 +0000 (+0000) Subject: ICU-8595 Compiler warning fixes for UResType X-Git-Tag: milestone-59-0-1~4671 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3cf524ee6a50c569dc0c075da5d374daa41a3097;p=icu ICU-8595 Compiler warning fixes for UResType X-SVN-Rev: 30295 --- diff --git a/icu4c/source/common/uresbund.cpp b/icu4c/source/common/uresbund.cpp index 93bc5590304..bb03948b51a 100644 --- a/icu4c/source/common/uresbund.cpp +++ b/icu4c/source/common/uresbund.cpp @@ -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; diff --git a/icu4c/source/common/uresdata.h b/icu4c/source/common/uresdata.h index 6fdc7123d0a..2bedf00426a 100644 --- a/icu4c/source/common/uresdata.h +++ b/icu4c/source/common/uresdata.h @@ -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))