diff --git a/VisualC.zip b/VisualC.zip index d863de97d..d949eeeb1 100644 Binary files a/VisualC.zip and b/VisualC.zip differ diff --git a/include/SDL_config_win32.h b/include/SDL_config_win32.h index 52b0b35d8..92d57f0f0 100644 --- a/include/SDL_config_win32.h +++ b/include/SDL_config_win32.h @@ -34,6 +34,9 @@ typedef __int32 int32_t; 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 diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index 9ef0bb067..9f5ae6d4d 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -47,7 +47,7 @@ void SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format) if ( sample > 255 ) { *dst = 255; } else { - *dst = sample; + *dst = (Uint8)sample; } src += 2; dst += 1; @@ -68,7 +68,7 @@ void SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format) if ( sample < -128 ) { *dst = -128; } else { - *dst = sample; + *dst = (Sint8)sample; } src += 2; dst += 1; @@ -185,10 +185,8 @@ void SDL_ConvertStrip(SDL_AudioCVT *cvt, Uint16 format) 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 @@ void SDL_ConvertStrip(SDL_AudioCVT *cvt, Uint16 format) 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 @@ void SDL_ConvertStrip_2(SDL_AudioCVT *cvt, Uint16 format) 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 @@ void SDL_ConvertStrip_2(SDL_AudioCVT *cvt, Uint16 format) 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; } diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c index b55b9a6aa..7e3f4a5b1 100644 --- a/src/audio/SDL_wave.c +++ b/src/audio/SDL_wave.c @@ -108,9 +108,9 @@ static Sint32 MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state, 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 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len) } /* 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; } diff --git a/src/video/SDL_RLEaccel.c b/src/video/SDL_RLEaccel.c index aa5d1ba9b..cba9ace76 100644 --- a/src/video/SDL_RLEaccel.c +++ b/src/video/SDL_RLEaccel.c @@ -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 @@ do { \ 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 @@ do { \ 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 @@ do { \ 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 @@ do { \ /* 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 @@ done: */ #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; diff --git a/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c index ccd7ace37..61c911086 100644 --- a/src/video/SDL_blit_A.c +++ b/src/video/SDL_blit_A.c @@ -1483,9 +1483,9 @@ static void Blit16to16SurfaceAlpha128(SDL_BlitInfo *info, Uint16 mask) 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 @@ static void Blit565to565SurfaceAlpha(SDL_BlitInfo *info) 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 @@ static void Blit555to555SurfaceAlpha(SDL_BlitInfo *info) 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 @@ static void BlitARGBto565PixelAlpha(SDL_BlitInfo *info) 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 @@ static void BlitARGBto565PixelAlpha(SDL_BlitInfo *info) 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 @@ static void BlitARGBto555PixelAlpha(SDL_BlitInfo *info) 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 @@ static void BlitARGBto555PixelAlpha(SDL_BlitInfo *info) d = (d | d << 16) & 0x03e07c1f; d += (s - d) * alpha >> 5; d &= 0x03e07c1f; - *dstp = d | d >> 16; + *dstp = (Uint16)(d | d >> 16); } } srcp++; diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c index 2935e5a65..33117056b 100644 --- a/src/video/SDL_blit_N.c +++ b/src/video/SDL_blit_N.c @@ -858,9 +858,9 @@ static Uint32 GetBlitFeatures( void ) /* 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 @@ static void Blit_RGB888_index8(SDL_BlitInfo *info) } /* 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 @@ static void Blit_RGB888_RGB555(SDL_BlitInfo *info) } /* 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 @@ static void BlitNto1Key(SDL_BlitInfo *info) 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 @@ static void BlitNto1Key(SDL_BlitInfo *info) 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 @@ static void BlitNto1Key(SDL_BlitInfo *info) 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 @@ static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info) Uint8 srcbpp; Uint8 dstbpp; Uint32 Pixel; - Uint8 sR, sG, sB, sA; + unsigned sR, sG, sB, sA; /* Set up some basic variables */ srcbpp = srcfmt->BytesPerPixel; diff --git a/src/video/SDL_cursor.c b/src/video/SDL_cursor.c index 429960361..723040e0b 100644 --- a/src/video/SDL_cursor.c +++ b/src/video/SDL_cursor.c @@ -331,7 +331,7 @@ void SDL_MoveCursor(int x, int y) /* 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 @@ static void SDL_DrawCursorFast(SDL_Surface *screen, SDL_Rect *area) 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 @@ static void SDL_DrawCursorFast(SDL_Surface *screen, SDL_Rect *area) 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 @@ static void SDL_DrawCursorSlow(SDL_Surface *screen, SDL_Rect *area) 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-- ) { diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 26c300ffd..578401ac7 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -687,7 +687,7 @@ int SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color) 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) { diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 2c64c4cef..2cf6b6c5c 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -995,10 +995,10 @@ void SDL_UpdateRect(SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h) 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); } } diff --git a/src/video/SDL_yuv_sw.c b/src/video/SDL_yuv_sw.c index 74570394d..8bb1cce71 100644 --- a/src/video/SDL_yuv_sw.c +++ b/src/video/SDL_yuv_sw.c @@ -167,27 +167,27 @@ static void Color16DitherYV12Mod1X( int *colortab, Uint32 *rgb_2_pix, ++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 @@ static void Color16DitherYUY2Mod1X( int *colortab, Uint32 *rgb_2_pix, 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 ]); } diff --git a/src/video/wincommon/SDL_sysevents.c b/src/video/wincommon/SDL_sysevents.c index 25f29aa52..6e3ca6477 100644 --- a/src/video/wincommon/SDL_sysevents.c +++ b/src/video/wincommon/SDL_sysevents.c @@ -78,7 +78,7 @@ extern void DIB_SwapGamma(_THIS); 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 */