diff options
| author | Tom Lane | 2005-09-24 19:14:05 +0000 |
|---|---|---|
| committer | Tom Lane | 2005-09-24 19:14:05 +0000 |
| commit | 8a65b820e2ef00d26050ac0d04962abaa91ab7b5 (patch) | |
| tree | 46b7012c99a03f276d3f75a44b534cd33ff11213 /contrib/tsearch2 | |
| parent | 8889685555e0ae7d5396038be9924ced2d330bd3 (diff) | |
Suppress signed-vs-unsigned-char warnings in contrib.
Diffstat (limited to 'contrib/tsearch2')
| -rw-r--r-- | contrib/tsearch2/dict_snowball.c | 2 | ||||
| -rw-r--r-- | contrib/tsearch2/gistidx.c | 2 | ||||
| -rw-r--r-- | contrib/tsearch2/ispell/spell.c | 67 | ||||
| -rw-r--r-- | contrib/tsearch2/query.c | 2 |
4 files changed, 39 insertions, 34 deletions
diff --git a/contrib/tsearch2/dict_snowball.c b/contrib/tsearch2/dict_snowball.c index 8bcd3385d8f..5a83fb45d3a 100644 --- a/contrib/tsearch2/dict_snowball.c +++ b/contrib/tsearch2/dict_snowball.c @@ -111,7 +111,7 @@ snb_lexize(PG_FUNCTION_ARGS) } else { - SN_set_current(d->z, strlen(txt), txt); + SN_set_current(d->z, strlen(txt), (symbol *) txt); (d->stem) (d->z); if (d->z->p && d->z->l) { diff --git a/contrib/tsearch2/gistidx.c b/contrib/tsearch2/gistidx.c index d8a7210591d..653a4765363 100644 --- a/contrib/tsearch2/gistidx.c +++ b/contrib/tsearch2/gistidx.c @@ -156,7 +156,7 @@ gtsvector_compress(PG_FUNCTION_ARGS) len = val->size; while (len--) { - *arr = crc32_sz((uint8 *) &words[ptr->pos], ptr->len); + *arr = crc32_sz(&words[ptr->pos], ptr->len); arr++; ptr++; } diff --git a/contrib/tsearch2/ispell/spell.c b/contrib/tsearch2/ispell/spell.c index 54d0410af33..872e7f972b2 100644 --- a/contrib/tsearch2/ispell/spell.c +++ b/contrib/tsearch2/ispell/spell.c @@ -52,12 +52,12 @@ strnduplicate(char *s, int len) return d; } -/* backward string compaire for suffix tree operations */ +/* backward string compare for suffix tree operations */ static int strbcmp(const unsigned char *s1, const unsigned char *s2) { - int l1 = strlen(s1) - 1, - l2 = strlen(s2) - 1; + int l1 = strlen((const char *) s1) - 1, + l2 = strlen((const char *) s2) - 1; while (l1 >= 0 && l2 >= 0) { @@ -78,8 +78,8 @@ strbcmp(const unsigned char *s1, const unsigned char *s2) static int strbncmp(const unsigned char *s1, const unsigned char *s2, size_t count) { - int l1 = strlen(s1) - 1, - l2 = strlen(s2) - 1, + int l1 = strlen((const char *) s1) - 1, + l2 = strlen((const char *) s2) - 1, l = count; while (l1 >= 0 && l2 >= 0 && l > 0) @@ -104,14 +104,18 @@ strbncmp(const unsigned char *s1, const unsigned char *s2, size_t count) static int cmpaffix(const void *s1, const void *s2) { - if (((const AFFIX *) s1)->type < ((const AFFIX *) s2)->type) + const AFFIX *a1 = (const AFFIX *) s1; + const AFFIX *a2 = (const AFFIX *) s2; + + if (a1->type < a2->type) return -1; - if (((const AFFIX *) s1)->type > ((const AFFIX *) s2)->type) + if (a1->type > a2->type) return 1; - if (((const AFFIX *) s1)->type == FF_PREFIX) - return (strcmp(((const AFFIX *) s1)->repl, ((const AFFIX *) s2)->repl)); + if (a1->type == FF_PREFIX) + return strcmp(a1->repl, a2->repl); else - return (strbcmp(((const AFFIX *) s1)->repl, ((const AFFIX *) s2)->repl)); + return strbcmp((const unsigned char *) a1->repl, + (const unsigned char *) a2->repl); } int @@ -142,29 +146,29 @@ NIAddSpell(IspellDict * Conf, const char *word, const char *flag) int NIImportDictionary(IspellDict * Conf, const char *filename) { - unsigned char str[BUFSIZ]; + char str[BUFSIZ]; FILE *dict; if (!(dict = fopen(filename, "r"))) return (1); while (fgets(str, sizeof(str), dict)) { - unsigned char *s; - const unsigned char *flag; + char *s; + const char *flag; flag = NULL; if ((s = strchr(str, '/'))) { - *s = 0; - s++; + *s++ = '\0'; flag = s; while (*s) { - if (isprint(*s) && !isspace(*s)) + if (isprint((unsigned char) *s) && + !isspace((unsigned char) *s)) s++; else { - *s = 0; + *s = '\0'; break; } } @@ -177,10 +181,8 @@ NIImportDictionary(IspellDict * Conf, const char *filename) s = str; while (*s) { - if (*s == '\r') - *s = 0; - if (*s == '\n') - *s = 0; + if (*s == '\r' || *s == '\n') + *s = '\0'; s++; } NIAddSpell(Conf, str, flag); @@ -311,16 +313,16 @@ remove_spaces(char *dist, char *src) int NIImportAffixes(IspellDict * Conf, const char *filename) { - unsigned char str[BUFSIZ]; - unsigned char flag = 0; - unsigned char mask[BUFSIZ] = ""; - unsigned char find[BUFSIZ] = ""; - unsigned char repl[BUFSIZ] = ""; - unsigned char *s; + char str[BUFSIZ]; + char mask[BUFSIZ]; + char find[BUFSIZ]; + char repl[BUFSIZ]; + char *s; int i; int suffixes = 0; int prefixes = 0; - unsigned char flagflags = 0; + int flag = 0; + char flagflags = 0; FILE *affix; if (!(affix = fopen(filename, "r"))) @@ -374,7 +376,7 @@ NIImportAffixes(IspellDict * Conf, const char *filename) if (*s == '\\') s++; - flag = *s; + flag = (unsigned char) *s; continue; } if ((!suffixes) && (!prefixes)) @@ -409,7 +411,7 @@ NIImportAffixes(IspellDict * Conf, const char *filename) continue; } - NIAddAffix(Conf, (int) flag, (char) flagflags, mask, find, repl, suffixes ? FF_SUFFIX : FF_PREFIX); + NIAddAffix(Conf, flag, flagflags, mask, find, repl, suffixes ? FF_SUFFIX : FF_PREFIX); } fclose(affix); @@ -681,7 +683,10 @@ NISortAffixes(IspellDict * Conf) firstsuffix = i; if (Affix->flagflags & FF_COMPOUNDONLYAFX) { - if (!ptr->affix || strbncmp((ptr - 1)->affix, Affix->repl, (ptr - 1)->len)) + if (!ptr->affix || + strbncmp((const unsigned char *) (ptr - 1)->affix, + (const unsigned char *) Affix->repl, + (ptr - 1)->len)) { /* leave only unique and minimals suffixes */ ptr->affix = Affix->repl; diff --git a/contrib/tsearch2/query.c b/contrib/tsearch2/query.c index eb45ba078e1..db45de56be1 100644 --- a/contrib/tsearch2/query.c +++ b/contrib/tsearch2/query.c @@ -238,7 +238,7 @@ pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval, int2 weight (errcode(ERRCODE_SYNTAX_ERROR), errmsg("word is too long"))); - pushquery(state, type, crc32_sz((uint8 *) strval, lenval), + pushquery(state, type, crc32_sz(strval, lenval), state->curop - state->op, lenval, weight); while (state->curop - state->op + lenval + 1 >= state->lenop) |
