changeset 1428:5f52867ba65c

Update for Visual C++ 6.0
author Sam Lantinga <slouken@libsdl.org>
date Fri, 24 Feb 2006 18:24:57 +0000
parents 5f5a74d29d18
children aff0170f9f1b
files VisualC.zip include/SDL_config_win32.h src/audio/SDL_audiocvt.c src/audio/SDL_wave.c src/video/SDL_RLEaccel.c src/video/SDL_blit_A.c src/video/SDL_blit_N.c src/video/SDL_cursor.c src/video/SDL_surface.c src/video/SDL_video.c src/video/SDL_yuv_sw.c src/video/wincommon/SDL_sysevents.c
diffstat 12 files changed, 91 insertions(+), 98 deletions(-) [+]
line wrap: on
line diff
Binary file VisualC.zip has changed
--- a/include/SDL_config_win32.h	Fri Feb 24 17:03:06 2006 +0000
+++ b/include/SDL_config_win32.h	Fri Feb 24 18:24:57 2006 +0000
@@ -34,6 +34,9 @@
 typedef unsigned __int32	uint32_t;
 typedef __int64			int64_t;
 typedef unsigned __int64	uint64_t;
+#if _MSC_VER <= 1200
+typedef unsigned long uintptr_t;
+#endif
 #endif
 #define SDL_HAS_64BIT_TYPE	1
 
--- a/src/audio/SDL_audiocvt.c	Fri Feb 24 17:03:06 2006 +0000
+++ b/src/audio/SDL_audiocvt.c	Fri Feb 24 18:24:57 2006 +0000
@@ -47,7 +47,7 @@
 				if ( sample > 255 ) {
 					*dst = 255;
 				} else {
-					*dst = sample;
+					*dst = (Uint8)sample;
 				}
 				src += 2;
 				dst += 1;
@@ -68,7 +68,7 @@
 				if ( sample < -128 ) {
 					*dst = -128;
 				} else {
-					*dst = sample;
+					*dst = (Sint8)sample;
 				}
 				src += 2;
 				dst += 1;
@@ -185,10 +185,8 @@
 			src = cvt->buf;
 			dst = cvt->buf;
 			for ( i=cvt->len_cvt/6; i; --i ) {
-				lsample = src[0];
-				rsample = src[1];
-				dst[0] = lsample;
-				dst[1] = rsample;
+				dst[0] = src[0];
+				dst[1] = src[1];
 				src += 6;
 				dst += 2;
 			}
@@ -201,10 +199,8 @@
 			src = (Sint8 *)cvt->buf;
 			dst = (Sint8 *)cvt->buf;
 			for ( i=cvt->len_cvt/6; i; --i ) {
-				lsample = src[0];
-				rsample = src[1];
-				dst[0] = lsample;
-				dst[1] = rsample;
+				dst[0] = src[0];
+				dst[1] = src[1];
 				src += 6;
 				dst += 2;
 			}
@@ -305,10 +301,8 @@
 			src = cvt->buf;
 			dst = cvt->buf;
 			for ( i=cvt->len_cvt/4; i; --i ) {
-				lsample = src[0];
-				rsample = src[1];
-				dst[0] = lsample;
-				dst[1] = rsample;
+				dst[0] = src[0];
+				dst[1] = src[1];
 				src += 4;
 				dst += 2;
 			}
@@ -321,10 +315,8 @@
 			src = (Sint8 *)cvt->buf;
 			dst = (Sint8 *)cvt->buf;
 			for ( i=cvt->len_cvt/4; i; --i ) {
-				lsample = src[0];
-				rsample = src[1];
-				dst[0] = lsample;
-				dst[1] = rsample;
+				dst[0] = src[0];
+				dst[1] = src[1];
 				src += 4;
 				dst += 2;
 			}
--- a/src/audio/SDL_wave.c	Fri Feb 24 17:03:06 2006 +0000
+++ b/src/audio/SDL_wave.c	Fri Feb 24 18:24:57 2006 +0000
@@ -108,9 +108,9 @@
 	if ( delta < 16 ) {
 		delta = 16;
 	}
-	state->iDelta = delta;
+	state->iDelta = (Uint16)delta;
 	state->iSamp2 = state->iSamp1;
-	state->iSamp1 = new_sample;
+	state->iSamp1 = (Sint16)new_sample;
 	return(new_sample);
 }
 
@@ -371,8 +371,8 @@
 			}
 
 			/* Store the initial sample we start with */
-			decoded[0] = state[c].sample&0xFF;
-			decoded[1] = state[c].sample>>8;
+			decoded[0] = (Uint8)(state[c].sample&0xFF);
+			decoded[1] = (Uint8)(state[c].sample>>8);
 			decoded += 2;
 		}
 
--- a/src/video/SDL_RLEaccel.c	Fri Feb 24 17:03:06 2006 +0000
+++ b/src/video/SDL_RLEaccel.c	Fri Feb 24 18:24:57 2006 +0000
@@ -110,9 +110,9 @@
 #define PIXEL_COPY(to, from, len, bpp)			\
 do {							\
     if(bpp == 4) {					\
-	SDL_memcpy4(to, from, (unsigned)(len));		\
+	SDL_memcpy4(to, from, (size_t)(len));		\
     } else {						\
-	SDL_memcpy(to, from, (unsigned)(len) * (bpp));	\
+	SDL_memcpy(to, from, (size_t)(len) * (bpp));	\
     }							\
 } while(0)
 
@@ -423,7 +423,7 @@
 	    d = (d | d << 16) & 0x07e0f81f;		\
 	    d += (s - d) * ALPHA >> 5;			\
 	    d &= 0x07e0f81f;				\
-	    *dst++ = d | d >> 16;			\
+	    *dst++ = (Uint16)(d | d >> 16);			\
 	}						\
     } while(0)
 
@@ -440,7 +440,7 @@
 	    d = (d | d << 16) & 0x03e07c1f;		\
 	    d += (s - d) * ALPHA >> 5;			\
 	    d &= 0x03e07c1f;				\
-	    *dst++ = d | d >> 16;			\
+	    *dst++ = (Uint16)(d | d >> 16);			\
 	}						\
     } while(0)
 
@@ -482,17 +482,17 @@
 	    PIXEL_FROM_RGB(d, fmt, rd, gd, bd);				\
 	    switch(bpp) {						\
 	    case 2:							\
-		*(Uint16 *)dst = d;					\
+		*(Uint16 *)dst = (Uint16)d;					\
 		break;							\
 	    case 3:							\
 		if(SDL_BYTEORDER == SDL_BIG_ENDIAN) {			\
-		    dst[0] = d >> 16;					\
-		    dst[1] = d >> 8;					\
-		    dst[2] = d;						\
+		    dst[0] = (Uint8)(d >> 16);					\
+		    dst[1] = (Uint8)(d >> 8);					\
+		    dst[2] = (Uint8)(d);						\
 		} else {						\
-		    dst[0] = d;						\
-		    dst[1] = d >> 8;					\
-		    dst[2] = d >> 16;					\
+		    dst[0] = (Uint8)d;						\
+		    dst[1] = (Uint8)(d >> 8);					\
+		    dst[2] = (Uint8)(d >> 16);					\
 		}							\
 		break;							\
 	    case 4:							\
@@ -575,10 +575,10 @@
 /* helper: blend a single 16 bit pixel at 50% */
 #define BLEND16_50(dst, src, mask)			\
     do {						\
-        Uint32 s = *src++;				\
+	Uint32 s = *src++;				\
 	Uint32 d = *dst;				\
-	*dst++ = (((s & mask) + (d & mask)) >> 1)	\
-	         + (s & d & (~mask & 0xffff));		\
+	*dst++ = (Uint16)((((s & mask) + (d & mask)) >> 1) +	\
+	                  (s & d & (~mask & 0xffff)));		\
     } while(0)
 
 /* basic 16bpp blender. mask is the pixels to keep when adding. */
@@ -971,32 +971,32 @@
  */
 #define BLIT_TRANSL_565(src, dst)		\
     do {					\
-        Uint32 s = src;				\
+	Uint32 s = src;				\
 	Uint32 d = dst;				\
 	unsigned alpha = (s & 0x3e0) >> 5;	\
 	s &= 0x07e0f81f;			\
 	d = (d | d << 16) & 0x07e0f81f;		\
 	d += (s - d) * alpha >> 5;		\
 	d &= 0x07e0f81f;			\
-	dst = d | d >> 16;			\
+	dst = (Uint16)(d | d >> 16);			\
     } while(0)
 
 #define BLIT_TRANSL_555(src, dst)		\
     do {					\
-        Uint32 s = src;				\
+	Uint32 s = src;				\
 	Uint32 d = dst;				\
 	unsigned alpha = (s & 0x3e0) >> 5;	\
 	s &= 0x03e07c1f;			\
 	d = (d | d << 16) & 0x03e07c1f;		\
 	d += (s - d) * alpha >> 5;		\
 	d &= 0x03e07c1f;			\
-	dst = d | d >> 16;			\
+	dst = (Uint16)(d | d >> 16);			\
     } while(0)
 
 /* used to save the destination format in the encoding. Designed to be
    macro-compatible with SDL_PixelFormat but without the unneeded fields */
 typedef struct {
-    	Uint8  BytesPerPixel;
+	Uint8  BytesPerPixel;
 	Uint8  Rloss;
 	Uint8  Gloss;
 	Uint8  Bloss;
--- a/src/video/SDL_blit_A.c	Fri Feb 24 17:03:06 2006 +0000
+++ b/src/video/SDL_blit_A.c	Fri Feb 24 18:24:57 2006 +0000
@@ -1483,9 +1483,9 @@
 			if(w) {
 				Uint16 d = *dstp, s;
 				if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
-					s = prev_sw;
+					s = (Uint16)prev_sw;
 				else
-					s = prev_sw >> 16;
+					s = (Uint16)(prev_sw >> 16);
 				*dstp = BLEND16_50(d, s, mask);
 				srcp++;
 				dstp++;
@@ -1858,7 +1858,7 @@
 				d = (d | d << 16) & 0x07e0f81f;
 				d += (s - d) * alpha >> 5;
 				d &= 0x07e0f81f;
-				*dstp++ = d | d >> 16;
+				*dstp++ = (Uint16)(d | d >> 16);
 			}, width);
 			srcp += srcskip;
 			dstp += dstskip;
@@ -1894,7 +1894,7 @@
 				d = (d | d << 16) & 0x03e07c1f;
 				d += (s - d) * alpha >> 5;
 				d &= 0x03e07c1f;
-				*dstp++ = d | d >> 16;
+				*dstp++ = (Uint16)(d | d >> 16);
 			}, width);
 			srcp += srcskip;
 			dstp += dstskip;
@@ -1922,8 +1922,7 @@
 		   Benchmark this! */
 		if(alpha) {   
 		  if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
-		    *dstp = (s >> 8 & 0xf800) + (s >> 5 & 0x7e0)
-			  + (s >> 3  & 0x1f);
+		    *dstp = (Uint16)((s >> 8 & 0xf800) + (s >> 5 & 0x7e0) + (s >> 3  & 0x1f));
 		  } else {
 		    Uint32 d = *dstp;
 		    /*
@@ -1935,7 +1934,7 @@
 		    d = (d | d << 16) & 0x07e0f81f;
 		    d += (s - d) * alpha >> 5;
 		    d &= 0x07e0f81f;
-		    *dstp = d | d >> 16;
+		    *dstp = (Uint16)(d | d >> 16);
 		  }
 		}
 		srcp++;
@@ -1967,8 +1966,7 @@
 		   Benchmark this! */
 		if(alpha) {   
 		  if(alpha == (SDL_ALPHA_OPAQUE >> 3)) {
-		    *dstp = (s >> 9 & 0x7c00) + (s >> 6 & 0x3e0)
-			  + (s >> 3  & 0x1f);
+		    *dstp = (Uint16)((s >> 9 & 0x7c00) + (s >> 6 & 0x3e0) + (s >> 3  & 0x1f));
 		  } else {
 		    Uint32 d = *dstp;
 		    /*
@@ -1980,7 +1978,7 @@
 		    d = (d | d << 16) & 0x03e07c1f;
 		    d += (s - d) * alpha >> 5;
 		    d &= 0x03e07c1f;
-		    *dstp = d | d >> 16;
+		    *dstp = (Uint16)(d | d >> 16);
 		  }
 		}
 		srcp++;
--- a/src/video/SDL_blit_N.c	Fri Feb 24 17:03:06 2006 +0000
+++ b/src/video/SDL_blit_N.c	Fri Feb 24 18:24:57 2006 +0000
@@ -858,9 +858,9 @@
 
 /* Special optimized blit for RGB 8-8-8 --> RGB 3-3-2 */
 #define RGB888_RGB332(dst, src) { \
-	dst = (((src)&0x00E00000)>>16)| \
-	      (((src)&0x0000E000)>>11)| \
-	      (((src)&0x000000C0)>>6); \
+	dst = (Uint8)((((src)&0x00E00000)>>16)| \
+	              (((src)&0x0000E000)>>11)| \
+	              (((src)&0x000000C0)>>6)); \
 }
 static void Blit_RGB888_index8(SDL_BlitInfo *info)
 {
@@ -962,9 +962,9 @@
 }
 /* Special optimized blit for RGB 8-8-8 --> RGB 5-5-5 */
 #define RGB888_RGB555(dst, src) { \
-	*(Uint16 *)(dst) = (((*src)&0x00F80000)>>9)| \
-	                   (((*src)&0x0000F800)>>6)| \
-	                   (((*src)&0x000000F8)>>3); \
+	*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>9)| \
+	                            (((*src)&0x0000F800)>>6)| \
+	                            (((*src)&0x000000F8)>>3)); \
 }
 #define RGB888_RGB555_TWO(dst, src) { \
 	*(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>9)| \
@@ -1082,9 +1082,9 @@
 }
 /* Special optimized blit for RGB 8-8-8 --> RGB 5-6-5 */
 #define RGB888_RGB565(dst, src) { \
-	*(Uint16 *)(dst) = (((*src)&0x00F80000)>>8)| \
-	                   (((*src)&0x0000FC00)>>5)| \
-	                   (((*src)&0x000000F8)>>3); \
+	*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>8)| \
+	                            (((*src)&0x0000FC00)>>5)| \
+	                            (((*src)&0x000000F8)>>3)); \
 }
 #define RGB888_RGB565_TWO(dst, src) { \
 	*(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>8)| \
@@ -2101,7 +2101,7 @@
 	Uint32 rgbmask = ~srcfmt->Amask;
 	int srcbpp;
 	Uint32 Pixel;
-	Uint8  sR, sG, sB;
+	unsigned sR, sG, sB;
 
 	/* Set up some basic variables */
 	srcbpp = srcfmt->BytesPerPixel;
@@ -2115,9 +2115,9 @@
 								sR, sG, sB);
 				if ( (Pixel & rgbmask) != ckey ) {
 				  	/* Pack RGB into 8bit pixel */
-				  	*dst = ((sR>>5)<<(3+2))|
-						((sG>>5)<<(2)) |
-						((sB>>6)<<(0)) ;
+				  	*dst = (Uint8)(((sR>>5)<<(3+2))|
+						           ((sG>>5)<<(2)) |
+						           ((sB>>6)<<(0)));
 				}
 				dst++;
 				src += srcbpp;
@@ -2134,9 +2134,9 @@
 								sR, sG, sB);
 				if ( (Pixel & rgbmask) != ckey ) {
 				  	/* Pack RGB into 8bit pixel */
-				  	*dst = palmap[((sR>>5)<<(3+2))|
-							((sG>>5)<<(2))  |
-							((sB>>6)<<(0))  ];
+				  	*dst = (Uint8)palmap[((sR>>5)<<(3+2))|
+							             ((sG>>5)<<(2))  |
+							             ((sB>>6)<<(0))  ];
 				}
 				dst++;
 				src += srcbpp;
@@ -2232,7 +2232,7 @@
 	Uint8 srcbpp;
 	Uint8 dstbpp;
 	Uint32 Pixel;
-	Uint8  sR, sG, sB, sA;
+	unsigned sR, sG, sB, sA;
 
 	/* Set up some basic variables */
 	srcbpp = srcfmt->BytesPerPixel;
--- a/src/video/SDL_cursor.c	Fri Feb 24 17:03:06 2006 +0000
+++ b/src/video/SDL_cursor.c	Fri Feb 24 18:24:57 2006 +0000
@@ -331,7 +331,7 @@
 
 /* Keep track of the current cursor colors */
 static int palette_changed = 1;
-static Uint32 pixels8[2];
+static Uint8 pixels8[2];
 
 void SDL_CursorPaletteChanged(void)
 {
@@ -377,8 +377,8 @@
 		int dstskip;
 
 		if ( palette_changed ) {
-			pixels8[0] = SDL_MapRGB(screen->format, 255, 255, 255);
-			pixels8[1] = SDL_MapRGB(screen->format, 0, 0, 0);
+			pixels8[0] = (Uint8)SDL_MapRGB(screen->format, 255, 255, 255);
+			pixels8[1] = (Uint8)SDL_MapRGB(screen->format, 0, 0, 0);
 			palette_changed = 0;
 		}
 		dst = (Uint8 *)screen->pixels +
@@ -419,7 +419,7 @@
 				datab = *data++;
 				for ( i=0; i<8; ++i ) {
 					if ( maskb & 0x80 ) {
-						*dst = pixels[datab>>7];
+						*dst = (Uint16)pixels[datab>>7];
 					}
 					maskb <<= 1;
 					datab <<= 1;
@@ -509,8 +509,8 @@
 	maxx = area->x+area->w;
 	if ( screen->format->BytesPerPixel == 1 ) {
 		if ( palette_changed ) {
-			pixels8[0] = SDL_MapRGB(screen->format, 255, 255, 255);
-			pixels8[1] = SDL_MapRGB(screen->format, 0, 0, 0);
+			pixels8[0] = (Uint8)SDL_MapRGB(screen->format, 255, 255, 255);
+			pixels8[1] = (Uint8)SDL_MapRGB(screen->format, 0, 0, 0);
 			palette_changed = 0;
 		}
 		for ( h=area->h; h; h-- ) {
--- a/src/video/SDL_surface.c	Fri Feb 24 17:03:06 2006 +0000
+++ b/src/video/SDL_surface.c	Fri Feb 24 18:24:57 2006 +0000
@@ -687,7 +687,7 @@
 		    case 2:
 			for ( y=dstrect->h; y; --y ) {
 				Uint16 *pixels = (Uint16 *)row;
-				Uint16 c = color;
+				Uint16 c = (Uint16)color;
 				Uint32 cc = (Uint32)c << 16 | c;
 				int n = dstrect->w;
 				if((unsigned long)pixels & 3) {
--- a/src/video/SDL_video.c	Fri Feb 24 17:03:06 2006 +0000
+++ b/src/video/SDL_video.c	Fri Feb 24 18:24:57 2006 +0000
@@ -995,10 +995,10 @@
 			return;
 
 		/* Fill the rectangle */
-		rect.x = x;
-		rect.y = y;
-		rect.w = w;
-		rect.h = h;
+		rect.x = (Sint16)x;
+		rect.y = (Sint16)y;
+		rect.w = (Uint16)w;
+		rect.h = (Uint16)h;
 		SDL_UpdateRects(screen, 1, &rect);
 	}
 }
--- a/src/video/SDL_yuv_sw.c	Fri Feb 24 17:03:06 2006 +0000
+++ b/src/video/SDL_yuv_sw.c	Fri Feb 24 18:24:57 2006 +0000
@@ -167,27 +167,27 @@
             ++cr; ++cb;
 
             L = *lum++;
-            *row1++ = (rgb_2_pix[ L + cr_r ] |
-                       rgb_2_pix[ L + crb_g ] |
-                       rgb_2_pix[ L + cb_b ]);
+            *row1++ = (unsigned short)(rgb_2_pix[ L + cr_r ] |
+                                       rgb_2_pix[ L + crb_g ] |
+                                       rgb_2_pix[ L + cb_b ]);
 
             L = *lum++;
-            *row1++ = (rgb_2_pix[ L + cr_r ] |
-                       rgb_2_pix[ L + crb_g ] |
-                       rgb_2_pix[ L + cb_b ]);
+            *row1++ = (unsigned short)(rgb_2_pix[ L + cr_r ] |
+                                       rgb_2_pix[ L + crb_g ] |
+                                       rgb_2_pix[ L + cb_b ]);
 
 
             /* Now, do second row.  */
 
             L = *lum2++;
-            *row2++ = (rgb_2_pix[ L + cr_r ] |
-                       rgb_2_pix[ L + crb_g ] |
-                       rgb_2_pix[ L + cb_b ]);
+            *row2++ = (unsigned short)(rgb_2_pix[ L + cr_r ] |
+                                       rgb_2_pix[ L + crb_g ] |
+                                       rgb_2_pix[ L + cb_b ]);
 
             L = *lum2++;
-            *row2++ = (rgb_2_pix[ L + cr_r ] |
-                       rgb_2_pix[ L + crb_g ] |
-                       rgb_2_pix[ L + cb_b ]);
+            *row2++ = (unsigned short)(rgb_2_pix[ L + cr_r ] |
+                                       rgb_2_pix[ L + crb_g ] |
+                                       rgb_2_pix[ L + cb_b ]);
         }
 
         /*
@@ -638,14 +638,14 @@
             cr += 4; cb += 4;
 
             L = *lum; lum += 2;
-            *row++ = (rgb_2_pix[ L + cr_r ] |
-                       rgb_2_pix[ L + crb_g ] |
-                       rgb_2_pix[ L + cb_b ]);
+            *row++ = (unsigned short)(rgb_2_pix[ L + cr_r ] |
+                                      rgb_2_pix[ L + crb_g ] |
+                                      rgb_2_pix[ L + cb_b ]);
 
             L = *lum; lum += 2;
-            *row++ = (rgb_2_pix[ L + cr_r ] |
-                       rgb_2_pix[ L + crb_g ] |
-                       rgb_2_pix[ L + cb_b ]);
+            *row++ = (unsigned short)(rgb_2_pix[ L + cr_r ] |
+                                      rgb_2_pix[ L + crb_g ] |
+                                      rgb_2_pix[ L + cb_b ]);
 
         }
 
--- a/src/video/wincommon/SDL_sysevents.c	Fri Feb 24 17:03:06 2006 +0000
+++ b/src/video/wincommon/SDL_sysevents.c	Fri Feb 24 18:24:57 2006 +0000
@@ -78,7 +78,7 @@
 static int codepage;
 static int Is9xME();
 static int GetCodePage();
-static int WINAPI ToUnicode9xME(UINT vkey, UINT scancode, BYTE *keystate, Uint16 *wchars, int wsize, UINT flags);
+static int WINAPI ToUnicode9xME(UINT vkey, UINT scancode, BYTE *keystate, LPWSTR wchars, int wsize, UINT flags);
 
 ToUnicodeFN SDL_ToUnicode = ToUnicode9xME;
 #endif /* !NO_GETKEYBOARDSTATE */