Commit bb11c757 authored by Sam Lantinga's avatar Sam Lantinga

Update for Visual C++ 6.0

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401432
parent 90e00973
No preview for this file type
......@@ -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
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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: \
......@@ -577,8 +577,8 @@ do { \
do { \
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. */
......@@ -978,7 +978,7 @@ done:
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) \
......@@ -990,7 +990,7 @@ done:
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
......
......@@ -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++;
......
......@@ -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)| \
dst = (Uint8)((((src)&0x00E00000)>>16)| \
(((src)&0x0000E000)>>11)| \
(((src)&0x000000C0)>>6); \
(((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)| \
*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>9)| \
(((*src)&0x0000F800)>>6)| \
(((*src)&0x000000F8)>>3); \
(((*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)| \
*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>8)| \
(((*src)&0x0000FC00)>>5)| \
(((*src)&0x000000F8)>>3); \
(((*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))|
*dst = (Uint8)(((sR>>5)<<(3+2))|
((sG>>5)<<(2)) |
((sB>>6)<<(0)) ;
((sB>>6)<<(0)));
}
dst++;
src += srcbpp;
......@@ -2134,7 +2134,7 @@ static void BlitNto1Key(SDL_BlitInfo *info)
sR, sG, sB);
if ( (Pixel & rgbmask) != ckey ) {
/* Pack RGB into 8bit pixel */
*dst = palmap[((sR>>5)<<(3+2))|
*dst = (Uint8)palmap[((sR>>5)<<(3+2))|
((sG>>5)<<(2)) |
((sB>>6)<<(0)) ];
}
......@@ -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;
......
......@@ -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-- ) {
......
......@@ -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) {
......
......@@ -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);
}
}
......
......@@ -167,12 +167,12 @@ static void Color16DitherYV12Mod1X( int *colortab, Uint32 *rgb_2_pix,
++cr; ++cb;
L = *lum++;
*row1++ = (rgb_2_pix[ L + cr_r ] |
*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 ] |
*row1++ = (unsigned short)(rgb_2_pix[ L + cr_r ] |
rgb_2_pix[ L + crb_g ] |
rgb_2_pix[ L + cb_b ]);
......@@ -180,12 +180,12 @@ static void Color16DitherYV12Mod1X( int *colortab, Uint32 *rgb_2_pix,
/* Now, do second row. */
L = *lum2++;
*row2++ = (rgb_2_pix[ L + cr_r ] |
*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 ] |
*row2++ = (unsigned short)(rgb_2_pix[ L + cr_r ] |
rgb_2_pix[ L + crb_g ] |
rgb_2_pix[ L + cb_b ]);
}
......@@ -638,12 +638,12 @@ static void Color16DitherYUY2Mod1X( int *colortab, Uint32 *rgb_2_pix,
cr += 4; cb += 4;
L = *lum; lum += 2;
*row++ = (rgb_2_pix[ L + cr_r ] |
*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 ] |
*row++ = (unsigned short)(rgb_2_pix[ L + cr_r ] |
rgb_2_pix[ L + crb_g ] |
rgb_2_pix[ L + cb_b ]);
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment