Commit 0526b1fc authored by Sam Lantinga's avatar Sam Lantinga

Using the SDL C runtime functions

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401715
parent d8aace2c
......@@ -117,14 +117,14 @@ static SDL_VideoDevice* QZ_CreateDevice (int device_index) {
SDL_VideoDevice *device;
SDL_PrivateVideoData *hidden;
device = (SDL_VideoDevice*) malloc (sizeof (*device) );
hidden = (SDL_PrivateVideoData*) malloc (sizeof (*hidden) );
device = (SDL_VideoDevice*) SDL_malloc (sizeof (*device) );
hidden = (SDL_PrivateVideoData*) SDL_malloc (sizeof (*hidden) );
if (device == NULL || hidden == NULL)
SDL_OutOfMemory ();
memset (device, 0, sizeof (*device) );
memset (hidden, 0, sizeof (*hidden) );
SDL_memset (device, 0, sizeof (*device) );
SDL_memset (hidden, 0, sizeof (*hidden) );
device->hidden = hidden;
......@@ -178,8 +178,8 @@ static SDL_VideoDevice* QZ_CreateDevice (int device_index) {
static void QZ_DeleteDevice (SDL_VideoDevice *device) {
free (device->hidden);
free (device);
SDL_free (device->hidden);
SDL_free (device);
}
static int QZ_VideoInit (_THIS, SDL_PixelFormat *video_format) {
......@@ -242,9 +242,9 @@ static SDL_Rect** QZ_ListModes (_THIS, SDL_PixelFormat *format, Uint32 flags) {
int i;
for (i = 0; client_mode_list[i] != NULL; i++)
free (client_mode_list[i]);
SDL_free (client_mode_list[i]);
free (client_mode_list);
SDL_free (client_mode_list);
client_mode_list = NULL;
}
......@@ -297,12 +297,12 @@ static SDL_Rect** QZ_ListModes (_THIS, SDL_PixelFormat *format, Uint32 flags) {
if (client_mode_list == NULL)
client_mode_list = (SDL_Rect**)
malloc (sizeof(*client_mode_list) * (list_size+1) );
SDL_malloc (sizeof(*client_mode_list) * (list_size+1) );
else
client_mode_list = (SDL_Rect**)
realloc (client_mode_list, sizeof(*client_mode_list) * (list_size+1));
SDL_realloc (client_mode_list, sizeof(*client_mode_list) * (list_size+1));
rect = (SDL_Rect*) malloc (sizeof(**client_mode_list));
rect = (SDL_Rect*) SDL_malloc (sizeof(**client_mode_list));
if (client_mode_list == NULL || rect == NULL) {
SDL_OutOfMemory ();
......@@ -372,7 +372,7 @@ static void QZ_UnsetVideoMode (_THIS, BOOL to_desktop) {
SDL_WaitThread (thread, NULL);
SDL_DestroySemaphore (sem1);
SDL_DestroySemaphore (sem2);
free (sw_buffers[0]);
SDL_free (sw_buffers[0]);
}
/*
......@@ -493,7 +493,7 @@ static SDL_Surface* QZ_SetVideoFullScreen (_THIS, SDL_Surface *current, int widt
this->UnlockHWSurface = QZ_UnlockDoubleBuffer;
this->FlipHWSurface = QZ_FlipDoubleBuffer;
current->pixels = malloc (current->pitch * current->h * 2);
current->pixels = SDL_malloc (current->pitch * current->h * 2);
if (current->pixels == NULL) {
SDL_OutOfMemory ();
goto ERR_DOUBLEBUF;
......@@ -984,7 +984,7 @@ static int QZ_ThreadFlip (_THIS) {
while ( h-- ) {
memcpy (dst, src, len);
SDL_memcpy (dst, src, len);
src += skip;
dst += skip;
}
......@@ -1211,7 +1211,7 @@ static int QZ_IsWindowObscured (NSWindow *window) {
dockIconCacheMiss) {
numCachedDockIcons = i - firstDockIcon;
memcpy (dockIcons, &(windows[firstDockIcon]),
SDL_memcpy (dockIcons, &(windows[firstDockIcon]),
numCachedDockIcons * sizeof(*windows));
}
......
......@@ -41,12 +41,12 @@ WMcursor* QZ_CreateWMCursor (_THIS, Uint8 *data, Uint8 *mask,
int row, bytes;
/* Allocate the cursor memory */
cursor = (WMcursor *)malloc(sizeof(WMcursor));
cursor = (WMcursor *)SDL_malloc(sizeof(WMcursor));
if ( cursor == NULL ) {
SDL_OutOfMemory();
return(NULL);
}
memset(cursor, 0, sizeof(*cursor));
SDL_memset(cursor, 0, sizeof(*cursor));
if (w > 16)
w = 16;
......@@ -57,11 +57,11 @@ WMcursor* QZ_CreateWMCursor (_THIS, Uint8 *data, Uint8 *mask,
bytes = (w+7)/8;
for ( row=0; row<h; ++row ) {
memcpy(&cursor->curs.data[row], data, bytes);
SDL_memcpy(&cursor->curs.data[row], data, bytes);
data += bytes;
}
for ( row=0; row<h; ++row ) {
memcpy(&cursor->curs.mask[row], mask, bytes);
SDL_memcpy(&cursor->curs.mask[row], mask, bytes);
mask += bytes;
}
cursor->curs.hotSpot.h = hot_x;
......
......@@ -91,16 +91,16 @@ static void QZ_FreeHWYUV (_THIS, SDL_Overlay *overlay) {
CDSequenceEnd (yuv_seq);
ExitMovies();
free (overlay->hwfuncs);
free (overlay->pitches);
free (overlay->pixels);
SDL_free (overlay->hwfuncs);
SDL_free (overlay->pitches);
SDL_free (overlay->pixels);
if (SDL_VideoSurface->flags & SDL_FULLSCREEN) {
[ qz_window close ];
qz_window = nil;
}
free (yuv_matrix);
SDL_free (yuv_matrix);
DisposeHandle ((Handle)yuv_idh);
}
......@@ -134,7 +134,7 @@ SDL_Overlay* QZ_CreateYUVOverlay (_THIS, int width, int height,
return NULL;
}
yuv_matrix = (MatrixRecordPtr) malloc (sizeof(MatrixRecord));
yuv_matrix = (MatrixRecordPtr) SDL_malloc (sizeof(MatrixRecord));
if (yuv_matrix == NULL) {
SDL_OutOfMemory();
return NULL;
......@@ -234,7 +234,7 @@ SDL_Overlay* QZ_CreateYUVOverlay (_THIS, int width, int height,
return NULL;
}
overlay = (SDL_Overlay*) malloc (sizeof(*overlay));
overlay = (SDL_Overlay*) SDL_malloc (sizeof(*overlay));
if (overlay == NULL) {
SDL_OutOfMemory();
return NULL;
......@@ -267,15 +267,15 @@ SDL_Overlay* QZ_CreateYUVOverlay (_THIS, int width, int height,
return NULL;
}
pixels = (Uint8**) malloc (sizeof(*pixels) * 3);
pitches = (Uint16*) malloc (sizeof(*pitches) * 3);
pixels = (Uint8**) SDL_malloc (sizeof(*pixels) * 3);
pitches = (Uint16*) SDL_malloc (sizeof(*pitches) * 3);
if (pixels == NULL || pitches == NULL) {
SDL_OutOfMemory();
return NULL;
}
yuv_pixmap = (PlanarPixmapInfoYUV420*)
malloc (sizeof(PlanarPixmapInfoYUV420) +
SDL_malloc (sizeof(PlanarPixmapInfoYUV420) +
(width * height * 2));
if (yuv_pixmap == NULL) {
SDL_OutOfMemory ();
......@@ -310,7 +310,7 @@ SDL_Overlay* QZ_CreateYUVOverlay (_THIS, int width, int height,
overlay->pitches = pitches;
}
overlay->hwfuncs = malloc (sizeof(*overlay->hwfuncs));
overlay->hwfuncs = SDL_malloc (sizeof(*overlay->hwfuncs));
if (overlay->hwfuncs == NULL) {
SDL_OutOfMemory();
return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment