diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-03-01 03:26:35 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-03-01 03:26:35 +0000 |
commit | e04fa58dcdf59e480db4a65be3d731d45a99fa3d (patch) | |
tree | 0de141a156f57d26d81d66248d999384e578bfd4 /src/backend/utils/adt/like_match.c | |
parent | 3bf822c4d722d6245a65abdd2502a9d26ab990d5 (diff) | |
download | postgresql-e04fa58dcdf59e480db4a65be3d731d45a99fa3d.tar.gz postgresql-e04fa58dcdf59e480db4a65be3d731d45a99fa3d.zip |
Fix unportable usages of tolower(). On signed-char machines, it is necessary
to explicitly cast the output back to char before comparing it to a char
value, else we get the wrong result for high-bit-set characters. Found by
Rolf Jentsch. Also, fix several places where <ctype.h> functions were being
called without casting the argument to unsigned char; this is likewise
unportable, but we keep making that mistake :-(. These found by buildfarm
member salamander, which I will desperately miss if it ever goes belly-up.
Diffstat (limited to 'src/backend/utils/adt/like_match.c')
-rw-r--r-- | src/backend/utils/adt/like_match.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/utils/adt/like_match.c b/src/backend/utils/adt/like_match.c index 915b9bd0d7e..4a8f96c7d40 100644 --- a/src/backend/utils/adt/like_match.c +++ b/src/backend/utils/adt/like_match.c @@ -19,7 +19,7 @@ * Copyright (c) 1996-2008, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.20 2008/01/01 19:45:52 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.21 2008/03/01 03:26:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -71,7 +71,7 @@ */ #ifdef MATCH_LOWER -#define TCHAR(t) tolower((t)) +#define TCHAR(t) ((char) tolower((unsigned char) (t))) #else #define TCHAR(t) (t) #endif |