Win32 warning police.
This commit is contained in:
parent
6a7de641da
commit
6784b18303
@ -3,10 +3,6 @@ This is intended to be a low-level binding to libuv that very closely mimics
|
||||
the C libuv API. Does very little right now pending scheduler improvements.
|
||||
*/
|
||||
|
||||
#[cfg(target_os = "linux")];
|
||||
#[cfg(target_os = "macos")];
|
||||
#[cfg(target_os = "freebsd")];
|
||||
|
||||
export sanity_check;
|
||||
export loop_t, idle_t;
|
||||
export loop_new, loop_delete, default_loop, run, unref;
|
||||
@ -38,9 +34,6 @@ type handle_type = ctypes::enum;
|
||||
type close_cb = opaque_cb;
|
||||
type idle_cb = opaque_cb;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
type handle_private_fields = {
|
||||
a00: ctypes::c_int,
|
||||
a01: ctypes::c_int,
|
||||
@ -121,9 +114,6 @@ fn sanity_check() {
|
||||
sys::size_of::<idle_t>());
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn handle_fields_new() -> handle_fields {
|
||||
{
|
||||
loop: ptr::null(),
|
||||
@ -154,46 +144,53 @@ fn idle_new() -> idle_t {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
// FIXME: We're out of date on libuv and not testing
|
||||
// it on windows presently. This needs to change.
|
||||
mod os {
|
||||
|
||||
#[test]
|
||||
fn test_sanity_check() {
|
||||
sanity_check();
|
||||
}
|
||||
|
||||
// From test-ref.c
|
||||
mod test_ref {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
#[test]
|
||||
fn ref() {
|
||||
let loop = loop_new();
|
||||
run(loop);
|
||||
loop_delete(loop);
|
||||
fn test_sanity_check() {
|
||||
sanity_check();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn idle_ref() {
|
||||
let loop = loop_new();
|
||||
let h = idle_new();
|
||||
idle_init(loop, ptr::addr_of(h));
|
||||
idle_start(ptr::addr_of(h), ptr::null());
|
||||
unref(loop);
|
||||
run(loop);
|
||||
loop_delete(loop);
|
||||
}
|
||||
// From test-ref.c
|
||||
mod test_ref {
|
||||
|
||||
#[test]
|
||||
fn async_ref() {
|
||||
/*
|
||||
let loop = loop_new();
|
||||
let h = async_new();
|
||||
async_init(loop, ptr::addr_of(h), ptr::null());
|
||||
unref(loop);
|
||||
run(loop);
|
||||
loop_delete(loop);
|
||||
*/
|
||||
#[test]
|
||||
fn ref() {
|
||||
let loop = loop_new();
|
||||
run(loop);
|
||||
loop_delete(loop);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn idle_ref() {
|
||||
let loop = loop_new();
|
||||
let h = idle_new();
|
||||
idle_init(loop, ptr::addr_of(h));
|
||||
idle_start(ptr::addr_of(h), ptr::null());
|
||||
unref(loop);
|
||||
run(loop);
|
||||
loop_delete(loop);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn async_ref() {
|
||||
/*
|
||||
let loop = loop_new();
|
||||
let h = async_new();
|
||||
async_init(loop, ptr::addr_of(h), ptr::null());
|
||||
unref(loop);
|
||||
run(loop);
|
||||
loop_delete(loop);
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,5 @@
|
||||
// Some temporary libuv hacks for servo
|
||||
|
||||
#[cfg(target_os = "linux")];
|
||||
#[cfg(target_os = "macos")];
|
||||
#[cfg(target_os = "freebsd")];
|
||||
|
||||
|
||||
#[nolink]
|
||||
native mod rustrt {
|
||||
fn rust_uvtmp_create_thread() -> thread;
|
||||
@ -100,73 +95,82 @@ fn get_req_id(cd: connect_data) -> u32 {
|
||||
ret rustrt::rust_uvtmp_get_req_id(cd);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_start_stop() {
|
||||
let thread = create_thread();
|
||||
start_thread(thread);
|
||||
join_thread(thread);
|
||||
delete_thread(thread);
|
||||
}
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
// FIXME: We're out of date on libuv and not testing
|
||||
// it on windows presently. This needs to change.
|
||||
mod os {
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_connect() {
|
||||
let thread = create_thread();
|
||||
start_thread(thread);
|
||||
let port = comm::port();
|
||||
let chan = comm::chan(port);
|
||||
connect(thread, 0u32, "74.125.224.146", chan);
|
||||
alt comm::recv(port) {
|
||||
connected(cd) {
|
||||
close_connection(thread, 0u32);
|
||||
}
|
||||
_ { fail "test_connect: port isn't connected"; }
|
||||
#[test]
|
||||
fn test_start_stop() {
|
||||
let thread = create_thread();
|
||||
start_thread(thread);
|
||||
join_thread(thread);
|
||||
delete_thread(thread);
|
||||
}
|
||||
join_thread(thread);
|
||||
delete_thread(thread);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_http() {
|
||||
let thread = create_thread();
|
||||
start_thread(thread);
|
||||
let port = comm::port();
|
||||
let chan = comm::chan(port);
|
||||
connect(thread, 0u32, "74.125.224.146", chan);
|
||||
alt comm::recv(port) {
|
||||
connected(cd) {
|
||||
write(thread, 0u32, str::bytes("GET / HTTP/1.0\n\n"), chan);
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_connect() {
|
||||
let thread = create_thread();
|
||||
start_thread(thread);
|
||||
let port = comm::port();
|
||||
let chan = comm::chan(port);
|
||||
connect(thread, 0u32, "74.125.224.146", chan);
|
||||
alt comm::recv(port) {
|
||||
wrote(cd) {
|
||||
read_start(thread, 0u32, chan);
|
||||
let keep_going = true;
|
||||
while keep_going {
|
||||
alt comm::recv(port) {
|
||||
read(_, buf, -1) {
|
||||
keep_going = false;
|
||||
delete_buf(buf);
|
||||
}
|
||||
read(_, buf, len) {
|
||||
unsafe {
|
||||
log(error, len);
|
||||
let buf = vec::unsafe::from_buf(buf, len as uint);
|
||||
let str = str::from_bytes(buf);
|
||||
#error("read something");
|
||||
io::println(str);
|
||||
}
|
||||
delete_buf(buf);
|
||||
}
|
||||
_ { fail "test_http: protocol error"; }
|
||||
}
|
||||
}
|
||||
connected(cd) {
|
||||
close_connection(thread, 0u32);
|
||||
}
|
||||
_ { fail "test_http: expected `wrote`"; }
|
||||
_ { fail "test_connect: port isn't connected"; }
|
||||
}
|
||||
}
|
||||
_ { fail "test_http: port not connected"; }
|
||||
join_thread(thread);
|
||||
delete_thread(thread);
|
||||
}
|
||||
join_thread(thread);
|
||||
delete_thread(thread);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_http() {
|
||||
let thread = create_thread();
|
||||
start_thread(thread);
|
||||
let port = comm::port();
|
||||
let chan = comm::chan(port);
|
||||
connect(thread, 0u32, "74.125.224.146", chan);
|
||||
alt comm::recv(port) {
|
||||
connected(cd) {
|
||||
write(thread, 0u32, str::bytes("GET / HTTP/1.0\n\n"), chan);
|
||||
alt comm::recv(port) {
|
||||
wrote(cd) {
|
||||
read_start(thread, 0u32, chan);
|
||||
let keep_going = true;
|
||||
while keep_going {
|
||||
alt comm::recv(port) {
|
||||
read(_, buf, -1) {
|
||||
keep_going = false;
|
||||
delete_buf(buf);
|
||||
}
|
||||
read(_, buf, len) {
|
||||
unsafe {
|
||||
log(error, len);
|
||||
let buf = vec::unsafe::from_buf(buf,
|
||||
len as uint);
|
||||
let str = str::from_bytes(buf);
|
||||
#error("read something");
|
||||
io::println(str);
|
||||
}
|
||||
delete_buf(buf);
|
||||
}
|
||||
_ { fail "test_http: protocol error"; }
|
||||
}
|
||||
}
|
||||
close_connection(thread, 0u32);
|
||||
}
|
||||
_ { fail "test_http: expected `wrote`"; }
|
||||
}
|
||||
}
|
||||
_ { fail "test_http: port not connected"; }
|
||||
}
|
||||
join_thread(thread);
|
||||
delete_thread(thread);
|
||||
}
|
||||
}
|
@ -44,7 +44,7 @@ mod libc_constants {
|
||||
}
|
||||
|
||||
type DWORD = u32;
|
||||
type HMODULE = uint;
|
||||
type HMODULE = c_uint;
|
||||
type LPTSTR = str::sbuf;
|
||||
type LPCTSTR = str::sbuf;
|
||||
|
||||
@ -52,9 +52,9 @@ type LPSECURITY_ATTRIBUTES = *ctypes::void;
|
||||
|
||||
#[abi = "stdcall"]
|
||||
native mod kernel32 {
|
||||
fn GetEnvironmentVariableA(n: str::sbuf, v: str::sbuf, nsize: uint) ->
|
||||
uint;
|
||||
fn SetEnvironmentVariableA(n: str::sbuf, v: str::sbuf) -> int;
|
||||
fn GetEnvironmentVariableA(n: str::sbuf, v: str::sbuf, nsize: c_uint) ->
|
||||
c_uint;
|
||||
fn SetEnvironmentVariableA(n: str::sbuf, v: str::sbuf) -> c_int;
|
||||
fn GetModuleFileNameA(hModule: HMODULE,
|
||||
lpFilename: LPTSTR,
|
||||
nSize: DWORD) -> DWORD;
|
||||
@ -99,7 +99,7 @@ fn fclose(file: FILE) {
|
||||
libc::fclose(file)
|
||||
}
|
||||
|
||||
fn fsync_fd(fd: fd_t, level: io::fsync::level) -> c_int {
|
||||
fn fsync_fd(_fd: fd_t, _level: io::fsync::level) -> c_int {
|
||||
// FIXME (1253)
|
||||
fail;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user