Page 1 of 1

fis some warnings, round 2

Posted: Sun Apr 27, 2014 1:26 pm
by lifanov
This fixes some more warnings: -Wreturn-type, -Wswitch, -Wparentheses-equality, and one instance of -Wpointer-sign.
Add return values to non-void functions, add an unhandled switch case, remove extraneous parentheses, and fix a cast.

I play-tested this set of changes for a while.

Code: Select all

diff --git a/src/core_lua.c b/src/core_lua.c
index b5047a9..beb532a 100644
--- a/src/core_lua.c
+++ b/src/core_lua.c
@@ -849,6 +849,7 @@ static font_make_texture_line(lua_State *L, SDL_Surface *s, int id, bool is_sepa
        }
 
        lua_rawseti(L, -2, id);
+       return 1;
 }
 
 extern GLint max_texture_size;
@@ -1018,7 +1019,7 @@ static int sdl_font_draw(lua_State *L)
                                        }
                                }
                                // Extra data
-                               else if ((*(next+1) == '&')) {
+                               else if (*(next+1) == '&') {                                        line_data = next + 2;
                                        line_data_size = codestop - (next+2);
                                }
diff --git a/src/map.c b/src/map.c
index 5202556..eb041a0 100644
--- a/src/map.c
+++ b/src/map.c
@@ -57,6 +57,8 @@ static int lua_is_hex(lua_State *L)
                lua_settable(L, LUA_REGISTRYINDEX);
                lua_pushnumber(L, 0);
        }
+
+       return 1;
 }
 
 static int map_object_new(lua_State *L)
diff --git a/src/music.c b/src/music.c
index e8b137f..4f3a60d 100644
--- a/src/music.c
+++ b/src/music.c
@@ -76,7 +76,7 @@ void openal_get_devices()
        char *defaultDevice=NULL;
        char *deviceList=NULL;
 
-       if (alcIsExtensionPresent(NULL, (ALubyte*)"ALC_ENUMERATION_EXT") == AL_TRUE)
+       if (alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT") == AL_TRUE)
        { // try out enumeration extension
                deviceList = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER);
 
diff --git a/src/web.c b/src/web.c
index 6dcef3f..00d9a17 100644
--- a/src/web.c
+++ b/src/web.c
@@ -369,6 +369,9 @@ static void handle_event(WebEvent *event) {
                                lua_pop(he_L, 1);
                        }
                        break;
+
+               case TE4_WEB_EVENT_DELETE_TEXTURE:
+                       break;
        }
 }
 

Re: fis some warnings, round 2

Posted: Sun Apr 27, 2014 3:39 pm
by darkgod
fixed thanks

Re: fis some warnings, round 2

Posted: Sun Apr 27, 2014 6:19 pm
by lifanov
Thanks!