Merge pull request #439 from Esption/master

Fixed build warnings on Linux
This commit is contained in:
tomaka 2015-05-09 07:04:01 +02:00
commit 9ba9bfc369
10 changed files with 21 additions and 16 deletions

View file

@ -1,6 +1,6 @@
#![allow(non_camel_case_types)]
use libc; use libc;
use std::ffi::CStr;
use std::mem;
pub type caca_display_t = libc::c_void; pub type caca_display_t = libc::c_void;
pub type caca_canvas_t = libc::c_void; pub type caca_canvas_t = libc::c_void;

View file

@ -1,4 +1,5 @@
#![cfg(any(target_os = "linux", target_os = "freebsd"))] #![cfg(any(target_os = "linux", target_os = "freebsd"))]
#![allow(unused_variables, dead_code)]
use libc; use libc;
use api::osmesa::{OsMesaContext, OsMesaCreationError}; use api::osmesa::{OsMesaContext, OsMesaCreationError};

View file

@ -1,4 +1,5 @@
#![cfg(target_os = "linux")] #![cfg(target_os = "linux")]
#![allow(dead_code)]
use libc; use libc;

View file

@ -1,3 +1,5 @@
#![allow(non_camel_case_types)]
use libc; use libc;
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]

View file

@ -1,4 +1,5 @@
#![cfg(any(target_os = "linux", target_os = "android"))] #![cfg(any(target_os = "linux", target_os = "android"))]
#![allow(unused_variables)]
use BuilderAttribs; use BuilderAttribs;
use CreationError; use CreationError;
@ -161,9 +162,7 @@ impl Context {
impl GlContext for Context { impl GlContext for Context {
unsafe fn make_current(&self) { unsafe fn make_current(&self) {
let ret = unsafe { let ret = self.egl.MakeCurrent(self.display, self.surface, self.surface, self.context);
self.egl.MakeCurrent(self.display, self.surface, self.surface, self.context)
};
if ret == 0 { if ret == 0 {
panic!("eglMakeCurrent failed"); panic!("eglMakeCurrent failed");
@ -206,8 +205,6 @@ unsafe impl Sync for Context {}
impl Drop for Context { impl Drop for Context {
fn drop(&mut self) { fn drop(&mut self) {
use std::ptr;
unsafe { unsafe {
// we don't call MakeCurrent(0, 0) because we are not sure that the context // we don't call MakeCurrent(0, 0) because we are not sure that the context
// is still the current one // is still the current one

View file

@ -60,6 +60,7 @@ impl OsMesaContext {
(self.width, self.height) (self.width, self.height)
} }
#[allow(dead_code)]
// TODO: can we remove this without causing havoc? // TODO: can we remove this without causing havoc?
pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) { pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
} }

View file

@ -1,4 +1,5 @@
#![cfg(target_os = "linux")] #![cfg(target_os = "linux")]
#![allow(unused_variables, dead_code)]
use self::wayland::egl::{EGLSurface, is_egl_available}; use self::wayland::egl::{EGLSurface, is_egl_available};
use self::wayland::core::{Display, Registry, Compositor, Shell, ShellSurface, use self::wayland::core::{Display, Registry, Compositor, Shell, ShellSurface,
@ -258,7 +259,7 @@ impl Window {
wayland_context.register_surface(shell_surface.get_wsurface().get_id(), events.clone()); wayland_context.register_surface(shell_surface.get_wsurface().get_id(), events.clone());
wayland_context.display.flush(); wayland_context.display.flush().unwrap();
Ok(Window { Ok(Window {
shell_surface: shell_surface, shell_surface: shell_surface,

View file

@ -414,7 +414,7 @@ impl Window {
}; };
// getting the visual infos // getting the visual infos
let mut visual_infos: ffi::glx::types::XVisualInfo = unsafe { let visual_infos: ffi::glx::types::XVisualInfo = unsafe {
let vi = glx.GetVisualFromFBConfig(display as *mut _, fb_config); let vi = glx.GetVisualFromFBConfig(display as *mut _, fb_config);
if vi.is_null() { if vi.is_null() {
return Err(OsError(format!("glx::ChooseVisual failed"))); return Err(OsError(format!("glx::ChooseVisual failed")));

View file

@ -106,26 +106,27 @@ impl gl_common::GlFunctionsSource for HeadlessContext {
impl GlContext for HeadlessContext { impl GlContext for HeadlessContext {
unsafe fn make_current(&self) { unsafe fn make_current(&self) {
self.make_current() self.context.make_current()
} }
fn is_current(&self) -> bool { fn is_current(&self) -> bool {
self.is_current() self.context.is_current()
} }
fn get_proc_address(&self, addr: &str) -> *const libc::c_void { fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
self.get_proc_address(addr) self.context.get_proc_address(addr)
} }
fn swap_buffers(&self) { fn swap_buffers(&self) {
self.swap_buffers() self.context.swap_buffers()
} }
fn get_api(&self) -> Api { fn get_api(&self) -> Api {
self.get_api() self.context.get_api()
} }
fn get_pixel_format(&self) -> PixelFormat { fn get_pixel_format(&self) -> PixelFormat {
self.get_pixel_format() self.context.get_pixel_format()
} }
} }

View file

@ -323,6 +323,7 @@ impl BuilderAttribs<'static> {
} }
impl<'a> BuilderAttribs<'a> { impl<'a> BuilderAttribs<'a> {
#[allow(dead_code)]
fn extract_non_static(mut self) -> (BuilderAttribs<'static>, Option<&'a platform::Window>) { fn extract_non_static(mut self) -> (BuilderAttribs<'static>, Option<&'a platform::Window>) {
let sharing = self.sharing.take(); let sharing = self.sharing.take();