Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fix some clang analyzer warnings.
Browse files Browse the repository at this point in the history
This fixes some analyzer warnings and a couple of minor memory leaks.
  • Loading branch information
jorgenpt committed Jul 24, 2013
1 parent 140f063 commit 8a0ae24
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/events/SDL_gesture.c
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/render/SDL_render.c
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/video/SDL_surface.c
Expand Up @@ -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;
}

Expand Down
7 changes: 5 additions & 2 deletions src/video/SDL_video.c
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/video/cocoa/SDL_cocoaevents.m
Expand Up @@ -138,6 +138,10 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filenam
NSMenu *windowMenu;
NSMenuItem *menuItem;

if (!NSApp) {
return;
}

/* Create the main menu bar */
[NSApp setMainMenu:[[NSMenu alloc] init]];

Expand Down Expand Up @@ -228,7 +232,7 @@ - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filenam
}
[NSApp finishLaunching];
}
if ([NSApp delegate] == nil) {
if (NSApp && ![NSApp delegate]) {
[NSApp setDelegate:[[SDLAppDelegate alloc] init]];
}
[pool release];
Expand Down
1 change: 1 addition & 0 deletions src/video/cocoa/SDL_cocoashape.m
Expand Up @@ -96,6 +96,7 @@
closure.window = shaper->window;
SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure);
[closure.path addClip];
[pool release];

return 0;
}
Expand Down

0 comments on commit 8a0ae24

Please sign in to comment.