Fix some clang analyzer warnings.

This fixes some analyzer warnings and a couple of minor memory leaks.
This commit is contained in:
Jørgen P. Tjernø 2013-07-23 17:40:13 -07:00
parent b01b128353
commit e007150b45
6 changed files with 15 additions and 5 deletions

View file

@ -392,7 +392,7 @@ static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points)
static float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_GestureTouch* touch)
{
SDL_FloatPoint points[DOLLARNPOINTS];
SDL_FloatPoint points[DOLLARNPOINTS] = {};
int i;
float bestDiff = 10000;

View file

@ -1467,7 +1467,7 @@ SDL_RenderDrawRects(SDL_Renderer * renderer,
int
SDL_RenderFillRect(SDL_Renderer * renderer, const SDL_Rect * rect)
{
SDL_Rect full_rect;
SDL_Rect full_rect = {};
CHECK_RENDERER_MAGIC(renderer, -1);

View file

@ -619,6 +619,8 @@ SDL_UpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect,
/* If the destination rectangle is NULL, use the entire dest surface */
if (dstrect == NULL) {
fulldst.x = fulldst.y = 0;
fulldst.w = dst->w;
fulldst.h = dst->h;
dstrect = &fulldst;
}

View file

@ -3062,8 +3062,11 @@ static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messagebo
}
SDL_VERSION(&info.version);
SDL_GetWindowWMInfo(window, &info);
return (info.subsystem == drivertype);
if (!SDL_GetWindowWMInfo(window, &info)) {
return SDL_TRUE;
} else {
return (info.subsystem == drivertype);
}
}
int

View file

@ -138,6 +138,10 @@ CreateApplicationMenus(void)
NSMenu *windowMenu;
NSMenuItem *menuItem;
if (!NSApp) {
return;
}
/* Create the main menu bar */
[NSApp setMainMenu:[[NSMenu alloc] init]];
@ -228,7 +232,7 @@ Cocoa_RegisterApp(void)
}
[NSApp finishLaunching];
}
if ([NSApp delegate] == nil) {
if (NSApp && ![NSApp delegate]) {
[NSApp setDelegate:[[SDLAppDelegate alloc] init]];
}
[pool release];

View file

@ -96,6 +96,7 @@ Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShape
closure.window = shaper->window;
SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure);
[closure.path addClip];
[pool release];
return 0;
}