emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] harfbuzz 0c22b52: Port hbfont.c to GCC 9 with --enable-gcc


From: Paul Eggert
Subject: [Emacs-diffs] harfbuzz 0c22b52: Port hbfont.c to GCC 9 with --enable-gcc-warnings
Date: Sat, 1 Jun 2019 15:07:53 -0400 (EDT)

branch: harfbuzz
commit 0c22b52046748d178ed851faaaca08f3a72ab227
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Port hbfont.c to GCC 9 with --enable-gcc-warnings
    
    * src/hbfont.c (hbfont_shape): Use ptrdiff_t, not int,
    for indexes that in theory might overflow int.
    Add UNINIT to pacify GCC 9 and omit an unnecessary initialization.
---
 src/hbfont.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/hbfont.c b/src/hbfont.c
index 10eed69..88767c3 100644
--- a/src/hbfont.c
+++ b/src/hbfont.c
@@ -393,8 +393,8 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object direction)
     }
   info = hb_buffer_get_glyph_infos (hb_buffer, NULL);
   pos = hb_buffer_get_glyph_positions (hb_buffer, NULL);
-  int from = -1, to, cluster_offset = 0;
-  int char_idx, incr = buf_reversed ? -1 : 1;
+  ptrdiff_t from = -1, to UNINIT, cluster_offset UNINIT;
+  int incr = buf_reversed ? -1 : 1;
   for (i = 0; i < glyph_len; i++)
     {
       Lisp_Object lglyph = LGSTRING_GLYPH (lgstring, i);
@@ -442,7 +442,7 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object direction)
         M could be smaller or greater than N.  However, in many cases
         there is a one-to-one correspondence, and it would be a pity
         to lose that information, even if it's sometimes inaccurate.  */
-      char_idx = from + cluster_offset;
+      ptrdiff_t char_idx = from + cluster_offset;
       cluster_offset += incr;
       if (char_idx > to)
        char_idx = to;



reply via email to

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