Static analysis fix: uninitialized variables.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 20 Mar 2014 10:41:47 -0400
changeset 86494ee50f124da2
parent 8648 2b3eec53c66b
child 8650 058c88ce501c
Static analysis fix: uninitialized variables.

This is actually a false-positive, in this case, since Clang doesn't know
that SDL_SetError() only ever returns -1. Feature request to improve that,
with explanation about these specific SDL patches, is here:

http://llvm.org/bugs/show_bug.cgi?id=19208
src/render/SDL_render.c
     1.1 --- a/src/render/SDL_render.c	Thu Mar 20 10:04:23 2014 -0400
     1.2 +++ b/src/render/SDL_render.c	Thu Mar 20 10:41:47 2014 -0400
     1.3 @@ -970,8 +970,8 @@
     1.4  SDL_UnlockTextureYUV(SDL_Texture * texture)
     1.5  {
     1.6      SDL_Texture *native = texture->native;
     1.7 -    void *native_pixels;
     1.8 -    int native_pitch;
     1.9 +    void *native_pixels = NULL;
    1.10 +    int native_pitch = 0;
    1.11      SDL_Rect rect;
    1.12  
    1.13      rect.x = 0;
    1.14 @@ -991,8 +991,8 @@
    1.15  SDL_UnlockTextureNative(SDL_Texture * texture)
    1.16  {
    1.17      SDL_Texture *native = texture->native;
    1.18 -    void *native_pixels;
    1.19 -    int native_pitch;
    1.20 +    void *native_pixels = NULL;
    1.21 +    int native_pitch = 0;
    1.22      const SDL_Rect *rect = &texture->locked_rect;
    1.23      const void* pixels = (void *) ((Uint8 *) texture->pixels +
    1.24                          rect->y * texture->pitch +