示例#1
0
datum_t
big5_to_mic(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_BIG5, PG_MULE_INTERNAL);

	big52mic(src, dest, len);

	RET_VOID();
}
示例#2
0
Datum
big5_to_mic(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_BIG5, PG_MULE_INTERNAL);

	big52mic(src, dest, len);

	PG_RETURN_VOID();
}
Datum
big5_to_mic(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_BIG5);
	Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
	Assert(len >= 0);

	big52mic(src, dest, len);

	PG_RETURN_VOID();
}
示例#4
0
Datum
big5_to_euc_tw(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_BIG5, PG_EUC_TW);

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

	PG_RETURN_VOID();
}