Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8.

This commit is contained in:
Simon Sapin 2015-04-23 00:14:02 +02:00 committed by Josh Matthews
parent 7b87085c18
commit ef8edd4e87
168 changed files with 2247 additions and 2408 deletions

720
ports/cef/Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -62,6 +62,9 @@ git = "https://github.com/servo/rust-png"
[dependencies.stb_image]
git = "https://github.com/servo/rust-stb-image"
[dependencies.core_foundation]
git = "https://github.com/servo/rust-core-foundation"
[dependencies.core_graphics]
git = "https://github.com/servo/rust-core-graphics"
@ -80,3 +83,4 @@ git = "https://github.com/servo/rust-cgl"
[dependencies]
url = "*"
libc = "*"
objc = "0.1"

View file

@ -7,11 +7,12 @@
#![feature(plugin)]
#![feature(link_args)]
#![feature(thread_local)]
#![feature(unicode)]
#![feature(core)]
#![feature(std_misc)]
#![feature(rustc_private)]
#![feature(collections)]
#![feature(negate_unsigned)]
#![feature(unicode)]
#![allow(non_camel_case_types)]
@ -31,9 +32,9 @@ extern crate glutin_app;
extern crate js;
extern crate layers;
extern crate png;
extern crate rustc_unicode;
extern crate script;
extern crate script_traits;
extern crate unicode;
extern crate net;
extern crate msg;
@ -42,16 +43,21 @@ extern crate style;
extern crate stb_image;
extern crate libc;
extern crate "url" as std_url;
extern crate url as std_url;
#[cfg(target_os="macos")]
extern crate cgl;
#[cfg(target_os="macos")]
extern crate cocoa;
#[cfg(target_os="macos")]
extern crate core_foundation;
#[cfg(target_os="macos")]
extern crate core_graphics;
#[cfg(target_os="macos")]
extern crate core_text;
#[cfg(target_os="macos")]
#[macro_use]
extern crate objc;
// Must come first.
pub mod macros;

View file

@ -94,7 +94,7 @@ pub extern "C" fn cef_string_utf8_set(src: *const u8, src_len: size_t, output: *
return 0;
}
ptr::copy((*output).str, src, src_len as usize);
ptr::copy(src, (*output).str, src_len as usize);
(*output).length = src_len;
(*output).dtor = Some(string_utf8_dtor as extern "C" fn(*mut u8));
}
@ -175,7 +175,7 @@ pub extern "C" fn cef_string_utf16_set(src: *const c_ushort, src_len: size_t, ou
return 0;
}
ptr::copy((*output).str, src, src_len as usize);
ptr::copy(src, (*output).str, src_len as usize);
(*output).length = src_len;
(*output).dtor = Some(string_utf16_dtor as extern "C" fn(*mut c_ushort));
}
@ -233,7 +233,7 @@ pub extern "C" fn cef_string_wide_set(src: *const wchar_t, src_len: size_t, outp
return 0;
}
ptr::copy((*output).str, src, src_len as usize);
ptr::copy(src, (*output).str, src_len as usize);
(*output).length = src_len;
(*output).dtor = Some(string_wide_dtor as extern "C" fn(*mut wchar_t));
}

View file

@ -3,9 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use eutil::slice_to_str;
use libc::{c_int};
use libc::c_int;
use std::collections::BTreeMap;
use std::iter::AdditiveIterator;
use std::mem;
use std::string::String;
use string::{cef_string_userfree_utf16_alloc, cef_string_userfree_utf16_free};
@ -31,7 +30,11 @@ pub extern "C" fn cef_string_multimap_size(smm: *mut cef_string_multimap_t) -> c
unsafe {
if smm.is_null() { return 0; }
let v = string_multimap_to_treemap(smm);
(*v).values().map(|val| (*val).len()).sum() as c_int
// t1 : collections::btree::map::Values<'_, collections::string::String, collections::vec::Vec<*mut types::cef_string_utf16>>`
let t1 = (*v).values();
// t2 : collections::btree::map::BTreeMap<collections::string::String, collections::vec::Vec<*mut types::cef_string_utf16>>
let t2 : usize = t1.map(|val| (*val).len()).sum();
t2 as c_int
}
}

View file

@ -10,8 +10,8 @@
use eutil::Downcast;
use interfaces::CefBrowser;
use render_handler::CefRenderHandlerExtensions;
use rustc_unicode::str::Utf16Encoder;
use types::{cef_cursor_handle_t, cef_rect_t};
use unicode::str::Utf16Encoder;
use compositing::compositor_task::{self, CompositorProxy, CompositorReceiver};
use compositing::windowing::{WindowEvent, WindowMethods};
@ -91,30 +91,33 @@ impl Window {
/// bundles custom resources (which we don't yet do).
#[cfg(target_os="macos")]
fn cursor_handle_for_cursor(&self, cursor: Cursor) -> cef_cursor_handle_t {
use cocoa::base::{class, msg_send, selector};
use cocoa::base::class;
let cocoa_name = match cursor {
Cursor::NoCursor => return 0 as cef_cursor_handle_t,
Cursor::ContextMenuCursor => "contextualMenuCursor",
Cursor::GrabbingCursor => "closedHandCursor",
Cursor::CrosshairCursor => "crosshairCursor",
Cursor::CopyCursor => "dragCopyCursor",
Cursor::AliasCursor => "dragLinkCursor",
Cursor::TextCursor => "IBeamCursor",
Cursor::GrabCursor | Cursor::AllScrollCursor => "openHandCursor",
Cursor::NoDropCursor | Cursor::NotAllowedCursor => "operationNotAllowedCursor",
Cursor::PointerCursor => "pointingHandCursor",
Cursor::SResizeCursor => "resizeDownCursor",
Cursor::WResizeCursor => "resizeLeftCursor",
Cursor::EwResizeCursor | Cursor::ColResizeCursor => "resizeLeftRightCursor",
Cursor::EResizeCursor => "resizeRightCursor",
Cursor::NResizeCursor => "resizeUpCursor",
Cursor::NsResizeCursor | Cursor::RowResizeCursor => "resizeUpDownCursor",
Cursor::VerticalTextCursor => "IBeamCursorForVerticalLayout",
_ => "arrowCursor",
};
unsafe {
msg_send()(class("NSCursor"), selector(cocoa_name))
match cursor {
Cursor::NoCursor => return 0 as cef_cursor_handle_t,
Cursor::ContextMenuCursor => msg_send![class("NSCursor"), contextualMenuCursor],
Cursor::GrabbingCursor => msg_send![class("NSCursor"), closedHandCursor],
Cursor::CrosshairCursor => msg_send![class("NSCursor"), crosshairCursor],
Cursor::CopyCursor => msg_send![class("NSCursor"), dragCopyCursor],
Cursor::AliasCursor => msg_send![class("NSCursor"), dragLinkCursor],
Cursor::TextCursor => msg_send![class("NSCursor"), IBeamCursor],
Cursor::GrabCursor | Cursor::AllScrollCursor =>
msg_send![class("NSCursor"), openHandCursor],
Cursor::NoDropCursor | Cursor::NotAllowedCursor =>
msg_send![class("NSCursor"), operationNotAllowedCursor],
Cursor::PointerCursor => msg_send![class("NSCursor"), pointingHandCursor],
Cursor::SResizeCursor => msg_send![class("NSCursor"), resizeDownCursor],
Cursor::WResizeCursor => msg_send![class("NSCursor"), resizeLeftCursor],
Cursor::EwResizeCursor | Cursor::ColResizeCursor =>
msg_send![class("NSCursor"), resizeLeftRightCursor],
Cursor::EResizeCursor => msg_send![class("NSCursor"), resizeRightCursor],
Cursor::NResizeCursor => msg_send![class("NSCursor"), resizeUpCursor],
Cursor::NsResizeCursor | Cursor::RowResizeCursor =>
msg_send![class("NSCursor"), resizeUpDownCursor],
Cursor::VerticalTextCursor => msg_send![class("NSCursor"), IBeamCursorForVerticalLayout],
_ => msg_send![class("NSCursor"), arrowCursor],
}
}
}
@ -325,9 +328,10 @@ struct CefCompositorProxy {
impl CompositorProxy for CefCompositorProxy {
#[cfg(target_os="macos")]
fn send(&mut self, msg: compositor_task::Msg) {
use cocoa::appkit::{NSApp, NSApplication, NSApplicationDefined, NSAutoreleasePool};
use cocoa::appkit::{NSEvent, NSEventModifierFlags, NSEventSubtype, NSPoint};
use cocoa::appkit::{NSApp, NSApplication, NSApplicationDefined};
use cocoa::appkit::{NSEvent, NSEventModifierFlags, NSEventSubtype};
use cocoa::base::nil;
use cocoa::foundation::{NSAutoreleasePool, NSPoint};
// Send a message and kick the OS event loop awake.
self.sender.send(msg).unwrap();
@ -342,7 +346,7 @@ impl CompositorProxy for CefCompositorProxy {
NSEventModifierFlags::empty(),
0.0,
0,
0,
nil,
NSEventSubtype::NSWindowExposedEventType,
0,
0);

View file

@ -4,6 +4,7 @@
use interfaces::{cef_drag_data_t, cef_post_data_element_t, cef_v8value_t, CefPostDataElement};
use interfaces::{CefV8Value};
use rustc_unicode::str::Utf16Encoder;
use types::{cef_base_t, cef_browser_settings_t, cef_color_model_t};
use types::{cef_context_menu_edit_state_flags_t, cef_context_menu_handler_t};
use types::{cef_context_menu_media_state_flags_t};
@ -29,7 +30,6 @@ use types::{cef_termination_status_t, cef_text_input_context_t, cef_thread_id_t}
use types::{cef_time_t, cef_transition_type_t, cef_urlrequest_status_t};
use types::{cef_v8_accesscontrol_t, cef_v8_propertyattribute_t, cef_value_type_t};
use types::{cef_window_info_t, cef_xml_encoding_type_t, cef_xml_node_type_t};
use unicode::str::Utf16Encoder;
use libc::{self, c_char, c_int, c_ushort, c_void};
use std::boxed;
@ -183,8 +183,8 @@ cef_unimplemented_wrapper!(cef_string_t, String);
impl<'a> CefWrap<*const cef_string_t> for &'a [u16] {
fn to_c(buffer: &'a [u16]) -> *const cef_string_t {
unsafe {
let ptr: *mut c_ushort = mem::transmute(libc::malloc(((buffer.len() + 1) * 2) as u64));
ptr::copy(ptr, mem::transmute(buffer.as_ptr()), buffer.len());
let ptr = libc::malloc(((buffer.len() + 1) * 2) as u64) as *mut c_ushort;
ptr::copy(buffer.as_ptr(), ptr, buffer.len());
*ptr.offset(buffer.len() as isize) = 0;
// FIXME(pcwalton): This leaks!! We should instead have the caller pass some scratch

View file

@ -4,9 +4,7 @@
//! A simple application that uses glutin to open a window for Servo to display in.
#![feature(int_uint)]
#![feature(box_syntax)]
#![cfg_attr(all(feature = "window", target_os = "linux"), feature(old_io, std_misc))]
#[macro_use] extern crate bitflags;
#[cfg(target_os="macos")]

View file

@ -33,8 +33,6 @@ use msg::constellation_msg::{KeyState, CONTROL, SHIFT, ALT};
#[cfg(feature = "window")]
use std::cell::{Cell, RefCell};
#[cfg(feature = "window")]
use std::num::Float;
#[cfg(feature = "window")]
use util::opts;
#[cfg(all(feature = "headless", target_os="linux"))]
@ -266,8 +264,7 @@ impl Window {
#[cfg(target_os="linux")]
fn handle_next_event(&self) -> bool {
use std::old_io::timer::sleep;
use std::time::duration::Duration;
use std::thread::sleep_ms;
// TODO(gw): This is an awful hack to work around the
// broken way we currently call X11 from multiple threads.
@ -291,7 +288,7 @@ impl Window {
self.handle_window_event(event)
}
None => {
sleep(Duration::milliseconds(16));
sleep_ms(16);
false
}
}
@ -741,42 +738,42 @@ impl CompositorProxy for GlutinCompositorProxy {
#[allow(non_snake_case)]
#[no_mangle]
pub extern "C" fn glBindVertexArrayOES(_array: uint)
pub extern "C" fn glBindVertexArrayOES(_array: usize)
{
unimplemented!()
}
#[allow(non_snake_case)]
#[no_mangle]
pub extern "C" fn glDeleteVertexArraysOES(_n: int, _arrays: *const ())
pub extern "C" fn glDeleteVertexArraysOES(_n: isize, _arrays: *const ())
{
unimplemented!()
}
#[allow(non_snake_case)]
#[no_mangle]
pub extern "C" fn glGenVertexArraysOES(_n: int, _arrays: *const ())
pub extern "C" fn glGenVertexArraysOES(_n: isize, _arrays: *const ())
{
unimplemented!()
}
#[allow(non_snake_case)]
#[no_mangle]
pub extern "C" fn glRenderbufferStorageMultisampleIMG(_: int, _: int, _: int, _: int, _: int)
pub extern "C" fn glRenderbufferStorageMultisampleIMG(_: isize, _: isize, _: isize, _: isize, _: isize)
{
unimplemented!()
}
#[allow(non_snake_case)]
#[no_mangle]
pub extern "C" fn glFramebufferTexture2DMultisampleIMG(_: int, _: int, _: int, _: int, _: int, _: int)
pub extern "C" fn glFramebufferTexture2DMultisampleIMG(_: isize, _: isize, _: isize, _: isize, _: isize, _: isize)
{
unimplemented!()
}
#[allow(non_snake_case)]
#[no_mangle]
pub extern "C" fn glDiscardFramebufferEXT(_: int, _: int, _: *const ())
pub extern "C" fn glDiscardFramebufferEXT(_: isize, _: isize, _: *const ())
{
unimplemented!()
}

707
ports/gonk/Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -57,4 +57,5 @@ git = "https://github.com/servo/gleam"
[dependencies]
url = "0.2.16"
time = "0.1.17"
errno = "*"
libc = "*"

View file

@ -8,9 +8,7 @@ use std::path::Path;
use std::mem::size_of;
use std::mem::transmute;
use std::mem::zeroed;
use std::os::errno;
use std::os::unix::AsRawFd;
use std::num::Float;
use std::os::unix::io::AsRawFd;
use std::fs::File;
use std::thread;
use std::sync::mpsc::Sender;
@ -18,6 +16,7 @@ use std::io::Read;
use geom::point::TypedPoint2D;
use errno::errno;
use libc::c_int;
use libc::c_long;
use libc::time_t;
@ -135,7 +134,7 @@ fn read_input_device(device_path: &Path,
let mut last_dist: f32 = 0f32;
let mut touch_count: i32 = 0;
let mut current_slot: uint = 0;
let mut current_slot: usize = 0;
// XXX: Need to use the real dimensions of the screen
let screen_dist = dist(0, 480, 854, 0);
loop {
@ -154,7 +153,7 @@ fn read_input_device(device_path: &Path,
let count = read / size_of::<linux_input_event>();
let events: *mut linux_input_event = unsafe { transmute(buf.as_mut_ptr()) };
let mut tracking_updated = false;
for idx in 0..(count as int) {
for idx in 0..(count as isize) {
let event: &linux_input_event = unsafe { transmute(events.offset(idx)) };
match (event.evt_type, event.code) {
(EV_SYN, EV_REPORT) => {
@ -204,8 +203,8 @@ fn read_input_device(device_path: &Path,
},
(EV_SYN, _) => println!("Unknown SYN code {}", event.code),
(EV_ABS, ABS_MT_SLOT) => {
if (event.value as uint) < slots.len() {
current_slot = event.value as uint;
if (event.value as usize) < slots.len() {
current_slot = event.value as usize;
} else {
println!("Invalid slot! {}", event.value);
}

View file

@ -4,8 +4,7 @@
#![feature(thread_local)]
#![feature(box_syntax)]
#![feature(int_uint)]
#![feature(path, rustc_private)]
#![feature(rustc_private)]
// For FFI
#![allow(non_snake_case, dead_code)]

View file

@ -6,8 +6,7 @@
#![deny(unused_variables)]
#![feature(box_syntax)]
#![feature(int_uint)]
#![feature(core, os, path, io, std_misc)]
#![feature(convert)]
// For FFI
#![allow(non_snake_case, dead_code)]
@ -27,6 +26,7 @@
extern crate servo;
extern crate time;
extern crate util;
extern crate errno;
extern crate compositing;
extern crate script_traits;

View file

@ -60,7 +60,7 @@ pub struct native_handle {
pub struct ANativeBase {
magic: u32,
version: u32,
reserved: [int; 4],
reserved: [isize; 4],
incRef: extern fn(*mut ANativeBase),
decRef: extern fn(*mut ANativeBase),
}
@ -86,7 +86,7 @@ pub struct ANativeWindow {
maxSwapInterval: c_int,
xdpi: f32,
ydpi: f32,
oem: [int; 4],
oem: [isize; 4],
setSwapInterval: extern fn(*mut ANativeWindow, c_int) -> c_int,
//dequeueBuffer_DEPRECATED: extern fn(*mut ANativeWindow, *mut *mut ANativeWindowBuffer) -> c_int,
//lockBuffer_DEPRECATED: extern fn(*mut ANativeWindow, *mut ANativeWindowBuffer) -> c_int,
@ -342,7 +342,7 @@ extern fn dequeueBuffer(base: *mut ANativeWindow, buf: *mut *mut ANativeWindowBu
unsafe {
let window: &mut GonkNativeWindow = transmute(base);
for idx in 0..window.bufs.len() {
if idx == window.last_idx as uint {
if idx == window.last_idx as usize {
continue;
}
match window.bufs[idx] {
@ -695,7 +695,7 @@ impl Window {
egl::EGL_ALPHA_SIZE, 0,
egl::EGL_NONE, 0];
let mut config: EGLConfig = unsafe { transmute(0i) };
let mut config: EGLConfig = unsafe { transmute(0isize) };
let mut num_config: EGLint = 0;
let ret2 = unsafe {