update for cgmath change

This commit is contained in:
Colin Sherratt
2014-08-16 01:57:23 -04:00
parent b727ce3673
commit 0b6ec50b74

View File

@ -6,13 +6,13 @@ extern crate cgmath;
extern crate libc; extern crate libc;
use libc::{c_int, c_uint, c_void, c_float, c_double}; use libc::{c_int, c_uint, c_void, c_float, c_double};
use std::str::raw::from_c_str;
use std::default::Default; use std::default::Default;
use std::ptr; use std::ptr;
use std::string::raw::from_buf;
use cgmath::quaternion::Quaternion; use cgmath::Quaternion;
use cgmath::vector::{Vector2, Vector3}; use cgmath::{Vector2, Vector3};
use cgmath::matrix::{Matrix4}; use cgmath::{Matrix4};
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
#[link(name="ovr")] #[link(name="ovr")]
@ -395,7 +395,7 @@ impl Hmd {
if ptr.is_null() { if ptr.is_null() {
Ok(()) Ok(())
} else { } else {
Err(from_c_str(ptr)) Err(from_buf(ptr as *const u8))
} }
} }
} }
@ -853,7 +853,7 @@ impl SensorDescription {
SensorDescription { SensorDescription {
vendor_id: sd.vendor_id as i16, vendor_id: sd.vendor_id as i16,
product_id: sd.product_id as i16, product_id: sd.product_id as i16,
serial_number: unsafe { from_c_str(&sd.serial_number[0]) } serial_number: unsafe { from_buf((&sd.serial_number[0] as *const i8) as *const u8) }
} }
} }
} }
@ -941,8 +941,8 @@ impl HmdDescription {
unsafe { unsafe {
HmdDescription { HmdDescription {
hmd_type: HmdType::from_ll(sd.hmd_type), hmd_type: HmdType::from_ll(sd.hmd_type),
product_name: from_c_str(sd.product_name), product_name: from_buf((sd.product_name as *const i8) as *const u8),
manufacture: from_c_str(sd.manufacture), manufacture: from_buf((sd.manufacture as *const i8) as *const u8),
hmd_capabilities: HmdCapabilities{ hmd_capabilities: HmdCapabilities{
flags: sd.hmd_capabilities flags: sd.hmd_capabilities
}, },
@ -966,7 +966,7 @@ impl HmdDescription {
), ),
eye_render_order: [EyeType::from_ll(sd.eye_render_order[0]), eye_render_order: [EyeType::from_ll(sd.eye_render_order[0]),
EyeType::from_ll(sd.eye_render_order[1])], EyeType::from_ll(sd.eye_render_order[1])],
display_device_name: from_c_str(sd.display_device_name), display_device_name: from_buf((sd.display_device_name as *const i8) as *const u8),
display_id: sd.display_id display_id: sd.display_id
} }
} }