From abbcdd52149b88a083e035239cd22f4a2b51101f Mon Sep 17 00:00:00 2001 From: sbidin Date: Mon, 23 Mar 2015 01:56:48 +0100 Subject: [PATCH] CVec was removed from stdlib, so use outside copy. --- Cargo.toml | 1 + src/sdl2_gfx/imagefilter.rs | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c93cfebe..0f3bfa73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ name = "sdl2_gfx" path = "src/sdl2_gfx/lib.rs" [dependencies] +c_vec = "^1.0.0" [dependencies.sdl2] git = "https://github.com/AngryLawyer/rust-sdl2/" diff --git a/src/sdl2_gfx/imagefilter.rs b/src/sdl2_gfx/imagefilter.rs index e873ba3b..2866dfda 100644 --- a/src/sdl2_gfx/imagefilter.rs +++ b/src/sdl2_gfx/imagefilter.rs @@ -1,10 +1,13 @@ //! MMX image filters +extern crate c_vec; + use std::mem; -use std::c_vec::CVec; +use std::ptr::Unique; use libc; use libc::{size_t, c_void, c_uint, c_int}; use sdl2::SdlResult; +use self::c_vec::CVec; mod ll { /* automatically generated by rust-bindgen */ @@ -105,7 +108,7 @@ pub fn mmx_on() { fn cvec_with_size(sz: uint) -> CVec { unsafe { let p = libc::malloc(sz as size_t) as *mut u8; - CVec::new_with_dtor(p, sz, move || { + CVec::new_with_dtor(Unique::new(p), sz, move |p| { libc::free(p as *mut c_void) }) }