Upgrade to rust

This commit is contained in:
Lars Bergstrom
2014-04-11 17:33:18 -05:00
parent 566a1dee24
commit ea3dda06fc
10 changed files with 29 additions and 28 deletions
+6 -6
View File
@@ -9,10 +9,10 @@
//! Heterogeneous immutable arrays.
use base::{CFAllocatorRef, CFIndex, CFIndexConvertible, CFRelease, CFType, CFTypeID, TCFType};
use base::{CFAllocatorRef, CFIndex, CFIndexConvertible, CFRelease, CFType, CFTypeID, CFTypeRef, TCFType};
use base::{kCFAllocatorDefault};
use libc::c_void;
use std::cast;
use std::libc::c_void;
/// FIXME(pcwalton): This is wrong.
pub type CFArrayRetainCallBack = *u8;
@@ -42,7 +42,7 @@ pub type CFArrayRef = *__CFArray;
///
/// FIXME(pcwalton): Should be a newtype struct, but that fails due to a Rust compiler bug.
pub struct CFArray {
priv obj: CFArrayRef,
obj: CFArrayRef,
}
impl Drop for CFArray {
@@ -54,8 +54,8 @@ impl Drop for CFArray {
}
pub struct CFArrayIterator<'a> {
priv array: &'a CFArray,
priv index: CFIndex,
array: &'a CFArray,
index: CFIndex,
}
impl<'a> Iterator<*c_void> for CFArrayIterator<'a> {
@@ -95,7 +95,7 @@ impl CFArray {
/// Creates a new `CFArray` with the given elements, which must be `CFType` objects.
pub fn from_CFTypes(elems: &[CFType]) -> CFArray {
unsafe {
let elems = elems.map(|elem| elem.as_CFTypeRef());
let elems: ~[CFTypeRef] = elems.iter().map(|elem| elem.as_CFTypeRef()).collect();
let array_ref = CFArrayCreate(kCFAllocatorDefault,
cast::transmute(elems.as_ptr()),
elems.len().to_CFIndex(),
+2 -2
View File
@@ -7,8 +7,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use libc::{c_long, c_ulong};
use std::cast;
use std::libc::{c_long, c_ulong};
use std::num::Bounded;
pub type Boolean = u8;
@@ -66,7 +66,7 @@ pub type CFTypeRef = *__CFType;
/// Superclass of all Core Foundation objects.
pub struct CFType {
priv obj: CFTypeRef,
obj: CFTypeRef,
}
impl Clone for CFType {
+1 -1
View File
@@ -21,7 +21,7 @@ pub type CFBooleanRef = *__CFBoolean;
///
/// FIXME(pcwalton): Should be a newtype struct, but that fails due to a Rust compiler bug.
pub struct CFBoolean {
priv obj: CFBooleanRef,
obj: CFBooleanRef,
}
impl Drop for CFBoolean {
+1 -1
View File
@@ -22,7 +22,7 @@ pub type CFDataRef = *__CFData;
///
/// FIXME(pcwalton): Should be a newtype struct, but that fails due to a Rust compiler bug.
pub struct CFData {
priv obj: CFDataRef,
obj: CFDataRef,
}
impl Drop for CFData {
+2 -2
View File
@@ -12,8 +12,8 @@
use base::{Boolean, CFAllocatorRef, CFIndex, CFIndexConvertible, CFRelease, CFType, CFTypeID};
use base::{CFTypeRef, TCFType, kCFAllocatorDefault};
use libc::c_void;
use std::cast;
use std::libc::c_void;
use std::ptr;
use std::slice;
@@ -49,7 +49,7 @@ pub type CFDictionaryRef = *__CFDictionary;
///
/// FIXME(pcwalton): Should be a newtype struct, but that fails due to a Rust compiler bug.
pub struct CFDictionary {
priv obj: CFDictionaryRef,
obj: CFDictionaryRef,
}
impl Drop for CFDictionary {
+5 -4
View File
@@ -7,11 +7,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[crate_id = "github.com/mozilla-servo/rust-core-foundation#core_foundation:0.1"];
#[crate_type = "lib"];
#[crate_type = "dylib"];
#[crate_type = "rlib"];
#![crate_id = "github.com/mozilla-servo/rust-core-foundation#core_foundation:0.1"]
#![crate_type = "lib"]
#![crate_type = "dylib"]
#![crate_type = "rlib"]
extern crate libc;
extern crate std;
pub mod array;
+3 -3
View File
@@ -9,12 +9,12 @@
//! Immutable numbers.
#[allow(non_uppercase_statics)];
#![allow(non_uppercase_statics)]
use base::{CFAllocatorRef, CFRelease, CFTypeID, TCFType, kCFAllocatorDefault};
use libc::c_void;
use std::cast;
use std::libc::c_void;
pub type CFNumberType = u32;
@@ -45,7 +45,7 @@ pub type CFNumberRef = *__CFNumber;
///
/// FIXME(pcwalton): Should be a newtype struct, but that fails due to a Rust compiler bug.
pub struct CFNumber {
priv obj: CFNumberRef,
obj: CFNumberRef,
}
impl Drop for CFNumber {
+4 -4
View File
@@ -9,11 +9,11 @@
//! An immutable bag of elements.
use base::{CFAllocatorRef, CFIndex, CFIndexConvertible, CFRelease, CFType, CFTypeID};
use base::{CFAllocatorRef, CFIndex, CFIndexConvertible, CFRelease, CFType, CFTypeID, CFTypeRef};
use base::{TCFType, kCFAllocatorDefault};
use libc::c_void;
use std::cast;
use std::libc::c_void;
pub type CFSetRetainCallBack = *u8;
pub type CFSetReleaseCallBack = *u8;
@@ -38,7 +38,7 @@ pub type CFSetRef = *__CFSet;
///
/// FIXME(pcwalton): Should be a newtype struct, but that fails due to a Rust compiler bug.
pub struct CFSet {
priv obj: CFSetRef,
obj: CFSetRef,
}
impl Drop for CFSet {
@@ -72,7 +72,7 @@ impl CFSet {
/// Creates a new set from a list of `CFType` instances.
pub fn from_slice(elems: &[CFType]) -> CFSet {
unsafe {
let elems = elems.map(|elem| elem.as_CFTypeRef());
let elems: ~[CFTypeRef] = elems.iter().map(|elem| elem.as_CFTypeRef()).collect();
let set_ref = CFSetCreate(kCFAllocatorDefault,
cast::transmute(elems.as_ptr()),
elems.len().to_CFIndex(),
+3 -3
View File
@@ -9,15 +9,15 @@
//! Immutable strings.
#[allow(non_uppercase_statics)];
#![allow(non_uppercase_statics)]
use base::{Boolean, CFAllocatorRef, CFIndex, CFIndexConvertible, CFOptionFlags, CFRange};
use base::{CFRelease, CFTypeID, TCFType, kCFAllocatorDefault, kCFAllocatorNull};
use libc;
use std::cast;
use std::fmt;
use std::from_str::FromStr;
use std::libc;
use std::ptr;
use std::slice;
@@ -205,7 +205,7 @@ pub type CFStringRef = *__CFString;
///
/// FIXME(pcwalton): Should be a newtype struct, but that fails due to a Rust compiler bug.
pub struct CFString {
priv obj: CFStringRef,
obj: CFStringRef,
}
impl Clone for CFString {
+2 -2
View File
@@ -9,7 +9,7 @@
//! A URL type for Core Foundation.
#[allow(non_uppercase_statics)];
#![allow(non_uppercase_statics)]
use base::{CFOptionFlags, CFRelease, CFTypeID, TCFType};
use std::fmt;
@@ -20,7 +20,7 @@ struct __CFURL;
pub type CFURLRef = *__CFURL;
pub struct CFURL {
priv obj: CFURLRef,
obj: CFURLRef,
}
impl Drop for CFURL {