ICU-96 fixed compiler warnings

X-SVN-Rev: 4285
This commit is contained in:
Vladimir Weinstein 2001-03-22 21:16:20 +00:00
parent ac32911f8d
commit 3fd8f3bf61
11 changed files with 75 additions and 70 deletions

View file

@ -678,7 +678,7 @@ uint32_t ucol_getNextUCA(UChar ch, collIterate *collationSource, UErrorCode *sta
* of implicit CEs
*/
uint32_t ucol_getPrevUCA(UChar ch, collIterate *collationSource,
uint32_t length, UErrorCode *status)
UErrorCode *status)
{
uint32_t order;
if (ch < 0xFF) {
@ -689,7 +689,7 @@ uint32_t ucol_getPrevUCA(UChar ch, collIterate *collationSource,
}
if (order >= UCOL_NOT_FOUND) {
order = getSpecialPrevCE(UCA, order, collationSource, length, status);
order = getSpecialPrevCE(UCA, order, collationSource, status);
}
if (order == UCOL_NOT_FOUND)
@ -992,7 +992,7 @@ uint32_t getSpecialCE(const UCollator *coll, uint32_t CE, collIterate *source, U
* It is called by both getPrevCE and getPrevUCA
*/
uint32_t getSpecialPrevCE(const UCollator *coll, uint32_t CE,
collIterate *source, uint32_t length,
collIterate *source,
UErrorCode *status)
{
uint32_t count = 0;
@ -1266,7 +1266,7 @@ int32_t ucol_getSortKeySize(const UCollator *coll, collIterate *s, int32_t curre
uint8_t UCOL_COMMON_BOT4 = (uint8_t)(variableMax1+1);
uint8_t UCOL_BOT_COUNT4 = (uint8_t)(0xFF - UCOL_COMMON_BOT4);
int32_t order = UCOL_NO_MORE_CES;
uint32_t order = UCOL_NO_MORE_CES;
uint8_t primary1 = 0;
uint8_t primary2 = 0;
uint32_t ce = 0;
@ -1472,7 +1472,6 @@ ucol_calcSortKey(const UCollator *coll,
UBool compareIdent = (strength == UCOL_IDENTICAL);
UBool doCase = (coll->caseLevel == UCOL_ON);
UBool isFrenchSec = (coll->frenchCollation == UCOL_ON) && (compareSec == 0);
UBool upperFirst = (coll->caseFirst == UCOL_UPPER_FIRST) && (compareTer == 0);
UBool shifted = (coll->alternateHandling == UCOL_SHIFTED);
UBool qShifted = shifted && (compareQuad == 0);
const uint8_t *scriptOrder = coll->scriptOrder;
@ -1989,7 +1988,7 @@ ucol_calcSortKeySimpleTertiary(const UCollator *coll,
uint32_t secSize = UCOL_SECONDARY_MAX_BUFFER, terSize = UCOL_TERTIARY_MAX_BUFFER;
int32_t sortKeySize = 3; /* it is always \0 terminated plus separators for secondary and tertiary */
uint32_t sortKeySize = 3; /* it is always \0 terminated plus separators for secondary and tertiary */
UChar normBuffer[UCOL_NORMALIZATION_MAX_BUFFER];
UChar *normSource = normBuffer;
@ -2251,7 +2250,7 @@ ucol_calcSortKeySimpleTertiary(const UCollator *coll,
/* this function makes a string with representation of a sortkey */
U_CAPI char U_EXPORT2 *ucol_sortKeyToString(const UCollator *coll, const uint8_t *sortkey, char *buffer, uint32_t *len) {
uint32_t strength = UCOL_PRIMARY;
int32_t strength = UCOL_PRIMARY;
uint32_t res_size = 0;
UBool doneCase = FALSE;
@ -2303,6 +2302,10 @@ U_CAPI char U_EXPORT2 *ucol_sortKeyToString(const UCollator *coll, const uint8_t
sprintf(current, "]");
current += 3;
if(res_size > *len) {
return NULL;
}
return buffer;
@ -2622,7 +2625,7 @@ U_CAPI int32_t
ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen) {
int32_t len = 0;
int32_t UCAlen = 0;
const UChar* ucaRules;
const UChar* ucaRules = 0;
const UChar *rules = ucol_getRules(coll, &len);
if(delta == UCOL_FULL_RULES) {
UErrorCode status = U_ZERO_ERROR;
@ -2887,7 +2890,6 @@ ucol_strcoll( const UCollator *coll,
UBool checkIdent = (strength == UCOL_IDENTICAL);
UBool checkCase = (coll->caseLevel == UCOL_ON);
UBool isFrenchSec = (coll->frenchCollation == UCOL_ON) && checkSecTer;
UBool upperFirst = (coll->caseFirst == UCOL_UPPER_FIRST) && checkTertiary;
UBool shifted = (coll->alternateHandling == UCOL_SHIFTED);
UBool qShifted = shifted && checkQuad;
@ -3536,11 +3538,6 @@ U_CAPI UCollationResult ucol_strcollinc(const UCollator *coll,
UCollationResult result = UCOL_EQUAL;
UErrorCode status = U_ZERO_ERROR;
UChar normSource[UCOL_MAX_BUFFER], normTarget[UCOL_MAX_BUFFER];
UChar *normSourceP = normSource;
UChar *normTargetP = normTarget;
uint32_t normSourceLength = UCOL_MAX_BUFFER, normTargetLength = UCOL_MAX_BUFFER;
if(coll->normalizationMode != UCOL_OFF) { /* run away screaming!!!! */
return alternateIncrementalProcessing(coll, &sColl, &tColl);
}
@ -3554,7 +3551,6 @@ U_CAPI UCollationResult ucol_strcollinc(const UCollator *coll,
UBool checkIdent = (strength == UCOL_IDENTICAL);
UBool checkCase = (coll->caseLevel == UCOL_ON);
UBool isFrenchSec = (coll->frenchCollation == UCOL_ON) && checkSecTer;
UBool upperFirst = (coll->caseFirst == UCOL_UPPER_FIRST) && checkTertiary;
UBool shifted = (coll->alternateHandling == UCOL_SHIFTED);
UBool qShifted = shifted && checkQuad;
@ -4195,8 +4191,7 @@ uint32_t ucol_getIncrementalUCA(UChar ch, incrementalContext *collationSource, U
int32_t ucol_getIncrementalSpecialCE(const UCollator *coll, uint32_t CE, incrementalContext *source, UErrorCode *status) {
int32_t i = 0; /* general counter */
uint32_t firstCE = UCOL_NOT_FOUND;
uint32_t i = 0; /* general counter */
if(U_FAILURE(*status)) return -1;

View file

@ -251,7 +251,9 @@ U_CFUNC void ucol_inv_getGapPositions(UColTokListHeader *lh) {
}
U_CFUNC uint32_t ucol_getNextGenerated(ucolCEGenerator *g, UErrorCode *status) {
if(U_SUCCESS(*status)) {
g->current = ucol_nextWeight(g->ranges, &g->noOfRanges);
}
return g->current;
}
@ -293,8 +295,8 @@ U_CFUNC uint32_t ucol_getCEGenerator(ucolCEGenerator *g, uint32_t* lows, uint32_
uint32_t count = tok->toInsert+(fbHigh[strength]-fbLow[strength]);
if(low == high && strength > UCOL_PRIMARY) {
uint32_t s = strength;
while(s >= UCOL_PRIMARY) {
int32_t s = strength;
for(;;) {
s--;
if(lows[fStrength*3+s] != highs[fStrength*3+s]) {
if(strength == UCOL_SECONDARY) {
@ -306,6 +308,10 @@ U_CFUNC uint32_t ucol_getCEGenerator(ucolCEGenerator *g, uint32_t* lows, uint32_
}
break;
}
if(s<0) {
*status = U_INTERNAL_PROGRAM_ERROR;
return 0;
}
}
}
@ -553,17 +559,11 @@ U_CFUNC void ucol_createElements(UColTokenParser *src, tempUCATable *t, UColTokL
}
/* copy UChars */
/*
key.source = newCharsLen << 24 | charsOffset;
key.expansion = newExtensionsLen << 24 | extensionOffset;
*/
UChar buff[128];
uint32_t decompSize;
uprv_memcpy(buff, (tok->source & 0x00FFFFFF) + src->source, (tok->source >> 24)*sizeof(UChar));
decompSize = unorm_normalize(buff, tok->source >> 24, UNORM_NFD, 0, el.uchars, 128, status);
/*uprv_memcpy(el.uchars, (tok->source & 0x00FFFFFF) + src->source, (tok->source >> 24)*sizeof(UChar));*/
/* I think I don't want to have expansion chars in chars for UCAelement... HMMM! */
/*uprv_memcpy(el.uchars+(tok->source >> 24), (tok->expansion & 0x00FFFFFF) + src->source, (tok->expansion >> 24)*sizeof(UChar));*/
el.cSize = decompSize; /*(tok->source >> 24); *//* + (tok->expansion >> 24);*/
el.cPoints = el.uchars;
@ -848,7 +848,7 @@ UCATableHeader *ucol_assembleTailoringTable(UColTokenParser *src, UErrorCode *st
UCATableHeader *myData = NULL;
{
UChar decomp[256];
uint32_t noOfDec = 0, i = 0, CE = UCOL_NOT_FOUND;
uint32_t noOfDec = 0, CE = UCOL_NOT_FOUND;
UChar u = 0;
UCAElements el;
el.isThai = FALSE;

View file

@ -251,14 +251,14 @@ uint32_t uprv_cnttab_insertContraction(CntTable *table, uint32_t element, UChar
uprv_growTable(tbl, status);
int32_t offset = 0;
uint32_t offset = 0;
while(tbl->codePoints[offset] < codePoint && offset<tbl->position) {
offset++;
}
int32_t i = tbl->position;
uint32_t i = tbl->position;
for(i = tbl->position; i > offset; i--) {
tbl->CEs[i] = tbl->CEs[i-1];
tbl->codePoints[i] = tbl->codePoints[i-1];
@ -303,7 +303,7 @@ uint32_t uprv_cnttab_addContraction(CntTable *table, uint32_t element, UChar cod
}
/* sets a part of contraction sequence in table. If element is non existant, it creates on. Returns element handle */
uint32_t uprv_cnttab_setContraction(CntTable *table, uint32_t element, int32_t offset, UChar codePoint, uint32_t value, UBool forward, UErrorCode *status) {
uint32_t uprv_cnttab_setContraction(CntTable *table, uint32_t element, uint32_t offset, UChar codePoint, uint32_t value, UBool forward, UErrorCode *status) {
element &= 0xFFFFFF;
ContractionTable *tbl = NULL;
@ -348,7 +348,7 @@ uint32_t uprv_cnttab_findCP(CntTable *table, uint32_t element, UChar codePoint,
tbl = tbl->reversed;
}
int32_t position = 0;
uint32_t position = 0;
while(codePoint > tbl->codePoints[position]) {
position++;
@ -363,7 +363,7 @@ uint32_t uprv_cnttab_findCP(CntTable *table, uint32_t element, UChar codePoint,
}
}
uint32_t uprv_cnttab_getCE(CntTable *table, uint32_t element, int32_t position, UBool forward, UErrorCode *status) {
uint32_t uprv_cnttab_getCE(CntTable *table, uint32_t element, uint32_t position, UBool forward, UErrorCode *status) {
element &= 0xFFFFFF;
ContractionTable *tbl = NULL;
@ -405,7 +405,7 @@ uint32_t uprv_cnttab_changeContraction(CntTable *table, uint32_t element, UChar
tbl = tbl->reversed;
}
int32_t position = 0;
uint32_t position = 0;
while(codePoint > tbl->codePoints[position]) {
position++;

View file

@ -31,9 +31,9 @@ typedef struct ContractionTable ContractionTable;
struct ContractionTable {
UChar *codePoints;
uint32_t *CEs;
int32_t position;
int32_t size;
int32_t backSize;
uint32_t position;
uint32_t size;
uint32_t backSize;
UBool forward;
ContractionTable *reversed;
};
@ -59,7 +59,7 @@ int32_t uprv_cnttab_moveTable(CntTable *table, uint32_t oldOffset, uint32_t newO
/* adds more contractions in table. If element is non existant, it creates on. Returns element handle */
uint32_t uprv_cnttab_addContraction(CntTable *table, uint32_t element, UChar codePoint, uint32_t value, UBool forward, UErrorCode *status);
/* sets a part of contraction sequence in table. If element is non existant, it creates on. Returns element handle */
uint32_t uprv_cnttab_setContraction(CntTable *table, uint32_t element, int32_t offset, UChar codePoint, uint32_t value, UBool forward, UErrorCode *status);
uint32_t uprv_cnttab_setContraction(CntTable *table, uint32_t element, uint32_t offset, UChar codePoint, uint32_t value, UBool forward, UErrorCode *status);
/* inserts a part of contraction sequence in table. Sequences behind the offset are moved back. If element is non existant, it creates on. Returns element handle */
uint32_t uprv_cnttab_insertContraction(CntTable *table, uint32_t element, UChar codePoint, uint32_t value, UBool forward, UErrorCode *status);
/* this is for adding non contractions */
@ -67,7 +67,7 @@ uint32_t uprv_cnttab_changeLastCE(CntTable *table, uint32_t element, uint32_t va
uint32_t uprv_cnttab_findCP(CntTable *table, uint32_t element, UChar codePoint, UBool forward, UErrorCode *status);
uint32_t uprv_cnttab_getCE(CntTable *table, uint32_t element, int32_t position, UBool forward, UErrorCode *status);
uint32_t uprv_cnttab_getCE(CntTable *table, uint32_t element, uint32_t position, UBool forward, UErrorCode *status);
uint32_t uprv_cnttab_changeContraction(CntTable *table, uint32_t element, UChar codePoint, uint32_t newCE, UBool forward, UErrorCode *status);
#endif

View file

@ -26,11 +26,9 @@
#include "ucol_elm.h"
#include "unicode/uchar.h"
void uprv_uca_reverseElement(ExpansionTable *expansions, UCAElements *el) {
int32_t i = 0;
void uprv_uca_reverseElement(UCAElements *el) {
uint32_t i = 0;
UChar temp;
uint32_t tempCE = 0, expansion = 0;
UErrorCode status = U_ZERO_ERROR;
for(i = 0; i<el->cSize/2; i++) {
temp = el->cPoints[i];
@ -40,6 +38,8 @@ void uprv_uca_reverseElement(ExpansionTable *expansions, UCAElements *el) {
#if 0
/* Syn Wee does not need reversed expansions at all */
UErrorCode status = U_ZERO_ERROR;
uint32_t tempCE = 0, expansion = 0;
if(el->noOfCEs>1) { /* this is an expansion that needs to be reversed and added - also, we need to change the mapValue */
uint32_t buffer[256];
#if 0
@ -335,7 +335,7 @@ uint32_t uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode
ExpansionTable *expansions = t->expansions;
CntTable *contractions = t->contractions;
int32_t i = 1;
uint32_t i = 1;
uint32_t expansion = 0;
uint32_t CE;
@ -352,7 +352,6 @@ uint32_t uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode
element->mapCE = expansion;
}
} else {
static int count = 0;
expansion = UCOL_SPECIAL_FLAG | (EXPANSION_TAG<<UCOL_TAG_SHIFT)
| ((uprv_uca_addExpansion(expansions, element->CEs[0], status)+(paddedsize(sizeof(UCATableHeader))>>2))<<4)
& 0xFFFFF0;
@ -378,7 +377,7 @@ uint32_t uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode
CE = ucmp32_get(mapping, element->cPoints[0]);
if(element->cSize > 1) { /* we're adding a contraction */
int32_t i;
uint32_t i;
for (i=1; i<element->cSize; i++) { /* First add contraction chars to unsafe CP hash table */
unsafeCPSet(t->unsafeCP, element->cPoints[i]);
}
@ -395,7 +394,7 @@ uint32_t uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode
ucmp32_set(mapping, element->cPoints[0], result);
}
/* add the reverse order */
uprv_uca_reverseElement(expansions, element);
uprv_uca_reverseElement(element);
CE = ucmp32_get(mapping, element->cPoints[0]);
result = uprv_uca_processContraction(contractions, element, CE, FALSE, status);
if(CE == UCOL_NOT_FOUND || !isContraction(CE)) {

View file

@ -37,13 +37,13 @@ typedef struct {
typedef struct {
UChar uchars[128];
UChar *cPoints;
int32_t cSize; /* Number of characters in sequence - for contraction */
int32_t noOfCEs; /* Number of collation elements */
uint32_t cSize; /* Number of characters in sequence - for contraction */
uint32_t noOfCEs; /* Number of collation elements */
uint32_t CEs[128]; /* These are collation elements - there could be more than one - in case of expansion */
uint32_t mapCE; /* This is the value element maps in original table */
int32_t sizePrim[128];
int32_t sizeSec[128];
int32_t sizeTer[128];
uint32_t sizePrim[128];
uint32_t sizeSec[128];
uint32_t sizeTer[128];
UBool variableTop;
UBool caseBit;
UBool isThai;
@ -73,7 +73,7 @@ U_CAPI UCATableHeader U_EXPORT2 *uprv_uca_assembleTable(tempUCATable *t, UErrorC
uint32_t uprv_uca_processContraction(CntTable *contractions, UCAElements *element, uint32_t existingCE, UBool forward, UErrorCode *status);
int32_t uprv_uca_addExpansion(ExpansionTable *expansions, uint32_t value, UErrorCode *status);
void uprv_uca_reverseElement(ExpansionTable *expansions, UCAElements *el);
void uprv_uca_reverseElement(UCAElements *el);
#define paddedsize(something) ((something)+((((something)%4)!=0)?(4-(something)%4):0))

View file

@ -245,10 +245,9 @@ struct incrementalContext {
(result) = ucmp32_get((coll)->mapping, ch); \
} \
if ((order) >= UCOL_NOT_FOUND) { \
(order) = getSpecialPrevCE((coll), (order), &(data), (length), \
(status)); \
(order) = getSpecialPrevCE((coll), (order), &(data), (status)); \
if ((order) == UCOL_NOT_FOUND) { \
(order) = ucol_getPrevUCA(ch, &(data), (length), (status)); \
(order) = ucol_getPrevUCA(ch, &(data), (status)); \
} \
} \
} \
@ -297,12 +296,10 @@ struct incrementalContext {
uint32_t getSpecialCE(const UCollator *coll, uint32_t CE, collIterate *source, UErrorCode *status);
uint32_t getSpecialPrevCE(const UCollator *coll, uint32_t CE,
collIterate *source, uint32_t length,
UErrorCode *status);
collIterate *source, UErrorCode *status);
U_CFUNC uint32_t ucol_getNextCE(const UCollator *coll, collIterate *collationSource, UErrorCode *status);
uint32_t ucol_getNextUCA(UChar ch, collIterate *collationSource, UErrorCode *status);
uint32_t ucol_getPrevUCA(UChar ch, collIterate *collationSource,
uint32_t length, UErrorCode *status);
uint32_t ucol_getPrevUCA(UChar ch, collIterate *collationSource, UErrorCode *status);
void incctx_cleanUpContext(incrementalContext *ctx);
UChar incctx_appendChar(incrementalContext *ctx, UChar c);

View file

@ -168,7 +168,7 @@ void ucol_uprv_tok_setOptionInImage(UCATableHeader *image, UColAttribute attrib,
#define UTOK_OPTION_COUNT 12
static didInit = FALSE;
static UBool didInit = FALSE;
/* we can be strict, or we can be lenient */
/* I'd surely be lenient with the option arguments */
/* maybe even with options */
@ -236,7 +236,6 @@ ucolTokOption rulesOptions[UTOK_OPTION_COUNT] = {
UBool ucol_uprv_tok_readAndSetOption(UCATableHeader *image, const UChar* start, const UChar *end, UBool *variableTop, UBool *top, UErrorCode *status) {
uint32_t i = 0;
int32_t j=0;
int32_t onOff = 0;
UBool foundOption = FALSE;
const UChar *optionArg = NULL;
if(!didInit) {

View file

@ -116,6 +116,11 @@ typedef struct {
U_CFUNC uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UErrorCode *status);
U_CFUNC void ucol_tok_closeTokenList(UColTokenParser *src);
void deleteToken(void *token);
int32_t ucol_uprv_tok_isOnorOf(const UChar* onoff);
void ucol_uprv_tok_setOptionInImage(UCATableHeader *image, UColAttribute attrib, UColAttributeValue value);
UBool ucol_uprv_tok_readAndSetOption(UCATableHeader *image, const UChar* start, const UChar *end, UBool *variableTop, UBool *top, UErrorCode *status);
int32_t uhash_hashTokens(const void *k);
UBool uhash_compareTokens(const void *key1, const void *key2);
void ucol_tok_initTokenList(UColTokenParser *src, UErrorCode *status);

View file

@ -201,9 +201,9 @@ ucol_previous(UCollationElements *elems,
if ((result) >= UCOL_NOT_FOUND)
{
(result) = getSpecialPrevCE(coll, result, data, length, status);
(result) = getSpecialPrevCE(coll, result, data, status);
if ((result) == UCOL_NOT_FOUND)
(result) = ucol_getPrevUCA(ch, data, length, status);
(result) = ucol_getPrevUCA(ch, data, status);
}
}
}

View file

@ -154,7 +154,9 @@ uint32_t contSize = 0;
#define UCOL_INV_SHIFTVALUE 20
void addNewInverse(UCAElements *element, UErrorCode *status) {
if(U_FAILURE(*status)) {
return;
}
if(VERBOSE && isContinuation(element->CEs[1])) {
fprintf(stdout, "+");
}
@ -177,6 +179,10 @@ void addNewInverse(UCAElements *element, UErrorCode *status) {
void insertInverse(UCAElements *element, uint32_t position, UErrorCode *status) {
uint8_t space[4096];
if(U_FAILURE(*status)) {
return;
}
if(VERBOSE && isContinuation(element->CEs[1])) {
fprintf(stdout, "+");
}
@ -203,6 +209,10 @@ void insertInverse(UCAElements *element, uint32_t position, UErrorCode *status)
void addToExistingInverse(UCAElements *element, uint32_t position, UErrorCode *status) {
if(U_FAILURE(*status)) {
return;
}
if((inverseTable[position][2] & UCOL_INV_SIZEMASK) == 0) { /* single element, have to make new extension place and put both guys there */
stringContinue[sContPos] = (UChar)inverseTable[position][2];
inverseTable[position][2] = ((element->cSize+3) << UCOL_INV_SHIFTVALUE) | sContPos;
@ -425,7 +435,7 @@ UCAElements *readAnElement(FILE *data, UErrorCode *status) {
spacePointer = strchr(buffer, ' ');
if(sscanf(buffer, "%04X", &theValue) != 1) /* read first code point */
{
fprintf(stderr, " scanf(hex) failed on [%s]\n ");
fprintf(stderr, " scanf(hex) failed!\n ");
}
element->cPoints[0] = theValue;
@ -548,7 +558,7 @@ UCAElements *readAnElement(FILE *data, UErrorCode *status) {
*status=U_INVALID_FORMAT_ERROR;
break;
}
*pointer++;
pointer++;
}
/*
@ -609,7 +619,7 @@ write_uca_table(const char *filename,
UErrorCode *status)
{
FILE *data = fopen(filename, "r");
int32_t line = 0;
uint32_t line = 0;
int32_t sizesPrim[35], sizesSec[35], sizesTer[35];
int32_t terValue[0xffff], secValue[0xffff];
int32_t sizeBreakDown[35][35][35];
@ -656,7 +666,7 @@ write_uca_table(const char *filename,
while(!feof(data)) {
if(U_FAILURE(*status)) {
fprintf(stderr, "Something returned an error %i while processing line: %i\nExiting...", status, line);
fprintf(stderr, "Something returned an error %i while processing line: %i\nExiting...", *status, line);
exit(*status);
}
@ -693,8 +703,8 @@ write_uca_table(const char *filename,
/* we're first adding to inverse, because addAnElement will reverse the order */
/* of code points and stuff... we don't want that to happen */
uint32_t invResult = addToInverse(element, status);
uint32_t result = uprv_uca_addAnElement(t, element, status);
addToInverse(element, status);
uprv_uca_addAnElement(t, element, status);
//deleteElement(element);
}
}