From 29c1d736c49b73f1df4c00bc4cc44aff95172b37 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 17 Aug 2022 11:57:53 +1000 Subject: Cleanup: compiler warnings, clang-tidy --- source/blender/blenfont/intern/blf_font.c | 32 +++++++++++++--------- .../draw/engines/eevee_next/eevee_renderbuffers.cc | 4 +-- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index f820ec14507..0a0b4bd328f 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -73,7 +73,9 @@ static ft_pix blf_font_width_max_ft_pix(struct FontBLF *font); /** \name FreeType Caching * \{ */ -/* Called when a face is removed by the cache. FreeType will call FT_Done_Face. */ +/** + * Called when a face is removed by the cache. FreeType will call #FT_Done_Face. + */ static void blf_face_finalizer(void *object) { FT_Face face = object; @@ -81,11 +83,15 @@ static void blf_face_finalizer(void *object) font->face = NULL; } -/* Called in response to FTC_Manager_LookupFace. Now add a face to our font. */ -FT_Error blf_cache_face_requester(FTC_FaceID faceID, - FT_Library lib, - FT_Pointer reqData, - FT_Face *face) +/** + * Called in response to #FTC_Manager_LookupFace. Now add a face to our font. + * + * \note Unused arguments are kept to match #FTC_Face_Requester function signature. + */ +static FT_Error blf_cache_face_requester(FTC_FaceID faceID, + FT_Library lib, + FT_Pointer UNUSED(reqData), + FT_Face *face) { FontBLF *font = (FontBLF *)faceID; int err = FT_Err_Cannot_Open_Resource; @@ -108,7 +114,9 @@ FT_Error blf_cache_face_requester(FTC_FaceID faceID, return err; } -/* Called when the FreeType cache is removing a font size. */ +/** + * Called when the FreeType cache is removing a font size. + */ static void blf_size_finalizer(void *object) { FT_Size size = object; @@ -127,10 +135,8 @@ uint blf_get_char_index(struct FontBLF *font, uint charcode) /* Use charmap cache for much faster lookup. */ return FTC_CMapCache_Lookup(ftc_charmap_cache, font, -1, charcode); } - else { - /* Fonts that are not cached need to use the regular lookup function. */ - return blf_ensure_face(font) ? FT_Get_Char_Index(font->face, charcode) : 0; - } + /* Fonts that are not cached need to use the regular lookup function. */ + return blf_ensure_face(font) ? FT_Get_Char_Index(font->face, charcode) : 0; } /* Convert a FreeType 26.6 value representing an unscaled design size to fractional pixels. */ @@ -1523,9 +1529,9 @@ FontBLF *blf_font_new_ex(const char *name, return font; } -FontBLF *blf_font_new(const char *name, const char *filename) +FontBLF *blf_font_new(const char *name, const char *filepath) { - return blf_font_new_ex(name, filename, NULL, 0, NULL); + return blf_font_new_ex(name, filepath, NULL, 0, NULL); } FontBLF *blf_font_new_from_mem(const char *name, const unsigned char *mem, const size_t mem_size) diff --git a/source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc b/source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc index dd7da0d8f76..c18c913d797 100644 --- a/source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc +++ b/source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc @@ -43,10 +43,10 @@ void RenderBuffers::acquire(int2 extent) bool do_vector_render_pass = (enabled_passes & EEVEE_RENDER_PASS_VECTOR) || (inst_.motion_blur.postfx_enabled() && !inst_.is_viewport()); uint32_t max_light_color_layer = max_ii(enabled_passes & EEVEE_RENDER_PASS_DIFFUSE_LIGHT ? - RENDER_PASS_LAYER_DIFFUSE_LIGHT : + (int)RENDER_PASS_LAYER_DIFFUSE_LIGHT : -1, enabled_passes & EEVEE_RENDER_PASS_SPECULAR_LIGHT ? - RENDER_PASS_LAYER_SPECULAR_LIGHT : + (int)RENDER_PASS_LAYER_SPECULAR_LIGHT : -1) + 1; /* Only RG16F when only doing only reprojection or motion blur. */ -- cgit v1.2.3