gsdx-replayer:linux: Fix strict-aliasing warnings

Use a reinterpret_cast instead of casting the function pointer address
to a void** and dereferencing it.

Also remove an unnecessary (void) and avoid including stdafx.h.
This commit is contained in:
Jonathan Li 2016-12-12 17:48:56 +00:00
parent d4a6e18c01
commit 2c3fd160c3
1 changed files with 6 additions and 4 deletions

View File

@ -18,8 +18,10 @@
*
*/
#include "stdafx.h"
#include <dlfcn.h>
#include <cstdlib>
#include <cstdio>
#include <string>
static void* handle;
@ -67,8 +69,8 @@ int main ( int argc, char *argv[] )
__attribute__((stdcall)) void (*GSsetSettingsDir_ptr)(const char*);
__attribute__((stdcall)) void (*GSReplay_ptr)(char*, int);
*(void**)(&GSsetSettingsDir_ptr) = dlsym(handle, "GSsetSettingsDir");
*(void**)(&GSReplay_ptr) = dlsym(handle, "GSReplay");
GSsetSettingsDir_ptr = reinterpret_cast<decltype(GSsetSettingsDir_ptr)>(dlsym(handle, "GSsetSettingsDir"));
GSReplay_ptr = reinterpret_cast<decltype(GSReplay_ptr)>(dlsym(handle, "GSReplay"));
if (argc == 2) {
char *ini = read_env("GSDUMP_CONF");
@ -76,7 +78,7 @@ int main ( int argc, char *argv[] )
GSsetSettingsDir_ptr(ini);
} else if (argc == 4) {
(void)GSsetSettingsDir_ptr(argv[3]);
GSsetSettingsDir_ptr(argv[3]);
} else if ( argc == 3) {
#ifdef XDG_STD