src/video/ipod/SDL_ipodvideo.c
changeset 1338 604d73db6802
parent 1336 3692456e7b0f
child 1358 c71e05b4dc2e
     1.1 --- a/src/video/ipod/SDL_ipodvideo.c	Tue Feb 07 07:03:29 2006 +0000
     1.2 +++ b/src/video/ipod/SDL_ipodvideo.c	Tue Feb 07 09:29:18 2006 +0000
     1.3 @@ -1,8 +1,6 @@
     1.4  #include <sys/types.h>
     1.5  #include <sys/ioctl.h>
     1.6  
     1.7 -#include <stdlib.h>
     1.8 -#include <stdio.h>
     1.9  #include <unistd.h>
    1.10  #include <fcntl.h>
    1.11  #include <string.h>
    1.12 @@ -15,6 +13,8 @@
    1.13  #include <linux/fb.h>
    1.14  
    1.15  #include "SDL.h"
    1.16 +#include "SDL_stdlib.h"
    1.17 +#include "SDL_string.h"
    1.18  #include "SDL_error.h"
    1.19  #include "SDL_video.h"
    1.20  #include "SDL_mouse.h"
    1.21 @@ -93,15 +93,15 @@
    1.22  {
    1.23      SDL_VideoDevice *this;
    1.24      
    1.25 -    this = (SDL_VideoDevice *)malloc (sizeof(SDL_VideoDevice));
    1.26 +    this = (SDL_VideoDevice *)SDL_malloc (sizeof(SDL_VideoDevice));
    1.27      if (this) {
    1.28  	memset (this, 0, sizeof *this);
    1.29 -	this->hidden = (struct SDL_PrivateVideoData *) malloc (sizeof(struct SDL_PrivateVideoData));
    1.30 +	this->hidden = (struct SDL_PrivateVideoData *) SDL_malloc (sizeof(struct SDL_PrivateVideoData));
    1.31      }
    1.32      if (!this || !this->hidden) {
    1.33  	SDL_OutOfMemory();
    1.34  	if (this)
    1.35 -	    free (this);
    1.36 +	    SDL_free (this);
    1.37  	return 0;
    1.38      }
    1.39      memset (this->hidden, 0, sizeof(struct SDL_PrivateVideoData));
    1.40 @@ -178,7 +178,7 @@
    1.41  	    for ( i=0; vcs[i] && (kbfd < 0); ++i ) {
    1.42  		char vtpath[12];
    1.43  		
    1.44 -		sprintf(vtpath, vcs[i], curvt);
    1.45 +		SDL_snprintf(vtpath, SDL_arraysize(vtpath), vcs[i], curvt);
    1.46  		kbfd = open(vtpath, O_RDWR);
    1.47  	    }
    1.48  	}
    1.49 @@ -320,8 +320,8 @@
    1.50  	Rmask = Gmask = Bmask = 0;
    1.51      }
    1.52  
    1.53 -    if (this->hidden->buffer) free (this->hidden->buffer);
    1.54 -    this->hidden->buffer = malloc (width * height * (bpp / 8));
    1.55 +    if (this->hidden->buffer) SDL_free (this->hidden->buffer);
    1.56 +    this->hidden->buffer = SDL_malloc (width * height * (bpp / 8));
    1.57      if (!this->hidden->buffer) {
    1.58  	SDL_SetError ("Couldn't allocate buffer for requested mode");
    1.59  	return 0;
    1.60 @@ -331,7 +331,7 @@
    1.61  
    1.62      if (!SDL_ReallocFormat (current, bpp, Rmask, Gmask, Bmask, 0)) {
    1.63  	SDL_SetError ("Couldn't allocate new pixel format");
    1.64 -	free (this->hidden->buffer);
    1.65 +	SDL_free (this->hidden->buffer);
    1.66  	this->hidden->buffer = 0;
    1.67  	return 0;
    1.68      }