Datum euc_tw_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_EUC_TW, PG_MULE_INTERNAL); euc_tw2mic(src, dest, len); PG_RETURN_VOID(); }
datum_t euc_tw_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_EUC_TW, PG_MULE_INTERNAL); euc_tw2mic(src, dest, len); RET_VOID(); }
Datum euc_tw_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_EUC_TW); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); Assert(len >= 0); euc_tw2mic(src, dest, len); PG_RETURN_VOID(); }
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(); }