mirror of
https://github.com/postgres/postgres.git
synced 2025-12-01 12:18:01 +03:00
pgindent run for 8.2.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conv.c,v 1.60 2006/05/21 20:05:19 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conv.c,v 1.61 2006/10/04 00:30:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ mic2latin(const unsigned char *mic, unsigned char *p, int len,
|
||||
}
|
||||
else
|
||||
{
|
||||
int l = pg_mic_mblen(mic);
|
||||
int l = pg_mic_mblen(mic);
|
||||
|
||||
if (len < l)
|
||||
report_invalid_encoding(PG_MULE_INTERNAL, (const char *) mic,
|
||||
@@ -217,7 +217,7 @@ mic2latin_with_table(const unsigned char *mic,
|
||||
}
|
||||
else
|
||||
{
|
||||
int l = pg_mic_mblen(mic);
|
||||
int l = pg_mic_mblen(mic);
|
||||
|
||||
if (len < l)
|
||||
report_invalid_encoding(PG_MULE_INTERNAL, (const char *) mic,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.15 2006/05/30 22:12:14 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.16 2006/10/04 00:30:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -173,7 +173,7 @@ euc_tw2mic(const unsigned char *euc, unsigned char *p, int len)
|
||||
(const char *) euc, len);
|
||||
if (c1 == SS2)
|
||||
{
|
||||
c1 = euc[1]; /* plane No. */
|
||||
c1 = euc[1]; /* plane No. */
|
||||
if (c1 == 0xa1)
|
||||
*p++ = LC_CNS11643_1;
|
||||
else if (c1 == 0xa2)
|
||||
@@ -187,7 +187,7 @@ euc_tw2mic(const unsigned char *euc, unsigned char *p, int len)
|
||||
*p++ = euc[3];
|
||||
}
|
||||
else
|
||||
{ /* CNS11643-1 */
|
||||
{ /* CNS11643-1 */
|
||||
*p++ = LC_CNS11643_1;
|
||||
*p++ = c1;
|
||||
*p++ = euc[1];
|
||||
@@ -302,7 +302,7 @@ big52mic(const unsigned char *big5, unsigned char *p, int len)
|
||||
{
|
||||
*p++ = 0x9d; /* LCPRV2 */
|
||||
}
|
||||
*p++ = lc; /* Plane No. */
|
||||
*p++ = lc; /* Plane No. */
|
||||
*p++ = (cnsBuf >> 8) & 0x00ff;
|
||||
*p++ = cnsBuf & 0x00ff;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.16 2006/05/30 22:12:15 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.17 2006/10/04 00:30:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -69,4 +69,3 @@ koi8r_to_utf8(PG_FUNCTION_ARGS)
|
||||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.15 2006/05/30 22:12:15 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.16 2006/10/04 00:30:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ utf8_to_gb18030(PG_FUNCTION_ARGS)
|
||||
Assert(len >= 0);
|
||||
|
||||
UtfToLocal(src, dest, ULmapGB18030,
|
||||
sizeof(ULmapGB18030) / sizeof(pg_utf_to_local), PG_GB18030, len);
|
||||
sizeof(ULmapGB18030) / sizeof(pg_utf_to_local), PG_GB18030, len);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.21 2006/07/11 18:26:11 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.22 2006/10/04 00:30:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -118,12 +118,12 @@ iso8859_to_utf8(PG_FUNCTION_ARGS)
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
int i;
|
||||
int i;
|
||||
|
||||
Assert(PG_GETARG_INT32(1) == PG_UTF8);
|
||||
Assert(len >= 0);
|
||||
|
||||
for (i=0;i<sizeof(maps)/sizeof(pg_conv_map);i++)
|
||||
for (i = 0; i < sizeof(maps) / sizeof(pg_conv_map); i++)
|
||||
{
|
||||
if (encoding == maps[i].encoding)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ iso8859_to_utf8(PG_FUNCTION_ARGS)
|
||||
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INTERNAL_ERROR),
|
||||
errmsg("unexpected encoding id %d for ISO-8859 charsets", encoding)));
|
||||
errmsg("unexpected encoding id %d for ISO-8859 charsets", encoding)));
|
||||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
@@ -146,12 +146,12 @@ utf8_to_iso8859(PG_FUNCTION_ARGS)
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
int i;
|
||||
int i;
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
Assert(len >= 0);
|
||||
|
||||
for (i=0;i<sizeof(maps)/sizeof(pg_conv_map);i++)
|
||||
for (i = 0; i < sizeof(maps) / sizeof(pg_conv_map); i++)
|
||||
{
|
||||
if (encoding == maps[i].encoding)
|
||||
{
|
||||
@@ -162,7 +162,7 @@ utf8_to_iso8859(PG_FUNCTION_ARGS)
|
||||
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INTERNAL_ERROR),
|
||||
errmsg("unexpected encoding id %d for ISO-8859 charsets", encoding)));
|
||||
errmsg("unexpected encoding id %d for ISO-8859 charsets", encoding)));
|
||||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.17 2006/05/30 22:12:15 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.18 2006/10/04 00:30:03 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -93,7 +93,7 @@ utf8_to_iso8859_1(PG_FUNCTION_ARGS)
|
||||
}
|
||||
else
|
||||
{
|
||||
int l = pg_utf_mblen(src);
|
||||
int l = pg_utf_mblen(src);
|
||||
|
||||
if (l > len || !pg_utf8_islegal(src, l))
|
||||
report_invalid_encoding(PG_UTF8, (const char *) src, len);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c,v 1.5 2006/07/11 18:26:11 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c,v 1.6 2006/10/04 00:30:03 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -68,37 +68,37 @@ typedef struct
|
||||
static pg_conv_map maps[] = {
|
||||
{PG_WIN866, LUmapWIN866, ULmapWIN866,
|
||||
sizeof(LUmapWIN866) / sizeof(pg_local_to_utf),
|
||||
sizeof(ULmapWIN866) / sizeof(pg_utf_to_local)},
|
||||
sizeof(ULmapWIN866) / sizeof(pg_utf_to_local)},
|
||||
{PG_WIN874, LUmapWIN874, ULmapWIN874,
|
||||
sizeof(LUmapWIN874) / sizeof(pg_local_to_utf),
|
||||
sizeof(ULmapWIN874) / sizeof(pg_utf_to_local)},
|
||||
sizeof(ULmapWIN874) / sizeof(pg_utf_to_local)},
|
||||
{PG_WIN1250, LUmapWIN1250, ULmapWIN1250,
|
||||
sizeof(LUmapWIN1250) / sizeof(pg_local_to_utf),
|
||||
sizeof(ULmapWIN1250) / sizeof(pg_utf_to_local)},
|
||||
sizeof(ULmapWIN1250) / sizeof(pg_utf_to_local)},
|
||||
{PG_WIN1251, LUmapWIN1251, ULmapWIN1251,
|
||||
sizeof(LUmapWIN1251) / sizeof(pg_local_to_utf),
|
||||
sizeof(ULmapWIN1251) / sizeof(pg_utf_to_local)},
|
||||
sizeof(ULmapWIN1251) / sizeof(pg_utf_to_local)},
|
||||
{PG_WIN1252, LUmapWIN1252, ULmapWIN1252,
|
||||
sizeof(LUmapWIN1252) / sizeof(pg_local_to_utf),
|
||||
sizeof(ULmapWIN1252) / sizeof(pg_utf_to_local)},
|
||||
sizeof(ULmapWIN1252) / sizeof(pg_utf_to_local)},
|
||||
{PG_WIN1253, LUmapWIN1253, ULmapWIN1253,
|
||||
sizeof(LUmapWIN1253) / sizeof(pg_local_to_utf),
|
||||
sizeof(ULmapWIN1253) / sizeof(pg_utf_to_local)},
|
||||
sizeof(ULmapWIN1253) / sizeof(pg_utf_to_local)},
|
||||
{PG_WIN1254, LUmapWIN1254, ULmapWIN1254,
|
||||
sizeof(LUmapWIN1254) / sizeof(pg_local_to_utf),
|
||||
sizeof(ULmapWIN1254) / sizeof(pg_utf_to_local)},
|
||||
sizeof(ULmapWIN1254) / sizeof(pg_utf_to_local)},
|
||||
{PG_WIN1255, LUmapWIN1255, ULmapWIN1255,
|
||||
sizeof(LUmapWIN1255) / sizeof(pg_local_to_utf),
|
||||
sizeof(ULmapWIN1255) / sizeof(pg_utf_to_local)},
|
||||
sizeof(ULmapWIN1255) / sizeof(pg_utf_to_local)},
|
||||
{PG_WIN1256, LUmapWIN1256, ULmapWIN1256,
|
||||
sizeof(LUmapWIN1256) / sizeof(pg_local_to_utf),
|
||||
sizeof(ULmapWIN1256) / sizeof(pg_utf_to_local)},
|
||||
sizeof(ULmapWIN1256) / sizeof(pg_utf_to_local)},
|
||||
{PG_WIN1257, LUmapWIN1257, ULmapWIN1257,
|
||||
sizeof(LUmapWIN1257) / sizeof(pg_local_to_utf),
|
||||
sizeof(ULmapWIN1257) / sizeof(pg_utf_to_local)},
|
||||
sizeof(ULmapWIN1257) / sizeof(pg_utf_to_local)},
|
||||
{PG_WIN1258, LUmapWIN1258, ULmapWIN1258,
|
||||
sizeof(LUmapWIN1258) / sizeof(pg_local_to_utf),
|
||||
sizeof(ULmapWIN1258) / sizeof(pg_utf_to_local)},
|
||||
sizeof(ULmapWIN1258) / sizeof(pg_utf_to_local)},
|
||||
};
|
||||
|
||||
Datum
|
||||
@@ -108,12 +108,12 @@ win_to_utf8(PG_FUNCTION_ARGS)
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
int i;
|
||||
int i;
|
||||
|
||||
Assert(PG_GETARG_INT32(1) == PG_UTF8);
|
||||
Assert(len >= 0);
|
||||
|
||||
for (i=0;i<sizeof(maps)/sizeof(pg_conv_map);i++)
|
||||
for (i = 0; i < sizeof(maps) / sizeof(pg_conv_map); i++)
|
||||
{
|
||||
if (encoding == maps[i].encoding)
|
||||
{
|
||||
@@ -136,12 +136,12 @@ utf8_to_win(PG_FUNCTION_ARGS)
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
int i;
|
||||
int i;
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
Assert(len >= 0);
|
||||
|
||||
for (i=0;i<sizeof(maps)/sizeof(pg_conv_map);i++)
|
||||
for (i = 0; i < sizeof(maps) / sizeof(pg_conv_map); i++)
|
||||
{
|
||||
if (encoding == maps[i].encoding)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* (currently mule internal code (mic) is used)
|
||||
* Tatsuo Ishii
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.58 2006/07/14 14:52:25 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.59 2006/10/04 00:30:02 momjian Exp $
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
@@ -133,9 +133,9 @@ SetClientEncoding(int encoding, bool doit)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* This is the first time through, so create the context. Make
|
||||
* it a child of TopMemoryContext so that these values survive
|
||||
* across transactions.
|
||||
* This is the first time through, so create the context. Make it a
|
||||
* child of TopMemoryContext so that these values survive across
|
||||
* transactions.
|
||||
*/
|
||||
MbProcContext = AllocSetContextCreate(TopMemoryContext,
|
||||
"MbProcContext",
|
||||
@@ -378,28 +378,27 @@ pg_client_to_server(const char *s, int len)
|
||||
{
|
||||
/*
|
||||
* No conversion is possible, but we must still validate the data,
|
||||
* because the client-side code might have done string escaping
|
||||
* using the selected client_encoding. If the client encoding is
|
||||
* ASCII-safe then we just do a straight validation under that
|
||||
* encoding. For an ASCII-unsafe encoding we have a problem:
|
||||
* we dare not pass such data to the parser but we have no way
|
||||
* to convert it. We compromise by rejecting the data if it
|
||||
* contains any non-ASCII characters.
|
||||
* because the client-side code might have done string escaping using
|
||||
* the selected client_encoding. If the client encoding is ASCII-safe
|
||||
* then we just do a straight validation under that encoding. For an
|
||||
* ASCII-unsafe encoding we have a problem: we dare not pass such data
|
||||
* to the parser but we have no way to convert it. We compromise by
|
||||
* rejecting the data if it contains any non-ASCII characters.
|
||||
*/
|
||||
if (PG_VALID_BE_ENCODING(ClientEncoding->encoding))
|
||||
(void) pg_verify_mbstr(ClientEncoding->encoding, s, len, false);
|
||||
else
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (s[i] == '\0' || IS_HIGHBIT_SET(s[i]))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE),
|
||||
errmsg("invalid byte value for encoding \"%s\": 0x%02x",
|
||||
pg_enc2name_tbl[PG_SQL_ASCII].name,
|
||||
(unsigned char) s[i])));
|
||||
errmsg("invalid byte value for encoding \"%s\": 0x%02x",
|
||||
pg_enc2name_tbl[PG_SQL_ASCII].name,
|
||||
(unsigned char) s[i])));
|
||||
}
|
||||
}
|
||||
return (char *) s;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* conversion functions between pg_wchar and multibyte streams.
|
||||
* Tatsuo Ishii
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.57 2006/08/22 12:11:28 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.58 2006/10/04 00:30:02 momjian Exp $
|
||||
*
|
||||
* WIN1250 client encoding updated by Pavel Behal
|
||||
*
|
||||
@@ -40,7 +40,7 @@
|
||||
* SQL/ASCII
|
||||
*/
|
||||
static int
|
||||
pg_ascii2wchar_with_len
|
||||
pg_ascii2wchar_with_len
|
||||
(const unsigned char *from, pg_wchar *to, int len)
|
||||
{
|
||||
int cnt = 0;
|
||||
@@ -68,7 +68,7 @@ pg_ascii_dsplen(const unsigned char *s)
|
||||
return 0;
|
||||
if (*s < 0x20 || *s == 0x7f)
|
||||
return -1;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,8 @@ static int pg_euc2wchar_with_len
|
||||
|
||||
while (len > 0 && *from)
|
||||
{
|
||||
if (*from == SS2 && len >= 2) /* JIS X 0201 (so called "1 byte KANA") */
|
||||
if (*from == SS2 && len >= 2) /* JIS X 0201 (so called "1 byte
|
||||
* KANA") */
|
||||
{
|
||||
from++;
|
||||
*to = (SS2 << 8) | *from++;
|
||||
@@ -95,13 +96,14 @@ static int pg_euc2wchar_with_len
|
||||
*to |= *from++;
|
||||
len -= 3;
|
||||
}
|
||||
else if (IS_HIGHBIT_SET(*from) && len >= 2) /* JIS X 0208 KANJI */
|
||||
else if (IS_HIGHBIT_SET(*from) && len >= 2) /* JIS X 0208 KANJI */
|
||||
{
|
||||
*to = *from++ << 8;
|
||||
*to |= *from++;
|
||||
len -= 2;
|
||||
}
|
||||
else /* must be ASCII */
|
||||
else
|
||||
/* must be ASCII */
|
||||
{
|
||||
*to = *from++;
|
||||
len--;
|
||||
@@ -222,7 +224,7 @@ static int pg_euccn2wchar_with_len
|
||||
*to |= *from++;
|
||||
len -= 3;
|
||||
}
|
||||
else if (IS_HIGHBIT_SET(*from) && len >= 2) /* code set 1 */
|
||||
else if (IS_HIGHBIT_SET(*from) && len >= 2) /* code set 1 */
|
||||
{
|
||||
*to = *from++ << 8;
|
||||
*to |= *from++;
|
||||
@@ -278,7 +280,7 @@ static int pg_euctw2wchar_with_len
|
||||
if (*from == SS2 && len >= 4) /* code set 2 */
|
||||
{
|
||||
from++;
|
||||
*to = (SS2 << 24) | (*from++ << 16) ;
|
||||
*to = (SS2 << 24) | (*from++ << 16);
|
||||
*to |= *from++ << 8;
|
||||
*to |= *from++;
|
||||
len -= 4;
|
||||
@@ -290,7 +292,7 @@ static int pg_euctw2wchar_with_len
|
||||
*to |= *from++;
|
||||
len -= 3;
|
||||
}
|
||||
else if (IS_HIGHBIT_SET(*from) && len >= 2) /* code set 2 */
|
||||
else if (IS_HIGHBIT_SET(*from) && len >= 2) /* code set 2 */
|
||||
{
|
||||
*to = *from++ << 8;
|
||||
*to |= *from++;
|
||||
@@ -455,7 +457,7 @@ struct mbinterval
|
||||
|
||||
/* auxiliary function for binary search in interval table */
|
||||
static int
|
||||
mbbisearch(pg_wchar ucs, const struct mbinterval *table, int max)
|
||||
mbbisearch(pg_wchar ucs, const struct mbinterval * table, int max)
|
||||
{
|
||||
int min = 0;
|
||||
int mid;
|
||||
@@ -677,14 +679,14 @@ pg_mule_mblen(const unsigned char *s)
|
||||
else if (IS_LCPRV2(*s))
|
||||
len = 4;
|
||||
else
|
||||
len = 1; /* assume ASCII */
|
||||
len = 1; /* assume ASCII */
|
||||
return len;
|
||||
}
|
||||
|
||||
static int
|
||||
pg_mule_dsplen(const unsigned char *s)
|
||||
{
|
||||
int len;
|
||||
int len;
|
||||
|
||||
if (IS_LC1(*s))
|
||||
len = 1;
|
||||
@@ -695,7 +697,7 @@ pg_mule_dsplen(const unsigned char *s)
|
||||
else if (IS_LCPRV2(*s))
|
||||
len = 2;
|
||||
else
|
||||
len = 1; /* assume ASCII */
|
||||
len = 1; /* assume ASCII */
|
||||
|
||||
return len;
|
||||
}
|
||||
@@ -739,11 +741,11 @@ pg_sjis_mblen(const unsigned char *s)
|
||||
int len;
|
||||
|
||||
if (*s >= 0xa1 && *s <= 0xdf)
|
||||
len = 1; /* 1 byte kana? */
|
||||
len = 1; /* 1 byte kana? */
|
||||
else if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* kanji? */
|
||||
len = 2; /* kanji? */
|
||||
else
|
||||
len = 1; /* should be ASCII */
|
||||
len = 1; /* should be ASCII */
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -753,11 +755,11 @@ pg_sjis_dsplen(const unsigned char *s)
|
||||
int len;
|
||||
|
||||
if (*s >= 0xa1 && *s <= 0xdf)
|
||||
len = 1; /* 1 byte kana? */
|
||||
len = 1; /* 1 byte kana? */
|
||||
else if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* kanji? */
|
||||
len = 2; /* kanji? */
|
||||
else
|
||||
len = pg_ascii_dsplen(s); /* should be ASCII */
|
||||
len = pg_ascii_dsplen(s); /* should be ASCII */
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -770,9 +772,9 @@ pg_big5_mblen(const unsigned char *s)
|
||||
int len;
|
||||
|
||||
if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* kanji? */
|
||||
len = 2; /* kanji? */
|
||||
else
|
||||
len = 1; /* should be ASCII */
|
||||
len = 1; /* should be ASCII */
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -782,9 +784,9 @@ pg_big5_dsplen(const unsigned char *s)
|
||||
int len;
|
||||
|
||||
if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* kanji? */
|
||||
len = 2; /* kanji? */
|
||||
else
|
||||
len = pg_ascii_dsplen(s); /* should be ASCII */
|
||||
len = pg_ascii_dsplen(s); /* should be ASCII */
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -797,9 +799,9 @@ pg_gbk_mblen(const unsigned char *s)
|
||||
int len;
|
||||
|
||||
if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* kanji? */
|
||||
len = 2; /* kanji? */
|
||||
else
|
||||
len = 1; /* should be ASCII */
|
||||
len = 1; /* should be ASCII */
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -809,9 +811,9 @@ pg_gbk_dsplen(const unsigned char *s)
|
||||
int len;
|
||||
|
||||
if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* kanji? */
|
||||
len = 2; /* kanji? */
|
||||
else
|
||||
len = pg_ascii_dsplen(s); /* should be ASCII */
|
||||
len = pg_ascii_dsplen(s); /* should be ASCII */
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -824,9 +826,9 @@ pg_uhc_mblen(const unsigned char *s)
|
||||
int len;
|
||||
|
||||
if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* 2byte? */
|
||||
len = 2; /* 2byte? */
|
||||
else
|
||||
len = 1; /* should be ASCII */
|
||||
len = 1; /* should be ASCII */
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -836,9 +838,9 @@ pg_uhc_dsplen(const unsigned char *s)
|
||||
int len;
|
||||
|
||||
if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* 2byte? */
|
||||
len = 2; /* 2byte? */
|
||||
else
|
||||
len = pg_ascii_dsplen(s); /* should be ASCII */
|
||||
len = pg_ascii_dsplen(s); /* should be ASCII */
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -852,7 +854,7 @@ pg_gb18030_mblen(const unsigned char *s)
|
||||
int len;
|
||||
|
||||
if (!IS_HIGHBIT_SET(*s))
|
||||
len = 1; /* ASCII */
|
||||
len = 1; /* ASCII */
|
||||
else
|
||||
{
|
||||
if ((*(s + 1) >= 0x40 && *(s + 1) <= 0x7e) || (*(s + 1) >= 0x80 && *(s + 1) <= 0xfe))
|
||||
@@ -873,7 +875,7 @@ pg_gb18030_dsplen(const unsigned char *s)
|
||||
if (IS_HIGHBIT_SET(*s))
|
||||
len = 2;
|
||||
else
|
||||
len = pg_ascii_dsplen(s); /* ASCII */
|
||||
len = pg_ascii_dsplen(s); /* ASCII */
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -906,13 +908,14 @@ static int
|
||||
pg_eucjp_verifier(const unsigned char *s, int len)
|
||||
{
|
||||
int l;
|
||||
unsigned char c1, c2;
|
||||
unsigned char c1,
|
||||
c2;
|
||||
|
||||
c1 = *s++;
|
||||
|
||||
switch (c1)
|
||||
{
|
||||
case SS2: /* JIS X 0201 */
|
||||
case SS2: /* JIS X 0201 */
|
||||
l = 2;
|
||||
if (l > len)
|
||||
return -1;
|
||||
@@ -921,7 +924,7 @@ pg_eucjp_verifier(const unsigned char *s, int len)
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case SS3: /* JIS X 0212 */
|
||||
case SS3: /* JIS X 0212 */
|
||||
l = 3;
|
||||
if (l > len)
|
||||
return -1;
|
||||
@@ -945,7 +948,8 @@ pg_eucjp_verifier(const unsigned char *s, int len)
|
||||
if (!IS_EUC_RANGE_VALID(c2))
|
||||
return -1;
|
||||
}
|
||||
else /* must be ASCII */
|
||||
else
|
||||
/* must be ASCII */
|
||||
{
|
||||
l = 1;
|
||||
}
|
||||
@@ -959,7 +963,8 @@ static int
|
||||
pg_euckr_verifier(const unsigned char *s, int len)
|
||||
{
|
||||
int l;
|
||||
unsigned char c1, c2;
|
||||
unsigned char c1,
|
||||
c2;
|
||||
|
||||
c1 = *s++;
|
||||
|
||||
@@ -974,7 +979,8 @@ pg_euckr_verifier(const unsigned char *s, int len)
|
||||
if (!IS_EUC_RANGE_VALID(c2))
|
||||
return -1;
|
||||
}
|
||||
else /* must be ASCII */
|
||||
else
|
||||
/* must be ASCII */
|
||||
{
|
||||
l = 1;
|
||||
}
|
||||
@@ -989,13 +995,14 @@ static int
|
||||
pg_euctw_verifier(const unsigned char *s, int len)
|
||||
{
|
||||
int l;
|
||||
unsigned char c1, c2;
|
||||
unsigned char c1,
|
||||
c2;
|
||||
|
||||
c1 = *s++;
|
||||
|
||||
switch (c1)
|
||||
{
|
||||
case SS2: /* CNS 11643 Plane 1-7 */
|
||||
case SS2: /* CNS 11643 Plane 1-7 */
|
||||
l = 4;
|
||||
if (l > len)
|
||||
return -1;
|
||||
@@ -1010,7 +1017,7 @@ pg_euctw_verifier(const unsigned char *s, int len)
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case SS3: /* unused */
|
||||
case SS3: /* unused */
|
||||
return -1;
|
||||
|
||||
default:
|
||||
@@ -1024,7 +1031,8 @@ pg_euctw_verifier(const unsigned char *s, int len)
|
||||
if (!IS_EUC_RANGE_VALID(c2))
|
||||
return -1;
|
||||
}
|
||||
else /* must be ASCII */
|
||||
else
|
||||
/* must be ASCII */
|
||||
{
|
||||
l = 1;
|
||||
}
|
||||
@@ -1036,7 +1044,8 @@ pg_euctw_verifier(const unsigned char *s, int len)
|
||||
static int
|
||||
pg_johab_verifier(const unsigned char *s, int len)
|
||||
{
|
||||
int l, mbl;
|
||||
int l,
|
||||
mbl;
|
||||
unsigned char c;
|
||||
|
||||
l = mbl = pg_johab_mblen(s);
|
||||
@@ -1059,7 +1068,8 @@ pg_johab_verifier(const unsigned char *s, int len)
|
||||
static int
|
||||
pg_mule_verifier(const unsigned char *s, int len)
|
||||
{
|
||||
int l, mbl;
|
||||
int l,
|
||||
mbl;
|
||||
unsigned char c;
|
||||
|
||||
l = mbl = pg_mule_mblen(s);
|
||||
@@ -1085,8 +1095,10 @@ pg_latin1_verifier(const unsigned char *s, int len)
|
||||
static int
|
||||
pg_sjis_verifier(const unsigned char *s, int len)
|
||||
{
|
||||
int l, mbl;
|
||||
unsigned char c1, c2;
|
||||
int l,
|
||||
mbl;
|
||||
unsigned char c1,
|
||||
c2;
|
||||
|
||||
l = mbl = pg_sjis_mblen(s);
|
||||
|
||||
@@ -1106,7 +1118,8 @@ pg_sjis_verifier(const unsigned char *s, int len)
|
||||
static int
|
||||
pg_big5_verifier(const unsigned char *s, int len)
|
||||
{
|
||||
int l, mbl;
|
||||
int l,
|
||||
mbl;
|
||||
|
||||
l = mbl = pg_big5_mblen(s);
|
||||
|
||||
@@ -1125,7 +1138,8 @@ pg_big5_verifier(const unsigned char *s, int len)
|
||||
static int
|
||||
pg_gbk_verifier(const unsigned char *s, int len)
|
||||
{
|
||||
int l, mbl;
|
||||
int l,
|
||||
mbl;
|
||||
|
||||
l = mbl = pg_gbk_mblen(s);
|
||||
|
||||
@@ -1144,7 +1158,8 @@ pg_gbk_verifier(const unsigned char *s, int len)
|
||||
static int
|
||||
pg_uhc_verifier(const unsigned char *s, int len)
|
||||
{
|
||||
int l, mbl;
|
||||
int l,
|
||||
mbl;
|
||||
|
||||
l = mbl = pg_uhc_mblen(s);
|
||||
|
||||
@@ -1163,7 +1178,8 @@ pg_uhc_verifier(const unsigned char *s, int len)
|
||||
static int
|
||||
pg_gb18030_verifier(const unsigned char *s, int len)
|
||||
{
|
||||
int l, mbl;
|
||||
int l,
|
||||
mbl;
|
||||
|
||||
l = mbl = pg_gb18030_mblen(s);
|
||||
|
||||
@@ -1182,7 +1198,7 @@ pg_gb18030_verifier(const unsigned char *s, int len)
|
||||
static int
|
||||
pg_utf8_verifier(const unsigned char *s, int len)
|
||||
{
|
||||
int l = pg_utf_mblen(s);
|
||||
int l = pg_utf_mblen(s);
|
||||
|
||||
if (len < l)
|
||||
return -1;
|
||||
@@ -1270,45 +1286,45 @@ pg_utf8_islegal(const unsigned char *source, int length)
|
||||
*-------------------------------------------------------------------
|
||||
*/
|
||||
pg_wchar_tbl pg_wchar_table[] = {
|
||||
{pg_ascii2wchar_with_len, pg_ascii_mblen, pg_ascii_dsplen, pg_ascii_verifier, 1}, /* 0; PG_SQL_ASCII */
|
||||
{pg_eucjp2wchar_with_len, pg_eucjp_mblen, pg_eucjp_dsplen, pg_eucjp_verifier, 3}, /* 1; PG_EUC_JP */
|
||||
{pg_euccn2wchar_with_len, pg_euccn_mblen, pg_euccn_dsplen, pg_euccn_verifier, 3}, /* 2; PG_EUC_CN */
|
||||
{pg_euckr2wchar_with_len, pg_euckr_mblen, pg_euckr_dsplen, pg_euckr_verifier, 3}, /* 3; PG_EUC_KR */
|
||||
{pg_euctw2wchar_with_len, pg_euctw_mblen, pg_euctw_dsplen, pg_euctw_verifier, 3}, /* 4; PG_EUC_TW */
|
||||
{pg_johab2wchar_with_len, pg_johab_mblen, pg_johab_dsplen, pg_johab_verifier, 3}, /* 5; PG_JOHAB */
|
||||
{pg_ascii2wchar_with_len, pg_ascii_mblen, pg_ascii_dsplen, pg_ascii_verifier, 1}, /* 0; PG_SQL_ASCII */
|
||||
{pg_eucjp2wchar_with_len, pg_eucjp_mblen, pg_eucjp_dsplen, pg_eucjp_verifier, 3}, /* 1; PG_EUC_JP */
|
||||
{pg_euccn2wchar_with_len, pg_euccn_mblen, pg_euccn_dsplen, pg_euccn_verifier, 3}, /* 2; PG_EUC_CN */
|
||||
{pg_euckr2wchar_with_len, pg_euckr_mblen, pg_euckr_dsplen, pg_euckr_verifier, 3}, /* 3; PG_EUC_KR */
|
||||
{pg_euctw2wchar_with_len, pg_euctw_mblen, pg_euctw_dsplen, pg_euctw_verifier, 3}, /* 4; PG_EUC_TW */
|
||||
{pg_johab2wchar_with_len, pg_johab_mblen, pg_johab_dsplen, pg_johab_verifier, 3}, /* 5; PG_JOHAB */
|
||||
{pg_utf2wchar_with_len, pg_utf_mblen, pg_utf_dsplen, pg_utf8_verifier, 4}, /* 6; PG_UTF8 */
|
||||
{pg_mule2wchar_with_len, pg_mule_mblen, pg_mule_dsplen, pg_mule_verifier, 3}, /* 7; PG_MULE_INTERNAL */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 8; PG_LATIN1 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 9; PG_LATIN2 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 10; PG_LATIN3 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 11; PG_LATIN4 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 12; PG_LATIN5 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 13; PG_LATIN6 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 14; PG_LATIN7 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 15; PG_LATIN8 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 16; PG_LATIN9 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 17; PG_LATIN10 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 18; PG_WIN1256 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 19; PG_WIN1258 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 20; PG_WIN874 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 21; PG_KOI8 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 22; PG_WIN1251 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 22; PG_WIN1252 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 23; PG_WIN866 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 24; ISO-8859-5 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 25; ISO-8859-6 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 26; ISO-8859-7 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 27; ISO-8859-8 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 28; PG_WIN1250 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 29; PG_WIN1253 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 30; PG_WIN1254 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 31; PG_WIN1255 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 32; PG_WIN1257 */
|
||||
{0, pg_sjis_mblen, pg_sjis_dsplen, pg_sjis_verifier, 2}, /* 33; PG_SJIS */
|
||||
{0, pg_big5_mblen, pg_big5_dsplen, pg_big5_verifier, 2}, /* 34; PG_BIG5 */
|
||||
{pg_mule2wchar_with_len, pg_mule_mblen, pg_mule_dsplen, pg_mule_verifier, 3}, /* 7; PG_MULE_INTERNAL */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 8; PG_LATIN1 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 9; PG_LATIN2 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 10; PG_LATIN3 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 11; PG_LATIN4 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 12; PG_LATIN5 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 13; PG_LATIN6 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 14; PG_LATIN7 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 15; PG_LATIN8 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 16; PG_LATIN9 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 17; PG_LATIN10 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 18; PG_WIN1256 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 19; PG_WIN1258 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 20; PG_WIN874 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 21; PG_KOI8 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 22; PG_WIN1251 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 22; PG_WIN1252 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 23; PG_WIN866 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 24; ISO-8859-5 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 25; ISO-8859-6 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 26; ISO-8859-7 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 27; ISO-8859-8 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 28; PG_WIN1250 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 29; PG_WIN1253 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 30; PG_WIN1254 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 31; PG_WIN1255 */
|
||||
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* 32; PG_WIN1257 */
|
||||
{0, pg_sjis_mblen, pg_sjis_dsplen, pg_sjis_verifier, 2}, /* 33; PG_SJIS */
|
||||
{0, pg_big5_mblen, pg_big5_dsplen, pg_big5_verifier, 2}, /* 34; PG_BIG5 */
|
||||
{0, pg_gbk_mblen, pg_gbk_dsplen, pg_gbk_verifier, 2}, /* 35; PG_GBK */
|
||||
{0, pg_uhc_mblen, pg_uhc_dsplen, pg_uhc_verifier, 2}, /* 36; PG_UHC */
|
||||
{0, pg_gb18030_mblen, pg_gb18030_dsplen, pg_gb18030_verifier, 2} /* 37; PG_GB18030 */
|
||||
{0, pg_gb18030_mblen, pg_gb18030_dsplen, pg_gb18030_verifier, 2} /* 37; PG_GB18030 */
|
||||
};
|
||||
|
||||
/* returns the byte length of a word for mule internal code */
|
||||
@@ -1358,8 +1374,8 @@ pg_encoding_verifymb(int encoding, const char *mbstr, int len)
|
||||
|
||||
return ((encoding >= 0 &&
|
||||
encoding < sizeof(pg_wchar_table) / sizeof(pg_wchar_tbl)) ?
|
||||
((*pg_wchar_table[encoding].mbverify) ((const unsigned char *) mbstr, len)) :
|
||||
((*pg_wchar_table[PG_SQL_ASCII].mbverify) ((const unsigned char *) mbstr, len)));
|
||||
((*pg_wchar_table[encoding].mbverify) ((const unsigned char *) mbstr, len)) :
|
||||
((*pg_wchar_table[PG_SQL_ASCII].mbverify) ((const unsigned char *) mbstr, len)));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1487,9 +1503,9 @@ report_invalid_encoding(int encoding, const char *mbstr, int len)
|
||||
errmsg("invalid byte sequence for encoding \"%s\": 0x%s",
|
||||
pg_enc2name_tbl[encoding].name,
|
||||
buf),
|
||||
errhint("This error can also happen if the byte sequence does not "
|
||||
"match the encoding expected by the server, which is controlled "
|
||||
"by \"client_encoding\".")));
|
||||
errhint("This error can also happen if the byte sequence does not "
|
||||
"match the encoding expected by the server, which is controlled "
|
||||
"by \"client_encoding\".")));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1516,10 +1532,10 @@ report_untranslatable_char(int src_encoding, int dest_encoding,
|
||||
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNTRANSLATABLE_CHARACTER),
|
||||
errmsg("character 0x%s of encoding \"%s\" has no equivalent in \"%s\"",
|
||||
buf,
|
||||
pg_enc2name_tbl[src_encoding].name,
|
||||
pg_enc2name_tbl[dest_encoding].name)));
|
||||
errmsg("character 0x%s of encoding \"%s\" has no equivalent in \"%s\"",
|
||||
buf,
|
||||
pg_enc2name_tbl[src_encoding].name,
|
||||
pg_enc2name_tbl[dest_encoding].name)));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user