summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorMichael Lentine <mlentine@google.com>2015-07-28 16:30:10 -0700
committerMichael Lentine <mlentine@google.com>2015-07-31 09:26:58 -0700
commite2fc6f87bea38ff3e4e6bd20ffe838b09b9f4411 (patch)
tree718cc59499b34e90f5d3ea13e47b3b02450317b3 /opengl
parent99426810e4828719be84a0f8c186161578512e93 (diff)
downloadframeworks_native-e2fc6f87bea38ff3e4e6bd20ffe838b09b9f4411.zip
frameworks_native-e2fc6f87bea38ff3e4e6bd20ffe838b09b9f4411.tar.gz
frameworks_native-e2fc6f87bea38ff3e4e6bd20ffe838b09b9f4411.tar.bz2
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
Diffstat (limited to 'opengl')
-rw-r--r--opengl/libs/EGL/egl_object.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/opengl/libs/EGL/egl_object.cpp b/opengl/libs/EGL/egl_object.cpp
index d511940..918faa8 100644
--- a/opengl/libs/EGL/egl_object.cpp
+++ b/opengl/libs/EGL/egl_object.cpp
@@ -14,6 +14,9 @@
** limitations under the License.
*/
+#include <string>
+#include <sstream>
+
#include <ctype.h>
#include <stdint.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
- exts = gl_extensions.string();
- while (1) {
- const char *end = strchr(exts, ' ');
- if (end == NULL) {
- tokenized_gl_extensions.push(String8(exts));
- break;
- }
- tokenized_gl_extensions.push(String8(exts, end - exts));
- exts = end + 1;
+ std::stringstream ss;
+ std::string str;
+ ss << gl_extensions.string();
+ while (ss >> str) {
+ tokenized_gl_extensions.push(String8(str.c_str()));
}
}
}