... |
... |
@@ -131,14 +131,15 @@ |
131
|
131
|
FT_UInt count,
|
132
|
132
|
FT_Memory memory )
|
133
|
133
|
{
|
134
|
|
- FT_UInt old_max = ( mask->max_bits + 7 ) >> 3;
|
135
|
|
- FT_UInt new_max = ( count + 7 ) >> 3;
|
|
134
|
+ FT_UInt old_max = mask->max_bits >> 3;
|
|
135
|
+ FT_UInt new_max = ( count + 7 ) >> 3;
|
136
|
136
|
FT_Error error = FT_Err_Ok;
|
137
|
137
|
|
138
|
138
|
|
139
|
139
|
if ( new_max > old_max )
|
140
|
140
|
{
|
141
|
141
|
new_max = FT_PAD_CEIL( new_max, 8 );
|
|
142
|
+ /* added bytes are zeroed here */
|
142
|
143
|
if ( !FT_RENEW_ARRAY( mask->bytes, old_max, new_max ) )
|
143
|
144
|
mask->max_bits = new_max * 8;
|
144
|
145
|
}
|
... |
... |
@@ -158,22 +159,6 @@ |
158
|
159
|
}
|
159
|
160
|
|
160
|
161
|
|
161
|
|
- /* clear a given bit */
|
162
|
|
- static void
|
163
|
|
- ps_mask_clear_bit( PS_Mask mask,
|
164
|
|
- FT_UInt idx )
|
165
|
|
- {
|
166
|
|
- FT_Byte* p;
|
167
|
|
-
|
168
|
|
-
|
169
|
|
- if ( idx >= mask->num_bits )
|
170
|
|
- return;
|
171
|
|
-
|
172
|
|
- p = mask->bytes + ( idx >> 3 );
|
173
|
|
- p[0] = (FT_Byte)( p[0] & ~( 0x80 >> ( idx & 7 ) ) );
|
174
|
|
- }
|
175
|
|
-
|
176
|
|
-
|
177
|
162
|
/* set a given bit, possibly grow the mask */
|
178
|
163
|
static FT_Error
|
179
|
164
|
ps_mask_set_bit( PS_Mask mask,
|
... |
... |
@@ -432,15 +417,14 @@ |
432
|
417
|
|
433
|
418
|
|
434
|
419
|
/* if "count2" is greater than "count1", we need to grow the */
|
435
|
|
- /* first bitset, and clear the highest bits */
|
|
420
|
+ /* first bitset */
|
436
|
421
|
if ( count2 > count1 )
|
437
|
422
|
{
|
438
|
423
|
error = ps_mask_ensure( mask1, count2, memory );
|
439
|
424
|
if ( error )
|
440
|
425
|
goto Exit;
|
441
|
426
|
|
442
|
|
- for ( pos = count1; pos < count2; pos++ )
|
443
|
|
- ps_mask_clear_bit( mask1, pos );
|
|
427
|
+ mask1->num_bits = count2;
|
444
|
428
|
}
|
445
|
429
|
|
446
|
430
|
/* merge (unite) the bitsets */
|