Skip to content

Commit f38f566

Browse files
committed
update sdl2 version to 0.6.0, fix compile errors
1 parent 0be0691 commit f38f566

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ path = "src/sdl2_image/lib.rs"
1414
[dependencies]
1515
bitflags = "0.1.1"
1616
libc = "0.1.6"
17-
sdl2 = "0.5"
18-
sdl2-sys = "0.5"
17+
sdl2 = "0.6"
18+
sdl2-sys = "0.6"
1919

2020
[[bin]]
2121
name = "demo"

src/sdl2_image/lib.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ extern crate sdl2_sys as sys;
99
extern crate bitflags;
1010

1111
use libc::{c_int, c_char};
12-
use std::ptr;
1312
use std::ffi::CString;
1413
use std::path::Path;
1514
use sdl2::surface::Surface;
@@ -72,10 +71,10 @@ impl<'a> LoadSurface for Surface<'a> {
7271
//! Loads an SDL Surface from a file
7372
unsafe {
7473
let raw = ffi::IMG_Load(CString::new(filename.to_str().unwrap()).unwrap().as_ptr());
75-
if raw == ptr::null_mut() {
74+
if (raw as *mut ()).is_null() {
7675
Err(get_error())
7776
} else {
78-
Ok(Surface::from_ll(raw, true))
77+
Ok(Surface::from_ll(raw))
7978
}
8079
}
8180
}
@@ -84,10 +83,10 @@ impl<'a> LoadSurface for Surface<'a> {
8483
//! Loads an SDL Surface from XPM data
8584
unsafe {
8685
let raw = ffi::IMG_ReadXPMFromArray(xpm as *const *const c_char);
87-
if raw == ptr::null_mut() {
86+
if (raw as *mut ()).is_null() {
8887
Err(get_error())
8988
} else {
90-
Ok(Surface::from_ll(raw, true))
89+
Ok(Surface::from_ll(raw))
9190
}
9291
}
9392
}
@@ -130,7 +129,7 @@ impl<'a> LoadTexture for Renderer<'a> {
130129
//! Loads an SDL Texture from a file
131130
unsafe {
132131
let raw = ffi::IMG_LoadTexture(self.raw(), CString::new(filename.to_str().unwrap()).unwrap().as_ptr());
133-
if raw == ptr::null_mut() {
132+
if (raw as *mut ()).is_null() {
134133
Err(get_error())
135134
} else {
136135
Ok(Texture::from_ll(self, raw))
@@ -162,10 +161,10 @@ pub fn get_linked_version() -> Version {
162161

163162
#[inline]
164163
fn to_surface_result<'a>(raw: *mut sys::surface::SDL_Surface) -> SdlResult<Surface<'a>> {
165-
if raw == ptr::null_mut() {
164+
if (raw as *mut ()).is_null() {
166165
Err(get_error())
167166
} else {
168-
unsafe { Ok(Surface::from_ll(raw, true)) }
167+
unsafe { Ok(Surface::from_ll(raw)) }
169168
}
170169
}
171170

0 commit comments

Comments
 (0)