[hb-cairo] Silence warning when building with FreeType

In file included from ../util/hb-view.cc:33:
In file included from ../util/view-cairo.hh:32:
../util/helper-cairo.hh:102:7: warning: variable 'cairo_face' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
  if (use_hb_draw)
      ^~~~~~~~~~~
../util/helper-cairo.hh:129:64: note: uninitialized use occurs here
  cairo_scaled_font_t *scaled_font = cairo_scaled_font_create (cairo_face,
                                                               ^~~~~~~~~~
../util/helper-cairo.hh:102:3: note: remove the 'if' if its condition is always true
  if (use_hb_draw)
  ^~~~~~~~~~~~~~~~
../util/helper-cairo.hh:101:32: note: initialize the variable 'cairo_face' to silence this warning
  cairo_font_face_t *cairo_face;
                               ^
                                = nullptr

We know that cairo_face will always be assigned since use_hb_draw will
always be true, but the compiler does not know that.
This commit is contained in:
Khaled Hosny 2022-12-30 22:55:56 +02:00
parent a45bf5b04c
commit 00060d99f3
1 changed files with 1 additions and 1 deletions

View File

@ -98,7 +98,7 @@ helper_cairo_create_scaled_font (const font_options_t *font_opts)
#endif
cairo_font_face_t *cairo_face;
cairo_font_face_t *cairo_face = nullptr;
if (use_hb_draw)
{
cairo_face = hb_cairo_font_face_create_for_font (font);