Skip to content

Commit

Permalink
Fixed a few test app type conversions that Visual Studio complains ab…
Browse files Browse the repository at this point in the history
…out.
  • Loading branch information
icculus authored and ccawley2011 committed Sep 23, 2022
1 parent 9601883 commit 076abcb
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion test/graywin.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void DrawBox(SDL_Surface *screen, int X, int Y, int width, int height)

/* Seed the random number generator */
if ( seeded == 0 ) {
srand(time(NULL));
srand((unsigned int) time(NULL));
seeded = 1;
}

Expand Down
8 changes: 4 additions & 4 deletions test/testdyngl.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ int main(int argc,char *argv[])

for(i=0;i<NB_PIXELS;i++)
{
pixels[3*i]=rand()%250-125;
pixels[3*i+1]=rand()%250-125;
pixels[3*i+2]=rand()%250-125;
pixels[3*i]=(GLfloat) (rand()%250-125);
pixels[3*i+1]=(GLfloat) (rand()%250-125);
pixels[3*i+2]=(GLfloat) (rand()%250-125);
}

f.glViewport(0,0,640,480);
Expand All @@ -166,7 +166,7 @@ int main(int argc,char *argv[])
f.glEnable(GL_FOG);
f.glFogf(GL_FOG_START,-500);
f.glFogf(GL_FOG_END,500);
f.glFogf(GL_FOG_DENSITY,0.005);
f.glFogf(GL_FOG_DENSITY,0.005f);

do
{
Expand Down
16 changes: 8 additions & 8 deletions test/testoverlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@ void RGBtoYUV(Uint8 *rgb, int *yuv, int monochrome, int luminance)
if (monochrome)
{
#if 1 /* these are the two formulas that I found on the FourCC site... */
yuv[0] = 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2];
yuv[0] = (int) (0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2]);
yuv[1] = 128;
yuv[2] = 128;
#else
yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16;
yuv[0] = (int) ((0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16);
yuv[1] = 128;
yuv[2] = 128;
#endif
}
else
{
#if 1 /* these are the two formulas that I found on the FourCC site... */
yuv[0] = 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2];
yuv[1] = (rgb[2]-yuv[0])*0.565 + 128;
yuv[2] = (rgb[0]-yuv[0])*0.713 + 128;
yuv[0] = (int) (0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2]);
yuv[1] = (int) ((rgb[2]-yuv[0])*0.565 + 128);
yuv[2] = (int) ((rgb[0]-yuv[0])*0.713 + 128);
#else
yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16;
yuv[1] = 128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]);
yuv[2] = 128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]);
yuv[0] = (int) ((0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16);
yuv[1] = (int) (128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]));
yuv[2] = (int) (128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]));
#endif
}

Expand Down
20 changes: 10 additions & 10 deletions test/testoverlay2.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,25 @@ void RGBtoYUV(Uint8 *rgb, int *yuv, int monochrome, int luminance)
if (monochrome)
{
#if 1 /* these are the two formulas that I found on the FourCC site... */
yuv[0] = 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2];
yuv[0] = (int) (0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2]);
yuv[1] = 128;
yuv[2] = 128;
#else
yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16;
yuv[0] = (int) ((0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16);
yuv[1] = 128;
yuv[2] = 128;
#endif
}
else
{
#if 1 /* these are the two formulas that I found on the FourCC site... */
yuv[0] = 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2];
yuv[1] = (rgb[2]-yuv[0])*0.565 + 128;
yuv[2] = (rgb[0]-yuv[0])*0.713 + 128;
yuv[0] = (int) (0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2]);
yuv[1] = (int) ((rgb[2]-yuv[0])*0.565 + 128);
yuv[2] = (int) ((rgb[0]-yuv[0])*0.713 + 128);
#else
yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16;
yuv[1] = 128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]);
yuv[2] = 128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]);
yuv[0] = (int) ((0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16);
yuv[1] = (int) (128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]));
yuv[2] = (int) (128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]));
#endif
}

Expand Down Expand Up @@ -290,7 +290,7 @@ int main(int argc, char **argv)
int resized=0;
int i;
int fps=12;
int fpsdelay;
Uint32 fpsdelay;
int overlay_format=SDL_YUY2_OVERLAY;
int scale=5;

Expand Down Expand Up @@ -503,7 +503,7 @@ int main(int argc, char **argv)

/* set the start frame */
i=0;
fpsdelay=1000/fps;
fpsdelay=(Uint32)(1000/fps);

/* Ignore key up events, they don't even get filtered */
SDL_EventState(SDL_KEYUP, SDL_IGNORE);
Expand Down
6 changes: 3 additions & 3 deletions test/testsprite.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void MoveSprites(SDL_Surface *screen, Uint32 background)

Uint32 color = SDL_MapRGB (screen->format, 255, 0, 0);
SDL_Rect r;
r.x = (sin((float)t * 2 * 3.1459) + 1.0) / 2.0 * (screen->w-20);
r.x = (Sint16) ((sin((float)t * 2 * 3.1459) + 1.0) / 2.0 * (screen->w-20));
r.y = 0;
r.w = 20;
r.h = screen->h;
Expand Down Expand Up @@ -137,7 +137,7 @@ Uint32 FastestFlags(Uint32 flags, int width, int height, int bpp)
/* Direct hardware blitting without double-buffering
causes really bad flickering.
*/
if ( info->video_mem*1024 > (height*width*bpp/8) ) {
if ( info->video_mem*1024 > ((Uint32)(height*width*bpp/8)) ) {
flags |= SDL_DOUBLEBUF;
} else {
flags &= ~SDL_HWSURFACE;
Expand Down Expand Up @@ -239,7 +239,7 @@ int main(int argc, char *argv[])
sprite_rects += numsprites;
sprite_w = sprite->w;
sprite_h = sprite->h;
srand(time(NULL));
srand((unsigned int) time(NULL));
for ( i=0; i<numsprites; ++i ) {
positions[i].x = rand()%(screen->w - sprite_w);
positions[i].y = rand()%(screen->h - sprite_h);
Expand Down

0 comments on commit 076abcb

Please sign in to comment.