Commit 51b2685b by jbauman@chromium.org

Don't use strlen inside of loop

This could hurt performance quite a bit. BUG=296 TEST= Review URL: https://codereview.appspot.com/5675086 git-svn-id: https://angleproject.googlecode.com/svn/trunk@993 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 0725e7df
#define MAJOR_VERSION 1 #define MAJOR_VERSION 1
#define MINOR_VERSION 0 #define MINOR_VERSION 0
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 992 #define BUILD_REVISION 993
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -2456,11 +2456,8 @@ void Program::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) ...@@ -2456,11 +2456,8 @@ void Program::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog)
if (mInfoLog) if (mInfoLog)
{ {
while (index < bufSize - 1 && index < (int)strlen(mInfoLog)) index = std::min(bufSize - 1, (int)strlen(mInfoLog));
{ memcpy(infoLog, mInfoLog, index);
infoLog[index] = mInfoLog[index];
index++;
}
} }
if (bufSize) if (bufSize)
......
...@@ -104,11 +104,8 @@ void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) ...@@ -104,11 +104,8 @@ void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog)
if (mInfoLog) if (mInfoLog)
{ {
while (index < bufSize - 1 && index < (int)strlen(mInfoLog)) index = std::min(bufSize - 1, (int)strlen(mInfoLog));
{ memcpy(infoLog, mInfoLog, index);
infoLog[index] = mInfoLog[index];
index++;
}
} }
if (bufSize) if (bufSize)
...@@ -152,11 +149,8 @@ void Shader::getSourceImpl(char *source, GLsizei bufSize, GLsizei *length, char ...@@ -152,11 +149,8 @@ void Shader::getSourceImpl(char *source, GLsizei bufSize, GLsizei *length, char
if (source) if (source)
{ {
while (index < bufSize - 1 && index < (int)strlen(source)) index = std::min(bufSize - 1, (int)strlen(source));
{ memcpy(buffer, source, index);
buffer[index] = source[index];
index++;
}
} }
if (bufSize) if (bufSize)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment