1
1
/*
2
2
* conversion functions between pg_wchar and multibyte streams.
3
3
* Tatsuo Ishii
4
- * $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.48 2005/12/24 09:35:36 ishii Exp $
4
+ * $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.49 2005/12/24 16:49:48 momjian Exp $
5
5
*
6
6
* WIN1250 client encoding updated by Pavel Behal
7
7
*
28
28
/*
29
29
* SQL/ASCII
30
30
*/
31
- static int pg_ascii2wchar_with_len
31
+ static int
32
+ pg_ascii2wchar_with_len
32
33
(const unsigned char * from , pg_wchar * to , int len )
33
34
{
34
35
int cnt = 0 ;
@@ -40,19 +41,19 @@ static int pg_ascii2wchar_with_len
40
41
cnt ++ ;
41
42
}
42
43
* to = 0 ;
43
- return ( cnt ) ;
44
+ return cnt ;
44
45
}
45
46
46
47
static int
47
48
pg_ascii_mblen (const unsigned char * s )
48
49
{
49
- return ( 1 ) ;
50
+ return 1 ;
50
51
}
51
52
52
53
static int
53
54
pg_ascii_dsplen (const unsigned char * s )
54
55
{
55
- return ( 1 ) ;
56
+ return 1 ;
56
57
}
57
58
58
59
/*
@@ -93,7 +94,7 @@ static int pg_euc2wchar_with_len
93
94
cnt ++ ;
94
95
}
95
96
* to = 0 ;
96
- return ( cnt ) ;
97
+ return cnt ;
97
98
}
98
99
99
100
static int
@@ -109,7 +110,7 @@ pg_euc_mblen(const unsigned char *s)
109
110
len = 2 ;
110
111
else
111
112
len = 1 ;
112
- return ( len ) ;
113
+ return len ;
113
114
}
114
115
115
116
static int
@@ -125,7 +126,7 @@ pg_euc_dsplen(const unsigned char *s)
125
126
len = 2 ;
126
127
else
127
128
len = 1 ;
128
- return ( len ) ;
129
+ return len ;
129
130
}
130
131
131
132
/*
@@ -134,13 +135,13 @@ pg_euc_dsplen(const unsigned char *s)
134
135
static int pg_eucjp2wchar_with_len
135
136
(const unsigned char * from , pg_wchar * to , int len )
136
137
{
137
- return ( pg_euc2wchar_with_len (from , to , len ) );
138
+ return pg_euc2wchar_with_len (from , to , len );
138
139
}
139
140
140
141
static int
141
142
pg_eucjp_mblen (const unsigned char * s )
142
143
{
143
- return ( pg_euc_mblen (s ) );
144
+ return pg_euc_mblen (s );
144
145
}
145
146
146
147
static int
@@ -156,7 +157,7 @@ pg_eucjp_dsplen(const unsigned char *s)
156
157
len = 2 ;
157
158
else
158
159
len = 1 ;
159
- return ( len ) ;
160
+ return len ;
160
161
}
161
162
162
163
/*
@@ -165,19 +166,19 @@ pg_eucjp_dsplen(const unsigned char *s)
165
166
static int pg_euckr2wchar_with_len
166
167
(const unsigned char * from , pg_wchar * to , int len )
167
168
{
168
- return ( pg_euc2wchar_with_len (from , to , len ) );
169
+ return pg_euc2wchar_with_len (from , to , len );
169
170
}
170
171
171
172
static int
172
173
pg_euckr_mblen (const unsigned char * s )
173
174
{
174
- return ( pg_euc_mblen (s ) );
175
+ return pg_euc_mblen (s );
175
176
}
176
177
177
178
static int
178
179
pg_euckr_dsplen (const unsigned char * s )
179
180
{
180
- return ( pg_euc_dsplen (s ) );
181
+ return pg_euc_dsplen (s );
181
182
}
182
183
183
184
/*
@@ -220,7 +221,7 @@ static int pg_euccn2wchar_with_len
220
221
cnt ++ ;
221
222
}
222
223
* to = 0 ;
223
- return ( cnt ) ;
224
+ return cnt ;
224
225
}
225
226
226
227
static int
@@ -232,7 +233,7 @@ pg_euccn_mblen(const unsigned char *s)
232
233
len = 2 ;
233
234
else
234
235
len = 1 ;
235
- return ( len ) ;
236
+ return len ;
236
237
}
237
238
238
239
static int
@@ -244,7 +245,7 @@ pg_euccn_dsplen(const unsigned char *s)
244
245
len = 2 ;
245
246
else
246
247
len = 1 ;
247
- return ( len ) ;
248
+ return len ;
248
249
}
249
250
250
251
/*
@@ -288,7 +289,7 @@ static int pg_euctw2wchar_with_len
288
289
cnt ++ ;
289
290
}
290
291
* to = 0 ;
291
- return ( cnt ) ;
292
+ return cnt ;
292
293
}
293
294
294
295
static int
@@ -304,7 +305,7 @@ pg_euctw_mblen(const unsigned char *s)
304
305
len = 2 ;
305
306
else
306
307
len = 1 ;
307
- return ( len ) ;
308
+ return len ;
308
309
}
309
310
310
311
static int
@@ -320,7 +321,7 @@ pg_euctw_dsplen(const unsigned char *s)
320
321
len = 2 ;
321
322
else
322
323
len = 1 ;
323
- return ( len ) ;
324
+ return len ;
324
325
}
325
326
326
327
/*
@@ -329,19 +330,19 @@ pg_euctw_dsplen(const unsigned char *s)
329
330
static int
330
331
pg_johab2wchar_with_len (const unsigned char * from , pg_wchar * to , int len )
331
332
{
332
- return ( pg_euc2wchar_with_len (from , to , len ) );
333
+ return pg_euc2wchar_with_len (from , to , len );
333
334
}
334
335
335
336
static int
336
337
pg_johab_mblen (const unsigned char * s )
337
338
{
338
- return ( pg_euc_mblen (s ) );
339
+ return pg_euc_mblen (s );
339
340
}
340
341
341
342
static int
342
343
pg_johab_dsplen (const unsigned char * s )
343
344
{
344
- return ( pg_euc_dsplen (s ) );
345
+ return pg_euc_dsplen (s );
345
346
}
346
347
347
348
/*
@@ -392,7 +393,7 @@ pg_utf2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
392
393
cnt ++ ;
393
394
}
394
395
* to = 0 ;
395
- return ( cnt ) ;
396
+ return cnt ;
396
397
}
397
398
398
399
/*
@@ -415,7 +416,7 @@ pg_utf_mblen(const unsigned char *s)
415
416
len = 5 ;
416
417
else if ((* s & 0xfe ) == 0xfc )
417
418
len = 6 ;
418
- return ( len ) ;
419
+ return len ;
419
420
}
420
421
421
422
static int
@@ -474,7 +475,7 @@ pg_mule2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
474
475
cnt ++ ;
475
476
}
476
477
* to = 0 ;
477
- return ( cnt ) ;
478
+ return cnt ;
478
479
}
479
480
480
481
int
@@ -494,7 +495,7 @@ pg_mule_mblen(const unsigned char *s)
494
495
{ /* assume ASCII */
495
496
len = 1 ;
496
497
}
497
- return ( len ) ;
498
+ return len ;
498
499
}
499
500
500
501
static int
@@ -518,19 +519,19 @@ pg_latin12wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
518
519
cnt ++ ;
519
520
}
520
521
* to = 0 ;
521
- return ( cnt ) ;
522
+ return cnt ;
522
523
}
523
524
524
525
static int
525
526
pg_latin1_mblen (const unsigned char * s )
526
527
{
527
- return ( 1 ) ;
528
+ return 1 ;
528
529
}
529
530
530
531
static int
531
532
pg_latin1_dsplen (const unsigned char * s )
532
533
{
533
- return ( 1 ) ;
534
+ return 1 ;
534
535
}
535
536
536
537
/*
@@ -553,7 +554,7 @@ pg_sjis_mblen(const unsigned char *s)
553
554
{ /* should be ASCII */
554
555
len = 1 ;
555
556
}
556
- return ( len ) ;
557
+ return len ;
557
558
}
558
559
559
560
static int
@@ -573,7 +574,7 @@ pg_sjis_dsplen(const unsigned char *s)
573
574
{ /* should be ASCII */
574
575
len = 1 ;
575
576
}
576
- return ( len ) ;
577
+ return len ;
577
578
}
578
579
579
580
/*
@@ -592,7 +593,7 @@ pg_big5_mblen(const unsigned char *s)
592
593
{ /* should be ASCII */
593
594
len = 1 ;
594
595
}
595
- return ( len ) ;
596
+ return len ;
596
597
}
597
598
598
599
static int
@@ -608,7 +609,7 @@ pg_big5_dsplen(const unsigned char *s)
608
609
{ /* should be ASCII */
609
610
len = 1 ;
610
611
}
611
- return ( len ) ;
612
+ return len ;
612
613
}
613
614
614
615
/*
@@ -627,7 +628,7 @@ pg_gbk_mblen(const unsigned char *s)
627
628
{ /* should be ASCII */
628
629
len = 1 ;
629
630
}
630
- return ( len ) ;
631
+ return len ;
631
632
}
632
633
633
634
static int
@@ -643,7 +644,7 @@ pg_gbk_dsplen(const unsigned char *s)
643
644
{ /* should be ASCII */
644
645
len = 1 ;
645
646
}
646
- return ( len ) ;
647
+ return len ;
647
648
}
648
649
649
650
/*
@@ -662,7 +663,7 @@ pg_uhc_mblen(const unsigned char *s)
662
663
{ /* should be ASCII */
663
664
len = 1 ;
664
665
}
665
- return ( len ) ;
666
+ return len ;
666
667
}
667
668
668
669
static int
@@ -678,7 +679,7 @@ pg_uhc_dsplen(const unsigned char *s)
678
679
{ /* should be ASCII */
679
680
len = 1 ;
680
681
}
681
- return ( len ) ;
682
+ return len ;
682
683
}
683
684
684
685
/*
@@ -703,7 +704,7 @@ pg_gb18030_mblen(const unsigned char *s)
703
704
else
704
705
len = 2 ;
705
706
}
706
- return ( len ) ;
707
+ return len ;
707
708
}
708
709
709
710
static int
@@ -717,7 +718,7 @@ pg_gb18030_dsplen(const unsigned char *s)
717
718
}
718
719
else
719
720
len = 2 ;
720
- return ( len ) ;
721
+ return len ;
721
722
}
722
723
723
724
@@ -763,7 +764,7 @@ pg_wchar_tbl pg_wchar_table[] = {
763
764
int
764
765
pg_mic_mblen (const unsigned char * mbstr )
765
766
{
766
- return ( pg_mule_mblen (mbstr ) );
767
+ return pg_mule_mblen (mbstr );
767
768
}
768
769
769
770
/*
0 commit comments