Skip to content

Commit c8c9c8a

Browse files
committed
Convert int to isize, uint to usize
See rust-lang/rust#20708
1 parent a21fd08 commit c8c9c8a

File tree

10 files changed

+49
-49
lines changed

10 files changed

+49
-49
lines changed

codegen/branchify.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ macro_rules! branchify(
8585
pub fn generate_branchified_method(
8686
writer: &mut Writer,
8787
branches: Vec<ParseBranch>,
88-
indent: uint,
88+
indent: usize,
8989
read_call: &str,
9090
end: &str,
9191
max_len: &str,
9292
valid: &str,
9393
unknown: &str) -> IoResult<()> {
9494

95-
fn r(writer: &mut Writer, branch: &ParseBranch, prefix: &str, indent: uint, read_call: &str,
95+
fn r(writer: &mut Writer, branch: &ParseBranch, prefix: &str, indent: usize, read_call: &str,
9696
end: &str, max_len: &str, valid: &str, unknown: &str) -> IoResult<()> {
9797
let indentstr = repeat(' ').take(indent * 4).collect::<String>();
9898
macro_rules! w (

codegen/status.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ enum HeadingOrStatus {
2323

2424
#[derive(Copy)]
2525
struct HttpStatus {
26-
code: uint,
26+
code: usize,
2727
reason: &'static str,
2828
comment: Option<&'static str>,
2929
}
3030

3131
/// Status with comment
32-
fn status_c(code: uint, reason: &'static str, comment: &'static str) -> HeadingOrStatus {
32+
fn status_c(code: usize, reason: &'static str, comment: &'static str) -> HeadingOrStatus {
3333
Status(HttpStatus { code: code, reason: reason, comment: Some(comment) })
3434
}
3535

3636
/// Status without comment
37-
fn status_n(code: uint, reason: &'static str) -> HeadingOrStatus {
37+
fn status_n(code: usize, reason: &'static str) -> HeadingOrStatus {
3838
Status(HttpStatus { code: code, reason: reason, comment: None })
3939
}
4040

@@ -74,8 +74,8 @@ fn camel_case(msg: &str) -> String {
7474
result
7575
}
7676

77-
static mut longest_ident: uint = 0;
78-
static mut longest_reason: uint = 0;
77+
static mut longest_ident: usize = 0;
78+
static mut longest_reason: usize = 0;
7979

8080
pub fn generate(output_dir: Path) -> IoResult<()> {
8181
let mut out = get_writer(output_dir, "status.rs");

src/http/buffer.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ use std::fmt::radix;
77
use std::ptr;
88

99
// 64KB chunks (moderately arbitrary)
10-
const READ_BUF_SIZE: uint = 0x10000;
11-
const WRITE_BUF_SIZE: uint = 0x10000;
10+
const READ_BUF_SIZE: usize = 0x10000;
11+
const WRITE_BUF_SIZE: usize = 0x10000;
1212
// TODO: consider removing constants and giving a buffer size in the constructor
1313

1414
pub struct BufferedStream<T> {
1515
pub wrapped: T,
1616
pub read_buffer: Vec<u8>,
1717
// The current position in the buffer
18-
pub read_pos: uint,
18+
pub read_pos: usize,
1919
// The last valid position in the reader
20-
pub read_max: uint,
20+
pub read_max: usize,
2121
pub write_buffer: Vec<u8>,
22-
pub write_len: uint,
22+
pub write_len: usize,
2323

2424
pub writing_chunked_body: bool,
2525
}
@@ -33,10 +33,10 @@ impl<T: Stream> BufferedStream<T> {
3333
BufferedStream {
3434
wrapped: stream,
3535
read_buffer: read_buffer,
36-
read_pos: 0u,
37-
read_max: 0u,
36+
read_pos: 0us,
37+
read_max: 0us,
3838
write_buffer: write_buffer,
39-
write_len: 0u,
39+
write_len: 0us,
4040
writing_chunked_body: false,
4141
}
4242
}
@@ -105,7 +105,7 @@ impl<T: Reader> Reader for BufferedStream<T> {
105105
///
106106
/// At present, this makes no attempt to fill its buffer proactively, instead waiting until you
107107
/// ask.
108-
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
108+
fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
109109
if self.read_pos == self.read_max {
110110
// Fill the buffer, giving up if we've run out of buffered content
111111
try!(self.fill_buffer());
@@ -137,7 +137,7 @@ impl<T: Writer> Writer for BufferedStream<T> {
137137
}
138138
} else {
139139
unsafe {
140-
ptr::copy_memory(self.write_buffer.as_mut_ptr().offset(self.write_len as int),
140+
ptr::copy_memory(self.write_buffer.as_mut_ptr().offset(self.write_len as isize),
141141
buf.as_ptr(), buf.len());
142142
}
143143

src/http/client/response.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub struct ResponseReader<S> {
1717
pub request: RequestWriter<S>,
1818

1919
/// The HTTP version number; typically `(1, 1)` or, less commonly, `(1, 0)`.
20-
pub version: (uint, uint),
20+
pub version: (usize, usize),
2121

2222
/// The HTTP status indicated in the response.
2323
pub status: Status,
@@ -129,7 +129,7 @@ impl<S: Stream> ResponseReader<S> {
129129
}
130130

131131
impl<S: Stream> Reader for ResponseReader<S> {
132-
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
132+
fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
133133
self.stream.read(buf)
134134
}
135135
}

src/http/client/sslclients/none.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl Connecter for NetworkStream {
3232
}
3333

3434
impl Reader for NetworkStream {
35-
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
35+
fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
3636
match *self {
3737
NormalStream(ref mut ns) => ns.read(buf),
3838
}

src/http/client/sslclients/openssl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl Connecter for NetworkStream {
3535
}
3636

3737
impl Reader for NetworkStream {
38-
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
38+
fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
3939
match *self {
4040
NormalStream(ref mut ns) => ns.read(buf),
4141
SslProtectedStream(ref mut ns) => ns.read(buf),

src/http/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ fn test_read_http_version() {
191191
#[test]
192192
fn test_read_decimal() {
193193
test_reads!(decimal,
194-
"0\0" => Some(0u),
194+
"0\0" => Some(0us),
195195
"0\0" => Some(0u8),
196196
"0\0" => Some(0u64),
197197
"9\0" => Some(9u8),
@@ -218,7 +218,7 @@ fn test_read_decimal() {
218218
#[test]
219219
fn test_read_hexadecimal() {
220220
test_reads!(hexadecimal,
221-
"0\0" => Some(0u),
221+
"0\0" => Some(0us),
222222
"0\0" => Some(0u8),
223223
"0\0" => Some(0u64),
224224
"f\0" => Some(0xfu8),

src/http/headers/mod.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,8 @@ impl HeaderConvertible for String {
635635
}
636636
}
637637

638-
impl HeaderConvertible for uint {
639-
fn from_stream<R: Reader>(reader: &mut HeaderValueByteIterator<R>) -> Option<uint> {
638+
impl HeaderConvertible for usize {
639+
fn from_stream<R: Reader>(reader: &mut HeaderValueByteIterator<R>) -> Option<usize> {
640640
reader.collect_to_string().parse()
641641
}
642642

@@ -782,23 +782,23 @@ mod test {
782782
}
783783

784784
#[test]
785-
fn test_from_stream_uint() {
786-
assert_eq!(from_stream_with_str::<uint>("foo bar"), None);
787-
assert_eq!(from_stream_with_str::<uint>("-1"), None);
788-
assert_eq!(from_stream_with_str("0"), Some(0u));
789-
assert_eq!(from_stream_with_str("123456789"), Some(123456789u));
785+
fn test_from_stream_usize() {
786+
assert_eq!(from_stream_with_str::<usize>("foo bar"), None);
787+
assert_eq!(from_stream_with_str::<usize>("-1"), None);
788+
assert_eq!(from_stream_with_str("0"), Some(0us));
789+
assert_eq!(from_stream_with_str("123456789"), Some(123456789us));
790790
}
791791

792792
#[test]
793-
fn test_http_value_uint() {
794-
assert_eq!(0u.http_value(), String::from_str("0"));
795-
assert_eq!(123456789u.http_value(), String::from_str("123456789"));
793+
fn test_http_value_usize() {
794+
assert_eq!(0us.http_value(), String::from_str("0"));
795+
assert_eq!(123456789us.http_value(), String::from_str("123456789"));
796796
}
797797

798798
#[test]
799-
fn test_to_stream_uint() {
800-
assert_eq!(to_stream_into_str(&0u), String::from_str("0"));
801-
assert_eq!(to_stream_into_str(&123456789u), String::from_str("123456789"));
799+
fn test_to_stream_usize() {
800+
assert_eq!(to_stream_into_str(&0us), String::from_str("0"));
801+
assert_eq!(to_stream_into_str(&123456789us), String::from_str("123456789"));
802802
}
803803

804804
fn sample_tm() -> Tm {
@@ -965,7 +965,7 @@ macro_rules! headers_mod {
965965
}
966966

967967
pub struct HeaderCollectionIterator<'a> {
968-
pos: uint,
968+
pos: usize,
969969
coll: &'a HeaderCollection,
970970
ext_iter: Option<Iter<'a, String, String>>
971971
}
@@ -1078,7 +1078,7 @@ headers_mod! {
10781078
19, "If-None-Match", "if-none-match", IfNoneMatch, if_none_match, String,
10791079
20, "If-Range", "if-range", IfRange, if_range, String,
10801080
21, "If-Unmodified-Since", "if-unmodified-since", IfUnmodifiedSince, if_unmodified_since, time::Tm,
1081-
22, "Max-Forwards", "max-forwards", MaxForwards, max_forwards, uint,
1081+
22, "Max-Forwards", "max-forwards", MaxForwards, max_forwards, usize,
10821082
23, "Proxy-Authorization", "proxy-authorization", ProxyAuthorization, proxy_authorization, String,
10831083
24, "Range", "range", Range, range, String,
10841084
25, "Referer", "referer", Referer, referer, String,
@@ -1089,7 +1089,7 @@ headers_mod! {
10891089
28, "Allow", "allow", Allow, allow, Vec<::method::Method>,
10901090
29, "Content-Encoding", "content-encoding", ContentEncoding, content_encoding, String,
10911091
30, "Content-Language", "content-language", ContentLanguage, content_language, String,
1092-
31, "Content-Length", "content-length", ContentLength, content_length, uint,
1092+
31, "Content-Length", "content-length", ContentLength, content_length, usize,
10931093
32, "Content-Location", "content-location", ContentLocation, content_location, String,
10941094
33, "Content-MD5", "content-md5", ContentMd5, content_md5, String,
10951095
34, "Content-Range", "content-range", ContentRange, content_range, String,
@@ -1131,7 +1131,7 @@ headers_mod! {
11311131
19, "Allow", "allow", Allow, allow, Vec<::method::Method>,
11321132
20, "Content-Encoding", "content-encoding", ContentEncoding, content_encoding, String,
11331133
21, "Content-Language", "content-language", ContentLanguage, content_language, String,
1134-
22, "Content-Length", "content-length", ContentLength, content_length, uint,
1134+
22, "Content-Length", "content-length", ContentLength, content_length, usize,
11351135
23, "Content-Location", "content-location", ContentLocation, content_location, String,
11361136
24, "Content-MD5", "content-md5", ContentMd5, content_md5, String,
11371137
25, "Content-Range", "content-range", ContentRange, content_range, String,

src/http/memstream.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl Writer for MemWriterFakeStream {
2828
}
2929

3030
impl Reader for MemWriterFakeStream {
31-
fn read(&mut self, _buf: &mut [u8]) -> IoResult<uint> {
31+
fn read(&mut self, _buf: &mut [u8]) -> IoResult<usize> {
3232
panic!("Uh oh, you didn't aught to call MemWriterFakeStream.read()!")
3333
}
3434
}
@@ -41,7 +41,7 @@ impl MemReaderFakeStream {
4141
}
4242

4343
impl Reader for MemReaderFakeStream {
44-
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
44+
fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
4545
let &MemReaderFakeStream(ref mut s) = self;
4646
s.read(buf)
4747
}

src/http/server/request.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ use self::RequestUri::{Star, AbsoluteUri, AbsolutePath, Authority};
2020

2121
// /// Line/header can't be more than 4KB long (note that with the compacting of LWS the actual source
2222
// /// data could be longer than 4KB)
23-
// const MAX_LINE_LEN: uint = 0x1000;
23+
// const MAX_LINE_LEN: usize = 0x1000;
2424

25-
const MAX_REQUEST_URI_LEN: uint = 1024;
26-
pub const MAX_METHOD_LEN: uint = 64;
25+
const MAX_REQUEST_URI_LEN: usize = 1024;
26+
pub const MAX_METHOD_LEN: usize = 64;
2727

2828
pub struct RequestBuffer<'a, S: 'a> {
2929
/// The socket connection to read from
@@ -37,7 +37,7 @@ impl<'a, S: Stream> RequestBuffer<'a, S> {
3737
}
3838
}
3939

40-
pub fn read_request_line(&mut self) -> Result<(Method, RequestUri, (uint, uint)),
40+
pub fn read_request_line(&mut self) -> Result<(Method, RequestUri, (usize, usize)),
4141
status::Status> {
4242
let method = match self.read_method() {
4343
Ok(m) => m,
@@ -163,7 +163,7 @@ impl<'a, S: Stream> RequestBuffer<'a, S> {
163163
}
164164

165165
impl<'a, S: Stream> Reader for RequestBuffer<'a, S> {
166-
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
166+
fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
167167
self.stream.read(buf)
168168
}
169169
}
@@ -239,7 +239,7 @@ pub struct Request {
239239
pub close_connection: bool,
240240

241241
/// The HTTP version number; typically `(1, 1)` or, less commonly, `(1, 0)`.
242-
pub version: (uint, uint)
242+
pub version: (usize, usize)
243243
}
244244

245245
/// The URI (Request-URI in RFC 2616) as specified in the Status-Line of an HTTP request
@@ -408,7 +408,7 @@ pub struct Request {
408408
url: ~Url,
409409
410410
// The HTTP protocol version used; typically (1, 1)
411-
protocol: (uint, uint),
411+
protocol: (usize, usize),
412412
413413
// Request headers, all nicely and correctly parsed.
414414
headers: ~Headers,

0 commit comments

Comments
 (0)