clients: fix len-string formatting
All these have the printf format string wrong. "%*s" sets the field width but does not limit the string to len bytes. You need to set precision instead to limit to len bytes: "%.*s". Found by grepping, after wondering why my WIP prints printed garbage at the end. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
e62f276a21
commit
1ca4ed2015
@ -81,7 +81,7 @@ create_shader(const char *source, GLenum shader_type)
|
||||
char log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog(shader, 1000, &len, log);
|
||||
fprintf(stderr, "Error: compiling %s: %*s\n",
|
||||
fprintf(stderr, "Error: compiling %s: %.*s\n",
|
||||
shader_type == GL_VERTEX_SHADER ? "vertex" : "fragment",
|
||||
len, log);
|
||||
return 0;
|
||||
@ -111,7 +111,7 @@ create_program(struct nested_client *client,
|
||||
char log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog(client->program, 1000, &len, log);
|
||||
fprintf(stderr, "Error: linking:\n%*s\n", len, log);
|
||||
fprintf(stderr, "Error: linking:\n%.*s\n", len, log);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -546,7 +546,7 @@ create_shader(const char *source, GLenum shader_type)
|
||||
char log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog(shader, 1000, &len, log);
|
||||
fprintf(stderr, "Error: compiling %s: %*s\n",
|
||||
fprintf(stderr, "Error: compiling %s: %.*s\n",
|
||||
shader_type == GL_VERTEX_SHADER ? "vertex" : "fragment",
|
||||
len, log);
|
||||
return 0;
|
||||
@ -570,7 +570,7 @@ create_and_link_program(GLuint vert, GLuint frag)
|
||||
char log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog(program, 1000, &len, log);
|
||||
fprintf(stderr, "Error: linking:\n%*s\n", len, log);
|
||||
fprintf(stderr, "Error: linking:\n%.*s\n", len, log);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ create_shader(struct window *window, const char *source, GLenum shader_type)
|
||||
char log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog(shader, 1000, &len, log);
|
||||
fprintf(stderr, "Error: compiling %s: %*s\n",
|
||||
fprintf(stderr, "Error: compiling %s: %.*s\n",
|
||||
shader_type == GL_VERTEX_SHADER ? "vertex" : "fragment",
|
||||
len, log);
|
||||
exit(1);
|
||||
@ -272,7 +272,7 @@ init_gl(struct window *window)
|
||||
char log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog(program, 1000, &len, log);
|
||||
fprintf(stderr, "Error: linking:\n%*s\n", len, log);
|
||||
fprintf(stderr, "Error: linking:\n%.*s\n", len, log);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ create_shader(const char *source, GLenum shader_type)
|
||||
char log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog(shader, 1000, &len, log);
|
||||
fprintf(stderr, "Error: compiling %s: %*s\n",
|
||||
fprintf(stderr, "Error: compiling %s: %.*s\n",
|
||||
shader_type == GL_VERTEX_SHADER ? "vertex" : "fragment",
|
||||
len, log);
|
||||
exit(1);
|
||||
@ -325,7 +325,7 @@ triangle_init_gl(struct triangle_gl_state *trigl)
|
||||
char log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog(program, 1000, &len, log);
|
||||
fprintf(stderr, "Error: linking:\n%*s\n", len, log);
|
||||
fprintf(stderr, "Error: linking:\n%.*s\n", len, log);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user