Skip to content

Commit 0860c78

Browse files
authoredDec 23, 2024
Fix correct CStr pointer type
1 parent 92d8a1b commit 0860c78

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,13 @@ fn unpack_rkafp(file_path: &str, dst_path: &str) -> Result<()> {
258258
}
259259
create_dir_all(format!("{}/Image", dst_path))?;
260260
unsafe {
261-
println!("manufacturer: {}", CStr::from_ptr(header.manufacturer.as_ptr() as *const i8).to_str()?);
262-
println!("model: {}", CStr::from_ptr(header.model.as_ptr() as *const i8).to_str()?);
261+
println!("manufacturer: {}", CStr::from_ptr(header.manufacturer.as_ptr() as *const std::ffi::c_char).to_str()?);
262+
println!("model: {}", CStr::from_ptr(header.model.as_ptr() as *const std::ffi::c_char).to_str()?);
263263
}
264264
for i in 0..header.num_parts {
265265
let part = &header.parts[i as usize];
266266
unsafe {
267-
let cstr = CStr::from_ptr(part.full_path.as_ptr() as *const i8);
267+
let cstr = CStr::from_ptr(part.full_path.as_ptr() as *const std::ffi::c_char);
268268
let part_full_path = cstr.to_str()?;
269269
if part_full_path == "SELF" || part_full_path == "RESERVED" {
270270
continue;
@@ -294,4 +294,4 @@ fn write_file(path: &Path, buffer: &[u8]) -> Result<()> {
294294
let mut file = File::create(path)?;
295295
file.write_all(buffer)?;
296296
Ok(())
297-
}
297+
}

0 commit comments

Comments
 (0)
Please sign in to comment.