From 28024de314a49e6519403794cdb17350ba079cc5 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 22 Feb 2021 01:38:26 +1100 Subject: [PATCH] [client] egl: fix gcc false `maybe-uninitialized` positives --- client/renderers/EGL/desktop.c | 2 +- client/renderers/EGL/egl.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/client/renderers/EGL/desktop.c b/client/renderers/EGL/desktop.c index f9690f71..45b27adf 100644 --- a/client/renderers/EGL/desktop.c +++ b/client/renderers/EGL/desktop.c @@ -248,7 +248,7 @@ bool egl_desktop_render(EGL_Desktop * desktop, const float x, const float y, if (!desktop->shader) return false; - int scaleAlgo; + int scaleAlgo = LG_SCALE_NEAREST; switch (scaleType) { diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index e9efa346..c5aa9694 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -223,13 +223,12 @@ bool egl_create(void ** opaque, const LG_RendererParams params, bool * needsOpen return false; // create our local storage - *opaque = malloc(sizeof(struct Inst)); + *opaque = calloc(1, sizeof(struct Inst)); if (!*opaque) { DEBUG_INFO("Failed to allocate %lu bytes", sizeof(struct Inst)); return false; } - memset(*opaque, 0, sizeof(struct Inst)); // safe off parameteres and init our default option values struct Inst * this = (struct Inst *)*opaque; @@ -402,7 +401,7 @@ static void egl_calc_mouse_state(struct Inst * this) static void egl_update_scale_type(struct Inst * this) { - int width, height; + int width = 0, height = 0; switch (this->rotate) {