Commits

illume committed 05346fb

Some cleanups from Marcus to stop compiler warnings.

I also removed a _GNU_SOURCE define since python already specifies it,
and it was causing warnings on my debian. Changed overlay.c to remove
another warning with PyMethodDef Overlay_methods.

Comments (0)

Files changed (20)

 SMPEG = -lsmpeg
 PNG = -lpng
 JPEG = -ljpeg
-NUMERIC = -I/usr/include/python2.0/Numeric
+NUMERIC = -I/usr/include/python2.4/Numeric
 X11 = -lX11
 #--EndConfig
 
-DEBUG = -C-W -C-Wall
+#DEBUG = -C-W -C-Wall
+DEBUG = 
 
 #the following modules are optional. you will want to compile
 #everything you can, but you can ignore ones you don't have
         try:
             config = os.popen(command + ' --version --cflags --libs').readlines()
             flags = string.split(string.join(config[1:], ' '))
+
+            # remove this GNU_SOURCE if there... since python has it already,
+            #   it causes a warning.
+            if '-D_GNU_SOURCE=1' in flags:
+                flags.remove('-D_GNU_SOURCE=1')
             self.ver = string.strip(config[0])
             if minver and self.ver < minver:
                 err= 'WARNING: requires %s version %s (%s found)' % (self.name, self.ver, minver)
 	{ "get_sdl_version", get_sdl_version, 1, DOC_PYGAMEGETSDLVERSION },
 
 	{ "segfault", do_segfault, 1, "crash" },
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 	{ "get_track_length", cd_get_track_length, 1, DOC_CDGETTRACKLENGTH },
 	{ "get_track_start", cd_get_track_start, 1, DOC_CDGETTRACKSTART },
 
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 static PyObject* cd_getattr(PyObject* self, char* attrname)
 	{ "get_init", get_init, 1, DOC_PYGAMECDROMGETINIT },
 	{ "get_count", get_count, 1, DOC_PYGAMECDROMGETCOUNT },
 	{ "CD", CD, 1, DOC_PYGAMECDROMCD },
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 	{ "gl_get_attribute", gl_get_attribute, 1, DOC_PYGAMEDISPLAYGLGETATTRIBUTE },
 
 
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 	{ "polygon", polygon, 1, DOC_PYGAMEDRAWPOLYGON },
 	{ "rect", rect, 1, DOC_PYGAMEDRAWRECT },
 
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 	{ "set_blocked", set_blocked, 1, DOC_PYGAMEEVENTSETBLOCKED },
 	{ "get_blocked", get_blocked, 1, DOC_PYGAMEEVENTGETBLOCKED },
 
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 }
 
 
-    /*DOC*/ static char doc_post[] =
-    /*DOC*/    "pygame.fastevent.post(Event) -> None\n"
-    /*DOC*/    "place an event on the queue\n"
-    /*DOC*/    "\n"
-    /*DOC*/    "This will post your own event objects onto the event queue.\n"
-    /*DOC*/    "You can past any event type you want, but some care must be\n"
-    /*DOC*/    "taken. For example, if you post a MOUSEBUTTONDOWN event to the\n"
-    /*DOC*/    "queue, it is likely any code receiving the event will expect\n"
-    /*DOC*/    "the standard MOUSEBUTTONDOWN attributes to be available, like\n"
-    /*DOC*/    "'pos' and 'button'.\n"
-    /*DOC*/    "\n"
-    /*DOC*/    "Because pygame.fastevent.post() may have to wait for the queue\n"
-	/*DOC*/    "to empty, you can get into a dead lock if you try to append an\n"
-	/*DOC*/    "event on to a full queue from the thread that processes events.\n"
-	/*DOC*/    "For that reason I do not recommend using this function in the\n"
-	/*DOC*/    "main thread of an SDL program.\n"
-    /*DOC*/ ;
+/*DOC*/ static char doc_post[] =
+/*DOC*/    "pygame.fastevent.post(Event) -> None\n"
+/*DOC*/    "place an event on the queue\n"
+/*DOC*/    "\n"
+/*DOC*/    "This will post your own event objects onto the event queue.\n"
+/*DOC*/    "You can past any event type you want, but some care must be\n"
+/*DOC*/    "taken. For example, if you post a MOUSEBUTTONDOWN event to the\n"
+/*DOC*/    "queue, it is likely any code receiving the event will expect\n"
+/*DOC*/    "the standard MOUSEBUTTONDOWN attributes to be available, like\n"
+/*DOC*/    "'pos' and 'button'.\n"
+/*DOC*/    "\n"
+/*DOC*/    "Because pygame.fastevent.post() may have to wait for the queue\n"
+/*DOC*/    "to empty, you can get into a dead lock if you try to append an\n"
+/*DOC*/    "event on to a full queue from the thread that processes events.\n"
+/*DOC*/    "For that reason I do not recommend using this function in the\n"
+/*DOC*/    "main thread of an SDL program.\n"
+/*DOC*/ ;
 
 static PyObject* fastevent_post(PyObject* self, PyObject* args)
 {
 	{ "poll", fastevent_poll, 1, doc_poll },
 	{ "post", fastevent_post, 1, doc_post },
 
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 
-    /*DOC*/ static char doc_fastevent_MODULE[] =
-    /*DOC*/    "pygame.fastevent is a wrapper for Bob Pendleton's fastevent\n"
-	/*DOC*/    "library.  It provides fast events for use in multithreaded\n"
-	/*DOC*/    "environments.  When using pygame.fastevent, you can not use\n"
-	/*DOC*/    "any of the pump, wait, poll, post, get, peek, etc. functions\n"
-	/*DOC*/    "from pygame.event, but you should use the Event objects.\n"
-    /*DOC*/ ;
+/*DOC*/ static char doc_fastevent_MODULE[] =
+/*DOC*/    "pygame.fastevent is a wrapper for Bob Pendleton's fastevent\n"
+/*DOC*/    "library.  It provides fast events for use in multithreaded\n"
+/*DOC*/    "environments.  When using pygame.fastevent, you can not use\n"
+/*DOC*/    "any of the pump, wait, poll, post, get, peek, etc. functions\n"
+/*DOC*/    "from pygame.event, but you should use the Event objects.\n"
+/*DOC*/;
 
 PYGAME_EXPORT
 void initfastevent(void)
 	{ "fromstring", image_fromstring, 1, DOC_PYGAMEIMAGEFROMSTRING },
 	{ "frombuffer", image_frombuffer, 1, DOC_PYGAMEIMAGEFROMBUFFER },
 
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 {
 	{ "load_extended", image_load_ext, 1, DOC_PYGAMEIMAGE },
 	{ "save_extended", image_save_ext, 1, DOC_PYGAMEIMAGE },
-
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 	{ "get_numhats", joy_get_numhats, 1, DOC_JOYSTICKGETNUMHATS },
 	{ "get_hat", joy_get_hat, 1, DOC_JOYSTICKGETHAT },
 
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 static PyObject* joy_getattr(PyObject* self, char* attrname)
 	{ "get_init", get_init, 1, DOC_PYGAMEJOYSTICKGETINIT },
 	{ "get_count", get_count, 1, DOC_PYGAMEJOYSTICKGETCOUNT },
 	{ "Joystick", Joystick, 1, DOC_PYGAMEJOYSTICKJOYSTICK },
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 	{ "set_mods", key_set_mods, 1, DOC_PYGAMEKEYSETMODS },
 	{ "get_focused", key_get_focused, 1, DOC_PYGAMEKEYGETFOCUSED },
 
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 	{ "set_endevent", chan_set_endevent, 1, DOC_CHANNELSETENDEVENT },
 	{ "get_endevent", chan_get_endevent, 1, DOC_CHANNELGETENDEVENT },
 
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 	{ "unpause", mixer_unpause, 1, DOC_PYGAMEMIXERUNPAUSE },
 /*	{ "lookup_frequency", lookup_frequency, 1, doc_lookup_frequency },*/
 
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 	{ "set_cursor", mouse_set_cursor, 1, DOC_PYGAMEMOUSESETCURSOR },
 	{ "get_cursor", mouse_get_cursor, 1, DOC_PYGAMEMOUSEGETCURSOR },
 
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 
 static PyMethodDef movie_builtins[] =
 {
-	{ "play", movie_play, 1, DOC_MOVIEPLAY },
-	{ "stop", movie_stop, 1, DOC_MOVIESTOP },
-	{ "pause", movie_pause, 1, DOC_MOVIEPAUSE },
-	{ "rewind", movie_rewind, 1, DOC_MOVIEREWIND },
-	{ "skip", movie_skip, 1, DOC_MOVIESKIP },
-
-	{ "set_volume", movie_set_volume, 1, DOC_MOVIESETVOLUME },
-	{ "set_display", movie_set_display, 1, DOC_MOVIESETDISPLAY },
-
-	{ "has_video", movie_has_video, 1, DOC_MOVIEHASVIDEO },
-	{ "has_audio", movie_has_audio, 1, DOC_MOVIEHASAUDIO },
-	{ "get_size", movie_get_size, 1, DOC_MOVIEGETSIZE },
-	{ "get_frame", movie_get_frame, 1, DOC_MOVIEGETFRAME },
-	{ "get_time", movie_get_time, 1, DOC_MOVIEGETTIME },
-	{ "get_length", movie_get_length, 1, DOC_MOVIEGETLENGTH },
-	{ "get_busy", movie_get_busy, 1, DOC_MOVIEGETBUSY },
+    { "play", movie_play, 1, DOC_MOVIEPLAY },
+    { "stop", movie_stop, 1, DOC_MOVIESTOP },
+    { "pause", movie_pause, 1, DOC_MOVIEPAUSE },
+    { "rewind", movie_rewind, 1, DOC_MOVIEREWIND },
+    { "skip", movie_skip, 1, DOC_MOVIESKIP },
+    
+    { "set_volume", movie_set_volume, 1, DOC_MOVIESETVOLUME },
+    { "set_display", movie_set_display, 1, DOC_MOVIESETDISPLAY },
+    
+    { "has_video", movie_has_video, 1, DOC_MOVIEHASVIDEO },
+    { "has_audio", movie_has_audio, 1, DOC_MOVIEHASAUDIO },
+    { "get_size", movie_get_size, 1, DOC_MOVIEGETSIZE },
+    { "get_frame", movie_get_frame, 1, DOC_MOVIEGETFRAME },
+    { "get_time", movie_get_time, 1, DOC_MOVIEGETTIME },
+    { "get_length", movie_get_length, 1, DOC_MOVIEGETLENGTH },
+    { "get_busy", movie_get_busy, 1, DOC_MOVIEGETBUSY },
     { "render_frame", movie_render_frame, 1, DOC_MOVIERENDERFRAME },
 
-	{ NULL, NULL }
+    { NULL, NULL, 0, NULL }
 };
 
 
 static PyMethodDef mixer_builtins[] =
 {
 	{ "Movie", Movie, 1, DOC_PYGAMEMOVIEMOVIE },
-
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
 	{ "load", music_load, 1, DOC_PYGAMEMIXERMUSICLOAD },
 	{ "queue", music_queue, 1, DOC_PYGAMEMIXERMUSICQUEUE },
 
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };
 
 
   {"set_location", (PyCFunction)Overlay_SetLocation, METH_VARARGS, DOC_OVERLAYSETLOCATION},
   {"display", (PyCFunction)Overlay_Display, METH_VARARGS, DOC_OVERLAYDISPLAY},
   {"get_hardware", (PyCFunction)Overlay_GetHardware, METH_NOARGS, DOC_OVERLAYGETHARDWARE},
-	{NULL}  /* Sentinel */
+  {NULL, NULL, 0, NULL}  /* Sentinel */
 };
 
 
 
 static PyMethodDef overlay_methods[] =
 {
-	{ NULL, NULL }
+    { NULL, NULL, 0, NULL }
 };
 
 
 
 static struct PyMethodDef rect_methods[] =
 {
-	{"normalize",		(PyCFunction)rect_normalize,	1, DOC_RECTNORMALIZE},
-	{"clip",			(PyCFunction)rect_clip, 		1, DOC_RECTCLIP},
-	{"clamp",			(PyCFunction)rect_clamp,		1, DOC_RECTCLAMP},
-	{"clamp_ip",		(PyCFunction)rect_clamp_ip,1, DOC_RECTCLAMPIP },
-	{"fit",			    (PyCFunction)rect_fit,		1, DOC_RECTFIT},
-
-	{"move",			(PyCFunction)rect_move, 		1, DOC_RECTMOVE},
-	{"inflate",			(PyCFunction)rect_inflate,		1, DOC_RECTINFLATE},
-	{"union",			(PyCFunction)rect_union,		1, DOC_RECTUNION},
-	{"unionall",		(PyCFunction)rect_unionall,		1, DOC_RECTUNIONALL},
-
-	{"move_ip",			(PyCFunction)rect_move_ip,		1, DOC_RECTMOVEIP},
-	{"inflate_ip",		(PyCFunction)rect_inflate_ip,	1, DOC_RECTINFLATEIP},
-	{"union_ip",		(PyCFunction)rect_union_ip,		1, DOC_RECTUNIONIP},
-	{"unionall_ip", 	(PyCFunction)rect_unionall_ip,	1, DOC_RECTUNIONALLIP},
-
-	{"collidepoint",	(PyCFunction)rect_collidepoint, 1, DOC_RECTCOLLIDEPOINT},
-	{"colliderect", 	(PyCFunction)rect_colliderect,	1, DOC_RECTCOLLIDERECT},
-	{"collidelist", 	(PyCFunction)rect_collidelist,	1, DOC_RECTCOLLIDELIST},
-	{"collidelistall",	(PyCFunction)rect_collidelistall,1,DOC_RECTCOLLIDELISTALL},
-	{"collidedict", 	(PyCFunction)rect_collidedict,	1, DOC_RECTCOLLIDEDICT},
-	{"collidedictall",	(PyCFunction)rect_collidedictall,1,DOC_RECTCOLLIDEDICTALL},
-	{"contains",		(PyCFunction)rect_contains,		1, DOC_RECTCONTAINS},
-
-        {"__reduce__",          (PyCFunction)rect_reduce, 0, NULL},
-        {"__copy__",            (PyCFunction)rect_copy, 0, NULL},
-
-	{NULL,		NULL}
+    {"normalize", (PyCFunction)rect_normalize, 1, DOC_RECTNORMALIZE},
+    {"clip", (PyCFunction)rect_clip, 1, DOC_RECTCLIP},
+    {"clamp", (PyCFunction)rect_clamp, 1, DOC_RECTCLAMP},
+    {"clamp_ip", (PyCFunction)rect_clamp_ip, 1, DOC_RECTCLAMPIP },
+    {"fit", (PyCFunction)rect_fit, 1, DOC_RECTFIT},
+    {"move", (PyCFunction)rect_move, 1, DOC_RECTMOVE},
+    {"inflate", (PyCFunction)rect_inflate, 1, DOC_RECTINFLATE},
+    {"union", (PyCFunction)rect_union, 1, DOC_RECTUNION},
+    {"unionall", (PyCFunction)rect_unionall, 1, DOC_RECTUNIONALL},
+    {"move_ip", (PyCFunction)rect_move_ip, 1, DOC_RECTMOVEIP},
+    {"inflate_ip", (PyCFunction)rect_inflate_ip, 1, DOC_RECTINFLATEIP},
+    {"union_ip", (PyCFunction)rect_union_ip, 1, DOC_RECTUNIONIP},
+    {"unionall_ip", (PyCFunction)rect_unionall_ip, 1, DOC_RECTUNIONALLIP},
+    {"collidepoint", (PyCFunction)rect_collidepoint, 1, DOC_RECTCOLLIDEPOINT},
+    {"colliderect", (PyCFunction)rect_colliderect, 1, DOC_RECTCOLLIDERECT},
+    {"collidelist", (PyCFunction)rect_collidelist, 1, DOC_RECTCOLLIDELIST},
+    {"collidelistall", (PyCFunction)rect_collidelistall, 1,
+     DOC_RECTCOLLIDELISTALL},
+    {"collidedict", (PyCFunction)rect_collidedict, 1, DOC_RECTCOLLIDEDICT},
+    {"collidedictall", (PyCFunction)rect_collidedictall, 1,
+     DOC_RECTCOLLIDEDICTALL},
+    {"contains", (PyCFunction)rect_contains, 1, DOC_RECTCONTAINS},
+    {"__reduce__", (PyCFunction)rect_reduce, 0, NULL},
+    {"__copy__", (PyCFunction)rect_copy, 0, NULL},
+    { NULL, NULL, 0, NULL }
 };
 
-
-
-
 /* sequence functions */
 
 static int rect_length(PyRectObject *self)
     {"center", (getter)rect_getcenter, (setter)rect_setcenter, NULL, NULL},
 
     {"__safe_for_unpickling__", (getter)rect_getsafepickle, NULL, NULL, NULL},
-    {NULL}  /* Sentinel */
+    {NULL, 0, NULL, NULL, NULL}  /* Sentinel */
 };
 
 
 
 static PyMethodDef rect__builtins__[] =
 {
-	{NULL, NULL}
+    {NULL, NULL, 0, NULL}
 };
 
 
 _clipboard_filter (const SDL_Event *event)
 {
     PyObject *dict = NULL;
-    Time timestamp;
+    Time timestamp = CurrentTime;
 
     /* Post all non-window manager specific events */
     if (event->type != SDL_SYSWMEVENT)
 {
     Atom clip;
     Atom cliptype;
-    Time timestamp;
+    Time timestamp = CurrentTime;
     time_t start;
     XEvent ev;
 
 	{ "chop", surf_chop, 1, DOC_PYGAMETRANSFORMCHOP },
 	{ "scale2x", surf_scale2x, 1, DOC_PYGAMETRANSFORMSCALE2X },
 		
-	{ NULL, NULL }
+	{ NULL, NULL, 0, NULL }
 };