diff --git a/Cargo.toml b/Cargo.toml index 8fb11485..7eef800a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ name = "sdl2" description = "SDL2 bindings for Rust" repository = "https://github.com/AngryLawyer/rust-sdl2" documentation = "http://angrylawyer.github.io/rust-sdl2/sdl2/" -version = "0.11.0" +version = "0.12.0" license = "MIT" authors = [ "Tony Aldridge " ] keywords = ["SDL", "windowing", "graphics"] @@ -16,7 +16,7 @@ path = "src/sdl2/lib.rs" [dependencies] num = "0.1" -bitflags = "0.3.2" +bitflags = "0.3" libc = "0.2" rand = "0.3" diff --git a/README.md b/README.md index be2b0659..fcdce99b 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ download through Crates.io: ```toml [dependencies] - sdl2 = "0.11" + sdl2 = "0.12" ``` Alternatively, pull it from GitHub diff --git a/src/sdl2/audio.rs b/src/sdl2/audio.rs index b9e7a9fa..05f76cca 100644 --- a/src/sdl2/audio.rs +++ b/src/sdl2/audio.rs @@ -51,7 +51,7 @@ //! ``` use std::ffi::{CStr, CString}; use num::FromPrimitive; -use libc::{c_int, c_void, uint8_t}; +use libc::{c_int, c_void, uint8_t, c_char}; use std::ops::{Deref, DerefMut}; use std::path::Path; use std::marker::PhantomData; @@ -480,7 +480,7 @@ impl AudioDevice { let device_ptr = device.map_or(null(), |s| s.as_ptr()); let iscapture_flag = 0; - let device_id = ll::SDL_OpenAudioDevice(device_ptr, iscapture_flag, &desired, &mut obtained, 0); + let device_id = ll::SDL_OpenAudioDevice(device_ptr as *const c_char, iscapture_flag, &desired, &mut obtained, 0); match device_id { 0 => { Err(get_error()) diff --git a/src/sdl2/clipboard.rs b/src/sdl2/clipboard.rs index 91152e97..40e516d9 100644 --- a/src/sdl2/clipboard.rs +++ b/src/sdl2/clipboard.rs @@ -1,4 +1,5 @@ use std::ffi::{CString, CStr}; +use libc::c_char; use SdlResult; use get_error; @@ -31,7 +32,7 @@ impl ClipboardUtil { pub fn set_clipboard_text(&self, text: &str) -> SdlResult<()> { unsafe { let text = CString::new(text).unwrap(); - let result = ll::SDL_SetClipboardText(text.as_ptr()); + let result = ll::SDL_SetClipboardText(text.as_ptr() as *const c_char); if result == 0 { Err(get_error()) diff --git a/src/sdl2/controller.rs b/src/sdl2/controller.rs index d5676442..6a8a14fb 100644 --- a/src/sdl2/controller.rs +++ b/src/sdl2/controller.rs @@ -74,7 +74,7 @@ impl GameControllerSubsystem { pub fn add_mapping(&self, mapping: &str) -> SdlResult { let mapping = try!(CString::new(mapping).unwrap_or_sdlresult()); - let result = unsafe { ll::SDL_GameControllerAddMapping(mapping.as_ptr()) }; + let result = unsafe { ll::SDL_GameControllerAddMapping(mapping.as_ptr() as *const c_char) }; match result { 1 => Ok(MappingStatus::Added), @@ -112,7 +112,7 @@ impl Axis { /// used by the game controller mapping strings. pub fn from_string(axis: &str) -> Option { let id = match CString::new(axis) { - Ok(axis) => unsafe { ll::SDL_GameControllerGetAxisFromString(axis.as_ptr()) }, + Ok(axis) => unsafe { ll::SDL_GameControllerGetAxisFromString(axis.as_ptr() as *const c_char) }, // string contains a nul byte - it won't match anything. Err(_) => ll::SDL_CONTROLLER_AXIS_INVALID }; @@ -169,7 +169,7 @@ impl Button { /// used by the game controller mapping strings. pub fn from_string(button: &str) -> Option