summaryrefslogtreecommitdiff
path: root/contrib/ltree
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-09-22 21:39:58 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-09-22 21:39:58 +0000
commitbeca984e5f1c315d02064e69861be112f5a69b3d (patch)
treeb06b0b54e649824380e3b35822c1c054dac24608 /contrib/ltree
parent6d0efd3a092ec60c7e27b53e604cbc87ba3c8e2c (diff)
downloadpostgresql-beca984e5f1c315d02064e69861be112f5a69b3d.tar.gz
Fix bugs in plpgsql and ecpg caused by assuming that isspace() would only
return true for exactly the characters treated as whitespace by their flex scanners. Per report from Victor Snezhko and subsequent investigation. Also fix a passel of unsafe usages of <ctype.h> functions, that is, ye olde char-vs-unsigned-char issue. I won't miss <ctype.h> when we are finally able to stop using it.
Diffstat (limited to 'contrib/ltree')
-rw-r--r--contrib/ltree/crc32.c4
-rw-r--r--contrib/ltree/ltree_io.c10
-rw-r--r--contrib/ltree/ltxtquery_io.c4
3 files changed, 9 insertions, 9 deletions
diff --git a/contrib/ltree/crc32.c b/contrib/ltree/crc32.c
index c114540181..8f37f47fe2 100644
--- a/contrib/ltree/crc32.c
+++ b/contrib/ltree/crc32.c
@@ -1,6 +1,6 @@
/* Both POSIX and CRC32 checksums */
-/* $PostgreSQL: pgsql/contrib/ltree/crc32.c,v 1.6 2006/03/11 04:38:29 momjian Exp $ */
+/* $PostgreSQL: pgsql/contrib/ltree/crc32.c,v 1.7 2006/09/22 21:39:57 tgl Exp $ */
#include <sys/types.h>
#include <stdio.h>
@@ -8,7 +8,7 @@
#ifdef LOWER_NODE
#include <ctype.h>
-#define TOLOWER(x) tolower(x)
+#define TOLOWER(x) tolower((unsigned char) (x))
#else
#define TOLOWER(x) (x)
#endif
diff --git a/contrib/ltree/ltree_io.c b/contrib/ltree/ltree_io.c
index c147887703..eb22894079 100644
--- a/contrib/ltree/ltree_io.c
+++ b/contrib/ltree/ltree_io.c
@@ -1,7 +1,7 @@
/*
* in/out function for ltree and lquery
* Teodor Sigaev <teodor@stack.net>
- * $PostgreSQL: pgsql/contrib/ltree/ltree_io.c,v 1.12 2006/03/11 04:38:29 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/ltree/ltree_io.c,v 1.13 2006/09/22 21:39:57 tgl Exp $
*/
#include "ltree.h"
@@ -332,7 +332,7 @@ lquery_in(PG_FUNCTION_ARGS)
{
if (*ptr == ',')
state = LQPRS_WAITSNUM;
- else if (isdigit((unsigned int) *ptr))
+ else if (isdigit((unsigned char) *ptr))
{
curqlevel->low = atoi(ptr);
state = LQPRS_WAITND;
@@ -342,7 +342,7 @@ lquery_in(PG_FUNCTION_ARGS)
}
else if (state == LQPRS_WAITSNUM)
{
- if (isdigit((unsigned int) *ptr))
+ if (isdigit((unsigned char) *ptr))
{
curqlevel->high = atoi(ptr);
state = LQPRS_WAITCLOSE;
@@ -359,7 +359,7 @@ lquery_in(PG_FUNCTION_ARGS)
{
if (*ptr == '}')
state = LQPRS_WAITEND;
- else if (!isdigit((unsigned int) *ptr))
+ else if (!isdigit((unsigned char) *ptr))
UNCHAR;
}
else if (state == LQPRS_WAITND)
@@ -371,7 +371,7 @@ lquery_in(PG_FUNCTION_ARGS)
}
else if (*ptr == ',')
state = LQPRS_WAITSNUM;
- else if (!isdigit((unsigned int) *ptr))
+ else if (!isdigit((unsigned char) *ptr))
UNCHAR;
}
else if (state == LQPRS_WAITEND)
diff --git a/contrib/ltree/ltxtquery_io.c b/contrib/ltree/ltxtquery_io.c
index 1142bb3fe3..ca6325adf7 100644
--- a/contrib/ltree/ltxtquery_io.c
+++ b/contrib/ltree/ltxtquery_io.c
@@ -1,7 +1,7 @@
/*
* txtquery io
* Teodor Sigaev <teodor@stack.net>
- * $PostgreSQL: pgsql/contrib/ltree/ltxtquery_io.c,v 1.11 2006/03/11 04:38:29 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/ltree/ltxtquery_io.c,v 1.12 2006/09/22 21:39:57 tgl Exp $
*/
#include "ltree.h"
@@ -81,7 +81,7 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, uint1
*lenval = 1;
*flag = 0;
}
- else if (!isspace((unsigned int) *(state->buf)))
+ else if (!isspace((unsigned char) *(state->buf)))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("operand syntax error")));