From e48b817b0a674613065d0a6e4b185b8a2bb07c5e Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Thu, 11 Feb 2010 16:12:26 +0000 Subject: [PATCH] cogl: resolves some low hanging issues flagged by clang An initial pass over the Cogl source code using the Clang static analysis tool flagged a few low hanging issues such as un-used variables or redundant initializing of variables which this patch fixes. --- cogl/cogl-texture-2d-sliced.c | 9 ++------- cogl/cogl-texture.c | 8 ++++---- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/cogl/cogl-texture-2d-sliced.c b/cogl/cogl-texture-2d-sliced.c index 0f9e65f22..2d969052c 100644 --- a/cogl/cogl-texture-2d-sliced.c +++ b/cogl/cogl-texture-2d-sliced.c @@ -998,7 +998,6 @@ _cogl_texture_2d_sliced_new_with_size (unsigned int width, CoglPixelFormat internal_format) { CoglTexture2DSliced *tex_2ds; - CoglTexture *tex; CoglBitmap bmp; /* Since no data, we need some internal format */ @@ -1008,8 +1007,6 @@ _cogl_texture_2d_sliced_new_with_size (unsigned int width, /* Init texture with empty bitmap */ tex_2ds = g_new (CoglTexture2DSliced, 1); - tex = COGL_TEXTURE (tex_2ds); - bmp.width = width; bmp.height = height; bmp.data = NULL; @@ -1037,7 +1034,6 @@ _cogl_texture_2d_sliced_new_from_bitmap (CoglHandle bmp_handle, CoglPixelFormat internal_format) { CoglTexture2DSliced *tex_2ds; - CoglTexture *tex; CoglBitmap *bmp = (CoglBitmap *)bmp_handle; g_return_val_if_fail (bmp_handle != COGL_INVALID_HANDLE, COGL_INVALID_HANDLE); @@ -1045,8 +1041,6 @@ _cogl_texture_2d_sliced_new_from_bitmap (CoglHandle bmp_handle, /* Create new texture and fill with loaded data */ tex_2ds = g_new0 (CoglTexture2DSliced, 1); - tex = COGL_TEXTURE (tex_2ds); - if (flags & COGL_TEXTURE_NO_SLICING) tex_2ds->max_waste = -1; else @@ -1121,7 +1115,8 @@ _cogl_texture_2d_sliced_new_from_foreign (GLuint gl_handle, return COGL_INVALID_HANDLE; /* Make sure binding succeeds */ - gl_error = glGetError (); + while ((gl_error = glGetError ()) != GL_NO_ERROR) + ; glBindTexture (gl_target, gl_handle); if (glGetError () != GL_NO_ERROR) return COGL_INVALID_HANDLE; diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c index e94aaf0e2..bf70c9ef4 100644 --- a/cogl/cogl-texture.c +++ b/cogl/cogl-texture.c @@ -800,8 +800,8 @@ do_texture_draw_and_read (CoglHandle handle, tex_width = cogl_texture_get_width (handle); tex_height = cogl_texture_get_height (handle); - ry1 = 0; ry2 = 0; - ty1 = 0; ty2 = 0; + ry2 = 0; + ty2 = 0; /* Walk Y axis until whole bitmap height consumed */ for (bh = tex_height; bh > 0; bh -= viewport[3]) @@ -814,8 +814,8 @@ do_texture_draw_and_read (CoglHandle handle, ty1 = ty2; ty2 = (ry2 / (float) tex_height); - rx1 = 0; rx2 = 0; - tx1 = 0; tx2 = 0; + rx2 = 0; + tx2 = 0; /* Walk X axis until whole bitmap width consumed */ for (bw = tex_width; bw > 0; bw-=viewport[2])