[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
diff --git a/ChangeLog b/ChangeLog
index 68c01f6..e7e92c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2016-03-29 Werner Lemberg <wl@gnu.org>
+ [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 <wl@gnu.org>
+
* src/pfr/pfrtypes.h: Replace all enums with macros.
We need `~FOO' to unset bits, and only with unsigned values (which
diff --git a/src/pfr/pfrsbit.c b/src/pfr/pfrsbit.c
index d271593..abdbb20 100644
--- 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: