libcore: rename *flate_buf to *flate_bytes (#3444)
This commit is contained in:
parent
f1f5739256
commit
651e63cc5c
@ -18,8 +18,8 @@ const lz_fast : c_int = 0x1; // LZ with only one probe
|
||||
const lz_norm : c_int = 0x80; // LZ with 128 probes, "normal"
|
||||
const lz_best : c_int = 0xfff; // LZ with 4095 probes, "best"
|
||||
|
||||
fn deflate_buf(buf: &[const u8]) -> ~[u8] {
|
||||
do vec::as_const_buf(buf) |b, len| {
|
||||
fn deflate_bytes(bytes: &[const u8]) -> ~[u8] {
|
||||
do vec::as_const_buf(bytes) |b, len| {
|
||||
unsafe {
|
||||
let mut outsz : size_t = 0;
|
||||
let res =
|
||||
@ -36,8 +36,8 @@ fn deflate_buf(buf: &[const u8]) -> ~[u8] {
|
||||
}
|
||||
}
|
||||
|
||||
fn inflate_buf(buf: &[const u8]) -> ~[u8] {
|
||||
do vec::as_const_buf(buf) |b, len| {
|
||||
fn inflate_bytes(bytes: &[const u8]) -> ~[u8] {
|
||||
do vec::as_const_buf(bytes) |b, len| {
|
||||
unsafe {
|
||||
let mut outsz : size_t = 0;
|
||||
let res =
|
||||
@ -69,11 +69,11 @@ fn test_flate_round_trip() {
|
||||
}
|
||||
debug!("de/inflate of %u bytes of random word-sequences",
|
||||
in.len());
|
||||
let cmp = flate::deflate_buf(in);
|
||||
let out = flate::inflate_buf(cmp);
|
||||
let cmp = flate::deflate_bytes(in);
|
||||
let out = flate::inflate_bytes(cmp);
|
||||
debug!("%u bytes deflated to %u (%.1f%% size)",
|
||||
in.len(), cmp.len(),
|
||||
100.0 * ((cmp.len() as float) / (in.len() as float)));
|
||||
assert(in == out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1178,7 +1178,7 @@ fn encode_metadata(parms: encode_parms, crate: @crate) -> ~[u8] {
|
||||
|
||||
(do str::as_bytes(~"rust\x00\x00\x00\x01") |bytes| {
|
||||
vec::slice(bytes, 0, 8)
|
||||
}) + flate::deflate_buf(io::mem_buffer_buf(buf))
|
||||
}) + flate::deflate_bytes(io::mem_buffer_buf(buf))
|
||||
}
|
||||
|
||||
// Get the encoded string for a type
|
||||
|
@ -202,8 +202,8 @@ fn get_metadata_section(os: os,
|
||||
let cvbuf1 = ptr::offset(cvbuf, vlen);
|
||||
debug!("inflating %u bytes of compressed metadata",
|
||||
csz - vlen);
|
||||
do vec::raw::form_slice(cvbuf1, csz-vlen) |buf| {
|
||||
let inflated = flate::inflate_buf(buf);
|
||||
do vec::raw::form_slice(cvbuf1, csz-vlen) |bytes| {
|
||||
let inflated = flate::inflate_bytes(bytes);
|
||||
found = move Some(@(move inflated));
|
||||
}
|
||||
if found != None {
|
||||
|
Loading…
x
Reference in New Issue
Block a user