lib: fix C compiler warnings in sha1, socket and sdl
authorAlexis Laferrière <alexis.laf@xymus.net>
Tue, 9 Jun 2015 15:24:32 +0000 (11:24 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 9 Jun 2015 16:56:19 +0000 (12:56 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/sdl.nit
lib/sha1.nit
lib/socket/socket_c.nit

index c5e1ec9..db0f700 100644 (file)
@@ -164,13 +164,13 @@ extern class SDLDisplay `{SDL_Surface *`}
        fun show_cursor=(val: Bool) `{ SDL_ShowCursor(val? SDL_ENABLE: SDL_DISABLE); `}
 
        # Is the cursor visible?
-       fun show_cursor: Bool `{ SDL_ShowCursor(SDL_QUERY); `}
+       fun show_cursor: Bool `{ return SDL_ShowCursor(SDL_QUERY); `}
 
        # Grab or release the input
        fun grab_input=(val: Bool) `{ SDL_WM_GrabInput(val? SDL_GRAB_ON: SDL_GRAB_OFF); `}
 
        # Is the input grabbed?
-       fun grab_input: Bool `{ SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON; `}
+       fun grab_input: Bool `{ return SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON; `}
 
        # Are instances of `SDLMouseMotionEvent` ignored?
        fun ignore_mouse_motion_events: Bool `{
index eea4c03..8a5acc9 100644 (file)
@@ -231,7 +231,6 @@ redef class String
        #     import base64
        #     assert "The quick brown fox jumps over the lazy dog".sha1.encode_base64 == "L9ThxnotKPzthJ7hu3bnORuT6xI="
        fun sha1: String import String.to_cstring, String.length, NativeString.to_s_with_length `{
-               uint32_t a;
                sha1nfo s;
 
                sha1_init(&s);
@@ -254,7 +253,6 @@ redef class String
        #
        #     assert "The quick brown fox jumps over the lazy dog".sha1_to_s == "2FD4E1C67A2D28FCED849EE1BB76E7391B93EB12"
        fun sha1_to_s: String import String.to_cstring, String.length, NativeString.to_s_with_length `{
-               uint32_t a;
                sha1nfo s;
 
                sha1_init(&s);
index 94eecd7..03d9ddc 100644 (file)
@@ -332,7 +332,9 @@ class NativeSocketObserver
        # are boxed objects, passing them to a C function is illegal.
        fun select(max: NativeSocket, reads: nullable NativeSocketSet, write: nullable NativeSocketSet,
                         except: nullable NativeSocketSet, timeout: NativeTimeval): Int `{
-               fd_set *rds, *wts, *exs = NULL;
+               fd_set *rds = NULL,
+                      *wts = NULL,
+                      *exs = NULL;
                struct timeval *tm = NULL;
                if (reads != NULL) rds = (fd_set*)reads;
                if (write != NULL) wts = (fd_set*)write;