77 const unsigned char *
start = euc;
94 (
const char *) euc,
len);
109 (
const char *) euc,
len);
112 if (c1 ==
SS2 && l == 2)
116 else if (c1 ==
SS3 && l == 3)
132 *p++ = ((ku + 0x1df) >> 1) - (ku >> 3) * 3;
135 if (ku >= 78 && ku <= 94)
137 *p++ = (ku + 0x19b) >> 1;
144 (
const char *) euc,
len);
150 if (ten >= 1 && ten <= 63)
152 else if (ten >= 64 && ten <= 94)
159 (
const char *) euc,
len);
171 if (ku >= 1 && ku <= 62)
172 *p++ = (ku + 0x101) >> 1;
173 else if (ku >= 63 && ku <= 94)
174 *p++ = (ku + 0x181) >> 1;
180 (
const char *) euc,
len);
185 if (ten >= 1 && ten <= 63)
187 else if (ten >= 64 && ten <= 94)
194 (
const char *) euc,
len);
205 (
const char *) euc,
len);
226 if (
b >= 0x40 &&
b <= 0x7e)
231 else if (
b >= 0x80 &&
b <= 0x9e)
236 else if (
b >= 0x9f &&
b <= 0xfc)
256 const unsigned char *
start = sjis;
276 (
const char *) sjis,
len);
286 if (l < 0 || l >
len)
291 (
const char *) sjis,
len);
294 if (c1 >= 0xa1 && c1 <= 0xdf && l == 1)
311 if (c1 >= 0x81 && c1 <= 0x9f)
313 ku = (c1 << 1) - 0x100;
320 (
const char *) sjis,
len);
324 else if (c1 >= 0xe0 && c1 <= 0xef)
326 ku = (c1 << 1) - 0x180;
333 (
const char *) sjis,
len);
337 else if (c1 >= 0xf0 && c1 <= 0xf3)
347 (
const char *) sjis,
len);
352 ku = kubun == 0 ? 8 : 1;
355 ku = kubun == 0 ? 4 : 3;
358 ku = kubun == 0 ? 12 : 5;
361 ku = kubun == 0 ? 14 : 13;
365 else if (c1 >= 0xf4 && c1 <= 0xfc)
374 (
const char *) sjis,
len);
376 if (c1 == 0xf4 && kubun == 1)
379 ku = (c1 << 1) - 0x19a - kubun;
386 (
const char *) sjis,
len);
#define IS_HIGHBIT_SET(ch)
static int euc_jis_20042shift_jis_2004(const unsigned char *euc, unsigned char *p, int len, bool noError)
static int get_ten(int b, int *ku)
Datum shift_jis_2004_to_euc_jis_2004(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(euc_jis_2004_to_shift_jis_2004)
static int shift_jis_20042euc_jis_2004(const unsigned char *sjis, unsigned char *p, int len, bool noError)
Datum euc_jis_2004_to_shift_jis_2004(PG_FUNCTION_ARGS)
#define PG_GETARG_CSTRING(n)
#define PG_RETURN_INT32(x)
#define PG_GETARG_INT32(n)
#define PG_GETARG_BOOL(n)
void report_invalid_encoding(int encoding, const char *mbstr, int len)
#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding, destencoding)
int pg_encoding_verifymbchar(int encoding, const char *mbstr, int len)