mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-30 19:00:29 +08:00
More uses of IS_HIGHBIT_SET() macro.
This commit is contained in:
parent
6840cccd11
commit
a2384d008a
@ -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.57 2005/12/25 02:14:17 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conv.c,v 1.58 2005/12/26 19:30:44 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -95,7 +95,7 @@ mic2gb18030(unsigned char *mic, unsigned char *p, int len)
|
||||
{
|
||||
len -= pg_mic_mblen(mic++);
|
||||
|
||||
if (c1 <= 0x7f) /* ASCII */
|
||||
if (!IS_HIGHBIT_SET(c1)) /* ASCII */
|
||||
*p++ = c1;
|
||||
else if (c1 >= 0x81 && c1 <= 0xfe)
|
||||
{
|
||||
@ -141,10 +141,8 @@ latin2mic(unsigned char *l, unsigned char *p, int len, int lc)
|
||||
|
||||
while (len-- > 0 && (c1 = *l++))
|
||||
{
|
||||
if (c1 > 0x7f)
|
||||
{ /* Latin? */
|
||||
*p++ = lc;
|
||||
}
|
||||
if (IS_HIGHBIT_SET(c1))
|
||||
*p++ = lc; /* Latin? */
|
||||
*p++ = c1;
|
||||
}
|
||||
*p = '\0';
|
||||
@ -164,7 +162,7 @@ mic2latin(unsigned char *mic, unsigned char *p, int len, int lc)
|
||||
|
||||
if (c1 == lc)
|
||||
*p++ = *mic++;
|
||||
else if (c1 > 0x7f)
|
||||
else if (IS_HIGHBIT_SET(c1))
|
||||
{
|
||||
mic--;
|
||||
pg_print_bogus_char(&mic, &p);
|
||||
@ -201,7 +199,7 @@ pg_mic2ascii(unsigned char *mic, unsigned char *p, int len)
|
||||
|
||||
while (len-- > 0 && (c1 = *mic))
|
||||
{
|
||||
if (c1 > 0x7f)
|
||||
if (IS_HIGHBIT_SET(c1))
|
||||
pg_print_bogus_char(&mic, &p);
|
||||
else
|
||||
{ /* should be ASCII */
|
||||
|
@ -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.11 2005/12/25 02:14:18 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.12 2005/12/26 19:30:44 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -110,15 +110,13 @@ mic2euc_cn(unsigned char *mic, unsigned char *p, int len)
|
||||
*p++ = *mic++;
|
||||
*p++ = *mic++;
|
||||
}
|
||||
else if (c1 > 0x7f)
|
||||
else if (IS_HIGHBIT_SET(c1))
|
||||
{ /* cannot convert to EUC_CN! */
|
||||
mic--;
|
||||
pg_print_bogus_char(&mic, &p);
|
||||
}
|
||||
else
|
||||
{ /* should be ASCII */
|
||||
*p++ = c1;
|
||||
}
|
||||
*p++ = c1; /* should be ASCII */
|
||||
}
|
||||
*p = '\0';
|
||||
}
|
||||
|
@ -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.13 2005/10/15 02:49:34 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c,v 1.14 2005/12/26 19:30:44 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -180,7 +180,7 @@ sjis2mic(unsigned char *sjis, unsigned char *p, int len)
|
||||
*p++ = LC_JISX0201K;
|
||||
*p++ = c1;
|
||||
}
|
||||
else if (c1 > 0x7f)
|
||||
else if (IS_HIGHBIT_SET(c1))
|
||||
{
|
||||
/*
|
||||
* JIS X0208, X0212, user defined extended characters
|
||||
@ -355,16 +355,14 @@ mic2sjis(unsigned char *mic, unsigned char *p, int len)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (c1 > 0x7f)
|
||||
else if (IS_HIGHBIT_SET(c1))
|
||||
{
|
||||
/* cannot convert to SJIS! */
|
||||
*p++ = PGSJISALTCODE >> 8;
|
||||
*p++ = PGSJISALTCODE & 0xff;
|
||||
}
|
||||
else
|
||||
{ /* should be ASCII */
|
||||
*p++ = c1;
|
||||
}
|
||||
*p++ = c1; /* should be ASCII */
|
||||
}
|
||||
*p = '\0';
|
||||
}
|
||||
@ -436,15 +434,13 @@ mic2euc_jp(unsigned char *mic, unsigned char *p, int len)
|
||||
*p++ = *mic++;
|
||||
*p++ = *mic++;
|
||||
}
|
||||
else if (c1 > 0x7f)
|
||||
else if (IS_HIGHBIT_SET(c1))
|
||||
{ /* cannot convert to EUC_JP! */
|
||||
mic--;
|
||||
pg_print_bogus_char(&mic, &p);
|
||||
}
|
||||
else
|
||||
{ /* should be ASCII */
|
||||
*p++ = c1;
|
||||
}
|
||||
*p++ = c1; /* should be ASCII */
|
||||
}
|
||||
*p = '\0';
|
||||
}
|
||||
|
@ -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.11 2005/12/25 02:14:18 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.12 2005/12/26 19:30:45 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -110,15 +110,13 @@ mic2euc_kr(unsigned char *mic, unsigned char *p, int len)
|
||||
*p++ = *mic++;
|
||||
*p++ = *mic++;
|
||||
}
|
||||
else if (c1 > 0x7f)
|
||||
else if (IS_HIGHBIT_SET(c1))
|
||||
{ /* cannot convert to EUC_KR! */
|
||||
mic--;
|
||||
pg_print_bogus_char(&mic, &p);
|
||||
}
|
||||
else
|
||||
{ /* should be ASCII */
|
||||
*p++ = c1;
|
||||
}
|
||||
*p++ = c1; /* should be ASCII */
|
||||
}
|
||||
*p = '\0';
|
||||
}
|
||||
|
@ -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.11 2005/12/25 02:14:18 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.12 2005/12/26 19:30:45 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -224,15 +224,13 @@ mic2euc_tw(unsigned char *mic, unsigned char *p, int len)
|
||||
*p++ = *mic++;
|
||||
*p++ = *mic++;
|
||||
}
|
||||
else if (c1 > 0x7f)
|
||||
else if (IS_HIGHBIT_SET(c1))
|
||||
{ /* cannot convert to EUC_TW! */
|
||||
mic--;
|
||||
pg_print_bogus_char(&mic, &p);
|
||||
}
|
||||
else
|
||||
{ /* should be ASCII */
|
||||
*p++ = c1;
|
||||
}
|
||||
*p++ = c1; /* should be ASCII */
|
||||
}
|
||||
*p = '\0';
|
||||
}
|
||||
@ -252,7 +250,7 @@ big52mic(unsigned char *big5, unsigned char *p, int len)
|
||||
|
||||
while (len >= 0 && (c1 = *big5++))
|
||||
{
|
||||
if (c1 <= 0x7fU)
|
||||
if (!IS_HIGHBIT_SET(c1))
|
||||
{ /* ASCII */
|
||||
len--;
|
||||
*p++ = c1;
|
||||
@ -328,7 +326,7 @@ mic2big5(unsigned char *mic, unsigned char *p, int len)
|
||||
*p++ = big5buf & 0x00ff;
|
||||
}
|
||||
}
|
||||
else if (c1 <= 0x7f) /* ASCII */
|
||||
else if (!IS_HIGHBIT_SET(c1)) /* ASCII */
|
||||
*p++ = c1;
|
||||
else
|
||||
{ /* cannot convert to Big5! */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* conversion functions between pg_wchar and multibyte streams.
|
||||
* Tatsuo Ishii
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.51 2005/12/25 02:14:18 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.52 2005/12/26 19:30:44 momjian Exp $
|
||||
*
|
||||
* WIN1250 client encoding updated by Pavel Behal
|
||||
*
|
||||
@ -542,7 +542,7 @@ pg_sjis_mblen(const unsigned char *s)
|
||||
|
||||
if (*s >= 0xa1 && *s <= 0xdf)
|
||||
len = 1; /* 1 byte kana? */
|
||||
else if (*s > 0x7f)
|
||||
else if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* kanji? */
|
||||
else
|
||||
len = 1; /* should be ASCII */
|
||||
@ -556,7 +556,7 @@ pg_sjis_dsplen(const unsigned char *s)
|
||||
|
||||
if (*s >= 0xa1 && *s <= 0xdf)
|
||||
len = 1; /* 1 byte kana? */
|
||||
else if (*s > 0x7f)
|
||||
else if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* kanji? */
|
||||
else
|
||||
len = 1; /* should be ASCII */
|
||||
@ -571,7 +571,7 @@ pg_big5_mblen(const unsigned char *s)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (*s > 0x7f)
|
||||
if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* kanji? */
|
||||
else
|
||||
len = 1; /* should be ASCII */
|
||||
@ -583,7 +583,7 @@ pg_big5_dsplen(const unsigned char *s)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (*s > 0x7f)
|
||||
if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* kanji? */
|
||||
else
|
||||
len = 1; /* should be ASCII */
|
||||
@ -598,7 +598,7 @@ pg_gbk_mblen(const unsigned char *s)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (*s > 0x7f)
|
||||
if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* kanji? */
|
||||
else
|
||||
len = 1; /* should be ASCII */
|
||||
@ -610,7 +610,7 @@ pg_gbk_dsplen(const unsigned char *s)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (*s > 0x7f)
|
||||
if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* kanji? */
|
||||
else
|
||||
len = 1; /* should be ASCII */
|
||||
@ -625,7 +625,7 @@ pg_uhc_mblen(const unsigned char *s)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (*s > 0x7f)
|
||||
if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* 2byte? */
|
||||
else
|
||||
len = 1; /* should be ASCII */
|
||||
@ -637,7 +637,7 @@ pg_uhc_dsplen(const unsigned char *s)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (*s > 0x7f)
|
||||
if (IS_HIGHBIT_SET(*s))
|
||||
len = 2; /* 2byte? */
|
||||
else
|
||||
len = 1; /* should be ASCII */
|
||||
@ -653,7 +653,7 @@ pg_gb18030_mblen(const unsigned char *s)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (*s <= 0x7f)
|
||||
if (!IS_HIGHBIT_SET(*s))
|
||||
len = 1; /* ASCII */
|
||||
else
|
||||
{
|
||||
@ -672,7 +672,7 @@ pg_gb18030_dsplen(const unsigned char *s)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (*s <= 0x7f)
|
||||
if (!IS_HIGHBIT_SET(*s))
|
||||
len = 1; /* ASCII */
|
||||
else
|
||||
len = 2;
|
||||
|
Loading…
Reference in New Issue
Block a user