Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: ui/gl/gl_version_info.cc

Issue 2070313002: Parse GL_VERSION incorrectly when version string is without release_number (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Four indent instead of two Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_tests.gyp ('k') | ui/gl/gl_version_info_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gl_version_info.h" 5 #include "ui/gl/gl_version_info.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_tokenizer.h" 8 #include "base/strings/string_tokenizer.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 *minor_version = 0; 66 *minor_version = 0;
67 *is_es = false; 67 *is_es = false;
68 *is_es2 = false; 68 *is_es2 = false;
69 *is_es3 = false; 69 *is_es3 = false;
70 if (!version_str) 70 if (!version_str)
71 return; 71 return;
72 std::string lstr(base::ToLowerASCII(version_str)); 72 std::string lstr(base::ToLowerASCII(version_str));
73 *is_es = (lstr.length() > 12) && (lstr.substr(0, 9) == "opengl es"); 73 *is_es = (lstr.length() > 12) && (lstr.substr(0, 9) == "opengl es");
74 if (*is_es) 74 if (*is_es)
75 lstr = lstr.substr(10, 3); 75 lstr = lstr.substr(10, 3);
76 base::StringTokenizer tokenizer(lstr.begin(), lstr.end(), "."); 76 base::StringTokenizer tokenizer(lstr.begin(), lstr.end(), ". ");
77 unsigned major, minor; 77 unsigned major, minor;
78 if (tokenizer.GetNext() && 78 if (tokenizer.GetNext() &&
79 base::StringToUint(tokenizer.token_piece(), &major)) { 79 base::StringToUint(tokenizer.token_piece(), &major)) {
80 *major_version = major; 80 *major_version = major;
81 if (tokenizer.GetNext() && 81 if (tokenizer.GetNext() &&
82 base::StringToUint(tokenizer.token_piece(), &minor)) { 82 base::StringToUint(tokenizer.token_piece(), &minor)) {
83 *minor_version = minor; 83 *minor_version = minor;
84 } 84 }
85 } 85 }
86 if (*is_es && *major_version == 2) 86 if (*is_es && *major_version == 2)
87 *is_es2 = true; 87 *is_es2 = true;
88 if (*is_es && *major_version == 3) 88 if (*is_es && *major_version == 3)
89 *is_es3 = true; 89 *is_es3 = true;
90 DCHECK(major_version != 0); 90 DCHECK(major_version != 0);
91 } 91 }
92 92
93 } // namespace gl 93 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_tests.gyp ('k') | ui/gl/gl_version_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698