Use only safe string functions
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401383
This commit is contained in:
parent
a81db3ea34
commit
1da8cb0143
60 changed files with 223 additions and 263 deletions
|
@ -373,8 +373,7 @@ int SDL_AudioInit(const char *driver_name)
|
|||
char *SDL_AudioDriverName(char *namebuf, int maxlen)
|
||||
{
|
||||
if ( current_audio != NULL ) {
|
||||
SDL_strncpy(namebuf, current_audio->name, maxlen-1);
|
||||
namebuf[maxlen-1] = '\0';
|
||||
SDL_strlcpy(namebuf, current_audio->name, maxlen);
|
||||
return(namebuf);
|
||||
}
|
||||
return(NULL);
|
||||
|
|
|
@ -89,7 +89,7 @@ int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic)
|
|||
audiodev = audiopath;
|
||||
}
|
||||
if ( path != NULL ) {
|
||||
SDL_strncpy(path, audiodev, maxlen);
|
||||
SDL_strlcpy(path, audiodev, maxlen);
|
||||
path[maxlen-1] = '\0';
|
||||
}
|
||||
return(audio_fd);
|
||||
|
@ -136,7 +136,7 @@ static int OpenUserDefinedDevice(char *path, int maxlen, int flags)
|
|||
}
|
||||
audio_fd = open(audiodev, flags, 0);
|
||||
if ( path != NULL ) {
|
||||
SDL_strncpy(path, audiodev, maxlen);
|
||||
SDL_strlcpy(path, audiodev, maxlen);
|
||||
path[maxlen-1] = '\0';
|
||||
}
|
||||
return audio_fd;
|
||||
|
@ -166,8 +166,7 @@ int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic)
|
|||
audio_fd = open(audiopath, flags, 0);
|
||||
if ( audio_fd > 0 ) {
|
||||
if ( path != NULL ) {
|
||||
SDL_strncpy( path, audiopath, maxlen );
|
||||
path[maxlen-1] = '\0';
|
||||
SDL_strlcpy( path, audiopath, maxlen );
|
||||
}
|
||||
return audio_fd;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ static int LoadALSALibrary(void) {
|
|||
if (alsa_handle) {
|
||||
alsa_loaded = 1;
|
||||
retval = 0;
|
||||
for (i = 0; i < SDL_TABLESIZE(alsa_functions); i++) {
|
||||
for (i = 0; i < SDL_arraysize(alsa_functions); i++) {
|
||||
/* *alsa_functions[i].func = SDL_LoadFunction(alsa_handle,alsa_functions[i].name);*/
|
||||
#if HAVE_DLVSYM
|
||||
*alsa_functions[i].func = dlvsym(alsa_handle,alsa_functions[i].name,"ALSA_0.9");
|
||||
|
|
|
@ -90,7 +90,7 @@ static int LoadARTSLibrary(void)
|
|||
if ( arts_handle ) {
|
||||
arts_loaded = 1;
|
||||
retval = 0;
|
||||
for ( i=0; i<SDL_TABLESIZE(arts_functions); ++i ) {
|
||||
for ( i=0; i<SDL_arraysize(arts_functions); ++i ) {
|
||||
*arts_functions[i].func = SDL_LoadFunction(arts_handle, arts_functions[i].name);
|
||||
if ( !*arts_functions[i].func ) {
|
||||
retval = -1;
|
||||
|
|
|
@ -85,7 +85,7 @@ static int LoadESDLibrary(void)
|
|||
if ( esd_handle ) {
|
||||
esd_loaded = 1;
|
||||
retval = 0;
|
||||
for ( i=0; i<SDL_TABLESIZE(esd_functions); ++i ) {
|
||||
for ( i=0; i<SDL_arraysize(esd_functions); ++i ) {
|
||||
*esd_functions[i].func = SDL_LoadFunction(esd_handle, esd_functions[i].name);
|
||||
if ( !*esd_functions[i].func ) {
|
||||
retval = -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue