summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Cheng <dcheng@google.com>2021-04-13 22:57:02 +0000
committerPhilip Withnall <philip@tecnocode.co.uk>2021-04-13 22:57:02 +0000
commit28b70c4129c7589cd7066ef327eec418b20793db (patch)
treeea0ef6e4d418135cb185fabe82b6bd9a06602d7e
parent722325fba8968a26eb243642cbe89a044d6dfd6c (diff)
Remove function pointer casts when calling xdg_run_command_on_dirs().
The function pointer casts silence the compiler and allow the code to build (and even run in the typical case). However, when building with control flow integrity checks, the runtime (rightfully) complains about calling a function via a mismatched function pointer type.
-rw-r--r--src/xdgmime.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/xdgmime.c b/src/xdgmime.c
index d178e06..90a0ed0 100644
--- a/src/xdgmime.c
+++ b/src/xdgmime.c
@@ -136,7 +136,8 @@ xdg_dir_time_list_free (XdgDirTimeList *list)
}
static int
-xdg_mime_init_from_directory (const char *directory)
+xdg_mime_init_from_directory (const char *directory,
+ void *user_data)
{
char *file_name;
struct stat st;
@@ -340,10 +341,11 @@ xdg_check_file (const char *file_path,
static int
xdg_check_dir (const char *directory,
- int *invalid_dir_list)
+ void *user_data)
{
int invalid, exists;
char *file_name;
+ int* invalid_dir_list = user_data;
assert (directory != NULL);
@@ -398,8 +400,7 @@ xdg_check_dirs (void)
for (list = dir_time_list; list; list = list->next)
list->checked = XDG_CHECKED_UNCHECKED;
- xdg_run_command_on_dirs ((XdgDirectoryFunc) xdg_check_dir,
- &invalid_dir_list);
+ xdg_run_command_on_dirs (xdg_check_dir, &invalid_dir_list);
if (invalid_dir_list)
return TRUE;
@@ -455,8 +456,7 @@ xdg_mime_init (void)
icon_list = _xdg_mime_icon_list_new ();
generic_icon_list = _xdg_mime_icon_list_new ();
- xdg_run_command_on_dirs ((XdgDirectoryFunc) xdg_mime_init_from_directory,
- NULL);
+ xdg_run_command_on_dirs (xdg_mime_init_from_directory, NULL);
need_reread = FALSE;
}