diff --git a/array.rs b/array.rs index adc1568..3f3f526 100644 --- a/array.rs +++ b/array.rs @@ -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(), diff --git a/base.rs b/base.rs index f7f20a4..1dfc2b7 100644 --- a/base.rs +++ b/base.rs @@ -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 { diff --git a/boolean.rs b/boolean.rs index 3c7d713..45d5e15 100644 --- a/boolean.rs +++ b/boolean.rs @@ -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 { diff --git a/data.rs b/data.rs index 29d5d96..c7d7885 100644 --- a/data.rs +++ b/data.rs @@ -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 { diff --git a/dictionary.rs b/dictionary.rs index 5063470..eec0d00 100644 --- a/dictionary.rs +++ b/dictionary.rs @@ -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 { diff --git a/lib.rs b/lib.rs index 955e381..c5bf6f5 100644 --- a/lib.rs +++ b/lib.rs @@ -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; diff --git a/number.rs b/number.rs index 61f41a0..e8cce6b 100644 --- a/number.rs +++ b/number.rs @@ -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 { diff --git a/set.rs b/set.rs index a6d9be1..3cb8a9d 100644 --- a/set.rs +++ b/set.rs @@ -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(), diff --git a/string.rs b/string.rs index 3101c3c..52fd4ef 100644 --- a/string.rs +++ b/string.rs @@ -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 { diff --git a/url.rs b/url.rs index 1fc04ec..ad3cde9 100644 --- a/url.rs +++ b/url.rs @@ -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 {