Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Allow abbreviated strings to be used for driver names.
Browse files Browse the repository at this point in the history
This allows people to use "pulse" with both SDL 1.2 and 2.0
  • Loading branch information
slouken committed Feb 19, 2013
1 parent cd76821 commit 1cb9a47
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/audio/SDL_audio.c
Expand Up @@ -580,8 +580,8 @@ SDL_AudioInit(const char *driver_name)
for (i = 0; (!initialized) && (bootstrap[i]); ++i) {
/* make sure we should even try this driver before doing so... */
const AudioBootStrap *backend = bootstrap[i];
if (((driver_name) && (SDL_strcasecmp(backend->name, driver_name))) ||
((!driver_name) && (backend->demand_only))) {
if ((driver_name && (SDL_strncasecmp(backend->name, driver_name, SDL_strlen(driver_name)) != 0)) ||
(!driver_name && backend->demand_only)) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/video/SDL_video.c
Expand Up @@ -437,7 +437,7 @@ SDL_VideoInit(const char *driver_name)
}
if (driver_name != NULL) {
for (i = 0; bootstrap[i]; ++i) {
if (SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) {
if (SDL_strncasecmp(bootstrap[i]->name, driver_name, SDL_strlen(driver_name)) == 0) {
video = bootstrap[i]->create(index);
break;
}
Expand Down

0 comments on commit 1cb9a47

Please sign in to comment.