servo: Merge #12 - Added explicit casts from ints to machine types (from mmeyerho:master)

Source-Repo: https://github.com/servo/servo
Source-Revision: 0a3544ae0d31c5ae3d585f90e892ed2e20748e0e
This commit is contained in:
Margaret Meyerhofer 2012-06-05 10:42:18 -07:00
Родитель 432a667f6a
Коммит 47f9e9bec6
2 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -57,6 +57,7 @@ themselves.
")]; ")];
import ptr::extensions; import ptr::extensions;
import core::libc::types::os::arch::c95::size_t;
export handle; export handle;
export reader_methods; export reader_methods;
@ -133,7 +134,7 @@ impl private_methods<T: copy send,A> for scope<T,A> {
fn clone(v: *T) -> *T unsafe { fn clone(v: *T) -> *T unsafe {
let n: *mut T = let n: *mut T =
unsafe::reinterpret_cast( unsafe::reinterpret_cast(
libc::calloc(sys::size_of::<T>(), 1u)); libc::calloc(sys::size_of::<T>() as size_t, 1u as size_t));
// n.b.: this assignment will run the drop glue for <T,A>. // n.b.: this assignment will run the drop glue for <T,A>.
// *Hopefully* the fact that everything is initialized to NULL // *Hopefully* the fact that everything is initialized to NULL
@ -215,7 +216,7 @@ impl writer_methods<T:copy send,A> for scope<T,A> {
fn handle(v: T) -> handle<T,A> unsafe { fn handle(v: T) -> handle<T,A> unsafe {
let d: *handle_data<T,A> = let d: *handle_data<T,A> =
unsafe::reinterpret_cast( unsafe::reinterpret_cast(
libc::malloc(sys::size_of::<handle_data<T,A>>())); libc::malloc(sys::size_of::<handle_data<T,A>>() as size_t));
(*d).rd_ptr = self.clone(ptr::addr_of(v)); (*d).rd_ptr = self.clone(ptr::addr_of(v));
(*d).wr_ptr = (*d).rd_ptr; (*d).wr_ptr = (*d).rd_ptr;
(*d).rd_aux = ptr::null(); (*d).rd_aux = ptr::null();

Просмотреть файл

@ -315,6 +315,7 @@ fn draw_some_text(draw_target: AzDrawTargetRef) {
import cairoftbg = azure::cairo_ft::bindgen; import cairoftbg = azure::cairo_ft::bindgen;
import libc::types::common::c99::uint16_t; import libc::types::common::c99::uint16_t;
import libc::types::common::c99::uint32_t; import libc::types::common::c99::uint32_t;
import azure::freetype::FT_Long;
impl methods for ft::FT_Error { impl methods for ft::FT_Error {
fn for_sure() { assert self == 0 as ft::FT_Error } fn for_sure() { assert self == 0 as ft::FT_Error }
@ -328,7 +329,7 @@ fn draw_some_text(draw_target: AzDrawTargetRef) {
let face: ft::FT_Face = ptr::null(); let face: ft::FT_Face = ptr::null();
vec::as_buf(fontbin) {|buf| vec::as_buf(fontbin) {|buf|
ftbg::FT_New_Memory_Face(library, buf, fontbin.len() as ft::FT_Long, ftbg::FT_New_Memory_Face(library, buf, fontbin.len() as ft::FT_Long,
0, ptr::addr_of(face)).for_sure(); 0 as FT_Long, ptr::addr_of(face)).for_sure();
} }
unsafe { unsafe {