diff options
| author | Paul Eggert | 2019-06-01 12:07:48 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-06-01 12:07:48 -0700 |
| commit | 0c22b52046748d178ed851faaaca08f3a72ab227 (patch) | |
| tree | e90e37b8fadde33e022ba18f840b48e09df2ef16 /src | |
| parent | 7febfc5cdc3a11bc5d0657d509417b27ea07c344 (diff) | |
| download | emacs-0c22b52046748d178ed851faaaca08f3a72ab227.tar.gz emacs-0c22b52046748d178ed851faaaca08f3a72ab227.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/hbfont.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hbfont.c b/src/hbfont.c index 10eed691aed..88767c30afe 100644 --- a/src/hbfont.c +++ b/src/hbfont.c | |||
| @@ -393,8 +393,8 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object direction) | |||
| 393 | } | 393 | } |
| 394 | info = hb_buffer_get_glyph_infos (hb_buffer, NULL); | 394 | info = hb_buffer_get_glyph_infos (hb_buffer, NULL); |
| 395 | pos = hb_buffer_get_glyph_positions (hb_buffer, NULL); | 395 | pos = hb_buffer_get_glyph_positions (hb_buffer, NULL); |
| 396 | int from = -1, to, cluster_offset = 0; | 396 | ptrdiff_t from = -1, to UNINIT, cluster_offset UNINIT; |
| 397 | int char_idx, incr = buf_reversed ? -1 : 1; | 397 | int incr = buf_reversed ? -1 : 1; |
| 398 | for (i = 0; i < glyph_len; i++) | 398 | for (i = 0; i < glyph_len; i++) |
| 399 | { | 399 | { |
| 400 | Lisp_Object lglyph = LGSTRING_GLYPH (lgstring, i); | 400 | Lisp_Object lglyph = LGSTRING_GLYPH (lgstring, i); |
| @@ -442,7 +442,7 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object direction) | |||
| 442 | M could be smaller or greater than N. However, in many cases | 442 | M could be smaller or greater than N. However, in many cases |
| 443 | there is a one-to-one correspondence, and it would be a pity | 443 | there is a one-to-one correspondence, and it would be a pity |
| 444 | to lose that information, even if it's sometimes inaccurate. */ | 444 | to lose that information, even if it's sometimes inaccurate. */ |
| 445 | char_idx = from + cluster_offset; | 445 | ptrdiff_t char_idx = from + cluster_offset; |
| 446 | cluster_offset += incr; | 446 | cluster_offset += incr; |
| 447 | if (char_idx > to) | 447 | if (char_idx > to) |
| 448 | char_idx = to; | 448 | char_idx = to; |