From 0d3970114556d75ebd87649c4b313d9931f5b61e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 14 Jul 2018 00:54:14 +0200 Subject: [PATCH] Get rid of double void argument --- gfx/drivers/sdl2_gfx.c | 5 +++-- gfx/drivers/sdl_gfx.c | 3 ++- gfx/drivers/vg.c | 3 ++- gfx/drivers/xvideo.c | 3 ++- gfx/drivers_font/caca_font.c | 3 ++- gfx/drivers_font/ctr_font.c | 5 +++-- gfx/drivers_font/d3d10_font.c | 2 +- gfx/drivers_font/d3d11_font.c | 2 +- gfx/drivers_font/d3d12_font.c | 2 +- gfx/drivers_font/gdi_font.c | 3 ++- gfx/drivers_font/gl_raster_font.c | 3 ++- gfx/drivers_font/metal_raster_font.m | 5 +++-- gfx/drivers_font/sixel_font.c | 3 ++- gfx/drivers_font/vga_font.c | 3 ++- gfx/drivers_font/vita2d_font.c | 3 ++- gfx/drivers_font/vulkan_raster_font.c | 3 ++- gfx/drivers_font/wiiu_font.c | 5 +++-- gfx/drivers_font_renderer/freetype.c | 19 ++++++++++--------- gfx/font_driver.c | 9 ++++----- gfx/font_driver.h | 6 ++++-- 20 files changed, 53 insertions(+), 37 deletions(-) diff --git a/gfx/drivers/sdl2_gfx.c b/gfx/drivers/sdl2_gfx.c index 75f3105e5e..baf468a369 100644 --- a/gfx/drivers/sdl2_gfx.c +++ b/gfx/drivers/sdl2_gfx.c @@ -104,8 +104,9 @@ static void sdl2_init_font(sdl2_video_t *vid, const char *font_path, if (!settings->bools.video_font_enable) return; - if (!font_renderer_create_default((const void**)&vid->font_driver, &vid->font_data, - *font_path ? font_path : NULL, font_size)) + if (!font_renderer_create_default( + &vid->font_driver, &vid->font_data, + *font_path ? font_path : NULL, font_size)) { RARCH_WARN("[SDL]: Could not initialize fonts.\n"); return; diff --git a/gfx/drivers/sdl_gfx.c b/gfx/drivers/sdl_gfx.c index 83ad492680..931f96a926 100644 --- a/gfx/drivers/sdl_gfx.c +++ b/gfx/drivers/sdl_gfx.c @@ -96,7 +96,8 @@ static void sdl_init_font(sdl_video_t *vid, const char *font_path, unsigned font if (!settings->bools.video_font_enable) return; - if (!font_renderer_create_default((const void**)&vid->font_driver, &vid->font, + if (!font_renderer_create_default( + &vid->font_driver, &vid->font, *settings->paths.path_font ? settings->paths.path_font : NULL, settings->floats.video_font_size)) { diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index 64d2451e48..16bcf23b5f 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -194,7 +194,8 @@ static void *vg_init(const video_info_t *video, video_context_driver_input_driver(&inp); if ( video->font_enable - && font_renderer_create_default((const void**)&vg->font_driver, &vg->mFontRenderer, + && font_renderer_create_default( + &vg->font_driver, &vg->mFontRenderer, *settings->paths.path_font ? settings->paths.path_font : NULL, settings->floats.video_font_size)) { vg->mFont = vgCreateFont(0); diff --git a/gfx/drivers/xvideo.c b/gfx/drivers/xvideo.c index d81bc83d61..619cbaa712 100644 --- a/gfx/drivers/xvideo.c +++ b/gfx/drivers/xvideo.c @@ -139,7 +139,8 @@ static void xv_init_font(xv_t *xv, const char *font_path, unsigned font_size) if (!settings->bools.video_font_enable) return; - if (font_renderer_create_default((const void**)&xv->font_driver, + if (font_renderer_create_default( + &xv->font_driver, &xv->font, *settings->paths.path_font ? settings->paths.path_font : NULL, settings->floats.video_font_size)) diff --git a/gfx/drivers_font/caca_font.c b/gfx/drivers_font/caca_font.c index f98f8e38ed..c337d61eff 100644 --- a/gfx/drivers_font/caca_font.c +++ b/gfx/drivers_font/caca_font.c @@ -45,7 +45,8 @@ static void *caca_init_font(void *data, font->caca = (caca_t*)data; - if (!font_renderer_create_default((const void**)&font->caca_font_driver, + if (!font_renderer_create_default( + &font->caca_font_driver, &font->caca_font_data, font_path, font_size)) { RARCH_WARN("Couldn't initialize font renderer.\n"); diff --git a/gfx/drivers_font/ctr_font.c b/gfx/drivers_font/ctr_font.c index c128ee05a7..1bebd0eba5 100644 --- a/gfx/drivers_font/ctr_font.c +++ b/gfx/drivers_font/ctr_font.c @@ -58,8 +58,9 @@ static void* ctr_font_init_font(void* data, const char* font_path, return NULL; font_size = 10; - if (!font_renderer_create_default((const void**)&font->font_driver, - &font->font_data, font_path, font_size)) + if (!font_renderer_create_default( + &font->font_driver, + &font->font_data, font_path, font_size)) { RARCH_WARN("Couldn't initialize font renderer.\n"); free(font); diff --git a/gfx/drivers_font/d3d10_font.c b/gfx/drivers_font/d3d10_font.c index 3252854303..333ff64106 100644 --- a/gfx/drivers_font/d3d10_font.c +++ b/gfx/drivers_font/d3d10_font.c @@ -46,7 +46,7 @@ d3d10_font_init_font(void* data, const char* font_path, float font_size, bool is return NULL; if (!font_renderer_create_default( - (const void**)&font->font_driver, &font->font_data, font_path, font_size)) + &font->font_driver, &font->font_data, font_path, font_size)) { RARCH_WARN("Couldn't initialize font renderer.\n"); free(font); diff --git a/gfx/drivers_font/d3d11_font.c b/gfx/drivers_font/d3d11_font.c index f0113d870d..2b9fc2c301 100644 --- a/gfx/drivers_font/d3d11_font.c +++ b/gfx/drivers_font/d3d11_font.c @@ -45,7 +45,7 @@ d3d11_font_init_font(void* data, const char* font_path, float font_size, bool is return NULL; if (!font_renderer_create_default( - (const void**)&font->font_driver, &font->font_data, font_path, font_size)) + &font->font_driver, &font->font_data, font_path, font_size)) { RARCH_WARN("Couldn't initialize font renderer.\n"); free(font); diff --git a/gfx/drivers_font/d3d12_font.c b/gfx/drivers_font/d3d12_font.c index f15b1c9cdb..3276f8d1fb 100644 --- a/gfx/drivers_font/d3d12_font.c +++ b/gfx/drivers_font/d3d12_font.c @@ -46,7 +46,7 @@ d3d12_font_init_font(void* data, const char* font_path, return NULL; if (!font_renderer_create_default( - (const void**)&font->font_driver, + &font->font_driver, &font->font_data, font_path, font_size)) { RARCH_WARN("Couldn't initialize font renderer.\n"); diff --git a/gfx/drivers_font/gdi_font.c b/gfx/drivers_font/gdi_font.c index 78a41c4163..1c37ddd5ed 100644 --- a/gfx/drivers_font/gdi_font.c +++ b/gfx/drivers_font/gdi_font.c @@ -51,7 +51,8 @@ static void *gdi_init_font(void *data, font->gdi = (gdi_t*)data; - if (!font_renderer_create_default((const void**)&font->gdi_font_driver, + if (!font_renderer_create_default( + &font->gdi_font_driver, &font->gdi_font_data, font_path, font_size)) { RARCH_WARN("Couldn't initialize font renderer.\n"); diff --git a/gfx/drivers_font/gl_raster_font.c b/gfx/drivers_font/gl_raster_font.c index c9b43abfaa..a1442f8a9b 100644 --- a/gfx/drivers_font/gl_raster_font.c +++ b/gfx/drivers_font/gl_raster_font.c @@ -178,7 +178,8 @@ static void *gl_raster_font_init_font(void *data, font->gl = (gl_t*)data; - if (!font_renderer_create_default((const void**)&font->font_driver, + if (!font_renderer_create_default( + &font->font_driver, &font->font_data, font_path, font_size)) { RARCH_WARN("Couldn't initialize font renderer.\n"); diff --git a/gfx/drivers_font/metal_raster_font.m b/gfx/drivers_font/metal_raster_font.m index c5c7fa94bd..1fc15fc3aa 100644 --- a/gfx/drivers_font/metal_raster_font.m +++ b/gfx/drivers_font/metal_raster_font.m @@ -64,8 +64,9 @@ _driver = driver; _context = driver.context; - if (!font_renderer_create_default((const void **)&_font_driver, - &_font_data, font_path, font_size)) + if (!font_renderer_create_default( + &_font_driver, + &_font_data, font_path, font_size)) { RARCH_WARN("Couldn't initialize font renderer.\n"); return nil; diff --git a/gfx/drivers_font/sixel_font.c b/gfx/drivers_font/sixel_font.c index f97b732ca5..d7082e37d1 100644 --- a/gfx/drivers_font/sixel_font.c +++ b/gfx/drivers_font/sixel_font.c @@ -45,7 +45,8 @@ static void *sixel_init_font(void *data, font->sixel = (sixel_t*)data; - if (!font_renderer_create_default((const void**)&font->sixel_font_driver, + if (!font_renderer_create_default( + &font->sixel_font_driver, &font->sixel_font_data, font_path, font_size)) { RARCH_WARN("Couldn't initialize font renderer.\n"); diff --git a/gfx/drivers_font/vga_font.c b/gfx/drivers_font/vga_font.c index 0cc11f2ba2..794c727bea 100644 --- a/gfx/drivers_font/vga_font.c +++ b/gfx/drivers_font/vga_font.c @@ -46,7 +46,8 @@ static void *vga_init_font(void *data, font_size = 1; - if (!font_renderer_create_default((const void**)&font->vga_font_driver, + if (!font_renderer_create_default( + &font->vga_font_driver, &font->vga_font_data, font_path, font_size)) { RARCH_WARN("Couldn't initialize font renderer.\n"); diff --git a/gfx/drivers_font/vita2d_font.c b/gfx/drivers_font/vita2d_font.c index 5a228aea6d..d3fa780378 100644 --- a/gfx/drivers_font/vita2d_font.c +++ b/gfx/drivers_font/vita2d_font.c @@ -48,7 +48,8 @@ static void *vita2d_font_init_font(void *data, font->vita = (vita_video_t*)data; - if (!font_renderer_create_default((const void**)&font->font_driver, + if (!font_renderer_create_default( + &font->font_driver, &font->font_data, font_path, font_size)) goto error; diff --git a/gfx/drivers_font/vulkan_raster_font.c b/gfx/drivers_font/vulkan_raster_font.c index 33c9c02326..9d4edb6a7e 100644 --- a/gfx/drivers_font/vulkan_raster_font.c +++ b/gfx/drivers_font/vulkan_raster_font.c @@ -60,7 +60,8 @@ static void *vulkan_raster_font_init_font(void *data, font->vk = (vk_t*)data; - if (!font_renderer_create_default((const void**)&font->font_driver, + if (!font_renderer_create_default( + &font->font_driver, &font->font_data, font_path, font_size)) { RARCH_WARN("Couldn't initialize font renderer.\n"); diff --git a/gfx/drivers_font/wiiu_font.c b/gfx/drivers_font/wiiu_font.c index 6552cf4848..b959c89664 100644 --- a/gfx/drivers_font/wiiu_font.c +++ b/gfx/drivers_font/wiiu_font.c @@ -47,8 +47,9 @@ static void* wiiu_font_init_font(void* data, const char* font_path, if (!font) return NULL; - if (!font_renderer_create_default((const void**)&font->font_driver, - &font->font_data, font_path, font_size)) + if (!font_renderer_create_default( + &font->font_driver, + &font->font_data, font_path, font_size)) { RARCH_WARN("Couldn't initialize font renderer.\n"); free(font); diff --git a/gfx/drivers_font_renderer/freetype.c b/gfx/drivers_font_renderer/freetype.c index 2273806938..7261e038af 100644 --- a/gfx/drivers_font_renderer/freetype.c +++ b/gfx/drivers_font_renderer/freetype.c @@ -84,13 +84,13 @@ static freetype_atlas_slot_t* font_renderer_get_slot(ft_font_renderer_t *handle) unsigned oldest = 0; for (i = 1; i < FT_ATLAS_SIZE; i++) - if((handle->usage_counter - handle->atlas_slots[i].last_used) > + if ((handle->usage_counter - handle->atlas_slots[i].last_used) > (handle->usage_counter - handle->atlas_slots[oldest].last_used)) oldest = i; /* remove from map */ map_id = handle->atlas_slots[oldest].charcode & 0xFF; - if(handle->uc_map[map_id] == &handle->atlas_slots[oldest]) + if (handle->uc_map[map_id] == &handle->atlas_slots[oldest]) handle->uc_map[map_id] = handle->atlas_slots[oldest].next; else if (handle->uc_map[map_id]) { @@ -120,7 +120,7 @@ static const struct font_glyph *font_renderer_ft_get_glyph( while(atlas_slot) { - if(atlas_slot->charcode == charcode) + if (atlas_slot->charcode == charcode) { atlas_slot->last_used = handle->usage_counter++; return &atlas_slot->glyph; @@ -203,7 +203,7 @@ static bool font_renderer_create_atlas(ft_font_renderer_t *handle, float font_si font_renderer_ft_get_glyph(handle, i); for (i = 0; i < 256; i++) - if(isalnum(i)) + if (isalnum(i)) font_renderer_ft_get_glyph(handle, i); return true; @@ -227,12 +227,12 @@ static void *font_renderer_ft_init(const char *font_path, float font_size) goto error; #ifdef WIIU - if(!*font_path) + if (!*font_path) { - void* font_data = NULL; + void* font_data = NULL; uint32_t font_size = 0; - if(!OSGetSharedData(SHARED_FONT_DEFAULT, 0, &font_data, &font_size)) + if (!OSGetSharedData(SHARED_FONT_DEFAULT, 0, &font_data, &font_size)) goto error; err = FT_New_Memory_Face(handle->lib, font_data, font_size, 0, &handle->face); @@ -299,7 +299,6 @@ static const char *font_renderer_ft_get_default_font(void) #else size_t i; #if 0 - settings_t *settings = config_get_ptr(); char asset_path[PATH_MAX_LENGTH]; #endif @@ -309,7 +308,9 @@ static const char *font_renderer_ft_get_default_font(void) /* Check if we are getting the font from the assets directory. */ if (string_is_equal(font_paths[i], "assets://pkg/osd-font.ttf")) { - fill_pathname_join(asset_path, settings->paths.directory_assets, "pkg/osd-font.ttf", PATH_MAX_LENGTH); + settings_t *settings = config_get_ptr(); + fill_pathname_join(asset_path, + settings->paths.directory_assets, "pkg/osd-font.ttf", PATH_MAX_LENGTH); font_paths[i] = asset_path; } #endif diff --git a/gfx/font_driver.c b/gfx/font_driver.c index d9ed697afd..e8af0dca9e 100644 --- a/gfx/font_driver.c +++ b/gfx/font_driver.c @@ -46,13 +46,12 @@ static const font_renderer_driver_t *font_backends[] = { static void *video_font_driver = NULL; -int font_renderer_create_default(const void **data, void **handle, +int font_renderer_create_default( + const font_renderer_driver_t **drv, + void **handle, const char *font_path, unsigned font_size) { - unsigned i; - const font_renderer_driver_t **drv = - (const font_renderer_driver_t**)data; for (i = 0; font_backends[i]; i++) { @@ -76,7 +75,7 @@ int font_renderer_create_default(const void **data, void **handle, font_backends[i]->ident); } - *drv = NULL; + *drv = NULL; *handle = NULL; return 0; diff --git a/gfx/font_driver.h b/gfx/font_driver.h index 54876a0e87..a32b834e85 100644 --- a/gfx/font_driver.h +++ b/gfx/font_driver.h @@ -124,8 +124,10 @@ typedef struct } font_data_t; /* font_path can be NULL for default font. */ -int font_renderer_create_default(const void **driver, - void **handle, const char *font_path, unsigned font_size); +int font_renderer_create_default( + const font_renderer_driver_t **drv, + void **handle, + const char *font_path, unsigned font_size); void font_driver_render_msg(video_frame_info_t *video_info, void *font_data, const char *msg, const struct font_params *params);