Rust upgrade

This commit is contained in:
Brian Anderson
2013-01-30 14:33:39 -08:00
parent fb1ea4368f
commit 4ef941f09e
2 changed files with 10 additions and 6 deletions
+4 -2
View File
@@ -19,12 +19,13 @@ pub type CGDataProviderRef = *__CGDataProvider;
pub impl CGDataProviderRef : AbstractCFTypeRef {
pure fn as_type_ref(&self) -> CFTypeRef { *self as CFTypeRef }
static pure fn type_id() -> CFTypeID unsafe { CGDataProviderGetTypeID() }
static pure fn type_id() -> CFTypeID { unsafe { CGDataProviderGetTypeID() } }
}
pub type CGDataProvider = CFWrapper<CGDataProviderRef, (), ()>;
pub fn new_from_buffer(buf: *u8, len: uint) -> CGDataProvider unsafe {
pub fn new_from_buffer(buf: *u8, len: uint) -> CGDataProvider {
unsafe {
let result = CGDataProviderCreateWithData(
ptr::null(),
cast::transmute(buf),
@@ -32,6 +33,7 @@ pub fn new_from_buffer(buf: *u8, len: uint) -> CGDataProvider unsafe {
ptr::null());
CFWrapper::wrap_owned(result)
}
}
#[nolink]
+6 -4
View File
@@ -11,15 +11,17 @@ pub type CGFontRef = *__CGFont;
pub impl CGFontRef : AbstractCFTypeRef {
pure fn as_type_ref(&self) -> CFTypeRef { *self as CFTypeRef }
static pure fn type_id() -> CFTypeID unsafe { CGFontGetTypeID() }
static pure fn type_id() -> CFTypeID { unsafe { CGFontGetTypeID() } }
}
pub type CGFont = CFWrapper<CGFontRef, (), ()>;
pub fn create_with_data_provider(provider: &CGDataProvider) -> CGFont {
// TODO: error handling
let value = CGFontCreateWithDataProvider(*provider.borrow_ref());
CFWrapper::wrap_owned(value)
unsafe {
// TODO: error handling
let value = CGFontCreateWithDataProvider(*provider.borrow_ref());
CFWrapper::wrap_owned(value)
}
}
#[nolink]