From 6dff8f35432087bf83e8ca629e9f66c1589286e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sat, 17 Oct 2015 01:16:32 +0200 Subject: Fix various warnings from recent GCC --- c_src/nif_helpers.c | 4 ++-- c_src/nif_helpers.h | 2 ++ c_src/sdl_texture.c | 3 +++ c_src/sdl_window.c | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/c_src/nif_helpers.c b/c_src/nif_helpers.c index d76f1b5..54fb85f 100644 --- a/c_src/nif_helpers.c +++ b/c_src/nif_helpers.c @@ -16,8 +16,8 @@ #include #include -extern atom_ok; -extern atom__nif_thread_ret_; +extern ERL_NIF_TERM atom_ok; +extern ERL_NIF_TERM atom__nif_thread_ret_; typedef struct nif_thread_message { TAILQ_ENTRY(nif_thread_message) next_entry; diff --git a/c_src/nif_helpers.h b/c_src/nif_helpers.h index c1d4131..3af147b 100644 --- a/c_src/nif_helpers.h +++ b/c_src/nif_helpers.h @@ -105,6 +105,7 @@ \ return 0; \ } +#define NIF_ATOM_TO_ENUM_FUNCTION_DECL(f, type) int f(ErlNifEnv*, ERL_NIF_TERM, type*); #define NIF_ENUM_TO_ATOM(a, e) if (id == e) return atom_ ## a; #define NIF_ENUM_TO_ATOM_FUNCTION(f, type, enum_list) \ @@ -113,6 +114,7 @@ enum_list(NIF_ENUM_TO_ATOM) \ return atom_undefined; \ } +#define NIF_ENUM_TO_ATOM_FUNCTION_DECL(f, type) ERL_NIF_TERM f(type); // Threaded NIFs. diff --git a/c_src/sdl_texture.c b/c_src/sdl_texture.c index 2179a09..b3d2198 100644 --- a/c_src/sdl_texture.c +++ b/c_src/sdl_texture.c @@ -14,6 +14,9 @@ #include "esdl2.h" +NIF_ATOM_TO_ENUM_FUNCTION_DECL(atom_to_blend_mode, SDL_BlendMode) +NIF_ENUM_TO_ATOM_FUNCTION_DECL(blend_mode_to_atom, SDL_BlendMode) + void dtor_Texture(ErlNifEnv* env, void* obj) { SDL_DestroyTexture(NIF_RES_GET(Texture, obj)); diff --git a/c_src/sdl_window.c b/c_src/sdl_window.c index c644c09..4989ba5 100644 --- a/c_src/sdl_window.c +++ b/c_src/sdl_window.c @@ -14,6 +14,8 @@ #include "esdl2.h" +NIF_ATOM_TO_ENUM_FUNCTION_DECL(atom_to_bool, SDL_bool) + void dtor_Window(ErlNifEnv* env, void* obj) { SDL_DestroyWindow(NIF_RES_GET(Window, obj)); -- cgit v1.2.3