Skip to content

Commit e8b8ecb

Browse files
committed
Remove useless constants MBFL_CHP_{CTL,DIGIT,UALPHA,LALPHA,MSPECIAL}
1 parent aabbee2 commit e8b8ecb

File tree

2 files changed

+131
-144
lines changed

2 files changed

+131
-144
lines changed

ext/mbstring/libmbfl/filters/mbfilter_qprint.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ int mbfl_filt_conv_qprintenc(int c, mbfl_convert_filter *filter)
110110
}
111111

112112
if (s <= 0 || s >= 0x80 || s == 0x3d /* not ASCII or '=' */
113-
|| ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) != 0 &&
114-
(mbfl_charprop_table[s] & MBFL_CHP_MMHQENC) != 0)) {
113+
|| ((filter->status & MBFL_QPRINT_STS_MIME_HEADER) && mime_char_needs_qencode[s])) {
115114
/* hex-octet */
116115
CK((*filter->output_function)(0x3d, filter->data)); /* '=' */
117116
n = (s >> 4) & 0xf;

ext/mbstring/libmbfl/filters/unicode_prop.h

Lines changed: 130 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -19,148 +19,136 @@
1919
* Suite 330, Boston, MA 02111-1307 USA
2020
*
2121
* The authors of this file: PHP3 Internationalization team
22-
*
23-
*/
24-
25-
/* character property table */
26-
#define MBFL_CHP_CTL 0x01
27-
#define MBFL_CHP_DIGIT 0x02
28-
#define MBFL_CHP_UALPHA 0x04
29-
#define MBFL_CHP_LALPHA 0x08
30-
#define MBFL_CHP_MMHQENC 0x10 /* must Q-encoding in MIME Header encoded-word */
31-
#define MBFL_CHP_MSPECIAL 0x20 /* RFC822 Special characters */
32-
33-
/*
34-
* Unicode table
3522
*/
3623

37-
static const unsigned char mbfl_charprop_table[] = {
38-
/* NUL 0 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC,
39-
/* SCH 1 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
40-
/* SIX 2 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
41-
/* EIX 3 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
42-
/* EOT 4 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
43-
/* ENQ 5 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
44-
/* ACK 6 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
45-
/* BEL 7 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
46-
/* BS 8 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
47-
/* HI 9 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
48-
/* LF 10 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
49-
/* VI 11 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
50-
/* FF 12 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
51-
/* CR 13 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
52-
/* SO 14 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
53-
/* SI 15 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
54-
/* SLE 16 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
55-
/* CSI 17 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
56-
/* DC2 18 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
57-
/* DC3 19 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
58-
/* DC4 20 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
59-
/* NAK 21 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
60-
/* SYN 22 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
61-
/* EIB 23 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
62-
/* CAN 24 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
63-
/* EM 25 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
64-
/* SLB 26 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
65-
/* ESC 27 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
66-
/* FS 28 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
67-
/* GS 29 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
68-
/* RS 30 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
69-
/* US 31 */ MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
70-
/* SP 32 */ MBFL_CHP_MMHQENC ,
71-
/* ! 33 */ 0 ,
72-
/* " 34 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
73-
/* # 35 */ MBFL_CHP_MMHQENC ,
74-
/* $ 36 */ MBFL_CHP_MMHQENC ,
75-
/* % 37 */ MBFL_CHP_MMHQENC ,
76-
/* & 38 */ MBFL_CHP_MMHQENC ,
77-
/* ' 39 */ MBFL_CHP_MMHQENC ,
78-
/* ( 40 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
79-
/* ) 41 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
80-
/* * 42 */ 0 ,
81-
/* + 43 */ 0 ,
82-
/* , 44 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
83-
/* - 45 */ 0 ,
84-
/* . 46 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
85-
/* / 47 */ 0 ,
86-
/* 0 48 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
87-
/* 1 49 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
88-
/* 2 50 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
89-
/* 3 51 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
90-
/* 4 52 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
91-
/* 5 53 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
92-
/* 6 54 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
93-
/* 7 55 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
94-
/* 8 56 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
95-
/* 9 57 */ MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
96-
/* : 58 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
97-
/* ; 59 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
98-
/* < 60 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
99-
/* = 61 */ 0 ,
100-
/* > 62 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
101-
/* ? 63 */ MBFL_CHP_MMHQENC ,
102-
/* @ 64 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
103-
/* A 65 */ MBFL_CHP_UALPHA ,
104-
/* B 66 */ MBFL_CHP_UALPHA ,
105-
/* C 67 */ MBFL_CHP_UALPHA ,
106-
/* D 68 */ MBFL_CHP_UALPHA ,
107-
/* E 69 */ MBFL_CHP_UALPHA ,
108-
/* F 70 */ MBFL_CHP_UALPHA ,
109-
/* G 71 */ MBFL_CHP_UALPHA ,
110-
/* H 72 */ MBFL_CHP_UALPHA ,
111-
/* I 73 */ MBFL_CHP_UALPHA ,
112-
/* J 74 */ MBFL_CHP_UALPHA ,
113-
/* K 75 */ MBFL_CHP_UALPHA ,
114-
/* L 76 */ MBFL_CHP_UALPHA ,
115-
/* M 77 */ MBFL_CHP_UALPHA ,
116-
/* N 78 */ MBFL_CHP_UALPHA ,
117-
/* O 79 */ MBFL_CHP_UALPHA ,
118-
/* P 80 */ MBFL_CHP_UALPHA ,
119-
/* Q 81 */ MBFL_CHP_UALPHA ,
120-
/* R 82 */ MBFL_CHP_UALPHA ,
121-
/* S 83 */ MBFL_CHP_UALPHA ,
122-
/* T 84 */ MBFL_CHP_UALPHA ,
123-
/* U 85 */ MBFL_CHP_UALPHA ,
124-
/* V 86 */ MBFL_CHP_UALPHA ,
125-
/* W 87 */ MBFL_CHP_UALPHA ,
126-
/* X 88 */ MBFL_CHP_UALPHA ,
127-
/* Y 89 */ MBFL_CHP_UALPHA ,
128-
/* Z 90 */ MBFL_CHP_UALPHA ,
129-
/* [ 91 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
130-
/* \ 92 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
131-
/* ] 93 */ MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
132-
/* ^ 94 */ MBFL_CHP_MMHQENC ,
133-
/* _ 95 */ MBFL_CHP_MMHQENC ,
134-
/* ` 96 */ MBFL_CHP_MMHQENC ,
135-
/* a 97 */ MBFL_CHP_LALPHA ,
136-
/* b 98 */ MBFL_CHP_LALPHA ,
137-
/* c 99 */ MBFL_CHP_LALPHA ,
138-
/* d 100 */ MBFL_CHP_LALPHA ,
139-
/* e 101 */ MBFL_CHP_LALPHA ,
140-
/* f 102 */ MBFL_CHP_LALPHA ,
141-
/* g 103 */ MBFL_CHP_LALPHA ,
142-
/* h 104 */ MBFL_CHP_LALPHA ,
143-
/* i 105 */ MBFL_CHP_LALPHA ,
144-
/* j 106 */ MBFL_CHP_LALPHA ,
145-
/* k 107 */ MBFL_CHP_LALPHA ,
146-
/* l 108 */ MBFL_CHP_LALPHA ,
147-
/* m 109 */ MBFL_CHP_LALPHA ,
148-
/* n 110 */ MBFL_CHP_LALPHA ,
149-
/* o 111 */ MBFL_CHP_LALPHA ,
150-
/* p 112 */ MBFL_CHP_LALPHA ,
151-
/* q 113 */ MBFL_CHP_LALPHA ,
152-
/* r 114 */ MBFL_CHP_LALPHA ,
153-
/* s 115 */ MBFL_CHP_LALPHA ,
154-
/* t 116 */ MBFL_CHP_LALPHA ,
155-
/* u 117 */ MBFL_CHP_LALPHA ,
156-
/* v 118 */ MBFL_CHP_LALPHA ,
157-
/* w 119 */ MBFL_CHP_LALPHA ,
158-
/* x 120 */ MBFL_CHP_LALPHA ,
159-
/* y 121 */ MBFL_CHP_LALPHA ,
160-
/* z 122 */ MBFL_CHP_LALPHA ,
161-
/* { 123 */ MBFL_CHP_MMHQENC ,
162-
/* | 124 */ MBFL_CHP_MMHQENC ,
163-
/* } 125 */ MBFL_CHP_MMHQENC ,
164-
/* ~ 126 */ MBFL_CHP_MMHQENC ,
165-
/* DEL 127 */ MBFL_CHP_MMHQENC
24+
/* Should we use QPrint-encoding in MIME Header encoded-word? */
25+
static const unsigned char mime_char_needs_qencode[] = {
26+
/* NUL 0 */ 1,
27+
/* SCH 1 */ 1,
28+
/* SIX 2 */ 1,
29+
/* EIX 3 */ 1,
30+
/* EOT 4 */ 1,
31+
/* ENQ 5 */ 1,
32+
/* ACK 6 */ 1,
33+
/* BEL 7 */ 1,
34+
/* BS 8 */ 1,
35+
/* HI 9 */ 1,
36+
/* LF 10 */ 1,
37+
/* VI 11 */ 1,
38+
/* FF 12 */ 1,
39+
/* CR 13 */ 1,
40+
/* SO 14 */ 1,
41+
/* SI 15 */ 1,
42+
/* SLE 16 */ 1,
43+
/* CSI 17 */ 1,
44+
/* DC2 18 */ 1,
45+
/* DC3 19 */ 1,
46+
/* DC4 20 */ 1,
47+
/* NAK 21 */ 1,
48+
/* SYN 22 */ 1,
49+
/* EIB 23 */ 1,
50+
/* CAN 24 */ 1,
51+
/* EM 25 */ 1,
52+
/* SLB 26 */ 1,
53+
/* ESC 27 */ 1,
54+
/* FS 28 */ 1,
55+
/* GS 29 */ 1,
56+
/* RS 30 */ 1,
57+
/* US 31 */ 1,
58+
/* SP 32 */ 1,
59+
/* ! 33 */ 0,
60+
/* " 34 */ 1,
61+
/* # 35 */ 1,
62+
/* $ 36 */ 1,
63+
/* % 37 */ 1,
64+
/* & 38 */ 1,
65+
/* ' 39 */ 1,
66+
/* ( 40 */ 1,
67+
/* ) 41 */ 1,
68+
/* * 42 */ 0,
69+
/* + 43 */ 0,
70+
/* , 44 */ 1,
71+
/* - 45 */ 0,
72+
/* . 46 */ 1,
73+
/* / 47 */ 0,
74+
/* 0 48 */ 1,
75+
/* 1 49 */ 1,
76+
/* 2 50 */ 1,
77+
/* 3 51 */ 1,
78+
/* 4 52 */ 1,
79+
/* 5 53 */ 1,
80+
/* 6 54 */ 1,
81+
/* 7 55 */ 1,
82+
/* 8 56 */ 1,
83+
/* 9 57 */ 1,
84+
/* : 58 */ 1,
85+
/* ; 59 */ 1,
86+
/* < 60 */ 1,
87+
/* = 61 */ 0,
88+
/* > 62 */ 1,
89+
/* ? 63 */ 1,
90+
/* @ 64 */ 1,
91+
/* A 65 */ 0,
92+
/* B 66 */ 0,
93+
/* C 67 */ 0,
94+
/* D 68 */ 0,
95+
/* E 69 */ 0,
96+
/* F 70 */ 0,
97+
/* G 71 */ 0,
98+
/* H 72 */ 0,
99+
/* I 73 */ 0,
100+
/* J 74 */ 0,
101+
/* K 75 */ 0,
102+
/* L 76 */ 0,
103+
/* M 77 */ 0,
104+
/* N 78 */ 0,
105+
/* O 79 */ 0,
106+
/* P 80 */ 0,
107+
/* Q 81 */ 0,
108+
/* R 82 */ 0,
109+
/* S 83 */ 0,
110+
/* T 84 */ 0,
111+
/* U 85 */ 0,
112+
/* V 86 */ 0,
113+
/* W 87 */ 0,
114+
/* X 88 */ 0,
115+
/* Y 89 */ 0,
116+
/* Z 90 */ 0,
117+
/* [ 91 */ 1,
118+
/* \ 92 */ 1,
119+
/* ] 93 */ 1,
120+
/* ^ 94 */ 1,
121+
/* _ 95 */ 1,
122+
/* ` 96 */ 1,
123+
/* a 97 */ 0,
124+
/* b 98 */ 0,
125+
/* c 99 */ 0,
126+
/* d 100 */ 0,
127+
/* e 101 */ 0,
128+
/* f 102 */ 0,
129+
/* g 103 */ 0,
130+
/* h 104 */ 0,
131+
/* i 105 */ 0,
132+
/* j 106 */ 0,
133+
/* k 107 */ 0,
134+
/* l 108 */ 0,
135+
/* m 109 */ 0,
136+
/* n 110 */ 0,
137+
/* o 111 */ 0,
138+
/* p 112 */ 0,
139+
/* q 113 */ 0,
140+
/* r 114 */ 0,
141+
/* s 115 */ 0,
142+
/* t 116 */ 0,
143+
/* u 117 */ 0,
144+
/* v 118 */ 0,
145+
/* w 119 */ 0,
146+
/* x 120 */ 0,
147+
/* y 121 */ 0,
148+
/* z 122 */ 0,
149+
/* { 123 */ 1,
150+
/* | 124 */ 1,
151+
/* } 125 */ 1,
152+
/* ~ 126 */ 1,
153+
/* DEL 127 */ 1
166154
};

0 commit comments

Comments
 (0)