[client] egl: fix gcc false maybe-uninitialized positives

This commit is contained in:
Geoffrey McRae 2021-02-22 01:38:26 +11:00
parent 63ec2dc01b
commit 28024de314
2 changed files with 3 additions and 4 deletions

View File

@ -248,7 +248,7 @@ bool egl_desktop_render(EGL_Desktop * desktop, const float x, const float y,
if (!desktop->shader) if (!desktop->shader)
return false; return false;
int scaleAlgo; int scaleAlgo = LG_SCALE_NEAREST;
switch (scaleType) switch (scaleType)
{ {

View File

@ -223,13 +223,12 @@ bool egl_create(void ** opaque, const LG_RendererParams params, bool * needsOpen
return false; return false;
// create our local storage // create our local storage
*opaque = malloc(sizeof(struct Inst)); *opaque = calloc(1, sizeof(struct Inst));
if (!*opaque) if (!*opaque)
{ {
DEBUG_INFO("Failed to allocate %lu bytes", sizeof(struct Inst)); DEBUG_INFO("Failed to allocate %lu bytes", sizeof(struct Inst));
return false; return false;
} }
memset(*opaque, 0, sizeof(struct Inst));
// safe off parameteres and init our default option values // safe off parameteres and init our default option values
struct Inst * this = (struct Inst *)*opaque; 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) static void egl_update_scale_type(struct Inst * this)
{ {
int width, height; int width = 0, height = 0;
switch (this->rotate) switch (this->rotate)
{ {