Fix compilation warnings

This commit is contained in:
Tomaka17 2014-09-23 08:01:18 +02:00
parent 0773427513
commit ea957ce1d7
4 changed files with 10 additions and 10 deletions

View file

@ -87,7 +87,7 @@ pub fn new_window(builder: WindowBuilder) -> Result<Window, String> {
screen_settings.dmFields = ffi::DM_BITSPERPEL | ffi::DM_PELSWIDTH | ffi::DM_PELSHEIGHT; screen_settings.dmFields = ffi::DM_BITSPERPEL | ffi::DM_PELSWIDTH | ffi::DM_PELSHEIGHT;
let result = unsafe { ffi::ChangeDisplaySettingsExW(monitor.get_system_name().as_ptr(), let result = unsafe { ffi::ChangeDisplaySettingsExW(monitor.get_system_name().as_ptr(),
&mut screen_settings, ptr::null(), ffi::CDS_FULLSCREEN, ptr::mut_null()) }; &mut screen_settings, ptr::null(), ffi::CDS_FULLSCREEN, ptr::null_mut()) };
if result != ffi::DISP_CHANGE_SUCCESSFUL { if result != ffi::DISP_CHANGE_SUCCESSFUL {
tx.send(Err(format!("ChangeDisplaySettings failed: {}", result))); tx.send(Err(format!("ChangeDisplaySettings failed: {}", result)));
@ -117,7 +117,7 @@ pub fn new_window(builder: WindowBuilder) -> Result<Window, String> {
ffi::CW_USEDEFAULT, ffi::CW_USEDEFAULT, ffi::CW_USEDEFAULT, ffi::CW_USEDEFAULT,
rect.right - rect.left, rect.bottom - rect.top, rect.right - rect.left, rect.bottom - rect.top,
ptr::null(), ptr::null(), ffi::GetModuleHandleW(ptr::null()), ptr::null(), ptr::null(), ffi::GetModuleHandleW(ptr::null()),
ptr::mut_null()); ptr::null_mut());
if handle.is_null() { if handle.is_null() {
use std::os; use std::os;
@ -240,7 +240,7 @@ pub fn new_window(builder: WindowBuilder) -> Result<Window, String> {
if builder.monitor.is_some() { 0 } else { ffi::CW_USEDEFAULT }, if builder.monitor.is_some() { 0 } else { ffi::CW_USEDEFAULT },
width.unwrap_or(ffi::CW_USEDEFAULT), height.unwrap_or(ffi::CW_USEDEFAULT), width.unwrap_or(ffi::CW_USEDEFAULT), height.unwrap_or(ffi::CW_USEDEFAULT),
ptr::null(), ptr::null(), ffi::GetModuleHandleW(ptr::null()), ptr::null(), ptr::null(), ffi::GetModuleHandleW(ptr::null()),
ptr::mut_null()); ptr::null_mut());
if handle.is_null() { if handle.is_null() {
use std::os; use std::os;

View file

@ -95,7 +95,7 @@ pub fn get_primary_monitor() -> MonitorID {
// we simply get all available monitors and return the one with the `PRIMARY_DEVICE` flag // we simply get all available monitors and return the one with the `PRIMARY_DEVICE` flag
// TODO: it is possible to query the win32 API for the primary monitor, this should be done // TODO: it is possible to query the win32 API for the primary monitor, this should be done
// instead // instead
for monitor in get_available_monitors().move_iter() { for monitor in get_available_monitors().into_iter() {
if (monitor.flags & ffi::DISPLAY_DEVICE_PRIMARY_DEVICE) != 0 { if (monitor.flags & ffi::DISPLAY_DEVICE_PRIMARY_DEVICE) != 0 {
return monitor return monitor
} }

View file

@ -1,5 +1,5 @@
#![allow(dead_code)] #![allow(dead_code)]
#![allow(non_snake_case_functions)] #![allow(non_snake_case)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
use libc; use libc;
@ -27,7 +27,7 @@ pub type VisualID = libc::c_ulong; // TODO: not sure
pub type Window = XID; pub type Window = XID;
pub type XrmDatabase = *const (); // TODO: not sure pub type XrmDatabase = *const (); // TODO: not sure
pub type XIC = *mut (); pub type XIC = *mut ();
pub type XID = uint; pub type XID = libc::uintptr_t;
pub type XIM = *mut (); pub type XIM = *mut ();
pub type Screen = (); pub type Screen = ();

View file

@ -172,7 +172,7 @@ impl Window {
as *const u8) as *const (); as *const u8) as *const ();
} }
addr.to_option().map(|addr| { addr.as_ref().map(|addr| {
let addr: extern "system" fn(*mut ffi::Display, ffi::GLXFBConfig, ffi::GLXContext, let addr: extern "system" fn(*mut ffi::Display, ffi::GLXFBConfig, ffi::GLXContext,
ffi::Bool, *const libc::c_int) -> ffi::GLXContext = mem::transmute(addr); ffi::Bool, *const libc::c_int) -> ffi::GLXContext = mem::transmute(addr);
addr addr
@ -181,7 +181,7 @@ impl Window {
// creating IM // creating IM
let im = unsafe { let im = unsafe {
let im = ffi::XOpenIM(display, ptr::null(), ptr::mut_null(), ptr::mut_null()); let im = ffi::XOpenIM(display, ptr::null(), ptr::null_mut(), ptr::null_mut());
if im.is_null() { if im.is_null() {
return Err(format!("XOpenIM failed")); return Err(format!("XOpenIM failed"));
} }
@ -320,7 +320,7 @@ impl Window {
unimplemented!() unimplemented!()
} }
pub fn set_inner_size(&self, x: uint, y: uint) { pub fn set_inner_size(&self, _x: uint, _y: uint) {
unimplemented!() unimplemented!()
} }
@ -390,7 +390,7 @@ impl Window {
let raw_ev: *mut ffi::XKeyEvent = event; let raw_ev: *mut ffi::XKeyEvent = event;
let count = ffi::Xutf8LookupString(self.ic, mem::transmute(raw_ev), let count = ffi::Xutf8LookupString(self.ic, mem::transmute(raw_ev),
mem::transmute(buffer.as_mut_ptr()), mem::transmute(buffer.as_mut_ptr()),
buffer.len() as libc::c_int, ptr::mut_null(), ptr::mut_null()); buffer.len() as libc::c_int, ptr::null_mut(), ptr::null_mut());
str::from_utf8(buffer.as_slice().slice_to(count as uint)) str::from_utf8(buffer.as_slice().slice_to(count as uint))
.unwrap_or("").to_string() .unwrap_or("").to_string()