ref: 2a03e5d9fb1392f1c57f26589cd3d5efb19f4fa1
parent: 31dc8f98f6ab7d8091d43a76937b0d01adc8de5c
author: Werner Lemberg <[email protected]>
date: Tue Mar 29 04:56:03 EDT 2016
[pfr] Minor. * src/pfr/pfrsbit.c (pfr_lookup_bitmap_data): Replace `left', `right', and `middle' with `min', `max', and `mid' as used in other FreeType binary search code. (pfr_load_bitmap_metrics): Fix invalid left shift.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2016-03-29 Werner Lemberg <[email protected]>
+ [pfr] Minor.
+
+ * src/pfr/pfrsbit.c (pfr_lookup_bitmap_data): Replace `left',
+ `right', and `middle' with `min', `max', and `mid' as used in other
+ FreeType binary search code.
+ (pfr_load_bitmap_metrics): Fix invalid left shift.
+
+2016-03-29 Werner Lemberg <[email protected]>
+
* src/pfr/pfrtypes.h: Replace all enums with macros.
We need `~FOO' to unset bits, and only with unsigned values (which
--- a/src/pfr/pfrsbit.c
+++ b/src/pfr/pfrsbit.c
@@ -282,7 +282,7 @@
FT_ULong* found_offset,
FT_ULong* found_size )
{
- FT_UInt left, right, char_len;
+ FT_UInt min, max, char_len;
FT_Bool two = FT_BOOL( *flags & PFR_BITMAP_2BYTE_CHARCODE );
FT_Byte* buff;
@@ -347,16 +347,17 @@
if ( !( *flags & PFR_BITMAP_VALID_CHARCODES ) )
goto Fail;
- left = 0;
- right = count;
+ min = 0;
+ max = count;
- while ( left < right )
+ /* binary search */
+ while ( min < max )
{
- FT_UInt middle, code;
+ FT_UInt mid, code;
- middle = ( left + right ) >> 1;
- buff = base + middle * char_len;
+ mid = ( min + max ) >> 1;
+ buff = base + mid * char_len;
if ( two )
code = PFR_NEXT_USHORT( buff );
@@ -367,9 +368,9 @@
goto Found_It;
if ( code < char_code )
- left = middle;
+ min = mid;
else
- right = middle;
+ max = mid;
}
Fail:
@@ -494,7 +495,7 @@
case 1:
PFR_CHECK( 1 );
- advance = PFR_NEXT_INT8( p ) << 8;
+ advance = PFR_NEXT_INT8( p ) * 256;
break;
case 2: