Commit eef5c1dd1455208dee1a6378016f018c8a69be35

Werner Lemberg 2019-08-27T10:43:32

[woff2] Fix compiler warnings. * src/sfnt/sfwoff2.c (read_num_hmetrics): Remove unused argument `table_len'. Update caller. (triplet_decode, compute_bbox, store_loca, reconstruct_glyf): Make `i' variable unsigned. (reconstruct_glyph): Remove condition which is always false. (reconstruct_html): Removed unused argument `transformed_size'. Update caller. * src/sfnt/woff2tags.c (woff2_known_tags): Remove condition which is always false.

diff --git a/ChangeLog b/ChangeLog
index 91dc356..7a06ca0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2019-08-27  Werner Lemberg  <wl@gnu.org>
+
+	[woff2] Fix compiler warnings.
+
+	* src/sfnt/sfwoff2.c (read_num_hmetrics): Remove unused argument
+	`table_len'.
+	Update caller.
+	(triplet_decode, compute_bbox, store_loca, reconstruct_glyf): Make
+	`i' variable unsigned.
+	(reconstruct_glyph): Remove condition which is always false.
+	(reconstruct_html): Removed unused argument `transformed_size'.
+	Update caller.
+
+	* src/sfnt/woff2tags.c (woff2_known_tags): Remove condition which is
+	always false.
+
 2019-08-27  Nikhil Ramakrishnan  <ramakrishnan.nikhil@gmail.com>
 
 	[woff2] Check whether known tag is in array bounds.
diff --git a/src/sfnt/sfwoff2.c b/src/sfnt/sfwoff2.c
index fc4094d..6ee6887 100644
--- a/src/sfnt/sfwoff2.c
+++ b/src/sfnt/sfwoff2.c
@@ -366,7 +366,6 @@
   /* Read `numberOfHMetrics' field from `hhea' table. */
   static FT_Error
   read_num_hmetrics( FT_Stream   stream,
-                     FT_ULong    table_len,
                      FT_UShort*  num_hmetrics )
   {
     FT_Error   error = FT_Err_Ok;
@@ -433,7 +432,7 @@
     FT_ULong  triplet_index = 0;
     FT_ULong  data_bytes;
 
-    FT_Int  i;
+    FT_UInt  i;
 
 
     if ( n_points > in_size )
@@ -673,7 +672,8 @@
     FT_Int  y_min = 0;
     FT_Int  x_max = 0;
     FT_Int  y_max = 0;
-    FT_Int  i;
+
+    FT_UInt  i;
 
     FT_ULong  offset;
     FT_Byte*  pointer;
@@ -778,7 +778,7 @@
     FT_Byte*  loca_buf = NULL;
     FT_Byte*  dst      = NULL;
 
-    FT_Int    i = 0;
+    FT_UInt   i = 0;
     FT_ULong  loca_buf_size;
 
     const FT_ULong  offset_size = index_format ? 4 : 2;
@@ -849,7 +849,7 @@
     FT_UShort  index_format;
     FT_ULong   expected_loca_length;
     FT_UInt    offset;
-    FT_Int     i;
+    FT_UInt    i;
     FT_ULong   points_size;
     FT_ULong   bitmap_length;
     FT_ULong   glyph_buf_size;
@@ -1099,8 +1099,7 @@
 
         substreams[GLYPH_STREAM].offset = FT_STREAM_POS();
 
-        if ( total_n_points >= ( 1 << 27 )   ||
-             instruction_size >= ( 1 << 30 ) )
+        if ( total_n_points >= ( 1 << 27 ) )
           goto Fail;
 
         size_needed = 12 +
@@ -1333,7 +1332,6 @@
 
   static FT_Error
   reconstruct_hmtx( FT_Stream  stream,
-                    FT_ULong   transformed_size,
                     FT_UShort  num_glyphs,
                     FT_UShort  num_hmetrics,
                     FT_Short*  x_mins,
@@ -1564,7 +1562,7 @@
       /* Get stream size for fields of `hmtx' table. */
       if ( table.Tag == TTAG_hhea )
       {
-        if ( read_num_hmetrics( stream, table.src_length, &num_hmetrics ) )
+        if ( read_num_hmetrics( stream, &num_hmetrics ) )
           return FT_THROW( Invalid_Table );
       }
 
@@ -1633,7 +1631,6 @@
           table.dst_offset = dest_offset;
 
           if ( reconstruct_hmtx( stream,
-                                 table.src_length,
                                  info->num_glyphs,
                                  info->num_hmetrics,
                                  info->x_mins,
diff --git a/src/sfnt/woff2tags.c b/src/sfnt/woff2tags.c
index 47b1186..4c0feb9 100644
--- a/src/sfnt/woff2tags.c
+++ b/src/sfnt/woff2tags.c
@@ -101,7 +101,7 @@
     };
 
 
-    if ( index < 0 || index > 62 )
+    if ( index > 62 )
       return 0;
 
     return known_tags[index];