Commits

Lenard Lindstrom  committed 04fa64a

Remove some compiler warnings

  • Participants
  • Parent commits 63d0c0d

Comments (0)

Files changed (3)

File src/imageext.c

 {
     /*we need to get ahold of the pyopengl glReadPixels function*/
     /*we use pyopengl's so we don't need to link with opengl at compiletime*/
-    PyObject *pyopengl, *readpixels = NULL;
-    int typeflag=0, formatflag=0;
-    SDL_Surface *surf;
+    SDL_Surface *surf = NULL;
     Uint32 rmask, gmask, bmask;
     int i;
-    unsigned char *pixels;
+    unsigned char *pixels = NULL;
 
     GL_glReadPixels_Func p_glReadPixels= NULL;
-    pixels = NULL;
-    surf = NULL;
 
-    p_glReadPixels = (GL_glReadPixels_Func) SDL_GL_GetProcAddress("glReadPixels"); 
+    p_glReadPixels = (GL_glReadPixels_Func) SDL_GL_GetProcAddress ("glReadPixels"); 
 
     surf = SDL_GetVideoSurface ();
 
         return NULL;
     }
 
-    pixels = (unsigned char*) malloc(surf->w * surf->h * 3);
+    pixels = (unsigned char*) malloc (surf->w * surf->h * 3);
 
     if(!pixels) {
         RAISE (PyExc_MemoryError, "Cannot allocate enough memory for pixels.");
     }
 
     /* GL_RGB, GL_UNSIGNED_BYTE */
-    p_glReadPixels(0, 0, surf->w, surf->h, 0x1907, 0x1401, pixels);
+    p_glReadPixels (0, 0, surf->w, surf->h, 0x1907, 0x1401, pixels);
 
     if (SDL_BYTEORDER == SDL_LIL_ENDIAN) {
         rmask=0x000000FF;
     surf = SDL_CreateRGBSurface (SDL_SWSURFACE, surf->w, surf->h, 24,
                                  rmask, gmask, bmask, 0);
     if (!surf) {
-        free(pixels);
+        free (pixels);
         RAISE (PyExc_SDLError, SDL_GetError ());
         return NULL;
     }
     }
 
 
-    free(pixels);
+    free (pixels);
     return surf;
 }
 
 /* sequence functions */
 
 static Py_ssize_t
-rect_length (PyRectObject *self)
+rect_length (PyObject *_self)
 {
     return 4;
 }

File src/surface.c

     int x, y;
     Uint32 color;
     Uint8 rgba[4] = {0, 0, 0, 0 };
-    PyObject *rgba_obj, *intobj;
+    PyObject *rgba_obj;
     Uint8 *byte_buf;
 
     if (!PyArg_ParseTuple (args, "(ii)O", &x, &y, &rgba_obj))
 
     char *kwids[] = { "min_alpha", NULL };
     if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i", kwids, &min_alpha))
-       return RAISE (PyExc_ValueError, "get_bounding_rect only accepts a single optional min_alpha argument");
+       return RAISE (PyExc_ValueError,
+                     "get_bounding_rect only accepts a single optional min_alpha argument");
     
     if (!surf)
         return RAISE (PyExc_SDLError, "display Surface quit");
     if (surf->flags & SDL_SRCCOLORKEY)
     {
         has_colorkey = 1;
-        SDL_GetRGBA (surf->format->colorkey, surf->format, &keyr, &keyg, &keyb, &a);
+        SDL_GetRGBA (surf->format->colorkey,
+                     surf->format,
+                     &keyr, &keyg, &keyb, &a);
     }
     
     pixels = (Uint8 *) surf->pixels;
         {
             pixel = (pixels + y * surf->pitch) + x*format->BytesPerPixel;
             SDL_GetRGBA (*((Uint32*)pixel), surf->format, &r, &g, &b, &a);
-            if (a >= min_alpha && has_colorkey == 0
-                || (has_colorkey != 0 && (r != keyr || g != keyg || b != keyb)))
+            if ((a >= min_alpha && has_colorkey == 0) ||
+                (has_colorkey != 0 && (r != keyr || g != keyg || b != keyb)))
             {
                 found_alpha = 1;
                 break;
         {
             pixel = (pixels + y * surf->pitch) + x*format->BytesPerPixel;
             SDL_GetRGBA (*((Uint32*)pixel), surf->format, &r, &g, &b, &a);
-            if (a >= min_alpha && has_colorkey == 0
-                || (has_colorkey != 0 && (r != keyr || g != keyg || b != keyb)))
+            if ((a >= min_alpha && has_colorkey == 0) ||
+                (has_colorkey != 0 && (r != keyr || g != keyg || b != keyb)))
             {
                 found_alpha = 1;
                 break;
         {
             pixel = (pixels + y * surf->pitch) + x*format->BytesPerPixel;
             SDL_GetRGBA (*((Uint32*)pixel), surf->format, &r, &g, &b, &a);
-            if (a >= min_alpha && has_colorkey == 0
-                || (has_colorkey != 0 && (r != keyr || g != keyg || b != keyb)))
+            if ((a >= min_alpha && has_colorkey == 0) ||
+                (has_colorkey != 0 && (r != keyr || g != keyg || b != keyb)))
             {
                 found_alpha = 1;
                 break;
         {
             pixel = (pixels + y * surf->pitch) + x*format->BytesPerPixel;
             SDL_GetRGBA (*((Uint32*)pixel), surf->format, &r, &g, &b, &a);
-            if (a >= min_alpha && has_colorkey == 0
-                || (has_colorkey != 0 && (r != keyr || g != keyg || b != keyb)))
+            if ((a >= min_alpha && has_colorkey == 0) ||
+                (has_colorkey != 0 && (r != keyr || g != keyg || b != keyb)))
             {
                 found_alpha = 1;
                 break;
     PyObject *buffer;
     PyObject *lock;
     SDL_Surface *surface = PySurface_AsSurface (self);
-    SDL_PixelFormat *format = surface->format;
     Py_ssize_t length;
 
     length = (Py_ssize_t) surface->pitch * surface->h;