From 216917d40a2d4649574bb428604bf630d9119714 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 23 Jan 2015 08:37:02 -0800 Subject: [PATCH] Bump to 0.1.6 --- Cargo.toml | 2 +- src/crc.rs | 2 +- src/deflate.rs | 2 +- src/gz.rs | 12 ++++++------ src/raw.rs | 8 ++++---- src/zlib.rs | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8979aa6d7..4eedde106 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "flate2" authors = ["Alex Crichton "] -version = "0.1.5" +version = "0.1.6" license = "MIT/Apache-2.0" readme = "README.md" keywords = ["gzip", "flate", "zlib", "encoding"] diff --git a/src/crc.rs b/src/crc.rs index 03f94c1de..96150163d 100644 --- a/src/crc.rs +++ b/src/crc.rs @@ -43,7 +43,7 @@ impl CrcReader { impl Reader for CrcReader { fn read(&mut self, into: &mut [u8]) -> IoResult { let amt = try!(self.inner.read(into)); - self.crc.update(into.slice_to(amt)); + self.crc.update(&into[..amt]); Ok(amt) } } diff --git a/src/deflate.rs b/src/deflate.rs index 1ab0cbdbd..70b238b68 100644 --- a/src/deflate.rs +++ b/src/deflate.rs @@ -145,7 +145,7 @@ mod tests { let mut w = EncoderWriter::new(MemWriter::new(), Default); let v = thread_rng().gen_iter::().take(1024).collect::>(); for _ in range(0, 200) { - let to_write = v.slice_to(thread_rng().gen_range(0, v.len())); + let to_write = &v[..thread_rng().gen_range(0, v.len())]; real.push_all(to_write); w.write(to_write).unwrap(); } diff --git a/src/gz.rs b/src/gz.rs index f894376a8..5e279ea6a 100644 --- a/src/gz.rs +++ b/src/gz.rs @@ -277,7 +277,7 @@ impl EncoderReader { fn copy(into: &mut [u8], from: &[u8], pos: &mut usize) -> usize { let min = cmp::min(into.len(), from.len() - *pos); - bytes::copy_memory(into, from.slice(*pos, *pos + min)); + bytes::copy_memory(into, &from[*pos .. *pos + min]); *pos += min; return min } @@ -290,7 +290,7 @@ impl Reader for EncoderReader { } else if self.pos < self.header.len() { amt += copy(into, self.header.as_slice(), &mut self.pos); if amt == into.len() { return Ok(amt) } - let tmp = into; into = tmp.slice_from_mut(amt); + let tmp = into; into = &mut tmp[amt..]; } match self.inner.read(into) { Ok(a) => Ok(amt + a), @@ -390,14 +390,14 @@ impl DecoderReader { { let flate = self.inner.inner(); let len = { - let remaining = flate.buf.slice_from(flate.pos); + let remaining = &flate.buf[flate.pos..]; let len = cmp::min(remaining.len(), buf.len()); - bytes::copy_memory(buf, remaining.slice_to(len)); + bytes::copy_memory(buf, &remaining[..len]); len }; if len < buf.len() { - match flate.inner.read(buf.slice_from_mut(len)) { + match flate.inner.read(&mut buf[len..]) { Ok(..) => {} Err(ref e) if e.kind == io::EndOfFile => { return Err(corrupt()) @@ -482,7 +482,7 @@ mod tests { let mut w = EncoderWriter::new(MemWriter::new(), Default); let v = thread_rng().gen_iter::().take(1024).collect::>(); for _ in range(0, 200) { - let to_write = v.slice_to(thread_rng().gen_range(0, v.len())); + let to_write = &v[..thread_rng().gen_range(0, v.len())]; real.push_all(to_write); w.write(to_write).unwrap(); } diff --git a/src/raw.rs b/src/raw.rs index 7ab0ee0a3..2ec850434 100644 --- a/src/raw.rs +++ b/src/raw.rs @@ -201,8 +201,8 @@ impl Stream { *pos = 0; } - let next_in = buf.slice_from(*pos); - let next_out = into.slice_from_mut(read); + let next_in = &buf[*pos..]; + let next_out = &mut into[read..]; self.next_in = next_in.as_ptr(); self.avail_in = next_in.len() as libc::c_uint; @@ -244,7 +244,7 @@ impl Stream { self.next_in = buf.as_ptr(); self.avail_in = buf.len() as libc::c_uint; let cur_len = into.len(); - self.next_out = into.slice_from_mut(cur_len).as_mut_ptr(); + self.next_out = into[cur_len..].as_mut_ptr(); self.avail_out = (cap - cur_len) as libc::c_uint; let before_out = self.total_out; @@ -255,7 +255,7 @@ impl Stream { into.set_len(cur_len + (self.total_out - before_out) as usize); ret }; - buf = buf.slice_from((self.total_in - before_in) as usize); + buf = &buf[(self.total_in - before_in) as usize..]; if cap - cur_len == 0 || ret == ffi::MZ_BUF_ERROR { try!(writer.write(into.as_slice())); diff --git a/src/zlib.rs b/src/zlib.rs index 2f2f24469..d8b4d1da4 100644 --- a/src/zlib.rs +++ b/src/zlib.rs @@ -146,7 +146,7 @@ mod tests { let mut w = EncoderWriter::new(MemWriter::new(), Default); let v = thread_rng().gen_iter::().take(1024).collect::>(); for _ in range(0, 200) { - let to_write = v.slice_to(thread_rng().gen_range(0, v.len())); + let to_write = &v[..thread_rng().gen_range(0, v.len())]; real.push_all(to_write); w.write(to_write).unwrap(); }