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

Commit8f02f22

Browse files
committed
Fix some compiler warnings (Tomoaki Nishiyama), add WIN1250 support (Pavel Behal)
1 parent2859bde commit8f02f22

File tree

4 files changed

+81
-15
lines changed

4 files changed

+81
-15
lines changed

‎src/backend/utils/mb/conv.c

Lines changed: 70 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@
22
* conversion between client encoding and server internal encoding
33
* (currently mule internal code (mic) is used)
44
* Tatsuo Ishii
5-
* $Id: conv.c,v 1.11 1999/05/26 15:19:55 momjian Exp $
5+
* WIN1250 client encoding support contributed by Pavel Behal
6+
*
7+
* $Id: conv.c,v 1.12 1999/07/11 22:47:20 ishii Exp $
8+
*
9+
*
610
*/
11+
712
#include<stdio.h>
813
#include<string.h>
914

1015
#include"mb/pg_wchar.h"
1116

1217
/*
13-
* convert bogus chars that cannot be represented in the current encoding
18+
* convert bogus chars that cannot be represented in the current
19+
encoding
1420
* system.
1521
*/
1622
staticvoid
@@ -557,7 +563,6 @@ mic2latin4(unsigned char *mic, unsigned char *p, int len)
557563
{
558564
mic2latin(mic,p,len,LC_ISO8859_4);
559565
}
560-
561566
#ifdefNOT_USED
562567
staticvoid
563568
latin52mic(unsignedchar*l,unsignedchar*p,intlen)
@@ -724,7 +729,7 @@ mic2latin_with_table(
724729
staticvoid
725730
iso2mic(unsignedchar*l,unsignedchar*p,intlen)
726731
{
727-
staticchariso2koi[]= {
732+
staticunsignedchariso2koi[]= {
728733
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
729734
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
730735
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -750,7 +755,7 @@ iso2mic(unsigned char *l, unsigned char *p, int len)
750755
staticvoid
751756
mic2iso(unsignedchar*mic,unsignedchar*p,intlen)
752757
{
753-
staticcharkoi2iso[]= {
758+
staticunsignedcharkoi2iso[]= {
754759
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
755760
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
756761
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -776,7 +781,7 @@ mic2iso(unsigned char *mic, unsigned char *p, int len)
776781
staticvoid
777782
win2mic(unsignedchar*l,unsignedchar*p,intlen)
778783
{
779-
staticcharwin2koi[]= {
784+
staticunsignedcharwin2koi[]= {
780785
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
781786
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
782787
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -802,7 +807,7 @@ win2mic(unsigned char *l, unsigned char *p, int len)
802807
staticvoid
803808
mic2win(unsignedchar*mic,unsignedchar*p,intlen)
804809
{
805-
staticcharkoi2win[]= {
810+
staticunsignedcharkoi2win[]= {
806811
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
807812
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
808813
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -828,7 +833,7 @@ mic2win(unsigned char *mic, unsigned char *p, int len)
828833
staticvoid
829834
alt2mic(unsignedchar*l,unsignedchar*p,intlen)
830835
{
831-
staticcharalt2koi[]= {
836+
staticunsignedcharalt2koi[]= {
832837
0xe1,0xe2,0xf7,0xe7,0xe4,0xe5,0xf6,0xfa,
833838
0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,0xf0,
834839
0xf2,0xf3,0xf4,0xf5,0xe6,0xe8,0xe3,0xfe,
@@ -854,7 +859,7 @@ alt2mic(unsigned char *l, unsigned char *p, int len)
854859
staticvoid
855860
mic2alt(unsignedchar*mic,unsignedchar*p,intlen)
856861
{
857-
staticcharkoi2alt[]= {
862+
staticunsignedcharkoi2alt[]= {
858863
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
859864
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
860865
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -880,6 +885,61 @@ mic2alt(unsigned char *mic, unsigned char *p, int len)
880885
* end of Cyrillic support
881886
*/
882887

888+
889+
/*-----------------------------------------------------------------
890+
* WIN1250
891+
* Microsoft's CP1250(windows-1250)
892+
*-----------------------------------------------------------------*/
893+
staticvoid
894+
win12502mic(unsignedchar*l,unsignedchar*p,intlen)
895+
{
896+
staticunsignedcharwin1250_2_iso88592[]= {
897+
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,
898+
0x88,0x89,0xA9,0x8B,0xA6,0xAB,0xAE,0xAC,
899+
0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,
900+
0x98,0x99,0xB9,0x9B,0xB6,0xBB,0xBE,0xBC,
901+
0xA0,0xB7,0xA2,0xA3,0xA4,0xA1,0x00,0xA7,
902+
0xA8,0x00,0xAA,0x00,0x00,0xAD,0x00,0xAF,
903+
0xB0,0x00,0xB2,0xB3,0xB4,0x00,0x00,0x00,
904+
0xB8,0xB1,0xBA,0x00,0xA5,0xBD,0xB5,0xBF,
905+
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,
906+
0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
907+
0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,
908+
0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,
909+
0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,
910+
0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
911+
0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,
912+
0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF
913+
};
914+
915+
latin2mic_with_table(l,p,len,LC_ISO8859_2,win1250_2_iso88592);
916+
}
917+
staticvoid
918+
mic2win1250(unsignedchar*mic,unsignedchar*p,intlen)
919+
{
920+
staticunsignedchariso88592_2_win1250[]= {
921+
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,
922+
0x88,0x89,0x00,0x8B,0x00,0x00,0x00,0x00,
923+
0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,
924+
0x98,0x99,0x00,0x9B,0x00,0x00,0x00,0x00,
925+
0xA0,0xA5,0xA2,0xA3,0xA4,0xBC,0x8C,0xA7,
926+
0xA8,0x8A,0xAA,0x8D,0x8F,0xAD,0x8E,0xAF,
927+
0xB0,0xB9,0xB2,0xB3,0xB4,0xBE,0x9C,0xA1,
928+
0xB8,0x9A,0xBA,0x9D,0x9F,0xBD,0x9E,0xBF,
929+
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,
930+
0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
931+
0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,
932+
0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,
933+
0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,
934+
0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
935+
0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,
936+
0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF
937+
};
938+
939+
mic2latin_with_table(mic,p,len,LC_ISO8859_2,iso88592_2_win1250);
940+
}
941+
/*-----------------------------------------------------------------*/
942+
883943
pg_encoding_conv_tblpg_conv_tbl[]= {
884944
{SQL_ASCII,"SQL_ASCII",0,ascii2mic,mic2ascii},/* SQL/ACII */
885945
{EUC_JP,"EUC_JP",0,euc_jp2mic,mic2euc_jp},/* EUC_JP */
@@ -898,5 +958,6 @@ pg_encoding_conv_tbl pg_conv_tbl[] = {
898958
{ALT,"ALT",0,alt2mic,mic2alt},/* CP866 */
899959
{SJIS,"SJIS",1,sjis2mic,mic2sjis},/* SJIS */
900960
{BIG5,"BIG5",1,big52mic,mic2big5},/* Big5 */
961+
{WIN1250,"WIN1250",1,win12502mic,mic2win1250},/* WIN 1250 */
901962
{-1,"",0,0,0}/* end mark */
902963
};

‎src/backend/utils/mb/wchar.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
/*
22
* conversion functions between pg_wchar and multi-byte streams.
33
* Tatsuo Ishii
4-
* $Id: wchar.c,v 1.8 1999/05/25 16:12:45 momjian Exp $
4+
* $Id: wchar.c,v 1.9 1999/07/11 22:47:20 ishii Exp $
5+
*
6+
* WIN1250 client encoding updated by Pavel Behal
7+
*
58
*/
69

710
#include"mb/pg_wchar.h"
@@ -454,7 +457,8 @@ pg_wchar_tbl pg_wchar_table[] = {
454457
{pg_latin12wchar_with_len,pg_latin1_mblen},/* 30 */
455458
{pg_latin12wchar_with_len,pg_latin1_mblen},/* 31 */
456459
{0,pg_sjis_mblen},/* 32 */
457-
{0,pg_big5_mblen}/* 33 */
460+
{0,pg_big5_mblen},/* 33 */
461+
{pg_latin12wchar_with_len,pg_latin1_mblen}/* 34 */
458462
};
459463

460464
/* returns the byte length of a word for mule internal code */

‎src/bin/psql/psqlHelp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright (c) 1994, Regents of the University of California
77
*
8-
* $Id: psqlHelp.h,v 1.71 1999/06/17 15:15:51 momjian Exp $
8+
* $Id: psqlHelp.h,v 1.72 1999/07/11 22:47:21 ishii Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -333,7 +333,7 @@ TIMEZONE|XACTISOLEVEL|CLIENT_ENCODING|SERVER_ENCODING"},
333333
\tSET TRANSACTION ISOLATION LEVEL 'SERIALIZABLE'|'READ COMMITTED'\n\
334334
\tSET CLIENT_ENCODING|NAMES TO 'EUC_JP'|'SJIS'|'EUC_CN'|'EUC_KR'|'EUC_TW'|\n\
335335
\t 'BIG5'|'MULE_INTERNAL'|'LATIN1'|'LATIN2'|'LATIN3'|'LATIN4'|'LATIN5'|\n\
336-
\t 'KOI8|'WIN'|'ALT'\n\
336+
\t 'KOI8|'WIN'|'ALT'|'WIN1250'\n\
337337
\tSET SERVER_ENCODING TO 'EUC_JP'|'SJIS'|'EUC_CN'|'EUC_KR'|'EUC_TW'|\n\
338338
\t 'BIG5'|'MULE_INTERNAL'|'LATIN1'|'LATIN2'|'LATIN3'|'LATIN4'|'LATIN5'|\n\
339339
\t 'KOI8|'WIN'|'ALT'"},

‎src/include/mb/pg_wchar.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: pg_wchar.h,v 1.8 1999/05/25 16:14:04 momjian Exp $ */
1+
/* $Id: pg_wchar.h,v 1.9 1999/07/11 22:47:19 ishii Exp $ */
22

33
#ifndefPG_WCHAR_H
44
#definePG_WCHAR_H
@@ -29,6 +29,7 @@
2929
/* followings are for client encoding only */
3030
#defineSJIS 32/* Shift JIS */
3131
#defineBIG5 33/* Big5 */
32+
#defineWIN1250 34/* windows-1250 */
3233

3334
#ifdefMULTIBYTE
3435
typedefunsignedintpg_wchar;
@@ -79,7 +80,7 @@ typedef struct
7980
{
8081
intencoding;/* encoding symbol value */
8182
char*name;/* encoding name */
82-
intis_client_only;/* 0: server/clientbothg supported 1:
83+
intis_client_only;/* 0: server/clientboth supported 1:
8384
* client only */
8485
void(*to_mic) ();/* client encoding to MIC */
8586
void(*from_mic) ();/* MIC to client encoding */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp