Change set_float_multi_raw to unsafe because it dereferences a raw pointer argument (not_unsafe_ptr_arg_deref); fix typo

This commit is contained in:
ice_iix 2020-07-02 16:49:38 -07:00
parent 0f9dcd2515
commit c27425750d
3 changed files with 6 additions and 6 deletions

View File

@ -648,10 +648,9 @@ impl Uniform {
}
}
pub fn set_float_mutli_raw(&self, data: *const f32, len: usize) {
unsafe {
gl::Uniform4fv(self.0, len as i32, data);
}
#[allow(clippy::missing_safety_doc)]
pub unsafe fn set_float_multi_raw(&self, data: *const f32, len: usize) {
gl::Uniform4fv(self.0, len as i32, data);
}
pub fn set_matrix4(&self, m: &::cgmath::Matrix4<f32>) {

View File

@ -15,7 +15,6 @@
#![recursion_limit = "300"]
#![allow(clippy::too_many_arguments)] // match standard gl functions with many arguments
#![allow(clippy::many_single_char_names)] // short variable names provide concise clarity
#![warn(clippy::not_unsafe_ptr_arg_deref)] // TODO: fix unsafe warnings
#![allow(clippy::float_cmp)] // float comparison used to check if changed
use log::{error, info, warn};

View File

@ -283,7 +283,9 @@ impl Manager {
v.set_matrix4_multi(&model.matrix)
}
if let Some(v) = collection.shader.color_mul {
v.set_float_mutli_raw(model.colors.as_ptr() as *const _, model.colors.len())
unsafe {
v.set_float_multi_raw(model.colors.as_ptr() as *const _, model.colors.len())
}
}
gl::draw_elements(gl::TRIANGLES, model.count, self.index_type, 0);
}