fix(platform): address C89 warnings and Windows pointer casting
- Include <stdint.h> so Windows does not complain about int types. - Cast GetProcAddress return through intptr_t to satisfy -Wpedantic. - Moved work_path for *nix only macros.
This commit is contained in:
+3
-2
@@ -1,4 +1,5 @@
|
|||||||
#include "stk.h"
|
#include "stk.h"
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -341,7 +342,7 @@ void platform_unload_library(void *handle)
|
|||||||
void *platform_get_symbol(void *handle, const char *symbol)
|
void *platform_get_symbol(void *handle, const char *symbol)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return (void *)GetProcAddress((HMODULE)handle, symbol);
|
return (void *)(intptr_t)GetProcAddress((HMODULE)handle, symbol);
|
||||||
#else
|
#else
|
||||||
return dlsym(handle, symbol);
|
return dlsym(handle, symbol);
|
||||||
#endif
|
#endif
|
||||||
@@ -649,7 +650,6 @@ stk_module_event_t *platform_directory_watch_check(
|
|||||||
char (*platform_directory_init_scan(const char *mod_dir, size_t *out_count))
|
char (*platform_directory_init_scan(const char *mod_dir, size_t *out_count))
|
||||||
[STK_PATH_MAX] {
|
[STK_PATH_MAX] {
|
||||||
char (*file_list)[STK_PATH_MAX] = NULL;
|
char (*file_list)[STK_PATH_MAX] = NULL;
|
||||||
char work_path[STK_PATH_MAX_OS];
|
|
||||||
size_t count = 0, index = 0;
|
size_t count = 0, index = 0;
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@@ -706,6 +706,7 @@ char (*platform_directory_init_scan(const char *mod_dir, size_t *out_count))
|
|||||||
} while (FindNextFileW(find_handle, &find_data) && index < count);
|
} while (FindNextFileW(find_handle, &find_data) && index < count);
|
||||||
FindClose(find_handle);
|
FindClose(find_handle);
|
||||||
#else
|
#else
|
||||||
|
char work_path[STK_PATH_MAX_OS];
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
struct stat file_stat;
|
struct stat file_stat;
|
||||||
|
|||||||
Reference in New Issue
Block a user