Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitada87a4

Browse files
committed
Use C99-designated initializer syntax for arrays related to encodings
This updates the following lookup arrays to use C99-designatedinitializer syntax, indexed based on the enum pg_enc:pg_enc2icu_tbl[]pg_enc2name_tbl[]pg_wchar_table[]This is more readable, and removes problems with ordering mistakes asthis removes dependencies between the arrays and their lookup index inthe enum pg_enc. So, adding new encodings becomes easier, even if thisdoes not happen often.Author: Jelte Fennema-NioReviewed-by: Jian He, Japin LiDiscussion:https://postgr.es/m/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com
1 parente8aecc5 commitada87a4

File tree

3 files changed

+122
-126
lines changed

3 files changed

+122
-126
lines changed

‎src/common/encnames.c

Lines changed: 77 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ static const pg_encname pg_encname_tbl[] =
297297

298298
/* ----------
299299
* These are "official" encoding names.
300-
* XXX must be sorted by the same order as enum pg_enc (in mb/pg_wchar.h)
301300
* ----------
302301
*/
303302
#ifndefWIN32
@@ -308,48 +307,48 @@ static const pg_encname pg_encname_tbl[] =
308307

309308
constpg_enc2namepg_enc2name_tbl[]=
310309
{
311-
DEF_ENC2NAME(SQL_ASCII,0),
312-
DEF_ENC2NAME(EUC_JP,20932),
313-
DEF_ENC2NAME(EUC_CN,20936),
314-
DEF_ENC2NAME(EUC_KR,51949),
315-
DEF_ENC2NAME(EUC_TW,0),
316-
DEF_ENC2NAME(EUC_JIS_2004,20932),
317-
DEF_ENC2NAME(UTF8,65001),
318-
DEF_ENC2NAME(MULE_INTERNAL,0),
319-
DEF_ENC2NAME(LATIN1,28591),
320-
DEF_ENC2NAME(LATIN2,28592),
321-
DEF_ENC2NAME(LATIN3,28593),
322-
DEF_ENC2NAME(LATIN4,28594),
323-
DEF_ENC2NAME(LATIN5,28599),
324-
DEF_ENC2NAME(LATIN6,0),
325-
DEF_ENC2NAME(LATIN7,0),
326-
DEF_ENC2NAME(LATIN8,0),
327-
DEF_ENC2NAME(LATIN9,28605),
328-
DEF_ENC2NAME(LATIN10,0),
329-
DEF_ENC2NAME(WIN1256,1256),
330-
DEF_ENC2NAME(WIN1258,1258),
331-
DEF_ENC2NAME(WIN866,866),
332-
DEF_ENC2NAME(WIN874,874),
333-
DEF_ENC2NAME(KOI8R,20866),
334-
DEF_ENC2NAME(WIN1251,1251),
335-
DEF_ENC2NAME(WIN1252,1252),
336-
DEF_ENC2NAME(ISO_8859_5,28595),
337-
DEF_ENC2NAME(ISO_8859_6,28596),
338-
DEF_ENC2NAME(ISO_8859_7,28597),
339-
DEF_ENC2NAME(ISO_8859_8,28598),
340-
DEF_ENC2NAME(WIN1250,1250),
341-
DEF_ENC2NAME(WIN1253,1253),
342-
DEF_ENC2NAME(WIN1254,1254),
343-
DEF_ENC2NAME(WIN1255,1255),
344-
DEF_ENC2NAME(WIN1257,1257),
345-
DEF_ENC2NAME(KOI8U,21866),
346-
DEF_ENC2NAME(SJIS,932),
347-
DEF_ENC2NAME(BIG5,950),
348-
DEF_ENC2NAME(GBK,936),
349-
DEF_ENC2NAME(UHC,949),
350-
DEF_ENC2NAME(GB18030,54936),
351-
DEF_ENC2NAME(JOHAB,0),
352-
DEF_ENC2NAME(SHIFT_JIS_2004,932)
310+
[PG_SQL_ASCII]=DEF_ENC2NAME(SQL_ASCII,0),
311+
[PG_EUC_JP]=DEF_ENC2NAME(EUC_JP,20932),
312+
[PG_EUC_CN]=DEF_ENC2NAME(EUC_CN,20936),
313+
[PG_EUC_KR]=DEF_ENC2NAME(EUC_KR,51949),
314+
[PG_EUC_TW]=DEF_ENC2NAME(EUC_TW,0),
315+
[PG_EUC_JIS_2004]=DEF_ENC2NAME(EUC_JIS_2004,20932),
316+
[PG_UTF8]=DEF_ENC2NAME(UTF8,65001),
317+
[PG_MULE_INTERNAL]=DEF_ENC2NAME(MULE_INTERNAL,0),
318+
[PG_LATIN1]=DEF_ENC2NAME(LATIN1,28591),
319+
[PG_LATIN2]=DEF_ENC2NAME(LATIN2,28592),
320+
[PG_LATIN3]=DEF_ENC2NAME(LATIN3,28593),
321+
[PG_LATIN4]=DEF_ENC2NAME(LATIN4,28594),
322+
[PG_LATIN5]=DEF_ENC2NAME(LATIN5,28599),
323+
[PG_LATIN6]=DEF_ENC2NAME(LATIN6,0),
324+
[PG_LATIN7]=DEF_ENC2NAME(LATIN7,0),
325+
[PG_LATIN8]=DEF_ENC2NAME(LATIN8,0),
326+
[PG_LATIN9]=DEF_ENC2NAME(LATIN9,28605),
327+
[PG_LATIN10]=DEF_ENC2NAME(LATIN10,0),
328+
[PG_WIN1256]=DEF_ENC2NAME(WIN1256,1256),
329+
[PG_WIN1258]=DEF_ENC2NAME(WIN1258,1258),
330+
[PG_WIN866]=DEF_ENC2NAME(WIN866,866),
331+
[PG_WIN874]=DEF_ENC2NAME(WIN874,874),
332+
[PG_KOI8R]=DEF_ENC2NAME(KOI8R,20866),
333+
[PG_WIN1251]=DEF_ENC2NAME(WIN1251,1251),
334+
[PG_WIN1252]=DEF_ENC2NAME(WIN1252,1252),
335+
[PG_ISO_8859_5]=DEF_ENC2NAME(ISO_8859_5,28595),
336+
[PG_ISO_8859_6]=DEF_ENC2NAME(ISO_8859_6,28596),
337+
[PG_ISO_8859_7]=DEF_ENC2NAME(ISO_8859_7,28597),
338+
[PG_ISO_8859_8]=DEF_ENC2NAME(ISO_8859_8,28598),
339+
[PG_WIN1250]=DEF_ENC2NAME(WIN1250,1250),
340+
[PG_WIN1253]=DEF_ENC2NAME(WIN1253,1253),
341+
[PG_WIN1254]=DEF_ENC2NAME(WIN1254,1254),
342+
[PG_WIN1255]=DEF_ENC2NAME(WIN1255,1255),
343+
[PG_WIN1257]=DEF_ENC2NAME(WIN1257,1257),
344+
[PG_KOI8U]=DEF_ENC2NAME(KOI8U,21866),
345+
[PG_SJIS]=DEF_ENC2NAME(SJIS,932),
346+
[PG_BIG5]=DEF_ENC2NAME(BIG5,950),
347+
[PG_GBK]=DEF_ENC2NAME(GBK,936),
348+
[PG_UHC]=DEF_ENC2NAME(UHC,949),
349+
[PG_GB18030]=DEF_ENC2NAME(GB18030,54936),
350+
[PG_JOHAB]=DEF_ENC2NAME(JOHAB,0),
351+
[PG_SHIFT_JIS_2004]=DEF_ENC2NAME(SHIFT_JIS_2004,932),
353352
};
354353

355354
/* ----------
@@ -414,41 +413,41 @@ const pg_enc2gettext pg_enc2gettext_tbl[] =
414413
*/
415414
staticconstchar*constpg_enc2icu_tbl[]=
416415
{
417-
NULL,/*PG_SQL_ASCII */
418-
"EUC-JP",/* PG_EUC_JP */
419-
"EUC-CN",/* PG_EUC_CN */
420-
"EUC-KR",/* PG_EUC_KR */
421-
"EUC-TW",/* PG_EUC_TW */
422-
NULL,/*PG_EUC_JIS_2004 */
423-
"UTF-8",/* PG_UTF8 */
424-
NULL,/*PG_MULE_INTERNAL */
425-
"ISO-8859-1",/* PG_LATIN1 */
426-
"ISO-8859-2",/* PG_LATIN2 */
427-
"ISO-8859-3",/* PG_LATIN3 */
428-
"ISO-8859-4",/* PG_LATIN4 */
429-
"ISO-8859-9",/* PG_LATIN5 */
430-
"ISO-8859-10",/* PG_LATIN6 */
431-
"ISO-8859-13",/* PG_LATIN7 */
432-
"ISO-8859-14",/* PG_LATIN8 */
433-
"ISO-8859-15",/* PG_LATIN9 */
434-
NULL,/*PG_LATIN10 */
435-
"CP1256",/* PG_WIN1256 */
436-
"CP1258",/* PG_WIN1258 */
437-
"CP866",/* PG_WIN866 */
438-
NULL,/*PG_WIN874 */
439-
"KOI8-R",/* PG_KOI8R */
440-
"CP1251",/* PG_WIN1251 */
441-
"CP1252",/* PG_WIN1252 */
442-
"ISO-8859-5",/* PG_ISO_8859_5 */
443-
"ISO-8859-6",/* PG_ISO_8859_6 */
444-
"ISO-8859-7",/* PG_ISO_8859_7 */
445-
"ISO-8859-8",/* PG_ISO_8859_8 */
446-
"CP1250",/* PG_WIN1250 */
447-
"CP1253",/* PG_WIN1253 */
448-
"CP1254",/* PG_WIN1254 */
449-
"CP1255",/* PG_WIN1255 */
450-
"CP1257",/* PG_WIN1257 */
451-
"KOI8-U",/* PG_KOI8U */
416+
[PG_SQL_ASCII]=NULL,
417+
[PG_EUC_JP]="EUC-JP",
418+
[PG_EUC_CN]="EUC-CN",
419+
[PG_EUC_KR]="EUC-KR",
420+
[PG_EUC_TW]="EUC-TW",
421+
[PG_EUC_JIS_2004]=NULL,
422+
[PG_UTF8]="UTF-8",
423+
[PG_MULE_INTERNAL]=NULL,
424+
[PG_LATIN1]="ISO-8859-1",
425+
[PG_LATIN2]="ISO-8859-2",
426+
[PG_LATIN3]="ISO-8859-3",
427+
[PG_LATIN4]="ISO-8859-4",
428+
[PG_LATIN5]="ISO-8859-9",
429+
[PG_LATIN6]="ISO-8859-10",
430+
[PG_LATIN7]="ISO-8859-13",
431+
[PG_LATIN8]="ISO-8859-14",
432+
[PG_LATIN9]="ISO-8859-15",
433+
[PG_LATIN10]=NULL,
434+
[PG_WIN1256]="CP1256",
435+
[PG_WIN1258]="CP1258",
436+
[PG_WIN866]="CP866",
437+
[PG_WIN874]=NULL,
438+
[PG_KOI8R]="KOI8-R",
439+
[PG_WIN1251]="CP1251",
440+
[PG_WIN1252]="CP1252",
441+
[PG_ISO_8859_5]="ISO-8859-5",
442+
[PG_ISO_8859_6]="ISO-8859-6",
443+
[PG_ISO_8859_7]="ISO-8859-7",
444+
[PG_ISO_8859_8]="ISO-8859-8",
445+
[PG_WIN1250]="CP1250",
446+
[PG_WIN1253]="CP1253",
447+
[PG_WIN1254]="CP1254",
448+
[PG_WIN1255]="CP1255",
449+
[PG_WIN1257]="CP1257",
450+
[PG_KOI8U]="KOI8-U",
452451
};
453452

454453
StaticAssertDecl(lengthof(pg_enc2icu_tbl)==PG_ENCODING_BE_LAST+1,

‎src/common/wchar.c

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,52 +2071,51 @@ pg_utf8_islegal(const unsigned char *source, int length)
20712071
/*
20722072
*-------------------------------------------------------------------
20732073
* encoding info table
2074-
* XXX must be sorted by the same order as enum pg_enc (in mb/pg_wchar.h)
20752074
*-------------------------------------------------------------------
20762075
*/
20772076
constpg_wchar_tblpg_wchar_table[]= {
2078-
{pg_ascii2wchar_with_len,pg_wchar2single_with_len,pg_ascii_mblen,pg_ascii_dsplen,pg_ascii_verifychar,pg_ascii_verifystr,1},/* PG_SQL_ASCII */
2079-
{pg_eucjp2wchar_with_len,pg_wchar2euc_with_len,pg_eucjp_mblen,pg_eucjp_dsplen,pg_eucjp_verifychar,pg_eucjp_verifystr,3},/* PG_EUC_JP */
2080-
{pg_euccn2wchar_with_len,pg_wchar2euc_with_len,pg_euccn_mblen,pg_euccn_dsplen,pg_euccn_verifychar,pg_euccn_verifystr,2},/* PG_EUC_CN */
2081-
{pg_euckr2wchar_with_len,pg_wchar2euc_with_len,pg_euckr_mblen,pg_euckr_dsplen,pg_euckr_verifychar,pg_euckr_verifystr,3},/* PG_EUC_KR */
2082-
{pg_euctw2wchar_with_len,pg_wchar2euc_with_len,pg_euctw_mblen,pg_euctw_dsplen,pg_euctw_verifychar,pg_euctw_verifystr,4},/* PG_EUC_TW */
2083-
{pg_eucjp2wchar_with_len,pg_wchar2euc_with_len,pg_eucjp_mblen,pg_eucjp_dsplen,pg_eucjp_verifychar,pg_eucjp_verifystr,3},/* PG_EUC_JIS_2004 */
2084-
{pg_utf2wchar_with_len,pg_wchar2utf_with_len,pg_utf_mblen,pg_utf_dsplen,pg_utf8_verifychar,pg_utf8_verifystr,4},/* PG_UTF8 */
2085-
{pg_mule2wchar_with_len,pg_wchar2mule_with_len,pg_mule_mblen,pg_mule_dsplen,pg_mule_verifychar,pg_mule_verifystr,4},/* PG_MULE_INTERNAL */
2086-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_LATIN1 */
2087-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_LATIN2 */
2088-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_LATIN3 */
2089-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_LATIN4 */
2090-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_LATIN5 */
2091-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_LATIN6 */
2092-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_LATIN7 */
2093-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_LATIN8 */
2094-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_LATIN9 */
2095-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_LATIN10 */
2096-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_WIN1256 */
2097-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_WIN1258 */
2098-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_WIN866 */
2099-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_WIN874 */
2100-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_KOI8R */
2101-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_WIN1251 */
2102-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_WIN1252 */
2103-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* ISO-8859-5 */
2104-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* ISO-8859-6 */
2105-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* ISO-8859-7 */
2106-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* ISO-8859-8 */
2107-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_WIN1250 */
2108-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_WIN1253 */
2109-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_WIN1254 */
2110-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_WIN1255 */
2111-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_WIN1257 */
2112-
{pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},/* PG_KOI8U */
2113-
{0,0,pg_sjis_mblen,pg_sjis_dsplen,pg_sjis_verifychar,pg_sjis_verifystr,2},/* PG_SJIS */
2114-
{0,0,pg_big5_mblen,pg_big5_dsplen,pg_big5_verifychar,pg_big5_verifystr,2},/* PG_BIG5 */
2115-
{0,0,pg_gbk_mblen,pg_gbk_dsplen,pg_gbk_verifychar,pg_gbk_verifystr,2},/* PG_GBK */
2116-
{0,0,pg_uhc_mblen,pg_uhc_dsplen,pg_uhc_verifychar,pg_uhc_verifystr,2},/* PG_UHC */
2117-
{0,0,pg_gb18030_mblen,pg_gb18030_dsplen,pg_gb18030_verifychar,pg_gb18030_verifystr,4},/* PG_GB18030 */
2118-
{0,0,pg_johab_mblen,pg_johab_dsplen,pg_johab_verifychar,pg_johab_verifystr,3},/* PG_JOHAB */
2119-
{0,0,pg_sjis_mblen,pg_sjis_dsplen,pg_sjis_verifychar,pg_sjis_verifystr,2}/* PG_SHIFT_JIS_2004 */
2077+
[PG_SQL_ASCII]={pg_ascii2wchar_with_len,pg_wchar2single_with_len,pg_ascii_mblen,pg_ascii_dsplen,pg_ascii_verifychar,pg_ascii_verifystr,1},
2078+
[PG_EUC_JP]={pg_eucjp2wchar_with_len,pg_wchar2euc_with_len,pg_eucjp_mblen,pg_eucjp_dsplen,pg_eucjp_verifychar,pg_eucjp_verifystr,3},
2079+
[PG_EUC_CN]={pg_euccn2wchar_with_len,pg_wchar2euc_with_len,pg_euccn_mblen,pg_euccn_dsplen,pg_euccn_verifychar,pg_euccn_verifystr,2},
2080+
[PG_EUC_KR]={pg_euckr2wchar_with_len,pg_wchar2euc_with_len,pg_euckr_mblen,pg_euckr_dsplen,pg_euckr_verifychar,pg_euckr_verifystr,3},
2081+
[PG_EUC_TW]={pg_euctw2wchar_with_len,pg_wchar2euc_with_len,pg_euctw_mblen,pg_euctw_dsplen,pg_euctw_verifychar,pg_euctw_verifystr,4},
2082+
[PG_EUC_JIS_2004]={pg_eucjp2wchar_with_len,pg_wchar2euc_with_len,pg_eucjp_mblen,pg_eucjp_dsplen,pg_eucjp_verifychar,pg_eucjp_verifystr,3},
2083+
[PG_UTF8]={pg_utf2wchar_with_len,pg_wchar2utf_with_len,pg_utf_mblen,pg_utf_dsplen,pg_utf8_verifychar,pg_utf8_verifystr,4},
2084+
[PG_MULE_INTERNAL]={pg_mule2wchar_with_len,pg_wchar2mule_with_len,pg_mule_mblen,pg_mule_dsplen,pg_mule_verifychar,pg_mule_verifystr,4},
2085+
[PG_LATIN1]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2086+
[PG_LATIN2]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2087+
[PG_LATIN3]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2088+
[PG_LATIN4]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2089+
[PG_LATIN5]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2090+
[PG_LATIN6]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2091+
[PG_LATIN7]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2092+
[PG_LATIN8]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2093+
[PG_LATIN9]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2094+
[PG_LATIN10]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2095+
[PG_WIN1256]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2096+
[PG_WIN1258]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2097+
[PG_WIN866]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2098+
[PG_WIN874]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2099+
[PG_KOI8R]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2100+
[PG_WIN1251]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2101+
[PG_WIN1252]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2102+
[PG_ISO_8859_5]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2103+
[PG_ISO_8859_6]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2104+
[PG_ISO_8859_7]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2105+
[PG_ISO_8859_8]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2106+
[PG_WIN1250]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2107+
[PG_WIN1253]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2108+
[PG_WIN1254]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2109+
[PG_WIN1255]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2110+
[PG_WIN1257]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2111+
[PG_KOI8U]={pg_latin12wchar_with_len,pg_wchar2single_with_len,pg_latin1_mblen,pg_latin1_dsplen,pg_latin1_verifychar,pg_latin1_verifystr,1},
2112+
[PG_SJIS]={0,0,pg_sjis_mblen,pg_sjis_dsplen,pg_sjis_verifychar,pg_sjis_verifystr,2},
2113+
[PG_BIG5]={0,0,pg_big5_mblen,pg_big5_dsplen,pg_big5_verifychar,pg_big5_verifystr,2},
2114+
[PG_GBK]={0,0,pg_gbk_mblen,pg_gbk_dsplen,pg_gbk_verifychar,pg_gbk_verifystr,2},
2115+
[PG_UHC]={0,0,pg_uhc_mblen,pg_uhc_dsplen,pg_uhc_verifychar,pg_uhc_verifystr,2},
2116+
[PG_GB18030]={0,0,pg_gb18030_mblen,pg_gb18030_dsplen,pg_gb18030_verifychar,pg_gb18030_verifystr,4},
2117+
[PG_JOHAB]={0,0,pg_johab_mblen,pg_johab_dsplen,pg_johab_verifychar,pg_johab_verifystr,3},
2118+
[PG_SHIFT_JIS_2004]={0,0,pg_sjis_mblen,pg_sjis_dsplen,pg_sjis_verifychar,pg_sjis_verifystr,2},
21202119
};
21212120

21222121
/*

‎src/include/mb/pg_wchar.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,9 @@ typedef unsigned int pg_wchar;
224224
/*
225225
* PostgreSQL encoding identifiers
226226
*
227-
* WARNING: the order of this enum must be same as order of entries
228-
*in the pg_enc2name_tbl[] array (in src/common/encnames.c), and
229-
*in the pg_wchar_table[] array (in src/common/wchar.c)!
230-
*
231-
*If you add some encoding don't forget to check
227+
* WARNING: If you add some encoding don't forget to update
228+
*the pg_enc2name_tbl[] array (in src/common/encnames.c) and
229+
*the pg_wchar_table[] array (in src/common/wchar.c) and to check
232230
*PG_ENCODING_BE_LAST macro.
233231
*
234232
* PG_SQL_ASCII is default encoding and must be = 0.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp