[mutter] compositor/background: Avoid uninitialized variable warning



commit 1dbefc4e364561897bb8a375d23ebb7940ddc85d
Author: Rico Tzschichholz <ricotz t-online de>
Date:   Wed Feb 20 14:02:02 2013 +0100

    compositor/background: Avoid uninitialized variable warning
    
    'code' may be used uninitialized in this function, so make sure
    to return early in this case.

 src/compositor/meta-background.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c
index 78b2489..b24a8be 100644
--- a/src/compositor/meta-background.c
+++ b/src/compositor/meta-background.c
@@ -544,13 +544,8 @@ add_texture_lookup_shader (MetaBackground *self)
 {
   MetaBackgroundPrivate *priv = self->priv;
   CoglSnippet *snippet;
-  const char *code;
+  const char *code = NULL;
 
-  ensure_pipeline (self);
-
-  snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP,
-                              TEXTURE_LOOKUP_SHADER_DECLARATIONS,
-                              NULL);
   if ((priv->effects & META_BACKGROUND_EFFECTS_BLUR) &&
       (priv->effects & META_BACKGROUND_EFFECTS_DESATURATE))
     code = BLUR_CODE "\n" DESATURATE_CODE;
@@ -558,7 +553,14 @@ add_texture_lookup_shader (MetaBackground *self)
     code = BLUR_CODE;
   else if (priv->effects & META_BACKGROUND_EFFECTS_DESATURATE)
     code = DESATURATE_CODE;
+  else
+    return;
+
+  ensure_pipeline (self);
 
+  snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_TEXTURE_LOOKUP,
+                              TEXTURE_LOOKUP_SHADER_DECLARATIONS,
+                              NULL);
   cogl_snippet_set_replace (snippet, code);
   cogl_pipeline_add_layer_snippet (priv->pipeline, 0, snippet);
   cogl_object_unref (snippet);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]