Fix glShaderSource with negative lengths

Each element of length can still be negative to indicate the string is
NULL-terminated.
This commit is contained in:
Chia-I Wu
2016-03-10 12:18:54 +08:00
committed by Chia-I Wu
parent e3bafd3162
commit aa8a0d353f
@@ -135,7 +135,7 @@ bool WrappedOpenGL::Serialise_glShaderSource(GLuint shader, GLsizei count, const
{
string s;
if(source && source[i])
s = length > 0 ? string(source[i], source[i] + length[i]) : string(source[i]);
s = (length && length[i] > 0) ? string(source[i], source[i] + length[i]) : string(source[i]);
m_pSerialiser->SerialiseString("source", s);
@@ -1331,7 +1331,7 @@ bool WrappedOpenGL::Serialise_glCompileShaderIncludeARB(GLuint shader, GLsizei c
{
string s;
if(path && path[i])
s = length > 0 ? string(path[i], path[i] + length[i]) : string(path[i]);
s = (length && length[i] > 0) ? string(path[i], path[i] + length[i]) : string(path[i]);
m_pSerialiser->SerialiseString("path", s);
@@ -1460,4 +1460,4 @@ void WrappedOpenGL::glDeleteNamedStringARB(GLint namelen, const GLchar *name)
}
}
#pragma endregion
#pragma endregion