浏览代码

Use `zeroed` instead of `unitialized`.

It's at least clear if it worked, then.
Lucas Stadler 10 年之前
父节点
当前提交
24965887e1
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      rust/coffi/src/main.rs

+ 1 - 1
rust/coffi/src/main.rs

33
33
34
    let mut img: png_image;
34
    let mut img: png_image;
35
    unsafe {
35
    unsafe {
36
        img = std::mem::uninitialized();
36
        img = std::mem::zeroed();
37
        let res = png_image_begin_read_from_file(&mut img, "mei.png".as_ptr());
37
        let res = png_image_begin_read_from_file(&mut img, "mei.png".as_ptr());
38
        println!("read_from_file: {}", res);
38
        println!("read_from_file: {}", res);
39
        println!("{}x{}", img.width, img.height);
39
        println!("{}x{}", img.width, img.height);