mirror of https://github.com/postgres/postgres
Make sure that all <ctype.h> routines are called with unsigned char
values; it's not portable to call them with signed chars. I recall doing this for the last release, but a few more uncasted calls have snuck in.
This commit is contained in:
parent
e7d9a6bf63
commit
ee051baeac
|
@ -78,7 +78,7 @@ isinteger(char *buff)
|
|||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!isdigit((int) *i))
|
||||
if (!isdigit((unsigned char) *i))
|
||||
return 0;
|
||||
i++;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ strtoupper(char *string)
|
|||
{
|
||||
while (*string != '\0')
|
||||
{
|
||||
*string = toupper(*string);
|
||||
*string = toupper((unsigned char) *string);
|
||||
string++;
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ strtolower(char *string)
|
|||
{
|
||||
while (*string != '\0')
|
||||
{
|
||||
*string = tolower(*string);
|
||||
*string = tolower((unsigned char) *string);
|
||||
string++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -253,17 +253,18 @@ metaphone(PG_FUNCTION_ARGS)
|
|||
* accesssing the array directly... */
|
||||
|
||||
/* Look at the next letter in the word */
|
||||
#define Next_Letter (toupper(word[w_idx+1]))
|
||||
#define Next_Letter (toupper((unsigned char) word[w_idx+1]))
|
||||
/* Look at the current letter in the word */
|
||||
#define Curr_Letter (toupper(word[w_idx]))
|
||||
#define Curr_Letter (toupper((unsigned char) word[w_idx]))
|
||||
/* Go N letters back. */
|
||||
#define Look_Back_Letter(n) (w_idx >= n ? toupper(word[w_idx-n]) : '\0')
|
||||
#define Look_Back_Letter(n) \
|
||||
(w_idx >= (n) ? toupper((unsigned char) word[w_idx-(n)]) : '\0')
|
||||
/* Previous letter. I dunno, should this return null on failure? */
|
||||
#define Prev_Letter (Look_Back_Letter(1))
|
||||
/* Look two letters down. It makes sure you don't walk off the string. */
|
||||
#define After_Next_Letter (Next_Letter != '\0' ? toupper(word[w_idx+2]) \
|
||||
: '\0')
|
||||
#define Look_Ahead_Letter(n) (toupper(Lookahead(word+w_idx, n)))
|
||||
#define After_Next_Letter \
|
||||
(Next_Letter != '\0' ? toupper((unsigned char) word[w_idx+2]) : '\0')
|
||||
#define Look_Ahead_Letter(n) toupper((unsigned char) Lookahead(word+w_idx, n))
|
||||
|
||||
|
||||
/* Allows us to safely look ahead an arbitrary # of letters */
|
||||
|
@ -291,7 +292,7 @@ Lookahead(char *word, int how_far)
|
|||
#define Phone_Len (p_idx)
|
||||
|
||||
/* Note is a letter is a 'break' in the word */
|
||||
#define Isbreak(c) (!isalpha(c))
|
||||
#define Isbreak(c) (!isalpha((unsigned char) (c)))
|
||||
|
||||
|
||||
int
|
||||
|
@ -336,7 +337,7 @@ _metaphone(
|
|||
|
||||
/*-- The first phoneme has to be processed specially. --*/
|
||||
/* Find our first letter */
|
||||
for (; !isalpha(Curr_Letter); w_idx++)
|
||||
for (; !isalpha((unsigned char) (Curr_Letter)); w_idx++)
|
||||
{
|
||||
/* On the off chance we were given nothing but crap... */
|
||||
if (Curr_Letter == '\0')
|
||||
|
@ -435,7 +436,7 @@ _metaphone(
|
|||
*/
|
||||
|
||||
/* Ignore non-alphas */
|
||||
if (!isalpha(Curr_Letter))
|
||||
if (!isalpha((unsigned char) (Curr_Letter)))
|
||||
continue;
|
||||
|
||||
/* Drop duplicates, except CC */
|
||||
|
|
|
@ -153,7 +153,7 @@ char _codes[26] = {
|
|||
};
|
||||
|
||||
|
||||
#define ENCODE(c) (isalpha(c) ? _codes[((toupper(c)) - 'A')] : 0)
|
||||
#define ENCODE(c) (isalpha((unsigned char) (c)) ? _codes[((toupper((unsigned char) (c))) - 'A')] : 0)
|
||||
|
||||
#define isvowel(c) (ENCODE(c) & 1) /* AEIOU */
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: pgcrypto.c,v 1.11 2001/11/20 15:50:53 momjian Exp $
|
||||
* $Id: pgcrypto.c,v 1.12 2001/12/30 23:09:41 tgl Exp $
|
||||
*/
|
||||
|
||||
#include <postgres.h>
|
||||
|
@ -556,7 +556,7 @@ find_provider(text *name,
|
|||
|
||||
p = VARDATA(name);
|
||||
for (i = 0; i < len; i++)
|
||||
buf[i] = tolower(p[i]);
|
||||
buf[i] = tolower((unsigned char) p[i]);
|
||||
buf[len] = 0;
|
||||
|
||||
err = provider_lookup(buf, &res);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.85 2001/12/29 21:28:18 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.86 2001/12/30 23:09:41 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -959,7 +959,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
|
|||
if (tzp == NULL)
|
||||
return -1;
|
||||
|
||||
if (isdigit(*field[i]) || ptype != 0)
|
||||
if (isdigit((unsigned char) *field[i]) || ptype != 0)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
|
@ -1573,7 +1573,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
|
|||
/* otherwise, this is a time and/or time zone */
|
||||
else
|
||||
{
|
||||
if (isdigit(*field[i]))
|
||||
if (isdigit((unsigned char) *field[i]))
|
||||
{
|
||||
char *cp;
|
||||
|
||||
|
|
|
@ -1092,7 +1092,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi)
|
|||
|
||||
ReadyToReturn = FALSE;
|
||||
empty_reqs = 0;
|
||||
for (wq = query; isspace(*wq); wq++)
|
||||
for (wq = query; isspace((unsigned char) *wq); wq++)
|
||||
;
|
||||
if (*wq == '\0')
|
||||
empty_reqs = 1;
|
||||
|
|
|
@ -193,7 +193,7 @@ timestamp2stime(const char *str, SIMPLE_TIME *st, BOOL *bZone, int *zone)
|
|||
}
|
||||
for (i = 1; i < 10; i++)
|
||||
{
|
||||
if (!isdigit(rest[i]))
|
||||
if (!isdigit((unsigned char) rest[i]))
|
||||
break;
|
||||
}
|
||||
for (; i < 10; i++)
|
||||
|
@ -1351,7 +1351,7 @@ copy_statement_with_parameters(StatementClass *stmt)
|
|||
while (isspace((unsigned char) old_statement[++opos]));
|
||||
}
|
||||
if (strnicmp(&old_statement[opos], "call", lit_call_len) ||
|
||||
!isspace(old_statement[opos + lit_call_len]))
|
||||
!isspace((unsigned char) old_statement[opos + lit_call_len]))
|
||||
{
|
||||
opos--;
|
||||
continue;
|
||||
|
@ -1407,7 +1407,7 @@ copy_statement_with_parameters(StatementClass *stmt)
|
|||
in_dquote = TRUE;
|
||||
else
|
||||
{
|
||||
if (isspace(oldchar))
|
||||
if (isspace((unsigned char) oldchar))
|
||||
{
|
||||
if (!prev_token_end)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue