mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Suppress signed-vs-unsigned-char warnings.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* Portions Copyright (c) 1999-2005, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/ascii.c,v 1.24 2005/01/01 05:43:07 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/ascii.c,v 1.25 2005/09/24 17:53:15 tgl Exp $
|
||||
*
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
@@ -42,7 +42,7 @@ pg_to_ascii(unsigned char *src, unsigned char *src_end, unsigned char *dest, int
|
||||
/*
|
||||
* ISO-8859-1 <range: 160 -- 255>
|
||||
*/
|
||||
ascii = " cL Y \"Ca -R 'u ., ?AAAAAAACEEEEIIII NOOOOOxOUUUUYTBaaaaaaaceeeeiiii nooooo/ouuuuyty";
|
||||
ascii = (const unsigned char *) " cL Y \"Ca -R 'u ., ?AAAAAAACEEEEIIII NOOOOOxOUUUUYTBaaaaaaaceeeeiiii nooooo/ouuuuyty";
|
||||
range = RANGE_160;
|
||||
}
|
||||
else if (enc == PG_LATIN2)
|
||||
@@ -50,7 +50,7 @@ pg_to_ascii(unsigned char *src, unsigned char *src_end, unsigned char *dest, int
|
||||
/*
|
||||
* ISO-8859-2 <range: 160 -- 255>
|
||||
*/
|
||||
ascii = " A L LS \"SSTZ-ZZ a,l'ls ,sstz\"zzRAAAALCCCEEEEIIDDNNOOOOxRUUUUYTBraaaalccceeeeiiddnnoooo/ruuuuyt.";
|
||||
ascii = (const unsigned char *) " A L LS \"SSTZ-ZZ a,l'ls ,sstz\"zzRAAAALCCCEEEEIIDDNNOOOOxRUUUUYTBraaaalccceeeeiiddnnoooo/ruuuuyt.";
|
||||
range = RANGE_160;
|
||||
}
|
||||
else if (enc == PG_LATIN9)
|
||||
@@ -58,7 +58,7 @@ pg_to_ascii(unsigned char *src, unsigned char *src_end, unsigned char *dest, int
|
||||
/*
|
||||
* ISO-8859-15 <range: 160 -- 255>
|
||||
*/
|
||||
ascii = " cL YS sCa -R Zu .z EeY?AAAAAAACEEEEIIII NOOOOOxOUUUUYTBaaaaaaaceeeeiiii nooooo/ouuuuyty";
|
||||
ascii = (const unsigned char *) " cL YS sCa -R Zu .z EeY?AAAAAAACEEEEIIII NOOOOOxOUUUUYTBaaaaaaaceeeeiiii nooooo/ouuuuyty";
|
||||
range = RANGE_160;
|
||||
}
|
||||
else if (enc == PG_WIN1250)
|
||||
@@ -66,7 +66,7 @@ pg_to_ascii(unsigned char *src, unsigned char *src_end, unsigned char *dest, int
|
||||
/*
|
||||
* Window CP1250 <range: 128 -- 255>
|
||||
*/
|
||||
ascii = " ' \" %S<STZZ `'\"\".-- s>stzz L A \"CS -RZ ,l'u .,as L\"lzRAAAALCCCEEEEIIDDNNOOOOxRUUUUYTBraaaalccceeeeiiddnnoooo/ruuuuyt ";
|
||||
ascii = (const unsigned char *) " ' \" %S<STZZ `'\"\".-- s>stzz L A \"CS -RZ ,l'u .,as L\"lzRAAAALCCCEEEEIIDDNNOOOOxRUUUUYTBraaaalccceeeeiiddnnoooo/ruuuuyt ";
|
||||
range = RANGE_128;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/encode.c,v 1.14 2005/01/01 05:43:07 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/encode.c,v 1.15 2005/09/24 17:53:15 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -20,10 +20,10 @@
|
||||
|
||||
struct pg_encoding
|
||||
{
|
||||
unsigned (*encode_len) (const uint8 *data, unsigned dlen);
|
||||
unsigned (*decode_len) (const uint8 *data, unsigned dlen);
|
||||
unsigned (*encode) (const uint8 *data, unsigned dlen, uint8 *res);
|
||||
unsigned (*decode) (const uint8 *data, unsigned dlen, uint8 *res);
|
||||
unsigned (*encode_len) (const char *data, unsigned dlen);
|
||||
unsigned (*decode_len) (const char *data, unsigned dlen);
|
||||
unsigned (*encode) (const char *data, unsigned dlen, char *res);
|
||||
unsigned (*decode) (const char *data, unsigned dlen, char *res);
|
||||
};
|
||||
|
||||
static struct pg_encoding *pg_find_encoding(const char *name);
|
||||
@@ -123,9 +123,9 @@ static const int8 hexlookup[128] = {
|
||||
};
|
||||
|
||||
static unsigned
|
||||
hex_encode(const uint8 *src, unsigned len, uint8 *dst)
|
||||
hex_encode(const char *src, unsigned len, char *dst)
|
||||
{
|
||||
const uint8 *end = src + len;
|
||||
const char *end = src + len;
|
||||
|
||||
while (src < end)
|
||||
{
|
||||
@@ -136,28 +136,28 @@ hex_encode(const uint8 *src, unsigned len, uint8 *dst)
|
||||
return len * 2;
|
||||
}
|
||||
|
||||
static uint8
|
||||
get_hex(unsigned c)
|
||||
static char
|
||||
get_hex(char c)
|
||||
{
|
||||
int res = -1;
|
||||
|
||||
if (c > 0 && c < 127)
|
||||
res = hexlookup[c];
|
||||
res = hexlookup[(unsigned char) c];
|
||||
|
||||
if (res < 0)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("invalid hexadecimal digit: \"%c\"", c)));
|
||||
|
||||
return (uint8) res;
|
||||
return (char) res;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
hex_decode(const uint8 *src, unsigned len, uint8 *dst)
|
||||
hex_decode(const char *src, unsigned len, char *dst)
|
||||
{
|
||||
const uint8 *s,
|
||||
const char *s,
|
||||
*srcend;
|
||||
uint8 v1,
|
||||
char v1,
|
||||
v2,
|
||||
*p = dst;
|
||||
|
||||
@@ -185,13 +185,13 @@ hex_decode(const uint8 *src, unsigned len, uint8 *dst)
|
||||
}
|
||||
|
||||
static unsigned
|
||||
hex_enc_len(const uint8 *src, unsigned srclen)
|
||||
hex_enc_len(const char *src, unsigned srclen)
|
||||
{
|
||||
return srclen << 1;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
hex_dec_len(const uint8 *src, unsigned srclen)
|
||||
hex_dec_len(const char *src, unsigned srclen)
|
||||
{
|
||||
return srclen >> 1;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ hex_dec_len(const uint8 *src, unsigned srclen)
|
||||
* BASE64
|
||||
*/
|
||||
|
||||
static const unsigned char _base64[] =
|
||||
static const char _base64[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
static const int8 b64lookup[128] = {
|
||||
@@ -215,11 +215,11 @@ static const int8 b64lookup[128] = {
|
||||
};
|
||||
|
||||
static unsigned
|
||||
b64_encode(const uint8 *src, unsigned len, uint8 *dst)
|
||||
b64_encode(const char *src, unsigned len, char *dst)
|
||||
{
|
||||
uint8 *p,
|
||||
char *p,
|
||||
*lend = dst + 76;
|
||||
const uint8 *s,
|
||||
const char *s,
|
||||
*end = src + len;
|
||||
int pos = 2;
|
||||
uint32 buf = 0;
|
||||
@@ -229,7 +229,7 @@ b64_encode(const uint8 *src, unsigned len, uint8 *dst)
|
||||
|
||||
while (s < end)
|
||||
{
|
||||
buf |= *s << (pos << 3);
|
||||
buf |= (unsigned char) *s << (pos << 3);
|
||||
pos--;
|
||||
s++;
|
||||
|
||||
@@ -262,12 +262,12 @@ b64_encode(const uint8 *src, unsigned len, uint8 *dst)
|
||||
}
|
||||
|
||||
static unsigned
|
||||
b64_decode(const uint8 *src, unsigned len, uint8 *dst)
|
||||
b64_decode(const char *src, unsigned len, char *dst)
|
||||
{
|
||||
const char *srcend = src + len,
|
||||
*s = src;
|
||||
uint8 *p = dst;
|
||||
unsigned c;
|
||||
char *p = dst;
|
||||
char c;
|
||||
int b = 0;
|
||||
uint32 buf = 0;
|
||||
int pos = 0,
|
||||
@@ -300,7 +300,7 @@ b64_decode(const uint8 *src, unsigned len, uint8 *dst)
|
||||
{
|
||||
b = -1;
|
||||
if (c > 0 && c < 127)
|
||||
b = b64lookup[c];
|
||||
b = b64lookup[(unsigned char) c];
|
||||
if (b < 0)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
@@ -331,14 +331,14 @@ b64_decode(const uint8 *src, unsigned len, uint8 *dst)
|
||||
|
||||
|
||||
static unsigned
|
||||
b64_enc_len(const uint8 *src, unsigned srclen)
|
||||
b64_enc_len(const char *src, unsigned srclen)
|
||||
{
|
||||
/* 3 bytes will be converted to 4, linefeed after 76 chars */
|
||||
return (srclen + 2) * 4 / 3 + srclen / (76 * 3 / 4);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
b64_dec_len(const uint8 *src, unsigned srclen)
|
||||
b64_dec_len(const char *src, unsigned srclen)
|
||||
{
|
||||
return (srclen * 3) >> 2;
|
||||
}
|
||||
@@ -358,10 +358,10 @@ b64_dec_len(const uint8 *src, unsigned srclen)
|
||||
#define DIG(VAL) ((VAL) + '0')
|
||||
|
||||
static unsigned
|
||||
esc_encode(const uint8 *src, unsigned srclen, uint8 *dst)
|
||||
esc_encode(const char *src, unsigned srclen, char *dst)
|
||||
{
|
||||
const uint8 *end = src + srclen;
|
||||
uint8 *rp = dst;
|
||||
const char *end = src + srclen;
|
||||
char *rp = dst;
|
||||
int len = 0;
|
||||
|
||||
while (src < end)
|
||||
@@ -395,10 +395,10 @@ esc_encode(const uint8 *src, unsigned srclen, uint8 *dst)
|
||||
}
|
||||
|
||||
static unsigned
|
||||
esc_decode(const uint8 *src, unsigned srclen, uint8 *dst)
|
||||
esc_decode(const char *src, unsigned srclen, char *dst)
|
||||
{
|
||||
const uint8 *end = src + srclen;
|
||||
uint8 *rp = dst;
|
||||
const char *end = src + srclen;
|
||||
char *rp = dst;
|
||||
int len = 0;
|
||||
|
||||
while (src < end)
|
||||
@@ -443,9 +443,9 @@ esc_decode(const uint8 *src, unsigned srclen, uint8 *dst)
|
||||
}
|
||||
|
||||
static unsigned
|
||||
esc_enc_len(const uint8 *src, unsigned srclen)
|
||||
esc_enc_len(const char *src, unsigned srclen)
|
||||
{
|
||||
const uint8 *end = src + srclen;
|
||||
const char *end = src + srclen;
|
||||
int len = 0;
|
||||
|
||||
while (src < end)
|
||||
@@ -464,9 +464,9 @@ esc_enc_len(const uint8 *src, unsigned srclen)
|
||||
}
|
||||
|
||||
static unsigned
|
||||
esc_dec_len(const uint8 *src, unsigned srclen)
|
||||
esc_dec_len(const char *src, unsigned srclen)
|
||||
{
|
||||
const uint8 *end = src + srclen;
|
||||
const char *end = src + srclen;
|
||||
int len = 0;
|
||||
|
||||
while (src < end)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/like.c,v 1.60 2005/05/25 22:59:33 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/like.c,v 1.61 2005/09/24 17:53:15 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -28,18 +28,13 @@
|
||||
#define LIKE_ABORT (-1)
|
||||
|
||||
|
||||
static int MatchText(unsigned char *t, int tlen,
|
||||
unsigned char *p, int plen);
|
||||
static int MatchTextIC(unsigned char *t, int tlen,
|
||||
unsigned char *p, int plen);
|
||||
static int MatchBytea(unsigned char *t, int tlen,
|
||||
unsigned char *p, int plen);
|
||||
static int MatchText(char *t, int tlen, char *p, int plen);
|
||||
static int MatchTextIC(char *t, int tlen, char *p, int plen);
|
||||
static int MatchBytea(char *t, int tlen, char *p, int plen);
|
||||
static text *do_like_escape(text *, text *);
|
||||
|
||||
static int MBMatchText(unsigned char *t, int tlen,
|
||||
unsigned char *p, int plen);
|
||||
static int MBMatchTextIC(unsigned char *t, int tlen,
|
||||
unsigned char *p, int plen);
|
||||
static int MBMatchText(char *t, int tlen, char *p, int plen);
|
||||
static int MBMatchTextIC(char *t, int tlen, char *p, int plen);
|
||||
static text *MB_do_like_escape(text *, text *);
|
||||
|
||||
/*--------------------
|
||||
@@ -48,7 +43,7 @@ static text *MB_do_like_escape(text *, text *);
|
||||
*--------------------
|
||||
*/
|
||||
static int
|
||||
wchareq(unsigned char *p1, unsigned char *p2)
|
||||
wchareq(char *p1, char *p2)
|
||||
{
|
||||
int p1_len;
|
||||
|
||||
@@ -78,9 +73,9 @@ wchareq(unsigned char *p1, unsigned char *p2)
|
||||
#define CHARMAX 0x80
|
||||
|
||||
static int
|
||||
iwchareq(unsigned char *p1, unsigned char *p2)
|
||||
iwchareq(char *p1, char *p2)
|
||||
{
|
||||
int c1[2],
|
||||
pg_wchar c1[2],
|
||||
c2[2];
|
||||
int l;
|
||||
|
||||
@@ -88,14 +83,14 @@ iwchareq(unsigned char *p1, unsigned char *p2)
|
||||
* short cut. if *p1 and *p2 is lower than CHARMAX, then we could
|
||||
* assume they are ASCII
|
||||
*/
|
||||
if (*p1 < CHARMAX && *p2 < CHARMAX)
|
||||
return (tolower(*p1) == tolower(*p2));
|
||||
if ((unsigned char) *p1 < CHARMAX && (unsigned char) *p2 < CHARMAX)
|
||||
return (tolower((unsigned char) *p1) == tolower((unsigned char) *p2));
|
||||
|
||||
/*
|
||||
* if one of them is an ASCII while the other is not, then they must
|
||||
* be different characters
|
||||
*/
|
||||
else if (*p1 < CHARMAX || *p2 < CHARMAX)
|
||||
else if ((unsigned char) *p1 < CHARMAX || (unsigned char) *p2 < CHARMAX)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
@@ -103,10 +98,10 @@ iwchareq(unsigned char *p1, unsigned char *p2)
|
||||
* characters
|
||||
*/
|
||||
l = pg_mblen(p1);
|
||||
(void) pg_mb2wchar_with_len(p1, (pg_wchar *) c1, l);
|
||||
(void) pg_mb2wchar_with_len(p1, c1, l);
|
||||
c1[0] = tolower(c1[0]);
|
||||
l = pg_mblen(p2);
|
||||
(void) pg_mb2wchar_with_len(p2, (pg_wchar *) c2, l);
|
||||
(void) pg_mb2wchar_with_len(p2, c2, l);
|
||||
c2[0] = tolower(c2[0]);
|
||||
return (c1[0] == c2[0]);
|
||||
}
|
||||
@@ -135,7 +130,7 @@ iwchareq(unsigned char *p1, unsigned char *p2)
|
||||
#undef do_like_escape
|
||||
|
||||
#define CHAREQ(p1, p2) (*(p1) == *(p2))
|
||||
#define ICHAREQ(p1, p2) (tolower(*(p1)) == tolower(*(p2)))
|
||||
#define ICHAREQ(p1, p2) (tolower((unsigned char) *(p1)) == tolower((unsigned char) *(p2)))
|
||||
#define NextChar(p, plen) ((p)++, (plen)--)
|
||||
#define CopyAdvChar(dst, src, srclen) (*(dst)++ = *(src)++, (srclen)--)
|
||||
|
||||
@@ -154,7 +149,7 @@ namelike(PG_FUNCTION_ARGS)
|
||||
Name str = PG_GETARG_NAME(0);
|
||||
text *pat = PG_GETARG_TEXT_P(1);
|
||||
bool result;
|
||||
unsigned char *s,
|
||||
char *s,
|
||||
*p;
|
||||
int slen,
|
||||
plen;
|
||||
@@ -178,7 +173,7 @@ namenlike(PG_FUNCTION_ARGS)
|
||||
Name str = PG_GETARG_NAME(0);
|
||||
text *pat = PG_GETARG_TEXT_P(1);
|
||||
bool result;
|
||||
unsigned char *s,
|
||||
char *s,
|
||||
*p;
|
||||
int slen,
|
||||
plen;
|
||||
@@ -202,7 +197,7 @@ textlike(PG_FUNCTION_ARGS)
|
||||
text *str = PG_GETARG_TEXT_P(0);
|
||||
text *pat = PG_GETARG_TEXT_P(1);
|
||||
bool result;
|
||||
unsigned char *s,
|
||||
char *s,
|
||||
*p;
|
||||
int slen,
|
||||
plen;
|
||||
@@ -226,7 +221,7 @@ textnlike(PG_FUNCTION_ARGS)
|
||||
text *str = PG_GETARG_TEXT_P(0);
|
||||
text *pat = PG_GETARG_TEXT_P(1);
|
||||
bool result;
|
||||
unsigned char *s,
|
||||
char *s,
|
||||
*p;
|
||||
int slen,
|
||||
plen;
|
||||
@@ -250,7 +245,7 @@ bytealike(PG_FUNCTION_ARGS)
|
||||
bytea *str = PG_GETARG_BYTEA_P(0);
|
||||
bytea *pat = PG_GETARG_BYTEA_P(1);
|
||||
bool result;
|
||||
unsigned char *s,
|
||||
char *s,
|
||||
*p;
|
||||
int slen,
|
||||
plen;
|
||||
@@ -271,7 +266,7 @@ byteanlike(PG_FUNCTION_ARGS)
|
||||
bytea *str = PG_GETARG_BYTEA_P(0);
|
||||
bytea *pat = PG_GETARG_BYTEA_P(1);
|
||||
bool result;
|
||||
unsigned char *s,
|
||||
char *s,
|
||||
*p;
|
||||
int slen,
|
||||
plen;
|
||||
@@ -296,7 +291,7 @@ nameiclike(PG_FUNCTION_ARGS)
|
||||
Name str = PG_GETARG_NAME(0);
|
||||
text *pat = PG_GETARG_TEXT_P(1);
|
||||
bool result;
|
||||
unsigned char *s,
|
||||
char *s,
|
||||
*p;
|
||||
int slen,
|
||||
plen;
|
||||
@@ -320,7 +315,7 @@ nameicnlike(PG_FUNCTION_ARGS)
|
||||
Name str = PG_GETARG_NAME(0);
|
||||
text *pat = PG_GETARG_TEXT_P(1);
|
||||
bool result;
|
||||
unsigned char *s,
|
||||
char *s,
|
||||
*p;
|
||||
int slen,
|
||||
plen;
|
||||
@@ -344,7 +339,7 @@ texticlike(PG_FUNCTION_ARGS)
|
||||
text *str = PG_GETARG_TEXT_P(0);
|
||||
text *pat = PG_GETARG_TEXT_P(1);
|
||||
bool result;
|
||||
unsigned char *s,
|
||||
char *s,
|
||||
*p;
|
||||
int slen,
|
||||
plen;
|
||||
@@ -368,7 +363,7 @@ texticnlike(PG_FUNCTION_ARGS)
|
||||
text *str = PG_GETARG_TEXT_P(0);
|
||||
text *pat = PG_GETARG_TEXT_P(1);
|
||||
bool result;
|
||||
unsigned char *s,
|
||||
char *s,
|
||||
*p;
|
||||
int slen,
|
||||
plen;
|
||||
@@ -415,7 +410,7 @@ like_escape_bytea(PG_FUNCTION_ARGS)
|
||||
bytea *pat = PG_GETARG_BYTEA_P(0);
|
||||
bytea *esc = PG_GETARG_BYTEA_P(1);
|
||||
bytea *result;
|
||||
unsigned char *p,
|
||||
char *p,
|
||||
*e,
|
||||
*r;
|
||||
int plen,
|
||||
@@ -500,7 +495,7 @@ like_escape_bytea(PG_FUNCTION_ARGS)
|
||||
}
|
||||
}
|
||||
|
||||
VARATT_SIZEP(result) = r - ((unsigned char *) result);
|
||||
VARATT_SIZEP(result) = r - ((char *) result);
|
||||
|
||||
PG_RETURN_BYTEA_P(result);
|
||||
}
|
||||
@@ -509,7 +504,7 @@ like_escape_bytea(PG_FUNCTION_ARGS)
|
||||
* Same as above, but specifically for bytea (binary) datatype
|
||||
*/
|
||||
static int
|
||||
MatchBytea(unsigned char *t, int tlen, unsigned char *p, int plen)
|
||||
MatchBytea(char *t, int tlen, char *p, int plen)
|
||||
{
|
||||
/* Fast path for match-everything pattern */
|
||||
if ((plen == 1) && (*p == '%'))
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.10 2004/12/31 22:01:22 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.11 2005/09/24 17:53:15 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -71,7 +71,7 @@
|
||||
*/
|
||||
|
||||
static int
|
||||
MatchText(unsigned char *t, int tlen, unsigned char *p, int plen)
|
||||
MatchText(char *t, int tlen, char *p, int plen)
|
||||
{
|
||||
/* Fast path for match-everything pattern */
|
||||
if ((plen == 1) && (*p == '%'))
|
||||
@@ -157,7 +157,7 @@ MatchText(unsigned char *t, int tlen, unsigned char *p, int plen)
|
||||
* Same as above, but ignore case
|
||||
*/
|
||||
static int
|
||||
MatchTextIC(unsigned char *t, int tlen, unsigned char *p, int plen)
|
||||
MatchTextIC(char *t, int tlen, char *p, int plen)
|
||||
{
|
||||
/* Fast path for match-everything pattern */
|
||||
if ((plen == 1) && (*p == '%'))
|
||||
@@ -247,7 +247,7 @@ static text *
|
||||
do_like_escape(text *pat, text *esc)
|
||||
{
|
||||
text *result;
|
||||
unsigned char *p,
|
||||
char *p,
|
||||
*e,
|
||||
*r;
|
||||
int plen,
|
||||
@@ -332,7 +332,7 @@ do_like_escape(text *pat, text *esc)
|
||||
}
|
||||
}
|
||||
|
||||
VARATT_SIZEP(result) = r - ((unsigned char *) result);
|
||||
VARATT_SIZEP(result) = r - ((char *) result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.57 2005/07/10 04:54:30 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.58 2005/09/24 17:53:15 tgl Exp $
|
||||
*
|
||||
* Alistair Crooks added the code for the regex caching
|
||||
* agc - cached the regular expressions used - there's a good chance
|
||||
@@ -134,7 +134,7 @@ RE_compile_and_cache(text *text_re, int cflags)
|
||||
|
||||
/* Convert pattern string to wide characters */
|
||||
pattern = (pg_wchar *) palloc((text_re_len - VARHDRSZ + 1) * sizeof(pg_wchar));
|
||||
pattern_len = pg_mb2wchar_with_len((unsigned char *) VARDATA(text_re),
|
||||
pattern_len = pg_mb2wchar_with_len(VARDATA(text_re),
|
||||
pattern,
|
||||
text_re_len - VARHDRSZ);
|
||||
|
||||
@@ -206,7 +206,7 @@ RE_compile_and_cache(text *text_re, int cflags)
|
||||
* convert to array of pg_wchar which is what Spencer's regex package wants.
|
||||
*/
|
||||
static bool
|
||||
RE_compile_and_execute(text *text_re, unsigned char *dat, int dat_len,
|
||||
RE_compile_and_execute(text *text_re, char *dat, int dat_len,
|
||||
int cflags, int nmatch, regmatch_t *pmatch)
|
||||
{
|
||||
pg_wchar *data;
|
||||
@@ -287,7 +287,7 @@ nameregexeq(PG_FUNCTION_ARGS)
|
||||
text *p = PG_GETARG_TEXT_P(1);
|
||||
|
||||
PG_RETURN_BOOL(RE_compile_and_execute(p,
|
||||
(unsigned char *) NameStr(*n),
|
||||
NameStr(*n),
|
||||
strlen(NameStr(*n)),
|
||||
regex_flavor,
|
||||
0, NULL));
|
||||
@@ -300,7 +300,7 @@ nameregexne(PG_FUNCTION_ARGS)
|
||||
text *p = PG_GETARG_TEXT_P(1);
|
||||
|
||||
PG_RETURN_BOOL(!RE_compile_and_execute(p,
|
||||
(unsigned char *) NameStr(*n),
|
||||
NameStr(*n),
|
||||
strlen(NameStr(*n)),
|
||||
regex_flavor,
|
||||
0, NULL));
|
||||
@@ -313,7 +313,7 @@ textregexeq(PG_FUNCTION_ARGS)
|
||||
text *p = PG_GETARG_TEXT_P(1);
|
||||
|
||||
PG_RETURN_BOOL(RE_compile_and_execute(p,
|
||||
(unsigned char *) VARDATA(s),
|
||||
VARDATA(s),
|
||||
VARSIZE(s) - VARHDRSZ,
|
||||
regex_flavor,
|
||||
0, NULL));
|
||||
@@ -326,7 +326,7 @@ textregexne(PG_FUNCTION_ARGS)
|
||||
text *p = PG_GETARG_TEXT_P(1);
|
||||
|
||||
PG_RETURN_BOOL(!RE_compile_and_execute(p,
|
||||
(unsigned char *) VARDATA(s),
|
||||
VARDATA(s),
|
||||
VARSIZE(s) - VARHDRSZ,
|
||||
regex_flavor,
|
||||
0, NULL));
|
||||
@@ -346,7 +346,7 @@ nameicregexeq(PG_FUNCTION_ARGS)
|
||||
text *p = PG_GETARG_TEXT_P(1);
|
||||
|
||||
PG_RETURN_BOOL(RE_compile_and_execute(p,
|
||||
(unsigned char *) NameStr(*n),
|
||||
NameStr(*n),
|
||||
strlen(NameStr(*n)),
|
||||
regex_flavor | REG_ICASE,
|
||||
0, NULL));
|
||||
@@ -359,7 +359,7 @@ nameicregexne(PG_FUNCTION_ARGS)
|
||||
text *p = PG_GETARG_TEXT_P(1);
|
||||
|
||||
PG_RETURN_BOOL(!RE_compile_and_execute(p,
|
||||
(unsigned char *) NameStr(*n),
|
||||
NameStr(*n),
|
||||
strlen(NameStr(*n)),
|
||||
regex_flavor | REG_ICASE,
|
||||
0, NULL));
|
||||
@@ -372,7 +372,7 @@ texticregexeq(PG_FUNCTION_ARGS)
|
||||
text *p = PG_GETARG_TEXT_P(1);
|
||||
|
||||
PG_RETURN_BOOL(RE_compile_and_execute(p,
|
||||
(unsigned char *) VARDATA(s),
|
||||
VARDATA(s),
|
||||
VARSIZE(s) - VARHDRSZ,
|
||||
regex_flavor | REG_ICASE,
|
||||
0, NULL));
|
||||
@@ -385,7 +385,7 @@ texticregexne(PG_FUNCTION_ARGS)
|
||||
text *p = PG_GETARG_TEXT_P(1);
|
||||
|
||||
PG_RETURN_BOOL(!RE_compile_and_execute(p,
|
||||
(unsigned char *) VARDATA(s),
|
||||
VARDATA(s),
|
||||
VARSIZE(s) - VARHDRSZ,
|
||||
regex_flavor | REG_ICASE,
|
||||
0, NULL));
|
||||
@@ -411,7 +411,7 @@ textregexsubstr(PG_FUNCTION_ARGS)
|
||||
* matched; else return what the whole regexp matched.
|
||||
*/
|
||||
match = RE_compile_and_execute(p,
|
||||
(unsigned char *) VARDATA(s),
|
||||
VARDATA(s),
|
||||
VARSIZE(s) - VARHDRSZ,
|
||||
regex_flavor,
|
||||
2, pmatch);
|
||||
@@ -524,7 +524,7 @@ similar_escape(PG_FUNCTION_ARGS)
|
||||
text *pat_text;
|
||||
text *esc_text;
|
||||
text *result;
|
||||
unsigned char *p,
|
||||
char *p,
|
||||
*e,
|
||||
*r;
|
||||
int plen,
|
||||
@@ -566,7 +566,7 @@ similar_escape(PG_FUNCTION_ARGS)
|
||||
|
||||
while (plen > 0)
|
||||
{
|
||||
unsigned char pchar = *p;
|
||||
char pchar = *p;
|
||||
|
||||
if (afterescape)
|
||||
{
|
||||
@@ -604,7 +604,7 @@ similar_escape(PG_FUNCTION_ARGS)
|
||||
|
||||
*r++ = '$';
|
||||
|
||||
VARATT_SIZEP(result) = r - ((unsigned char *) result);
|
||||
VARATT_SIZEP(result) = r - ((char *) result);
|
||||
|
||||
PG_RETURN_TEXT_P(result);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.187 2005/07/21 04:41:43 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.188 2005/09/24 17:53:16 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -135,11 +135,11 @@ static bool convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue,
|
||||
Datum lobound, Datum hibound, Oid boundstypid,
|
||||
double *scaledlobound, double *scaledhibound);
|
||||
static double convert_numeric_to_scalar(Datum value, Oid typid);
|
||||
static void convert_string_to_scalar(unsigned char *value,
|
||||
static void convert_string_to_scalar(char *value,
|
||||
double *scaledvalue,
|
||||
unsigned char *lobound,
|
||||
char *lobound,
|
||||
double *scaledlobound,
|
||||
unsigned char *hibound,
|
||||
char *hibound,
|
||||
double *scaledhibound);
|
||||
static void convert_bytea_to_scalar(Datum value,
|
||||
double *scaledvalue,
|
||||
@@ -147,11 +147,11 @@ static void convert_bytea_to_scalar(Datum value,
|
||||
double *scaledlobound,
|
||||
Datum hibound,
|
||||
double *scaledhibound);
|
||||
static double convert_one_string_to_scalar(unsigned char *value,
|
||||
static double convert_one_string_to_scalar(char *value,
|
||||
int rangelo, int rangehi);
|
||||
static double convert_one_bytea_to_scalar(unsigned char *value, int valuelen,
|
||||
int rangelo, int rangehi);
|
||||
static unsigned char *convert_string_datum(Datum value, Oid typid);
|
||||
static char *convert_string_datum(Datum value, Oid typid);
|
||||
static double convert_timevalue_to_scalar(Datum value, Oid typid);
|
||||
static bool get_restriction_variable(PlannerInfo *root, List *args, int varRelid,
|
||||
VariableStatData *vardata, Node **other,
|
||||
@@ -2350,9 +2350,9 @@ convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue,
|
||||
case TEXTOID:
|
||||
case NAMEOID:
|
||||
{
|
||||
unsigned char *valstr = convert_string_datum(value, valuetypid);
|
||||
unsigned char *lostr = convert_string_datum(lobound, boundstypid);
|
||||
unsigned char *histr = convert_string_datum(hibound, boundstypid);
|
||||
char *valstr = convert_string_datum(value, valuetypid);
|
||||
char *lostr = convert_string_datum(lobound, boundstypid);
|
||||
char *histr = convert_string_datum(hibound, boundstypid);
|
||||
|
||||
convert_string_to_scalar(valstr, scaledvalue,
|
||||
lostr, scaledlobound,
|
||||
@@ -2471,31 +2471,31 @@ convert_numeric_to_scalar(Datum value, Oid typid)
|
||||
* so this is more likely to happen than you might think.)
|
||||
*/
|
||||
static void
|
||||
convert_string_to_scalar(unsigned char *value,
|
||||
convert_string_to_scalar(char *value,
|
||||
double *scaledvalue,
|
||||
unsigned char *lobound,
|
||||
char *lobound,
|
||||
double *scaledlobound,
|
||||
unsigned char *hibound,
|
||||
char *hibound,
|
||||
double *scaledhibound)
|
||||
{
|
||||
int rangelo,
|
||||
rangehi;
|
||||
unsigned char *sptr;
|
||||
char *sptr;
|
||||
|
||||
rangelo = rangehi = hibound[0];
|
||||
rangelo = rangehi = (unsigned char) hibound[0];
|
||||
for (sptr = lobound; *sptr; sptr++)
|
||||
{
|
||||
if (rangelo > *sptr)
|
||||
rangelo = *sptr;
|
||||
if (rangehi < *sptr)
|
||||
rangehi = *sptr;
|
||||
if (rangelo > (unsigned char) *sptr)
|
||||
rangelo = (unsigned char) *sptr;
|
||||
if (rangehi < (unsigned char) *sptr)
|
||||
rangehi = (unsigned char) *sptr;
|
||||
}
|
||||
for (sptr = hibound; *sptr; sptr++)
|
||||
{
|
||||
if (rangelo > *sptr)
|
||||
rangelo = *sptr;
|
||||
if (rangehi < *sptr)
|
||||
rangehi = *sptr;
|
||||
if (rangelo > (unsigned char) *sptr)
|
||||
rangelo = (unsigned char) *sptr;
|
||||
if (rangehi < (unsigned char) *sptr)
|
||||
rangehi = (unsigned char) *sptr;
|
||||
}
|
||||
/* If range includes any upper-case ASCII chars, make it include all */
|
||||
if (rangelo <= 'Z' && rangehi >= 'A')
|
||||
@@ -2551,9 +2551,9 @@ convert_string_to_scalar(unsigned char *value,
|
||||
}
|
||||
|
||||
static double
|
||||
convert_one_string_to_scalar(unsigned char *value, int rangelo, int rangehi)
|
||||
convert_one_string_to_scalar(char *value, int rangelo, int rangehi)
|
||||
{
|
||||
int slen = strlen((char *) value);
|
||||
int slen = strlen(value);
|
||||
double num,
|
||||
denom,
|
||||
base;
|
||||
@@ -2574,7 +2574,7 @@ convert_one_string_to_scalar(unsigned char *value, int rangelo, int rangehi)
|
||||
denom = base;
|
||||
while (slen-- > 0)
|
||||
{
|
||||
int ch = *value++;
|
||||
int ch = (unsigned char) *value++;
|
||||
|
||||
if (ch < rangelo)
|
||||
ch = rangelo - 1;
|
||||
@@ -2593,7 +2593,7 @@ convert_one_string_to_scalar(unsigned char *value, int rangelo, int rangehi)
|
||||
* When using a non-C locale, we must pass the string through strxfrm()
|
||||
* before continuing, so as to generate correct locale-specific results.
|
||||
*/
|
||||
static unsigned char *
|
||||
static char *
|
||||
convert_string_datum(Datum value, Oid typid)
|
||||
{
|
||||
char *val;
|
||||
@@ -2660,7 +2660,7 @@ convert_string_datum(Datum value, Oid typid)
|
||||
val = xfrmstr;
|
||||
}
|
||||
|
||||
return (unsigned char *) val;
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4104,8 +4104,7 @@ make_greater_string(const Const *str_const)
|
||||
if (datatype != BYTEAOID)
|
||||
{
|
||||
/* do not generate invalid encoding sequences */
|
||||
if (!pg_verifymbstr((const unsigned char *) workstr,
|
||||
len, true))
|
||||
if (!pg_verifymbstr(workstr, len, true))
|
||||
continue;
|
||||
workstr_const = string_to_const(workstr, datatype);
|
||||
}
|
||||
@@ -4124,7 +4123,7 @@ make_greater_string(const Const *str_const)
|
||||
* byte, depending on the character encoding.
|
||||
*/
|
||||
if (datatype != BYTEAOID && pg_database_encoding_max_length() > 1)
|
||||
len = pg_mbcliplen((const unsigned char *) workstr, len, len - 1);
|
||||
len = pg_mbcliplen(workstr, len, len - 1);
|
||||
else
|
||||
len -= 1;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.45 2005/07/10 21:13:59 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.46 2005/09/24 17:53:16 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -555,7 +555,7 @@ varbit_send(PG_FUNCTION_ARGS)
|
||||
|
||||
pq_begintypsend(&buf);
|
||||
pq_sendint(&buf, VARBITLEN(s), sizeof(int32));
|
||||
pq_sendbytes(&buf, VARBITS(s), VARBITBYTES(s));
|
||||
pq_sendbytes(&buf, (char *) VARBITS(s), VARBITBYTES(s));
|
||||
PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.134 2005/09/16 04:13:17 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.135 2005/09/24 17:53:16 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -793,10 +793,10 @@ text_position(text *t1, text *t2, int matchnum)
|
||||
*ps2;
|
||||
|
||||
ps1 = p1 = (pg_wchar *) palloc((len1 + 1) * sizeof(pg_wchar));
|
||||
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(t1), p1, len1);
|
||||
(void) pg_mb2wchar_with_len(VARDATA(t1), p1, len1);
|
||||
len1 = pg_wchar_strlen(p1);
|
||||
ps2 = p2 = (pg_wchar *) palloc((len2 + 1) * sizeof(pg_wchar));
|
||||
(void) pg_mb2wchar_with_len((unsigned char *) VARDATA(t2), p2, len2);
|
||||
(void) pg_mb2wchar_with_len(VARDATA(t2), p2, len2);
|
||||
len2 = pg_wchar_strlen(p2);
|
||||
|
||||
/* no use in searching str past point where search_str will fit */
|
||||
|
||||
Reference in New Issue
Block a user