Skip to content

Commit c8e65c9

Browse files
committed
Remove COMPAT2 conversion modes for mb_convert_kana
mb_convert_kana has conversion modes selected using 'M'/'m', which convert a few various punctuation and symbol characters between 'ordinary' and full-width forms. The constants which refer to these modes have names ending with COMPAT1. Internally, there are similar conversion modes with names ending in COMPAT2. They are like COMPAT1 modes, but they operate on a smaller set of characters. But... that is all just dead code, because there is no way for user code to select the COMPAT2 modes. I have no idea what the original author intended those COMPAT2 modes to actually be used for. Guess it doesn't really matter, anyways. At this point, it's just more food for the flames.
1 parent d7eb442 commit c8e65c9

File tree

2 files changed

+2
-28
lines changed

2 files changed

+2
-28
lines changed

ext/mbstring/libmbfl/filters/mbfilter_tl_jisx0201_jisx0208.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,6 @@ int mbfl_convert_kana(int c, int next, bool *consumed, int *second, int mode)
114114
} else if (c == 0x22) {
115115
return 0x201d; /* RIGHT DOUBLE QUOTATION MARK */
116116
}
117-
} else if (mode & MBFL_FILT_TL_HAN2ZEN_COMPAT2) { /* special ascii to symbol */
118-
if (c == 0x5c) {
119-
return 0xff3c; /* FULLWIDTH REVERSE SOLIDUS */
120-
} else if (c == 0x7e) {
121-
return 0xff5e; /* FULLWIDTH TILDE */
122-
} else if (c == 0x27) {
123-
return 0xff07; /* FULLWIDTH APOSTROPHE */
124-
} else if (c == 0x22) {
125-
return 0xff02; /* FULLWIDTH QUOTATION MARK */
126-
}
127117
}
128118

129119
if (mode & (MBFL_FILT_TL_ZEN2HAN_ALL | MBFL_FILT_TL_ZEN2HAN_ALPHA | MBFL_FILT_TL_ZEN2HAN_NUMERIC | MBFL_FILT_TL_ZEN2HAN_SPACE)) {
@@ -205,18 +195,6 @@ int mbfl_convert_kana(int c, int next, bool *consumed, int *second, int mode)
205195
}
206196
}
207197

208-
if (mode & MBFL_FILT_TL_ZEN2HAN_COMPAT2) { /* special symbol to ascii */
209-
if (c == 0xff3c) { /* FULLWIDTH REVERSE SOLIDUS */
210-
return 0x5c;
211-
} else if (c == 0xff5e) { /* FULLWIDTH TILDE */
212-
return 0x7e;
213-
} else if (c == 0xff07) { /* FULLWIDTH APOSTROPHE */
214-
return 0x27;
215-
} else if (c == 0xff02) { /* FULLWIDTH QUOTATION MARK */
216-
return 0x22;
217-
}
218-
}
219-
220198
return c;
221199
}
222200

ext/mbstring/libmbfl/filters/mbfilter_tl_jisx0201_jisx0208.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@
4646
#define MBFL_FILT_TL_ZEN2HAN_KANA2HIRA 0x00020000
4747
#define MBFL_FILT_TL_HAN2ZEN_COMPAT1 0x00100000
4848
#define MBFL_FILT_TL_ZEN2HAN_COMPAT1 0x00200000
49-
#define MBFL_FILT_TL_HAN2ZEN_COMPAT2 0x00400000
50-
#define MBFL_FILT_TL_ZEN2HAN_COMPAT2 0x00800000
5149
#define MBFL_FILT_TL_HAN2ZEN_MASK ( \
5250
MBFL_FILT_TL_HAN2ZEN_ALL |\
5351
MBFL_FILT_TL_HAN2ZEN_ALPHA |\
@@ -56,8 +54,7 @@
5654
MBFL_FILT_TL_HAN2ZEN_KATAKANA |\
5755
MBFL_FILT_TL_HAN2ZEN_HIRAGANA |\
5856
MBFL_FILT_TL_HAN2ZEN_GLUE |\
59-
MBFL_FILT_TL_HAN2ZEN_COMPAT1 |\
60-
MBFL_FILT_TL_HAN2ZEN_COMPAT2)
57+
MBFL_FILT_TL_HAN2ZEN_COMPAT1)
6158
#define MBFL_FILT_TL_ZEN2HAN_MASK ( \
6259
MBFL_FILT_TL_ZEN2HAN_ALL | \
6360
MBFL_FILT_TL_ZEN2HAN_ALPHA | \
@@ -67,8 +64,7 @@
6764
MBFL_FILT_TL_ZEN2HAN_HIRAGANA | \
6865
MBFL_FILT_TL_ZEN2HAN_HIRA2KANA | \
6966
MBFL_FILT_TL_ZEN2HAN_KANA2HIRA | \
70-
MBFL_FILT_TL_ZEN2HAN_COMPAT1 | \
71-
MBFL_FILT_TL_ZEN2HAN_COMPAT2)
67+
MBFL_FILT_TL_ZEN2HAN_COMPAT1)
7268

7369
extern const struct mbfl_convert_vtbl vtbl_tl_jisx0201_jisx0208;
7470

0 commit comments

Comments
 (0)