From cb875ce8e4594c5ee17b60e5d9f356d0c2a3a8ae Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Fri, 11 Aug 2000 00:02:59 +0000 Subject: [PATCH] ICU-535 fixed some compiler warnings X-SVN-Rev: 2179 --- icu4c/source/common/unicode/utf8.h | 12 ++++----- icu4c/source/tools/genprops/store.c | 42 ++++++++++++++++++----------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/icu4c/source/common/unicode/utf8.h b/icu4c/source/common/unicode/utf8.h index 81f0b48e722..f2f047c9114 100644 --- a/icu4c/source/common/unicode/utf8.h +++ b/icu4c/source/common/unicode/utf8.h @@ -164,17 +164,17 @@ utf8_back1SafeBody(const uint8_t *s, UTextOffset start, UTextOffset i); (s)[(i)++]=(uint8_t)(c); \ } else { \ if((uint32_t)(c)<=0x7ff) { \ - (s)[(i)++]=(uint8_t)((c)>>6)|0xc0; \ + (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \ } else { \ if((uint32_t)(c)<=0xffff) { \ - (s)[(i)++]=(uint8_t)((c)>>12)|0xe0; \ + (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \ } else { \ - (s)[(i)++]=(uint8_t)((c)>>18)|0xf0; \ - (s)[(i)++]=(uint8_t)((c)>>12)&0x3f|0x80; \ + (s)[(i)++]=(uint8_t)(((c)>>18)|0xf0); \ + (s)[(i)++]=(uint8_t)(((c)>>12)&0x3f|0x80); \ } \ - (s)[(i)++]=(uint8_t)((c)>>6)&0x3f|0x80; \ + (s)[(i)++]=(uint8_t)(((c)>>6)&0x3f|0x80); \ } \ - (s)[(i)++]=(uint8_t)(c)&0x3f|0x80; \ + (s)[(i)++]=(uint8_t)((c)&0x3f|0x80); \ } \ } diff --git a/icu4c/source/tools/genprops/store.c b/icu4c/source/tools/genprops/store.c index fb7aa020a6d..6697f9c52ad 100644 --- a/icu4c/source/tools/genprops/store.c +++ b/icu4c/source/tools/genprops/store.c @@ -325,8 +325,10 @@ compactStage(uint16_t *stage, uint16_t stageTop, uint16_t blockSize, static int compareProps(const void *l, const void *r); +#if DO_DEBUG_OUT static uint32_t getProps2(uint32_t c, uint16_t *pI1, uint16_t *pI2, uint16_t *pI3, uint16_t *pI4); +#endif static uint32_t getProps(uint32_t c, uint16_t *pI1, uint16_t *pI2, uint16_t *pI3); @@ -437,7 +439,7 @@ addProps(Props *p) { x=0; value=0; count=0; - isNumber= genCategoryNames[p->generalCategory][0]=='N'; + isNumber= (UBool)(genCategoryNames[p->generalCategory][0]=='N'); if(p->upperCase!=0) { /* verify that no numbers and no Mn have case mappings */ @@ -839,7 +841,8 @@ compactStage2(void) { } stage2Top=newTop; - if(DO_DEBUG_OUT) { +#if DO_DEBUG_OUT + { /* debug output */ uint16_t i1, i2, i3, i4; uint32_t c; @@ -847,6 +850,7 @@ compactStage2(void) { printf("properties(0x%06x)=0x%06x\n", c, getProps2(c, &i1, &i2, &i3, &i4)); } } +#endif } extern void @@ -859,7 +863,8 @@ compactStage3(void) { } stage3Top=newTop; - if(DO_DEBUG_OUT) { +#if DO_DEBUG_OUT + { /* debug output */ uint16_t i1, i2, i3, i4; uint32_t c; @@ -867,6 +872,7 @@ compactStage3(void) { printf("properties(0x%06x)=0x%06x\n", c, getProps2(c, &i1, &i2, &i3, &i4)); } } +#endif } static uint16_t @@ -892,18 +898,18 @@ compactStage(uint16_t *stage, uint16_t stageTop, uint16_t blockSize, map[0]=0; newStart=blockSize; for(start=newStart; start0; --i) { + for(i=(uint16_t)(blockSize-i); i>0; --i) { stage[newStart++]=stage[start++]; } } else if(newStart0;) { @@ -990,7 +998,8 @@ compactProps(void) { if(beVerbose) { printf("compactProps() reduced propsTop from %u to %u\n", stage3Top, propsTop); } - if(DO_DEBUG_OUT) { +#if DO_DEBUG_OUT + { /* debug output */ uint16_t i1, i2, i3, i4; uint32_t c; @@ -998,6 +1007,7 @@ compactProps(void) { printf("properties(0x%06x)=0x%06x\n", c, getProps2(c, &i1, &i2, &i3, &i4)); } } +#endif } static int @@ -1039,7 +1049,7 @@ generateData(const char *dataDir) { stage2[i]+=offset; } - offset=(offset+stage3Top+1)/2; /* uint32_t offset to props[], include padding */ + offset=(uint16_t)((offset+stage3Top+1)/2); /* uint32_t offset to props[], include padding */ for(i=0; i>STAGE_1_SHIFT); - *pI2=i2=stage1[i1]+(uint16_t)((c>>STAGE_2_SHIFT)&(STAGE_2_BLOCK-1)); - *pI3=i3=stage2[i2]+(uint16_t)(c&(STAGE_3_BLOCK-1)); + *pI2=i2=(uint16_t)(stage1[i1]+((c>>STAGE_2_SHIFT)&(STAGE_2_BLOCK-1))); + *pI3=i3=(uint16_t)(stage2[i2]+(c&(STAGE_3_BLOCK-1))); *pI4=i4=stage3[i3]; return props32[i4]; } +#endif /* get properties before compacting them */ static uint32_t @@ -1106,8 +1118,8 @@ getProps(uint32_t c, uint16_t *pI1, uint16_t *pI2, uint16_t *pI3) { uint16_t i1, i2, i3; *pI1=i1=(uint16_t)(c>>STAGE_1_SHIFT); - *pI2=i2=stage1[i1]+(uint16_t)((c>>STAGE_2_SHIFT)&(STAGE_2_BLOCK-1)); - *pI3=i3=stage2[i2]+(uint16_t)(c&(STAGE_3_BLOCK-1)); + *pI2=i2=(uint16_t)(stage1[i1]+((c>>STAGE_2_SHIFT)&(STAGE_2_BLOCK-1))); + *pI3=i3=(uint16_t)(stage2[i2]+(c&(STAGE_3_BLOCK-1))); return props[i3]; } @@ -1157,7 +1169,7 @@ allocProps(void) { static uint16_t addUChars(const UChar *s, uint16_t length) { - uint16_t top=ucharsTop+length+1; + uint16_t top=(uint16_t)(ucharsTop+length+1); UChar *p; if(top>=MAX_UCHAR_COUNT) {