| Line | Source Code | Coverage |
|---|
| 1 | static HB_Error | - |
| 2 | hb_buffer_ensure( HB_Buffer buffer, | - |
| 3 | HB_UInt size ) | - |
| 4 | { | - |
| 5 | HB_UInt new_allocated = buffer->allocated; | - |
| 6 | | - |
| 7 | if (size > new_allocated) evaluated: size > new_allocated| yes Evaluation Count:365 | yes Evaluation Count:12884254 |
| 365-12884254 |
| 8 | { | - |
| 9 | HB_Error error; | - |
| 10 | | - |
| 11 | while (size > new_allocated) evaluated: size > new_allocated| yes Evaluation Count:365 | yes Evaluation Count:365 |
| 365 |
| 12 | new_allocated += (new_allocated >> 1) + 8; executed: new_allocated += (new_allocated >> 1) + 8;Execution Count:365 | 365 |
| 13 | | - |
| 14 | if ( buffer->positions ) evaluated: buffer->positions| yes Evaluation Count:182 | yes Evaluation Count:183 |
| 182-183 |
| 15 | { | - |
| 16 | if ( ( (buffer->positions) = _hb_realloc( (buffer->positions), ((new_allocated)*sizeof(HB_PositionRec)), &error ), error != 0 ) ) partially evaluated: ( (buffer->positions) = _hb_realloc( (buffer->positions), ((new_allocated)*sizeof(HB_PositionRec)), &error ), error != 0 )| no Evaluation Count:0 | yes Evaluation Count:182 |
| 0-182 |
| 17 | return error; never executed: return error; | 0 |
| 18 | } executed: }Execution Count:182 | 182 |
| 19 | | - |
| 20 | if ( ( (buffer->in_string) = _hb_realloc( (buffer->in_string), ((new_allocated)*sizeof(HB_GlyphItemRec)), &error ), error != 0 ) ) partially evaluated: ( (buffer->in_string) = _hb_realloc( (buffer->in_string), ((new_allocated)*sizeof(HB_GlyphItemRec)), &error ), error != 0 )| no Evaluation Count:0 | yes Evaluation Count:365 |
| 0-365 |
| 21 | return error; never executed: return error; | 0 |
| 22 | | - |
| 23 | if ( buffer->separate_out ) partially evaluated: buffer->separate_out| no Evaluation Count:0 | yes Evaluation Count:365 |
| 0-365 |
| 24 | { | - |
| 25 | if ( ( (buffer->alt_string) = _hb_realloc( (buffer->alt_string), ((new_allocated)*sizeof(HB_GlyphItemRec)), &error ), error != 0 ) ) never evaluated: ( (buffer->alt_string) = _hb_realloc( (buffer->alt_string), ((new_allocated)*sizeof(HB_GlyphItemRec)), &error ), error != 0 ) | 0 |
| 26 | return error; never executed: return error; | 0 |
| 27 | | - |
| 28 | buffer->out_string = buffer->alt_string; | - |
| 29 | } | 0 |
| 30 | else | - |
| 31 | { | - |
| 32 | buffer->out_string = buffer->in_string; | - |
| 33 | | - |
| 34 | if ( buffer->alt_string ) evaluated: buffer->alt_string| yes Evaluation Count:25 | yes Evaluation Count:340 |
| 25-340 |
| 35 | { | - |
| 36 | if ( ( (buffer->alt_string) = _hb_realloc( (buffer->alt_string), ((new_allocated)*sizeof(HB_GlyphItemRec)), &error ), error != 0 ) ) partially evaluated: ( (buffer->alt_string) = _hb_realloc( (buffer->alt_string), ((new_allocated)*sizeof(HB_GlyphItemRec)), &error ), error != 0 )| no Evaluation Count:0 | yes Evaluation Count:25 |
| 0-25 |
| 37 | return error; never executed: return error; | 0 |
| 38 | } executed: }Execution Count:25 | 25 |
| 39 | } executed: }Execution Count:365 | 365 |
| 40 | | - |
| 41 | buffer->allocated = new_allocated; | - |
| 42 | } executed: }Execution Count:365 | 365 |
| 43 | | - |
| 44 | return HB_Err_Ok; executed: return HB_Err_Ok;Execution Count:12884619 | 12884619 |
| 45 | } | - |
| 46 | | - |
| 47 | static HB_Error | - |
| 48 | hb_buffer_duplicate_out_buffer( HB_Buffer buffer ) | - |
| 49 | { | - |
| 50 | if ( !buffer->alt_string ) evaluated: !buffer->alt_string| yes Evaluation Count:25 | yes Evaluation Count:9851 |
| 25-9851 |
| 51 | { | - |
| 52 | HB_Error error; | - |
| 53 | | - |
| 54 | if ( ( (buffer->alt_string) = _hb_alloc( (buffer->allocated)*sizeof(HB_GlyphItemRec), &error ), error != 0 ) ) partially evaluated: ( (buffer->alt_string) = _hb_alloc( (buffer->allocated)*sizeof(HB_GlyphItemRec), &error ), error != 0 )| no Evaluation Count:0 | yes Evaluation Count:25 |
| 0-25 |
| 55 | return error; never executed: return error; | 0 |
| 56 | } executed: }Execution Count:25 | 25 |
| 57 | | - |
| 58 | buffer->out_string = buffer->alt_string; | - |
| 59 | memcpy( buffer->out_string, buffer->in_string, buffer->out_length * sizeof (buffer->out_string[0]) ); | - |
| 60 | buffer->separate_out = (!0); | - |
| 61 | | - |
| 62 | return HB_Err_Ok; executed: return HB_Err_Ok;Execution Count:9876 | 9876 |
| 63 | } | - |
| 64 | | - |
| 65 | | - |
| 66 | | - |
| 67 | HB_Error | - |
| 68 | hb_buffer_new( HB_Buffer *pbuffer ) | - |
| 69 | { | - |
| 70 | HB_Buffer buffer; | - |
| 71 | HB_Error error; | - |
| 72 | | - |
| 73 | if ( ( (buffer) = _hb_alloc( sizeof( HB_BufferRec ), &error ), error != 0 ) ) partially evaluated: ( (buffer) = _hb_alloc( sizeof( HB_BufferRec ), &error ), error != 0 )| no Evaluation Count:0 | yes Evaluation Count:218 |
| 0-218 |
| 74 | return error; never executed: return error; | 0 |
| 75 | | - |
| 76 | buffer->allocated = 0; | - |
| 77 | buffer->in_string = ((void *)0); | - |
| 78 | buffer->alt_string = ((void *)0); | - |
| 79 | buffer->positions = ((void *)0); | - |
| 80 | | - |
| 81 | hb_buffer_clear( buffer ); | - |
| 82 | | - |
| 83 | *pbuffer = buffer; | - |
| 84 | | - |
| 85 | return HB_Err_Ok; executed: return HB_Err_Ok;Execution Count:218 | 218 |
| 86 | } | - |
| 87 | | - |
| 88 | void | - |
| 89 | hb_buffer_free( HB_Buffer buffer ) | - |
| 90 | { | - |
| 91 | do { if ( (buffer->in_string) ) { _hb_free( buffer->in_string ); buffer->in_string = ((void *)0); } } while (0); executed: }Execution Count:132 executed: }Execution Count:208 evaluated: (buffer->in_string)| yes Evaluation Count:132 | yes Evaluation Count:76 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:208 |
| 0-208 |
| 92 | do { if ( (buffer->alt_string) ) { _hb_free( buffer->alt_string ); buffer->alt_string = ((void *)0); } } while (0); executed: }Execution Count:22 executed: }Execution Count:208 evaluated: (buffer->alt_string)| yes Evaluation Count:22 | yes Evaluation Count:186 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:208 |
| 0-208 |
| 93 | buffer->out_string = ((void *)0); | - |
| 94 | do { if ( (buffer->positions) ) { _hb_free( buffer->positions ); buffer->positions = ((void *)0); } } while (0); executed: }Execution Count:131 executed: }Execution Count:208 evaluated: (buffer->positions)| yes Evaluation Count:131 | yes Evaluation Count:77 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:208 |
| 0-208 |
| 95 | do { if ( (buffer) ) { _hb_free( buffer ); buffer = ((void *)0); } } while (0); executed: }Execution Count:208 executed: }Execution Count:208 partially evaluated: (buffer)| yes Evaluation Count:208 | no Evaluation Count:0 |
partially evaluated: 0| no Evaluation Count:0 | yes Evaluation Count:208 |
| 0-208 |
| 96 | } executed: }Execution Count:208 | 208 |
| 97 | | - |
| 98 | void | - |
| 99 | hb_buffer_clear( HB_Buffer buffer ) | - |
| 100 | { | - |
| 101 | buffer->in_length = 0; | - |
| 102 | buffer->out_length = 0; | - |
| 103 | buffer->in_pos = 0; | - |
| 104 | buffer->out_pos = 0; | - |
| 105 | buffer->out_string = buffer->in_string; | - |
| 106 | buffer->separate_out = 0; | - |
| 107 | buffer->max_ligID = 0; | - |
| 108 | } executed: }Execution Count:248331 | 248331 |
| 109 | | - |
| 110 | HB_Error | - |
| 111 | hb_buffer_add_glyph( HB_Buffer buffer, | - |
| 112 | HB_UInt glyph_index, | - |
| 113 | HB_UInt properties, | - |
| 114 | HB_UInt cluster ) | - |
| 115 | { | - |
| 116 | HB_Error error; | - |
| 117 | HB_GlyphItem glyph; | - |
| 118 | | - |
| 119 | error = hb_buffer_ensure( buffer, buffer->in_length + 1 ); | - |
| 120 | if ( error ) partially evaluated: error| no Evaluation Count:0 | yes Evaluation Count:3326586 |
| 0-3326586 |
| 121 | return error; never executed: return error; | 0 |
| 122 | | - |
| 123 | glyph = &buffer->in_string[buffer->in_length]; | - |
| 124 | glyph->gindex = glyph_index; | - |
| 125 | glyph->properties = properties; | - |
| 126 | glyph->cluster = cluster; | - |
| 127 | glyph->component = 0; | - |
| 128 | glyph->ligID = 0; | - |
| 129 | glyph->gproperties = 0xFFFF; | - |
| 130 | | - |
| 131 | buffer->in_length++; | - |
| 132 | | - |
| 133 | return HB_Err_Ok; executed: return HB_Err_Ok;Execution Count:3326586 | 3326586 |
| 134 | } | - |
| 135 | | - |
| 136 | | - |
| 137 | | - |
| 138 | void | - |
| 139 | _hb_buffer_clear_output( HB_Buffer buffer ) | - |
| 140 | { | - |
| 141 | buffer->out_length = 0; | - |
| 142 | buffer->out_pos = 0; | - |
| 143 | buffer->out_string = buffer->in_string; | - |
| 144 | buffer->separate_out = 0; | - |
| 145 | } executed: }Execution Count:744297 | 744297 |
| 146 | | - |
| 147 | HB_Error | - |
| 148 | _hb_buffer_clear_positions( HB_Buffer buffer ) | - |
| 149 | { | - |
| 150 | if ( !buffer->positions ) evaluated: !buffer->positions| yes Evaluation Count:138 | yes Evaluation Count:247974 |
| 138-247974 |
| 151 | { | - |
| 152 | HB_Error error; | - |
| 153 | | - |
| 154 | if ( ( (buffer->positions) = _hb_alloc( (buffer->allocated)*sizeof(HB_PositionRec), &error ), error != 0 ) ) partially evaluated: ( (buffer->positions) = _hb_alloc( (buffer->allocated)*sizeof(HB_PositionRec), &error ), error != 0 )| no Evaluation Count:0 | yes Evaluation Count:138 |
| 0-138 |
| 155 | return error; never executed: return error; | 0 |
| 156 | } executed: }Execution Count:138 | 138 |
| 157 | | - |
| 158 | memset (buffer->positions, 0, sizeof (buffer->positions[0]) * buffer->in_length); | - |
| 159 | | - |
| 160 | return HB_Err_Ok; executed: return HB_Err_Ok;Execution Count:248112 | 248112 |
| 161 | } | - |
| 162 | | - |
| 163 | void | - |
| 164 | _hb_buffer_swap( HB_Buffer buffer ) | - |
| 165 | { | - |
| 166 | HB_GlyphItem tmp_string; | - |
| 167 | int tmp_length; | - |
| 168 | int tmp_pos; | - |
| 169 | | - |
| 170 | if ( buffer->separate_out ) evaluated: buffer->separate_out| yes Evaluation Count:9876 | yes Evaluation Count:94 |
| 94-9876 |
| 171 | { | - |
| 172 | tmp_string = buffer->in_string; | - |
| 173 | buffer->in_string = buffer->out_string; | - |
| 174 | buffer->out_string = tmp_string; | - |
| 175 | buffer->alt_string = buffer->out_string; | - |
| 176 | } executed: }Execution Count:9876 | 9876 |
| 177 | | - |
| 178 | tmp_length = buffer->in_length; | - |
| 179 | buffer->in_length = buffer->out_length; | - |
| 180 | buffer->out_length = tmp_length; | - |
| 181 | | - |
| 182 | tmp_pos = buffer->in_pos; | - |
| 183 | buffer->in_pos = buffer->out_pos; | - |
| 184 | buffer->out_pos = tmp_pos; | - |
| 185 | } executed: }Execution Count:9970 | 9970 |
| 186 | HB_Error | - |
| 187 | _hb_buffer_add_output_glyphs( HB_Buffer buffer, | - |
| 188 | HB_UShort num_in, | - |
| 189 | HB_UShort num_out, | - |
| 190 | HB_UShort *glyph_data, | - |
| 191 | HB_UShort component, | - |
| 192 | HB_UShort ligID ) | - |
| 193 | { | - |
| 194 | HB_Error error; | - |
| 195 | HB_UShort i; | - |
| 196 | HB_UInt properties; | - |
| 197 | HB_UInt cluster; | - |
| 198 | | - |
| 199 | error = hb_buffer_ensure( buffer, buffer->out_pos + num_out ); | - |
| 200 | if ( error ) partially evaluated: error| no Evaluation Count:0 | yes Evaluation Count:9979 |
| 0-9979 |
| 201 | return error; never executed: return error; | 0 |
| 202 | | - |
| 203 | if ( !buffer->separate_out ) evaluated: !buffer->separate_out| yes Evaluation Count:9876 | yes Evaluation Count:103 |
| 103-9876 |
| 204 | { | - |
| 205 | error = hb_buffer_duplicate_out_buffer( buffer ); | - |
| 206 | if ( error ) partially evaluated: error| no Evaluation Count:0 | yes Evaluation Count:9876 |
| 0-9876 |
| 207 | return error; never executed: return error; | 0 |
| 208 | } executed: }Execution Count:9876 | 9876 |
| 209 | | - |
| 210 | properties = buffer->in_string[buffer->in_pos].properties; | - |
| 211 | cluster = buffer->in_string[buffer->in_pos].cluster; | - |
| 212 | if ( component == 0xFFFF ) partially evaluated: component == 0xFFFF| yes Evaluation Count:9979 | no Evaluation Count:0 |
| 0-9979 |
| 213 | component = buffer->in_string[buffer->in_pos].component; executed: component = buffer->in_string[buffer->in_pos].component;Execution Count:9979 | 9979 |
| 214 | if ( ligID == 0xFFFF ) partially evaluated: ligID == 0xFFFF| no Evaluation Count:0 | yes Evaluation Count:9979 |
| 0-9979 |
| 215 | ligID = buffer->in_string[buffer->in_pos].ligID; never executed: ligID = buffer->in_string[buffer->in_pos].ligID; | 0 |
| 216 | | - |
| 217 | for ( i = 0; i < num_out; i++ ) evaluated: i < num_out| yes Evaluation Count:9979 | yes Evaluation Count:9979 |
| 9979 |
| 218 | { | - |
| 219 | HB_GlyphItem item = &buffer->out_string[buffer->out_pos + i]; | - |
| 220 | | - |
| 221 | item->gindex = glyph_data[i]; | - |
| 222 | item->properties = properties; | - |
| 223 | item->cluster = cluster; | - |
| 224 | item->component = component; | - |
| 225 | item->ligID = ligID; | - |
| 226 | item->gproperties = 0xFFFF; | - |
| 227 | } executed: }Execution Count:9979 | 9979 |
| 228 | | - |
| 229 | buffer->in_pos += num_in; | - |
| 230 | buffer->out_pos += num_out; | - |
| 231 | | - |
| 232 | buffer->out_length = buffer->out_pos; | - |
| 233 | | - |
| 234 | return HB_Err_Ok; executed: return HB_Err_Ok;Execution Count:9979 | 9979 |
| 235 | } | - |
| 236 | | - |
| 237 | HB_Error | - |
| 238 | _hb_buffer_add_output_glyph( HB_Buffer buffer, | - |
| 239 | HB_UInt glyph_index, | - |
| 240 | HB_UShort component, | - |
| 241 | HB_UShort ligID ) | - |
| 242 | { | - |
| 243 | HB_UShort glyph_data = glyph_index; | - |
| 244 | | - |
| 245 | return _hb_buffer_add_output_glyphs ( buffer, 1, 1, | 0 |
| 246 | &glyph_data, component, ligID ); never executed: return _hb_buffer_add_output_glyphs ( buffer, 1, 1, &glyph_data, component, ligID ); | 0 |
| 247 | } | - |
| 248 | | - |
| 249 | HB_Error | - |
| 250 | _hb_buffer_copy_output_glyph ( HB_Buffer buffer ) | - |
| 251 | { | - |
| 252 | HB_Error error; | - |
| 253 | | - |
| 254 | error = hb_buffer_ensure( buffer, buffer->out_pos + 1 ); | - |
| 255 | if ( error ) partially evaluated: error| no Evaluation Count:0 | yes Evaluation Count:9548054 |
| 0-9548054 |
| 256 | return error; never executed: return error; | 0 |
| 257 | | - |
| 258 | if ( buffer->separate_out ) evaluated: buffer->separate_out| yes Evaluation Count:89007 | yes Evaluation Count:9459047 |
| 89007-9459047 |
| 259 | { | - |
| 260 | buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos]; | - |
| 261 | } executed: }Execution Count:89007 | 89007 |
| 262 | | - |
| 263 | buffer->in_pos++; | - |
| 264 | buffer->out_pos++; | - |
| 265 | buffer->out_length = buffer->out_pos; | - |
| 266 | | - |
| 267 | return HB_Err_Ok; executed: return HB_Err_Ok;Execution Count:9548054 | 9548054 |
| 268 | } | - |
| 269 | | - |
| 270 | HB_Error | - |
| 271 | _hb_buffer_replace_output_glyph( HB_Buffer buffer, | - |
| 272 | HB_UInt glyph_index, | - |
| 273 | HB_Bool inplace ) | - |
| 274 | { | - |
| 275 | | - |
| 276 | HB_Error error; | - |
| 277 | | - |
| 278 | if ( inplace ) partially evaluated: inplace| yes Evaluation Count:130 | no Evaluation Count:0 |
| 0-130 |
| 279 | { | - |
| 280 | error = _hb_buffer_copy_output_glyph ( buffer ); | - |
| 281 | if ( error ) partially evaluated: error| no Evaluation Count:0 | yes Evaluation Count:130 |
| 0-130 |
| 282 | return error; never executed: return error; | 0 |
| 283 | | - |
| 284 | buffer->out_string[buffer->out_pos-1].gindex = glyph_index; | - |
| 285 | } executed: }Execution Count:130 | 130 |
| 286 | else | - |
| 287 | { | - |
| 288 | return _hb_buffer_add_output_glyph( buffer, glyph_index, 0xFFFF, 0xFFFF ); never executed: return _hb_buffer_add_output_glyph( buffer, glyph_index, 0xFFFF, 0xFFFF ); | 0 |
| 289 | } | - |
| 290 | | - |
| 291 | return HB_Err_Ok; executed: return HB_Err_Ok;Execution Count:130 | 130 |
| 292 | } | - |
| 293 | | - |
| 294 | HB_UShort | - |
| 295 | _hb_buffer_allocate_ligid( HB_Buffer buffer ) | - |
| 296 | { | - |
| 297 | buffer->max_ligID++; | - |
| 298 | if ((buffer->max_ligID == 0)) partially evaluated: (buffer->max_ligID == 0)| no Evaluation Count:0 | yes Evaluation Count:9979 |
| 0-9979 |
| 299 | buffer->max_ligID++; never executed: buffer->max_ligID++; | 0 |
| 300 | | - |
| 301 | return buffer->max_ligID; executed: return buffer->max_ligID;Execution Count:9979 | 9979 |
| 302 | } | - |
| 303 | | - |
| | |