Skip to content

Commit

Permalink
Bump to 0.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Jan 23, 2015
1 parent d7a235f commit 216917d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

name = "flate2"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
version = "0.1.5"
version = "0.1.6"
license = "MIT/Apache-2.0"
readme = "README.md"
keywords = ["gzip", "flate", "zlib", "encoding"]
Expand Down
2 changes: 1 addition & 1 deletion src/crc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<R: Reader> CrcReader<R> {
impl<R: Reader> Reader for CrcReader<R> {
fn read(&mut self, into: &mut [u8]) -> IoResult<usize> {
let amt = try!(self.inner.read(into));
self.crc.update(into.slice_to(amt));
self.crc.update(&into[..amt]);
Ok(amt)
}
}
2 changes: 1 addition & 1 deletion src/deflate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ mod tests {
let mut w = EncoderWriter::new(MemWriter::new(), Default);
let v = thread_rng().gen_iter::<u8>().take(1024).collect::<Vec<_>>();
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();
}
Expand Down
12 changes: 6 additions & 6 deletions src/gz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ impl<R: Reader> EncoderReader<R> {

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
}
Expand All @@ -290,7 +290,7 @@ impl<R: Reader> Reader for EncoderReader<R> {
} 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),
Expand Down Expand Up @@ -390,14 +390,14 @@ impl<R: Reader> DecoderReader<R> {
{
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())
Expand Down Expand Up @@ -482,7 +482,7 @@ mod tests {
let mut w = EncoderWriter::new(MemWriter::new(), Default);
let v = thread_rng().gen_iter::<u8>().take(1024).collect::<Vec<_>>();
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();
}
Expand Down
8 changes: 4 additions & 4 deletions src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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()));
Expand Down
2 changes: 1 addition & 1 deletion src/zlib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ mod tests {
let mut w = EncoderWriter::new(MemWriter::new(), Default);
let v = thread_rng().gen_iter::<u8>().take(1024).collect::<Vec<_>>();
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();
}
Expand Down

0 comments on commit 216917d

Please sign in to comment.