Skip to content

Commit aba7fe8

Browse files
committed
mark functions as unsafe; add Safety sections
1 parent 49ec328 commit aba7fe8

File tree

1 file changed

+11
-3
lines changed
  • crates/processing_ffi/src

1 file changed

+11
-3
lines changed

crates/processing_ffi/src/lib.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,13 +1158,17 @@ pub extern "C" fn processing_light_create_spot(
11581158
#[unsafe(no_mangle)]
11591159
pub extern "C" fn processing_material_create_pbr() -> u64 {
11601160
error::clear_error();
1161-
error::check(|| material_create_pbr())
1161+
error::check(material_create_pbr)
11621162
.map(|e| e.to_bits())
11631163
.unwrap_or(0)
11641164
}
11651165

1166+
/// Set float value for `name` field on Material.
1167+
///
1168+
/// # Safety
1169+
/// - `name` must be non-null
11661170
#[unsafe(no_mangle)]
1167-
pub extern "C" fn processing_material_set_float(
1171+
pub unsafe extern "C" fn processing_material_set_float(
11681172
mat_id: u64,
11691173
name: *const std::ffi::c_char,
11701174
value: f32,
@@ -1180,8 +1184,12 @@ pub extern "C" fn processing_material_set_float(
11801184
});
11811185
}
11821186

1187+
/// Set float4 value for `name` field on Material.
1188+
///
1189+
/// # Safety
1190+
/// - `name` must be non-null
11831191
#[unsafe(no_mangle)]
1184-
pub extern "C" fn processing_material_set_float4(
1192+
pub unsafe extern "C" fn processing_material_set_float4(
11851193
mat_id: u64,
11861194
name: *const std::ffi::c_char,
11871195
r: f32,

0 commit comments

Comments
 (0)