Checkkeys.c test program

Hi,

whilst investigating "Re: [SDL] Minimal example of weird pointer behaviour"
I had reason to get the latest CVS, noticed that there had been quite a lot
of changes to the windows code, and decided to run through the tests again.

File:test/checkkeys.c
Line:90

videoflags = SDL_SWSURFACE;
if ( strcmp(argv[1], “-fullscreen”) == 0 ) {
videoflags |= SDL_FULLSCREEN;
}

causes a GPF if argv[1] is NULL (no command-line parameters)

What about this as a fix, in the tradition of the other examples:

videoflags = SDL_SWSURFACE;
while( argc > 1 ) {
–argc;
if ( argv[argc] && !strcmp(argv[1], “-fullscreen”) ) {
videoflags |= SDL_FULLSCREEN;
} else {
fprintf(stderr, “Usage: %s [-fullscreen]\n”,argv[0]);
exit(1);
}
}

cheers,
John.

videoflags = SDL_SWSURFACE;
if ( strcmp(argv[1], “-fullscreen”) == 0 ) {
videoflags |= SDL_FULLSCREEN;
}

causes a GPF if argv[1] is NULL (no command-line parameters)

What about this as a fix, in the tradition of the other examples:

[snipped]

I’ll buy that for a dollar. :slight_smile:

Thanks!
-Sam Lantinga, Software Engineer, Blizzard Entertainment