Line | Source Code | Coverage |
---|
1 | /* | - |
2 | * Copyright (C) 1998-2004 David Turner and Werner Lemberg | - |
3 | * Copyright (C) 2006 Behdad Esfahbod | - |
4 | * | - |
5 | * This is part of HarfBuzz, an OpenType Layout engine library. | - |
6 | * | - |
7 | * Permission is hereby granted, without written agreement and without | - |
8 | * license or royalty fees, to use, copy, modify, and distribute this | - |
9 | * software and its documentation for any purpose, provided that the | - |
10 | * above copyright notice and the following two paragraphs appear in | - |
11 | * all copies of this software. | - |
12 | * | - |
13 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR | - |
14 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | - |
15 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN | - |
16 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | - |
17 | * DAMAGE. | - |
18 | * | - |
19 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, | - |
20 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | - |
21 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | - |
22 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO | - |
23 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | - |
24 | */ | - |
25 | | - |
26 | #include "harfbuzz-impl.h" | - |
27 | #include "harfbuzz-open-private.h" | - |
28 | | - |
29 | | - |
30 | /*************************** | - |
31 | * Script related functions | - |
32 | ***************************/ | - |
33 | | - |
34 | | - |
35 | /* LangSys */ | - |
36 | | - |
37 | static HB_Error Load_LangSys( HB_LangSys* ls, | - |
38 | HB_Stream stream ) | - |
39 | { | - |
40 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
41 | HB_UShort n, count; executed (the execution status of this line is deduced): HB_UShort n, count; | - |
42 | HB_UShort* fi; executed (the execution status of this line is deduced): HB_UShort* fi; | - |
43 | | - |
44 | | - |
45 | if ( ACCESS_Frame( 6L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 6L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:8484 |
| 0-8484 |
46 | return error; never executed: return error; | 0 |
47 | | - |
48 | ls->LookupOrderOffset = GET_UShort(); /* should be 0 */ executed (the execution status of this line is deduced): ls->LookupOrderOffset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
49 | ls->ReqFeatureIndex = GET_UShort(); executed (the execution status of this line is deduced): ls->ReqFeatureIndex = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
50 | count = ls->FeatureCount = GET_UShort(); executed (the execution status of this line is deduced): count = ls->FeatureCount = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
51 | | - |
52 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
53 | | - |
54 | ls->FeatureIndex = NULL; executed (the execution status of this line is deduced): ls->FeatureIndex = ((void *)0); | - |
55 | | - |
56 | if ( ALLOC_ARRAY( ls->FeatureIndex, count, HB_UShort ) ) partially evaluated: ( (ls->FeatureIndex) = _hb_alloc( (count)*sizeof(HB_UShort), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:8484 |
| 0-8484 |
57 | return error; never executed: return error; | 0 |
58 | | - |
59 | if ( ACCESS_Frame( count * 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, count * 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:8484 |
| 0-8484 |
60 | { | - |
61 | FREE( ls->FeatureIndex ); never executed: } never executed: } never evaluated: (ls->FeatureIndex) never evaluated: 0 | 0 |
62 | return error; never executed: return error; | 0 |
63 | } | - |
64 | | - |
65 | fi = ls->FeatureIndex; executed (the execution status of this line is deduced): fi = ls->FeatureIndex; | - |
66 | | - |
67 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:24054 | yes Evaluation Count:8484 |
| 8484-24054 |
68 | fi[n] = GET_UShort(); executed: fi[n] = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); Execution Count:24054 | 24054 |
69 | | - |
70 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
71 | | - |
72 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:8484 | 8484 |
73 | } | - |
74 | | - |
75 | | - |
76 | static void Free_LangSys( HB_LangSys* ls ) | - |
77 | { | - |
78 | FREE( ls->FeatureIndex ); executed: } Execution Count:7959 executed: } Execution Count:8062 evaluated: (ls->FeatureIndex) yes Evaluation Count:7959 | yes Evaluation Count:103 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:8062 |
| 0-8062 |
79 | } executed: } Execution Count:8062 | 8062 |
80 | | - |
81 | | - |
82 | /* Script */ | - |
83 | | - |
84 | static HB_Error Load_Script( HB_ScriptTable* s, | - |
85 | HB_Stream stream ) | - |
86 | { | - |
87 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
88 | HB_UShort n, m, count; executed (the execution status of this line is deduced): HB_UShort n, m, count; | - |
89 | HB_UInt cur_offset, new_offset, base_offset; executed (the execution status of this line is deduced): HB_UInt cur_offset, new_offset, base_offset; | - |
90 | | - |
91 | HB_LangSysRecord* lsr; executed (the execution status of this line is deduced): HB_LangSysRecord* lsr; | - |
92 | | - |
93 | | - |
94 | base_offset = FILE_Pos(); executed (the execution status of this line is deduced): base_offset = _hb_stream_pos( stream ); | - |
95 | | - |
96 | if ( ACCESS_Frame( 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:5125 |
| 0-5125 |
97 | return error; never executed: return error; | 0 |
98 | | - |
99 | new_offset = GET_UShort() + base_offset; executed (the execution status of this line is deduced): new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))) + base_offset; | - |
100 | | - |
101 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
102 | | - |
103 | if ( new_offset != base_offset ) /* not a NULL offset */ evaluated: new_offset != base_offset yes Evaluation Count:5124 | yes Evaluation Count:1 |
| 1-5124 |
104 | { | - |
105 | cur_offset = FILE_Pos(); executed (the execution status of this line is deduced): cur_offset = _hb_stream_pos( stream ); | - |
106 | if ( FILE_Seek( new_offset ) || partially evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:5124 |
| 0-5124 |
107 | ( error = Load_LangSys( &s->DefaultLangSys, partially evaluated: ( error = Load_LangSys( &s->DefaultLangSys, stream ) ) != HB_Err_Ok no Evaluation Count:0 | yes Evaluation Count:5124 |
| 0-5124 |
108 | stream ) ) != HB_Err_Ok ) partially evaluated: ( error = Load_LangSys( &s->DefaultLangSys, stream ) ) != HB_Err_Ok no Evaluation Count:0 | yes Evaluation Count:5124 |
| 0-5124 |
109 | return error; never executed: return error; | 0 |
110 | (void)FILE_Seek( cur_offset ); executed (the execution status of this line is deduced): (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
111 | } executed: } Execution Count:5124 | 5124 |
112 | else | - |
113 | { | - |
114 | /* we create a DefaultLangSys table with no entries */ | - |
115 | | - |
116 | s->DefaultLangSys.LookupOrderOffset = 0; executed (the execution status of this line is deduced): s->DefaultLangSys.LookupOrderOffset = 0; | - |
117 | s->DefaultLangSys.ReqFeatureIndex = 0xFFFF; executed (the execution status of this line is deduced): s->DefaultLangSys.ReqFeatureIndex = 0xFFFF; | - |
118 | s->DefaultLangSys.FeatureCount = 0; executed (the execution status of this line is deduced): s->DefaultLangSys.FeatureCount = 0; | - |
119 | s->DefaultLangSys.FeatureIndex = NULL; executed (the execution status of this line is deduced): s->DefaultLangSys.FeatureIndex = ((void *)0); | - |
120 | } executed: } Execution Count:1 | 1 |
121 | | - |
122 | if ( ACCESS_Frame( 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:5125 |
| 0-5125 |
123 | goto Fail2; never executed: goto Fail2; | 0 |
124 | | - |
125 | count = s->LangSysCount = GET_UShort(); executed (the execution status of this line is deduced): count = s->LangSysCount = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
126 | | - |
127 | /* safety check; otherwise the official handling of TrueType Open | - |
128 | fonts won't work */ | - |
129 | | - |
130 | if ( s->LangSysCount == 0 && s->DefaultLangSys.FeatureCount == 0 ) evaluated: s->LangSysCount == 0 yes Evaluation Count:4357 | yes Evaluation Count:768 |
evaluated: s->DefaultLangSys.FeatureCount == 0 yes Evaluation Count:102 | yes Evaluation Count:4255 |
| 102-4357 |
131 | { | - |
132 | error = HB_Err_Not_Covered; executed (the execution status of this line is deduced): error = HB_Err_Not_Covered; | - |
133 | goto Fail2; executed: goto Fail2; Execution Count:102 | 102 |
134 | } | - |
135 | | - |
136 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
137 | | - |
138 | s->LangSysRecord = NULL; executed (the execution status of this line is deduced): s->LangSysRecord = ((void *)0); | - |
139 | | - |
140 | if ( ALLOC_ARRAY( s->LangSysRecord, count, HB_LangSysRecord ) ) partially evaluated: ( (s->LangSysRecord) = _hb_alloc( (count)*sizeof(HB_LangSysRecord), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:5023 |
| 0-5023 |
141 | goto Fail2; never executed: goto Fail2; | 0 |
142 | | - |
143 | lsr = s->LangSysRecord; executed (the execution status of this line is deduced): lsr = s->LangSysRecord; | - |
144 | | - |
145 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:3360 | yes Evaluation Count:5023 |
| 3360-5023 |
146 | { | - |
147 | if ( ACCESS_Frame( 6L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 6L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:3360 |
| 0-3360 |
148 | goto Fail1; never executed: goto Fail1; | 0 |
149 | | - |
150 | lsr[n].LangSysTag = GET_ULong(); executed (the execution status of this line is deduced): lsr[n].LangSysTag = ((HB_UInt)(stream->cursor += 4, (HB_Int)( (*(((HB_Byte*)stream->cursor)-4) << 24) | (*(((HB_Byte*)stream->cursor)-3) << 16) | (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
151 | new_offset = GET_UShort() + base_offset; executed (the execution status of this line is deduced): new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))) + base_offset; | - |
152 | | - |
153 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
154 | | - |
155 | cur_offset = FILE_Pos(); executed (the execution status of this line is deduced): cur_offset = _hb_stream_pos( stream ); | - |
156 | if ( FILE_Seek( new_offset ) || partially evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:3360 |
| 0-3360 |
157 | ( error = Load_LangSys( &lsr[n].LangSys, stream ) ) != HB_Err_Ok ) partially evaluated: ( error = Load_LangSys( &lsr[n].LangSys, stream ) ) != HB_Err_Ok no Evaluation Count:0 | yes Evaluation Count:3360 |
| 0-3360 |
158 | goto Fail1; never executed: goto Fail1; | 0 |
159 | (void)FILE_Seek( cur_offset ); executed (the execution status of this line is deduced): (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
160 | } executed: } Execution Count:3360 | 3360 |
161 | | - |
162 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:5023 | 5023 |
163 | | - |
164 | Fail1: | - |
165 | for ( m = 0; m < n; m++ ) | 0 |
166 | Free_LangSys( &lsr[m].LangSys ); never executed: Free_LangSys( &lsr[m].LangSys ); | 0 |
167 | | - |
168 | FREE( s->LangSysRecord ); never executed: } never executed: } never evaluated: (s->LangSysRecord) never evaluated: 0 | 0 |
169 | | - |
170 | Fail2: code before this statement never executed: Fail2: | 0 |
171 | Free_LangSys( &s->DefaultLangSys ); executed (the execution status of this line is deduced): Free_LangSys( &s->DefaultLangSys ); | - |
172 | return error; executed: return error; Execution Count:102 | 102 |
173 | } | - |
174 | | - |
175 | | - |
176 | static void Free_Script( HB_ScriptTable* s ) | - |
177 | { | - |
178 | HB_UShort n, count; executed (the execution status of this line is deduced): HB_UShort n, count; | - |
179 | | - |
180 | HB_LangSysRecord* lsr; executed (the execution status of this line is deduced): HB_LangSysRecord* lsr; | - |
181 | | - |
182 | | - |
183 | Free_LangSys( &s->DefaultLangSys ); executed (the execution status of this line is deduced): Free_LangSys( &s->DefaultLangSys ); | - |
184 | | - |
185 | if ( s->LangSysRecord ) evaluated: s->LangSysRecord yes Evaluation Count:728 | yes Evaluation Count:4046 |
| 728-4046 |
186 | { | - |
187 | count = s->LangSysCount; executed (the execution status of this line is deduced): count = s->LangSysCount; | - |
188 | lsr = s->LangSysRecord; executed (the execution status of this line is deduced): lsr = s->LangSysRecord; | - |
189 | | - |
190 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:3186 | yes Evaluation Count:728 |
| 728-3186 |
191 | Free_LangSys( &lsr[n].LangSys ); executed: Free_LangSys( &lsr[n].LangSys ); Execution Count:3186 | 3186 |
192 | | - |
193 | FREE( lsr ); executed: } Execution Count:728 executed: } Execution Count:728 partially evaluated: (lsr) yes Evaluation Count:728 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:728 |
| 0-728 |
194 | } executed: } Execution Count:728 | 728 |
195 | } executed: } Execution Count:4774 | 4774 |
196 | | - |
197 | | - |
198 | /* ScriptList */ | - |
199 | | - |
200 | HB_INTERNAL HB_Error | - |
201 | _HB_OPEN_Load_ScriptList( HB_ScriptList* sl, | - |
202 | HB_Stream stream ) | - |
203 | { | - |
204 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
205 | | - |
206 | HB_UShort n, script_count; executed (the execution status of this line is deduced): HB_UShort n, script_count; | - |
207 | HB_UInt cur_offset, new_offset, base_offset; executed (the execution status of this line is deduced): HB_UInt cur_offset, new_offset, base_offset; | - |
208 | | - |
209 | HB_ScriptRecord* sr; executed (the execution status of this line is deduced): HB_ScriptRecord* sr; | - |
210 | | - |
211 | | - |
212 | base_offset = FILE_Pos(); executed (the execution status of this line is deduced): base_offset = _hb_stream_pos( stream ); | - |
213 | | - |
214 | if ( ACCESS_Frame( 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:278 |
| 0-278 |
215 | return error; never executed: return error; | 0 |
216 | | - |
217 | script_count = GET_UShort(); executed (the execution status of this line is deduced): script_count = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
218 | | - |
219 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
220 | | - |
221 | sl->ScriptRecord = NULL; executed (the execution status of this line is deduced): sl->ScriptRecord = ((void *)0); | - |
222 | | - |
223 | if ( ALLOC_ARRAY( sl->ScriptRecord, script_count, HB_ScriptRecord ) ) partially evaluated: ( (sl->ScriptRecord) = _hb_alloc( (script_count)*sizeof(HB_ScriptRecord), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:278 |
| 0-278 |
224 | return error; never executed: return error; | 0 |
225 | | - |
226 | sr = sl->ScriptRecord; executed (the execution status of this line is deduced): sr = sl->ScriptRecord; | - |
227 | | - |
228 | sl->ScriptCount= 0; executed (the execution status of this line is deduced): sl->ScriptCount= 0; | - |
229 | for ( n = 0; n < script_count; n++ ) evaluated: n < script_count yes Evaluation Count:5125 | yes Evaluation Count:278 |
| 278-5125 |
230 | { | - |
231 | if ( ACCESS_Frame( 6L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 6L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:5125 |
| 0-5125 |
232 | goto Fail; never executed: goto Fail; | 0 |
233 | | - |
234 | sr[sl->ScriptCount].ScriptTag = GET_ULong(); executed (the execution status of this line is deduced): sr[sl->ScriptCount].ScriptTag = ((HB_UInt)(stream->cursor += 4, (HB_Int)( (*(((HB_Byte*)stream->cursor)-4) << 24) | (*(((HB_Byte*)stream->cursor)-3) << 16) | (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
235 | new_offset = GET_UShort() + base_offset; executed (the execution status of this line is deduced): new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))) + base_offset; | - |
236 | | - |
237 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
238 | | - |
239 | cur_offset = FILE_Pos(); executed (the execution status of this line is deduced): cur_offset = _hb_stream_pos( stream ); | - |
240 | | - |
241 | if ( FILE_Seek( new_offset ) ) partially evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:5125 |
| 0-5125 |
242 | goto Fail; never executed: goto Fail; | 0 |
243 | | - |
244 | error = Load_Script( &sr[sl->ScriptCount].Script, stream ); executed (the execution status of this line is deduced): error = Load_Script( &sr[sl->ScriptCount].Script, stream ); | - |
245 | if ( error == HB_Err_Ok ) evaluated: error == HB_Err_Ok yes Evaluation Count:5023 | yes Evaluation Count:102 |
| 102-5023 |
246 | sl->ScriptCount += 1; executed: sl->ScriptCount += 1; Execution Count:5023 | 5023 |
247 | else if ( error != HB_Err_Not_Covered ) partially evaluated: error != HB_Err_Not_Covered no Evaluation Count:0 | yes Evaluation Count:102 |
| 0-102 |
248 | goto Fail; never executed: goto Fail; | 0 |
249 | | - |
250 | (void)FILE_Seek( cur_offset ); executed (the execution status of this line is deduced): (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
251 | } executed: } Execution Count:5125 | 5125 |
252 | | - |
253 | /* Empty tables are harmless and generated by fontforge. | - |
254 | * See http://bugzilla.gnome.org/show_bug.cgi?id=347073 | - |
255 | */ | - |
256 | #if 0 | - |
257 | if ( sl->ScriptCount == 0 ) | - |
258 | { | - |
259 | error = ERR(HB_Err_Invalid_SubTable); | - |
260 | goto Fail; | - |
261 | } | - |
262 | #endif | - |
263 | | - |
264 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:278 | 278 |
265 | | - |
266 | Fail: | - |
267 | for ( n = 0; n < sl->ScriptCount; n++ ) never evaluated: n < sl->ScriptCount | 0 |
268 | Free_Script( &sr[n].Script ); never executed: Free_Script( &sr[n].Script ); | 0 |
269 | | - |
270 | FREE( sl->ScriptRecord ); never executed: } never executed: } never evaluated: (sl->ScriptRecord) never evaluated: 0 | 0 |
271 | return error; never executed: return error; | 0 |
272 | } | - |
273 | | - |
274 | | - |
275 | HB_INTERNAL void | - |
276 | _HB_OPEN_Free_ScriptList( HB_ScriptList* sl ) | - |
277 | { | - |
278 | HB_UShort n, count; executed (the execution status of this line is deduced): HB_UShort n, count; | - |
279 | | - |
280 | HB_ScriptRecord* sr; executed (the execution status of this line is deduced): HB_ScriptRecord* sr; | - |
281 | | - |
282 | | - |
283 | if ( sl->ScriptRecord ) partially evaluated: sl->ScriptRecord yes Evaluation Count:264 | no Evaluation Count:0 |
| 0-264 |
284 | { | - |
285 | count = sl->ScriptCount; executed (the execution status of this line is deduced): count = sl->ScriptCount; | - |
286 | sr = sl->ScriptRecord; executed (the execution status of this line is deduced): sr = sl->ScriptRecord; | - |
287 | | - |
288 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:4774 | yes Evaluation Count:264 |
| 264-4774 |
289 | Free_Script( &sr[n].Script ); executed: Free_Script( &sr[n].Script ); Execution Count:4774 | 4774 |
290 | | - |
291 | FREE( sr ); executed: } Execution Count:264 executed: } Execution Count:264 partially evaluated: (sr) yes Evaluation Count:264 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:264 |
| 0-264 |
292 | } executed: } Execution Count:264 | 264 |
293 | } executed: } Execution Count:264 | 264 |
294 | | - |
295 | | - |
296 | | - |
297 | /********************************* | - |
298 | * Feature List related functions | - |
299 | *********************************/ | - |
300 | | - |
301 | | - |
302 | /* Feature */ | - |
303 | | - |
304 | static HB_Error Load_Feature( HB_Feature* f, | - |
305 | HB_Stream stream ) | - |
306 | { | - |
307 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
308 | | - |
309 | HB_UShort n, count; executed (the execution status of this line is deduced): HB_UShort n, count; | - |
310 | | - |
311 | HB_UShort* lli; executed (the execution status of this line is deduced): HB_UShort* lli; | - |
312 | | - |
313 | | - |
314 | if ( ACCESS_Frame( 4L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 4L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:4870 |
| 0-4870 |
315 | return error; never executed: return error; | 0 |
316 | | - |
317 | f->FeatureParams = GET_UShort(); /* should be 0 */ executed (the execution status of this line is deduced): f->FeatureParams = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
318 | count = f->LookupListCount = GET_UShort(); executed (the execution status of this line is deduced): count = f->LookupListCount = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
319 | | - |
320 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
321 | | - |
322 | f->LookupListIndex = NULL; executed (the execution status of this line is deduced): f->LookupListIndex = ((void *)0); | - |
323 | | - |
324 | if ( ALLOC_ARRAY( f->LookupListIndex, count, HB_UShort ) ) partially evaluated: ( (f->LookupListIndex) = _hb_alloc( (count)*sizeof(HB_UShort), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:4870 |
| 0-4870 |
325 | return error; never executed: return error; | 0 |
326 | | - |
327 | lli = f->LookupListIndex; executed (the execution status of this line is deduced): lli = f->LookupListIndex; | - |
328 | | - |
329 | if ( ACCESS_Frame( count * 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, count * 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:4870 |
| 0-4870 |
330 | { | - |
331 | FREE( f->LookupListIndex ); never executed: } never executed: } never evaluated: (f->LookupListIndex) never evaluated: 0 | 0 |
332 | return error; never executed: return error; | 0 |
333 | } | - |
334 | | - |
335 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:6946 | yes Evaluation Count:4870 |
| 4870-6946 |
336 | lli[n] = GET_UShort(); executed: lli[n] = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); Execution Count:6946 | 6946 |
337 | | - |
338 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
339 | | - |
340 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:4870 | 4870 |
341 | } | - |
342 | | - |
343 | | - |
344 | static void Free_Feature( HB_Feature* f ) | - |
345 | { | - |
346 | FREE( f->LookupListIndex ); executed: } Execution Count:4633 executed: } Execution Count:4633 partially evaluated: (f->LookupListIndex) yes Evaluation Count:4633 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:4633 |
| 0-4633 |
347 | } executed: } Execution Count:4633 | 4633 |
348 | | - |
349 | | - |
350 | /* FeatureList */ | - |
351 | | - |
352 | HB_INTERNAL HB_Error | - |
353 | _HB_OPEN_Load_FeatureList( HB_FeatureList* fl, | - |
354 | HB_Stream stream ) | - |
355 | { | - |
356 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
357 | | - |
358 | HB_UShort n, m, count; executed (the execution status of this line is deduced): HB_UShort n, m, count; | - |
359 | HB_UInt cur_offset, new_offset, base_offset; executed (the execution status of this line is deduced): HB_UInt cur_offset, new_offset, base_offset; | - |
360 | | - |
361 | HB_FeatureRecord* fr; executed (the execution status of this line is deduced): HB_FeatureRecord* fr; | - |
362 | | - |
363 | | - |
364 | base_offset = FILE_Pos(); executed (the execution status of this line is deduced): base_offset = _hb_stream_pos( stream ); | - |
365 | | - |
366 | if ( ACCESS_Frame( 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:278 |
| 0-278 |
367 | return error; never executed: return error; | 0 |
368 | | - |
369 | count = fl->FeatureCount = GET_UShort(); executed (the execution status of this line is deduced): count = fl->FeatureCount = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
370 | | - |
371 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
372 | | - |
373 | fl->FeatureRecord = NULL; executed (the execution status of this line is deduced): fl->FeatureRecord = ((void *)0); | - |
374 | | - |
375 | if ( ALLOC_ARRAY( fl->FeatureRecord, count, HB_FeatureRecord ) ) partially evaluated: ( (fl->FeatureRecord) = _hb_alloc( (count)*sizeof(HB_FeatureRecord), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:278 |
| 0-278 |
376 | return error; never executed: return error; | 0 |
377 | if ( ALLOC_ARRAY( fl->ApplyOrder, count, HB_UShort ) ) partially evaluated: ( (fl->ApplyOrder) = _hb_alloc( (count)*sizeof(HB_UShort), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:278 |
| 0-278 |
378 | goto Fail2; never executed: goto Fail2; | 0 |
379 | | - |
380 | fl->ApplyCount = 0; executed (the execution status of this line is deduced): fl->ApplyCount = 0; | - |
381 | | - |
382 | fr = fl->FeatureRecord; executed (the execution status of this line is deduced): fr = fl->FeatureRecord; | - |
383 | | - |
384 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:4870 | yes Evaluation Count:278 |
| 278-4870 |
385 | { | - |
386 | if ( ACCESS_Frame( 6L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 6L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:4870 |
| 0-4870 |
387 | goto Fail1; never executed: goto Fail1; | 0 |
388 | | - |
389 | fr[n].FeatureTag = GET_ULong(); executed (the execution status of this line is deduced): fr[n].FeatureTag = ((HB_UInt)(stream->cursor += 4, (HB_Int)( (*(((HB_Byte*)stream->cursor)-4) << 24) | (*(((HB_Byte*)stream->cursor)-3) << 16) | (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
390 | new_offset = GET_UShort() + base_offset; executed (the execution status of this line is deduced): new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))) + base_offset; | - |
391 | | - |
392 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
393 | | - |
394 | cur_offset = FILE_Pos(); executed (the execution status of this line is deduced): cur_offset = _hb_stream_pos( stream ); | - |
395 | if ( FILE_Seek( new_offset ) || partially evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:4870 |
| 0-4870 |
396 | ( error = Load_Feature( &fr[n].Feature, stream ) ) != HB_Err_Ok ) partially evaluated: ( error = Load_Feature( &fr[n].Feature, stream ) ) != HB_Err_Ok no Evaluation Count:0 | yes Evaluation Count:4870 |
| 0-4870 |
397 | goto Fail1; never executed: goto Fail1; | 0 |
398 | (void)FILE_Seek( cur_offset ); executed (the execution status of this line is deduced): (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
399 | } executed: } Execution Count:4870 | 4870 |
400 | | - |
401 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:278 | 278 |
402 | | - |
403 | Fail1: | - |
404 | for ( m = 0; m < n; m++ ) | 0 |
405 | Free_Feature( &fr[m].Feature ); never executed: Free_Feature( &fr[m].Feature ); | 0 |
406 | | - |
407 | FREE( fl->ApplyOrder ); never executed: } never executed: } never evaluated: (fl->ApplyOrder) never evaluated: 0 | 0 |
408 | | - |
409 | Fail2: code before this statement never executed: Fail2: | 0 |
410 | FREE( fl->FeatureRecord ); never executed: } never executed: } never evaluated: (fl->FeatureRecord) never evaluated: 0 | 0 |
411 | | - |
412 | return error; never executed: return error; | 0 |
413 | } | - |
414 | | - |
415 | | - |
416 | HB_INTERNAL void | - |
417 | _HB_OPEN_Free_FeatureList( HB_FeatureList* fl ) | - |
418 | { | - |
419 | HB_UShort n, count; executed (the execution status of this line is deduced): HB_UShort n, count; | - |
420 | | - |
421 | HB_FeatureRecord* fr; executed (the execution status of this line is deduced): HB_FeatureRecord* fr; | - |
422 | | - |
423 | | - |
424 | if ( fl->FeatureRecord ) partially evaluated: fl->FeatureRecord yes Evaluation Count:264 | no Evaluation Count:0 |
| 0-264 |
425 | { | - |
426 | count = fl->FeatureCount; executed (the execution status of this line is deduced): count = fl->FeatureCount; | - |
427 | fr = fl->FeatureRecord; executed (the execution status of this line is deduced): fr = fl->FeatureRecord; | - |
428 | | - |
429 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:4633 | yes Evaluation Count:264 |
| 264-4633 |
430 | Free_Feature( &fr[n].Feature ); executed: Free_Feature( &fr[n].Feature ); Execution Count:4633 | 4633 |
431 | | - |
432 | FREE( fr ); executed: } Execution Count:264 executed: } Execution Count:264 partially evaluated: (fr) yes Evaluation Count:264 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:264 |
| 0-264 |
433 | } executed: } Execution Count:264 | 264 |
434 | | - |
435 | FREE( fl->ApplyOrder ); executed: } Execution Count:264 executed: } Execution Count:264 partially evaluated: (fl->ApplyOrder) yes Evaluation Count:264 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:264 |
| 0-264 |
436 | } executed: } Execution Count:264 | 264 |
437 | | - |
438 | | - |
439 | | - |
440 | /******************************** | - |
441 | * Lookup List related functions | - |
442 | ********************************/ | - |
443 | | - |
444 | /* the subroutines of the following two functions are defined in | - |
445 | ftxgsub.c and ftxgpos.c respectively */ | - |
446 | | - |
447 | | - |
448 | /* SubTable */ | - |
449 | | - |
450 | static HB_Error Load_SubTable( HB_SubTable* st, | - |
451 | HB_Stream stream, | - |
452 | HB_Type table_type, | - |
453 | HB_UShort lookup_type ) | - |
454 | { | - |
455 | if ( table_type == HB_Type_GSUB ) evaluated: table_type == HB_Type_GSUB yes Evaluation Count:6163 | yes Evaluation Count:2684 |
| 2684-6163 |
456 | return _HB_GSUB_Load_SubTable ( &st->st.gsub, stream, lookup_type ); executed: return _HB_GSUB_Load_SubTable ( &st->st.gsub, stream, lookup_type ); Execution Count:6163 | 6163 |
457 | else | - |
458 | return _HB_GPOS_Load_SubTable ( &st->st.gpos, stream, lookup_type ); executed: return _HB_GPOS_Load_SubTable ( &st->st.gpos, stream, lookup_type ); Execution Count:2684 | 2684 |
459 | } | - |
460 | | - |
461 | | - |
462 | static void Free_SubTable( HB_SubTable* st, | - |
463 | HB_Type table_type, | - |
464 | HB_UShort lookup_type ) | - |
465 | { | - |
466 | if ( table_type == HB_Type_GSUB ) evaluated: table_type == HB_Type_GSUB yes Evaluation Count:5864 | yes Evaluation Count:2547 |
| 2547-5864 |
467 | _HB_GSUB_Free_SubTable ( &st->st.gsub, lookup_type ); executed: _HB_GSUB_Free_SubTable ( &st->st.gsub, lookup_type ); Execution Count:5864 | 5864 |
468 | else | - |
469 | _HB_GPOS_Free_SubTable ( &st->st.gpos, lookup_type ); executed: _HB_GPOS_Free_SubTable ( &st->st.gpos, lookup_type ); Execution Count:2547 | 2547 |
470 | } | - |
471 | | - |
472 | | - |
473 | /* Lookup */ | - |
474 | | - |
475 | static HB_Error Load_Lookup( HB_Lookup* l, | - |
476 | HB_Stream stream, | - |
477 | HB_Type type ) | - |
478 | { | - |
479 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
480 | | - |
481 | HB_UShort n, m, count; executed (the execution status of this line is deduced): HB_UShort n, m, count; | - |
482 | HB_UInt cur_offset, new_offset, base_offset; executed (the execution status of this line is deduced): HB_UInt cur_offset, new_offset, base_offset; | - |
483 | | - |
484 | HB_SubTable* st; executed (the execution status of this line is deduced): HB_SubTable* st; | - |
485 | | - |
486 | HB_Bool is_extension = FALSE; executed (the execution status of this line is deduced): HB_Bool is_extension = 0; | - |
487 | | - |
488 | | - |
489 | base_offset = FILE_Pos(); executed (the execution status of this line is deduced): base_offset = _hb_stream_pos( stream ); | - |
490 | | - |
491 | if ( ACCESS_Frame( 6L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 6L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:7105 |
| 0-7105 |
492 | return error; never executed: return error; | 0 |
493 | | - |
494 | l->LookupType = GET_UShort(); executed (the execution status of this line is deduced): l->LookupType = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
495 | l->LookupFlag = GET_UShort(); executed (the execution status of this line is deduced): l->LookupFlag = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
496 | count = l->SubTableCount = GET_UShort(); executed (the execution status of this line is deduced): count = l->SubTableCount = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
497 | | - |
498 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
499 | | - |
500 | l->SubTable = NULL; executed (the execution status of this line is deduced): l->SubTable = ((void *)0); | - |
501 | | - |
502 | if ( ALLOC_ARRAY( l->SubTable, count, HB_SubTable ) ) partially evaluated: ( (l->SubTable) = _hb_alloc( (count)*sizeof(HB_SubTable), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:7105 |
| 0-7105 |
503 | return error; never executed: return error; | 0 |
504 | | - |
505 | st = l->SubTable; executed (the execution status of this line is deduced): st = l->SubTable; | - |
506 | | - |
507 | if ( ( type == HB_Type_GSUB && l->LookupType == HB_GSUB_LOOKUP_EXTENSION ) || evaluated: type == HB_Type_GSUB yes Evaluation Count:5065 | yes Evaluation Count:2040 |
partially evaluated: l->LookupType == 7 no Evaluation Count:0 | yes Evaluation Count:5065 |
| 0-5065 |
508 | ( type == HB_Type_GPOS && l->LookupType == HB_GPOS_LOOKUP_EXTENSION ) ) evaluated: type == HB_Type_GPOS yes Evaluation Count:2040 | yes Evaluation Count:5065 |
partially evaluated: l->LookupType == 9 no Evaluation Count:0 | yes Evaluation Count:2040 |
| 0-5065 |
509 | is_extension = TRUE; never executed: is_extension = (!0); | 0 |
510 | | - |
511 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:8847 | yes Evaluation Count:7105 |
| 7105-8847 |
512 | { | - |
513 | if ( ACCESS_Frame( 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:8847 |
| 0-8847 |
514 | goto Fail; never executed: goto Fail; | 0 |
515 | | - |
516 | new_offset = GET_UShort() + base_offset; executed (the execution status of this line is deduced): new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))) + base_offset; | - |
517 | | - |
518 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
519 | | - |
520 | cur_offset = FILE_Pos(); executed (the execution status of this line is deduced): cur_offset = _hb_stream_pos( stream ); | - |
521 | | - |
522 | if ( is_extension ) partially evaluated: is_extension no Evaluation Count:0 | yes Evaluation Count:8847 |
| 0-8847 |
523 | { | - |
524 | if ( FILE_Seek( new_offset ) || ACCESS_Frame( 8L ) ) never evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) never evaluated: ( (error = (_hb_stream_frame_enter( stream, 8L ))) != 0 ) | 0 |
525 | goto Fail; never executed: goto Fail; | 0 |
526 | | - |
527 | if (GET_UShort() != 1) /* format should be 1 */ never evaluated: ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))) != 1 | 0 |
528 | goto Fail; never executed: goto Fail; | 0 |
529 | | - |
530 | l->LookupType = GET_UShort(); never executed (the execution status of this line is deduced): l->LookupType = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
531 | new_offset += GET_ULong(); never executed (the execution status of this line is deduced): new_offset += ((HB_UInt)(stream->cursor += 4, (HB_Int)( (*(((HB_Byte*)stream->cursor)-4) << 24) | (*(((HB_Byte*)stream->cursor)-3) << 16) | (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
532 | | - |
533 | FORGET_Frame(); never executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
534 | } | 0 |
535 | | - |
536 | if ( FILE_Seek( new_offset ) || partially evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:8847 |
| 0-8847 |
537 | ( error = Load_SubTable( &st[n], stream, partially evaluated: ( error = Load_SubTable( &st[n], stream, type, l->LookupType ) ) != HB_Err_Ok no Evaluation Count:0 | yes Evaluation Count:8847 |
| 0-8847 |
538 | type, l->LookupType ) ) != HB_Err_Ok ) partially evaluated: ( error = Load_SubTable( &st[n], stream, type, l->LookupType ) ) != HB_Err_Ok no Evaluation Count:0 | yes Evaluation Count:8847 |
| 0-8847 |
539 | goto Fail; never executed: goto Fail; | 0 |
540 | (void)FILE_Seek( cur_offset ); executed (the execution status of this line is deduced): (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
541 | } executed: } Execution Count:8847 | 8847 |
542 | | - |
543 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:7105 | 7105 |
544 | | - |
545 | Fail: | - |
546 | for ( m = 0; m < n; m++ ) | 0 |
547 | Free_SubTable( &st[m], type, l->LookupType ); never executed: Free_SubTable( &st[m], type, l->LookupType ); | 0 |
548 | | - |
549 | FREE( l->SubTable ); never executed: } never executed: } never evaluated: (l->SubTable) never evaluated: 0 | 0 |
550 | return error; never executed: return error; | 0 |
551 | } | - |
552 | | - |
553 | | - |
554 | static void Free_Lookup( HB_Lookup* l, | - |
555 | HB_Type type) | - |
556 | { | - |
557 | HB_UShort n, count; executed (the execution status of this line is deduced): HB_UShort n, count; | - |
558 | | - |
559 | HB_SubTable* st; executed (the execution status of this line is deduced): HB_SubTable* st; | - |
560 | | - |
561 | | - |
562 | if ( l->SubTable ) partially evaluated: l->SubTable yes Evaluation Count:6754 | no Evaluation Count:0 |
| 0-6754 |
563 | { | - |
564 | count = l->SubTableCount; executed (the execution status of this line is deduced): count = l->SubTableCount; | - |
565 | st = l->SubTable; executed (the execution status of this line is deduced): st = l->SubTable; | - |
566 | | - |
567 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:8411 | yes Evaluation Count:6754 |
| 6754-8411 |
568 | Free_SubTable( &st[n], type, l->LookupType ); executed: Free_SubTable( &st[n], type, l->LookupType ); Execution Count:8411 | 8411 |
569 | | - |
570 | FREE( st ); executed: } Execution Count:6754 executed: } Execution Count:6754 partially evaluated: (st) yes Evaluation Count:6754 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:6754 |
| 0-6754 |
571 | } executed: } Execution Count:6754 | 6754 |
572 | } executed: } Execution Count:6754 | 6754 |
573 | | - |
574 | | - |
575 | /* LookupList */ | - |
576 | | - |
577 | HB_INTERNAL HB_Error | - |
578 | _HB_OPEN_Load_LookupList( HB_LookupList* ll, | - |
579 | HB_Stream stream, | - |
580 | HB_Type type ) | - |
581 | { | - |
582 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
583 | | - |
584 | HB_UShort n, m, count; executed (the execution status of this line is deduced): HB_UShort n, m, count; | - |
585 | HB_UInt cur_offset, new_offset, base_offset; executed (the execution status of this line is deduced): HB_UInt cur_offset, new_offset, base_offset; | - |
586 | | - |
587 | HB_Lookup* l; executed (the execution status of this line is deduced): HB_Lookup* l; | - |
588 | | - |
589 | | - |
590 | base_offset = FILE_Pos(); executed (the execution status of this line is deduced): base_offset = _hb_stream_pos( stream ); | - |
591 | | - |
592 | if ( ACCESS_Frame( 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:278 |
| 0-278 |
593 | return error; never executed: return error; | 0 |
594 | | - |
595 | count = ll->LookupCount = GET_UShort(); executed (the execution status of this line is deduced): count = ll->LookupCount = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
596 | | - |
597 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
598 | | - |
599 | ll->Lookup = NULL; executed (the execution status of this line is deduced): ll->Lookup = ((void *)0); | - |
600 | | - |
601 | if ( ALLOC_ARRAY( ll->Lookup, count, HB_Lookup ) ) partially evaluated: ( (ll->Lookup) = _hb_alloc( (count)*sizeof(HB_Lookup), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:278 |
| 0-278 |
602 | return error; never executed: return error; | 0 |
603 | if ( ALLOC_ARRAY( ll->Properties, count, HB_UInt ) ) partially evaluated: ( (ll->Properties) = _hb_alloc( (count)*sizeof(HB_UInt), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:278 |
| 0-278 |
604 | goto Fail2; never executed: goto Fail2; | 0 |
605 | | - |
606 | l = ll->Lookup; executed (the execution status of this line is deduced): l = ll->Lookup; | - |
607 | | - |
608 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:7105 | yes Evaluation Count:278 |
| 278-7105 |
609 | { | - |
610 | if ( ACCESS_Frame( 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:7105 |
| 0-7105 |
611 | goto Fail1; never executed: goto Fail1; | 0 |
612 | | - |
613 | new_offset = GET_UShort() + base_offset; executed (the execution status of this line is deduced): new_offset = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))) + base_offset; | - |
614 | | - |
615 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
616 | | - |
617 | cur_offset = FILE_Pos(); executed (the execution status of this line is deduced): cur_offset = _hb_stream_pos( stream ); | - |
618 | if ( FILE_Seek( new_offset ) || partially evaluated: ( (error = (_hb_stream_seek( stream, new_offset ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:7105 |
| 0-7105 |
619 | ( error = Load_Lookup( &l[n], stream, type ) ) != HB_Err_Ok ) partially evaluated: ( error = Load_Lookup( &l[n], stream, type ) ) != HB_Err_Ok no Evaluation Count:0 | yes Evaluation Count:7105 |
| 0-7105 |
620 | goto Fail1; never executed: goto Fail1; | 0 |
621 | (void)FILE_Seek( cur_offset ); executed (the execution status of this line is deduced): (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); | - |
622 | } executed: } Execution Count:7105 | 7105 |
623 | | - |
624 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:278 | 278 |
625 | | - |
626 | Fail1: | - |
627 | FREE( ll->Properties ); never executed: } never executed: } never evaluated: (ll->Properties) never evaluated: 0 | 0 |
628 | | - |
629 | for ( m = 0; m < n; m++ ) | 0 |
630 | Free_Lookup( &l[m], type ); never executed: Free_Lookup( &l[m], type ); | 0 |
631 | | - |
632 | Fail2: code before this statement never executed: Fail2: | 0 |
633 | FREE( ll->Lookup ); never executed: } never executed: } never evaluated: (ll->Lookup) never evaluated: 0 | 0 |
634 | return error; never executed: return error; | 0 |
635 | } | - |
636 | | - |
637 | | - |
638 | HB_INTERNAL void | - |
639 | _HB_OPEN_Free_LookupList( HB_LookupList* ll, | - |
640 | HB_Type type ) | - |
641 | { | - |
642 | HB_UShort n, count; executed (the execution status of this line is deduced): HB_UShort n, count; | - |
643 | | - |
644 | HB_Lookup* l; executed (the execution status of this line is deduced): HB_Lookup* l; | - |
645 | | - |
646 | | - |
647 | FREE( ll->Properties ); executed: } Execution Count:264 executed: } Execution Count:264 partially evaluated: (ll->Properties) yes Evaluation Count:264 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:264 |
| 0-264 |
648 | | - |
649 | if ( ll->Lookup ) partially evaluated: ll->Lookup yes Evaluation Count:264 | no Evaluation Count:0 |
| 0-264 |
650 | { | - |
651 | count = ll->LookupCount; executed (the execution status of this line is deduced): count = ll->LookupCount; | - |
652 | l = ll->Lookup; executed (the execution status of this line is deduced): l = ll->Lookup; | - |
653 | | - |
654 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:6754 | yes Evaluation Count:264 |
| 264-6754 |
655 | Free_Lookup( &l[n], type ); executed: Free_Lookup( &l[n], type ); Execution Count:6754 | 6754 |
656 | | - |
657 | FREE( l ); executed: } Execution Count:264 executed: } Execution Count:264 partially evaluated: (l) yes Evaluation Count:264 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:264 |
| 0-264 |
658 | } executed: } Execution Count:264 | 264 |
659 | } executed: } Execution Count:264 | 264 |
660 | | - |
661 | | - |
662 | | - |
663 | /***************************** | - |
664 | * Coverage related functions | - |
665 | *****************************/ | - |
666 | | - |
667 | | - |
668 | /* CoverageFormat1 */ | - |
669 | | - |
670 | static HB_Error Load_Coverage1( HB_CoverageFormat1* cf1, | - |
671 | HB_Stream stream ) | - |
672 | { | - |
673 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
674 | | - |
675 | HB_UShort n, count; executed (the execution status of this line is deduced): HB_UShort n, count; | - |
676 | | - |
677 | HB_UShort* ga; executed (the execution status of this line is deduced): HB_UShort* ga; | - |
678 | | - |
679 | | - |
680 | if ( ACCESS_Frame( 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:6640 |
| 0-6640 |
681 | return error; never executed: return error; | 0 |
682 | | - |
683 | count = cf1->GlyphCount = GET_UShort(); executed (the execution status of this line is deduced): count = cf1->GlyphCount = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
684 | | - |
685 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
686 | | - |
687 | cf1->GlyphArray = NULL; executed (the execution status of this line is deduced): cf1->GlyphArray = ((void *)0); | - |
688 | | - |
689 | if ( ALLOC_ARRAY( cf1->GlyphArray, count, HB_UShort ) ) partially evaluated: ( (cf1->GlyphArray) = _hb_alloc( (count)*sizeof(HB_UShort), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:6640 |
| 0-6640 |
690 | return error; never executed: return error; | 0 |
691 | | - |
692 | ga = cf1->GlyphArray; executed (the execution status of this line is deduced): ga = cf1->GlyphArray; | - |
693 | | - |
694 | if ( ACCESS_Frame( count * 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, count * 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:6640 |
| 0-6640 |
695 | { | - |
696 | FREE( cf1->GlyphArray ); never executed: } never executed: } never evaluated: (cf1->GlyphArray) never evaluated: 0 | 0 |
697 | return error; never executed: return error; | 0 |
698 | } | - |
699 | | - |
700 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:62575 | yes Evaluation Count:6640 |
| 6640-62575 |
701 | ga[n] = GET_UShort(); executed: ga[n] = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); Execution Count:62575 | 62575 |
702 | | - |
703 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
704 | | - |
705 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:6640 | 6640 |
706 | } | - |
707 | | - |
708 | | - |
709 | static void Free_Coverage1( HB_CoverageFormat1* cf1) | - |
710 | { | - |
711 | FREE( cf1->GlyphArray ); executed: } Execution Count:6308 executed: } Execution Count:6311 evaluated: (cf1->GlyphArray) yes Evaluation Count:6308 | yes Evaluation Count:3 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:6311 |
| 0-6311 |
712 | } executed: } Execution Count:6311 | 6311 |
713 | | - |
714 | | - |
715 | /* CoverageFormat2 */ | - |
716 | | - |
717 | static HB_Error Load_Coverage2( HB_CoverageFormat2* cf2, | - |
718 | HB_Stream stream ) | - |
719 | { | - |
720 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
721 | | - |
722 | HB_UShort n, count; executed (the execution status of this line is deduced): HB_UShort n, count; | - |
723 | | - |
724 | HB_RangeRecord* rr; executed (the execution status of this line is deduced): HB_RangeRecord* rr; | - |
725 | | - |
726 | | - |
727 | if ( ACCESS_Frame( 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:4737 |
| 0-4737 |
728 | return error; never executed: return error; | 0 |
729 | | - |
730 | count = cf2->RangeCount = GET_UShort(); executed (the execution status of this line is deduced): count = cf2->RangeCount = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
731 | | - |
732 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
733 | | - |
734 | cf2->RangeRecord = NULL; executed (the execution status of this line is deduced): cf2->RangeRecord = ((void *)0); | - |
735 | | - |
736 | if ( ALLOC_ARRAY( cf2->RangeRecord, count, HB_RangeRecord ) ) partially evaluated: ( (cf2->RangeRecord) = _hb_alloc( (count)*sizeof(HB_RangeRecord), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:4737 |
| 0-4737 |
737 | return error; never executed: return error; | 0 |
738 | | - |
739 | rr = cf2->RangeRecord; executed (the execution status of this line is deduced): rr = cf2->RangeRecord; | - |
740 | | - |
741 | if ( ACCESS_Frame( count * 6L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, count * 6L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:4737 |
| 0-4737 |
742 | goto Fail; never executed: goto Fail; | 0 |
743 | | - |
744 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:48021 | yes Evaluation Count:4737 |
| 4737-48021 |
745 | { | - |
746 | rr[n].Start = GET_UShort(); executed (the execution status of this line is deduced): rr[n].Start = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
747 | rr[n].End = GET_UShort(); executed (the execution status of this line is deduced): rr[n].End = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
748 | rr[n].StartCoverageIndex = GET_UShort(); executed (the execution status of this line is deduced): rr[n].StartCoverageIndex = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
749 | | - |
750 | /* sanity check; we are limited to 16bit integers */ | - |
751 | if ( rr[n].Start > rr[n].End || partially evaluated: rr[n].Start > rr[n].End no Evaluation Count:0 | yes Evaluation Count:48021 |
| 0-48021 |
752 | ( rr[n].End - rr[n].Start + (long)rr[n].StartCoverageIndex ) >= partially evaluated: ( rr[n].End - rr[n].Start + (long)rr[n].StartCoverageIndex ) >= 0x10000L no Evaluation Count:0 | yes Evaluation Count:48021 |
| 0-48021 |
753 | 0x10000L ) partially evaluated: ( rr[n].End - rr[n].Start + (long)rr[n].StartCoverageIndex ) >= 0x10000L no Evaluation Count:0 | yes Evaluation Count:48021 |
| 0-48021 |
754 | { | - |
755 | error = ERR(HB_Err_Invalid_SubTable); never executed (the execution status of this line is deduced): error = _hb_err (HB_Err_Invalid_SubTable); | - |
756 | goto Fail; never executed: goto Fail; | 0 |
757 | } | - |
758 | } executed: } Execution Count:48021 | 48021 |
759 | | - |
760 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
761 | | - |
762 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:4737 | 4737 |
763 | | - |
764 | Fail: | - |
765 | FREE( cf2->RangeRecord ); never executed: } never executed: } never evaluated: (cf2->RangeRecord) never evaluated: 0 | 0 |
766 | return error; never executed: return error; | 0 |
767 | } | - |
768 | | - |
769 | | - |
770 | static void Free_Coverage2( HB_CoverageFormat2* cf2 ) | - |
771 | { | - |
772 | FREE( cf2->RangeRecord ); executed: } Execution Count:4376 executed: } Execution Count:4500 evaluated: (cf2->RangeRecord) yes Evaluation Count:4376 | yes Evaluation Count:124 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:4500 |
| 0-4500 |
773 | } executed: } Execution Count:4500 | 4500 |
774 | | - |
775 | | - |
776 | HB_INTERNAL HB_Error | - |
777 | _HB_OPEN_Load_Coverage( HB_Coverage* c, | - |
778 | HB_Stream stream ) | - |
779 | { | - |
780 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
781 | | - |
782 | if ( ACCESS_Frame( 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:11377 |
| 0-11377 |
783 | return error; never executed: return error; | 0 |
784 | | - |
785 | c->CoverageFormat = GET_UShort(); executed (the execution status of this line is deduced): c->CoverageFormat = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
786 | | - |
787 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
788 | | - |
789 | switch ( c->CoverageFormat ) | - |
790 | { | - |
791 | case 1: return Load_Coverage1( &c->cf.cf1, stream ); executed: return Load_Coverage1( &c->cf.cf1, stream ); Execution Count:6640 | 6640 |
792 | case 2: return Load_Coverage2( &c->cf.cf2, stream ); executed: return Load_Coverage2( &c->cf.cf2, stream ); Execution Count:4737 | 4737 |
793 | default: return ERR(HB_Err_Invalid_SubTable_Format); never executed: return _hb_err (HB_Err_Invalid_SubTable_Format); | 0 |
794 | } | - |
795 | | - |
796 | return HB_Err_Ok; /* never reached */ never executed: return HB_Err_Ok; | 0 |
797 | } | - |
798 | | - |
799 | | - |
800 | HB_INTERNAL void | - |
801 | _HB_OPEN_Free_Coverage( HB_Coverage* c ) | - |
802 | { | - |
803 | switch ( c->CoverageFormat ) | - |
804 | { | - |
805 | case 1: Free_Coverage1( &c->cf.cf1 ); break; executed: break; Execution Count:6311 | 6311 |
806 | case 2: Free_Coverage2( &c->cf.cf2 ); break; executed: break; Execution Count:4500 | 4500 |
807 | default: break; | 0 |
808 | } | - |
809 | } executed: } Execution Count:10811 | 10811 |
810 | | - |
811 | | - |
812 | static HB_Error Coverage_Index1( HB_CoverageFormat1* cf1, | - |
813 | HB_UShort glyphID, | - |
814 | HB_UShort* index ) | - |
815 | { | - |
816 | HB_UShort min, max, new_min, new_max, middle; executed (the execution status of this line is deduced): HB_UShort min, max, new_min, new_max, middle; | - |
817 | | - |
818 | HB_UShort* array = cf1->GlyphArray; executed (the execution status of this line is deduced): HB_UShort* array = cf1->GlyphArray; | - |
819 | | - |
820 | | - |
821 | /* binary search */ | - |
822 | | - |
823 | if ( cf1->GlyphCount == 0 ) partially evaluated: cf1->GlyphCount == 0 no Evaluation Count:0 | yes Evaluation Count:35026299 |
| 0-35026299 |
824 | return HB_Err_Not_Covered; never executed: return HB_Err_Not_Covered; | 0 |
825 | | - |
826 | new_min = 0; executed (the execution status of this line is deduced): new_min = 0; | - |
827 | new_max = cf1->GlyphCount - 1; executed (the execution status of this line is deduced): new_max = cf1->GlyphCount - 1; | - |
828 | | - |
829 | do | - |
830 | { | - |
831 | min = new_min; executed (the execution status of this line is deduced): min = new_min; | - |
832 | max = new_max; executed (the execution status of this line is deduced): max = new_max; | - |
833 | | - |
834 | /* we use (min + max) / 2 = max - (max - min) / 2 to avoid | - |
835 | overflow and rounding errors */ | - |
836 | | - |
837 | middle = max - ( ( max - min ) >> 1 ); executed (the execution status of this line is deduced): middle = max - ( ( max - min ) >> 1 ); | - |
838 | | - |
839 | if ( glyphID == array[middle] ) evaluated: glyphID == array[middle] yes Evaluation Count:756770 | yes Evaluation Count:73958283 |
| 756770-73958283 |
840 | { | - |
841 | *index = middle; executed (the execution status of this line is deduced): *index = middle; | - |
842 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:756770 | 756770 |
843 | } | - |
844 | else if ( glyphID < array[middle] ) evaluated: glyphID < array[middle] yes Evaluation Count:62609951 | yes Evaluation Count:11348332 |
| 11348332-62609951 |
845 | { | - |
846 | if ( middle == min ) evaluated: middle == min yes Evaluation Count:28836044 | yes Evaluation Count:33773907 |
| 28836044-33773907 |
847 | break; executed: break; Execution Count:28836044 | 28836044 |
848 | new_max = middle - 1; executed (the execution status of this line is deduced): new_max = middle - 1; | - |
849 | } executed: } Execution Count:33773907 | 33773907 |
850 | else | - |
851 | { | - |
852 | if ( middle == max ) evaluated: middle == max yes Evaluation Count:5433485 | yes Evaluation Count:5914847 |
| 5433485-5914847 |
853 | break; executed: break; Execution Count:5433485 | 5433485 |
854 | new_min = middle + 1; executed (the execution status of this line is deduced): new_min = middle + 1; | - |
855 | } executed: } Execution Count:5914847 | 5914847 |
856 | } while ( min < max ); partially evaluated: min < max yes Evaluation Count:39688754 | no Evaluation Count:0 |
| 0-39688754 |
857 | | - |
858 | return HB_Err_Not_Covered; executed: return HB_Err_Not_Covered; Execution Count:34269529 | 34269529 |
859 | } | - |
860 | | - |
861 | | - |
862 | static HB_Error Coverage_Index2( HB_CoverageFormat2* cf2, | - |
863 | HB_UShort glyphID, | - |
864 | HB_UShort* index ) | - |
865 | { | - |
866 | HB_UShort min, max, new_min, new_max, middle; executed (the execution status of this line is deduced): HB_UShort min, max, new_min, new_max, middle; | - |
867 | | - |
868 | HB_RangeRecord* rr = cf2->RangeRecord; executed (the execution status of this line is deduced): HB_RangeRecord* rr = cf2->RangeRecord; | - |
869 | | - |
870 | | - |
871 | /* binary search */ | - |
872 | | - |
873 | if ( cf2->RangeCount == 0 ) partially evaluated: cf2->RangeCount == 0 no Evaluation Count:0 | yes Evaluation Count:32276673 |
| 0-32276673 |
874 | return HB_Err_Not_Covered; never executed: return HB_Err_Not_Covered; | 0 |
875 | | - |
876 | new_min = 0; executed (the execution status of this line is deduced): new_min = 0; | - |
877 | new_max = cf2->RangeCount - 1; executed (the execution status of this line is deduced): new_max = cf2->RangeCount - 1; | - |
878 | | - |
879 | do | - |
880 | { | - |
881 | min = new_min; executed (the execution status of this line is deduced): min = new_min; | - |
882 | max = new_max; executed (the execution status of this line is deduced): max = new_max; | - |
883 | | - |
884 | /* we use (min + max) / 2 = max - (max - min) / 2 to avoid | - |
885 | overflow and rounding errors */ | - |
886 | | - |
887 | middle = max - ( ( max - min ) >> 1 ); executed (the execution status of this line is deduced): middle = max - ( ( max - min ) >> 1 ); | - |
888 | | - |
889 | if ( glyphID >= rr[middle].Start && glyphID <= rr[middle].End ) evaluated: glyphID >= rr[middle].Start yes Evaluation Count:1081371 | yes Evaluation Count:80400604 |
evaluated: glyphID <= rr[middle].End yes Evaluation Count:2902 | yes Evaluation Count:1078469 |
| 2902-80400604 |
890 | { | - |
891 | *index = rr[middle].StartCoverageIndex + glyphID - rr[middle].Start; executed (the execution status of this line is deduced): *index = rr[middle].StartCoverageIndex + glyphID - rr[middle].Start; | - |
892 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:2902 | 2902 |
893 | } | - |
894 | else if ( glyphID < rr[middle].Start ) evaluated: glyphID < rr[middle].Start yes Evaluation Count:80400604 | yes Evaluation Count:1078469 |
| 1078469-80400604 |
895 | { | - |
896 | if ( middle == min ) evaluated: middle == min yes Evaluation Count:31636370 | yes Evaluation Count:48764234 |
| 31636370-48764234 |
897 | break; executed: break; Execution Count:31636370 | 31636370 |
898 | new_max = middle - 1; executed (the execution status of this line is deduced): new_max = middle - 1; | - |
899 | } executed: } Execution Count:48764234 | 48764234 |
900 | else | - |
901 | { | - |
902 | if ( middle == max ) evaluated: middle == max yes Evaluation Count:637401 | yes Evaluation Count:441068 |
| 441068-637401 |
903 | break; executed: break; Execution Count:637401 | 637401 |
904 | new_min = middle + 1; executed (the execution status of this line is deduced): new_min = middle + 1; | - |
905 | } executed: } Execution Count:441068 | 441068 |
906 | } while ( min < max ); partially evaluated: min < max yes Evaluation Count:49205302 | no Evaluation Count:0 |
| 0-49205302 |
907 | | - |
908 | return HB_Err_Not_Covered; executed: return HB_Err_Not_Covered; Execution Count:32273771 | 32273771 |
909 | } | - |
910 | | - |
911 | | - |
912 | HB_INTERNAL HB_Error | - |
913 | _HB_OPEN_Coverage_Index( HB_Coverage* c, | - |
914 | HB_UShort glyphID, | - |
915 | HB_UShort* index ) | - |
916 | { | - |
917 | switch ( c->CoverageFormat ) | - |
918 | { | - |
919 | case 1: return Coverage_Index1( &c->cf.cf1, glyphID, index ); executed: return Coverage_Index1( &c->cf.cf1, glyphID, index ); Execution Count:35026299 | 35026299 |
920 | case 2: return Coverage_Index2( &c->cf.cf2, glyphID, index ); executed: return Coverage_Index2( &c->cf.cf2, glyphID, index ); Execution Count:32276673 | 32276673 |
921 | default: return ERR(HB_Err_Invalid_SubTable_Format); never executed: return _hb_err (HB_Err_Invalid_SubTable_Format); | 0 |
922 | } | - |
923 | | - |
924 | return HB_Err_Ok; /* never reached */ never executed: return HB_Err_Ok; | 0 |
925 | } | - |
926 | | - |
927 | | - |
928 | | - |
929 | /************************************* | - |
930 | * Class Definition related functions | - |
931 | *************************************/ | - |
932 | | - |
933 | | - |
934 | /* ClassDefFormat1 */ | - |
935 | | - |
936 | static HB_Error Load_ClassDef1( HB_ClassDefinition* cd, | - |
937 | HB_UShort limit, | - |
938 | HB_Stream stream ) | - |
939 | { | - |
940 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
941 | | - |
942 | HB_UShort n, count; executed (the execution status of this line is deduced): HB_UShort n, count; | - |
943 | | - |
944 | HB_UShort* cva; executed (the execution status of this line is deduced): HB_UShort* cva; | - |
945 | | - |
946 | HB_ClassDefFormat1* cdf1; executed (the execution status of this line is deduced): HB_ClassDefFormat1* cdf1; | - |
947 | | - |
948 | | - |
949 | cdf1 = &cd->cd.cd1; executed (the execution status of this line is deduced): cdf1 = &cd->cd.cd1; | - |
950 | | - |
951 | if ( ACCESS_Frame( 4L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 4L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:2343 |
| 0-2343 |
952 | return error; never executed: return error; | 0 |
953 | | - |
954 | cdf1->StartGlyph = GET_UShort(); executed (the execution status of this line is deduced): cdf1->StartGlyph = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
955 | count = cdf1->GlyphCount = GET_UShort(); executed (the execution status of this line is deduced): count = cdf1->GlyphCount = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
956 | | - |
957 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
958 | | - |
959 | /* sanity check; we are limited to 16bit integers */ | - |
960 | | - |
961 | if ( cdf1->StartGlyph + (long)count >= 0x10000L ) partially evaluated: cdf1->StartGlyph + (long)count >= 0x10000L no Evaluation Count:0 | yes Evaluation Count:2343 |
| 0-2343 |
962 | return ERR(HB_Err_Invalid_SubTable); never executed: return _hb_err (HB_Err_Invalid_SubTable); | 0 |
963 | | - |
964 | cdf1->ClassValueArray = NULL; executed (the execution status of this line is deduced): cdf1->ClassValueArray = ((void *)0); | - |
965 | | - |
966 | if ( ALLOC_ARRAY( cdf1->ClassValueArray, count, HB_UShort ) ) partially evaluated: ( (cdf1->ClassValueArray) = _hb_alloc( (count)*sizeof(HB_UShort), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:2343 |
| 0-2343 |
967 | return error; never executed: return error; | 0 |
968 | | - |
969 | cva = cdf1->ClassValueArray; executed (the execution status of this line is deduced): cva = cdf1->ClassValueArray; | - |
970 | | - |
971 | if ( ACCESS_Frame( count * 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, count * 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:2343 |
| 0-2343 |
972 | goto Fail; never executed: goto Fail; | 0 |
973 | | - |
974 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:8663 | yes Evaluation Count:2343 |
| 2343-8663 |
975 | { | - |
976 | cva[n] = GET_UShort(); executed (the execution status of this line is deduced): cva[n] = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
977 | if ( cva[n] >= limit ) partially evaluated: cva[n] >= limit no Evaluation Count:0 | yes Evaluation Count:8663 |
| 0-8663 |
978 | { | - |
979 | error = ERR(HB_Err_Invalid_SubTable); never executed (the execution status of this line is deduced): error = _hb_err (HB_Err_Invalid_SubTable); | - |
980 | goto Fail; never executed: goto Fail; | 0 |
981 | } | - |
982 | } executed: } Execution Count:8663 | 8663 |
983 | | - |
984 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
985 | | - |
986 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:2343 | 2343 |
987 | | - |
988 | Fail: | - |
989 | FREE( cva ); never executed: } never executed: } never evaluated: (cva) never evaluated: 0 | 0 |
990 | | - |
991 | return error; never executed: return error; | 0 |
992 | } | - |
993 | | - |
994 | | - |
995 | static void Free_ClassDef1( HB_ClassDefFormat1* cdf1 ) | - |
996 | { | - |
997 | FREE( cdf1->ClassValueArray ); executed: } Execution Count:2228 executed: } Execution Count:2228 partially evaluated: (cdf1->ClassValueArray) yes Evaluation Count:2228 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:2228 |
| 0-2228 |
998 | } executed: } Execution Count:2228 | 2228 |
999 | | - |
1000 | | - |
1001 | /* ClassDefFormat2 */ | - |
1002 | | - |
1003 | static HB_Error Load_ClassDef2( HB_ClassDefinition* cd, | - |
1004 | HB_UShort limit, | - |
1005 | HB_Stream stream ) | - |
1006 | { | - |
1007 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
1008 | | - |
1009 | HB_UShort n, count; executed (the execution status of this line is deduced): HB_UShort n, count; | - |
1010 | | - |
1011 | HB_ClassRangeRecord* crr; executed (the execution status of this line is deduced): HB_ClassRangeRecord* crr; | - |
1012 | | - |
1013 | HB_ClassDefFormat2* cdf2; executed (the execution status of this line is deduced): HB_ClassDefFormat2* cdf2; | - |
1014 | | - |
1015 | | - |
1016 | cdf2 = &cd->cd.cd2; executed (the execution status of this line is deduced): cdf2 = &cd->cd.cd2; | - |
1017 | | - |
1018 | if ( ACCESS_Frame( 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:2764 |
| 0-2764 |
1019 | return error; never executed: return error; | 0 |
1020 | | - |
1021 | count = GET_UShort(); executed (the execution status of this line is deduced): count = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
1022 | cdf2->ClassRangeCount = 0; /* zero for now. we fill with the number of good entries later */ executed (the execution status of this line is deduced): cdf2->ClassRangeCount = 0; | - |
1023 | | - |
1024 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
1025 | | - |
1026 | cdf2->ClassRangeRecord = NULL; executed (the execution status of this line is deduced): cdf2->ClassRangeRecord = ((void *)0); | - |
1027 | | - |
1028 | if ( ALLOC_ARRAY( cdf2->ClassRangeRecord, count, HB_ClassRangeRecord ) ) partially evaluated: ( (cdf2->ClassRangeRecord) = _hb_alloc( (count)*sizeof(HB_ClassRangeRecord), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:2764 |
| 0-2764 |
1029 | return error; never executed: return error; | 0 |
1030 | | - |
1031 | crr = cdf2->ClassRangeRecord; executed (the execution status of this line is deduced): crr = cdf2->ClassRangeRecord; | - |
1032 | | - |
1033 | if ( ACCESS_Frame( count * 6L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, count * 6L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:2764 |
| 0-2764 |
1034 | goto Fail; never executed: goto Fail; | 0 |
1035 | | - |
1036 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:87139 | yes Evaluation Count:2764 |
| 2764-87139 |
1037 | { | - |
1038 | crr[n].Start = GET_UShort(); executed (the execution status of this line is deduced): crr[n].Start = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
1039 | crr[n].End = GET_UShort(); executed (the execution status of this line is deduced): crr[n].End = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
1040 | crr[n].Class = GET_UShort(); executed (the execution status of this line is deduced): crr[n].Class = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
1041 | | - |
1042 | /* sanity check */ | - |
1043 | | - |
1044 | if ( crr[n].Start > crr[n].End || partially evaluated: crr[n].Start > crr[n].End no Evaluation Count:0 | yes Evaluation Count:87139 |
| 0-87139 |
1045 | crr[n].Class >= limit ) partially evaluated: crr[n].Class >= limit no Evaluation Count:0 | yes Evaluation Count:87139 |
| 0-87139 |
1046 | { | - |
1047 | /* XXX | - |
1048 | * Corrupt entry. Skip it. | - |
1049 | * This is hit by Nafees Nastaliq font for example | - |
1050 | */ | - |
1051 | n--; never executed (the execution status of this line is deduced): n--; | - |
1052 | count--; never executed (the execution status of this line is deduced): count--; | - |
1053 | } | 0 |
1054 | } executed: } Execution Count:87139 | 87139 |
1055 | | - |
1056 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
1057 | | - |
1058 | cdf2->ClassRangeCount = count; executed (the execution status of this line is deduced): cdf2->ClassRangeCount = count; | - |
1059 | | - |
1060 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:2764 | 2764 |
1061 | | - |
1062 | Fail: | - |
1063 | FREE( crr ); never executed: } never executed: } never evaluated: (crr) never evaluated: 0 | 0 |
1064 | | - |
1065 | return error; never executed: return error; | 0 |
1066 | } | - |
1067 | | - |
1068 | | - |
1069 | static void Free_ClassDef2( HB_ClassDefFormat2* cdf2 ) | - |
1070 | { | - |
1071 | FREE( cdf2->ClassRangeRecord ); executed: } Execution Count:2629 executed: } Execution Count:2629 partially evaluated: (cdf2->ClassRangeRecord) yes Evaluation Count:2629 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:2629 |
| 0-2629 |
1072 | } executed: } Execution Count:2629 | 2629 |
1073 | | - |
1074 | | - |
1075 | /* ClassDefinition */ | - |
1076 | | - |
1077 | HB_INTERNAL HB_Error | - |
1078 | _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd, | - |
1079 | HB_UShort limit, | - |
1080 | HB_Stream stream ) | - |
1081 | { | - |
1082 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
1083 | | - |
1084 | if ( ACCESS_Frame( 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:5107 |
| 0-5107 |
1085 | return error; never executed: return error; | 0 |
1086 | | - |
1087 | cd->ClassFormat = GET_UShort(); executed (the execution status of this line is deduced): cd->ClassFormat = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
1088 | | - |
1089 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
1090 | | - |
1091 | switch ( cd->ClassFormat ) | - |
1092 | { | - |
1093 | case 1: error = Load_ClassDef1( cd, limit, stream ); break; executed: break; Execution Count:2343 | 2343 |
1094 | case 2: error = Load_ClassDef2( cd, limit, stream ); break; executed: break; Execution Count:2764 | 2764 |
1095 | default: error = ERR(HB_Err_Invalid_SubTable_Format); break; | 0 |
1096 | } | - |
1097 | | - |
1098 | if ( error ) partially evaluated: error no Evaluation Count:0 | yes Evaluation Count:5107 |
| 0-5107 |
1099 | return error; never executed: return error; | 0 |
1100 | | - |
1101 | cd->loaded = TRUE; executed (the execution status of this line is deduced): cd->loaded = (!0); | - |
1102 | | - |
1103 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:5107 | 5107 |
1104 | } | - |
1105 | | - |
1106 | | - |
1107 | static HB_Error | - |
1108 | _HB_OPEN_Load_EmptyClassDefinition( HB_ClassDefinition* cd ) | - |
1109 | { | - |
1110 | HB_Error error; never executed (the execution status of this line is deduced): HB_Error error; | - |
1111 | | - |
1112 | cd->ClassFormat = 1; /* Meaningless */ never executed (the execution status of this line is deduced): cd->ClassFormat = 1; | - |
1113 | | - |
1114 | if ( ALLOC_ARRAY( cd->cd.cd1.ClassValueArray, 1, HB_UShort ) ) never evaluated: ( (cd->cd.cd1.ClassValueArray) = _hb_alloc( (1)*sizeof(HB_UShort), &error ), error != 0 ) | 0 |
1115 | return error; never executed: return error; | 0 |
1116 | | - |
1117 | cd->loaded = TRUE; never executed (the execution status of this line is deduced): cd->loaded = (!0); | - |
1118 | | - |
1119 | return HB_Err_Ok; never executed: return HB_Err_Ok; | 0 |
1120 | } | - |
1121 | | - |
1122 | HB_INTERNAL HB_Error | - |
1123 | _HB_OPEN_Load_EmptyOrClassDefinition( HB_ClassDefinition* cd, | - |
1124 | HB_UShort limit, | - |
1125 | HB_UInt class_offset, | - |
1126 | HB_UInt base_offset, | - |
1127 | HB_Stream stream ) | - |
1128 | { | - |
1129 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
1130 | HB_UInt cur_offset; executed (the execution status of this line is deduced): HB_UInt cur_offset; | - |
1131 | | - |
1132 | cur_offset = FILE_Pos(); executed (the execution status of this line is deduced): cur_offset = _hb_stream_pos( stream ); | - |
1133 | | - |
1134 | if ( class_offset ) partially evaluated: class_offset yes Evaluation Count:4425 | no Evaluation Count:0 |
| 0-4425 |
1135 | { | - |
1136 | if ( !FILE_Seek( class_offset + base_offset ) ) partially evaluated: !( (error = (_hb_stream_seek( stream, class_offset + base_offset ))) != 0 ) yes Evaluation Count:4425 | no Evaluation Count:0 |
| 0-4425 |
1137 | error = _HB_OPEN_Load_ClassDefinition( cd, limit, stream ); executed: error = _HB_OPEN_Load_ClassDefinition( cd, limit, stream ); Execution Count:4425 | 4425 |
1138 | } executed: } Execution Count:4425 | 4425 |
1139 | else | - |
1140 | error = _HB_OPEN_Load_EmptyClassDefinition ( cd ); never executed: error = _HB_OPEN_Load_EmptyClassDefinition ( cd ); | 0 |
1141 | | - |
1142 | if (error == HB_Err_Ok) partially evaluated: error == HB_Err_Ok yes Evaluation Count:4425 | no Evaluation Count:0 |
| 0-4425 |
1143 | (void)FILE_Seek( cur_offset ); /* Changes error as a side-effect */ executed: (void)( (error = (_hb_stream_seek( stream, cur_offset ))) != 0 ); Execution Count:4425 | 4425 |
1144 | | - |
1145 | return error; executed: return error; Execution Count:4425 | 4425 |
1146 | } | - |
1147 | | - |
1148 | HB_INTERNAL void | - |
1149 | _HB_OPEN_Free_ClassDefinition( HB_ClassDefinition* cd ) | - |
1150 | { | - |
1151 | if ( !cd->loaded ) evaluated: !cd->loaded yes Evaluation Count:129 | yes Evaluation Count:4857 |
| 129-4857 |
1152 | return; executed: return; Execution Count:129 | 129 |
1153 | | - |
1154 | switch ( cd->ClassFormat ) | - |
1155 | { | - |
1156 | case 1: Free_ClassDef1( &cd->cd.cd1 ); break; executed: break; Execution Count:2228 | 2228 |
1157 | case 2: Free_ClassDef2( &cd->cd.cd2 ); break; executed: break; Execution Count:2629 | 2629 |
1158 | default: break; | 0 |
1159 | } | - |
1160 | } executed: } Execution Count:4857 | 4857 |
1161 | | - |
1162 | | - |
1163 | static HB_Error Get_Class1( HB_ClassDefFormat1* cdf1, | - |
1164 | HB_UShort glyphID, | - |
1165 | HB_UShort* klass, | - |
1166 | HB_UShort* index ) | - |
1167 | { | - |
1168 | HB_UShort* cva = cdf1->ClassValueArray; never executed (the execution status of this line is deduced): HB_UShort* cva = cdf1->ClassValueArray; | - |
1169 | | - |
1170 | | - |
1171 | if ( index ) | 0 |
1172 | *index = 0; never executed: *index = 0; | 0 |
1173 | | - |
1174 | if ( glyphID >= cdf1->StartGlyph && never evaluated: glyphID >= cdf1->StartGlyph | 0 |
1175 | glyphID < cdf1->StartGlyph + cdf1->GlyphCount ) never evaluated: glyphID < cdf1->StartGlyph + cdf1->GlyphCount | 0 |
1176 | { | - |
1177 | *klass = cva[glyphID - cdf1->StartGlyph]; never executed (the execution status of this line is deduced): *klass = cva[glyphID - cdf1->StartGlyph]; | - |
1178 | return HB_Err_Ok; never executed: return HB_Err_Ok; | 0 |
1179 | } | - |
1180 | else | - |
1181 | { | - |
1182 | *klass = 0; never executed (the execution status of this line is deduced): *klass = 0; | - |
1183 | return HB_Err_Not_Covered; never executed: return HB_Err_Not_Covered; | 0 |
1184 | } | - |
1185 | } | - |
1186 | | - |
1187 | | - |
1188 | /* we need the index value of the last searched class range record | - |
1189 | in case of failure for constructed GDEF tables */ | - |
1190 | | - |
1191 | static HB_Error Get_Class2( HB_ClassDefFormat2* cdf2, | - |
1192 | HB_UShort glyphID, | - |
1193 | HB_UShort* klass, | - |
1194 | HB_UShort* index ) | - |
1195 | { | - |
1196 | HB_Error error = HB_Err_Ok; executed (the execution status of this line is deduced): HB_Error error = HB_Err_Ok; | - |
1197 | HB_UShort min, max, new_min, new_max, middle; executed (the execution status of this line is deduced): HB_UShort min, max, new_min, new_max, middle; | - |
1198 | | - |
1199 | HB_ClassRangeRecord* crr = cdf2->ClassRangeRecord; executed (the execution status of this line is deduced): HB_ClassRangeRecord* crr = cdf2->ClassRangeRecord; | - |
1200 | | - |
1201 | | - |
1202 | /* binary search */ | - |
1203 | | - |
1204 | if ( cdf2->ClassRangeCount == 0 ) partially evaluated: cdf2->ClassRangeCount == 0 no Evaluation Count:0 | yes Evaluation Count:4795286 |
| 0-4795286 |
1205 | { | - |
1206 | *klass = 0; never executed (the execution status of this line is deduced): *klass = 0; | - |
1207 | if ( index ) | 0 |
1208 | *index = 0; never executed: *index = 0; | 0 |
1209 | | - |
1210 | return HB_Err_Not_Covered; never executed: return HB_Err_Not_Covered; | 0 |
1211 | } | - |
1212 | | - |
1213 | new_min = 0; executed (the execution status of this line is deduced): new_min = 0; | - |
1214 | new_max = cdf2->ClassRangeCount - 1; executed (the execution status of this line is deduced): new_max = cdf2->ClassRangeCount - 1; | - |
1215 | | - |
1216 | do | - |
1217 | { | - |
1218 | min = new_min; executed (the execution status of this line is deduced): min = new_min; | - |
1219 | max = new_max; executed (the execution status of this line is deduced): max = new_max; | - |
1220 | | - |
1221 | /* we use (min + max) / 2 = max - (max - min) / 2 to avoid | - |
1222 | overflow and rounding errors */ | - |
1223 | | - |
1224 | middle = max - ( ( max - min ) >> 1 ); executed (the execution status of this line is deduced): middle = max - ( ( max - min ) >> 1 ); | - |
1225 | | - |
1226 | if ( glyphID >= crr[middle].Start && glyphID <= crr[middle].End ) evaluated: glyphID >= crr[middle].Start yes Evaluation Count:8338980 | yes Evaluation Count:24349859 |
evaluated: glyphID <= crr[middle].End yes Evaluation Count:4536956 | yes Evaluation Count:3802024 |
| 3802024-24349859 |
1227 | { | - |
1228 | *klass = crr[middle].Class; executed (the execution status of this line is deduced): *klass = crr[middle].Class; | - |
1229 | error = HB_Err_Ok; executed (the execution status of this line is deduced): error = HB_Err_Ok; | - |
1230 | break; executed: break; Execution Count:4536956 | 4536956 |
1231 | } | - |
1232 | else if ( glyphID < crr[middle].Start ) evaluated: glyphID < crr[middle].Start yes Evaluation Count:24349859 | yes Evaluation Count:3802024 |
| 3802024-24349859 |
1233 | { | - |
1234 | if ( middle == min ) evaluated: middle == min yes Evaluation Count:206263 | yes Evaluation Count:24143596 |
| 206263-24143596 |
1235 | { | - |
1236 | *klass = 0; executed (the execution status of this line is deduced): *klass = 0; | - |
1237 | error = HB_Err_Not_Covered; executed (the execution status of this line is deduced): error = HB_Err_Not_Covered; | - |
1238 | break; executed: break; Execution Count:206263 | 206263 |
1239 | } | - |
1240 | new_max = middle - 1; executed (the execution status of this line is deduced): new_max = middle - 1; | - |
1241 | } executed: } Execution Count:24143596 | 24143596 |
1242 | else | - |
1243 | { | - |
1244 | if ( middle == max ) evaluated: middle == max yes Evaluation Count:52067 | yes Evaluation Count:3749957 |
| 52067-3749957 |
1245 | { | - |
1246 | *klass = 0; executed (the execution status of this line is deduced): *klass = 0; | - |
1247 | error = HB_Err_Not_Covered; executed (the execution status of this line is deduced): error = HB_Err_Not_Covered; | - |
1248 | break; executed: break; Execution Count:52067 | 52067 |
1249 | } | - |
1250 | new_min = middle + 1; executed (the execution status of this line is deduced): new_min = middle + 1; | - |
1251 | } executed: } Execution Count:3749957 | 3749957 |
1252 | } while ( min < max ); partially evaluated: min < max yes Evaluation Count:27893553 | no Evaluation Count:0 |
| 0-27893553 |
1253 | | - |
1254 | if ( index ) evaluated: index yes Evaluation Count:3541657 | yes Evaluation Count:1253629 |
| 1253629-3541657 |
1255 | *index = middle; executed: *index = middle; Execution Count:3541657 | 3541657 |
1256 | | - |
1257 | return error; executed: return error; Execution Count:4795286 | 4795286 |
1258 | } | - |
1259 | | - |
1260 | | - |
1261 | HB_INTERNAL HB_Error | - |
1262 | _HB_OPEN_Get_Class( HB_ClassDefinition* cd, | - |
1263 | HB_UShort glyphID, | - |
1264 | HB_UShort* klass, | - |
1265 | HB_UShort* index ) | - |
1266 | { | - |
1267 | switch ( cd->ClassFormat ) | - |
1268 | { | - |
1269 | case 1: return Get_Class1( &cd->cd.cd1, glyphID, klass, index ); never executed: return Get_Class1( &cd->cd.cd1, glyphID, klass, index ); | 0 |
1270 | case 2: return Get_Class2( &cd->cd.cd2, glyphID, klass, index ); executed: return Get_Class2( &cd->cd.cd2, glyphID, klass, index ); Execution Count:4795286 | 4795286 |
1271 | default: return ERR(HB_Err_Invalid_SubTable_Format); never executed: return _hb_err (HB_Err_Invalid_SubTable_Format); | 0 |
1272 | } | - |
1273 | | - |
1274 | return HB_Err_Ok; /* never reached */ never executed: return HB_Err_Ok; | 0 |
1275 | } | - |
1276 | | - |
1277 | | - |
1278 | | - |
1279 | /*************************** | - |
1280 | * Device related functions | - |
1281 | ***************************/ | - |
1282 | | - |
1283 | | - |
1284 | HB_INTERNAL HB_Error | - |
1285 | _HB_OPEN_Load_Device( HB_Device** device, | - |
1286 | HB_Stream stream ) | - |
1287 | { | - |
1288 | HB_Device* d; executed (the execution status of this line is deduced): HB_Device* d; | - |
1289 | HB_Error error; executed (the execution status of this line is deduced): HB_Error error; | - |
1290 | | - |
1291 | HB_UShort n, count; executed (the execution status of this line is deduced): HB_UShort n, count; | - |
1292 | | - |
1293 | HB_UShort* dv; executed (the execution status of this line is deduced): HB_UShort* dv; | - |
1294 | | - |
1295 | | - |
1296 | if ( ACCESS_Frame( 6L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, 6L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:225 |
| 0-225 |
1297 | return error; never executed: return error; | 0 |
1298 | | - |
1299 | if ( ALLOC( *device, sizeof(HB_Device)) ) partially evaluated: ( (*device) = _hb_alloc( sizeof(HB_Device), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:225 |
| 0-225 |
1300 | { | - |
1301 | *device = 0; never executed (the execution status of this line is deduced): *device = 0; | - |
1302 | return error; never executed: return error; | 0 |
1303 | } | - |
1304 | | - |
1305 | d = *device; executed (the execution status of this line is deduced): d = *device; | - |
1306 | | - |
1307 | d->StartSize = GET_UShort(); executed (the execution status of this line is deduced): d->StartSize = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
1308 | d->EndSize = GET_UShort(); executed (the execution status of this line is deduced): d->EndSize = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
1309 | d->DeltaFormat = GET_UShort(); executed (the execution status of this line is deduced): d->DeltaFormat = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); | - |
1310 | | - |
1311 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
1312 | | - |
1313 | d->DeltaValue = NULL; executed (the execution status of this line is deduced): d->DeltaValue = ((void *)0); | - |
1314 | | - |
1315 | if ( d->StartSize > d->EndSize || partially evaluated: d->StartSize > d->EndSize no Evaluation Count:0 | yes Evaluation Count:225 |
| 0-225 |
1316 | d->DeltaFormat == 0 || d->DeltaFormat > 3 ) partially evaluated: d->DeltaFormat == 0 no Evaluation Count:0 | yes Evaluation Count:225 |
partially evaluated: d->DeltaFormat > 3 no Evaluation Count:0 | yes Evaluation Count:225 |
| 0-225 |
1317 | { | - |
1318 | /* XXX | - |
1319 | * I've seen fontforge generate DeltaFormat == 0. | - |
1320 | * Just return Ok and let the NULL DeltaValue disable | - |
1321 | * this table. | - |
1322 | */ | - |
1323 | return HB_Err_Ok; never executed: return HB_Err_Ok; | 0 |
1324 | } | - |
1325 | | - |
1326 | count = ( ( d->EndSize - d->StartSize + 1 ) >> executed (the execution status of this line is deduced): count = ( ( d->EndSize - d->StartSize + 1 ) >> | - |
1327 | ( 4 - d->DeltaFormat ) ) + 1; executed (the execution status of this line is deduced): ( 4 - d->DeltaFormat ) ) + 1; | - |
1328 | | - |
1329 | if ( ALLOC_ARRAY( d->DeltaValue, count, HB_UShort ) ) partially evaluated: ( (d->DeltaValue) = _hb_alloc( (count)*sizeof(HB_UShort), &error ), error != 0 ) no Evaluation Count:0 | yes Evaluation Count:225 |
| 0-225 |
1330 | { | - |
1331 | FREE( *device ); never executed: } never executed: } never evaluated: (*device) never evaluated: 0 | 0 |
1332 | *device = 0; never executed (the execution status of this line is deduced): *device = 0; | - |
1333 | return error; never executed: return error; | 0 |
1334 | } | - |
1335 | | - |
1336 | if ( ACCESS_Frame( count * 2L ) ) partially evaluated: ( (error = (_hb_stream_frame_enter( stream, count * 2L ))) != 0 ) no Evaluation Count:0 | yes Evaluation Count:225 |
| 0-225 |
1337 | { | - |
1338 | FREE( d->DeltaValue ); never executed: } never executed: } never evaluated: (d->DeltaValue) never evaluated: 0 | 0 |
1339 | FREE( *device ); never executed: } never executed: } never evaluated: (*device) never evaluated: 0 | 0 |
1340 | *device = 0; never executed (the execution status of this line is deduced): *device = 0; | - |
1341 | return error; never executed: return error; | 0 |
1342 | } | - |
1343 | | - |
1344 | dv = d->DeltaValue; executed (the execution status of this line is deduced): dv = d->DeltaValue; | - |
1345 | | - |
1346 | for ( n = 0; n < count; n++ ) evaluated: n < count yes Evaluation Count:225 | yes Evaluation Count:225 |
| 225 |
1347 | dv[n] = GET_UShort(); executed: dv[n] = ((HB_UShort)(stream->cursor += 2, (HB_Short)( (*(((HB_Byte*)stream->cursor)-2) << 8) | *(((HB_Byte*)stream->cursor)-1) ))); Execution Count:225 | 225 |
1348 | | - |
1349 | FORGET_Frame(); executed (the execution status of this line is deduced): _hb_stream_frame_exit( stream ); | - |
1350 | | - |
1351 | return HB_Err_Ok; executed: return HB_Err_Ok; Execution Count:225 | 225 |
1352 | } | - |
1353 | | - |
1354 | | - |
1355 | HB_INTERNAL void | - |
1356 | _HB_OPEN_Free_Device( HB_Device* d ) | - |
1357 | { | - |
1358 | if ( d ) evaluated: d yes Evaluation Count:116 | yes Evaluation Count:116 |
| 116 |
1359 | { | - |
1360 | FREE( d->DeltaValue ); executed: } Execution Count:116 executed: } Execution Count:116 partially evaluated: (d->DeltaValue) yes Evaluation Count:116 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:116 |
| 0-116 |
1361 | FREE( d ); executed: } Execution Count:116 executed: } Execution Count:116 partially evaluated: (d) yes Evaluation Count:116 | no Evaluation Count:0 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:116 |
| 0-116 |
1362 | } executed: } Execution Count:116 | 116 |
1363 | } executed: } Execution Count:232 | 232 |
1364 | | - |
1365 | | - |
1366 | /* Since we have the delta values stored in compressed form, we must | - |
1367 | uncompress it now. To simplify the interface, the function always | - |
1368 | returns a meaningful value in `value'; the error is just for | - |
1369 | information. | - |
1370 | | | | - |
1371 | format = 1: 0011223344556677|8899101112131415|... | - |
1372 | | | | - |
1373 | byte 1 byte 2 | - |
1374 | | - |
1375 | 00: (byte >> 14) & mask | - |
1376 | 11: (byte >> 12) & mask | - |
1377 | ... | - |
1378 | | - |
1379 | mask = 0x0003 | - |
1380 | | | | - |
1381 | format = 2: 0000111122223333|4444555566667777|... | - |
1382 | | | | - |
1383 | byte 1 byte 2 | - |
1384 | | - |
1385 | 0000: (byte >> 12) & mask | - |
1386 | 1111: (byte >> 8) & mask | - |
1387 | ... | - |
1388 | | - |
1389 | mask = 0x000F | - |
1390 | | | | - |
1391 | format = 3: 0000000011111111|2222222233333333|... | - |
1392 | | | | - |
1393 | byte 1 byte 2 | - |
1394 | | - |
1395 | 00000000: (byte >> 8) & mask | - |
1396 | 11111111: (byte >> 0) & mask | - |
1397 | .... | - |
1398 | | - |
1399 | mask = 0x00FF */ | - |
1400 | | - |
1401 | HB_INTERNAL HB_Error | - |
1402 | _HB_OPEN_Get_Device( HB_Device* d, | - |
1403 | HB_UShort size, | - |
1404 | HB_Short* value ) | - |
1405 | { | - |
1406 | HB_UShort byte, bits, mask, s; executed (the execution status of this line is deduced): HB_UShort byte, bits, mask, s; | - |
1407 | | - |
1408 | if ( d && d->DeltaValue && size >= d->StartSize && size <= d->EndSize ) evaluated: d yes Evaluation Count:48 | yes Evaluation Count:48 |
partially evaluated: d->DeltaValue yes Evaluation Count:48 | no Evaluation Count:0 |
partially evaluated: size >= d->StartSize no Evaluation Count:0 | yes Evaluation Count:48 |
never evaluated: size <= d->EndSize | 0-48 |
1409 | { | - |
1410 | HB_UShort f = d->DeltaFormat; never executed (the execution status of this line is deduced): HB_UShort f = d->DeltaFormat; | - |
1411 | s = size - d->StartSize; never executed (the execution status of this line is deduced): s = size - d->StartSize; | - |
1412 | byte = d->DeltaValue[s >> ( 4 - f )]; never executed (the execution status of this line is deduced): byte = d->DeltaValue[s >> ( 4 - f )]; | - |
1413 | bits = byte >> ( 16 - ( ( s % ( 1 << ( 4 - f ) ) + 1 ) << f ) ); never executed (the execution status of this line is deduced): bits = byte >> ( 16 - ( ( s % ( 1 << ( 4 - f ) ) + 1 ) << f ) ); | - |
1414 | mask = 0xFFFF >> ( 16 - ( 1 << f ) ); never executed (the execution status of this line is deduced): mask = 0xFFFF >> ( 16 - ( 1 << f ) ); | - |
1415 | | - |
1416 | *value = (HB_Short)( bits & mask ); never executed (the execution status of this line is deduced): *value = (HB_Short)( bits & mask ); | - |
1417 | | - |
1418 | /* conversion to a signed value */ | - |
1419 | | - |
1420 | if ( *value >= ( ( mask + 1 ) >> 1 ) ) never evaluated: *value >= ( ( mask + 1 ) >> 1 ) | 0 |
1421 | *value -= mask + 1; never executed: *value -= mask + 1; | 0 |
1422 | | - |
1423 | return HB_Err_Ok; never executed: return HB_Err_Ok; | 0 |
1424 | } | - |
1425 | else | - |
1426 | { | - |
1427 | *value = 0; executed (the execution status of this line is deduced): *value = 0; | - |
1428 | return HB_Err_Not_Covered; executed: return HB_Err_Not_Covered; Execution Count:96 | 96 |
1429 | } | - |
1430 | } | - |
1431 | | - |
1432 | | - |
1433 | /* END */ | - |
1434 | | - |
| | |