compositor/background: Avoid uninitialized variable warning

'code' may be used uninitialized in this function, so make sure
to return early in this case.
This commit is contained in:
Rico Tzschichholz 2013-02-20 14:02:02 +01:00 committed by Rico Tzschichholz
parent 7f6a77232f
commit 1dbefc4e36

View File

@ -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);