about summary refs log tree commit diff
path: root/src/libstd/rt/io
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-10-17 21:08:48 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-10-24 14:21:58 -0700
commit620ab3853abf99ecea3a3d055f47cd6d06433c95 (patch)
tree61f35d294ededfa57258fee32e83b54f7f2e0536 /src/libstd/rt/io
parent279c35182050889cba42e4adb1438a7f640fdabd (diff)
downloadrust-620ab3853abf99ecea3a3d055f47cd6d06433c95.tar.gz
rust-620ab3853abf99ecea3a3d055f47cd6d06433c95.zip
Test fixes and merge conflicts
Diffstat (limited to 'src/libstd/rt/io')
-rw-r--r--src/libstd/rt/io/native/file.rs18
-rw-r--r--src/libstd/rt/io/net/addrinfo.rs7
2 files changed, 20 insertions, 5 deletions
diff --git a/src/libstd/rt/io/native/file.rs b/src/libstd/rt/io/native/file.rs
index a2b2289679a..ba819df071a 100644
--- a/src/libstd/rt/io/native/file.rs
+++ b/src/libstd/rt/io/native/file.rs
@@ -17,9 +17,18 @@ use os;
 use prelude::*;
 use super::super::*;
 
-fn raise_error() {
+#[cfg(windows)]
+fn get_err(errno: i32) -> (IoErrorKind, &'static str) {
+    match errno {
+        libc::EOF => (EndOfFile, "end of file"),
+        _ => (OtherIoError, "unknown error"),
+    }
+}
+
+#[cfg(not(windows))]
+fn get_err(errno: i32) -> (IoErrorKind, &'static str) {
     // XXX: this should probably be a bit more descriptive...
-    let (kind, desc) = match os::errno() as i32 {
+    match errno {
         libc::EOF => (EndOfFile, "end of file"),
 
         // These two constants can have the same value on some systems, but
@@ -28,8 +37,11 @@ fn raise_error() {
             (ResourceUnavailable, "resource temporarily unavailable"),
 
         _ => (OtherIoError, "unknown error"),
-    };
+    }
+}
 
+fn raise_error() {
+    let (kind, desc) = get_err(os::errno() as i32);
     io_error::cond.raise(IoError {
         kind: kind,
         desc: desc,
diff --git a/src/libstd/rt/io/net/addrinfo.rs b/src/libstd/rt/io/net/addrinfo.rs
index e0c92730cd9..27cf9781c9c 100644
--- a/src/libstd/rt/io/net/addrinfo.rs
+++ b/src/libstd/rt/io/net/addrinfo.rs
@@ -91,8 +91,11 @@ pub fn get_host_addresses(host: &str) -> Option<~[IpAddr]> {
 /// # Failure
 ///
 /// On failure, this will raise on the `io_error` condition.
-pub fn lookup(hostname: Option<&str>, servname: Option<&str>,
-              hint: Option<Hint>) -> Option<~[Info]> {
+///
+/// XXX: this is not public because the `Hint` structure is not ready for public
+///      consumption just yet.
+fn lookup(hostname: Option<&str>, servname: Option<&str>,
+          hint: Option<Hint>) -> Option<~[Info]> {
     do with_local_io |io| {
         match io.get_host_addresses(hostname, servname, hint) {
             Ok(i) => Some(i),