Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Mar 21, 2006
1 parent e21f404 commit 0baef22
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
13 changes: 8 additions & 5 deletions src/cdrom/beos/SDL_syscdrom.cc
Expand Up @@ -109,16 +109,18 @@ static int CheckDrive(char *drive)
static void AddDrive(char *drive)
{
int i;
size_t len;

if ( SDL_numcds < MAX_DRIVES ) {
/* Add this drive to our list */
i = SDL_numcds;
SDL_cdlist[i] = (char *)SDL_malloc(SDL_strlen(drive)+1);
len = SDL_strlen(drive)+1;
SDL_cdlist[i] = (char *)SDL_malloc(len);
if ( SDL_cdlist[i] == NULL ) {
SDL_OutOfMemory();
return;
}
SDL_strcpy(SDL_cdlist[i], drive);
SDL_strlcpy(SDL_cdlist[i], drive, len);
++SDL_numcds;
#ifdef CDROM_DEBUG
fprintf(stderr, "Added CD-ROM drive: %s\n", drive);
Expand Down Expand Up @@ -165,9 +167,10 @@ int SDL_SYS_CDInit(void)
SDLcdrom = SDL_getenv("SDL_CDROM"); /* ':' separated list of devices */
if ( SDLcdrom != NULL ) {
char *cdpath, *delim;
cdpath = (char *)SDL_malloc(SDL_strlen(SDLcdrom)+1);
size_t len = SDL_strlen(SDLcdrom)+1;
cdpath = SDL_stack_alloc(char, len);
if ( cdpath != NULL ) {
SDL_strcpy(cdpath, SDLcdrom);
SDL_strlcpy(cdpath, SDLcdrom, len);
SDLcdrom = cdpath;
do {
delim = SDL_strchr(SDLcdrom, ':');
Expand All @@ -183,7 +186,7 @@ int SDL_SYS_CDInit(void)
SDLcdrom = NULL;
}
} while ( SDLcdrom );
SDL_free(cdpath);
SDL_stack_free(cdpath);
}

/* If we found our drives, there's nothing left to do */
Expand Down
11 changes: 6 additions & 5 deletions src/main/macosx/SDLMain.m
Expand Up @@ -252,19 +252,20 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filenam
return FALSE;

const char *temparg = [filename UTF8String];
char *arg = (char *) malloc(strlen(temparg) + 1);
size_t arglen = SDL_strlen(temparg) + 1;
char *arg = (char *) SDL_malloc(arglen);
if (arg == NULL)
return FALSE;

char **newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
if (newargv == NULL)
{
free(arg);
SDL_free(arg);
return FALSE;
}
gArgv = newargv;

strcpy(arg, temparg);
SDL_strlcpy(arg, temparg, arglen);
gArgv[gArgc++] = arg;
gArgv[gArgc] = NULL;
return TRUE;
Expand Down Expand Up @@ -346,15 +347,15 @@ int main (int argc, char **argv)
/* Copy the arguments into a global variable */
/* This is passed if we are launched by double-clicking */
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
gArgv = (char **) malloc(sizeof (char *) * 2);
gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
gArgv[0] = argv[0];
gArgv[1] = NULL;
gArgc = 1;
gFinderLaunch = YES;
} else {
int i;
gArgc = argc;
gArgv = (char **) malloc(sizeof (char *) * (argc+1));
gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
for (i = 0; i <= argc; i++)
gArgv[i] = argv[i];
gFinderLaunch = NO;
Expand Down
6 changes: 3 additions & 3 deletions src/video/bwindow/SDL_sysvideo.cc
Expand Up @@ -639,7 +639,7 @@ int BE_GL_LoadLibrary(_THIS, const char *path)
if (get_image_symbol((image_id)cookie,"glBegin",B_SYMBOL_TYPE_ANY,&location) == B_OK) {
_this->gl_config.dll_handle = (void*)cookie;
_this->gl_config.driver_loaded = 1;
SDL_strncpy(_this->gl_config.driver_path, "libGL.so", sizeof(_this->gl_config.driver_path)-1);
SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", SDL_arraysize(_this->gl_config.driver_path));
}
}
}
Expand Down Expand Up @@ -667,7 +667,7 @@ int BE_GL_LoadLibrary(_THIS, const char *path)
if ((_this->gl_config.dll_handle = (void*)load_add_on(path)) != (void*)B_ERROR) {
_this->gl_config.driver_loaded = 1;
SDL_strncpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path)-1);
SDL_strlcpy(_this->gl_config.driver_path, path, SDL_arraysize(_this->gl_config.driver_path));
}*/
}

Expand All @@ -676,7 +676,7 @@ int BE_GL_LoadLibrary(_THIS, const char *path)
} else {
_this->gl_config.dll_handle = NULL;
_this->gl_config.driver_loaded = 0;
SDL_strcpy(_this->gl_config.driver_path, "");
*_this->gl_config.driver_path = '\0';
return -1;
}
}
Expand Down

0 comments on commit 0baef22

Please sign in to comment.