Line | Source Code | Coverage |
---|
1 | | - |
2 | static HB_Error Load_AttachList( HB_AttachList* al, | - |
3 | HB_Stream stream ); | - |
4 | static HB_Error Load_LigCaretList( HB_LigCaretList* lcl, | - |
5 | HB_Stream stream ); | - |
6 | | - |
7 | static void Free_AttachList( HB_AttachList* al); | - |
8 | static void Free_LigCaretList( HB_LigCaretList* lcl); | - |
9 | | - |
10 | static void Free_NewGlyphClasses( HB_GDEFHeader* gdef); | - |
11 | HB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr ) | - |
12 | { | - |
13 | HB_Error error; | - |
14 | | - |
15 | HB_GDEFHeader* gdef; | - |
16 | | - |
17 | if ( !retptr ) partially evaluated: !retptr no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
18 | return _hb_err (HB_Err_Invalid_Argument); never executed: return _hb_err (HB_Err_Invalid_Argument); | 0 |
19 | | - |
20 | if ( ( (gdef) = _hb_alloc( sizeof( *gdef ), &error ), error != 0 ) ) partially evaluated: ( (gdef) = _hb_alloc( sizeof( *gdef ), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
21 | return error; never executed: return error; | 0 |
22 | | - |
23 | gdef->GlyphClassDef.loaded = 0; | - |
24 | gdef->AttachList.loaded = 0; | - |
25 | gdef->LigCaretList.loaded = 0; | - |
26 | gdef->MarkAttachClassDef_offset = 0; | - |
27 | gdef->MarkAttachClassDef.loaded = 0; | - |
28 | | - |
29 | gdef->LastGlyph = 0; | - |
30 | gdef->NewGlyphClasses = ((void *)0); | - |
31 | | - |
32 | *retptr = gdef; | - |
33 | | - |
34 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:136 | 136 |
35 | } | - |
36 | | - |
37 | | - |
38 | HB_Error HB_Load_GDEF_Table( HB_Stream stream, | - |
39 | HB_GDEFHeader** retptr ) | - |
40 | { | - |
41 | HB_Error error = HB_Err_Ok; | - |
42 | HB_UInt cur_offset, new_offset, base_offset; | - |
43 | | - |
44 | HB_GDEFHeader* gdef; | - |
45 | | - |
46 | | - |
47 | if ( !retptr ) partially evaluated: !retptr no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
48 | return _hb_err (HB_Err_Invalid_Argument); never executed: return _hb_err (HB_Err_Invalid_Argument); | 0 |
49 | | - |
50 | if ( (0) ) partially evaluated: (0) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
51 | return error; never executed: return error; | 0 |
52 | | - |
53 | if (( error = HB_New_GDEF_Table ( &gdef ) )) partially evaluated: ( error = HB_New_GDEF_Table ( &gdef ) ) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
54 | return error; never executed: return error; | 0 |
55 | | - |
56 | base_offset = _hb_stream_pos( stream ); | - |
57 | | - |
58 | | - |
59 | | - |
60 | if ( ( (error = (_hb_stream_seek( stream, base_offset + 4L ))) != 0 ) || partially evaluated: ( (error = (_hb_stream_seek( stream, base_offset + 4L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
61 | ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
62 | goto Fail0; never executed: goto Fail0; | 0 |
63 | | - |
64 | new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
65 | | - |
66 | _hb_stream_frame_exit( stream ); | - |
67 | | - |
68 | | - |
69 | | - |
70 | if ( new_offset ) partially evaluated: new_offset yes Evaluation Count:136 | no Evaluation Count:0 |
| 0-136 |
71 | { | - |
72 | new_offset += base_offset; | - |
73 | | - |
74 | | - |
75 | | - |
76 | cur_offset = _hb_stream_pos( stream ); | - |
77 | if ( ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) || partially evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
78 | ( error = _HB_OPEN_Load_ClassDefinition( &gdef->GlyphClassDef, 5, | 0-136 |
79 | stream ) ) != HB_Err_Ok ) partially evaluated: ( error = _HB_OPEN_Load_ClassDefinition( &gdef->GlyphClassDef, 5, stream ) ) != HB_Err_Ok no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
80 | goto Fail0; never executed: goto Fail0; | 0 |
81 | (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
82 | } executed: } Execution Count:136 | 136 |
83 | | - |
84 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
85 | goto Fail1; never executed: goto Fail1; | 0 |
86 | | - |
87 | new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
88 | | - |
89 | _hb_stream_frame_exit( stream ); | - |
90 | | - |
91 | if ( new_offset ) partially evaluated: new_offset no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
92 | { | - |
93 | new_offset += base_offset; | - |
94 | | - |
95 | cur_offset = _hb_stream_pos( stream ); | - |
96 | if ( ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) || never evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) | 0 |
97 | ( error = Load_AttachList( &gdef->AttachList, | 0 |
98 | stream ) ) != HB_Err_Ok ) never evaluated: ( error = Load_AttachList( &gdef->AttachList, stream ) ) != HB_Err_Ok | 0 |
99 | goto Fail1; never executed: goto Fail1; | 0 |
100 | (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
101 | } | 0 |
102 | | - |
103 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
104 | goto Fail2; never executed: goto Fail2; | 0 |
105 | | - |
106 | new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
107 | | - |
108 | _hb_stream_frame_exit( stream ); | - |
109 | | - |
110 | if ( new_offset ) partially evaluated: new_offset yes Evaluation Count:136 | no Evaluation Count:0 |
| 0-136 |
111 | { | - |
112 | new_offset += base_offset; | - |
113 | | - |
114 | cur_offset = _hb_stream_pos( stream ); | - |
115 | if ( ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) || partially evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
116 | ( error = Load_LigCaretList( &gdef->LigCaretList, | 0-136 |
117 | stream ) ) != HB_Err_Ok ) partially evaluated: ( error = Load_LigCaretList( &gdef->LigCaretList, stream ) ) != HB_Err_Ok no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
118 | goto Fail2; never executed: goto Fail2; | 0 |
119 | (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
120 | } executed: } Execution Count:136 | 136 |
121 | | - |
122 | | - |
123 | | - |
124 | | - |
125 | | - |
126 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
127 | goto Fail3; never executed: goto Fail3; | 0 |
128 | | - |
129 | new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
130 | | - |
131 | _hb_stream_frame_exit( stream ); | - |
132 | | - |
133 | if ( new_offset ) evaluated: new_offset yes Evaluation Count:90 | yes Evaluation Count:46 |
| 46-90 |
134 | gdef->MarkAttachClassDef_offset = new_offset + base_offset; executed: gdef->MarkAttachClassDef_offset = new_offset + base_offset; Execution Count:90 | 90 |
135 | else | - |
136 | gdef->MarkAttachClassDef_offset = 0; executed: gdef->MarkAttachClassDef_offset = 0; Execution Count:46 | 46 |
137 | | - |
138 | *retptr = gdef; | - |
139 | | - |
140 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:136 | 136 |
141 | | - |
142 | Fail3: | - |
143 | Free_LigCaretList( &gdef->LigCaretList ); | - |
144 | | - |
145 | Fail2: code before this statement never executed: Fail2: | 0 |
146 | Free_AttachList( &gdef->AttachList ); | - |
147 | | - |
148 | Fail1: code before this statement never executed: Fail1: | 0 |
149 | _HB_OPEN_Free_ClassDefinition( &gdef->GlyphClassDef ); | - |
150 | | - |
151 | Fail0: code before this statement never executed: Fail0: | 0 |
152 | do { if ( (gdef) ) { _hb_free( gdef ); gdef = ((void *)0); } } while (0); | 0 |
153 | | - |
154 | return error; never executed: return error; | 0 |
155 | } | - |
156 | | - |
157 | | - |
158 | HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef ) | - |
159 | { | - |
160 | Free_LigCaretList( &gdef->LigCaretList ); | - |
161 | Free_AttachList( &gdef->AttachList ); | - |
162 | _HB_OPEN_Free_ClassDefinition( &gdef->GlyphClassDef ); | - |
163 | _HB_OPEN_Free_ClassDefinition( &gdef->MarkAttachClassDef ); | - |
164 | | - |
165 | Free_NewGlyphClasses( gdef ); | - |
166 | | - |
167 | do { if ( (gdef) ) { _hb_free( gdef ); gdef = ((void *)0); } } while (0); partially evaluated: (gdef) yes Evaluation Count:129 | no Evaluation Count:0 |
executed: } Execution Count:129 executed: } Execution Count:129 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:129 |
| 0-129 |
168 | | - |
169 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:129 | 129 |
170 | } | - |
171 | static HB_Error Load_AttachPoint( HB_AttachPoint* ap, | - |
172 | HB_Stream stream ) | - |
173 | { | - |
174 | HB_Error error; | - |
175 | | - |
176 | HB_UShort n, count; | - |
177 | HB_UShort* pi; | - |
178 | | - |
179 | | - |
180 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) never evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) | 0 |
181 | return error; never executed: return error; | 0 |
182 | | - |
183 | count = ap->PointCount = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
184 | | - |
185 | _hb_stream_frame_exit( stream ); | - |
186 | | - |
187 | ap->PointIndex = ((void *)0); | - |
188 | | - |
189 | if ( count ) | 0 |
190 | { | - |
191 | if ( ( (ap->PointIndex) = _hb_alloc( (count)*sizeof(HB_UShort), &error ), error != 0 ) ) never evaluated: ( (ap->PointIndex) = _hb_alloc( (count)*sizeof(HB_UShort), &error ), error != 0 ) | 0 |
192 | return error; never executed: return error; | 0 |
193 | | - |
194 | pi = ap->PointIndex; | - |
195 | | - |
196 | if ( ( (error = (_hb_stream_frame_enter( stream, count * 2L ))) != 0 ) ) never evaluated: ( (error = (_hb_stream_frame_enter( stream, count * 2L ))) != 0 ) | 0 |
197 | { | - |
198 | do { if ( (pi) ) { _hb_free( pi ); pi = ((void *)0); } } while (0); | 0 |
199 | return error; never executed: return error; | 0 |
200 | } | - |
201 | | - |
202 | for ( n = 0; n < count; n++ ) never evaluated: n < count | 0 |
203 | pi[n] = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); never executed: pi[n] = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | 0 |
204 | | - |
205 | _hb_stream_frame_exit( stream ); | - |
206 | } | 0 |
207 | | - |
208 | return HB_Err_Ok; never executed: return HB_Err_Ok; | 0 |
209 | } | - |
210 | | - |
211 | | - |
212 | static void Free_AttachPoint( HB_AttachPoint* ap ) | - |
213 | { | - |
214 | do { if ( (ap->PointIndex) ) { _hb_free( ap->PointIndex ); ap->PointIndex = ((void *)0); } } while (0); never evaluated: (ap->PointIndex) | 0 |
215 | } | 0 |
216 | | - |
217 | | - |
218 | | - |
219 | | - |
220 | static HB_Error Load_AttachList( HB_AttachList* al, | - |
221 | HB_Stream stream ) | - |
222 | { | - |
223 | HB_Error error; | - |
224 | | - |
225 | HB_UShort n, m, count; | - |
226 | HB_UInt cur_offset, new_offset, base_offset; | - |
227 | | - |
228 | HB_AttachPoint* ap; | - |
229 | | - |
230 | | - |
231 | base_offset = _hb_stream_pos( stream ); | - |
232 | | - |
233 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) never evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) | 0 |
234 | return error; never executed: return error; | 0 |
235 | | - |
236 | new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))) + base_offset; | - |
237 | | - |
238 | _hb_stream_frame_exit( stream ); | - |
239 | | - |
240 | cur_offset = _hb_stream_pos( stream ); | - |
241 | if ( ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) || never evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) | 0 |
242 | ( error = _HB_OPEN_Load_Coverage( &al->Coverage, stream ) ) != HB_Err_Ok ) never evaluated: ( error = _HB_OPEN_Load_Coverage( &al->Coverage, stream ) ) != HB_Err_Ok | 0 |
243 | return error; never executed: return error; | 0 |
244 | (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
245 | | - |
246 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) never evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) | 0 |
247 | goto Fail2; never executed: goto Fail2; | 0 |
248 | | - |
249 | count = al->GlyphCount = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
250 | | - |
251 | _hb_stream_frame_exit( stream ); | - |
252 | | - |
253 | al->AttachPoint = ((void *)0); | - |
254 | | - |
255 | if ( ( (al->AttachPoint) = _hb_alloc( (count)*sizeof(HB_AttachPoint), &error ), error != 0 ) ) never evaluated: ( (al->AttachPoint) = _hb_alloc( (count)*sizeof(HB_AttachPoint), &error ), error != 0 ) | 0 |
256 | goto Fail2; never executed: goto Fail2; | 0 |
257 | | - |
258 | ap = al->AttachPoint; | - |
259 | | - |
260 | for ( n = 0; n < count; n++ ) never evaluated: n < count | 0 |
261 | { | - |
262 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) never evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) | 0 |
263 | goto Fail1; never executed: goto Fail1; | 0 |
264 | | - |
265 | new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))) + base_offset; | - |
266 | | - |
267 | _hb_stream_frame_exit( stream ); | - |
268 | | - |
269 | cur_offset = _hb_stream_pos( stream ); | - |
270 | if ( ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) || never evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) | 0 |
271 | ( error = Load_AttachPoint( &ap[n], stream ) ) != HB_Err_Ok ) never evaluated: ( error = Load_AttachPoint( &ap[n], stream ) ) != HB_Err_Ok | 0 |
272 | goto Fail1; never executed: goto Fail1; | 0 |
273 | (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
274 | } | 0 |
275 | | - |
276 | al->loaded = (!0); | - |
277 | | - |
278 | return HB_Err_Ok; never executed: return HB_Err_Ok; | 0 |
279 | | - |
280 | Fail1: | - |
281 | for ( m = 0; m < n; m++ ) | 0 |
282 | Free_AttachPoint( &ap[m] ); never executed: Free_AttachPoint( &ap[m] ); | 0 |
283 | | - |
284 | do { if ( (ap) ) { _hb_free( ap ); ap = ((void *)0); } } while (0); | 0 |
285 | | - |
286 | Fail2: code before this statement never executed: Fail2: | 0 |
287 | _HB_OPEN_Free_Coverage( &al->Coverage ); | - |
288 | return error; never executed: return error; | 0 |
289 | } | - |
290 | | - |
291 | | - |
292 | static void Free_AttachList( HB_AttachList* al) | - |
293 | { | - |
294 | HB_UShort n, count; | - |
295 | | - |
296 | HB_AttachPoint* ap; | - |
297 | | - |
298 | | - |
299 | if ( !al->loaded ) partially evaluated: !al->loaded yes Evaluation Count:129 | no Evaluation Count:0 |
| 0-129 |
300 | return; executed: return; Execution Count:129 | 129 |
301 | | - |
302 | if ( al->AttachPoint ) never evaluated: al->AttachPoint | 0 |
303 | { | - |
304 | count = al->GlyphCount; | - |
305 | ap = al->AttachPoint; | - |
306 | | - |
307 | for ( n = 0; n < count; n++ ) never evaluated: n < count | 0 |
308 | Free_AttachPoint( &ap[n] ); never executed: Free_AttachPoint( &ap[n] ); | 0 |
309 | | - |
310 | do { if ( (ap) ) { _hb_free( ap ); ap = ((void *)0); } } while (0); | 0 |
311 | } | 0 |
312 | | - |
313 | _HB_OPEN_Free_Coverage( &al->Coverage ); | - |
314 | } | 0 |
315 | static HB_Error Load_CaretValue( HB_CaretValue* cv, | - |
316 | HB_Stream stream ) | - |
317 | { | - |
318 | HB_Error error; | - |
319 | | - |
320 | HB_UInt cur_offset, new_offset, base_offset; | - |
321 | | - |
322 | | - |
323 | base_offset = _hb_stream_pos( stream ); | - |
324 | | - |
325 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
326 | return error; never executed: return error; | 0 |
327 | | - |
328 | cv->CaretValueFormat = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
329 | | - |
330 | _hb_stream_frame_exit( stream ); | - |
331 | | - |
332 | switch ( cv->CaretValueFormat ) | - |
333 | { | - |
334 | case 1: | - |
335 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
336 | return error; never executed: return error; | 0 |
337 | | - |
338 | cv->cvf.cvf1.Coordinate = (stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) )); | - |
339 | | - |
340 | _hb_stream_frame_exit( stream ); | - |
341 | | - |
342 | break; executed: break; Execution Count:8 | 8 |
343 | | - |
344 | case 2: | - |
345 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) never evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) | 0 |
346 | return error; never executed: return error; | 0 |
347 | | - |
348 | cv->cvf.cvf2.CaretValuePoint = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
349 | | - |
350 | _hb_stream_frame_exit( stream ); | - |
351 | | - |
352 | break; | 0 |
353 | | - |
354 | case 3: | - |
355 | if ( ( (error = (_hb_stream_frame_enter( stream, 4L ))) != 0 ) ) never evaluated: ( (error = (_hb_stream_frame_enter( stream, 4L ))) != 0 ) | 0 |
356 | return error; never executed: return error; | 0 |
357 | | - |
358 | cv->cvf.cvf3.Coordinate = (stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) )); | - |
359 | | - |
360 | new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))) + base_offset; | - |
361 | | - |
362 | _hb_stream_frame_exit( stream ); | - |
363 | | - |
364 | cur_offset = _hb_stream_pos( stream ); | - |
365 | if ( ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) || never evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) | 0 |
366 | ( error = _HB_OPEN_Load_Device( &cv->cvf.cvf3.Device, | 0 |
367 | stream ) ) != HB_Err_Ok ) never evaluated: ( error = _HB_OPEN_Load_Device( &cv->cvf.cvf3.Device, stream ) ) != HB_Err_Ok | 0 |
368 | return error; never executed: return error; | 0 |
369 | (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
370 | | - |
371 | break; | 0 |
372 | | - |
373 | case 4: | - |
374 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) never evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) | 0 |
375 | return error; never executed: return error; | 0 |
376 | | - |
377 | | - |
378 | | - |
379 | | - |
380 | (void) ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
381 | | - |
382 | | - |
383 | _hb_stream_frame_exit( stream ); | - |
384 | break; | 0 |
385 | | - |
386 | default: | - |
387 | return _hb_err (HB_Err_Invalid_SubTable_Format); never executed: return _hb_err (HB_Err_Invalid_SubTable_Format); | 0 |
388 | } | - |
389 | | - |
390 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:8 | 8 |
391 | } | - |
392 | | - |
393 | | - |
394 | static void Free_CaretValue( HB_CaretValue* cv) | - |
395 | { | - |
396 | if ( cv->CaretValueFormat == 3 ) partially evaluated: cv->CaretValueFormat == 3 no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
397 | _HB_OPEN_Free_Device( cv->cvf.cvf3.Device ); never executed: _HB_OPEN_Free_Device( cv->cvf.cvf3.Device ); | 0 |
398 | } executed: } Execution Count:8 | 8 |
399 | | - |
400 | | - |
401 | | - |
402 | | - |
403 | static HB_Error Load_LigGlyph( HB_LigGlyph* lg, | - |
404 | HB_Stream stream ) | - |
405 | { | - |
406 | HB_Error error; | - |
407 | | - |
408 | HB_UShort n, m, count; | - |
409 | HB_UInt cur_offset, new_offset, base_offset; | - |
410 | | - |
411 | HB_CaretValue* cv; | - |
412 | | - |
413 | | - |
414 | base_offset = _hb_stream_pos( stream ); | - |
415 | | - |
416 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
417 | return error; never executed: return error; | 0 |
418 | | - |
419 | count = lg->CaretCount = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
420 | | - |
421 | _hb_stream_frame_exit( stream ); | - |
422 | | - |
423 | lg->CaretValue = ((void *)0); | - |
424 | | - |
425 | if ( ( (lg->CaretValue) = _hb_alloc( (count)*sizeof(HB_CaretValue), &error ), error != 0 ) ) partially evaluated: ( (lg->CaretValue) = _hb_alloc( (count)*sizeof(HB_CaretValue), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
426 | return error; never executed: return error; | 0 |
427 | | - |
428 | cv = lg->CaretValue; | - |
429 | | - |
430 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:8 | yes Evaluation Count:8 |
| 8 |
431 | { | - |
432 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
433 | goto Fail; never executed: goto Fail; | 0 |
434 | | - |
435 | new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))) + base_offset; | - |
436 | | - |
437 | _hb_stream_frame_exit( stream ); | - |
438 | | - |
439 | cur_offset = _hb_stream_pos( stream ); | - |
440 | if ( ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) || partially evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
441 | ( error = Load_CaretValue( &cv[n], stream ) ) != HB_Err_Ok ) partially evaluated: ( error = Load_CaretValue( &cv[n], stream ) ) != HB_Err_Ok no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
442 | goto Fail; never executed: goto Fail; | 0 |
443 | (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
444 | } executed: } Execution Count:8 | 8 |
445 | | - |
446 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:8 | 8 |
447 | | - |
448 | Fail: | - |
449 | for ( m = 0; m < n; m++ ) | 0 |
450 | Free_CaretValue( &cv[m] ); never executed: Free_CaretValue( &cv[m] ); | 0 |
451 | | - |
452 | do { if ( (cv) ) { _hb_free( cv ); cv = ((void *)0); } } while (0); | 0 |
453 | return error; never executed: return error; | 0 |
454 | } | - |
455 | | - |
456 | | - |
457 | static void Free_LigGlyph( HB_LigGlyph* lg) | - |
458 | { | - |
459 | HB_UShort n, count; | - |
460 | | - |
461 | HB_CaretValue* cv; | - |
462 | | - |
463 | | - |
464 | if ( lg->CaretValue ) partially evaluated: lg->CaretValue yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
465 | { | - |
466 | count = lg->CaretCount; | - |
467 | cv = lg->CaretValue; | - |
468 | | - |
469 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:8 | yes Evaluation Count:8 |
| 8 |
470 | Free_CaretValue( &cv[n] ); executed: Free_CaretValue( &cv[n] ); Execution Count:8 | 8 |
471 | | - |
472 | do { if ( (cv) ) { _hb_free( cv ); cv = ((void *)0); } } while (0); partially evaluated: (cv) yes Evaluation Count:8 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:8 |
executed: } Execution Count:8 executed: } Execution Count:8 | 0-8 |
473 | } executed: } Execution Count:8 | 8 |
474 | } executed: } Execution Count:8 | 8 |
475 | | - |
476 | | - |
477 | | - |
478 | | - |
479 | static HB_Error Load_LigCaretList( HB_LigCaretList* lcl, | - |
480 | HB_Stream stream ) | - |
481 | { | - |
482 | HB_Error error; | - |
483 | | - |
484 | HB_UShort m, n, count; | - |
485 | HB_UInt cur_offset, new_offset, base_offset; | - |
486 | | - |
487 | HB_LigGlyph* lg; | - |
488 | | - |
489 | | - |
490 | base_offset = _hb_stream_pos( stream ); | - |
491 | | - |
492 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
493 | return error; never executed: return error; | 0 |
494 | | - |
495 | new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))) + base_offset; | - |
496 | | - |
497 | _hb_stream_frame_exit( stream ); | - |
498 | | - |
499 | cur_offset = _hb_stream_pos( stream ); | - |
500 | if ( ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) || partially evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
501 | ( error = _HB_OPEN_Load_Coverage( &lcl->Coverage, stream ) ) != HB_Err_Ok ) partially evaluated: ( error = _HB_OPEN_Load_Coverage( &lcl->Coverage, stream ) ) != HB_Err_Ok no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
502 | return error; never executed: return error; | 0 |
503 | (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
504 | | - |
505 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
506 | goto Fail2; never executed: goto Fail2; | 0 |
507 | | - |
508 | count = lcl->LigGlyphCount = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
509 | | - |
510 | _hb_stream_frame_exit( stream ); | - |
511 | | - |
512 | lcl->LigGlyph = ((void *)0); | - |
513 | | - |
514 | if ( ( (lcl->LigGlyph) = _hb_alloc( (count)*sizeof(HB_LigGlyph), &error ), error != 0 ) ) partially evaluated: ( (lcl->LigGlyph) = _hb_alloc( (count)*sizeof(HB_LigGlyph), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
515 | goto Fail2; never executed: goto Fail2; | 0 |
516 | | - |
517 | lg = lcl->LigGlyph; | - |
518 | | - |
519 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:8 | yes Evaluation Count:136 |
| 8-136 |
520 | { | - |
521 | if ( ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
522 | goto Fail1; never executed: goto Fail1; | 0 |
523 | | - |
524 | new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))) + base_offset; | - |
525 | | - |
526 | _hb_stream_frame_exit( stream ); | - |
527 | | - |
528 | cur_offset = _hb_stream_pos( stream ); | - |
529 | if ( ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) || partially evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
530 | ( error = Load_LigGlyph( &lg[n], stream ) ) != HB_Err_Ok ) partially evaluated: ( error = Load_LigGlyph( &lg[n], stream ) ) != HB_Err_Ok no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
531 | goto Fail1; never executed: goto Fail1; | 0 |
532 | (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
533 | } executed: } Execution Count:8 | 8 |
534 | | - |
535 | lcl->loaded = (!0); | - |
536 | | - |
537 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:136 | 136 |
538 | | - |
539 | Fail1: | - |
540 | for ( m = 0; m < n; m++ ) | 0 |
541 | Free_LigGlyph( &lg[m] ); never executed: Free_LigGlyph( &lg[m] ); | 0 |
542 | | - |
543 | do { if ( (lg) ) { _hb_free( lg ); lg = ((void *)0); } } while (0); | 0 |
544 | | - |
545 | Fail2: code before this statement never executed: Fail2: | 0 |
546 | _HB_OPEN_Free_Coverage( &lcl->Coverage ); | - |
547 | return error; never executed: return error; | 0 |
548 | } | - |
549 | | - |
550 | | - |
551 | static void Free_LigCaretList( HB_LigCaretList* lcl ) | - |
552 | { | - |
553 | HB_UShort n, count; | - |
554 | | - |
555 | HB_LigGlyph* lg; | - |
556 | | - |
557 | | - |
558 | if ( !lcl->loaded ) partially evaluated: !lcl->loaded no Evaluation Count:0 | yes Evaluation Count:129 |
| 0-129 |
559 | return; | 0 |
560 | | - |
561 | if ( lcl->LigGlyph ) evaluated: lcl->LigGlyph yes Evaluation Count:5 | yes Evaluation Count:124 |
| 5-124 |
562 | { | - |
563 | count = lcl->LigGlyphCount; | - |
564 | lg = lcl->LigGlyph; | - |
565 | | - |
566 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:8 | yes Evaluation Count:5 |
| 5-8 |
567 | Free_LigGlyph( &lg[n] ); executed: Free_LigGlyph( &lg[n] ); Execution Count:8 | 8 |
568 | | - |
569 | do { if ( (lg) ) { _hb_free( lg ); lg = ((void *)0); } } while (0); partially evaluated: (lg) yes Evaluation Count:5 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:5 |
executed: } Execution Count:5 executed: } Execution Count:5 | 0-5 |
570 | } executed: } Execution Count:5 | 5 |
571 | | - |
572 | _HB_OPEN_Free_Coverage( &lcl->Coverage ); | - |
573 | } executed: } Execution Count:129 | 129 |
574 | static HB_UShort Get_New_Class( HB_GDEFHeader* gdef, | - |
575 | HB_UShort glyphID, | - |
576 | HB_UShort index ) | - |
577 | { | - |
578 | HB_UShort glyph_index, array_index, count; | - |
579 | HB_UShort byte, bits; | - |
580 | | - |
581 | HB_ClassRangeRecord* gcrr; | - |
582 | HB_UShort** ngc; | - |
583 | | - |
584 | | - |
585 | if ( glyphID >= gdef->LastGlyph ) never evaluated: glyphID >= gdef->LastGlyph | 0 |
586 | return 0; never executed: return 0; | 0 |
587 | | - |
588 | count = gdef->GlyphClassDef.cd.cd2.ClassRangeCount; | - |
589 | gcrr = gdef->GlyphClassDef.cd.cd2.ClassRangeRecord; | - |
590 | ngc = gdef->NewGlyphClasses; | - |
591 | | - |
592 | if ( index < count && glyphID < gcrr[index].Start ) never evaluated: index < count never evaluated: glyphID < gcrr[index].Start | 0 |
593 | { | - |
594 | array_index = index; | - |
595 | if ( index == 0 ) never evaluated: index == 0 | 0 |
596 | glyph_index = glyphID; never executed: glyph_index = glyphID; | 0 |
597 | else | - |
598 | glyph_index = glyphID - gcrr[index - 1].End - 1; never executed: glyph_index = glyphID - gcrr[index - 1].End - 1; | 0 |
599 | } | - |
600 | else | - |
601 | { | - |
602 | array_index = index + 1; | - |
603 | glyph_index = glyphID - gcrr[index].End - 1; | - |
604 | } | 0 |
605 | | - |
606 | byte = ngc[array_index][glyph_index / 4]; | - |
607 | bits = byte >> ( 16 - ( glyph_index % 4 + 1 ) * 4 ); | - |
608 | | - |
609 | return bits & 0x000F; never executed: return bits & 0x000F; | 0 |
610 | } | - |
611 | | - |
612 | | - |
613 | | - |
614 | HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef, | - |
615 | HB_UShort glyphID, | - |
616 | HB_UShort* property ) | - |
617 | { | - |
618 | HB_UShort class = 0, index = 0; | - |
619 | | - |
620 | HB_Error error; | - |
621 | | - |
622 | | - |
623 | if ( !gdef || !property ) partially evaluated: !gdef no Evaluation Count:0 | yes Evaluation Count:3541657 |
partially evaluated: !property no Evaluation Count:0 | yes Evaluation Count:3541657 |
| 0-3541657 |
624 | return _hb_err (HB_Err_Invalid_Argument); never executed: return _hb_err (HB_Err_Invalid_Argument); | 0 |
625 | | - |
626 | | - |
627 | | - |
628 | if ( gdef->MarkAttachClassDef.loaded ) partially evaluated: gdef->MarkAttachClassDef.loaded no Evaluation Count:0 | yes Evaluation Count:3541657 |
| 0-3541657 |
629 | { | - |
630 | error = _HB_OPEN_Get_Class( &gdef->MarkAttachClassDef, glyphID, &class, &index ); | - |
631 | if ( error && error != HB_Err_Not_Covered ) never evaluated: error != HB_Err_Not_Covered | 0 |
632 | return error; never executed: return error; | 0 |
633 | if ( !error ) | 0 |
634 | { | - |
635 | *property = class << 8; | - |
636 | return HB_Err_Ok; never executed: return HB_Err_Ok; | 0 |
637 | } | - |
638 | } | 0 |
639 | | - |
640 | error = _HB_OPEN_Get_Class( &gdef->GlyphClassDef, glyphID, &class, &index ); | - |
641 | if ( error && error != HB_Err_Not_Covered ) evaluated: error yes Evaluation Count:10876 | yes Evaluation Count:3530781 |
partially evaluated: error != HB_Err_Not_Covered no Evaluation Count:0 | yes Evaluation Count:10876 |
| 0-3530781 |
642 | return error; never executed: return error; | 0 |
643 | | - |
644 | | - |
645 | | - |
646 | | - |
647 | if ( error == HB_Err_Not_Covered && gdef->NewGlyphClasses ) evaluated: error == HB_Err_Not_Covered yes Evaluation Count:10876 | yes Evaluation Count:3530781 |
partially evaluated: gdef->NewGlyphClasses no Evaluation Count:0 | yes Evaluation Count:10876 |
| 0-3530781 |
648 | class = Get_New_Class( gdef, glyphID, index ); never executed: class = Get_New_Class( gdef, glyphID, index ); | 0 |
649 | | - |
650 | switch ( class ) | - |
651 | { | - |
652 | default: | - |
653 | case 0: | - |
654 | *property = 0; | - |
655 | break; executed: break; Execution Count:10876 | 10876 |
656 | | - |
657 | case 1: | - |
658 | *property = 0x0002; | - |
659 | break; executed: break; Execution Count:3315737 | 3315737 |
660 | | - |
661 | case 2: | - |
662 | *property = 0x0004; | - |
663 | break; executed: break; Execution Count:9979 | 9979 |
664 | | - |
665 | case 3: | - |
666 | *property = 0x0008; | - |
667 | break; executed: break; Execution Count:205065 | 205065 |
668 | | - |
669 | case 4: | - |
670 | *property = 0x0010; | - |
671 | break; | 0 |
672 | } | - |
673 | | - |
674 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:3541657 | 3541657 |
675 | } | - |
676 | | - |
677 | | - |
678 | static HB_Error Make_ClassRange( HB_ClassDefinition* cd, | - |
679 | HB_UShort start, | - |
680 | HB_UShort end, | - |
681 | HB_UShort class ) | - |
682 | { | - |
683 | HB_Error error; | - |
684 | HB_UShort index; | - |
685 | | - |
686 | HB_ClassDefFormat2* cdf2; | - |
687 | HB_ClassRangeRecord* crr; | - |
688 | | - |
689 | | - |
690 | cdf2 = &cd->cd.cd2; | - |
691 | | - |
692 | if ( ( (cdf2->ClassRangeRecord) = _hb_realloc( (cdf2->ClassRangeRecord), ((cdf2->ClassRangeCount + 1)*sizeof(HB_ClassRangeRecord)), &error ), error != 0 ) ) never evaluated: ( (cdf2->ClassRangeRecord) = _hb_realloc( (cdf2->ClassRangeRecord), ((cdf2->ClassRangeCount + 1)*sizeof(HB_ClassRangeRecord)), &error ), error != 0 ) | 0 |
693 | | - |
694 | | - |
695 | return error; never executed: return error; | 0 |
696 | | - |
697 | cdf2->ClassRangeCount++; | - |
698 | | - |
699 | crr = cdf2->ClassRangeRecord; | - |
700 | index = cdf2->ClassRangeCount - 1; | - |
701 | | - |
702 | crr[index].Start = start; | - |
703 | crr[index].End = end; | - |
704 | crr[index].Class = class; | - |
705 | | - |
706 | return HB_Err_Ok; never executed: return HB_Err_Ok; | 0 |
707 | } | - |
708 | | - |
709 | | - |
710 | | - |
711 | HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, | - |
712 | HB_UShort num_glyphs, | - |
713 | HB_UShort glyph_count, | - |
714 | HB_UShort* glyph_array, | - |
715 | HB_UShort* class_array ) | - |
716 | { | - |
717 | HB_UShort start, curr_glyph, curr_class; | - |
718 | HB_UShort n, m, count; | - |
719 | HB_Error error; | - |
720 | | - |
721 | HB_ClassDefinition* gcd; | - |
722 | HB_ClassRangeRecord* gcrr; | - |
723 | HB_UShort** ngc; | - |
724 | | - |
725 | | - |
726 | if ( !gdef || !glyph_array || !class_array ) never evaluated: !glyph_array never evaluated: !class_array | 0 |
727 | return _hb_err (HB_Err_Invalid_Argument); never executed: return _hb_err (HB_Err_Invalid_Argument); | 0 |
728 | | - |
729 | gcd = &gdef->GlyphClassDef; | - |
730 | | - |
731 | | - |
732 | | - |
733 | gcd->ClassFormat = 2; | - |
734 | | - |
735 | gcd->cd.cd2.ClassRangeCount = 0; | - |
736 | gcd->cd.cd2.ClassRangeRecord = ((void *)0); | - |
737 | | - |
738 | start = glyph_array[0]; | - |
739 | curr_class = class_array[0]; | - |
740 | curr_glyph = start; | - |
741 | | - |
742 | if ( curr_class >= 5 ) never evaluated: curr_class >= 5 | 0 |
743 | { | - |
744 | error = _hb_err (HB_Err_Invalid_Argument); | - |
745 | goto Fail4; never executed: goto Fail4; | 0 |
746 | } | - |
747 | | - |
748 | glyph_count--; | - |
749 | | - |
750 | for ( n = 0; n < glyph_count + 1; n++ ) never evaluated: n < glyph_count + 1 | 0 |
751 | { | - |
752 | if ( curr_glyph == glyph_array[n] && curr_class == class_array[n] ) never evaluated: curr_glyph == glyph_array[n] never evaluated: curr_class == class_array[n] | 0 |
753 | { | - |
754 | if ( n == glyph_count ) never evaluated: n == glyph_count | 0 |
755 | { | - |
756 | if ( ( error = Make_ClassRange( gcd, start, | 0 |
757 | curr_glyph, | 0 |
758 | curr_class) ) != HB_Err_Ok ) never evaluated: ( error = Make_ClassRange( gcd, start, curr_glyph, curr_class) ) != HB_Err_Ok | 0 |
759 | goto Fail3; never executed: goto Fail3; | 0 |
760 | } | 0 |
761 | else | - |
762 | { | - |
763 | if ( curr_glyph == 0xFFFF ) never evaluated: curr_glyph == 0xFFFF | 0 |
764 | { | - |
765 | error = _hb_err (HB_Err_Invalid_Argument); | - |
766 | goto Fail3; never executed: goto Fail3; | 0 |
767 | } | - |
768 | else | - |
769 | curr_glyph++; never executed: curr_glyph++; | 0 |
770 | } | - |
771 | } | - |
772 | else | - |
773 | { | - |
774 | if ( ( error = Make_ClassRange( gcd, start, | 0 |
775 | curr_glyph - 1, | 0 |
776 | curr_class) ) != HB_Err_Ok ) never evaluated: ( error = Make_ClassRange( gcd, start, curr_glyph - 1, curr_class) ) != HB_Err_Ok | 0 |
777 | goto Fail3; never executed: goto Fail3; | 0 |
778 | | - |
779 | if ( curr_glyph > glyph_array[n] ) never evaluated: curr_glyph > glyph_array[n] | 0 |
780 | { | - |
781 | error = _hb_err (HB_Err_Invalid_Argument); | - |
782 | goto Fail3; never executed: goto Fail3; | 0 |
783 | } | - |
784 | | - |
785 | start = glyph_array[n]; | - |
786 | curr_class = class_array[n]; | - |
787 | curr_glyph = start; | - |
788 | | - |
789 | if ( curr_class >= 5 ) never evaluated: curr_class >= 5 | 0 |
790 | { | - |
791 | error = _hb_err (HB_Err_Invalid_Argument); | - |
792 | goto Fail3; never executed: goto Fail3; | 0 |
793 | } | - |
794 | | - |
795 | if ( n == glyph_count ) never evaluated: n == glyph_count | 0 |
796 | { | - |
797 | if ( ( error = Make_ClassRange( gcd, start, | 0 |
798 | curr_glyph, | 0 |
799 | curr_class) ) != HB_Err_Ok ) never evaluated: ( error = Make_ClassRange( gcd, start, curr_glyph, curr_class) ) != HB_Err_Ok | 0 |
800 | goto Fail3; never executed: goto Fail3; | 0 |
801 | } | 0 |
802 | else | - |
803 | { | - |
804 | if ( curr_glyph == 0xFFFF ) never evaluated: curr_glyph == 0xFFFF | 0 |
805 | { | - |
806 | error = _hb_err (HB_Err_Invalid_Argument); | - |
807 | goto Fail3; never executed: goto Fail3; | 0 |
808 | } | - |
809 | else | - |
810 | curr_glyph++; never executed: curr_glyph++; | 0 |
811 | } | - |
812 | } | - |
813 | } | - |
814 | | - |
815 | | - |
816 | | - |
817 | | - |
818 | if ( ( (gdef->NewGlyphClasses) = _hb_alloc( (gcd->cd.cd2.ClassRangeCount + 1)*sizeof(HB_UShort*), &error ), error != 0 ) ) never evaluated: ( (gdef->NewGlyphClasses) = _hb_alloc( (gcd->cd.cd2.ClassRangeCount + 1)*sizeof(HB_UShort*), &error ), error != 0 ) | 0 |
819 | | - |
820 | goto Fail3; never executed: goto Fail3; | 0 |
821 | | - |
822 | count = gcd->cd.cd2.ClassRangeCount; | - |
823 | gcrr = gcd->cd.cd2.ClassRangeRecord; | - |
824 | ngc = gdef->NewGlyphClasses; | - |
825 | | - |
826 | | - |
827 | | - |
828 | | - |
829 | if ( count > 0 ) never evaluated: count > 0 | 0 |
830 | { | - |
831 | if ( gcrr[0].Start ) never evaluated: gcrr[0].Start | 0 |
832 | { | - |
833 | if ( ( (ngc[0]) = _hb_alloc( (( gcrr[0].Start + 3 ) / 4)*sizeof(HB_UShort), &error ), error != 0 ) ) never evaluated: ( (ngc[0]) = _hb_alloc( (( gcrr[0].Start + 3 ) / 4)*sizeof(HB_UShort), &error ), error != 0 ) | 0 |
834 | goto Fail2; never executed: goto Fail2; | 0 |
835 | } | 0 |
836 | | - |
837 | for ( n = 1; n < count; n++ ) never evaluated: n < count | 0 |
838 | { | - |
839 | if ( gcrr[n].Start - gcrr[n - 1].End > 1 ) never evaluated: gcrr[n].Start - gcrr[n - 1].End > 1 | 0 |
840 | if ( ( (ngc[n]) = _hb_alloc( (( gcrr[n].Start - gcrr[n - 1].End + 2 ) / 4)*sizeof(HB_UShort), &error ), error != 0 ) ) never evaluated: ( (ngc[n]) = _hb_alloc( (( gcrr[n].Start - gcrr[n - 1].End + 2 ) / 4)*sizeof(HB_UShort), &error ), error != 0 ) | 0 |
841 | | - |
842 | | - |
843 | goto Fail1; never executed: goto Fail1; | 0 |
844 | } | 0 |
845 | | - |
846 | if ( gcrr[count - 1].End != num_glyphs - 1 ) never evaluated: gcrr[count - 1].End != num_glyphs - 1 | 0 |
847 | { | - |
848 | if ( ( (ngc[count]) = _hb_alloc( (( num_glyphs - gcrr[count - 1].End + 2 ) / 4)*sizeof(HB_UShort), &error ), error != 0 ) ) never evaluated: ( (ngc[count]) = _hb_alloc( (( num_glyphs - gcrr[count - 1].End + 2 ) / 4)*sizeof(HB_UShort), &error ), error != 0 ) | 0 |
849 | | - |
850 | | - |
851 | goto Fail1; never executed: goto Fail1; | 0 |
852 | } | 0 |
853 | } | 0 |
854 | else if ( num_glyphs > 0 ) never evaluated: num_glyphs > 0 | 0 |
855 | { | - |
856 | if ( ( (ngc[count]) = _hb_alloc( (( num_glyphs + 3 ) / 4)*sizeof(HB_UShort), &error ), error != 0 ) ) never evaluated: ( (ngc[count]) = _hb_alloc( (( num_glyphs + 3 ) / 4)*sizeof(HB_UShort), &error ), error != 0 ) | 0 |
857 | | - |
858 | | - |
859 | goto Fail2; never executed: goto Fail2; | 0 |
860 | } | 0 |
861 | | - |
862 | gdef->LastGlyph = num_glyphs - 1; | - |
863 | | - |
864 | gdef->MarkAttachClassDef_offset = 0L; | - |
865 | gdef->MarkAttachClassDef.loaded = 0; | - |
866 | | - |
867 | gcd->loaded = (!0); | - |
868 | | - |
869 | return HB_Err_Ok; never executed: return HB_Err_Ok; | 0 |
870 | | - |
871 | Fail1: | - |
872 | for ( m = 0; m < n; m++ ) | 0 |
873 | do { if ( (ngc[m]) ) { _hb_free( ngc[m] ); ngc[m] = ((void *)0); } } while (0); never evaluated: (ngc[m]) | 0 |
874 | | - |
875 | Fail2: code before this statement never executed: Fail2: | 0 |
876 | do { if ( (gdef->NewGlyphClasses) ) { _hb_free( gdef->NewGlyphClasses ); gdef->NewGlyphClasses = ((void *)0); } } while (0); never evaluated: (gdef->NewGlyphClasses) | 0 |
877 | | - |
878 | Fail3: code before this statement never executed: Fail3: | 0 |
879 | do { if ( (gcd->cd.cd2.ClassRangeRecord) ) { _hb_free( gcd->cd.cd2.ClassRangeRecord ); gcd->cd.cd2.ClassRangeRecord = ((void *)0); } } while (0); never evaluated: (gcd->cd.cd2.ClassRangeRecord) | 0 |
880 | | - |
881 | Fail4: | - |
882 | return error; never executed: return error; | 0 |
883 | } | - |
884 | | - |
885 | | - |
886 | static void Free_NewGlyphClasses( HB_GDEFHeader* gdef ) | - |
887 | { | - |
888 | HB_UShort** ngc; | - |
889 | HB_UShort n, count; | - |
890 | | - |
891 | | - |
892 | if ( gdef->NewGlyphClasses ) partially evaluated: gdef->NewGlyphClasses no Evaluation Count:0 | yes Evaluation Count:129 |
| 0-129 |
893 | { | - |
894 | count = gdef->GlyphClassDef.cd.cd2.ClassRangeCount + 1; | - |
895 | ngc = gdef->NewGlyphClasses; | - |
896 | | - |
897 | for ( n = 0; n < count; n++ ) never evaluated: n < count | 0 |
898 | do { if ( (ngc[n]) ) { _hb_free( ngc[n] ); ngc[n] = ((void *)0); } } while (0); never evaluated: (ngc[n]) | 0 |
899 | | - |
900 | do { if ( (ngc) ) { _hb_free( ngc ); ngc = ((void *)0); } } while (0); | 0 |
901 | } | 0 |
902 | } executed: } Execution Count:129 | 129 |
903 | | - |
904 | | - |
905 | HB_Error | - |
906 | _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef, | - |
907 | HB_UShort glyphID, | - |
908 | HB_UShort property ) | - |
909 | { | - |
910 | HB_Error error; | - |
911 | HB_UShort class, new_class, index = 0; | - |
912 | HB_UShort byte, bits, mask; | - |
913 | HB_UShort array_index, glyph_index, count; | - |
914 | | - |
915 | HB_ClassRangeRecord* gcrr; | - |
916 | HB_UShort** ngc; | - |
917 | | - |
918 | | - |
919 | error = _HB_OPEN_Get_Class( &gdef->GlyphClassDef, glyphID, &class, &index ); | - |
920 | if ( error && error != HB_Err_Not_Covered ) never evaluated: error != HB_Err_Not_Covered | 0 |
921 | return error; never executed: return error; | 0 |
922 | | - |
923 | | - |
924 | | - |
925 | if ( !error ) | 0 |
926 | return HB_Err_Not_Covered; never executed: return HB_Err_Not_Covered; | 0 |
927 | | - |
928 | switch ( property ) | - |
929 | { | - |
930 | case 0: | - |
931 | new_class = 0; | - |
932 | break; | 0 |
933 | | - |
934 | case 0x0002: | - |
935 | new_class = 1; | - |
936 | break; | 0 |
937 | | - |
938 | case 0x0004: | - |
939 | new_class = 2; | - |
940 | break; | 0 |
941 | | - |
942 | case 0x0008: | - |
943 | new_class = 3; | - |
944 | break; | 0 |
945 | | - |
946 | case 0x0010: | - |
947 | new_class = 4; | - |
948 | break; | 0 |
949 | | - |
950 | default: | - |
951 | return _hb_err (HB_Err_Invalid_Argument); never executed: return _hb_err (HB_Err_Invalid_Argument); | 0 |
952 | } | - |
953 | | - |
954 | count = gdef->GlyphClassDef.cd.cd2.ClassRangeCount; | - |
955 | gcrr = gdef->GlyphClassDef.cd.cd2.ClassRangeRecord; | - |
956 | ngc = gdef->NewGlyphClasses; | - |
957 | | - |
958 | if ( index < count && glyphID < gcrr[index].Start ) never evaluated: index < count never evaluated: glyphID < gcrr[index].Start | 0 |
959 | { | - |
960 | array_index = index; | - |
961 | if ( index == 0 ) never evaluated: index == 0 | 0 |
962 | glyph_index = glyphID; never executed: glyph_index = glyphID; | 0 |
963 | else | - |
964 | glyph_index = glyphID - gcrr[index - 1].End - 1; never executed: glyph_index = glyphID - gcrr[index - 1].End - 1; | 0 |
965 | } | - |
966 | else | - |
967 | { | - |
968 | array_index = index + 1; | - |
969 | glyph_index = glyphID - gcrr[index].End - 1; | - |
970 | } | 0 |
971 | | - |
972 | byte = ngc[array_index][glyph_index / 4]; | - |
973 | bits = byte >> ( 16 - ( glyph_index % 4 + 1 ) * 4 ); | - |
974 | class = bits & 0x000F; | - |
975 | | - |
976 | | - |
977 | | - |
978 | if ( !class ) | 0 |
979 | { | - |
980 | bits = new_class << ( 16 - ( glyph_index % 4 + 1 ) * 4 ); | - |
981 | mask = ~( 0x000F << ( 16 - ( glyph_index % 4 + 1 ) * 4 ) ); | - |
982 | | - |
983 | ngc[array_index][glyph_index / 4] &= mask; | - |
984 | ngc[array_index][glyph_index / 4] |= bits; | - |
985 | } | 0 |
986 | | - |
987 | return HB_Err_Ok; never executed: return HB_Err_Ok; | 0 |
988 | } | - |
989 | | - |
990 | | - |
991 | HB_Error | - |
992 | _HB_GDEF_Check_Property( HB_GDEFHeader* gdef, | - |
993 | HB_GlyphItem gitem, | - |
994 | HB_UShort flags, | - |
995 | HB_UShort* property ) | - |
996 | { | - |
997 | HB_Error error; | - |
998 | | - |
999 | if ( gdef ) evaluated: gdef yes Evaluation Count:67971957 | yes Evaluation Count:54 |
| 54-67971957 |
1000 | { | - |
1001 | HB_UShort basic_glyph_class; | - |
1002 | HB_UShort desired_attachment_class; | - |
1003 | | - |
1004 | if ( gitem->gproperties == 0xFFFF ) evaluated: gitem->gproperties == 0xFFFF yes Evaluation Count:3336533 | yes Evaluation Count:64635424 |
| 3336533-64635424 |
1005 | { | - |
1006 | error = HB_GDEF_Get_Glyph_Property( gdef, gitem->gindex, &gitem->gproperties ); | - |
1007 | if ( error ) partially evaluated: error no Evaluation Count:0 | yes Evaluation Count:3336533 |
| 0-3336533 |
1008 | return error; never executed: return error; | 0 |
1009 | } executed: } Execution Count:3336533 | 3336533 |
1010 | | - |
1011 | *property = gitem->gproperties; | - |
1012 | | - |
1013 | | - |
1014 | | - |
1015 | | - |
1016 | | - |
1017 | | - |
1018 | if ( *property & 0xFF00 ) partially evaluated: *property & 0xFF00 no Evaluation Count:0 | yes Evaluation Count:67971957 |
| 0-67971957 |
1019 | basic_glyph_class = 0x0008; never executed: basic_glyph_class = 0x0008; | 0 |
1020 | else | - |
1021 | basic_glyph_class = *property; executed: basic_glyph_class = *property; Execution Count:67971957 | 67971957 |
1022 | | - |
1023 | | - |
1024 | | - |
1025 | | - |
1026 | if ( flags & basic_glyph_class ) evaluated: flags & basic_glyph_class yes Evaluation Count:69314 | yes Evaluation Count:67902643 |
| 69314-67902643 |
1027 | return HB_Err_Not_Covered; executed: return HB_Err_Not_Covered; Execution Count:69314 | 69314 |
1028 | | - |
1029 | | - |
1030 | | - |
1031 | | - |
1032 | | - |
1033 | desired_attachment_class = flags & 0xFF00; | - |
1034 | if ( desired_attachment_class ) partially evaluated: desired_attachment_class no Evaluation Count:0 | yes Evaluation Count:67902643 |
| 0-67902643 |
1035 | { | - |
1036 | if ( basic_glyph_class == 0x0008 && never evaluated: basic_glyph_class == 0x0008 | 0 |
1037 | *property != desired_attachment_class ) never evaluated: *property != desired_attachment_class | 0 |
1038 | return HB_Err_Not_Covered; never executed: return HB_Err_Not_Covered; | 0 |
1039 | } | 0 |
1040 | } else { executed: } Execution Count:67902643 | 67902643 |
1041 | *property = 0; | - |
1042 | } executed: } Execution Count:54 | 54 |
1043 | | - |
1044 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:67902697 | 67902697 |
1045 | } | - |
1046 | | - |
1047 | HB_Error | - |
1048 | _HB_GDEF_LoadMarkAttachClassDef_From_LookupFlags( HB_GDEFHeader* gdef, | - |
1049 | HB_Stream stream, | - |
1050 | HB_Lookup* lo, | - |
1051 | HB_UShort num_lookups) | - |
1052 | { | - |
1053 | HB_Error error = HB_Err_Ok; | - |
1054 | HB_UShort i; | - |
1055 | if ( gdef && evaluated: gdef yes Evaluation Count:272 | yes Evaluation Count:6 |
| 6-272 |
1056 | gdef->MarkAttachClassDef_offset && !gdef->MarkAttachClassDef.loaded ) evaluated: gdef->MarkAttachClassDef_offset yes Evaluation Count:180 | yes Evaluation Count:92 |
partially evaluated: !gdef->MarkAttachClassDef.loaded yes Evaluation Count:180 | no Evaluation Count:0 |
| 0-180 |
1057 | { | - |
1058 | for ( i = 0; i < num_lookups; i++ ) evaluated: i < num_lookups yes Evaluation Count:4950 | yes Evaluation Count:180 |
| 180-4950 |
1059 | { | - |
1060 | | - |
1061 | if ( lo[i].LookupFlag & 0xFF00 ) partially evaluated: lo[i].LookupFlag & 0xFF00 no Evaluation Count:0 | yes Evaluation Count:4950 |
| 0-4950 |
1062 | { | - |
1063 | if ( ( (error = (_hb_stream_seek( stream, gdef->MarkAttachClassDef_offset ))) != 0 ) || never evaluated: ( (error = (_hb_stream_seek( stream, gdef->MarkAttachClassDef_offset ))) != 0 ) | 0 |
1064 | ( error = _HB_OPEN_Load_ClassDefinition( &gdef->MarkAttachClassDef, | 0 |
1065 | 256, stream ) ) != HB_Err_Ok ) never evaluated: ( error = _HB_OPEN_Load_ClassDefinition( &gdef->MarkAttachClassDef, 256, stream ) ) != HB_Err_Ok | 0 |
1066 | goto Done; never executed: goto Done; | 0 |
1067 | | - |
1068 | break; | 0 |
1069 | } | - |
1070 | } executed: } Execution Count:4950 | 4950 |
1071 | } executed: } Execution Count:180 | 180 |
1072 | | - |
1073 | Done: | - |
1074 | return error; executed: return error; Execution Count:278 | 278 |
1075 | } | - |
1076 | | - |
| | |