Commit a27b691e authored by Tom Lane's avatar Tom Lane

Ensure that all uses of <ctype.h> functions are applied to unsigned-char

values, whether the local char type is signed or not.  This is necessary
for portability.  Per discussion on pghackers around 9/16/00.
parent 4d2a5065
#include "postgres.h" #include "postgres.h"
#include "executor/spi.h" #include "executor/spi.h"
#include "commands/trigger.h" #include "commands/trigger.h"
#include <ctype.h> /* tolower */ #include <ctype.h>
#include <stdio.h> /* debugging */ #include <stdio.h> /* debugging */
/* /*
...@@ -256,10 +256,9 @@ fti(PG_FUNCTION_ARGS) ...@@ -256,10 +256,9 @@ fti(PG_FUNCTION_ARGS)
char *string = column; char *string = column;
while (*string != '\0') while (*string != '\0')
{ /* placed 'really' inline. */ {
*string = tolower(*string); /* some compilers will *string = tolower((unsigned char) *string);
* choke */ string++;
string++; /* on 'inline' keyword */
} }
data = (struct varlena *) palloc(sizeof(int32) + strlen(column) +1); data = (struct varlena *) palloc(sizeof(int32) + strlen(column) +1);
...@@ -312,9 +311,9 @@ breakup(char *string, char *substring) ...@@ -312,9 +311,9 @@ breakup(char *string, char *substring)
* (ie. 'string$%^&', last_start first points to '&', and after * (ie. 'string$%^&', last_start first points to '&', and after
* this to 'g' * this to 'g'
*/ */
if (!isalnum((int) *last_start)) if (!isalnum((unsigned char) *last_start))
{ {
while (!isalnum((int) *last_start) && while (!isalnum((unsigned char) *last_start) &&
last_start > string) last_start > string)
last_start--; last_start--;
cur_pos = last_start; cur_pos = last_start;
...@@ -323,7 +322,7 @@ breakup(char *string, char *substring) ...@@ -323,7 +322,7 @@ breakup(char *string, char *substring)
cur_pos--; /* substrings are at minimum 2 characters cur_pos--; /* substrings are at minimum 2 characters
* long */ * long */
if (isalnum((int) *cur_pos)) if (isalnum((unsigned char) *cur_pos))
{ {
/* Houston, we have a substring! :) */ /* Houston, we have a substring! :) */
memcpy(substring, cur_pos, last_start - cur_pos + 1); memcpy(substring, cur_pos, last_start - cur_pos + 1);
......
/* $Header: /cvsroot/pgsql/contrib/soundex/Attic/soundex.c,v 1.8 2000/11/20 20:36:57 tgl Exp $ */ /* $Header: /cvsroot/pgsql/contrib/soundex/Attic/soundex.c,v 1.9 2000/12/03 20:45:31 tgl Exp $ */
#include "postgres.h" #include "postgres.h"
#include "fmgr.h" #include "fmgr.h"
#include "utils/builtins.h" #include "utils/builtins.h"
...@@ -42,7 +42,7 @@ text_soundex(PG_FUNCTION_ARGS) ...@@ -42,7 +42,7 @@ text_soundex(PG_FUNCTION_ARGS)
/* ABCDEFGHIJKLMNOPQRSTUVWXYZ */ /* ABCDEFGHIJKLMNOPQRSTUVWXYZ */
static const char *soundex_table = "01230120022455012623010202"; static const char *soundex_table = "01230120022455012623010202";
#define soundex_code(letter) soundex_table[toupper(letter) - 'A'] #define soundex_code(letter) soundex_table[toupper((unsigned char) (letter)) - 'A']
static void static void
...@@ -56,7 +56,7 @@ soundex(const char *instr, char *outstr) ...@@ -56,7 +56,7 @@ soundex(const char *instr, char *outstr)
outstr[SOUNDEX_LEN] = '\0'; outstr[SOUNDEX_LEN] = '\0';
/* Skip leading non-alphabetic characters */ /* Skip leading non-alphabetic characters */
while (!isalpha(instr[0]) && instr[0]) while (!isalpha((unsigned char) instr[0]) && instr[0])
++instr; ++instr;
/* No string left */ /* No string left */
...@@ -67,12 +67,13 @@ soundex(const char *instr, char *outstr) ...@@ -67,12 +67,13 @@ soundex(const char *instr, char *outstr)
} }
/* Take the first letter as is */ /* Take the first letter as is */
*outstr++ = (char) toupper(*instr++); *outstr++ = (char) toupper((unsigned char) *instr++);
count = 1; count = 1;
while (*instr && count < SOUNDEX_LEN) while (*instr && count < SOUNDEX_LEN)
{ {
if (isalpha(*instr) && soundex_code(*instr) != soundex_code(*(instr - 1))) if (isalpha((unsigned char) *instr) &&
soundex_code(*instr) != soundex_code(*(instr - 1)))
{ {
*outstr = soundex_code(instr[0]); *outstr = soundex_code(instr[0]);
if (*outstr != '0') if (*outstr != '0')
......
...@@ -6,7 +6,7 @@ strtoupper(char *string) ...@@ -6,7 +6,7 @@ strtoupper(char *string)
int i; int i;
for (i = 0; i < strlen(string); i++) for (i = 0; i < strlen(string); i++)
string[i] = toupper(string[i]); string[i] = toupper((unsigned char) string[i]);
return string; return string;
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "executor/spi.h" /* this is what you need to work with SPI */ #include "executor/spi.h" /* this is what you need to work with SPI */
#include "commands/trigger.h" /* -"- and triggers */ #include "commands/trigger.h" /* -"- and triggers */
#include <ctype.h> /* tolower () */ #include <ctype.h>
extern Datum check_primary_key(PG_FUNCTION_ARGS); extern Datum check_primary_key(PG_FUNCTION_ARGS);
...@@ -293,7 +293,7 @@ check_foreign_key(PG_FUNCTION_ARGS) ...@@ -293,7 +293,7 @@ check_foreign_key(PG_FUNCTION_ARGS)
nrefs = pg_atoi(args[0], sizeof(int), 0); nrefs = pg_atoi(args[0], sizeof(int), 0);
if (nrefs < 1) if (nrefs < 1)
elog(ERROR, "check_foreign_key: %d (< 1) number of references specified", nrefs); elog(ERROR, "check_foreign_key: %d (< 1) number of references specified", nrefs);
action = tolower(*(args[1])); action = tolower((unsigned char) *(args[1]));
if (action != 'r' && action != 'c' && action != 's') if (action != 'r' && action != 'c' && action != 's')
elog(ERROR, "check_foreign_key: invalid action %s", args[1]); elog(ERROR, "check_foreign_key: invalid action %s", args[1]);
nargs -= 2; nargs -= 2;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "executor/spi.h" /* this is what you need to work with SPI */ #include "executor/spi.h" /* this is what you need to work with SPI */
#include "commands/trigger.h" /* -"- and triggers */ #include "commands/trigger.h" /* -"- and triggers */
#include <ctype.h> /* tolower () */ #include <ctype.h>
#define ABSTIMEOID 702 /* it should be in pg_type.h */ #define ABSTIMEOID 702 /* it should be in pg_type.h */
...@@ -376,7 +376,7 @@ set_timetravel(PG_FUNCTION_ARGS) ...@@ -376,7 +376,7 @@ set_timetravel(PG_FUNCTION_ARGS)
NameGetDatum(relname))); NameGetDatum(relname)));
d = TTOff[nTTOff] = malloc(strlen(rname) + 1); d = TTOff[nTTOff] = malloc(strlen(rname) + 1);
while (*s) while (*s)
*d++ = tolower(*s++); *d++ = tolower((unsigned char) *s++);
*d = 0; *d = 0;
pfree(rname); pfree(rname);
nTTOff++; nTTOff++;
......
...@@ -28,9 +28,10 @@ ...@@ -28,9 +28,10 @@
#define DIGIT(val) ((val) + '0') #define DIGIT(val) ((val) + '0')
#define ISOCTAL(c) (((c) >= '0') && ((c) <= '7')) #define ISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
#ifndef ISO8859 #ifndef ISO8859
#define NOTPRINTABLE(c) (!isprint(c)) #define NOTPRINTABLE(c) (!isprint((unsigned char) (c)))
#else #else
#define NOTPRINTABLE(c) (!isprint(c) && ((c) < 0xa0)) #define NOTPRINTABLE(c) (!isprint((unsigned char) (c)) && \
((unsigned char) (c) < (unsigned char) 0xa0))
#endif #endif
/* /*
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.49 2000/11/20 20:36:47 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.50 2000/12/03 20:45:33 tgl Exp $
* *
* DESCRIPTION * DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the * The "DefineFoo" routines take the parse tree and pick out the
...@@ -71,7 +71,7 @@ case_translate_language_name(const char *input, char *output) ...@@ -71,7 +71,7 @@ case_translate_language_name(const char *input, char *output)
int i; int i;
for (i = 0; i < NAMEDATALEN-1 && input[i]; ++i) for (i = 0; i < NAMEDATALEN-1 && input[i]; ++i)
output[i] = tolower(input[i]); output[i] = tolower((unsigned char) input[i]);
output[i] = '\0'; output[i] = '\0';
......
...@@ -31,7 +31,7 @@ case_translate_language_name(const char *input, char *output) ...@@ -31,7 +31,7 @@ case_translate_language_name(const char *input, char *output)
int i; int i;
for (i = 0; i < NAMEDATALEN && input[i]; ++i) for (i = 0; i < NAMEDATALEN && input[i]; ++i)
output[i] = tolower(input[i]); output[i] = tolower((unsigned char) input[i]);
output[i] = '\0'; output[i] = '\0';
......
...@@ -473,9 +473,8 @@ get_seq_name(text *seqin) ...@@ -473,9 +473,8 @@ get_seq_name(text *seqin)
*/ */
for (; *rawname; rawname++) for (; *rawname; rawname++)
{ {
if (isascii((int) *rawname) && if (isupper((unsigned char) *rawname))
isupper((int) *rawname)) *rawname = tolower((unsigned char) *rawname);
*rawname = tolower(*rawname);
} }
} }
return seqname; return seqname;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.43 2000/10/26 17:31:34 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.44 2000/12/03 20:45:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -104,7 +104,7 @@ get_token(char **tok, char **val, char *str) ...@@ -104,7 +104,7 @@ get_token(char **tok, char **val, char *str)
return NULL; return NULL;
/* skip leading white space */ /* skip leading white space */
while (isspace((int) *str)) while (isspace((unsigned char) *str))
str++; str++;
/* end of string? then return NULL */ /* end of string? then return NULL */
...@@ -118,7 +118,8 @@ get_token(char **tok, char **val, char *str) ...@@ -118,7 +118,8 @@ get_token(char **tok, char **val, char *str)
*tok = str; *tok = str;
/* Advance to end of word */ /* Advance to end of word */
while (*str && !isspace((int) *str) && *str != ',' && *str != '=') while (*str && !isspace((unsigned char) *str) &&
*str != ',' && *str != '=')
str++; str++;
/* Terminate word string for caller */ /* Terminate word string for caller */
...@@ -126,7 +127,7 @@ get_token(char **tok, char **val, char *str) ...@@ -126,7 +127,7 @@ get_token(char **tok, char **val, char *str)
*str = '\0'; *str = '\0';
/* Skip any whitespace */ /* Skip any whitespace */
while (isspace((int) ch)) while (isspace((unsigned char) ch))
ch = *(++str); ch = *(++str);
/* end of string? */ /* end of string? */
...@@ -144,7 +145,7 @@ get_token(char **tok, char **val, char *str) ...@@ -144,7 +145,7 @@ get_token(char **tok, char **val, char *str)
str++; str++;
/* skip whitespace after '=' */ /* skip whitespace after '=' */
while (isspace((int) *str)) while (isspace((unsigned char) *str))
str++; str++;
if (*str == ',' || *str == '\0') if (*str == ',' || *str == '\0')
...@@ -154,7 +155,7 @@ get_token(char **tok, char **val, char *str) ...@@ -154,7 +155,7 @@ get_token(char **tok, char **val, char *str)
*val = str; *val = str;
/* Advance to end of word */ /* Advance to end of word */
while (*str && !isspace((int) *str) && *str != ',') while (*str && !isspace((unsigned char) *str) && *str != ',')
str++; str++;
/* Terminate word string for caller */ /* Terminate word string for caller */
...@@ -162,7 +163,7 @@ get_token(char **tok, char **val, char *str) ...@@ -162,7 +163,7 @@ get_token(char **tok, char **val, char *str)
*str = '\0'; *str = '\0';
/* Skip any whitespace */ /* Skip any whitespace */
while (isspace((int) ch)) while (isspace((unsigned char) ch))
ch = *(++str); ch = *(++str);
/* end of string? */ /* end of string? */
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.49 2000/08/25 10:00:30 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.50 2000/12/03 20:45:33 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <netdb.h> /* for MAXHOSTNAMELEN on some */ #include <netdb.h> /* for MAXHOSTNAMELEN on some */
#endif #endif
#include <pwd.h> #include <pwd.h>
#include <ctype.h> /* isspace() declaration */ #include <ctype.h>
#include <sys/types.h> /* needed by in.h on Ultrix */ #include <sys/types.h> /* needed by in.h on Ultrix */
#include <netinet/in.h> #include <netinet/in.h>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.134 2000/11/16 22:30:23 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.135 2000/12/03 20:45:33 tgl Exp $
* *
* NOTES * NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which * Every (plan) node in POSTGRES has an associated "out" routine which
...@@ -70,8 +70,8 @@ _outToken(StringInfo str, char *s) ...@@ -70,8 +70,8 @@ _outToken(StringInfo str, char *s)
if (*s == '<' || if (*s == '<' ||
*s == '\"' || *s == '\"' ||
*s == '@' || *s == '@' ||
isdigit((int) *s) || isdigit((unsigned char) *s) ||
(*s == '-' && isdigit((int) s[1]))) (*s == '-' && isdigit((unsigned char) s[1])))
appendStringInfoChar(str, '\\'); appendStringInfoChar(str, '\\');
while (*s) while (*s)
{ {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.25 2000/10/31 13:59:52 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.26 2000/12/03 20:45:33 tgl Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -205,8 +205,8 @@ nodeTokenType(char *token, int length) ...@@ -205,8 +205,8 @@ nodeTokenType(char *token, int length)
numlen = length; numlen = length;
if (*numptr == '+' || *numptr == '-') if (*numptr == '+' || *numptr == '-')
numptr++, numlen--; numptr++, numlen--;
if ((numlen > 0 && isdigit((int) *numptr)) || if ((numlen > 0 && isdigit((unsigned char) *numptr)) ||
(numlen > 1 && *numptr == '.' && isdigit((int) numptr[1]))) (numlen > 1 && *numptr == '.' && isdigit((unsigned char) numptr[1])))
{ {
/* /*
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.49 2000/11/16 22:30:28 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.50 2000/12/03 20:45:34 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -533,7 +533,7 @@ fitsInFloat(Value *value) ...@@ -533,7 +533,7 @@ fitsInFloat(Value *value)
ndigits = 0; ndigits = 0;
for (; *ptr; ptr++) for (; *ptr; ptr++)
{ {
if (isdigit((int) *ptr)) if (isdigit((unsigned char) *ptr))
ndigits++; ndigits++;
else if (*ptr == 'e' || *ptr == 'E') else if (*ptr == 'e' || *ptr == 'E')
break; /* don't count digits in exponent */ break; /* don't count digits in exponent */
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.83 2000/11/16 22:47:44 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.84 2000/12/03 20:45:34 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -478,9 +478,8 @@ other . ...@@ -478,9 +478,8 @@ other .
ScanKeyword *keyword; ScanKeyword *keyword;
for(i = 0; yytext[i]; i++) for(i = 0; yytext[i]; i++)
if (isascii((int) yytext[i]) && if (isupper((unsigned char) yytext[i]))
isupper((int) yytext[i])) yytext[i] = tolower((unsigned char) yytext[i]);
yytext[i] = tolower(yytext[i]);
if (i >= NAMEDATALEN) if (i >= NAMEDATALEN)
{ {
#ifdef MULTIBYTE #ifdef MULTIBYTE
......
/* $Id: inet_aton.c,v 1.17 1999/07/17 04:12:09 momjian Exp $ /* $Id: inet_aton.c,v 1.18 2000/12/03 20:45:34 tgl Exp $
* *
* This inet_aton() function was taken from the GNU C library and * This inet_aton() function was taken from the GNU C library and
* incorporated into Postgres for those systems which do not have this * incorporated into Postgres for those systems which do not have this
...@@ -83,16 +83,16 @@ inet_aton(const char *cp, struct in_addr * addr) ...@@ -83,16 +83,16 @@ inet_aton(const char *cp, struct in_addr * addr)
} }
while ((c = *cp) != '\0') while ((c = *cp) != '\0')
{ {
if (isascii(c) && isdigit(c)) if (isdigit((unsigned char) c))
{ {
val = (val * base) + (c - '0'); val = (val * base) + (c - '0');
cp++; cp++;
continue; continue;
} }
if (base == 16 && isascii(c) && isxdigit(c)) if (base == 16 && isxdigit((unsigned char) c))
{ {
val = (val << 4) + val = (val << 4) +
(c + 10 - (islower(c) ? 'a' : 'A')); (c + 10 - (islower((unsigned char) c) ? 'a' : 'A'));
cp++; cp++;
continue; continue;
} }
...@@ -114,10 +114,11 @@ inet_aton(const char *cp, struct in_addr * addr) ...@@ -114,10 +114,11 @@ inet_aton(const char *cp, struct in_addr * addr)
} }
/* /*
* Check for trailing characters. * Check for trailing junk.
*/ */
if (*cp && (!isascii(*cp) || !isspace(*cp))) while (*cp)
return 0; if (!isspace((unsigned char) *cp++))
return 0;
/* /*
* Concoct the address according to the number of parts specified. * Concoct the address according to the number of parts specified.
......
...@@ -74,7 +74,7 @@ typedef unsigned long ulong_long; ...@@ -74,7 +74,7 @@ typedef unsigned long ulong_long;
* causing nast effects. * causing nast effects.
**************************************************************/ **************************************************************/
/*static char _id[] = "$Id: snprintf.c,v 1.27 1999/09/09 03:13:22 tgl Exp $";*/ /*static char _id[] = "$Id: snprintf.c,v 1.28 2000/12/03 20:45:34 tgl Exp $";*/
static char *end; static char *end;
static int SnprfOverflow; static int SnprfOverflow;
...@@ -457,7 +457,7 @@ static void ...@@ -457,7 +457,7 @@ static void
dopr_outch(int c) dopr_outch(int c)
{ {
#ifdef NOT_USED #ifdef NOT_USED
if (iscntrl(c) && c != '\n' && c != '\t') if (iscntrl((unsigned char) c) && c != '\n' && c != '\t')
{ {
c = '@' + (c & 0x1F); c = '@' + (c & 0x1F);
if (end == 0 || output < end) if (end == 0 || output < end)
......
...@@ -58,7 +58,7 @@ int base; ...@@ -58,7 +58,7 @@ int base;
{ {
const char *s = nptr; const char *s = nptr;
unsigned long acc; unsigned long acc;
int c; unsigned char c;
unsigned long cutoff; unsigned long cutoff;
int neg = 0, int neg = 0,
any, any,
...@@ -109,7 +109,7 @@ int base; ...@@ -109,7 +109,7 @@ int base;
cutoff = neg ? -(unsigned long) LONG_MIN : LONG_MAX; cutoff = neg ? -(unsigned long) LONG_MIN : LONG_MAX;
cutlim = cutoff % (unsigned long) base; cutlim = cutoff % (unsigned long) base;
cutoff /= (unsigned long) base; cutoff /= (unsigned long) base;
for (acc = 0, any = 0;; c = *s++) for (acc = 0, any = 0; ; c = *s++)
{ {
if (isdigit(c)) if (isdigit(c))
c -= '0'; c -= '0';
...@@ -117,9 +117,9 @@ int base; ...@@ -117,9 +117,9 @@ int base;
c -= isupper(c) ? 'A' - 10 : 'a' - 10; c -= isupper(c) ? 'A' - 10 : 'a' - 10;
else else
break; break;
if (c >= base) if ((int) c >= base)
break; break;
if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) if (any < 0 || acc > cutoff || acc == cutoff && (int) c > cutlim)
any = -1; any = -1;
else else
{ {
......
...@@ -96,9 +96,9 @@ register int base; ...@@ -96,9 +96,9 @@ register int base;
c -= isupper(c) ? 'A' - 10 : 'a' - 10; c -= isupper(c) ? 'A' - 10 : 'a' - 10;
else else
break; break;
if (c >= base) if ((int) c >= base)
break; break;
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) if (any < 0 || acc > cutoff || (acc == cutoff && (int) c > cutlim))
any = -1; any = -1;
else else
{ {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.197 2000/11/30 23:20:51 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.198 2000/12/03 20:45:34 tgl Exp $
* *
* NOTES * NOTES
* *
...@@ -1807,12 +1807,12 @@ split_opts(char **argv, int *argcp, char *s) ...@@ -1807,12 +1807,12 @@ split_opts(char **argv, int *argcp, char *s)
{ {
while (s && *s) while (s && *s)
{ {
while (isspace((int) *s)) while (isspace((unsigned char) *s))
++s; ++s;
if (*s == '\0') if (*s == '\0')
break; break;
argv[(*argcp)++] = s; argv[(*argcp)++] = s;
while (*s && !isspace((int) *s)) while (*s && !isspace((unsigned char) *s))
++s; ++s;
if (*s) if (*s)
*s++ = '\0'; *s++ = '\0';
......
...@@ -1158,9 +1158,9 @@ static int ...@@ -1158,9 +1158,9 @@ static int
pg_isprint(int c) pg_isprint(int c)
{ {
#ifdef MULTIBYTE #ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && isprint(c)); return (c >= 0 && c <= UCHAR_MAX && isprint((unsigned char) c));
#else #else
return (isprint(c)); return (isprint((unsigned char) c));
#endif #endif
} }
......
...@@ -1049,15 +1049,15 @@ int ch; ...@@ -1049,15 +1049,15 @@ int ch;
assert(pg_isalpha(ch)); assert(pg_isalpha(ch));
if (pg_isupper(ch)) if (pg_isupper(ch))
#ifdef MULTIBYTE #ifdef MULTIBYTE
return (unsigned char) tolower(ch); return (unsigned char) tolower((unsigned char) ch);
#else #else
return tolower(ch); return tolower((unsigned char) ch);
#endif #endif
else if (pg_islower(ch)) else if (pg_islower(ch))
#ifdef MULTIBYTE #ifdef MULTIBYTE
return (unsigned char) toupper(ch); return (unsigned char) toupper((unsigned char) ch);
#else #else
return toupper(ch); return toupper((unsigned char) ch);
#endif #endif
else else
/* peculiar, but could happen */ /* peculiar, but could happen */
...@@ -1882,9 +1882,9 @@ static int ...@@ -1882,9 +1882,9 @@ static int
pg_isdigit(int c) pg_isdigit(int c)
{ {
#ifdef MULTIBYTE #ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && isdigit(c)); return (c >= 0 && c <= UCHAR_MAX && isdigit((unsigned char) c));
#else #else
return (isdigit(c)); return (isdigit((unsigned char) c));
#endif #endif
} }
...@@ -1892,9 +1892,9 @@ static int ...@@ -1892,9 +1892,9 @@ static int
pg_isalpha(int c) pg_isalpha(int c)
{ {
#ifdef MULTIBYTE #ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && isalpha(c)); return (c >= 0 && c <= UCHAR_MAX && isalpha((unsigned char) c));
#else #else
return (isalpha(c)); return (isalpha((unsigned char) c));
#endif #endif
} }
...@@ -1902,9 +1902,9 @@ static int ...@@ -1902,9 +1902,9 @@ static int
pg_isupper(int c) pg_isupper(int c)
{ {
#ifdef MULTIBYTE #ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && isupper(c)); return (c >= 0 && c <= UCHAR_MAX && isupper((unsigned char) c));
#else #else
return (isupper(c)); return (isupper((unsigned char) c));
#endif #endif
} }
...@@ -1912,8 +1912,8 @@ static int ...@@ -1912,8 +1912,8 @@ static int
pg_islower(int c) pg_islower(int c)
{ {
#ifdef MULTIBYTE #ifdef MULTIBYTE
return (c >= 0 && c <= UCHAR_MAX && islower(c)); return (c >= 0 && c <= UCHAR_MAX && islower((unsigned char) c));
#else #else
return (islower(c)); return (islower((unsigned char) c));
#endif #endif
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.54 2000/11/28 23:42:31 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.55 2000/12/03 20:45:35 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -57,7 +57,7 @@ getid(char *s, char *n) ...@@ -57,7 +57,7 @@ getid(char *s, char *n)
Assert(s && n); Assert(s && n);
while (isspace((int) *s)) while (isspace((unsigned char) *s))
++s; ++s;
if (*s == '"') if (*s == '"')
...@@ -66,7 +66,9 @@ getid(char *s, char *n) ...@@ -66,7 +66,9 @@ getid(char *s, char *n)
s++; s++;
} }
for (id = s, len = 0; isalnum((int) *s) || *s == '_' || in_quotes; ++len, ++s) for (id = s, len = 0;
isalnum((unsigned char) *s) || *s == '_' || in_quotes;
++len, ++s)
{ {
if (in_quotes && *s == '"') if (in_quotes && *s == '"')
{ {
...@@ -80,7 +82,7 @@ getid(char *s, char *n) ...@@ -80,7 +82,7 @@ getid(char *s, char *n)
if (len > 0) if (len > 0)
memmove(n, id, len); memmove(n, id, len);
n[len] = '\0'; n[len] = '\0';
while (isspace((int) *s)) while (isspace((unsigned char) *s))
++s; ++s;
return s; return s;
} }
...@@ -149,7 +151,7 @@ aclparse(char *s, AclItem *aip, unsigned *modechg) ...@@ -149,7 +151,7 @@ aclparse(char *s, AclItem *aip, unsigned *modechg)
} }
aip->ai_mode = ACL_NO; aip->ai_mode = ACL_NO;
while (isalpha((int) *++s)) while (isalpha((unsigned char) *++s))
{ {
switch (*s) switch (*s)
{ {
...@@ -242,7 +244,7 @@ aclitemin(PG_FUNCTION_ARGS) ...@@ -242,7 +244,7 @@ aclitemin(PG_FUNCTION_ARGS)
s = aclparse(s, aip, &modechg); s = aclparse(s, aip, &modechg);
if (modechg != ACL_MODECHG_EQL) if (modechg != ACL_MODECHG_EQL)
elog(ERROR, "aclitemin: cannot accept anything but = ACLs"); elog(ERROR, "aclitemin: cannot accept anything but = ACLs");
while (isspace((int) *s)) while (isspace((unsigned char) *s))
++s; ++s;
if (*s) if (*s)
elog(ERROR, "aclitemin: extra garbage at end of specification"); elog(ERROR, "aclitemin: extra garbage at end of specification");
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.66 2000/11/16 22:30:31 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.67 2000/12/03 20:45:35 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -146,14 +146,14 @@ array_in(PG_FUNCTION_ARGS) ...@@ -146,14 +146,14 @@ array_in(PG_FUNCTION_ARGS)
* Note: we currently allow whitespace between, but not within, * Note: we currently allow whitespace between, but not within,
* dimension items. * dimension items.
*/ */
while (isspace((int) *p)) while (isspace((unsigned char) *p))
p++; p++;
if (*p != '[') if (*p != '[')
break; /* no more dimension items */ break; /* no more dimension items */
p++; p++;
if (ndim >= MAXDIM) if (ndim >= MAXDIM)
elog(ERROR, "array_in: more than %d dimensions", MAXDIM); elog(ERROR, "array_in: more than %d dimensions", MAXDIM);
for (q = p; isdigit((int) *q); q++); for (q = p; isdigit((unsigned char) *q); q++);
if (q == p) /* no digits? */ if (q == p) /* no digits? */
elog(ERROR, "array_in: missing dimension value"); elog(ERROR, "array_in: missing dimension value");
if (*q == ':') if (*q == ':')
...@@ -162,7 +162,7 @@ array_in(PG_FUNCTION_ARGS) ...@@ -162,7 +162,7 @@ array_in(PG_FUNCTION_ARGS)
*q = '\0'; *q = '\0';
lBound[ndim] = atoi(p); lBound[ndim] = atoi(p);
p = q + 1; p = q + 1;
for (q = p; isdigit((int) *q); q++); for (q = p; isdigit((unsigned char) *q); q++);
if (q == p) /* no digits? */ if (q == p) /* no digits? */
elog(ERROR, "array_in: missing dimension value"); elog(ERROR, "array_in: missing dimension value");
} }
...@@ -197,7 +197,7 @@ array_in(PG_FUNCTION_ARGS) ...@@ -197,7 +197,7 @@ array_in(PG_FUNCTION_ARGS)
if (strncmp(p, ASSGN, strlen(ASSGN)) != 0) if (strncmp(p, ASSGN, strlen(ASSGN)) != 0)
elog(ERROR, "array_in: missing assignment operator"); elog(ERROR, "array_in: missing assignment operator");
p += strlen(ASSGN); p += strlen(ASSGN);
while (isspace((int) *p)) while (isspace((unsigned char) *p))
p++; p++;
} }
...@@ -323,7 +323,7 @@ ArrayCount(char *str, int *dim, int typdelim) ...@@ -323,7 +323,7 @@ ArrayCount(char *str, int *dim, int typdelim)
temp[ndim - 1]++; temp[ndim - 1]++;
q++; q++;
if (!eoArray) if (!eoArray)
while (isspace((int) *q)) while (isspace((unsigned char) *q))
q++; q++;
} }
for (i = 0; i < ndim; ++i) for (i = 0; i < ndim; ++i)
...@@ -454,7 +454,7 @@ ReadArrayStr(char *arrayStr, ...@@ -454,7 +454,7 @@ ReadArrayStr(char *arrayStr,
* if not at the end of the array skip white space * if not at the end of the array skip white space
*/ */
if (!eoArray) if (!eoArray)
while (isspace((int) *q)) while (isspace((unsigned char) *q))
{ {
p++; p++;
q++; q++;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* workings can be found in the book "Software Solutions in C" by * workings can be found in the book "Software Solutions in C" by
* Dale Schumacher, Academic Press, ISBN: 0-12-632360-7. * Dale Schumacher, Academic Press, ISBN: 0-12-632360-7.
* *
* $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.48 2000/11/25 22:43:08 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.49 2000/12/03 20:45:35 tgl Exp $
*/ */
#include "postgres.h" #include "postgres.h"
...@@ -122,7 +122,7 @@ cash_in(PG_FUNCTION_ARGS) ...@@ -122,7 +122,7 @@ cash_in(PG_FUNCTION_ARGS)
/* we need to add all sorts of checking here. For now just */ /* we need to add all sorts of checking here. For now just */
/* strip all leading whitespace and any leading currency symbol */ /* strip all leading whitespace and any leading currency symbol */
while (isspace((int) *s)) while (isspace((unsigned char) *s))
s++; s++;
if (strncmp(s, csymbol, strlen(csymbol)) == 0) if (strncmp(s, csymbol, strlen(csymbol)) == 0)
s += strlen(csymbol); s += strlen(csymbol);
...@@ -154,7 +154,7 @@ cash_in(PG_FUNCTION_ARGS) ...@@ -154,7 +154,7 @@ cash_in(PG_FUNCTION_ARGS)
printf("cashin- string is '%s'\n", s); printf("cashin- string is '%s'\n", s);
#endif #endif
while (isspace((int) *s)) while (isspace((unsigned char) *s))
s++; s++;
if (strncmp(s, csymbol, strlen(csymbol)) == 0) if (strncmp(s, csymbol, strlen(csymbol)) == 0)
s += strlen(csymbol); s += strlen(csymbol);
...@@ -167,7 +167,7 @@ cash_in(PG_FUNCTION_ARGS) ...@@ -167,7 +167,7 @@ cash_in(PG_FUNCTION_ARGS)
{ {
/* we look for digits as int4 as we have less */ /* we look for digits as int4 as we have less */
/* than the required number of decimal places */ /* than the required number of decimal places */
if (isdigit((int) *s) && dec < fpoint) if (isdigit((unsigned char) *s) && dec < fpoint)
{ {
value = (value * 10) + *s - '0'; value = (value * 10) + *s - '0';
...@@ -189,7 +189,7 @@ cash_in(PG_FUNCTION_ARGS) ...@@ -189,7 +189,7 @@ cash_in(PG_FUNCTION_ARGS)
else else
{ {
/* round off */ /* round off */
if (isdigit((int) *s) && *s >= '5') if (isdigit((unsigned char) *s) && *s >= '5')
value++; value++;
/* adjust for less than required decimal places */ /* adjust for less than required decimal places */
...@@ -200,7 +200,7 @@ cash_in(PG_FUNCTION_ARGS) ...@@ -200,7 +200,7 @@ cash_in(PG_FUNCTION_ARGS)
} }
} }
while (isspace((int) *s) || *s == '0' || *s == ')') while (isspace((unsigned char) *s) || *s == '0' || *s == ')')
s++; s++;
if (*s != '\0') if (*s != '\0')
...@@ -707,7 +707,7 @@ cash_words(PG_FUNCTION_ARGS) ...@@ -707,7 +707,7 @@ cash_words(PG_FUNCTION_ARGS)
strcat(buf, m0 == 1 ? " cent" : " cents"); strcat(buf, m0 == 1 ? " cent" : " cents");
/* capitalize output */ /* capitalize output */
buf[0] = toupper(buf[0]); buf[0] = toupper((unsigned char) buf[0]);
/* make a text type for output */ /* make a text type for output */
result = (text *) palloc(strlen(buf) + VARHDRSZ); result = (text *) palloc(strlen(buf) + VARHDRSZ);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.56 2000/11/11 19:55:19 thomas Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.57 2000/12/03 20:45:35 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -421,16 +421,17 @@ ParseDateTime(char *timestr, char *lowstr, ...@@ -421,16 +421,17 @@ ParseDateTime(char *timestr, char *lowstr,
field[nf] = lp; field[nf] = lp;
/* leading digit? then date or time */ /* leading digit? then date or time */
if (isdigit((int) *cp) || (*cp == '.')) if (isdigit((unsigned char) *cp) || (*cp == '.'))
{ {
*lp++ = *cp++; *lp++ = *cp++;
while (isdigit((int) *cp)) while (isdigit((unsigned char) *cp))
*lp++ = *cp++; *lp++ = *cp++;
/* time field? */ /* time field? */
if (*cp == ':') if (*cp == ':')
{ {
ftype[nf] = DTK_TIME; ftype[nf] = DTK_TIME;
while (isdigit((int) *cp) || (*cp == ':') || (*cp == '.')) while (isdigit((unsigned char) *cp) ||
(*cp == ':') || (*cp == '.'))
*lp++ = *cp++; *lp++ = *cp++;
} }
...@@ -438,8 +439,9 @@ ParseDateTime(char *timestr, char *lowstr, ...@@ -438,8 +439,9 @@ ParseDateTime(char *timestr, char *lowstr,
else if ((*cp == '-') || (*cp == '/') || (*cp == '.')) else if ((*cp == '-') || (*cp == '/') || (*cp == '.'))
{ {
ftype[nf] = DTK_DATE; ftype[nf] = DTK_DATE;
while (isalnum((int) *cp) || (*cp == '-') || (*cp == '/') || (*cp == '.')) while (isalnum((unsigned char) *cp) || (*cp == '-') ||
*lp++ = tolower(*cp++); (*cp == '/') || (*cp == '.'))
*lp++ = tolower((unsigned char) *cp++);
} }
...@@ -456,12 +458,12 @@ ParseDateTime(char *timestr, char *lowstr, ...@@ -456,12 +458,12 @@ ParseDateTime(char *timestr, char *lowstr,
* text? then date string, month, day of week, special, or * text? then date string, month, day of week, special, or
* timezone * timezone
*/ */
else if (isalpha((int) *cp)) else if (isalpha((unsigned char) *cp))
{ {
ftype[nf] = DTK_STRING; ftype[nf] = DTK_STRING;
*lp++ = tolower(*cp++); *lp++ = tolower((unsigned char) *cp++);
while (isalpha((int) *cp)) while (isalpha((unsigned char) *cp))
*lp++ = tolower(*cp++); *lp++ = tolower((unsigned char) *cp++);
/* /*
* Full date string with leading text month? Could also be a * Full date string with leading text month? Could also be a
...@@ -470,13 +472,14 @@ ParseDateTime(char *timestr, char *lowstr, ...@@ -470,13 +472,14 @@ ParseDateTime(char *timestr, char *lowstr,
if ((*cp == '-') || (*cp == '/') || (*cp == '.')) if ((*cp == '-') || (*cp == '/') || (*cp == '.'))
{ {
ftype[nf] = DTK_DATE; ftype[nf] = DTK_DATE;
while (isdigit((int) *cp) || (*cp == '-') || (*cp == '/') || (*cp == '.')) while (isdigit((unsigned char) *cp) ||
*lp++ = tolower(*cp++); (*cp == '-') || (*cp == '/') || (*cp == '.'))
*lp++ = tolower((unsigned char) *cp++);
} }
/* skip leading spaces */ /* skip leading spaces */
} }
else if (isspace((int) *cp)) else if (isspace((unsigned char) *cp))
{ {
cp++; cp++;
continue; continue;
...@@ -487,24 +490,25 @@ ParseDateTime(char *timestr, char *lowstr, ...@@ -487,24 +490,25 @@ ParseDateTime(char *timestr, char *lowstr,
{ {
*lp++ = *cp++; *lp++ = *cp++;
/* soak up leading whitespace */ /* soak up leading whitespace */
while (isspace((int) *cp)) while (isspace((unsigned char) *cp))
cp++; cp++;
/* numeric timezone? */ /* numeric timezone? */
if (isdigit((int) *cp)) if (isdigit((unsigned char) *cp))
{ {
ftype[nf] = DTK_TZ; ftype[nf] = DTK_TZ;
*lp++ = *cp++; *lp++ = *cp++;
while (isdigit((int) *cp) || (*cp == ':') || (*cp == '.')) while (isdigit((unsigned char) *cp) ||
(*cp == ':') || (*cp == '.'))
*lp++ = *cp++; *lp++ = *cp++;
/* special? */ /* special? */
} }
else if (isalpha((int) *cp)) else if (isalpha((unsigned char) *cp))
{ {
ftype[nf] = DTK_SPECIAL; ftype[nf] = DTK_SPECIAL;
*lp++ = tolower(*cp++); *lp++ = tolower((unsigned char) *cp++);
while (isalpha((int) *cp)) while (isalpha((unsigned char) *cp))
*lp++ = tolower(*cp++); *lp++ = tolower((unsigned char) *cp++);
/* otherwise something wrong... */ /* otherwise something wrong... */
} }
...@@ -513,7 +517,7 @@ ParseDateTime(char *timestr, char *lowstr, ...@@ -513,7 +517,7 @@ ParseDateTime(char *timestr, char *lowstr,
/* ignore punctuation but use as delimiter */ /* ignore punctuation but use as delimiter */
} }
else if (ispunct((int) *cp)) else if (ispunct((unsigned char) *cp))
{ {
cp++; cp++;
continue; continue;
...@@ -631,7 +635,7 @@ DecodeDateTime(char **field, int *ftype, int nf, ...@@ -631,7 +635,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
* PST) * PST)
*/ */
if ((i > 0) && ((fmask & DTK_M(TZ)) != 0) if ((i > 0) && ((fmask & DTK_M(TZ)) != 0)
&& (ftype[i - 1] == DTK_TZ) && (isalpha((int) *field[i - 1]))) && (ftype[i - 1] == DTK_TZ) && (isalpha((unsigned char) *field[i - 1])))
{ {
*tzp -= tz; *tzp -= tz;
tmask = 0; tmask = 0;
...@@ -974,7 +978,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf, ...@@ -974,7 +978,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
* PST) * PST)
*/ */
if ((i > 0) && ((fmask & DTK_M(TZ)) != 0) if ((i > 0) && ((fmask & DTK_M(TZ)) != 0)
&& (ftype[i - 1] == DTK_TZ) && (isalpha((int) *field[i - 1]))) && (ftype[i - 1] == DTK_TZ) && (isalpha((unsigned char) *field[i - 1])))
{ {
*tzp -= tz; *tzp -= tz;
tmask = 0; tmask = 0;
...@@ -1162,18 +1166,18 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm) ...@@ -1162,18 +1166,18 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm)
while ((*str != '\0') && (nf < MAXDATEFIELDS)) while ((*str != '\0') && (nf < MAXDATEFIELDS))
{ {
/* skip field separators */ /* skip field separators */
while (!isalnum((int) *str)) while (!isalnum((unsigned char) *str))
str++; str++;
field[nf] = str; field[nf] = str;
if (isdigit((int) *str)) if (isdigit((unsigned char) *str))
{ {
while (isdigit((int) *str)) while (isdigit((unsigned char) *str))
str++; str++;
} }
else if (isalpha((int) *str)) else if (isalpha((unsigned char) *str))
{ {
while (isalpha((int) *str)) while (isalpha((unsigned char) *str))
str++; str++;
} }
...@@ -1193,7 +1197,7 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm) ...@@ -1193,7 +1197,7 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm)
/* look first for text fields, since that will be unambiguous month */ /* look first for text fields, since that will be unambiguous month */
for (i = 0; i < nf; i++) for (i = 0; i < nf; i++)
{ {
if (isalpha((int) *field[i])) if (isalpha((unsigned char) *field[i]))
{ {
type = DecodeSpecial(i, field[i], &val); type = DecodeSpecial(i, field[i], &val);
if (type == IGNORE) if (type == IGNORE)
...@@ -1556,7 +1560,7 @@ DecodePosixTimezone(char *str, int *tzp) ...@@ -1556,7 +1560,7 @@ DecodePosixTimezone(char *str, int *tzp)
char delim; char delim;
cp = str; cp = str;
while ((*cp != '\0') && isalpha((int) *cp)) while ((*cp != '\0') && isalpha((unsigned char) *cp))
cp++; cp++;
if (DecodeTimezone(cp, &tz) != 0) if (DecodeTimezone(cp, &tz) != 0)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.6 2000/11/16 22:30:31 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.7 2000/12/03 20:45:35 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -203,7 +203,7 @@ format_type_internal(Oid type_oid, int32 typemod) ...@@ -203,7 +203,7 @@ format_type_internal(Oid type_oid, int32 typemod)
default: default:
name = NameStr(((Form_pg_type) GETSTRUCT(tuple))->typname); name = NameStr(((Form_pg_type) GETSTRUCT(tuple))->typname);
if (strspn(name, "abcdefghijklmnopqrstuvwxyz0123456789_") != strlen(name) if (strspn(name, "abcdefghijklmnopqrstuvwxyz0123456789_") != strlen(name)
|| isdigit((int) name[0])) || isdigit((unsigned char) name[0]))
buf = psnprintf(strlen(name) + 3, "\"%s\"", name); buf = psnprintf(strlen(name) + 3, "\"%s\"", name);
else else
buf = pstrdup(name); buf = pstrdup(name);
......
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
* formatting.c * formatting.c
* *
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.25 2000/12/01 05:17:19 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.26 2000/12/03 20:45:35 tgl Exp $
* *
* *
* Portions Copyright (c) 1999-2000, PostgreSQL, Inc * Portions Copyright (c) 1999-2000, PostgreSQL, Inc
...@@ -127,7 +127,7 @@ typedef struct ...@@ -127,7 +127,7 @@ typedef struct
int len, /* keyword length */ int len, /* keyword length */
(*action) (), (*action) (),
id; /* keyword id */ id; /* keyword id */
bool isdigit; /* is expected output/input digit */ bool isitdigit; /* is expected output/input digit */
} KeyWord; } KeyWord;
typedef struct typedef struct
...@@ -601,7 +601,7 @@ typedef enum ...@@ -601,7 +601,7 @@ typedef enum
* ---------- * ----------
*/ */
static KeyWord DCH_keywords[] = { static KeyWord DCH_keywords[] = {
/* keyword, len, func, type, isdigit is in Index */ /* keyword, len, func, type, isitdigit is in Index */
{"A.D.", 4, dch_date, DCH_A_D, FALSE}, /* A */ {"A.D.", 4, dch_date, DCH_A_D, FALSE}, /* A */
{"A.M.", 4, dch_time, DCH_A_M, FALSE}, {"A.M.", 4, dch_time, DCH_A_M, FALSE},
{"AD", 2, dch_date, DCH_AD, FALSE}, {"AD", 2, dch_date, DCH_AD, FALSE},
...@@ -682,7 +682,7 @@ static KeyWord DCH_keywords[] = { ...@@ -682,7 +682,7 @@ static KeyWord DCH_keywords[] = {
{NULL, 0, NULL, 0}}; {NULL, 0, NULL, 0}};
/* ---------- /* ----------
* KeyWords for NUMBER version (now, isdigit info is not needful here..) * KeyWords for NUMBER version (now, isitdigit info is not needful here..)
* ---------- * ----------
*/ */
static KeyWord NUM_keywords[] = { static KeyWord NUM_keywords[] = {
...@@ -1233,9 +1233,9 @@ DCH_processor(FormatNode *node, char *inout, int flag) ...@@ -1233,9 +1233,9 @@ DCH_processor(FormatNode *node, char *inout, int flag)
* Skip blank space in FROM_CHAR's input * Skip blank space in FROM_CHAR's input
* ---------- * ----------
*/ */
if (isspace(n->character) && IS_FX == 0) if (isspace((unsigned char) n->character) && IS_FX == 0)
{ {
while (*s != '\0' && isspace((int) *(s + 1))) while (*s != '\0' && isspace((unsigned char) *(s + 1)))
++s; ++s;
} }
} }
...@@ -1552,12 +1552,12 @@ is_next_separator(FormatNode *n) ...@@ -1552,12 +1552,12 @@ is_next_separator(FormatNode *n)
if (n->type == NODE_TYPE_ACTION) if (n->type == NODE_TYPE_ACTION)
{ {
if (n->key->isdigit) if (n->key->isitdigit)
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
else if (isdigit(n->character)) else if (isdigit((unsigned char) n->character))
return FALSE; return FALSE;
return TRUE; /* some non-digit input (separator) */ return TRUE; /* some non-digit input (separator) */
...@@ -1952,7 +1952,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node) ...@@ -1952,7 +1952,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
case DCH_month: case DCH_month:
sprintf(inout, "%*s", S_FM(suf) ? 0 : -9, months_full[tm->tm_mon - 1]); sprintf(inout, "%*s", S_FM(suf) ? 0 : -9, months_full[tm->tm_mon - 1]);
*inout = tolower(*inout); *inout = tolower((unsigned char) *inout);
if (S_FM(suf)) if (S_FM(suf))
return strlen(p_inout) - 1; return strlen(p_inout) - 1;
else else
...@@ -1969,7 +1969,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node) ...@@ -1969,7 +1969,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
case DCH_mon: case DCH_mon:
strcpy(inout, months[tm->tm_mon - 1]); strcpy(inout, months[tm->tm_mon - 1]);
*inout = tolower(*inout); *inout = tolower((unsigned char) *inout);
return 2; return 2;
case DCH_MM: case DCH_MM:
...@@ -2015,7 +2015,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node) ...@@ -2015,7 +2015,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
case DCH_day: case DCH_day:
sprintf(inout, "%*s", S_FM(suf) ? 0 : -9, days[tm->tm_wday]); sprintf(inout, "%*s", S_FM(suf) ? 0 : -9, days[tm->tm_wday]);
*inout = tolower(*inout); *inout = tolower((unsigned char) *inout);
if (S_FM(suf)) if (S_FM(suf))
return strlen(p_inout) - 1; return strlen(p_inout) - 1;
else else
...@@ -2032,7 +2032,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node) ...@@ -2032,7 +2032,7 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node)
case DCH_dy: case DCH_dy:
strcpy(inout, days[tm->tm_wday]); strcpy(inout, days[tm->tm_wday]);
*inout = tolower(*inout); *inout = tolower((unsigned char) *inout);
return 2; return 2;
case DCH_DDD: case DCH_DDD:
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.54 2000/07/30 20:43:41 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.55 2000/12/03 20:45:35 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -119,7 +119,7 @@ single_decode(char *str, float8 *x, char **s) ...@@ -119,7 +119,7 @@ single_decode(char *str, float8 *x, char **s)
if (!PointerIsValid(str)) if (!PointerIsValid(str))
return FALSE; return FALSE;
while (isspace((int) *str)) while (isspace((unsigned char) *str))
str++; str++;
*x = strtod(str, &cp); *x = strtod(str, &cp);
#ifdef GEODEBUG #ifdef GEODEBUG
...@@ -127,7 +127,7 @@ single_decode(char *str, float8 *x, char **s) ...@@ -127,7 +127,7 @@ single_decode(char *str, float8 *x, char **s)
#endif #endif
if (cp <= str) if (cp <= str)
return FALSE; return FALSE;
while (isspace((int) *cp)) while (isspace((unsigned char) *cp))
cp++; cp++;
if (s != NULL) if (s != NULL)
...@@ -152,33 +152,33 @@ pair_decode(char *str, float8 *x, float8 *y, char **s) ...@@ -152,33 +152,33 @@ pair_decode(char *str, float8 *x, float8 *y, char **s)
if (!PointerIsValid(str)) if (!PointerIsValid(str))
return FALSE; return FALSE;
while (isspace((int) *str)) while (isspace((unsigned char) *str))
str++; str++;
if ((has_delim = (*str == LDELIM))) if ((has_delim = (*str == LDELIM)))
str++; str++;
while (isspace((int) *str)) while (isspace((unsigned char) *str))
str++; str++;
*x = strtod(str, &cp); *x = strtod(str, &cp);
if (cp <= str) if (cp <= str)
return FALSE; return FALSE;
while (isspace((int) *cp)) while (isspace((unsigned char) *cp))
cp++; cp++;
if (*cp++ != DELIM) if (*cp++ != DELIM)
return FALSE; return FALSE;
while (isspace((int) *cp)) while (isspace((unsigned char) *cp))
cp++; cp++;
*y = strtod(cp, &str); *y = strtod(cp, &str);
if (str <= cp) if (str <= cp)
return FALSE; return FALSE;
while (isspace((int) *str)) while (isspace((unsigned char) *str))
str++; str++;
if (has_delim) if (has_delim)
{ {
if (*str != RDELIM) if (*str != RDELIM)
return FALSE; return FALSE;
str++; str++;
while (isspace((int) *str)) while (isspace((unsigned char) *str))
str++; str++;
} }
if (s != NULL) if (s != NULL)
...@@ -203,7 +203,7 @@ path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point *p) ...@@ -203,7 +203,7 @@ path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point *p)
int i; int i;
s = str; s = str;
while (isspace((int) *s)) while (isspace((unsigned char) *s))
s++; s++;
if ((*isopen = (*s == LDELIM_EP))) if ((*isopen = (*s == LDELIM_EP)))
{ {
...@@ -212,14 +212,14 @@ path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point *p) ...@@ -212,14 +212,14 @@ path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point *p)
return FALSE; return FALSE;
depth++; depth++;
s++; s++;
while (isspace((int) *s)) while (isspace((unsigned char) *s))
s++; s++;
} }
else if (*s == LDELIM) else if (*s == LDELIM)
{ {
cp = (s + 1); cp = (s + 1);
while (isspace((int) *cp)) while (isspace((unsigned char) *cp))
cp++; cp++;
if (*cp == LDELIM) if (*cp == LDELIM)
{ {
...@@ -255,7 +255,7 @@ path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point *p) ...@@ -255,7 +255,7 @@ path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point *p)
{ {
depth--; depth--;
s++; s++;
while (isspace((int) *s)) while (isspace((unsigned char) *s))
s++; s++;
} }
else else
...@@ -1216,7 +1216,7 @@ path_in(PG_FUNCTION_ARGS) ...@@ -1216,7 +1216,7 @@ path_in(PG_FUNCTION_ARGS)
elog(ERROR, "Bad path external representation '%s'", str); elog(ERROR, "Bad path external representation '%s'", str);
s = str; s = str;
while (isspace((int) *s)) while (isspace((unsigned char) *s))
s++; s++;
/* skip single leading paren */ /* skip single leading paren */
...@@ -3752,13 +3752,13 @@ circle_in(PG_FUNCTION_ARGS) ...@@ -3752,13 +3752,13 @@ circle_in(PG_FUNCTION_ARGS)
circle = (CIRCLE *) palloc(sizeof(CIRCLE)); circle = (CIRCLE *) palloc(sizeof(CIRCLE));
s = str; s = str;
while (isspace((int) *s)) while (isspace((unsigned char) *s))
s++; s++;
if ((*s == LDELIM_C) || (*s == LDELIM)) if ((*s == LDELIM_C) || (*s == LDELIM))
{ {
depth++; depth++;
cp = (s + 1); cp = (s + 1);
while (isspace((int) *cp)) while (isspace((unsigned char) *cp))
cp++; cp++;
if (*cp == LDELIM) if (*cp == LDELIM)
s = cp; s = cp;
...@@ -3769,7 +3769,7 @@ circle_in(PG_FUNCTION_ARGS) ...@@ -3769,7 +3769,7 @@ circle_in(PG_FUNCTION_ARGS)
if (*s == DELIM) if (*s == DELIM)
s++; s++;
while (isspace((int) *s)) while (isspace((unsigned char) *s))
s++; s++;
if ((!single_decode(s, &circle->radius, &s)) || (circle->radius < 0)) if ((!single_decode(s, &circle->radius, &s)) || (circle->radius < 0))
...@@ -3782,7 +3782,7 @@ circle_in(PG_FUNCTION_ARGS) ...@@ -3782,7 +3782,7 @@ circle_in(PG_FUNCTION_ARGS)
{ {
depth--; depth--;
s++; s++;
while (isspace((int) *s)) while (isspace((unsigned char) *s))
s++; s++;
} }
else else
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: inet_net_pton.c,v 1.11 2000/06/14 18:17:44 petere Exp $"; static const char rcsid[] = "$Id: inet_net_pton.c,v 1.12 2000/12/03 20:45:36 tgl Exp $";
#endif #endif
...@@ -105,7 +105,7 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size) ...@@ -105,7 +105,7 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size)
ch = *src++; ch = *src++;
if (ch == '0' && (src[0] == 'x' || src[0] == 'X') if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
&& isascii((int) src[1]) && isxdigit((int) src[1])) && isxdigit((unsigned char) src[1]))
{ {
/* Hexadecimal: Eat nybble string. */ /* Hexadecimal: Eat nybble string. */
if (size <= 0) if (size <= 0)
...@@ -113,10 +113,10 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size) ...@@ -113,10 +113,10 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size)
dirty = 0; dirty = 0;
tmp = 0; tmp = 0;
src++; /* skip x or X. */ src++; /* skip x or X. */
while ((ch = *src++) != '\0' && isascii(ch) && isxdigit(ch)) while ((ch = *src++) != '\0' && isxdigit((unsigned char) ch))
{ {
if (isupper(ch)) if (isupper((unsigned char) ch))
ch = tolower(ch); ch = tolower((unsigned char) ch);
n = strchr(xdigits, ch) - xdigits; n = strchr(xdigits, ch) - xdigits;
assert(n >= 0 && n <= 15); assert(n >= 0 && n <= 15);
if (dirty == 0) if (dirty == 0)
...@@ -138,7 +138,7 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size) ...@@ -138,7 +138,7 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size)
*dst++ = (u_char) (tmp << 4); *dst++ = (u_char) (tmp << 4);
} }
} }
else if (isascii(ch) && isdigit(ch)) else if (isdigit((unsigned char) ch))
{ {
/* Decimal: eat dotted digit string. */ /* Decimal: eat dotted digit string. */
for (;;) for (;;)
...@@ -153,7 +153,7 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size) ...@@ -153,7 +153,7 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size)
if (tmp > 255) if (tmp > 255)
goto enoent; goto enoent;
} while ((ch = *src++) != '\0' && } while ((ch = *src++) != '\0' &&
isascii(ch) && isdigit(ch)); isdigit((unsigned char) ch));
if (size-- <= 0) if (size-- <= 0)
goto emsgsize; goto emsgsize;
*dst++ = (u_char) tmp; *dst++ = (u_char) tmp;
...@@ -162,7 +162,7 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size) ...@@ -162,7 +162,7 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size)
if (ch != '.') if (ch != '.')
goto enoent; goto enoent;
ch = *src++; ch = *src++;
if (!isascii(ch) || !isdigit(ch)) if (!isdigit((unsigned char) ch))
goto enoent; goto enoent;
} }
} }
...@@ -170,7 +170,7 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size) ...@@ -170,7 +170,7 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size)
goto enoent; goto enoent;
bits = -1; bits = -1;
if (ch == '/' && isascii((int) src[0]) && isdigit((int) src[0]) && dst > odst) if (ch == '/' && isdigit((unsigned char) src[0]) && dst > odst)
{ {
/* CIDR width specifier. Nothing can follow it. */ /* CIDR width specifier. Nothing can follow it. */
ch = *src++; /* Skip over the /. */ ch = *src++; /* Skip over the /. */
...@@ -181,8 +181,7 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size) ...@@ -181,8 +181,7 @@ inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size)
assert(n >= 0 && n <= 9); assert(n >= 0 && n <= 9);
bits *= 10; bits *= 10;
bits += n; bits += n;
} while ((ch = *src++) != '\0' && } while ((ch = *src++) != '\0' && isdigit((unsigned char) ch));
isascii(ch) && isdigit(ch));
if (ch != '\0') if (ch != '\0')
goto enoent; goto enoent;
if (bits > 32) if (bits > 32)
...@@ -261,7 +260,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst) ...@@ -261,7 +260,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst)
size_t size = 4; size_t size = 4;
/* Get the mantissa. */ /* Get the mantissa. */
while (ch = *src++, (isascii(ch) && isdigit(ch))) while (ch = *src++, isdigit((unsigned char) ch))
{ {
tmp = 0; tmp = 0;
do do
...@@ -272,7 +271,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst) ...@@ -272,7 +271,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst)
tmp += n; tmp += n;
if (tmp > 255) if (tmp > 255)
goto enoent; goto enoent;
} while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); } while ((ch = *src++) != '\0' && isdigit((unsigned char) ch));
if (size-- == 0) if (size-- == 0)
goto emsgsize; goto emsgsize;
*dst++ = (u_char) tmp; *dst++ = (u_char) tmp;
...@@ -284,7 +283,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst) ...@@ -284,7 +283,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst)
/* Get the prefix length if any. */ /* Get the prefix length if any. */
bits = -1; bits = -1;
if (ch == '/' && isascii((int) src[0]) && isdigit((int) src[0]) && dst > odst) if (ch == '/' && isdigit((unsigned char) src[0]) && dst > odst)
{ {
/* CIDR width specifier. Nothing can follow it. */ /* CIDR width specifier. Nothing can follow it. */
ch = *src++; /* Skip over the /. */ ch = *src++; /* Skip over the /. */
...@@ -295,7 +294,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst) ...@@ -295,7 +294,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst)
assert(n >= 0 && n <= 9); assert(n >= 0 && n <= 9);
bits *= 10; bits *= 10;
bits += n; bits += n;
} while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); } while ((ch = *src++) != '\0' && isdigit((unsigned char) ch));
if (ch != '\0') if (ch != '\0')
goto enoent; goto enoent;
if (bits > 32) if (bits > 32)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.43 2000/10/24 20:14:35 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.44 2000/12/03 20:45:36 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -85,12 +85,12 @@ int2vectorin(PG_FUNCTION_ARGS) ...@@ -85,12 +85,12 @@ int2vectorin(PG_FUNCTION_ARGS)
{ {
if (sscanf(intString, "%hd", &result[slot]) != 1) if (sscanf(intString, "%hd", &result[slot]) != 1)
break; break;
while (*intString && isspace((int) *intString)) while (*intString && isspace((unsigned char) *intString))
intString++; intString++;
while (*intString && !isspace((int) *intString)) while (*intString && !isspace((unsigned char) *intString))
intString++; intString++;
} }
while (*intString && isspace((int) *intString)) while (*intString && isspace((unsigned char) *intString))
intString++; intString++;
if (*intString) if (*intString)
elog(ERROR, "int2vector value has too many values"); elog(ERROR, "int2vector value has too many values");
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int8.c,v 1.25 2000/10/24 20:14:35 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/int8.c,v 1.26 2000/12/03 20:45:36 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -67,15 +67,15 @@ int8in(PG_FUNCTION_ARGS) ...@@ -67,15 +67,15 @@ int8in(PG_FUNCTION_ARGS)
* Do our own scan, rather than relying on sscanf which might be * Do our own scan, rather than relying on sscanf which might be
* broken for long long. * broken for long long.
*/ */
while (*ptr && isspace((int) *ptr)) /* skip leading spaces */ while (*ptr && isspace((unsigned char) *ptr)) /* skip leading spaces */
ptr++; ptr++;
if (*ptr == '-') /* handle sign */ if (*ptr == '-') /* handle sign */
sign = -1, ptr++; sign = -1, ptr++;
else if (*ptr == '+') else if (*ptr == '+')
ptr++; ptr++;
if (!isdigit((int) *ptr)) /* require at least one digit */ if (!isdigit((unsigned char) *ptr)) /* require at least one digit */
elog(ERROR, "Bad int8 external representation \"%s\"", str); elog(ERROR, "Bad int8 external representation \"%s\"", str);
while (*ptr && isdigit((int) *ptr)) /* process digits */ while (*ptr && isdigit((unsigned char) *ptr)) /* process digits */
{ {
int64 newtmp = tmp * 10 + (*ptr++ - '0'); int64 newtmp = tmp * 10 + (*ptr++ - '0');
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.75 2000/10/29 13:17:34 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.76 2000/12/03 20:45:36 tgl Exp $
* *
* NOTES * NOTES
* *
...@@ -1655,7 +1655,7 @@ dummyfunc() ...@@ -1655,7 +1655,7 @@ dummyfunc()
for (;;) for (;;)
{ {
c = *p; c = *p;
if (isdigit(c)) if (isdigit((unsigned char) c))
{ {
*quantity = *quantity * 10 + (c - '0'); *quantity = *quantity * 10 + (c - '0');
p++; p++;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* 1998 Jan Wieck * 1998 Jan Wieck
* *
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.34 2000/08/01 18:29:35 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.35 2000/12/03 20:45:36 tgl Exp $
* *
* ---------- * ----------
*/ */
...@@ -2339,7 +2339,7 @@ set_var_from_str(char *str, NumericVar *dest) ...@@ -2339,7 +2339,7 @@ set_var_from_str(char *str, NumericVar *dest)
while (*cp) while (*cp)
{ {
if (!isspace((int) *cp)) if (!isspace((unsigned char) *cp))
break; break;
cp++; cp++;
} }
...@@ -2368,12 +2368,12 @@ set_var_from_str(char *str, NumericVar *dest) ...@@ -2368,12 +2368,12 @@ set_var_from_str(char *str, NumericVar *dest)
cp++; cp++;
} }
if (!isdigit((int) *cp)) if (!isdigit((unsigned char) *cp))
elog(ERROR, "Bad numeric input format '%s'", str); elog(ERROR, "Bad numeric input format '%s'", str);
while (*cp) while (*cp)
{ {
if (isdigit((int) *cp)) if (isdigit((unsigned char) *cp))
{ {
dest->digits[i++] = *cp++ - '0'; dest->digits[i++] = *cp++ - '0';
if (!have_dp) if (!have_dp)
...@@ -2416,7 +2416,7 @@ set_var_from_str(char *str, NumericVar *dest) ...@@ -2416,7 +2416,7 @@ set_var_from_str(char *str, NumericVar *dest)
/* Should be nothing left but spaces */ /* Should be nothing left but spaces */
while (*cp) while (*cp)
{ {
if (!isspace((int) *cp)) if (!isspace((unsigned char) *cp))
elog(ERROR, "Bad numeric input format '%s'", str); elog(ERROR, "Bad numeric input format '%s'", str);
cp++; cp++;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.40 2000/11/21 04:27:39 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.41 2000/12/03 20:45:36 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -42,12 +42,12 @@ oidvectorin(PG_FUNCTION_ARGS) ...@@ -42,12 +42,12 @@ oidvectorin(PG_FUNCTION_ARGS)
{ {
if (sscanf(oidString, "%u", &result[slot]) != 1) if (sscanf(oidString, "%u", &result[slot]) != 1)
break; break;
while (*oidString && isspace((int) *oidString)) while (*oidString && isspace((unsigned char) *oidString))
oidString++; oidString++;
while (*oidString && isdigit((int) *oidString)) while (*oidString && isdigit((unsigned char) *oidString))
oidString++; oidString++;
} }
while (*oidString && isspace((int) *oidString)) while (*oidString && isspace((unsigned char) *oidString))
oidString++; oidString++;
if (*oidString) if (*oidString)
elog(ERROR, "oidvector value has too many values"); elog(ERROR, "oidvector value has too many values");
......
/* /*
* Edmund Mergl <E.Mergl@bawue.de> * Edmund Mergl <E.Mergl@bawue.de>
* *
* $Header: /cvsroot/pgsql/src/backend/utils/adt/oracle_compat.c,v 1.28 2000/09/25 12:58:47 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/oracle_compat.c,v 1.29 2000/12/03 20:45:36 tgl Exp $
* *
*/ */
...@@ -118,7 +118,7 @@ initcap(PG_FUNCTION_ARGS) ...@@ -118,7 +118,7 @@ initcap(PG_FUNCTION_ARGS)
while (m-- > 0) while (m-- > 0)
{ {
if (isspace(ptr[-1])) if (isspace((unsigned char) ptr[-1]))
*ptr = toupper((unsigned char) *ptr); *ptr = toupper((unsigned char) *ptr);
else else
*ptr = tolower((unsigned char) *ptr); *ptr = tolower((unsigned char) *ptr);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.83 2000/11/25 20:33:53 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.84 2000/12/03 20:45:36 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1421,7 +1421,7 @@ like_fixed_prefix(char *patt, bool case_insensitive, ...@@ -1421,7 +1421,7 @@ like_fixed_prefix(char *patt, bool case_insensitive,
* XXX I suspect isalpha() is not an adequately locale-sensitive * XXX I suspect isalpha() is not an adequately locale-sensitive
* test for characters that can vary under case folding? * test for characters that can vary under case folding?
*/ */
if (case_insensitive && isalpha((int) patt[pos])) if (case_insensitive && isalpha((unsigned char) patt[pos]))
break; break;
/* /*
* NOTE: this code used to think that %% meant a literal %, but * NOTE: this code used to think that %% meant a literal %, but
...@@ -1504,7 +1504,7 @@ regex_fixed_prefix(char *patt, bool case_insensitive, ...@@ -1504,7 +1504,7 @@ regex_fixed_prefix(char *patt, bool case_insensitive,
patt[pos] == '(' || patt[pos] == '(' ||
patt[pos] == '[' || patt[pos] == '[' ||
patt[pos] == '$' || patt[pos] == '$' ||
(case_insensitive && isalpha((int) patt[pos]))) (case_insensitive && isalpha((unsigned char) patt[pos])))
break; break;
/* /*
* Check for quantifiers. Except for +, this means the preceding * Check for quantifiers. Except for +, this means the preceding
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.38 2000/11/11 19:55:19 thomas Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.39 2000/12/03 20:45:36 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1597,7 +1597,7 @@ timestamp_trunc(PG_FUNCTION_ARGS) ...@@ -1597,7 +1597,7 @@ timestamp_trunc(PG_FUNCTION_ARGS)
up = VARDATA(units); up = VARDATA(units);
lp = lowunits; lp = lowunits;
for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++) for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
*lp++ = tolower(*up++); *lp++ = tolower((unsigned char) *up++);
*lp = '\0'; *lp = '\0';
type = DecodeUnits(0, lowunits, &val); type = DecodeUnits(0, lowunits, &val);
...@@ -1730,7 +1730,7 @@ interval_trunc(PG_FUNCTION_ARGS) ...@@ -1730,7 +1730,7 @@ interval_trunc(PG_FUNCTION_ARGS)
up = VARDATA(units); up = VARDATA(units);
lp = lowunits; lp = lowunits;
for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++) for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
*lp++ = tolower(*up++); *lp++ = tolower((unsigned char) *up++);
*lp = '\0'; *lp = '\0';
type = DecodeUnits(0, lowunits, &val); type = DecodeUnits(0, lowunits, &val);
...@@ -1921,7 +1921,7 @@ timestamp_part(PG_FUNCTION_ARGS) ...@@ -1921,7 +1921,7 @@ timestamp_part(PG_FUNCTION_ARGS)
up = VARDATA(units); up = VARDATA(units);
lp = lowunits; lp = lowunits;
for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++) for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
*lp++ = tolower(*up++); *lp++ = tolower((unsigned char) *up++);
*lp = '\0'; *lp = '\0';
type = DecodeUnits(0, lowunits, &val); type = DecodeUnits(0, lowunits, &val);
...@@ -2079,7 +2079,7 @@ interval_part(PG_FUNCTION_ARGS) ...@@ -2079,7 +2079,7 @@ interval_part(PG_FUNCTION_ARGS)
up = VARDATA(units); up = VARDATA(units);
lp = lowunits; lp = lowunits;
for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++) for (i = 0; i < (VARSIZE(units) - VARHDRSZ); i++)
*lp++ = tolower(*up++); *lp++ = tolower((unsigned char) *up++);
*lp = '\0'; *lp = '\0';
type = DecodeUnits(0, lowunits, &val); type = DecodeUnits(0, lowunits, &val);
...@@ -2214,7 +2214,7 @@ timestamp_zone(PG_FUNCTION_ARGS) ...@@ -2214,7 +2214,7 @@ timestamp_zone(PG_FUNCTION_ARGS)
up = VARDATA(zone); up = VARDATA(zone);
lp = lowzone; lp = lowzone;
for (i = 0; i < (VARSIZE(zone) - VARHDRSZ); i++) for (i = 0; i < (VARSIZE(zone) - VARHDRSZ); i++)
*lp++ = tolower(*up++); *lp++ = tolower((unsigned char) *up++);
*lp = '\0'; *lp = '\0';
type = DecodeSpecial(0, lowzone, &val); type = DecodeSpecial(0, lowzone, &val);
...@@ -2237,7 +2237,7 @@ timestamp_zone(PG_FUNCTION_ARGS) ...@@ -2237,7 +2237,7 @@ timestamp_zone(PG_FUNCTION_ARGS)
up = upzone; up = upzone;
lp = lowzone; lp = lowzone;
for (i = 0; *lp != '\0'; i++) for (i = 0; *lp != '\0'; i++)
*up++ = toupper(*lp++); *up++ = toupper((unsigned char) *lp++);
*up = '\0'; *up = '\0';
tzn = upzone; tzn = upzone;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.65 2000/07/29 03:26:42 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.66 2000/12/03 20:45:36 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -56,9 +56,9 @@ byteain(PG_FUNCTION_ARGS) ...@@ -56,9 +56,9 @@ byteain(PG_FUNCTION_ARGS)
{ {
if (*tp == '\\') if (*tp == '\\')
tp++; tp++;
else if (!isdigit((int) *tp++) || else if (!isdigit((unsigned char) *tp++) ||
!isdigit((int) *tp++) || !isdigit((unsigned char) *tp++) ||
!isdigit((int) *tp++)) !isdigit((unsigned char) *tp++))
elog(ERROR, "Bad input string for type bytea"); elog(ERROR, "Bad input string for type bytea");
} }
} }
...@@ -111,7 +111,7 @@ byteaout(PG_FUNCTION_ARGS) ...@@ -111,7 +111,7 @@ byteaout(PG_FUNCTION_ARGS)
{ {
if (*vp == '\\') if (*vp == '\\')
len += 2; len += 2;
else if (isascii((int) *vp) && isprint((int) *vp)) else if (isprint((unsigned char) *vp))
len++; len++;
else else
len += 4; len += 4;
...@@ -125,7 +125,7 @@ byteaout(PG_FUNCTION_ARGS) ...@@ -125,7 +125,7 @@ byteaout(PG_FUNCTION_ARGS)
*rp++ = '\\'; *rp++ = '\\';
*rp++ = '\\'; *rp++ = '\\';
} }
else if (isascii((int) *vp) && isprint((int) *vp)) else if (isprint((unsigned char) *vp))
*rp++ = *vp; *rp++ = *vp;
else else
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.71 2000/12/03 10:27:28 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.72 2000/12/03 20:45:36 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -693,13 +693,13 @@ write_syslog(int level, const char *line) ...@@ -693,13 +693,13 @@ write_syslog(int level, const char *line)
l = strlen(buf); l = strlen(buf);
#endif #endif
/* already word boundary? */ /* already word boundary? */
if (isspace(line[l]) || line[l] == '\0') if (isspace((unsigned char) line[l]) || line[l] == '\0')
buflen = l; buflen = l;
else else
{ {
/* try to divide at word boundary */ /* try to divide at word boundary */
i = l - 1; i = l - 1;
while (i > 0 && !isspace(buf[i])) while (i > 0 && !isspace((unsigned char) buf[i]))
i--; i--;
if (i <= 0) /* couldn't divide word boundary */ if (i <= 0) /* couldn't divide word boundary */
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.47 2000/09/15 04:57:09 pjw Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.48 2000/12/03 20:45:37 tgl Exp $
* *
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2 * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
* *
...@@ -213,7 +213,8 @@ parseNumericArray(const char *str, char **array, int arraysize) ...@@ -213,7 +213,8 @@ parseNumericArray(const char *str, char **array, int arraysize)
} }
else else
{ {
if (!(isdigit((int) s) || s == '-') || j >= sizeof(temp) - 1) if (!(isdigit((unsigned char) s) || s == '-') ||
j >= sizeof(temp) - 1)
{ {
fprintf(stderr, "parseNumericArray: bogus number\n"); fprintf(stderr, "parseNumericArray: bogus number\n");
exit(2); exit(2);
...@@ -541,13 +542,15 @@ fmtId(const char *rawid, bool force_quotes) ...@@ -541,13 +542,15 @@ fmtId(const char *rawid, bool force_quotes)
if (!force_quotes) if (!force_quotes)
{ {
/* do a quick check on the first character... */ /* do a quick check on the first character... */
if (!islower((int) *rawid)) if (!islower((unsigned char) *rawid))
force_quotes = true; force_quotes = true;
/* otherwise check the entire string */ /* otherwise check the entire string */
else else
for (cp = rawid; *cp; cp++) for (cp = rawid; *cp; cp++)
{ {
if (!(islower((int) *cp) || isdigit((int) *cp) || (*cp == '_'))) if (!(islower((unsigned char) *cp) ||
isdigit((unsigned char) *cp) ||
(*cp == '_')))
{ {
force_quotes = true; force_quotes = true;
break; break;
......
...@@ -581,7 +581,7 @@ void FixupBlobRefs(ArchiveHandle *AH, char *tablename) ...@@ -581,7 +581,7 @@ void FixupBlobRefs(ArchiveHandle *AH, char *tablename)
char *attr; char *attr;
for(i=0 ; i < strlen(tablename) ; i++) for(i=0 ; i < strlen(tablename) ; i++)
tablename[i] = tolower(tablename[i]); tablename[i] = tolower((unsigned char) tablename[i]);
if (strcmp(tablename, BLOB_XREF_TABLE) == 0) if (strcmp(tablename, BLOB_XREF_TABLE) == 0)
return; return;
......
...@@ -550,7 +550,7 @@ static void _PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt) ...@@ -550,7 +550,7 @@ static void _PrintTocData(ArchiveHandle* AH, TocEntry* te, RestoreOptions *ropt)
/* Get a copy of the COPY statement and clean it up */ /* Get a copy of the COPY statement and clean it up */
tmpCopy = strdup(te->copyStmt); tmpCopy = strdup(te->copyStmt);
for (i=0 ; i < strlen(tmpCopy) ; i++) for (i=0 ; i < strlen(tmpCopy) ; i++)
tmpCopy[i] = tolower(tmpCopy[i]); tmpCopy[i] = tolower((unsigned char) tmpCopy[i]);
/* /*
* This is very nasty; we don't know if the archive used WITH OIDS, so * This is very nasty; we don't know if the archive used WITH OIDS, so
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.182 2000/11/27 20:51:40 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.183 2000/12/03 20:45:37 tgl Exp $
* *
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
* *
...@@ -813,9 +813,8 @@ main(int argc, char **argv) ...@@ -813,9 +813,8 @@ main(int argc, char **argv)
else else
{ {
for (i = 0; tablename[i]; i++) for (i = 0; tablename[i]; i++)
if (isascii((int) tablename[i]) && if (isupper((unsigned char) tablename[i]))
isupper((int) tablename[i])) tablename[i] = tolower((unsigned char) tablename[i]);
tablename[i] = tolower(tablename[i]);
} }
} }
break; break;
......
...@@ -381,26 +381,23 @@ static char* _cleanupName(char* name) ...@@ -381,26 +381,23 @@ static char* _cleanupName(char* name)
{ {
int i; int i;
if (!name) if (!name || ! name[0])
return NULL; return NULL;
if (strlen(name) == 0)
return NULL;
name = strdup(name); name = strdup(name);
if (name[0] == '"') if (name[0] == '"')
{ {
strcpy(name, &name[1]); strcpy(name, &name[1]);
if (*(name + strlen(name) - 1) == '"') if (name[0] && *(name + strlen(name) - 1) == '"')
*(name + strlen(name) - 1) = '\0'; *(name + strlen(name) - 1) = '\0';
} }
/* otherwise, convert table name to lowercase... */ /* otherwise, convert table name to lowercase... */
else else
{ {
for (i = 0; name[i]; i++) for (i = 0; name[i]; i++)
if (isascii((unsigned char) name[i]) && isupper(name[i])) if (isupper((unsigned char) name[i]))
name[i] = tolower(name[i]); name[i] = tolower((unsigned char) name[i]);
} }
return name; return name;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
#include <ctype.h> #include <ctype.h>
#define issaltchar(c) (isalnum(c) || (c) == '.' || (c) == '/') #define issaltchar(c) (isalnum((unsigned char) (c)) || (c) == '.' || (c) == '/')
#ifdef HAVE_TERMIOS_H #ifdef HAVE_TERMIOS_H
#include <termios.h> #include <termios.h>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2000 by PostgreSQL Global Development Group * Copyright 2000 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.41 2000/11/27 02:20:36 tgl Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.42 2000/12/03 20:45:38 tgl Exp $
*/ */
#include "postgres.h" #include "postgres.h"
#include "command.h" #include "command.h"
...@@ -142,7 +142,7 @@ HandleSlashCmds(const char *line, ...@@ -142,7 +142,7 @@ HandleSlashCmds(const char *line,
status = exec_command(new_cmd, my_line + 1, &continue_parse, query_buf); status = exec_command(new_cmd, my_line + 1, &continue_parse, query_buf);
#if 0 /* turned out to be too annoying */ #if 0 /* turned out to be too annoying */
if (status != CMD_UNKNOWN && isalpha(new_cmd[0])) if (status != CMD_UNKNOWN && isalpha((unsigned char) new_cmd[0]))
psql_error("Warning: this syntax is deprecated\n"); psql_error("Warning: this syntax is deprecated\n");
#endif #endif
} }
...@@ -1070,8 +1070,8 @@ scan_option(char **string, enum option_type type, char *quote) ...@@ -1070,8 +1070,8 @@ scan_option(char **string, enum option_type type, char *quote)
if (type == OT_SQLID) if (type == OT_SQLID)
for (cp = return_val; *cp; cp += PQmblen(cp, pset.encoding)) for (cp = return_val; *cp; cp += PQmblen(cp, pset.encoding))
if (isascii(*cp)) if (isupper((unsigned char) *cp))
*cp = tolower(*cp); *cp = tolower((unsigned char) *cp);
*string = &options_string[pos + token_end]; *string = &options_string[pos + token_end];
return return_val; return return_val;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2000 by PostgreSQL Global Development Group * Copyright 2000 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.23 2000/12/03 14:36:47 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.24 2000/12/03 20:45:38 tgl Exp $
*/ */
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
/* If we don't have this, we might as well forget about the whole thing: */ /* If we don't have this, we might as well forget about the whole thing: */
#ifdef USE_READLINE #ifdef USE_READLINE
#include <ctype.h> /* toupper */ #include <ctype.h>
#ifdef USE_ASSERT_CHECKING #ifdef USE_ASSERT_CHECKING
#include <assert.h> #include <assert.h>
#endif #endif
...@@ -440,7 +440,8 @@ psql_completion(char *text, int start, int end) ...@@ -440,7 +440,8 @@ psql_completion(char *text, int start, int end)
/* Complete "AS ON <sth with a 'T' :)>" with a "TO" */ /* Complete "AS ON <sth with a 'T' :)>" with a "TO" */
else if (strcasecmp(prev3_wd, "AS") == 0 && else if (strcasecmp(prev3_wd, "AS") == 0 &&
strcasecmp(prev2_wd, "ON") == 0 && strcasecmp(prev2_wd, "ON") == 0 &&
(toupper(prev_wd[4]) == 'T' || toupper(prev_wd[5]) == 'T')) (toupper((unsigned char) prev_wd[4]) == 'T' ||
toupper((unsigned char) prev_wd[5]) == 'T'))
COMPLETE_WITH_CONST("TO"); COMPLETE_WITH_CONST("TO");
/* Complete "AS ON <sth> TO" with a table name */ /* Complete "AS ON <sth> TO" with a table name */
else if (strcasecmp(prev4_wd, "AS") == 0 && else if (strcasecmp(prev4_wd, "AS") == 0 &&
......
...@@ -207,8 +207,8 @@ struct re_guts ...@@ -207,8 +207,8 @@ struct re_guts
#endif #endif
#ifdef MULTIBYTE #ifdef MULTIBYTE
#define ISWORD(c) ((c >= 0 && c <= UCHAR_MAX) && \ #define ISWORD(c) (((c) >= 0 && (c) <= UCHAR_MAX) && \
(isalnum(c) || (c) == '_')) (isalnum((unsigned char) (c)) || (c) == '_'))
#else #else
#define ISWORD(c) (isalnum(c) || (c) == '_') #define ISWORD(c) (isalnum((unsigned char) (c)) || (c) == '_')
#endif #endif
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.68 2000/11/20 03:51:33 tgl Exp $ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.69 2000/12/03 20:45:38 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -537,8 +537,8 @@ cppline {space}*#(.*\\{line_end})*.* ...@@ -537,8 +537,8 @@ cppline {space}*#(.*\\{line_end})*.*
/* this should leave the last byte set to '\0' */ /* this should leave the last byte set to '\0' */
strncpy(lower_text, yytext, NAMEDATALEN-1); strncpy(lower_text, yytext, NAMEDATALEN-1);
for(i = 0; lower_text[i]; i++) for(i = 0; lower_text[i]; i++)
if (isascii((int)lower_text[i]) && isupper((int) lower_text[i])) if (isupper((unsigned char) lower_text[i]))
lower_text[i] = tolower(lower_text[i]); lower_text[i] = tolower((unsigned char) lower_text[i]);
if (i >= NAMEDATALEN) if (i >= NAMEDATALEN)
{ {
...@@ -755,7 +755,10 @@ cppline {space}*#(.*\\{line_end})*.* ...@@ -755,7 +755,10 @@ cppline {space}*#(.*\\{line_end})*.*
/* skip the ";" and trailing whitespace. Note that yytext contains /* skip the ";" and trailing whitespace. Note that yytext contains
at least one non-space character plus the ";" */ at least one non-space character plus the ";" */
for ( i = strlen(yytext)-2; i > 0 && isspace((int) yytext[i]); i-- ) {} for ( i = strlen(yytext)-2;
i > 0 && isspace((unsigned char) yytext[i]);
i-- )
{}
yytext[i+1] = '\0'; yytext[i+1] = '\0';
for ( defptr = defines; defptr != NULL && for ( defptr = defines; defptr != NULL &&
...@@ -827,7 +830,10 @@ cppline {space}*#(.*\\{line_end})*.* ...@@ -827,7 +830,10 @@ cppline {space}*#(.*\\{line_end})*.*
/* skip the ";" and trailing whitespace. Note that yytext contains /* skip the ";" and trailing whitespace. Note that yytext contains
at least one non-space character plus the ";" */ at least one non-space character plus the ";" */
for ( i = strlen(yytext)-2; i > 0 && isspace((int) yytext[i]); i-- ) {} for ( i = strlen(yytext)-2;
i > 0 && isspace((unsigned char) yytext[i]);
i-- )
{}
yytext[i+1] = '\0'; yytext[i+1] = '\0';
yyin = NULL; yyin = NULL;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.50 2000/11/27 13:29:32 wieck Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.51 2000/12/03 20:45:39 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1846,7 +1846,7 @@ Pg_listen(ClientData cData, Tcl_Interp *interp, int argc, char *argv[]) ...@@ -1846,7 +1846,7 @@ Pg_listen(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
char *reld = caserelname; char *reld = caserelname;
while (*rels) while (*rels)
*reld++ = tolower(*rels++); *reld++ = tolower((unsigned char) *rels++);
*reld = '\0'; *reld = '\0';
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.152 2000/11/30 23:20:51 tgl Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.153 2000/12/03 20:45:39 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2248,20 +2248,21 @@ int parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage) { ...@@ -2248,20 +2248,21 @@ int parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage) {
line[strlen(line)-1] = 0; line[strlen(line)-1] = 0;
/* ignore leading blanks */ /* ignore leading blanks */
while(*line && isspace(line[0])) while(*line && isspace((unsigned char) line[0]))
line++; line++;
/* ignore comments and empty lines */ /* ignore comments and empty lines */
if(strlen(line) == 0 || line[0] == '#') if(strlen(line) == 0 || line[0] == '#')
continue; continue;
/* Check for right groupname */ /* Check for right groupname */
if(line[0] == '[') { if(line[0] == '[')
if(group_found) { {
/* group info already read */ if(group_found) {
fclose(f); /* group info already read */
return 0; fclose(f);
} return 0;
}
if(strncmp(line+1, service, strlen(service)) == 0 && if(strncmp(line+1, service, strlen(service)) == 0 &&
line[strlen(service)+1] == ']') line[strlen(service)+1] == ']')
...@@ -2358,7 +2359,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage) ...@@ -2358,7 +2359,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage)
while (*cp) while (*cp)
{ {
/* Skip blanks before the parameter name */ /* Skip blanks before the parameter name */
if (isspace((int) *cp)) if (isspace((unsigned char) *cp))
{ {
cp++; cp++;
continue; continue;
...@@ -2370,12 +2371,12 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage) ...@@ -2370,12 +2371,12 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage)
{ {
if (*cp == '=') if (*cp == '=')
break; break;
if (isspace((int) *cp)) if (isspace((unsigned char) *cp))
{ {
*cp++ = '\0'; *cp++ = '\0';
while (*cp) while (*cp)
{ {
if (!isspace((int) *cp)) if (!isspace((unsigned char) *cp))
break; break;
cp++; cp++;
} }
...@@ -2399,7 +2400,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage) ...@@ -2399,7 +2400,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage)
/* Skip blanks after the '=' */ /* Skip blanks after the '=' */
while (*cp) while (*cp)
{ {
if (!isspace((int) *cp)) if (!isspace((unsigned char) *cp))
break; break;
cp++; cp++;
} }
...@@ -2412,7 +2413,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage) ...@@ -2412,7 +2413,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage)
cp2 = pval; cp2 = pval;
while (*cp) while (*cp)
{ {
if (isspace((int) *cp)) if (isspace((unsigned char) *cp))
{ {
*cp++ = '\0'; *cp++ = '\0';
break; break;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.96 2000/06/14 18:17:58 petere Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.97 2000/12/03 20:45:39 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1955,9 +1955,8 @@ PQfnumber(const PGresult *res, const char *field_name) ...@@ -1955,9 +1955,8 @@ PQfnumber(const PGresult *res, const char *field_name)
} }
else else
for (i = 0; field_case[i]; i++) for (i = 0; field_case[i]; i++)
if (isascii((int) field_case[i]) && if (isupper((unsigned char) field_case[i]))
isupper((int) field_case[i])) field_case[i] = tolower((unsigned char) field_case[i]);
field_case[i] = tolower(field_case[i]);
for (i = 0; i < res->numAttributes; i++) for (i = 0; i < res->numAttributes; i++)
{ {
......
...@@ -284,9 +284,9 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 ...@@ -284,9 +284,9 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
nval++; nval++;
/* skip the current token */ /* skip the current token */
while ((*vp != '\0') && (! isspace(*vp))) vp++; while ((*vp != '\0') && (! isspace((unsigned char) *vp))) vp++;
/* and skip the space to the next token */ /* and skip the space to the next token */
while ((*vp != '\0') && (isspace(*vp))) vp++; while ((*vp != '\0') && (isspace((unsigned char) *vp))) vp++;
if (*vp == '\0') if (*vp == '\0')
break; break;
} }
...@@ -1126,10 +1126,10 @@ static char escape[1024]; ...@@ -1126,10 +1126,10 @@ static char escape[1024];
char key[33]; char key[33];
/* Separate off the key, skipping leading and trailing whitespace */ /* Separate off the key, skipping leading and trailing whitespace */
while ((*value != '\0') && isspace(*value)) value++; while ((*value != '\0') && isspace((unsigned char) *value)) value++;
sscanf(value, "%32s", key); sscanf(value, "%32s", key);
while ((*value != '\0') && (! isspace(*value))) value++; while ((*value != '\0') && (! isspace((unsigned char) *value))) value++;
while ((*value != '\0') && isspace(*value)) value++; while ((*value != '\0') && isspace((unsigned char) *value)) value++;
mylog("convert_escape: key='%s', val='%s'\n", key, value); mylog("convert_escape: key='%s', val='%s'\n", key, value);
...@@ -1149,12 +1149,14 @@ char key[33]; ...@@ -1149,12 +1149,14 @@ char key[33];
char *mapFunc; char *mapFunc;
while ((*funcEnd != '\0') && (*funcEnd != '(') && while ((*funcEnd != '\0') && (*funcEnd != '(') &&
(! isspace(*funcEnd))) funcEnd++; (! isspace((unsigned char) *funcEnd)))
funcEnd++;
svchar = *funcEnd; svchar = *funcEnd;
*funcEnd = '\0'; *funcEnd = '\0';
sscanf(value, "%32s", key); sscanf(value, "%32s", key);
*funcEnd = svchar; *funcEnd = svchar;
while ((*funcEnd != '\0') && isspace(*funcEnd)) funcEnd++; while ((*funcEnd != '\0') && isspace((unsigned char) *funcEnd))
funcEnd++;
/* We expect left parenthesis here, /* We expect left parenthesis here,
* else return fn body as-is since it is * else return fn body as-is since it is
...@@ -1430,18 +1432,18 @@ int i, o=0; ...@@ -1430,18 +1432,18 @@ int i, o=0;
void void
encode(char *in, char *out) encode(char *in, char *out)
{ {
unsigned int i, o = 0; unsigned int i, o = 0;
for (i = 0; i < strlen(in); i++) { for (i = 0; i < strlen(in); i++) {
if ( in[i] == '+') { if ( in[i] == '+') {
sprintf(&out[o], "%%2B"); sprintf(&out[o], "%%2B");
o += 3; o += 3;
} }
else if ( isspace(in[i])) { else if ( isspace((unsigned char) in[i])) {
out[o++] = '+'; out[o++] = '+';
} }
else if ( ! isalnum(in[i])) { else if ( ! isalnum((unsigned char) in[i])) {
sprintf(&out[o], "%%%02x", in[i]); sprintf(&out[o], "%%%02x", (unsigned char) in[i]);
o += 3; o += 3;
} }
else else
......
...@@ -144,8 +144,8 @@ GetPrivateProfileString(char *theSection, /* section name */ ...@@ -144,8 +144,8 @@ GetPrivateProfileString(char *theSection, /* section name */
{ {
aStart = aLine + 1; aStart = aLine + 1;
aString--; aString--;
while (isspace(*aStart)) aStart++; while (isspace((unsigned char) *aStart)) aStart++;
while (isspace(*aString)) aString--; while (isspace((unsigned char) *aString)) aString--;
*(aString+1) = '\0'; *(aString+1) = '\0';
/* accept as matched if NULL key or exact match */ /* accept as matched if NULL key or exact match */
...@@ -188,7 +188,7 @@ GetPrivateProfileString(char *theSection, /* section name */ ...@@ -188,7 +188,7 @@ GetPrivateProfileString(char *theSection, /* section name */
} }
aStart = aLine; aStart = aLine;
while(isspace(*aStart)) aStart++; while (isspace((unsigned char) *aStart)) aStart++;
/* strip trailing blanks from key */ /* strip trailing blanks from key */
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "iodbc.h" #include "iodbc.h"
#include "isql.h" #include "isql.h"
#include "isqlext.h" #include "isqlext.h"
#include <ctype.h> /* for tolower function */ #include <ctype.h>
#else #else
#include <windows.h> #include <windows.h>
#include <sql.h> #include <sql.h>
...@@ -2615,7 +2615,7 @@ Int2 result_cols; ...@@ -2615,7 +2615,7 @@ Int2 result_cols;
/* Handle action (i.e., 'cascade', 'restrict', 'setnull') */ /* Handle action (i.e., 'cascade', 'restrict', 'setnull') */
switch(tolower(ptr[0])) { switch(tolower((unsigned char) ptr[0])) {
case 'c': case 'c':
action = SQL_CASCADE; action = SQL_CASCADE;
break; break;
......
...@@ -55,7 +55,7 @@ char qc, in_escape = FALSE; ...@@ -55,7 +55,7 @@ char qc, in_escape = FALSE;
smax--; smax--;
/* skip leading delimiters */ /* skip leading delimiters */
while (isspace(s[i]) || s[i] == ',') { while (isspace((unsigned char) s[i]) || s[i] == ',') {
/* mylog("skipping '%c'\n", s[i]); */ /* mylog("skipping '%c'\n", s[i]); */
i++; i++;
} }
...@@ -70,7 +70,8 @@ char qc, in_escape = FALSE; ...@@ -70,7 +70,8 @@ char qc, in_escape = FALSE;
if (numeric) *numeric = FALSE; if (numeric) *numeric = FALSE;
/* get the next token */ /* get the next token */
while ( ! isspace(s[i]) && s[i] != ',' && s[i] != '\0' && out != smax) { while ( ! isspace((unsigned char) s[i]) && s[i] != ',' &&
s[i] != '\0' && out != smax) {
/* Handle quoted stuff */ /* Handle quoted stuff */
if ( out == 0 && (s[i] == '\"' || s[i] == '\'')) { if ( out == 0 && (s[i] == '\"' || s[i] == '\'')) {
...@@ -102,16 +103,16 @@ char qc, in_escape = FALSE; ...@@ -102,16 +103,16 @@ char qc, in_escape = FALSE;
} }
/* Check for numeric literals */ /* Check for numeric literals */
if ( out == 0 && isdigit(s[i])) { if ( out == 0 && isdigit((unsigned char) s[i])) {
if (numeric) *numeric = TRUE; if (numeric) *numeric = TRUE;
token[out++] = s[i++]; token[out++] = s[i++];
while ( isalnum(s[i]) || s[i] == '.') while ( isalnum((unsigned char) s[i]) || s[i] == '.')
token[out++] = s[i++]; token[out++] = s[i++];
break; break;
} }
if ( ispunct(s[i]) && s[i] != '_') { if ( ispunct((unsigned char) s[i]) && s[i] != '_') {
mylog("got ispunct: s[%d] = '%c'\n", i, s[i]); mylog("got ispunct: s[%d] = '%c'\n", i, s[i]);
if (out == 0) { if (out == 0) {
...@@ -133,7 +134,7 @@ char qc, in_escape = FALSE; ...@@ -133,7 +134,7 @@ char qc, in_escape = FALSE;
token[out] = '\0'; token[out] = '\0';
/* find the delimiter */ /* find the delimiter */
while ( isspace(s[i])) while ( isspace((unsigned char) s[i]))
i++; i++;
/* return the most priority delimiter */ /* return the most priority delimiter */
...@@ -148,7 +149,7 @@ char qc, in_escape = FALSE; ...@@ -148,7 +149,7 @@ char qc, in_escape = FALSE;
} }
/* skip trailing blanks */ /* skip trailing blanks */
while ( isspace(s[i])) { while ( isspace((unsigned char) s[i])) {
i++; i++;
} }
......
/*------------------------------------------------------- /*-------------------------------------------------------
* *
* $Id: Pg.xs,v 1.15 2000/10/24 17:00:00 tgl Exp $ with patch for NULs * $Id: Pg.xs,v 1.16 2000/12/03 20:45:40 tgl Exp $ with patch for NULs
* *
* Copyright (c) 1997, 1998 Edmund Mergl * Copyright (c) 1997, 1998 Edmund Mergl
* *
...@@ -215,7 +215,7 @@ PQconnectdb(conninfo) ...@@ -215,7 +215,7 @@ PQconnectdb(conninfo)
} }
} else { } else {
while (*ptr && *ptr != ' ' && *ptr != '\t') { while (*ptr && *ptr != ' ' && *ptr != '\t') {
*ptr = tolower(*ptr); *ptr = tolower((unsigned char) *ptr);
ptr++; ptr++;
} }
} }
...@@ -734,7 +734,7 @@ connectdb(conninfo) ...@@ -734,7 +734,7 @@ connectdb(conninfo)
} }
} else { } else {
while (*ptr && *ptr != ' ' && *ptr != '\t') { while (*ptr && *ptr != ' ' && *ptr != '\t') {
*ptr = tolower(*ptr); *ptr = tolower((unsigned char) *ptr);
ptr++; ptr++;
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* procedural language * procedural language
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.8 2000/09/05 09:02:18 wieck Exp $ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.9 2000/12/03 20:45:40 tgl Exp $
* *
* This software is copyrighted by Jan Wieck - Hamburg. * This software is copyrighted by Jan Wieck - Hamburg.
* *
...@@ -354,8 +354,8 @@ plpgsql_tolower(char *s) ...@@ -354,8 +354,8 @@ plpgsql_tolower(char *s)
} }
else else
{ {
if (isupper((int) *s)) if (isupper((unsigned char) *s))
*cp++ = tolower(*s++); *cp++ = tolower((unsigned char) *s++);
else else
*cp++ = *s++; *cp++ = *s++;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment