mirror of
https://github.com/postgres/postgres.git
synced 2025-12-02 23:42:46 +03:00
Suppress signed-vs-unsigned-char warnings.
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.53 2005/06/15 00:15:08 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conv.c,v 1.54 2005/09/24 17:53:17 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -421,7 +421,7 @@ LocalToUtf(unsigned char *iso, unsigned char *utf,
|
||||
continue;
|
||||
}
|
||||
|
||||
l = pg_encoding_mblen(encoding, iso);
|
||||
l = pg_encoding_mblen(encoding, (char *) iso);
|
||||
|
||||
if (l == 1)
|
||||
iiso = *iso++;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.9 2004/12/31 22:01:45 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.10 2005/09/24 17:53:17 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -35,8 +35,8 @@ extern Datum mic_to_ascii(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
ascii_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_SQL_ASCII);
|
||||
@@ -51,8 +51,8 @@ ascii_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_ascii(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.10 2005/03/07 04:30:52 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.11 2005/09/24 17:53:17 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -82,8 +82,8 @@ static void mic2win866(unsigned char *mic, unsigned char *p, int len);
|
||||
Datum
|
||||
koi8r_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_KOI8R);
|
||||
@@ -98,8 +98,8 @@ koi8r_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_koi8r(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
@@ -114,8 +114,8 @@ mic_to_koi8r(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
iso_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5);
|
||||
@@ -130,8 +130,8 @@ iso_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_iso(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
@@ -146,8 +146,8 @@ mic_to_iso(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win1251_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_WIN1251);
|
||||
@@ -162,8 +162,8 @@ win1251_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_win1251(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
@@ -178,8 +178,8 @@ mic_to_win1251(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win866_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_WIN866);
|
||||
@@ -194,8 +194,8 @@ win866_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_win866(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
@@ -210,8 +210,8 @@ mic_to_win866(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
koi8r_to_win1251(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -221,7 +221,7 @@ koi8r_to_win1251(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
koi8r2mic(src, buf, len);
|
||||
mic2win1251(buf, dest, strlen(buf));
|
||||
mic2win1251(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -230,8 +230,8 @@ koi8r_to_win1251(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win1251_to_koi8r(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -241,7 +241,7 @@ win1251_to_koi8r(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
win12512mic(src, buf, len);
|
||||
mic2koi8r(buf, dest, strlen(buf));
|
||||
mic2koi8r(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -250,8 +250,8 @@ win1251_to_koi8r(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
koi8r_to_win866(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -261,7 +261,7 @@ koi8r_to_win866(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
koi8r2mic(src, buf, len);
|
||||
mic2win866(buf, dest, strlen(buf));
|
||||
mic2win866(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -270,8 +270,8 @@ koi8r_to_win866(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win866_to_koi8r(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -281,7 +281,7 @@ win866_to_koi8r(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
win8662mic(src, buf, len);
|
||||
mic2koi8r(buf, dest, strlen(buf));
|
||||
mic2koi8r(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -290,8 +290,8 @@ win866_to_koi8r(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win866_to_win1251(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -301,7 +301,7 @@ win866_to_win1251(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
win8662mic(src, buf, len);
|
||||
mic2win1251(buf, dest, strlen(buf));
|
||||
mic2win1251(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -310,8 +310,8 @@ win866_to_win1251(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win1251_to_win866(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -321,7 +321,7 @@ win1251_to_win866(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
win12512mic(src, buf, len);
|
||||
mic2win866(buf, dest, strlen(buf));
|
||||
mic2win866(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -330,8 +330,8 @@ win1251_to_win866(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
iso_to_koi8r(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -341,7 +341,7 @@ iso_to_koi8r(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
iso2mic(src, buf, len);
|
||||
mic2koi8r(buf, dest, strlen(buf));
|
||||
mic2koi8r(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -350,8 +350,8 @@ iso_to_koi8r(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
koi8r_to_iso(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -361,7 +361,7 @@ koi8r_to_iso(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
koi8r2mic(src, buf, len);
|
||||
mic2iso(buf, dest, strlen(buf));
|
||||
mic2iso(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -370,8 +370,8 @@ koi8r_to_iso(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
iso_to_win1251(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -381,7 +381,7 @@ iso_to_win1251(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
iso2mic(src, buf, len);
|
||||
mic2win1251(buf, dest, strlen(buf));
|
||||
mic2win1251(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -390,8 +390,8 @@ iso_to_win1251(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win1251_to_iso(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -401,7 +401,7 @@ win1251_to_iso(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
win12512mic(src, buf, len);
|
||||
mic2win1251(buf, dest, strlen(buf));
|
||||
mic2win1251(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -410,8 +410,8 @@ win1251_to_iso(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
iso_to_win866(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -421,7 +421,7 @@ iso_to_win866(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
iso2mic(src, buf, len);
|
||||
mic2win866(buf, dest, strlen(buf));
|
||||
mic2win866(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -430,8 +430,8 @@ iso_to_win866(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win866_to_iso(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -441,7 +441,7 @@ win866_to_iso(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
win8662mic(src, buf, len);
|
||||
mic2win866(buf, dest, strlen(buf));
|
||||
mic2win866(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
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/euc_cn_and_mic/euc_cn_and_mic.c,v 1.9 2004/12/31 22:01:51 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.10 2005/09/24 17:53:18 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -38,8 +38,8 @@ static void mic2euc_cn(unsigned char *mic, unsigned char *p, int len);
|
||||
Datum
|
||||
euc_cn_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_EUC_CN);
|
||||
@@ -54,8 +54,8 @@ euc_cn_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_euc_cn(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c,v 1.11 2005/06/24 13:56:39 ishii Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c,v 1.12 2005/09/24 17:53:18 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -64,8 +64,8 @@ static void sjis2euc_jp(unsigned char *mic, unsigned char *p, int len);
|
||||
Datum
|
||||
euc_jp_to_sjis(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_EUC_JP);
|
||||
@@ -80,8 +80,8 @@ euc_jp_to_sjis(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
sjis_to_euc_jp(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_SJIS);
|
||||
@@ -96,8 +96,8 @@ sjis_to_euc_jp(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
euc_jp_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_EUC_JP);
|
||||
@@ -112,8 +112,8 @@ euc_jp_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_euc_jp(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
@@ -128,8 +128,8 @@ mic_to_euc_jp(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
sjis_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_SJIS);
|
||||
@@ -144,8 +144,8 @@ sjis_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_sjis(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.9 2004/12/31 22:01:56 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.10 2005/09/24 17:53:19 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -38,8 +38,8 @@ static void mic2euc_kr(unsigned char *mic, unsigned char *p, int len);
|
||||
Datum
|
||||
euc_kr_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_EUC_KR);
|
||||
@@ -54,8 +54,8 @@ euc_kr_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_euc_kr(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
|
||||
@@ -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.9 2004/12/31 22:02:07 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.10 2005/09/24 17:53:19 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -50,8 +50,8 @@ static void mic2euc_tw(unsigned char *mic, unsigned char *p, int len);
|
||||
Datum
|
||||
euc_tw_to_big5(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -61,7 +61,7 @@ euc_tw_to_big5(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
euc_tw2mic(src, buf, len);
|
||||
mic2big5(buf, dest, strlen(buf));
|
||||
mic2big5(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -70,8 +70,8 @@ euc_tw_to_big5(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
big5_to_euc_tw(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -81,7 +81,7 @@ big5_to_euc_tw(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
big52mic(src, buf, len);
|
||||
mic2euc_tw(buf, dest, strlen(buf));
|
||||
mic2euc_tw(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -90,8 +90,8 @@ big5_to_euc_tw(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
euc_tw_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_EUC_TW);
|
||||
@@ -106,8 +106,8 @@ euc_tw_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_euc_tw(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
@@ -122,8 +122,8 @@ mic_to_euc_tw(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
big5_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_BIG5);
|
||||
@@ -138,8 +138,8 @@ big5_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_big5(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.9 2004/12/31 22:02:08 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.10 2005/09/24 17:53:19 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -50,8 +50,8 @@ static void mic2win1250(unsigned char *mic, unsigned char *p, int len);
|
||||
Datum
|
||||
latin2_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_LATIN2);
|
||||
@@ -66,8 +66,8 @@ latin2_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_latin2(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
@@ -82,8 +82,8 @@ mic_to_latin2(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win1250_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_WIN1250);
|
||||
@@ -98,8 +98,8 @@ win1250_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_win1250(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
@@ -114,8 +114,8 @@ mic_to_win1250(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
latin2_to_win1250(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -125,7 +125,7 @@ latin2_to_win1250(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
latin22mic(src, buf, len);
|
||||
mic2win1250(buf, dest, strlen(buf));
|
||||
mic2win1250(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@@ -134,8 +134,8 @@ latin2_to_win1250(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win1250_to_latin2(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned char *buf;
|
||||
|
||||
@@ -145,7 +145,7 @@ win1250_to_latin2(PG_FUNCTION_ARGS)
|
||||
|
||||
buf = palloc(len * ENCODING_GROWTH_RATE);
|
||||
win12502mic(src, buf, len);
|
||||
mic2latin2(buf, dest, strlen(buf));
|
||||
mic2latin2(buf, dest, strlen((char *) buf));
|
||||
pfree(buf);
|
||||
|
||||
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/latin_and_mic/latin_and_mic.c,v 1.9 2004/12/31 22:02:10 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c,v 1.10 2005/09/24 17:53:19 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -50,8 +50,8 @@ static void mic2latin4(unsigned char *mic, unsigned char *p, int len);
|
||||
Datum
|
||||
latin1_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_LATIN1);
|
||||
@@ -66,8 +66,8 @@ latin1_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_latin1(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
@@ -82,8 +82,8 @@ mic_to_latin1(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
latin3_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_LATIN3);
|
||||
@@ -98,8 +98,8 @@ latin3_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_latin3(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
@@ -114,8 +114,8 @@ mic_to_latin3(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
latin4_to_mic(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_LATIN4);
|
||||
@@ -130,8 +130,8 @@ latin4_to_mic(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
mic_to_latin4(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
|
||||
|
||||
@@ -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_ascii/utf8_and_ascii.c,v 1.10 2005/03/07 04:30:52 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c,v 1.11 2005/09/24 17:53:20 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -35,8 +35,8 @@ extern Datum utf8_to_ascii(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
ascii_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_SQL_ASCII);
|
||||
@@ -51,8 +51,8 @@ ascii_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_ascii(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
|
||||
@@ -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_big5/utf8_and_big5.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c,v 1.11 2005/09/24 17:53:20 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,8 +36,8 @@ extern Datum utf8_to_big5(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
big5_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_BIG5);
|
||||
@@ -53,8 +53,8 @@ big5_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_big5(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
|
||||
@@ -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.10 2005/03/07 04:30:53 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.11 2005/09/24 17:53:20 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -49,8 +49,8 @@ extern Datum win866_to_utf8(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
utf8_to_koi8r(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
@@ -66,8 +66,8 @@ utf8_to_koi8r(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
koi8r_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_KOI8R);
|
||||
@@ -83,8 +83,8 @@ koi8r_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_win1251(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
@@ -100,8 +100,8 @@ utf8_to_win1251(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win1251_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_WIN1251);
|
||||
@@ -117,8 +117,8 @@ win1251_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_win866(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
@@ -134,8 +134,8 @@ utf8_to_win866(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win866_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_WIN866);
|
||||
|
||||
@@ -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_euc_cn/utf8_and_euc_cn.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c,v 1.11 2005/09/24 17:53:21 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,8 +36,8 @@ extern Datum utf8_to_euc_cn(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
euc_cn_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_EUC_CN);
|
||||
@@ -53,8 +53,8 @@ euc_cn_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_euc_cn(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
|
||||
@@ -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_euc_jp/utf8_and_euc_jp.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c,v 1.11 2005/09/24 17:53:21 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,8 +36,8 @@ extern Datum utf8_to_euc_jp(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
euc_jp_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_EUC_JP);
|
||||
@@ -53,8 +53,8 @@ euc_jp_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_euc_jp(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
|
||||
@@ -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_euc_kr/utf8_and_euc_kr.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c,v 1.11 2005/09/24 17:53:22 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,8 +36,8 @@ extern Datum utf8_to_euc_kr(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
euc_kr_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_EUC_KR);
|
||||
@@ -53,8 +53,8 @@ euc_kr_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_euc_kr(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
|
||||
@@ -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_euc_tw/utf8_and_euc_tw.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c,v 1.11 2005/09/24 17:53:22 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,8 +36,8 @@ extern Datum utf8_to_euc_tw(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
euc_tw_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_EUC_TW);
|
||||
@@ -53,8 +53,8 @@ euc_tw_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_euc_tw(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
|
||||
@@ -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.10 2005/03/07 04:30:53 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.11 2005/09/24 17:53:23 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,8 +36,8 @@ extern Datum utf8_to_gb18030(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
gb18030_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_GB18030);
|
||||
@@ -53,8 +53,8 @@ gb18030_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_gb18030(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
|
||||
@@ -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_gbk/utf8_and_gbk.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c,v 1.11 2005/09/24 17:53:23 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,8 +36,8 @@ extern Datum utf8_to_gbk(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
gbk_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_GBK);
|
||||
@@ -53,8 +53,8 @@ gbk_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_gbk(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
|
||||
@@ -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.13 2005/03/14 18:31:21 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.14 2005/09/24 17:53:23 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -128,8 +128,8 @@ Datum
|
||||
iso8859_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int encoding = PG_GETARG_INT32(0);
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(1) == PG_UTF8);
|
||||
@@ -144,8 +144,8 @@ Datum
|
||||
utf8_to_iso8859(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int encoding = PG_GETARG_INT32(1);
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
|
||||
@@ -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.11 2005/03/07 04:30:54 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.12 2005/09/24 17:53:24 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -35,8 +35,8 @@ extern Datum utf8_to_iso8859_1(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
iso8859_1_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned short c;
|
||||
|
||||
@@ -62,8 +62,8 @@ iso8859_1_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_iso8859_1(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
unsigned short c,
|
||||
c1,
|
||||
|
||||
@@ -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_johab/utf8_and_johab.c,v 1.10 2005/03/07 04:30:54 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c,v 1.11 2005/09/24 17:53:24 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,8 +36,8 @@ extern Datum utf8_to_johab(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
johab_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_JOHAB);
|
||||
@@ -53,8 +53,8 @@ johab_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_johab(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
|
||||
@@ -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_sjis/utf8_and_sjis.c,v 1.10 2005/03/07 04:30:54 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c,v 1.11 2005/09/24 17:53:24 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,8 +36,8 @@ extern Datum utf8_to_sjis(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
sjis_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_SJIS);
|
||||
@@ -53,8 +53,8 @@ sjis_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_sjis(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
|
||||
@@ -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_uhc/utf8_and_uhc.c,v 1.10 2005/03/07 04:30:54 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c,v 1.11 2005/09/24 17:53:25 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,8 +36,8 @@ extern Datum utf8_to_uhc(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
uhc_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UHC);
|
||||
@@ -53,8 +53,8 @@ uhc_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_uhc(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
|
||||
@@ -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_win1250/utf8_and_win1250.c,v 1.11 2005/03/14 18:31:21 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c,v 1.12 2005/09/24 17:53:25 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -37,8 +37,8 @@ extern Datum win1250_to_utf8(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
utf8_to_win1250(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
@@ -54,8 +54,8 @@ utf8_to_win1250(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win1250_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_WIN1250);
|
||||
|
||||
@@ -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_win1252/utf8_and_win1252.c,v 1.3 2005/03/14 18:31:22 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1252/utf8_and_win1252.c,v 1.4 2005/09/24 17:53:25 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -37,8 +37,8 @@ extern Datum win1252_to_utf8(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
utf8_to_win1252(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
@@ -54,8 +54,8 @@ utf8_to_win1252(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win1252_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_WIN1252);
|
||||
|
||||
@@ -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_win1256/utf8_and_win1256.c,v 1.11 2005/03/14 18:31:22 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c,v 1.12 2005/09/24 17:53:26 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -37,8 +37,8 @@ extern Datum win1256_to_utf8(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
utf8_to_win1256(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
@@ -54,8 +54,8 @@ utf8_to_win1256(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win1256_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_WIN1256);
|
||||
|
||||
@@ -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_win1258/utf8_and_win1258.c,v 1.1 2005/03/07 04:30:55 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1258/utf8_and_win1258.c,v 1.2 2005/09/24 17:53:26 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -36,8 +36,8 @@ extern Datum utf8_to_win1258(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
win1258_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_WIN1258);
|
||||
@@ -53,8 +53,8 @@ win1258_to_utf8(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
utf8_to_win1258(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
|
||||
@@ -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_win874/utf8_and_win874.c,v 1.11 2005/03/14 18:31:22 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c,v 1.12 2005/09/24 17:53:26 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -37,8 +37,8 @@ extern Datum win874_to_utf8(PG_FUNCTION_ARGS);
|
||||
Datum
|
||||
utf8_to_win874(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_UTF8);
|
||||
@@ -54,8 +54,8 @@ utf8_to_win874(PG_FUNCTION_ARGS)
|
||||
Datum
|
||||
win874_to_utf8(PG_FUNCTION_ARGS)
|
||||
{
|
||||
unsigned char *src = PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = PG_GETARG_CSTRING(3);
|
||||
unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
|
||||
unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
|
||||
int len = PG_GETARG_INT32(4);
|
||||
|
||||
Assert(PG_GETARG_INT32(0) == PG_WIN874);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* (currently mule internal code (mic) is used)
|
||||
* Tatsuo Ishii
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.50 2005/07/10 21:13:59 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.51 2005/09/24 17:53:17 tgl Exp $
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
@@ -43,9 +43,9 @@ static int pending_client_encoding = PG_SQL_ASCII;
|
||||
|
||||
|
||||
/* Internal functions */
|
||||
static unsigned char *perform_default_encoding_conversion(unsigned char *src,
|
||||
static char *perform_default_encoding_conversion(const char *src,
|
||||
int len, bool is_client_to_server);
|
||||
static int cliplen(const unsigned char *str, int len, int limit);
|
||||
static int cliplen(const char *str, int len, int limit);
|
||||
|
||||
|
||||
/*
|
||||
@@ -303,7 +303,7 @@ pg_convert(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert string using encoding_nanme.
|
||||
* Convert string using encoding_name.
|
||||
*
|
||||
* TEXT convert2(TEXT string, NAME src_encoding_name, NAME dest_encoding_name)
|
||||
*/
|
||||
@@ -346,7 +346,7 @@ pg_convert2(PG_FUNCTION_ARGS)
|
||||
* textin assumes that input string encoding is same as database
|
||||
* encoding.
|
||||
*/
|
||||
len = strlen(result) + VARHDRSZ;
|
||||
len = strlen((char *) result) + VARHDRSZ;
|
||||
retval = palloc(len);
|
||||
VARATT_SIZEP(retval) = len;
|
||||
memcpy(VARDATA(retval), result, len - VARHDRSZ);
|
||||
@@ -364,14 +364,14 @@ pg_convert2(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* convert client encoding to server encoding.
|
||||
*/
|
||||
unsigned char *
|
||||
pg_client_to_server(unsigned char *s, int len)
|
||||
char *
|
||||
pg_client_to_server(const char *s, int len)
|
||||
{
|
||||
Assert(DatabaseEncoding);
|
||||
Assert(ClientEncoding);
|
||||
|
||||
if (ClientEncoding->encoding == DatabaseEncoding->encoding)
|
||||
return s;
|
||||
return (char *) s;
|
||||
|
||||
return perform_default_encoding_conversion(s, len, true);
|
||||
}
|
||||
@@ -379,14 +379,14 @@ pg_client_to_server(unsigned char *s, int len)
|
||||
/*
|
||||
* convert server encoding to client encoding.
|
||||
*/
|
||||
unsigned char *
|
||||
pg_server_to_client(unsigned char *s, int len)
|
||||
char *
|
||||
pg_server_to_client(const char *s, int len)
|
||||
{
|
||||
Assert(DatabaseEncoding);
|
||||
Assert(ClientEncoding);
|
||||
|
||||
if (ClientEncoding->encoding == DatabaseEncoding->encoding)
|
||||
return s;
|
||||
return (char *) s;
|
||||
|
||||
return perform_default_encoding_conversion(s, len, false);
|
||||
}
|
||||
@@ -398,16 +398,16 @@ pg_server_to_client(unsigned char *s, int len)
|
||||
* before calling this function. Otherwise no conversion is
|
||||
* performed.
|
||||
*/
|
||||
static unsigned char *
|
||||
perform_default_encoding_conversion(unsigned char *src, int len, bool is_client_to_server)
|
||||
static char *
|
||||
perform_default_encoding_conversion(const char *src, int len, bool is_client_to_server)
|
||||
{
|
||||
unsigned char *result;
|
||||
char *result;
|
||||
int src_encoding,
|
||||
dest_encoding;
|
||||
FmgrInfo *flinfo;
|
||||
|
||||
if (len <= 0)
|
||||
return src;
|
||||
return (char *) src;
|
||||
|
||||
if (is_client_to_server)
|
||||
{
|
||||
@@ -423,13 +423,13 @@ perform_default_encoding_conversion(unsigned char *src, int len, bool is_client_
|
||||
}
|
||||
|
||||
if (flinfo == NULL)
|
||||
return src;
|
||||
return (char *) src;
|
||||
|
||||
if (src_encoding == dest_encoding)
|
||||
return src;
|
||||
return (char *) src;
|
||||
|
||||
if (src_encoding == PG_SQL_ASCII || dest_encoding == PG_SQL_ASCII)
|
||||
return src;
|
||||
return (char *) src;
|
||||
|
||||
result = palloc(len * 4 + 1);
|
||||
|
||||
@@ -444,41 +444,41 @@ perform_default_encoding_conversion(unsigned char *src, int len, bool is_client_
|
||||
|
||||
/* convert a multibyte string to a wchar */
|
||||
int
|
||||
pg_mb2wchar(const unsigned char *from, pg_wchar *to)
|
||||
pg_mb2wchar(const char *from, pg_wchar *to)
|
||||
{
|
||||
return (*pg_wchar_table[DatabaseEncoding->encoding].mb2wchar_with_len) (from, to, strlen(from));
|
||||
return (*pg_wchar_table[DatabaseEncoding->encoding].mb2wchar_with_len) ((const unsigned char *) from, to, strlen(from));
|
||||
}
|
||||
|
||||
/* convert a multibyte string to a wchar with a limited length */
|
||||
int
|
||||
pg_mb2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
|
||||
pg_mb2wchar_with_len(const char *from, pg_wchar *to, int len)
|
||||
{
|
||||
return (*pg_wchar_table[DatabaseEncoding->encoding].mb2wchar_with_len) (from, to, len);
|
||||
return (*pg_wchar_table[DatabaseEncoding->encoding].mb2wchar_with_len) ((const unsigned char *) from, to, len);
|
||||
}
|
||||
|
||||
/* returns the byte length of a multibyte word */
|
||||
int
|
||||
pg_mblen(const unsigned char *mbstr)
|
||||
pg_mblen(const char *mbstr)
|
||||
{
|
||||
return ((*pg_wchar_table[DatabaseEncoding->encoding].mblen) (mbstr));
|
||||
return ((*pg_wchar_table[DatabaseEncoding->encoding].mblen) ((const unsigned char *) mbstr));
|
||||
}
|
||||
|
||||
/* returns the display length of a multibyte word */
|
||||
int
|
||||
pg_dsplen(const unsigned char *mbstr)
|
||||
pg_dsplen(const char *mbstr)
|
||||
{
|
||||
return ((*pg_wchar_table[DatabaseEncoding->encoding].dsplen) (mbstr));
|
||||
return ((*pg_wchar_table[DatabaseEncoding->encoding].dsplen) ((const unsigned char *) mbstr));
|
||||
}
|
||||
|
||||
/* returns the length (counted as a wchar) of a multibyte string */
|
||||
/* returns the length (counted in wchars) of a multibyte string */
|
||||
int
|
||||
pg_mbstrlen(const unsigned char *mbstr)
|
||||
pg_mbstrlen(const char *mbstr)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
/* optimization for single byte encoding */
|
||||
if (pg_database_encoding_max_length() == 1)
|
||||
return strlen((char *) mbstr);
|
||||
return strlen(mbstr);
|
||||
|
||||
while (*mbstr)
|
||||
{
|
||||
@@ -488,11 +488,11 @@ pg_mbstrlen(const unsigned char *mbstr)
|
||||
return (len);
|
||||
}
|
||||
|
||||
/* returns the length (counted as a wchar) of a multibyte string
|
||||
/* returns the length (counted in wchars) of a multibyte string
|
||||
* (not necessarily NULL terminated)
|
||||
*/
|
||||
int
|
||||
pg_mbstrlen_with_len(const unsigned char *mbstr, int limit)
|
||||
pg_mbstrlen_with_len(const char *mbstr, int limit)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
@@ -518,7 +518,7 @@ pg_mbstrlen_with_len(const unsigned char *mbstr, int limit)
|
||||
* this function does not break multibyte word boundary.
|
||||
*/
|
||||
int
|
||||
pg_mbcliplen(const unsigned char *mbstr, int len, int limit)
|
||||
pg_mbcliplen(const char *mbstr, int len, int limit)
|
||||
{
|
||||
int clen = 0;
|
||||
int l;
|
||||
@@ -545,7 +545,7 @@ pg_mbcliplen(const unsigned char *mbstr, int len, int limit)
|
||||
* Similar to pg_mbcliplen except the limit parameter specifies the
|
||||
* character length, not the byte length. */
|
||||
int
|
||||
pg_mbcharcliplen(const unsigned char *mbstr, int len, int limit)
|
||||
pg_mbcharcliplen(const char *mbstr, int len, int limit)
|
||||
{
|
||||
int clen = 0;
|
||||
int nch = 0;
|
||||
@@ -613,10 +613,10 @@ pg_client_encoding(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
static int
|
||||
cliplen(const unsigned char *str, int len, int limit)
|
||||
cliplen(const char *str, int len, int limit)
|
||||
{
|
||||
int l = 0;
|
||||
const unsigned char *s;
|
||||
const char *s;
|
||||
|
||||
for (s = str; *s; s++, l++)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* conversion functions between pg_wchar and multibyte streams.
|
||||
* Tatsuo Ishii
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.44 2005/06/15 00:15:08 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.45 2005/09/24 17:53:17 tgl Exp $
|
||||
*
|
||||
* WIN1250 client encoding updated by Pavel Behal
|
||||
*
|
||||
@@ -769,28 +769,28 @@ pg_mic_mblen(const unsigned char *mbstr)
|
||||
* Returns the byte length of a multibyte word.
|
||||
*/
|
||||
int
|
||||
pg_encoding_mblen(int encoding, const unsigned char *mbstr)
|
||||
pg_encoding_mblen(int encoding, const char *mbstr)
|
||||
{
|
||||
Assert(PG_VALID_ENCODING(encoding));
|
||||
|
||||
return ((encoding >= 0 &&
|
||||
encoding < sizeof(pg_wchar_table) / sizeof(pg_wchar_tbl)) ?
|
||||
((*pg_wchar_table[encoding].mblen) (mbstr)) :
|
||||
((*pg_wchar_table[PG_SQL_ASCII].mblen) (mbstr)));
|
||||
((*pg_wchar_table[encoding].mblen) ((const unsigned char *) mbstr)) :
|
||||
((*pg_wchar_table[PG_SQL_ASCII].mblen) ((const unsigned char *) mbstr)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the display length of a multibyte word.
|
||||
*/
|
||||
int
|
||||
pg_encoding_dsplen(int encoding, const unsigned char *mbstr)
|
||||
pg_encoding_dsplen(int encoding, const char *mbstr)
|
||||
{
|
||||
Assert(PG_VALID_ENCODING(encoding));
|
||||
|
||||
return ((encoding >= 0 &&
|
||||
encoding < sizeof(pg_wchar_table) / sizeof(pg_wchar_tbl)) ?
|
||||
((*pg_wchar_table[encoding].dsplen) (mbstr)) :
|
||||
((*pg_wchar_table[PG_SQL_ASCII].dsplen) (mbstr)));
|
||||
((*pg_wchar_table[encoding].dsplen) ((const unsigned char *) mbstr)) :
|
||||
((*pg_wchar_table[PG_SQL_ASCII].dsplen) ((const unsigned char *) mbstr)));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -840,7 +840,7 @@ bool pg_utf8_islegal(const unsigned char *source, int length) {
|
||||
* true; when noError is false, ereport() a descriptive message.
|
||||
*/
|
||||
bool
|
||||
pg_verifymbstr(const unsigned char *mbstr, int len, bool noError)
|
||||
pg_verifymbstr(const char *mbstr, int len, bool noError)
|
||||
{
|
||||
int l;
|
||||
int i;
|
||||
@@ -857,24 +857,30 @@ pg_verifymbstr(const unsigned char *mbstr, int len, bool noError)
|
||||
l = pg_mblen(mbstr);
|
||||
|
||||
/* special UTF-8 check */
|
||||
if (encoding == PG_UTF8) {
|
||||
if(!pg_utf8_islegal(mbstr,l)) {
|
||||
if (noError) return false;
|
||||
ereport(ERROR,(errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE),errmsg("Invalid UNICODE byte sequence detected near byte %c",*mbstr)));
|
||||
if (encoding == PG_UTF8)
|
||||
{
|
||||
if(!pg_utf8_islegal((const unsigned char *) mbstr, l))
|
||||
{
|
||||
if (noError)
|
||||
return false;
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE),
|
||||
errmsg("invalid UNICODE byte sequence detected near byte 0x%02x",
|
||||
(unsigned char) *mbstr)));
|
||||
}
|
||||
} else {
|
||||
for (i = 1; i < l; i++)
|
||||
{
|
||||
/*
|
||||
* we expect that every multibyte char consists of bytes
|
||||
* having the 8th bit set
|
||||
*/
|
||||
if (i >= len || (mbstr[i] & 0x80) == 0)
|
||||
{
|
||||
char buf[8 * 2 + 1];
|
||||
char *p = buf;
|
||||
int j,
|
||||
jlimit;
|
||||
/*
|
||||
* we expect that every multibyte char consists of bytes
|
||||
* having the 8th bit set
|
||||
*/
|
||||
if (i >= len || (mbstr[i] & 0x80) == 0)
|
||||
{
|
||||
char buf[8 * 2 + 1];
|
||||
char *p = buf;
|
||||
int j,
|
||||
jlimit;
|
||||
|
||||
if (noError)
|
||||
return false;
|
||||
@@ -883,12 +889,12 @@ pg_verifymbstr(const unsigned char *mbstr, int len, bool noError)
|
||||
jlimit = Min(jlimit, 8); /* prevent buffer overrun */
|
||||
|
||||
for (j = 0; j < jlimit; j++)
|
||||
p += sprintf(p, "%02x", mbstr[j]);
|
||||
p += sprintf(p, "%02x", (unsigned char) mbstr[j]);
|
||||
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE),
|
||||
errmsg("invalid byte sequence for encoding \"%s\": 0x%s",
|
||||
GetDatabaseEncodingName(), buf)));
|
||||
errmsg("invalid byte sequence for encoding \"%s\": 0x%s",
|
||||
GetDatabaseEncodingName(), buf)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user