Пример #1
0
datum_t
mic_to_big5(PG_FUNC_ARGS)
{
	unsigned char *src = (unsigned char *) ARG_CSTRING(2);
	unsigned char *dest = (unsigned char *) ARG_CSTRING(3);
	int			len = ARG_INT32(4);

	CHECK_ENC_CONV_ARGS(PG_MULE_INTERNAL, PG_BIG5);

	mic2big5(src, dest, len);

	RET_VOID();
}
Пример #2
0
Datum
mic_to_big5(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);

	CHECK_ENCODING_CONVERSION_ARGS(PG_MULE_INTERNAL, PG_BIG5);

	mic2big5(src, dest, len);

	PG_RETURN_VOID();
}
Пример #3
0
Datum
mic_to_big5(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);

	Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
	Assert(PG_GETARG_INT32(1) == PG_BIG5);
	Assert(len >= 0);

	mic2big5(src, dest, len);

	PG_RETURN_VOID();
}
Пример #4
0
Datum
euc_tw_to_big5(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);
	unsigned char *buf;

	CHECK_ENCODING_CONVERSION_ARGS(PG_EUC_TW, PG_BIG5);

	buf = palloc(len * ENCODING_GROWTH_RATE + 1);
	euc_tw2mic(src, buf, len);
	mic2big5(buf, dest, strlen((char *) buf));
	pfree(buf);

	PG_RETURN_VOID();
}