[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] svn patch for windows



Hi,

thought I'd checkout out Pygame-1.8 svn. Had fun (not) finding the
Microsoft compiler for Python-2.4 and above (eventually found it on a
backup I had from ages back). 

Then spent a while building all the dependencies to use 'msvcr71.dll'.

I documented what I got up to here:
http://johnnypops.demon.co.uk/pygame/index.html

Anyway. To get PyGame to build I had to fix a couple of glitches:

Index: src/overlay.c
===================================================================
--- src/overlay.c	(revision 965)
+++ src/overlay.c	(working copy)
@@ -78,13 +78,13 @@
 
     if(src_y)
 	{
-		void *dst_y=0, *dst_u=0, *dst_v=0;
+		Uint8 *dst_y=0, *dst_u=0, *dst_v=0;
 		SDL_LockYUVOverlay( self->cOverlay );
 
 		// No clipping at this time( only support for YUV420 )
-		dst_y = (void*)self->cOverlay->pixels[ 0 ];
-		dst_v = (void*)self->cOverlay->pixels[ 1 ];
-		dst_u = (void*)self->cOverlay->pixels[ 2 ];
+		dst_y = self->cOverlay->pixels[ 0 ];
+		dst_v = self->cOverlay->pixels[ 1 ];
+		dst_u = self->cOverlay->pixels[ 2 ];
 		for (y=0; y< self->cOverlay->h; y++)
 		{
 			memcpy( dst_y, src_y, self->cOverlay->w );


This stops compile errors later on when arithmetic is performed on the dst_y,
dst_u and dst_v pointers.


Index: src/scrap.c
===================================================================
--- src/scrap.c	(revision 965)
+++ src/scrap.c	(working copy)
@@ -376,11 +376,11 @@
 
 #elif defined(WIN_SCRAP)
         SDL_Window = info.window;
-        retval = 1
+        retval = 1;
 
 #elif defined(QNX_SCRAP)
         InputGroup = PhInputGroup (NULL);
-        retval = 1
+        retval = 1;
 
 #endif /* scrap type */
     }
@@ -422,6 +422,9 @@
 {
     scrap_type format;
     int nulledlen = srclen + 1;
+#if defined(WIN_SCRAP)
+    HANDLE hMem;
+#endif
 
     if (!pygame_scrap_initialized ())
     {
@@ -465,8 +468,6 @@
     Unlock_Display ();
 
 #elif defined(WIN_SCRAP)
-    HANDLE hMem;
-    
     if (!OpenClipboard (SDL_Window))
         return 0; /* Could not open the clipboard. */

     
This fixes some typos and a variable declaration (is there a compiler
compatibility switch to prevent this nonsense?).


Index: src/imageext.c
===================================================================
--- src/imageext.c	(revision 965)
+++ src/imageext.c	(working copy)
@@ -488,7 +488,7 @@
                           ) {
 #ifdef JPEGLIB_H
 		    result = SaveJPEG(surf, name);
-#elif
+#else
                     return RAISE(PyExc_SDLError, "No support for jpg compiled in.");
 #endif
 
@@ -496,7 +496,7 @@
                 else if(name[namelen-1]=='g' || name[namelen-1]=='G') {
 #ifdef PNG_H
 		    result = SavePNG(surf, name);
-#elif
+#else
                     return RAISE(PyExc_SDLError, "No support for png compiled in.");
 #endif
                 }


I found these whilst fiddling about with libpng linkage.


Index: src/image.c
===================================================================
--- src/image.c	(revision 965)
+++ src/image.c	(working copy)
@@ -1011,6 +1011,7 @@
 		Py_INCREF(extsave);
 		Py_INCREF(extload);
 		is_extended = 1;
+		Py_DECREF(extmodule);
 	}
 	else
 	{

I'm not certain about this one. I was looking through the code whilst
trying to find out why it crashed when importing imageext (libpng/Py2exe
problems).

Looking forward to the 1.8 release,

regards,
John.