freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 2a6665a: [sfnt] Fix fallout from 2021-05-29 change.


From: Werner Lemberg
Subject: [freetype2] master 2a6665a: [sfnt] Fix fallout from 2021-05-29 change.
Date: Wed, 2 Jun 2021 01:20:40 -0400 (EDT)

branch: master
commit 2a6665a4c04913bbe088af48db4eb293d498043c
Author: Ben Wagner <bungeman@chromium.org>
Commit: Werner Lemberg <wl@gnu.org>

    [sfnt] Fix fallout from 2021-05-29 change.
    
    * src/sfnt/ttcolr.c (find_base_glyph_record,
    find_base_glyph_v1_record): Adjust binary search.
    
    Needs to be updated with change to unsigned.
---
 ChangeLog         | 10 ++++++++++
 src/sfnt/ttcolr.c | 20 ++++++++++----------
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2b6ee36..0d0e8f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2021-06-02  Ben Wagner  <bungeman@chromium.org>
+           Werner Lemberg  <wl@gnu.org>
+
+       [sfnt] Fix fallout from 2021-05-29 change.
+
+       * src/sfnt/ttcolr.c (find_base_glyph_record,
+       find_base_glyph_v1_record): Adjust binary search.
+
+       Needs to be updated with change to unsigned.
+
 2021-06-02  Werner Lemberg  <wl@gnu.org>
 
        * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Fix tracing.
diff --git a/src/sfnt/ttcolr.c b/src/sfnt/ttcolr.c
index 632547f..fa58a90 100644
--- a/src/sfnt/ttcolr.c
+++ b/src/sfnt/ttcolr.c
@@ -233,10 +233,10 @@
                           BaseGlyphRecord*  record )
   {
     FT_UInt  min = 0;
-    FT_UInt  max = num_base_glyph - 1;
+    FT_UInt  max = num_base_glyph;
 
 
-    while ( min <= max )
+    while ( min < max )
     {
       FT_UInt   mid = min + ( max - min ) / 2;
       FT_Byte*  p   = base_glyph_begin + mid * BASE_GLYPH_SIZE;
@@ -247,7 +247,7 @@
       if ( gid < glyph_id )
         min = mid + 1;
       else if (gid > glyph_id )
-        max = mid - 1;
+        max = mid;
       else
       {
         record->gid               = gid;
@@ -590,16 +590,16 @@
 
 
   static FT_Bool
-  find_base_glyph_v1_record ( FT_Byte *           base_glyph_begin,
-                              FT_UInt             num_base_glyph,
-                              FT_UInt             glyph_id,
-                              BaseGlyphV1Record  *record )
+  find_base_glyph_v1_record( FT_Byte *           base_glyph_begin,
+                             FT_UInt             num_base_glyph,
+                             FT_UInt             glyph_id,
+                             BaseGlyphV1Record  *record )
   {
     FT_UInt  min = 0;
-    FT_UInt  max = num_base_glyph - 1;
+    FT_UInt  max = num_base_glyph;
 
 
-    while ( min <= max )
+    while ( min < max )
     {
       FT_UInt  mid = min + ( max - min ) / 2;
 
@@ -616,7 +616,7 @@
       if ( gid < glyph_id )
         min = mid + 1;
       else if (gid > glyph_id )
-        max = mid - 1;
+        max = mid;
       else
       {
         record->gid          = gid;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]