ICU-1007 reduce warnings

X-SVN-Rev: 5054
This commit is contained in:
Markus Scherer 2001-06-21 23:10:00 +00:00
parent d0ccdee1b0
commit a60e3b7f92
2 changed files with 27 additions and 18 deletions

View File

@ -36,6 +36,10 @@ U_CDECL_BEGIN
#include "gennorm.h" #include "gennorm.h"
U_CDECL_END U_CDECL_END
#ifdef WIN32
# pragma warning(disable: 4100)
#endif
UBool beVerbose=FALSE, haveCopyright=TRUE; UBool beVerbose=FALSE, haveCopyright=TRUE;
/* prototypes --------------------------------------------------------------- */ /* prototypes --------------------------------------------------------------- */

View File

@ -28,6 +28,10 @@
#include "unormimp.h" #include "unormimp.h"
#include "gennorm.h" #include "gennorm.h"
#ifdef WIN32
# pragma warning(disable: 4100)
#endif
#define DO_DEBUG_OUT 0 #define DO_DEBUG_OUT 0
/* file data ---------------------------------------------------------------- */ /* file data ---------------------------------------------------------------- */
@ -78,12 +82,15 @@ utm_open(const char *name, uint32_t count, uint32_t size) {
return mem; return mem;
} }
#if 0
/* we don't use this - we don't clean up memory here... */
static void static void
utm_close(UToolMemory *mem) { utm_close(UToolMemory *mem) {
if(mem!=NULL) { if(mem!=NULL) {
uprv_free(mem); uprv_free(mem);
} }
} }
#endif
static void * static void *
utm_getStart(UToolMemory *mem) { utm_getStart(UToolMemory *mem) {
@ -198,7 +205,7 @@ createStage2Block(uint32_t code) {
uint16_t *p; uint16_t *p;
p=(uint16_t *)utm_allocN(stage2Mem, _NORM_STAGE_2_BLOCK_COUNT); p=(uint16_t *)utm_allocN(stage2Mem, _NORM_STAGE_2_BLOCK_COUNT);
stage1[i]=j=p-stage2; stage1[i]=j=(uint16_t)(p-stage2);
} }
return j; return j;
} }
@ -208,7 +215,7 @@ createStage2Block(uint32_t code) {
* get or create the intermediate trie entries for it as well * get or create the intermediate trie entries for it as well
*/ */
static Norm * static Norm *
createNorm(code) { createNorm(uint32_t code) {
Norm *p; Norm *p;
uint16_t stage2Block, k; uint16_t stage2Block, k;
@ -217,7 +224,7 @@ createNorm(code) {
if(stage2[k]==0) { if(stage2[k]==0) {
/* allocate Norm */ /* allocate Norm */
p=(Norm *)utm_alloc(normMem); p=(Norm *)utm_alloc(normMem);
stage2[k]=p-norms; stage2[k]=(uint16_t)(p-norms);
} else { } else {
p=norms+stage2[k]; p=norms+stage2[k];
} }
@ -226,7 +233,7 @@ createNorm(code) {
/* get an existing Norm unit */ /* get an existing Norm unit */
static Norm * static Norm *
getNorm(code) { getNorm(uint32_t code) {
uint32_t i; uint32_t i;
uint16_t j; uint16_t j;
@ -268,6 +275,7 @@ enumTrie(EnumTrieFn *fn, void *context) {
uint16_t j, k, l; uint16_t j, k, l;
code=0; code=0;
count=0;
for(i=0; i<_NORM_STAGE_1_MAX_COUNT; ++i) { for(i=0; i<_NORM_STAGE_1_MAX_COUNT; ++i) {
j=stage1[i]; j=stage1[i];
if(j!=0) { if(j!=0) {
@ -450,7 +458,7 @@ processCombining() {
/* calculate the length of the combining data for this lead code point in the combiningTable */ /* calculate the length of the combining data for this lead code point in the combiningTable */
while(j<count && i==triples[j].leadIndex) { while(j<count && i==triples[j].leadIndex) {
/* count 2 16-bit units per composition code unit */ /* count 2 16-bit units per composition code unit */
tableTop+=2*UTF16_CHAR_LENGTH(combined=triples[j++].combined); tableTop+=(uint16_t)(2*UTF16_CHAR_LENGTH(combined=triples[j++].combined));
} }
} }
@ -614,7 +622,7 @@ decompWithSingleFn(void *context, uint32_t code, Norm *norm) {
DecompSingle *me=(DecompSingle *)context; DecompSingle *me=(DecompSingle *)context;
uint32_t c, myC; uint32_t c, myC;
int32_t i, length; int32_t i, length;
uint8_t lenNFD, lenNFKD, myLenNFD, myLenNFKD; uint8_t lenNFD=0, lenNFKD=0, myLenNFD, myLenNFKD;
UBool changedNFD=FALSE, changedNFKD=FALSE; UBool changedNFD=FALSE, changedNFKD=FALSE;
/* get the new character's data */ /* get the new character's data */
@ -626,7 +634,6 @@ decompWithSingleFn(void *context, uint32_t code, Norm *norm) {
if((length=norm->lenNFD)!=0 && myLenNFD!=0) { if((length=norm->lenNFD)!=0 && myLenNFD!=0) {
/* apply NFD(myC) to norm->nfd */ /* apply NFD(myC) to norm->nfd */
s32=norm->nfd; s32=norm->nfd;
lenNFD=0;
for(i=0; i<length; ++i) { for(i=0; i<length; ++i) {
c=s32[i]; c=s32[i];
if(c==myC) { if(c==myC) {
@ -642,7 +649,6 @@ decompWithSingleFn(void *context, uint32_t code, Norm *norm) {
if((length=norm->lenNFKD)!=0) { if((length=norm->lenNFKD)!=0) {
/* apply NFD(myC) and NFKD(myC) to norm->nfkd */ /* apply NFD(myC) and NFKD(myC) to norm->nfkd */
s32=norm->nfkd; s32=norm->nfkd;
lenNFKD=0;
for(i=0; i<length; ++i) { for(i=0; i<length; ++i) {
c=s32[i]; c=s32[i];
if(c==myC) { if(c==myC) {
@ -661,7 +667,6 @@ decompWithSingleFn(void *context, uint32_t code, Norm *norm) {
} else if((length=norm->lenNFD)!=0 && myLenNFKD!=0) { } else if((length=norm->lenNFD)!=0 && myLenNFKD!=0) {
/* apply NFKD(myC) to norm->nfd, forming a new norm->nfkd */ /* apply NFKD(myC) to norm->nfd, forming a new norm->nfkd */
s32=norm->nfd; s32=norm->nfd;
lenNFKD=0;
for(i=0; i<length; ++i) { for(i=0; i<length; ++i) {
c=s32[i]; c=s32[i];
if(c==myC) { if(c==myC) {
@ -807,7 +812,7 @@ setHangulJamoSpecials() {
/* set one complete stage 2 block with this Hangul information */ /* set one complete stage 2 block with this Hangul information */
pStage2Block=(uint16_t *)utm_allocN(stage2Mem, _NORM_STAGE_2_BLOCK_COUNT); pStage2Block=(uint16_t *)utm_allocN(stage2Mem, _NORM_STAGE_2_BLOCK_COUNT);
for(i=0; i<_NORM_STAGE_2_BLOCK_COUNT; ++i) { for(i=0; i<_NORM_STAGE_2_BLOCK_COUNT; ++i) {
pStage2Block[i]=norm-norms; pStage2Block[i]=(uint16_t)(norm-norms);
} }
/* set these data for U+ac00..U+d7a3 */ /* set these data for U+ac00..U+d7a3 */
@ -815,22 +820,22 @@ setHangulJamoSpecials() {
/* set a partial stage 2 block before pStage2Block can be repeated */ /* set a partial stage 2 block before pStage2Block can be repeated */
if(c&_NORM_STAGE_2_MASK) { if(c&_NORM_STAGE_2_MASK) {
i=createStage2Block(c)+(uint16_t)(c&_NORM_STAGE_2_MASK); i=(uint16_t)(createStage2Block(c)+(c&_NORM_STAGE_2_MASK));
do { do {
stage2[i++]=norm-norms; stage2[i++]=(uint16_t)(norm-norms);
} while(++c&_NORM_STAGE_2_MASK); } while(++c&_NORM_STAGE_2_MASK);
} }
/* set full stage 1 blocks to the common stage 2 block */ /* set full stage 1 blocks to the common stage 2 block */
while(c<(0xd7a3&~_NORM_STAGE_2_MASK)) { while(c<(0xd7a3&~_NORM_STAGE_2_MASK)) {
stage1[c>>_NORM_TRIE_SHIFT]=pStage2Block-stage2; stage1[c>>_NORM_TRIE_SHIFT]=(uint16_t)(pStage2Block-stage2);
c+=_NORM_STAGE_2_BLOCK_COUNT; c+=_NORM_STAGE_2_BLOCK_COUNT;
} }
/* set a partial stage 2 block after the repetition */ /* set a partial stage 2 block after the repetition */
i=createStage2Block(c); i=createStage2Block(c);
while(c<=0xd7a3) { while(c<=0xd7a3) {
stage2[i++]=norm-norms; stage2[i++]=(uint16_t)(norm-norms);
++c; ++c;
} }
} }
@ -873,7 +878,7 @@ reorderString(uint32_t *s, int32_t length) {
} }
} }
return ((uint16_t)ccs[0]<<8)|ccs[length-1]; return (uint16_t)(((uint16_t)ccs[0]<<8)|ccs[length-1]);
} }
static UBool combineAndQC[64]={ 0 }; static UBool combineAndQC[64]={ 0 };
@ -1102,7 +1107,7 @@ makeFCD() {
map[i>>_NORM_TRIE_SHIFT]=(uint16_t)0; map[i>>_NORM_TRIE_SHIFT]=(uint16_t)0;
} else { } else {
/* keep this block */ /* keep this block */
map[i>>_NORM_TRIE_SHIFT]=(uint16_t)(i&~_NORM_STAGE_2_MASK)-delta; map[i>>_NORM_TRIE_SHIFT]=(uint16_t)((i&~_NORM_STAGE_2_MASK)-delta);
oredValues=0; oredValues=0;
} }
} }
@ -1364,8 +1369,8 @@ generateData(const char *dataDir) {
indexes[_NORM_INDEX_COMBINE_DATA_COUNT]=combiningTableTop; indexes[_NORM_INDEX_COMBINE_DATA_COUNT]=combiningTableTop;
indexes[_NORM_INDEX_COMBINE_FWD_COUNT]=combineFwdTop; indexes[_NORM_INDEX_COMBINE_FWD_COUNT]=combineFwdTop;
indexes[_NORM_INDEX_COMBINE_BOTH_COUNT]=combineBothTop-combineFwdTop; indexes[_NORM_INDEX_COMBINE_BOTH_COUNT]=(uint16_t)(combineBothTop-combineFwdTop);
indexes[_NORM_INDEX_COMBINE_BACK_COUNT]=combineBackTop-combineBothTop; indexes[_NORM_INDEX_COMBINE_BACK_COUNT]=(uint16_t)(combineBackTop-combineBothTop);
indexes[_NORM_INDEX_FCD_TRIE_INDEX_COUNT]=fcdStage1Top; indexes[_NORM_INDEX_FCD_TRIE_INDEX_COUNT]=fcdStage1Top;
indexes[_NORM_INDEX_FCD_TRIE_DATA_COUNT]=fcdTableTop; indexes[_NORM_INDEX_FCD_TRIE_DATA_COUNT]=fcdTableTop;