Fix parsing of extension string
Previously the parsing found the next space and then added the the difference between the current position and space to the set of tokens. This improperly generated empty strings if there were consecutive spaces or if spaces existed at the beginning or end of strings. To fix this, the parse is modified to use simple stringstream parsing. Bug: 22709246 Change-Id: I9e32c07bbf984eadccdadf1dc34437fa0c46088b
This commit is contained in:
parent
99426810e4
commit
e2fc6f87be
@ -14,6 +14,9 @@
|
|||||||
** limitations under the License.
|
** limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -115,15 +118,11 @@ void egl_context_t::onMakeCurrent(EGLSurface draw, EGLSurface read) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// tokenize the supported extensions for the glGetStringi() wrapper
|
// tokenize the supported extensions for the glGetStringi() wrapper
|
||||||
exts = gl_extensions.string();
|
std::stringstream ss;
|
||||||
while (1) {
|
std::string str;
|
||||||
const char *end = strchr(exts, ' ');
|
ss << gl_extensions.string();
|
||||||
if (end == NULL) {
|
while (ss >> str) {
|
||||||
tokenized_gl_extensions.push(String8(exts));
|
tokenized_gl_extensions.push(String8(str.c_str()));
|
||||||
break;
|
|
||||||
}
|
|
||||||
tokenized_gl_extensions.push(String8(exts, end - exts));
|
|
||||||
exts = end + 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user