Skip to content

Commit 6784b18

Browse files
committed
Win32 warning police.
1 parent 6a7de64 commit 6784b18

File tree

3 files changed

+116
-115
lines changed

3 files changed

+116
-115
lines changed

src/libstd/uv.rs

Lines changed: 42 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ This is intended to be a low-level binding to libuv that very closely mimics
33
the C libuv API. Does very little right now pending scheduler improvements.
44
*/
55

6-
#[cfg(target_os = "linux")];
7-
#[cfg(target_os = "macos")];
8-
#[cfg(target_os = "freebsd")];
9-
106
export sanity_check;
117
export loop_t, idle_t;
128
export loop_new, loop_delete, default_loop, run, unref;
@@ -38,9 +34,6 @@ type handle_type = ctypes::enum;
3834
type close_cb = opaque_cb;
3935
type idle_cb = opaque_cb;
4036

41-
#[cfg(target_os = "linux")]
42-
#[cfg(target_os = "macos")]
43-
#[cfg(target_os = "freebsd")]
4437
type handle_private_fields = {
4538
a00: ctypes::c_int,
4639
a01: ctypes::c_int,
@@ -121,9 +114,6 @@ fn sanity_check() {
121114
sys::size_of::<idle_t>());
122115
}
123116

124-
#[cfg(target_os = "linux")]
125-
#[cfg(target_os = "macos")]
126-
#[cfg(target_os = "freebsd")]
127117
fn handle_fields_new() -> handle_fields {
128118
{
129119
loop: ptr::null(),
@@ -154,46 +144,53 @@ fn idle_new() -> idle_t {
154144
}
155145
}
156146

157-
#[cfg(test)]
158-
mod tests {
159-
160-
#[test]
161-
fn test_sanity_check() {
162-
sanity_check();
163-
}
164-
165-
// From test-ref.c
166-
mod test_ref {
147+
#[cfg(target_os = "linux")]
148+
#[cfg(target_os = "macos")]
149+
#[cfg(target_os = "freebsd")]
150+
// FIXME: We're out of date on libuv and not testing
151+
// it on windows presently. This needs to change.
152+
mod os {
167153

168-
#[test]
169-
fn ref() {
170-
let loop = loop_new();
171-
run(loop);
172-
loop_delete(loop);
173-
}
154+
#[cfg(test)]
155+
mod tests {
174156

175157
#[test]
176-
fn idle_ref() {
177-
let loop = loop_new();
178-
let h = idle_new();
179-
idle_init(loop, ptr::addr_of(h));
180-
idle_start(ptr::addr_of(h), ptr::null());
181-
unref(loop);
182-
run(loop);
183-
loop_delete(loop);
158+
fn test_sanity_check() {
159+
sanity_check();
184160
}
185161

186-
#[test]
187-
fn async_ref() {
188-
/*
189-
let loop = loop_new();
190-
let h = async_new();
191-
async_init(loop, ptr::addr_of(h), ptr::null());
192-
unref(loop);
193-
run(loop);
194-
loop_delete(loop);
195-
*/
162+
// From test-ref.c
163+
mod test_ref {
164+
165+
#[test]
166+
fn ref() {
167+
let loop = loop_new();
168+
run(loop);
169+
loop_delete(loop);
170+
}
171+
172+
#[test]
173+
fn idle_ref() {
174+
let loop = loop_new();
175+
let h = idle_new();
176+
idle_init(loop, ptr::addr_of(h));
177+
idle_start(ptr::addr_of(h), ptr::null());
178+
unref(loop);
179+
run(loop);
180+
loop_delete(loop);
181+
}
182+
183+
#[test]
184+
fn async_ref() {
185+
/*
186+
let loop = loop_new();
187+
let h = async_new();
188+
async_init(loop, ptr::addr_of(h), ptr::null());
189+
unref(loop);
190+
run(loop);
191+
loop_delete(loop);
192+
*/
193+
}
196194
}
197195
}
198196
}
199-

src/libstd/uvtmp.rs

Lines changed: 69 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
// Some temporary libuv hacks for servo
22

3-
#[cfg(target_os = "linux")];
4-
#[cfg(target_os = "macos")];
5-
#[cfg(target_os = "freebsd")];
6-
7-
83
#[nolink]
94
native mod rustrt {
105
fn rust_uvtmp_create_thread() -> thread;
@@ -100,73 +95,82 @@ fn get_req_id(cd: connect_data) -> u32 {
10095
ret rustrt::rust_uvtmp_get_req_id(cd);
10196
}
10297

103-
#[test]
104-
fn test_start_stop() {
105-
let thread = create_thread();
106-
start_thread(thread);
107-
join_thread(thread);
108-
delete_thread(thread);
109-
}
98+
#[cfg(target_os = "linux")]
99+
#[cfg(target_os = "macos")]
100+
#[cfg(target_os = "freebsd")]
101+
// FIXME: We're out of date on libuv and not testing
102+
// it on windows presently. This needs to change.
103+
mod os {
110104

111-
#[test]
112-
#[ignore]
113-
fn test_connect() {
114-
let thread = create_thread();
115-
start_thread(thread);
116-
let port = comm::port();
117-
let chan = comm::chan(port);
118-
connect(thread, 0u32, "74.125.224.146", chan);
119-
alt comm::recv(port) {
120-
connected(cd) {
121-
close_connection(thread, 0u32);
122-
}
123-
_ { fail "test_connect: port isn't connected"; }
105+
#[test]
106+
fn test_start_stop() {
107+
let thread = create_thread();
108+
start_thread(thread);
109+
join_thread(thread);
110+
delete_thread(thread);
111+
}
112+
113+
#[test]
114+
#[ignore]
115+
fn test_connect() {
116+
let thread = create_thread();
117+
start_thread(thread);
118+
let port = comm::port();
119+
let chan = comm::chan(port);
120+
connect(thread, 0u32, "74.125.224.146", chan);
121+
alt comm::recv(port) {
122+
connected(cd) {
123+
close_connection(thread, 0u32);
124+
}
125+
_ { fail "test_connect: port isn't connected"; }
126+
}
127+
join_thread(thread);
128+
delete_thread(thread);
124129
}
125-
join_thread(thread);
126-
delete_thread(thread);
127-
}
128130

129-
#[test]
130-
#[ignore]
131-
fn test_http() {
132-
let thread = create_thread();
133-
start_thread(thread);
134-
let port = comm::port();
135-
let chan = comm::chan(port);
136-
connect(thread, 0u32, "74.125.224.146", chan);
137-
alt comm::recv(port) {
138-
connected(cd) {
139-
write(thread, 0u32, str::bytes("GET / HTTP/1.0\n\n"), chan);
131+
#[test]
132+
#[ignore]
133+
fn test_http() {
134+
let thread = create_thread();
135+
start_thread(thread);
136+
let port = comm::port();
137+
let chan = comm::chan(port);
138+
connect(thread, 0u32, "74.125.224.146", chan);
140139
alt comm::recv(port) {
141-
wrote(cd) {
142-
read_start(thread, 0u32, chan);
143-
let keep_going = true;
144-
while keep_going {
145-
alt comm::recv(port) {
146-
read(_, buf, -1) {
147-
keep_going = false;
148-
delete_buf(buf);
149-
}
150-
read(_, buf, len) {
151-
unsafe {
152-
log(error, len);
153-
let buf = vec::unsafe::from_buf(buf, len as uint);
154-
let str = str::from_bytes(buf);
155-
#error("read something");
156-
io::println(str);
140+
connected(cd) {
141+
write(thread, 0u32, str::bytes("GET / HTTP/1.0\n\n"), chan);
142+
alt comm::recv(port) {
143+
wrote(cd) {
144+
read_start(thread, 0u32, chan);
145+
let keep_going = true;
146+
while keep_going {
147+
alt comm::recv(port) {
148+
read(_, buf, -1) {
149+
keep_going = false;
150+
delete_buf(buf);
151+
}
152+
read(_, buf, len) {
153+
unsafe {
154+
log(error, len);
155+
let buf = vec::unsafe::from_buf(buf,
156+
len as uint);
157+
let str = str::from_bytes(buf);
158+
#error("read something");
159+
io::println(str);
160+
}
161+
delete_buf(buf);
162+
}
163+
_ { fail "test_http: protocol error"; }
157164
}
158-
delete_buf(buf);
159-
}
160-
_ { fail "test_http: protocol error"; }
161165
}
166+
close_connection(thread, 0u32);
167+
}
168+
_ { fail "test_http: expected `wrote`"; }
162169
}
163-
close_connection(thread, 0u32);
164170
}
165-
_ { fail "test_http: expected `wrote`"; }
171+
_ { fail "test_http: port not connected"; }
166172
}
167-
}
168-
_ { fail "test_http: port not connected"; }
173+
join_thread(thread);
174+
delete_thread(thread);
169175
}
170-
join_thread(thread);
171-
delete_thread(thread);
172-
}
176+
}

src/libstd/win32_os.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ mod libc_constants {
4444
}
4545

4646
type DWORD = u32;
47-
type HMODULE = uint;
47+
type HMODULE = c_uint;
4848
type LPTSTR = str::sbuf;
4949
type LPCTSTR = str::sbuf;
5050

5151
type LPSECURITY_ATTRIBUTES = *ctypes::void;
5252

5353
#[abi = "stdcall"]
5454
native mod kernel32 {
55-
fn GetEnvironmentVariableA(n: str::sbuf, v: str::sbuf, nsize: uint) ->
56-
uint;
57-
fn SetEnvironmentVariableA(n: str::sbuf, v: str::sbuf) -> int;
55+
fn GetEnvironmentVariableA(n: str::sbuf, v: str::sbuf, nsize: c_uint) ->
56+
c_uint;
57+
fn SetEnvironmentVariableA(n: str::sbuf, v: str::sbuf) -> c_int;
5858
fn GetModuleFileNameA(hModule: HMODULE,
5959
lpFilename: LPTSTR,
6060
nSize: DWORD) -> DWORD;
@@ -99,7 +99,7 @@ fn fclose(file: FILE) {
9999
libc::fclose(file)
100100
}
101101

102-
fn fsync_fd(fd: fd_t, level: io::fsync::level) -> c_int {
102+
fn fsync_fd(_fd: fd_t, _level: io::fsync::level) -> c_int {
103103
// FIXME (1253)
104104
fail;
105105
}

0 commit comments

Comments
 (0)