Skip to content

Commit

Permalink
Remove public exports of gl_common and libc
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka committed Nov 8, 2015
1 parent 0386d09 commit 3489718
Show file tree
Hide file tree
Showing 21 changed files with 28 additions and 51 deletions.
4 changes: 2 additions & 2 deletions src/api/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl GlContext for Window {
}

#[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
self.context.get_proc_address(addr)
}

Expand Down Expand Up @@ -323,7 +323,7 @@ impl GlContext for HeadlessContext {
}

#[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
self.0.get_proc_address(addr)
}

Expand Down
2 changes: 1 addition & 1 deletion src/api/caca/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ impl GlContext for Window {
}

#[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
self.opengl.get_proc_address(addr)
}

Expand Down
4 changes: 2 additions & 2 deletions src/api/cocoa/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl GlContext for HeadlessContext {
}

#[inline]
fn get_proc_address(&self, _addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, _addr: &str) -> *const () {
let symbol_name: CFString = _addr.parse().unwrap();
let framework_name: CFString = "com.apple.opengl".parse().unwrap();
let framework = unsafe {
Expand All @@ -100,7 +100,7 @@ impl GlContext for HeadlessContext {
let symbol = unsafe {
CFBundleGetFunctionPointerForName(framework, symbol_name.as_concrete_TypeRef())
};
symbol as *const libc::c_void
symbol as *const ()
}

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion src/api/cocoa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ impl GlContext for Window {
}
}

fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
let symbol_name: CFString = FromStr::from_str(addr).unwrap();
let framework_name: CFString = FromStr::from_str("com.apple.opengl").unwrap();
let framework = unsafe {
Expand Down
2 changes: 1 addition & 1 deletion src/api/egl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ impl GlContext for Context {
unsafe { self.egl.GetCurrentContext() == self.context }
}

fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
let addr = CString::new(addr.as_bytes()).unwrap();
let addr = addr.as_ptr();
unsafe {
Expand Down
2 changes: 1 addition & 1 deletion src/api/emscripten/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl GlContext for Window {
true // FIXME:
}

fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
let addr = CString::new(addr.as_bytes()).unwrap();
let addr = addr.as_ptr();

Expand Down
2 changes: 1 addition & 1 deletion src/api/glx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl GlContext for Context {
unsafe { self.glx.GetCurrentContext() == self.context }
}

fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
let addr = CString::new(addr.as_bytes()).unwrap();
let addr = addr.as_ptr();
unsafe {
Expand Down
4 changes: 2 additions & 2 deletions src/api/ios/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,12 @@ impl GlContext for Window {
false
}

fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
let addr_c = CString::new(addr).unwrap();
let path = CString::new("/System/Library/Frameworks/OpenGLES.framework/OpenGLES").unwrap();
unsafe {
let lib = dlopen(path.as_ptr(), RTLD_LAZY | RTLD_GLOBAL);
dlsym(lib, addr_c.as_ptr())
dlsym(lib, addr_c.as_ptr()) as *const _
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/api/osmesa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl GlContext for OsMesaContext {
unsafe { osmesa_sys::OSMesaGetCurrentContext() == self.context }
}

fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
unsafe {
let c_str = CString::new(addr.as_bytes().to_vec()).unwrap();
mem::transmute(osmesa_sys::OSMesaGetProcAddress(mem::transmute(c_str.as_ptr())))
Expand Down
2 changes: 1 addition & 1 deletion src/api/wayland/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ impl GlContext for Window {
}

#[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
self.context.get_proc_address(addr)
}

Expand Down
2 changes: 1 addition & 1 deletion src/api/wgl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl GlContext for Context {
unsafe { gl::wgl::GetCurrentContext() == self.context.0 as *const libc::c_void }
}

fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
let addr = CString::new(addr.as_bytes()).unwrap();
let addr = addr.as_ptr();

Expand Down
2 changes: 1 addition & 1 deletion src/api/win32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ impl GlContext for Window {
}

#[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
match self.context {
Context::Wgl(ref c) => c.get_proc_address(addr),
Context::Egl(ref c) => c.get_proc_address(addr),
Expand Down
2 changes: 1 addition & 1 deletion src/api/x11/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ impl GlContext for Window {
}

#[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
match self.x.context {
Context::Glx(ref ctxt) => ctxt.get_proc_address(addr),
Context::Egl(ref ctxt) => ctxt.get_proc_address(addr),
Expand Down
16 changes: 3 additions & 13 deletions src/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ use PixelFormat;
use PixelFormatRequirements;
use Robustness;

use gl_common;
use libc;

use platform;

/// Object that allows you to build headless contexts.
Expand Down Expand Up @@ -103,8 +100,8 @@ impl HeadlessContext {
///
/// Contrary to `wglGetProcAddress`, all available OpenGL functions return an address.
#[inline]
pub fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
self.context.get_proc_address(addr) as *const libc::c_void
pub fn get_proc_address(&self, addr: &str) -> *const () {
self.context.get_proc_address(addr)
}

/// Returns the API that is currently provided by this window.
Expand All @@ -120,13 +117,6 @@ impl HeadlessContext {
}
}

impl gl_common::GlFunctionsSource for HeadlessContext {
#[inline]
fn get_proc_addr(&self, addr: &str) -> *const libc::c_void {
self.get_proc_address(addr)
}
}

impl GlContext for HeadlessContext {
#[inline]
unsafe fn make_current(&self) -> Result<(), ContextError> {
Expand All @@ -139,7 +129,7 @@ impl GlContext for HeadlessContext {
}

#[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
self.context.get_proc_address(addr)
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub trait GlContext {
fn is_current(&self) -> bool;

/// Returns the address of an OpenGL function.
fn get_proc_address(&self, addr: &str) -> *const libc::c_void;
fn get_proc_address(&self, addr: &str) -> *const ();

/// Swaps the buffers in case of double or triple buffering.
///
Expand Down
2 changes: 1 addition & 1 deletion src/platform/emscripten/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl GlContext for HeadlessContext {
}

#[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
self.0.get_proc_address(addr)
}

Expand Down
3 changes: 1 addition & 2 deletions src/platform/ios/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![cfg(target_os = "ios")]
use libc::c_void;

use GlAttributes;
use CreationError;
Expand Down Expand Up @@ -33,7 +32,7 @@ impl HeadlessContext {
}

/// See the docs in the crate root file.
pub fn get_proc_address(&self, _addr: &str) -> *const c_void {
pub fn get_proc_address(&self, _addr: &str) -> *const () {
unimplemented!()
}

Expand Down
2 changes: 1 addition & 1 deletion src/platform/linux/api_dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ impl GlContext for Window {
}

#[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
match self {
&Window::X(ref w) => w.get_proc_address(addr),
&Window::Wayland(ref w) => w.get_proc_address(addr)
Expand Down
3 changes: 1 addition & 2 deletions src/platform/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use GlAttributes;
use GlContext;
use PixelFormat;
use PixelFormatRequirements;
use libc;

use api::osmesa::{self, OsMesaContext};

Expand Down Expand Up @@ -45,7 +44,7 @@ impl GlContext for HeadlessContext {
}

#[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
self.0.get_proc_address(addr)
}

Expand Down
4 changes: 1 addition & 3 deletions src/platform/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ pub use api::win32;
pub use api::win32::{MonitorId, get_available_monitors, get_primary_monitor};
pub use api::win32::{WindowProxy, PollEventsIterator, WaitEventsIterator};

use libc;

use Api;
use ContextError;
use CreationError;
Expand Down Expand Up @@ -134,7 +132,7 @@ impl GlContext for HeadlessContext {
}

#[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
match self {
&HeadlessContext::HiddenWindow(ref ctxt) => ctxt.get_proc_address(addr),
&HeadlessContext::EglPbuffer(ref ctxt) => ctxt.get_proc_address(addr),
Expand Down
15 changes: 3 additions & 12 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ use Window;
use WindowAttributes;
use native_monitor::NativeMonitorId;

use gl_common;
use libc;

use platform;

/// Object that allows you to build windows.
Expand Down Expand Up @@ -397,8 +395,8 @@ impl Window {
///
/// Contrary to `wglGetProcAddress`, all available OpenGL functions return an address.
#[inline]
pub fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
self.window.get_proc_address(addr) as *const libc::c_void
pub fn get_proc_address(&self, addr: &str) -> *const () {
self.window.get_proc_address(addr)
}

/// Swaps the buffers in case of double or triple buffering.
Expand Down Expand Up @@ -492,13 +490,6 @@ impl Window {
}
}

impl gl_common::GlFunctionsSource for Window {
#[inline]
fn get_proc_addr(&self, addr: &str) -> *const libc::c_void {
self.get_proc_address(addr)
}
}

impl GlContext for Window {
#[inline]
unsafe fn make_current(&self) -> Result<(), ContextError> {
Expand All @@ -511,7 +502,7 @@ impl GlContext for Window {
}

#[inline]
fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
fn get_proc_address(&self, addr: &str) -> *const () {
self.get_proc_address(addr)
}

Expand Down

0 comments on commit 3489718

Please sign in to comment.