11/*
22 * conversion functions between pg_wchar and multibyte streams.
33 * Tatsuo Ishii
4- * $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.48 2005/12/2409:35:36 ishii Exp $
4+ * $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.49 2005/12/2416:49:48 momjian Exp $
55 *
66 * WIN1250 client encoding updated by Pavel Behal
77 *
2828/*
2929 * SQL/ASCII
3030 */
31- static int pg_ascii2wchar_with_len
31+ static int
32+ pg_ascii2wchar_with_len
3233(const unsignedchar * from ,pg_wchar * to ,int len )
3334{
3435int cnt = 0 ;
@@ -40,19 +41,19 @@ static intpg_ascii2wchar_with_len
4041cnt ++ ;
4142}
4243* to = 0 ;
43- return ( cnt ) ;
44+ return cnt ;
4445}
4546
4647static int
4748pg_ascii_mblen (const unsignedchar * s )
4849{
49- return ( 1 ) ;
50+ return 1 ;
5051}
5152
5253static int
5354pg_ascii_dsplen (const unsignedchar * s )
5455{
55- return ( 1 ) ;
56+ return 1 ;
5657}
5758
5859/*
@@ -93,7 +94,7 @@ static intpg_euc2wchar_with_len
9394cnt ++ ;
9495}
9596* to = 0 ;
96- return ( cnt ) ;
97+ return cnt ;
9798}
9899
99100static int
@@ -109,7 +110,7 @@ pg_euc_mblen(const unsigned char *s)
109110len = 2 ;
110111else
111112len = 1 ;
112- return ( len ) ;
113+ return len ;
113114}
114115
115116static int
@@ -125,7 +126,7 @@ pg_euc_dsplen(const unsigned char *s)
125126len = 2 ;
126127else
127128len = 1 ;
128- return ( len ) ;
129+ return len ;
129130}
130131
131132/*
@@ -134,13 +135,13 @@ pg_euc_dsplen(const unsigned char *s)
134135static int pg_eucjp2wchar_with_len
135136(const unsignedchar * from ,pg_wchar * to ,int len )
136137{
137- return ( pg_euc2wchar_with_len (from ,to ,len ) );
138+ return pg_euc2wchar_with_len (from ,to ,len );
138139}
139140
140141static int
141142pg_eucjp_mblen (const unsignedchar * s )
142143{
143- return ( pg_euc_mblen (s ) );
144+ return pg_euc_mblen (s );
144145}
145146
146147static int
@@ -156,7 +157,7 @@ pg_eucjp_dsplen(const unsigned char *s)
156157len = 2 ;
157158else
158159len = 1 ;
159- return ( len ) ;
160+ return len ;
160161}
161162
162163/*
@@ -165,19 +166,19 @@ pg_eucjp_dsplen(const unsigned char *s)
165166static int pg_euckr2wchar_with_len
166167(const unsignedchar * from ,pg_wchar * to ,int len )
167168{
168- return ( pg_euc2wchar_with_len (from ,to ,len ) );
169+ return pg_euc2wchar_with_len (from ,to ,len );
169170}
170171
171172static int
172173pg_euckr_mblen (const unsignedchar * s )
173174{
174- return ( pg_euc_mblen (s ) );
175+ return pg_euc_mblen (s );
175176}
176177
177178static int
178179pg_euckr_dsplen (const unsignedchar * s )
179180{
180- return ( pg_euc_dsplen (s ) );
181+ return pg_euc_dsplen (s );
181182}
182183
183184/*
@@ -220,7 +221,7 @@ static intpg_euccn2wchar_with_len
220221cnt ++ ;
221222}
222223* to = 0 ;
223- return ( cnt ) ;
224+ return cnt ;
224225}
225226
226227static int
@@ -232,7 +233,7 @@ pg_euccn_mblen(const unsigned char *s)
232233len = 2 ;
233234else
234235len = 1 ;
235- return ( len ) ;
236+ return len ;
236237}
237238
238239static int
@@ -244,7 +245,7 @@ pg_euccn_dsplen(const unsigned char *s)
244245len = 2 ;
245246else
246247len = 1 ;
247- return ( len ) ;
248+ return len ;
248249}
249250
250251/*
@@ -288,7 +289,7 @@ static intpg_euctw2wchar_with_len
288289cnt ++ ;
289290}
290291* to = 0 ;
291- return ( cnt ) ;
292+ return cnt ;
292293}
293294
294295static int
@@ -304,7 +305,7 @@ pg_euctw_mblen(const unsigned char *s)
304305len = 2 ;
305306else
306307len = 1 ;
307- return ( len ) ;
308+ return len ;
308309}
309310
310311static int
@@ -320,7 +321,7 @@ pg_euctw_dsplen(const unsigned char *s)
320321len = 2 ;
321322else
322323len = 1 ;
323- return ( len ) ;
324+ return len ;
324325}
325326
326327/*
@@ -329,19 +330,19 @@ pg_euctw_dsplen(const unsigned char *s)
329330static int
330331pg_johab2wchar_with_len (const unsignedchar * from ,pg_wchar * to ,int len )
331332{
332- return ( pg_euc2wchar_with_len (from ,to ,len ) );
333+ return pg_euc2wchar_with_len (from ,to ,len );
333334}
334335
335336static int
336337pg_johab_mblen (const unsignedchar * s )
337338{
338- return ( pg_euc_mblen (s ) );
339+ return pg_euc_mblen (s );
339340}
340341
341342static int
342343pg_johab_dsplen (const unsignedchar * s )
343344{
344- return ( pg_euc_dsplen (s ) );
345+ return pg_euc_dsplen (s );
345346}
346347
347348/*
@@ -392,7 +393,7 @@ pg_utf2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
392393cnt ++ ;
393394}
394395* to = 0 ;
395- return ( cnt ) ;
396+ return cnt ;
396397}
397398
398399/*
@@ -415,7 +416,7 @@ pg_utf_mblen(const unsigned char *s)
415416len = 5 ;
416417else if ((* s & 0xfe )== 0xfc )
417418len = 6 ;
418- return ( len ) ;
419+ return len ;
419420}
420421
421422static int
@@ -474,7 +475,7 @@ pg_mule2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
474475cnt ++ ;
475476}
476477* to = 0 ;
477- return ( cnt ) ;
478+ return cnt ;
478479}
479480
480481int
@@ -494,7 +495,7 @@ pg_mule_mblen(const unsigned char *s)
494495{/* assume ASCII */
495496len = 1 ;
496497}
497- return ( len ) ;
498+ return len ;
498499}
499500
500501static int
@@ -518,19 +519,19 @@ pg_latin12wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
518519cnt ++ ;
519520}
520521* to = 0 ;
521- return ( cnt ) ;
522+ return cnt ;
522523}
523524
524525static int
525526pg_latin1_mblen (const unsignedchar * s )
526527{
527- return ( 1 ) ;
528+ return 1 ;
528529}
529530
530531static int
531532pg_latin1_dsplen (const unsignedchar * s )
532533{
533- return ( 1 ) ;
534+ return 1 ;
534535}
535536
536537/*
@@ -553,7 +554,7 @@ pg_sjis_mblen(const unsigned char *s)
553554{/* should be ASCII */
554555len = 1 ;
555556}
556- return ( len ) ;
557+ return len ;
557558}
558559
559560static int
@@ -573,7 +574,7 @@ pg_sjis_dsplen(const unsigned char *s)
573574{/* should be ASCII */
574575len = 1 ;
575576}
576- return ( len ) ;
577+ return len ;
577578}
578579
579580/*
@@ -592,7 +593,7 @@ pg_big5_mblen(const unsigned char *s)
592593{/* should be ASCII */
593594len = 1 ;
594595}
595- return ( len ) ;
596+ return len ;
596597}
597598
598599static int
@@ -608,7 +609,7 @@ pg_big5_dsplen(const unsigned char *s)
608609{/* should be ASCII */
609610len = 1 ;
610611}
611- return ( len ) ;
612+ return len ;
612613}
613614
614615/*
@@ -627,7 +628,7 @@ pg_gbk_mblen(const unsigned char *s)
627628{/* should be ASCII */
628629len = 1 ;
629630}
630- return ( len ) ;
631+ return len ;
631632}
632633
633634static int
@@ -643,7 +644,7 @@ pg_gbk_dsplen(const unsigned char *s)
643644{/* should be ASCII */
644645len = 1 ;
645646}
646- return ( len ) ;
647+ return len ;
647648}
648649
649650/*
@@ -662,7 +663,7 @@ pg_uhc_mblen(const unsigned char *s)
662663{/* should be ASCII */
663664len = 1 ;
664665}
665- return ( len ) ;
666+ return len ;
666667}
667668
668669static int
@@ -678,7 +679,7 @@ pg_uhc_dsplen(const unsigned char *s)
678679{/* should be ASCII */
679680len = 1 ;
680681}
681- return ( len ) ;
682+ return len ;
682683}
683684
684685/*
@@ -703,7 +704,7 @@ pg_gb18030_mblen(const unsigned char *s)
703704else
704705len = 2 ;
705706}
706- return ( len ) ;
707+ return len ;
707708}
708709
709710static int
@@ -717,7 +718,7 @@ pg_gb18030_dsplen(const unsigned char *s)
717718}
718719else
719720len = 2 ;
720- return ( len ) ;
721+ return len ;
721722}
722723
723724
@@ -763,7 +764,7 @@ pg_wchar_tbl pg_wchar_table[] = {
763764int
764765pg_mic_mblen (const unsignedchar * mbstr )
765766{
766- return ( pg_mule_mblen (mbstr ) );
767+ return pg_mule_mblen (mbstr );
767768}
768769
769770/*