Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | static pcre_uint32 | - |
4 | swap_uint32(pcre_uint32 value) | - |
5 | { | - |
6 | return ((value & 0x000000ff) << 24) | | 0 |
7 | ((value & 0x0000ff00) << 8) | | 0 |
8 | ((value & 0x00ff0000) >> 8) | | 0 |
9 | (value >> 24); never executed: return ((value & 0x000000ff) << 24) | ((value & 0x0000ff00) << 8) | ((value & 0x00ff0000) >> 8) | (value >> 24); | 0 |
10 | } | - |
11 | | - |
12 | static pcre_uint16 | - |
13 | swap_uint16(pcre_uint16 value) | - |
14 | { | - |
15 | return (value >> 8) | (value << 8); never executed: return (value >> 8) | (value << 8); | 0 |
16 | } | - |
17 | extern int pcre16_pattern_to_host_byte_order(pcre16 *argument_re, | - |
18 | pcre16_extra *extra_data, const unsigned char *tables) | - |
19 | | - |
20 | { | - |
21 | real_pcre16 *re = (real_pcre16 *)argument_re; | - |
22 | pcre_study_data *study; | - |
23 | | - |
24 | pcre_uchar *ptr; | - |
25 | int length; | - |
26 | | - |
27 | BOOL utf; | - |
28 | BOOL utf16_char; | - |
29 | | - |
30 | | - |
31 | | - |
32 | if (re == ((void *)0)) return (-2); never executed: return (-2); never evaluated: re == ((void *)0) | 0 |
33 | if (re->magic_number == 0x50435245UL) never evaluated: re->magic_number == 0x50435245UL | 0 |
34 | { | - |
35 | if ((re->flags & 0x0002) == 0) return (-28); never evaluated: (re->flags & 0x0002) == 0 never executed: return (-28); | 0 |
36 | re->tables = tables; | - |
37 | return 0; never executed: return 0; | 0 |
38 | } | - |
39 | | - |
40 | if (re->magic_number != 0x45524350UL) return (-4); never evaluated: re->magic_number != 0x45524350UL never executed: return (-4); | 0 |
41 | if ((swap_uint16(re->flags) & 0x0002) == 0) return (-28); never evaluated: (swap_uint16(re->flags) & 0x0002) == 0 never executed: return (-28); | 0 |
42 | | - |
43 | re->magic_number = 0x50435245UL; | - |
44 | re->size = swap_uint32(re->size); | - |
45 | re->options = swap_uint32(re->options); | - |
46 | re->flags = swap_uint16(re->flags); | - |
47 | re->top_bracket = swap_uint16(re->top_bracket); | - |
48 | re->top_backref = swap_uint16(re->top_backref); | - |
49 | re->first_char = swap_uint16(re->first_char); | - |
50 | re->req_char = swap_uint16(re->req_char); | - |
51 | re->name_table_offset = swap_uint16(re->name_table_offset); | - |
52 | re->name_entry_size = swap_uint16(re->name_entry_size); | - |
53 | re->name_count = swap_uint16(re->name_count); | - |
54 | re->ref_count = swap_uint16(re->ref_count); | - |
55 | re->tables = tables; | - |
56 | | - |
57 | if (extra_data != ((void *)0) && (extra_data->flags & 0x0001) != 0) never evaluated: extra_data != ((void *)0) never evaluated: (extra_data->flags & 0x0001) != 0 | 0 |
58 | { | - |
59 | study = (pcre_study_data *)extra_data->study_data; | - |
60 | study->size = swap_uint32(study->size); | - |
61 | study->flags = swap_uint32(study->flags); | - |
62 | study->minlength = swap_uint32(study->minlength); | - |
63 | } | 0 |
64 | | - |
65 | | - |
66 | ptr = (pcre_uchar *)re + re->name_table_offset; | - |
67 | length = re->name_count * re->name_entry_size; | - |
68 | | - |
69 | utf = (re->options & 0x00000800) != 0; | - |
70 | utf16_char = 0; | - |
71 | | - |
72 | | - |
73 | while(1) | 0 |
74 | { | - |
75 | | - |
76 | while (length-- > 0) never evaluated: length-- > 0 | 0 |
77 | { | - |
78 | *ptr = swap_uint16(*ptr); | - |
79 | ptr++; | - |
80 | } | 0 |
81 | | - |
82 | if (utf16_char) never evaluated: utf16_char | 0 |
83 | { | - |
84 | if ((((ptr[-1]) & 0xfc00) == 0xd800)) never evaluated: (((ptr[-1]) & 0xfc00) == 0xd800) | 0 |
85 | { | - |
86 | | - |
87 | *ptr = swap_uint16(*ptr); | - |
88 | ptr++; | - |
89 | } | 0 |
90 | } | 0 |
91 | utf16_char = 0; | - |
92 | | - |
93 | | - |
94 | | - |
95 | length = 0; | - |
96 | *ptr = swap_uint16(*ptr); | - |
97 | switch (*ptr) | - |
98 | { | - |
99 | case OP_END: | - |
100 | return 0; never executed: return 0; | 0 |
101 | | - |
102 | | - |
103 | case OP_CHAR: | - |
104 | case OP_CHARI: | - |
105 | case OP_NOT: | - |
106 | case OP_NOTI: | - |
107 | case OP_STAR: | - |
108 | case OP_MINSTAR: | - |
109 | case OP_PLUS: | - |
110 | case OP_MINPLUS: | - |
111 | case OP_QUERY: | - |
112 | case OP_MINQUERY: | - |
113 | case OP_UPTO: | - |
114 | case OP_MINUPTO: | - |
115 | case OP_EXACT: | - |
116 | case OP_POSSTAR: | - |
117 | case OP_POSPLUS: | - |
118 | case OP_POSQUERY: | - |
119 | case OP_POSUPTO: | - |
120 | case OP_STARI: | - |
121 | case OP_MINSTARI: | - |
122 | case OP_PLUSI: | - |
123 | case OP_MINPLUSI: | - |
124 | case OP_QUERYI: | - |
125 | case OP_MINQUERYI: | - |
126 | case OP_UPTOI: | - |
127 | case OP_MINUPTOI: | - |
128 | case OP_EXACTI: | - |
129 | case OP_POSSTARI: | - |
130 | case OP_POSPLUSI: | - |
131 | case OP_POSQUERYI: | - |
132 | case OP_POSUPTOI: | - |
133 | case OP_NOTSTAR: | - |
134 | case OP_NOTMINSTAR: | - |
135 | case OP_NOTPLUS: | - |
136 | case OP_NOTMINPLUS: | - |
137 | case OP_NOTQUERY: | - |
138 | case OP_NOTMINQUERY: | - |
139 | case OP_NOTUPTO: | - |
140 | case OP_NOTMINUPTO: | - |
141 | case OP_NOTEXACT: | - |
142 | case OP_NOTPOSSTAR: | - |
143 | case OP_NOTPOSPLUS: | - |
144 | case OP_NOTPOSQUERY: | - |
145 | case OP_NOTPOSUPTO: | - |
146 | case OP_NOTSTARI: | - |
147 | case OP_NOTMINSTARI: | - |
148 | case OP_NOTPLUSI: | - |
149 | case OP_NOTMINPLUSI: | - |
150 | case OP_NOTQUERYI: | - |
151 | case OP_NOTMINQUERYI: | - |
152 | case OP_NOTUPTOI: | - |
153 | case OP_NOTMINUPTOI: | - |
154 | case OP_NOTEXACTI: | - |
155 | case OP_NOTPOSSTARI: | - |
156 | case OP_NOTPOSPLUSI: | - |
157 | case OP_NOTPOSQUERYI: | - |
158 | case OP_NOTPOSUPTOI: | - |
159 | if (utf) utf16_char = 1; never executed: utf16_char = 1; | 0 |
160 | | - |
161 | | - |
162 | | - |
163 | default: code before this statement never executed: default: | 0 |
164 | length = _pcre16_OP_lengths[*ptr] - 1; | - |
165 | break; | 0 |
166 | | - |
167 | case OP_CLASS: | - |
168 | case OP_NCLASS: | - |
169 | | - |
170 | ptr += 32/sizeof(pcre_uchar); | - |
171 | length = 0; | - |
172 | break; | 0 |
173 | | - |
174 | case OP_XCLASS: | - |
175 | | - |
176 | ptr++; | - |
177 | *ptr = swap_uint16(*ptr); | - |
178 | if (1 > 1) | 0 |
179 | { | - |
180 | | - |
181 | ptr++; | - |
182 | *ptr = swap_uint16(*ptr); | - |
183 | } | 0 |
184 | ptr++; | - |
185 | length = ((ptr[-1])) - (1 + 1 + 1); | - |
186 | *ptr = swap_uint16(*ptr); | - |
187 | if ((*ptr & 0x02) != 0) never evaluated: (*ptr & 0x02) != 0 | 0 |
188 | { | - |
189 | | - |
190 | ptr += 32/sizeof(pcre_uchar); | - |
191 | length -= 32/sizeof(pcre_uchar); | - |
192 | } | 0 |
193 | break; | 0 |
194 | } | - |
195 | ptr++; | - |
196 | } | 0 |
197 | | - |
198 | | - |
199 | | - |
200 | return 0; never executed: return 0; | 0 |
201 | } | - |
202 | | - |
| | |