Warning, /graphics/krita/3rdparty/ext_freetype/harfbuzz-clang16-fix.patch is written in an unsupported language. File is not indexed.

0001 From d88269c827895b38f99f7cf741fa60210d4d5169 Mon Sep 17 00:00:00 2001
0002 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
0003 Date: Fri, 28 Oct 2022 22:17:15 +0300
0004 Subject: [PATCH] freetype: Fix function signatures to match without casts
0005 
0006 Clang 16 has got a new stricter warning for casts of function types
0007 (see https://github.com/llvm/llvm-project/commit/1aad641c793090b4d036c03e737df2ebe2c32c57).
0008 
0009 This new warning gets included as part of the existing error
0010 diagnostic setting of -Wcast-function-type.
0011 
0012 This fixes errors like these:
0013 
0014 ../src/hb-ft.cc:1011:34: error: cast from 'void (*)(FT_Face)' (aka 'void (*)(FT_FaceRec_ *)') to 'FT_Generic_Finalizer' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
0015     ft_face->generic.finalizer = (FT_Generic_Finalizer) hb_ft_face_finalize;
0016                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0017 ---
0018  src/hb-ft.cc | 30 ++++++++++++++++++------------
0019  1 file changed, 18 insertions(+), 12 deletions(-)
0020 
0021 diff --git a/src/hb-ft.cc b/src/hb-ft.cc
0022 index bcc1dd080f5..1626b9a1500 100644
0023 --- a/src/hb-ft.cc
0024 +++ b/src/hb-ft.cc
0025 @@ -732,16 +732,18 @@ hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED,
0026  
0027  static int
0028  _hb_ft_move_to (const FT_Vector *to,
0029 -               hb_draw_session_t *drawing)
0030 +               void *arg)
0031  {
0032 +  hb_draw_session_t *drawing = (hb_draw_session_t *) arg;
0033    drawing->move_to (to->x, to->y);
0034    return FT_Err_Ok;
0035  }
0036  
0037  static int
0038  _hb_ft_line_to (const FT_Vector *to,
0039 -               hb_draw_session_t *drawing)
0040 +               void *arg)
0041  {
0042 +  hb_draw_session_t *drawing = (hb_draw_session_t *) arg;
0043    drawing->line_to (to->x, to->y);
0044    return FT_Err_Ok;
0045  }
0046 @@ -749,8 +751,9 @@ _hb_ft_line_to (const FT_Vector *to,
0047  static int
0048  _hb_ft_conic_to (const FT_Vector *control,
0049                  const FT_Vector *to,
0050 -                hb_draw_session_t *drawing)
0051 +                void *arg)
0052  {
0053 +  hb_draw_session_t *drawing = (hb_draw_session_t *) arg;
0054    drawing->quadratic_to (control->x, control->y,
0055                          to->x, to->y);
0056    return FT_Err_Ok;
0057 @@ -760,8 +763,9 @@ static int
0058  _hb_ft_cubic_to (const FT_Vector *control1,
0059                  const FT_Vector *control2,
0060                  const FT_Vector *to,
0061 -                hb_draw_session_t *drawing)
0062 +                void *arg)
0063  {
0064 +  hb_draw_session_t *drawing = (hb_draw_session_t *) arg;
0065    drawing->cubic_to (control1->x, control1->y,
0066                      control2->x, control2->y,
0067                      to->x, to->y);
0068 @@ -787,10 +791,10 @@ hb_ft_get_glyph_shape (hb_font_t *font HB_UNUSED,
0069      return;
0070  
0071    const FT_Outline_Funcs outline_funcs = {
0072 -    (FT_Outline_MoveToFunc) _hb_ft_move_to,
0073 -    (FT_Outline_LineToFunc) _hb_ft_line_to,
0074 -    (FT_Outline_ConicToFunc) _hb_ft_conic_to,
0075 -    (FT_Outline_CubicToFunc) _hb_ft_cubic_to,
0076 +    _hb_ft_move_to,
0077 +    _hb_ft_line_to,
0078 +    _hb_ft_conic_to,
0079 +    _hb_ft_cubic_to,
0080      0, /* shift */
0081      0, /* delta */
0082    };
0083 @@ -975,8 +979,9 @@ hb_ft_face_create_referenced (FT_Face ft_face)
0084  }
0085  
0086  static void
0087 -hb_ft_face_finalize (FT_Face ft_face)
0088 +hb_ft_face_finalize (void *arg)
0089  {
0090 +  FT_Face ft_face = (FT_Face) arg;
0091    hb_face_destroy ((hb_face_t *) ft_face->generic.data);
0092  }
0093  
0094 @@ -1008,7 +1013,7 @@ hb_ft_face_create_cached (FT_Face ft_face)
0095        ft_face->generic.finalizer (ft_face);
0096  
0097      ft_face->generic.data = hb_ft_face_create (ft_face, nullptr);
0098 -    ft_face->generic.finalizer = (FT_Generic_Finalizer) hb_ft_face_finalize;
0099 +    ft_face->generic.finalizer = hb_ft_face_finalize;
0100    }
0101  
0102    return hb_face_reference ((hb_face_t *) ft_face->generic.data);
0103 @@ -1217,8 +1222,9 @@ get_ft_library ()
0104  }
0105  
0106  static void
0107 -_release_blob (FT_Face ft_face)
0108 +_release_blob (void *arg)
0109  {
0110 +  FT_Face ft_face = (FT_Face) arg;
0111    hb_blob_destroy ((hb_blob_t *) ft_face->generic.data);
0112  }
0113  
0114 @@ -1271,7 +1277,7 @@ hb_ft_font_set_funcs (hb_font_t *font)
0115  
0116  
0117    ft_face->generic.data = blob;
0118 -  ft_face->generic.finalizer = (FT_Generic_Finalizer) _release_blob;
0119 +  ft_face->generic.finalizer = _release_blob;
0120  
0121    _hb_ft_font_set_funcs (font, ft_face, true);
0122    hb_ft_font_set_load_flags (font, FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING);