Skip to content

Commit

Permalink
Merge pull request #56 from NotKild/master
Browse files Browse the repository at this point in the history
Fix variable type issue with Rust 1.6
  • Loading branch information
andelf committed Jan 5, 2016
2 parents 45387a9 + fb74815 commit ef4be16
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sdl2_image/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl<'a> LoadSurface for Surface<'a> {
fn from_file(filename: &Path) -> SdlResult<Surface<'a>> {
//! Loads an SDL Surface from a file
unsafe {
let raw = ffi::IMG_Load(CString::new(filename.to_str().unwrap()).unwrap().as_ptr());
let raw = ffi::IMG_Load(CString::new(filename.to_str().unwrap()).unwrap().as_ptr() as *const i8);
if (raw as *mut ()).is_null() {
Err(get_error())
} else {
Expand All @@ -96,7 +96,7 @@ impl<'a> SaveSurface for Surface<'a> {
fn save(&self, filename: &Path) -> SdlResult<()> {
//! Saves an SDL Surface to a file
unsafe {
let status = ffi::IMG_SavePNG(self.raw(), CString::new(filename.to_str().unwrap()).unwrap().as_ptr());
let status = ffi::IMG_SavePNG(self.raw(), CString::new(filename.to_str().unwrap()).unwrap().as_ptr() as *const i8);
if status != 0 {
Err(get_error())
} else {
Expand Down Expand Up @@ -128,7 +128,7 @@ impl<'a> LoadTexture for Renderer<'a> {
fn load_texture(&self, filename: &Path) -> SdlResult<Texture> {
//! Loads an SDL Texture from a file
unsafe {
let raw = ffi::IMG_LoadTexture(self.raw(), CString::new(filename.to_str().unwrap()).unwrap().as_ptr());
let raw = ffi::IMG_LoadTexture(self.raw(), CString::new(filename.to_str().unwrap()).unwrap().as_ptr() as *const i8);
if (raw as *mut ()).is_null() {
Err(get_error())
} else {
Expand Down Expand Up @@ -215,7 +215,7 @@ impl<'a> ImageRWops for RWops<'a> {
}
fn load_typed(&self, _type: &str) -> SdlResult<Surface> {
let raw = unsafe {
ffi::IMG_LoadTyped_RW(self.raw(), 0, CString::new(_type.as_bytes()).unwrap().as_ptr())
ffi::IMG_LoadTyped_RW(self.raw(), 0, CString::new(_type.as_bytes()).unwrap().as_ptr() as *const i8)
};
to_surface_result(raw)
}
Expand Down

2 comments on commit ef4be16

@MagaTailor
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong - it should have been as *const _

Saboteur!

@MagaTailor
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned the correct fix a month ago in this comment.

andelf/rust-sdl2_ttf#22

Please sign in to comment.