Skip to content

Commit b1ab76f

Browse files
committed
Minor formatting tweaks in mbfilter_euc_kr.c
1 parent 958ef47 commit b1ab76f

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

ext/mbstring/libmbfl/filters/mbfilter_euc_kr.c

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,18 @@ const struct mbfl_convert_vtbl vtbl_wchar_euckr = {
8383
NULL,
8484
};
8585

86-
8786
#define CK(statement) do { if ((statement) < 0) return (-1); } while (0)
8887

89-
/*
90-
* EUC-KR => wchar
91-
*/
9288
int
9389
mbfl_filt_conv_euckr_wchar(int c, mbfl_convert_filter *filter)
9490
{
9591
int c1, w, flag;
9692

9793
switch (filter->status) {
9894
case 0:
99-
if (c >= 0 && c < 0x80) { /* latin */
95+
if (c >= 0 && c < 0x80) { /* latin */
10096
CK((*filter->output_function)(c, filter->data));
101-
} else if (c > 0xa0 && c < 0xff && c != 0xc9) { /* dbcs lead byte */
97+
} else if (c > 0xa0 && c < 0xff && c != 0xc9) { /* dbcs lead byte */
10298
filter->status = 1;
10399
filter->cache = c;
104100
} else {
@@ -108,7 +104,7 @@ mbfl_filt_conv_euckr_wchar(int c, mbfl_convert_filter *filter)
108104
}
109105
break;
110106

111-
case 1: /* dbcs second byte */
107+
case 1: /* dbcs second byte */
112108
filter->status = 0;
113109
c1 = filter->cache;
114110
flag = 0;
@@ -140,7 +136,7 @@ mbfl_filt_conv_euckr_wchar(int c, mbfl_convert_filter *filter)
140136
w |= MBFL_WCSPLANE_KSC5601;
141137
}
142138
CK((*filter->output_function)(w, filter->data));
143-
} else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
139+
} else if ((c >= 0 && c < 0x21) || c == 0x7f) { /* CTLs */
144140
CK((*filter->output_function)(c, filter->data));
145141
} else {
146142
w = (c1 << 8) | c;
@@ -158,15 +154,10 @@ mbfl_filt_conv_euckr_wchar(int c, mbfl_convert_filter *filter)
158154
return c;
159155
}
160156

161-
/*
162-
* wchar => EUC-KR
163-
*/
164157
int
165158
mbfl_filt_conv_wchar_euckr(int c, mbfl_convert_filter *filter)
166159
{
167-
int c1, c2, s;
168-
169-
s = 0;
160+
int c1, c2, s = 0;
170161

171162
if (c >= ucs_a1_uhc_table_min && c < ucs_a1_uhc_table_max) {
172163
s = ucs_a1_uhc_table[c - ucs_a1_uhc_table_min];
@@ -186,8 +177,8 @@ mbfl_filt_conv_wchar_euckr(int c, mbfl_convert_filter *filter)
186177

187178
c1 = (s >> 8) & 0xff;
188179
c2 = s & 0xff;
189-
/* exclude UHC extension area */
190-
if (c1 < 0xa1 || c2 < 0xa1){
180+
/* exclude UHC extension area (although we are using the UHC conversion tables) */
181+
if (c1 < 0xa1 || c2 < 0xa1) {
191182
s = c;
192183
}
193184

@@ -203,7 +194,7 @@ mbfl_filt_conv_wchar_euckr(int c, mbfl_convert_filter *filter)
203194
}
204195
}
205196
if (s >= 0) {
206-
if (s < 0x80) { /* latin */
197+
if (s < 0x80) { /* latin */
207198
CK((*filter->output_function)(s, filter->data));
208199
} else {
209200
CK((*filter->output_function)((s >> 8) & 0xff, filter->data));

0 commit comments

Comments
 (0)