diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/host.c | 2 | ||||
-rw-r--r-- | src/instance.c | 4 | ||||
-rw-r--r-- | src/suil_internal.h | 7 |
3 files changed, 7 insertions, 6 deletions
@@ -23,7 +23,7 @@ suil_host_new(SuilPortWriteFunc write_func, SuilPortSubscribeFunc subscribe_func, SuilPortUnsubscribeFunc unsubscribe_func) { - SuilHost* host = malloc(sizeof(struct SuilHostImpl)); + SuilHost* host = (SuilHost*)malloc(sizeof(struct SuilHostImpl)); host->write_func = write_func; host->index_func = index_func; host->subscribe_func = subscribe_func; diff --git a/src/instance.c b/src/instance.c index 0f9434a..617280e 100644 --- a/src/instance.c +++ b/src/instance.c @@ -98,7 +98,7 @@ open_wrapper(SuilHost* host, + strlen(module_name) + 2; - char* const path = calloc(path_len, 1); + char* const path = (char*)calloc(path_len, 1); snprintf(path, path_len, "%s%s%s%s%s", mod_dir, SUIL_DIR_SEP, SUIL_MODULE_PREFIX, module_name, SUIL_MODULE_EXT); @@ -184,7 +184,7 @@ suil_instance_new(SuilHost* host, } // Create SuilInstance - SuilInstance* instance = calloc(1, sizeof(struct SuilInstanceImpl)); + SuilInstance* instance = (SuilInstance*)calloc(1, sizeof(SuilInstance)); if (!instance) { SUIL_ERRORF("Failed to allocate memory for <%s> instance\n", ui_uri); dlclose(lib); diff --git a/src/suil_internal.h b/src/suil_internal.h index 385dc26..0e565cb 100644 --- a/src/suil_internal.h +++ b/src/suil_internal.h @@ -24,8 +24,10 @@ #ifdef _WIN32 #include <windows.h> #define dlopen(path, flags) LoadLibrary(path) -#define dlclose(lib) FreeLibrary(lib) +#define dlclose(lib) FreeLibrary((HMODULE)lib) #define dlsym GetProcAddress +#define inline __inline +#define snprintf _snprintf static inline char* dlerror(void) { return "Unknown error"; } #else #include <dlfcn.h> @@ -35,8 +37,7 @@ static inline char* dlerror(void) { return "Unknown error"; } #include "suil/suil.h" -#define SUIL_ERRORF(fmt, ...) fprintf(stderr, "error: %s: " fmt, \ - __func__, __VA_ARGS__) +#define SUIL_ERRORF(fmt, ...) fprintf(stderr, "suil error: " fmt, __VA_ARGS__) struct SuilHostImpl { SuilPortWriteFunc write_func; |