# HG changeset patch # User egottlieb # Date 1280984018 14400 # Node ID 0c82f20327ec2022be4b619ddcb1f3f00d5ed1fa # Parent 8dabd625079f377d577272ece68e7be94b613627 Correcting minor bugs and adding assertions to help me track down a NULL pointer bug in Cocoa code. diff -r 8dabd625079f -r 0c82f20327ec src/video/SDL_shape.c --- a/src/video/SDL_shape.c Tue Aug 03 23:41:57 2010 -0400 +++ b/src/video/SDL_shape.c Thu Aug 05 00:53:38 2010 -0400 @@ -22,6 +22,7 @@ #include "SDL_config.h" #include "SDL.h" +#include "SDL_assert.h" #include "SDL_video.h" #include "SDL_sysvideo.h" #include "SDL_pixels.h" @@ -197,6 +198,7 @@ } void SDL_TraverseShapeTree(SDL_ShapeTree *tree,SDL_TraversalFunction function,void* closure) { + SDL_assert(tree != NULL); if(tree->kind == QuadShape) { SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upleft,function,closure); SDL_TraverseShapeTree((SDL_ShapeTree *)tree->data.children.upright,function,closure); diff -r 8dabd625079f -r 0c82f20327ec src/video/cocoa/SDL_cocoashape.m --- a/src/video/cocoa/SDL_cocoashape.m Tue Aug 03 23:41:57 2010 -0400 +++ b/src/video/cocoa/SDL_cocoashape.m Thu Aug 05 00:53:38 2010 -0400 @@ -28,7 +28,7 @@ SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) { SDL_WindowData* data = (SDL_WindowData*)window->driverdata; - [data->nswindow setAlpha:1.0]; + [data->nswindow setAlphaValue:1.0]; [data->nswindow setOpaque:YES]; [data->nswindow setStyleMask:NSBorderlessWindowMask]; SDL_WindowShaper* result = SDL_malloc(sizeof(SDL_WindowShaper)); @@ -45,7 +45,7 @@ shape_data->shape = NULL; int resized_properly = Cocoa_ResizeWindowShape(window); - assert(resized_properly == 0); + SDL_assert(resized_properly == 0); return result; } @@ -60,6 +60,7 @@ } void ConglomerateShapeTree(SDL_ShapeTree* tree,SDL_PathConglomeration* cong) { + SDL_assert(tree != NULL); if(tree->kind == OpaqueShape) { NSRect rect = convert_rect(tree->data.shape,cong->window); [cong->clipPath appendBezierPathWithRect:rect]; @@ -91,7 +92,7 @@ int Cocoa_ResizeWindowShape(SDL_Window *window) { SDL_ShapeData* data = window->shaper->driverdata; - assert(data != NULL); + SDL_assert(data != NULL); if(data->shape != NULL) SDL_FreeShapeTree(&data->shape); diff -r 8dabd625079f -r 0c82f20327ec src/video/x11/SDL_x11shape.c --- a/src/video/x11/SDL_x11shape.c Tue Aug 03 23:41:57 2010 -0400 +++ b/src/video/x11/SDL_x11shape.c Thu Aug 05 00:53:38 2010 -0400 @@ -20,7 +20,8 @@ eligottlieb@gmail.com */ -#include +#include "SDL_assert.h" +#include "SDL_malloc.h" #include "SDL_x11video.h" #include "SDL_x11shape.h" #include "SDL_x11window.h" @@ -39,13 +40,13 @@ result->mode.mode = ShapeModeDefault; result->mode.parameters.binarizationCutoff = 1; result->usershownflag = 0; - SDL_ShapeData* data = malloc(sizeof(SDL_ShapeData)); + SDL_ShapeData* data = SDL_malloc(sizeof(SDL_ShapeData)); result->driverdata = data; data->bitmapsize = 0; data->bitmap = NULL; window->shaper = result; int resized_properly = X11_ResizeWindowShape(window); - assert(resized_properly == 0); + SDL_assert(resized_properly == 0); } #endif @@ -54,7 +55,7 @@ int X11_ResizeWindowShape(SDL_Window* window) { SDL_ShapeData* data = window->shaper->driverdata; - assert(data != NULL); + SDL_assert(data != NULL); unsigned int bitmapsize = window->w / 8; if(window->w % 8 > 0)