diff --git a/contrib/dbase/dbf2pg.c b/contrib/dbase/dbf2pg.c index a635e09122..038c2b5aba 100644 --- a/contrib/dbase/dbf2pg.c +++ b/contrib/dbase/dbf2pg.c @@ -78,7 +78,7 @@ isinteger(char *buff) i++; continue; } - if (!isdigit((int) *i)) + if (!isdigit((unsigned char) *i)) return 0; i++; } @@ -90,7 +90,7 @@ strtoupper(char *string) { while (*string != '\0') { - *string = toupper(*string); + *string = toupper((unsigned char) *string); string++; } } @@ -100,7 +100,7 @@ strtolower(char *string) { while (*string != '\0') { - *string = tolower(*string); + *string = tolower((unsigned char) *string); string++; } } diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.c b/contrib/fuzzystrmatch/fuzzystrmatch.c index 3f863a4fa9..fbb16f66b3 100644 --- a/contrib/fuzzystrmatch/fuzzystrmatch.c +++ b/contrib/fuzzystrmatch/fuzzystrmatch.c @@ -253,17 +253,18 @@ metaphone(PG_FUNCTION_ARGS) * accesssing the array directly... */ /* Look at the next letter in the word */ -#define Next_Letter (toupper(word[w_idx+1])) +#define Next_Letter (toupper((unsigned char) word[w_idx+1])) /* Look at the current letter in the word */ -#define Curr_Letter (toupper(word[w_idx])) +#define Curr_Letter (toupper((unsigned char) word[w_idx])) /* Go N letters back. */ -#define Look_Back_Letter(n) (w_idx >= n ? toupper(word[w_idx-n]) : '\0') +#define Look_Back_Letter(n) \ + (w_idx >= (n) ? toupper((unsigned char) word[w_idx-(n)]) : '\0') /* Previous letter. I dunno, should this return null on failure? */ #define Prev_Letter (Look_Back_Letter(1)) /* Look two letters down. It makes sure you don't walk off the string. */ -#define After_Next_Letter (Next_Letter != '\0' ? toupper(word[w_idx+2]) \ - : '\0') -#define Look_Ahead_Letter(n) (toupper(Lookahead(word+w_idx, n))) +#define After_Next_Letter \ + (Next_Letter != '\0' ? toupper((unsigned char) word[w_idx+2]) : '\0') +#define Look_Ahead_Letter(n) toupper((unsigned char) Lookahead(word+w_idx, n)) /* Allows us to safely look ahead an arbitrary # of letters */ @@ -291,7 +292,7 @@ Lookahead(char *word, int how_far) #define Phone_Len (p_idx) /* Note is a letter is a 'break' in the word */ -#define Isbreak(c) (!isalpha(c)) +#define Isbreak(c) (!isalpha((unsigned char) (c))) int @@ -336,7 +337,7 @@ _metaphone( /*-- The first phoneme has to be processed specially. --*/ /* Find our first letter */ - for (; !isalpha(Curr_Letter); w_idx++) + for (; !isalpha((unsigned char) (Curr_Letter)); w_idx++) { /* On the off chance we were given nothing but crap... */ if (Curr_Letter == '\0') @@ -435,7 +436,7 @@ _metaphone( */ /* Ignore non-alphas */ - if (!isalpha(Curr_Letter)) + if (!isalpha((unsigned char) (Curr_Letter))) continue; /* Drop duplicates, except CC */ diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.h b/contrib/fuzzystrmatch/fuzzystrmatch.h index 23e5e57d92..59e0d9258c 100644 --- a/contrib/fuzzystrmatch/fuzzystrmatch.h +++ b/contrib/fuzzystrmatch/fuzzystrmatch.h @@ -153,7 +153,7 @@ char _codes[26] = { }; -#define ENCODE(c) (isalpha(c) ? _codes[((toupper(c)) - 'A')] : 0) +#define ENCODE(c) (isalpha((unsigned char) (c)) ? _codes[((toupper((unsigned char) (c))) - 'A')] : 0) #define isvowel(c) (ENCODE(c) & 1) /* AEIOU */ diff --git a/contrib/pgcrypto/pgcrypto.c b/contrib/pgcrypto/pgcrypto.c index bf700e3da9..d3dc36dc9a 100644 --- a/contrib/pgcrypto/pgcrypto.c +++ b/contrib/pgcrypto/pgcrypto.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pgcrypto.c,v 1.11 2001/11/20 15:50:53 momjian Exp $ + * $Id: pgcrypto.c,v 1.12 2001/12/30 23:09:41 tgl Exp $ */ #include @@ -556,7 +556,7 @@ find_provider(text *name, p = VARDATA(name); for (i = 0; i < len; i++) - buf[i] = tolower(p[i]); + buf[i] = tolower((unsigned char) p[i]); buf[len] = 0; err = provider_lookup(buf, &res); diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 674eaeb91a..49e93abe99 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.85 2001/12/29 21:28:18 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.86 2001/12/30 23:09:41 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -959,7 +959,7 @@ DecodeDateTime(char **field, int *ftype, int nf, if (tzp == NULL) return -1; - if (isdigit(*field[i]) || ptype != 0) + if (isdigit((unsigned char) *field[i]) || ptype != 0) { char *cp; @@ -1573,7 +1573,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf, /* otherwise, this is a time and/or time zone */ else { - if (isdigit(*field[i])) + if (isdigit((unsigned char) *field[i])) { char *cp; diff --git a/src/interfaces/odbc/connection.c b/src/interfaces/odbc/connection.c index e39501f800..e057d7b73f 100644 --- a/src/interfaces/odbc/connection.c +++ b/src/interfaces/odbc/connection.c @@ -1092,7 +1092,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi) ReadyToReturn = FALSE; empty_reqs = 0; - for (wq = query; isspace(*wq); wq++) + for (wq = query; isspace((unsigned char) *wq); wq++) ; if (*wq == '\0') empty_reqs = 1; diff --git a/src/interfaces/odbc/convert.c b/src/interfaces/odbc/convert.c index 57bf6b70df..0b609a07db 100644 --- a/src/interfaces/odbc/convert.c +++ b/src/interfaces/odbc/convert.c @@ -193,7 +193,7 @@ timestamp2stime(const char *str, SIMPLE_TIME *st, BOOL *bZone, int *zone) } for (i = 1; i < 10; i++) { - if (!isdigit(rest[i])) + if (!isdigit((unsigned char) rest[i])) break; } for (; i < 10; i++) @@ -1351,7 +1351,7 @@ copy_statement_with_parameters(StatementClass *stmt) while (isspace((unsigned char) old_statement[++opos])); } if (strnicmp(&old_statement[opos], "call", lit_call_len) || - !isspace(old_statement[opos + lit_call_len])) + !isspace((unsigned char) old_statement[opos + lit_call_len])) { opos--; continue; @@ -1407,7 +1407,7 @@ copy_statement_with_parameters(StatementClass *stmt) in_dquote = TRUE; else { - if (isspace(oldchar)) + if (isspace((unsigned char) oldchar)) { if (!prev_token_end) {