From abcff5b7f125a9e0d203025207fae07e58c40d8f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 7 Jun 2020 12:38:24 +0200 Subject: Cleanup: Fix uninitialised variables --- examples/pugl_shader_demo.c | 2 +- examples/shader_utils.h | 8 ++++---- pugl/detail/x11.c | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c index 7c0df6a..15e1943 100644 --- a/examples/pugl_shader_demo.c +++ b/examples/pugl_shader_demo.c @@ -306,7 +306,7 @@ setupGl(PuglTestApp* app) "UniformBufferObject"); // Generate/bind a uniform buffer for setting rectangle properties - GLuint uboHandle; + GLuint uboHandle = 0; glGenBuffers(1, &uboHandle); glBindBuffer(GL_UNIFORM_BUFFER, uboHandle); glBindBufferBase(GL_UNIFORM_BUFFER, globalsIndex, uboHandle); diff --git a/examples/shader_utils.h b/examples/shader_utils.h index 9cfc850..10a7ace 100644 --- a/examples/shader_utils.h +++ b/examples/shader_utils.h @@ -36,10 +36,10 @@ compileShader(const char* header, const char* source, const GLenum type) glShaderSource(shader, 2, sources, lengths); glCompileShader(shader); - int status; + int status = 0; glGetShaderiv(shader, GL_COMPILE_STATUS, &status); if (status == GL_FALSE) { - GLint length; + GLint length = 0; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length); char* log = (char*)calloc(1, (size_t)length); @@ -83,10 +83,10 @@ compileProgram(const char* headerSource, glAttachShader(program.program, program.fragmentShader); glLinkProgram(program.program); - GLint status; + GLint status = 0; glGetProgramiv(program.program, GL_LINK_STATUS, &status); if (status == GL_FALSE) { - GLint length; + GLint length = 0; glGetProgramiv(program.program, GL_INFO_LOG_LENGTH, &length); char* log = (char*)calloc(1, (size_t)length); diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index 6a580ce..987f55f 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -75,11 +75,11 @@ static bool puglInitXSync(PuglWorldInternals* impl) { #ifdef HAVE_XSYNC - int syncMajor; - int syncMinor; - int errorBase; - XSyncSystemCounter* counters; - int numCounters; + int syncMajor = 0; + int syncMinor = 0; + int errorBase = 0; + XSyncSystemCounter* counters = NULL; + int numCounters = 0; if (XSyncQueryExtension(impl->display, &impl->syncEventBase, &errorBase) && XSyncInitialize(impl->display, &syncMajor, &syncMinor) && -- cgit v1.2.1