Skip to content

Commit 82a0ca4

Browse files
author
bors-servo
authored
Auto merge of #584 - frewsxcv:get_string, r=glennw
Use safe function for GL `GetString`. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/584) <!-- Reviewable:end -->
2 parents 4db55ba + 3c6bda6 commit 82a0ca4

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

sample/src/main.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,7 @@ fn main() {
7373
gl::clear_color(0.3, 0.0, 0.0, 1.0);
7474
}
7575

76-
let version = unsafe {
77-
let data = CStr::from_ptr(gl::GetString(gl::VERSION) as *const _).to_bytes().to_vec();
78-
String::from_utf8(data).unwrap()
79-
};
80-
81-
println!("OpenGL version {}", version);
76+
println!("OpenGL version {}", gl::get_string(gl::VERSION));
8277
println!("Shader resource path: {:?}", res_path);
8378

8479
let (width, height) = window.get_inner_size().unwrap();

0 commit comments

Comments
 (0)