Skip to content

Commit bb17a3a

Browse files
authored
Merge pull request #55 from danielrh/master
Fix q9 compression
2 parents 458f578 + d23dbcd commit bb17a3a

23 files changed

+341
-174
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "brotli"
3-
version = "3.3.0"
3+
version = "3.3.1"
44
authors = ["Daniel Reiter Horn <[email protected]>", "The Brotli Authors"]
55
description = "A brotli compressor and decompressor that with an interface avoiding the rust stdlib. This makes it suitable for embedded devices and kernels. It is designed with a pluggable allocator so that the standard lib's allocator may be employed. The default build also includes a stdlib allocator and stream interface. Disable this with --features=no-stdlib. All included code is safe."
66
license = "BSD-3-Clause/MIT"

examples/compress.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn main() {
2121
if let io::ErrorKind::Interrupted = e.kind() {
2222
continue;
2323
}
24-
panic!(e);
24+
panic!("{}", e);
2525
}
2626
Ok(size) => {
2727
if size == 0 {
@@ -30,13 +30,13 @@ fn main() {
3030
if let io::ErrorKind::Interrupted = e.kind() {
3131
continue;
3232
}
33-
panic!(e)
33+
panic!("{}", e)
3434
}
3535
Ok(_) => break,
3636
}
3737
}
3838
match writer.write_all(&buf[..size]) {
39-
Err(e) => panic!(e),
39+
Err(e) => panic!("{}", e),
4040
Ok(_) => {},
4141
}
4242
}

examples/decompress.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ fn main() {
2020
if let io::ErrorKind::Interrupted = e.kind() {
2121
continue;
2222
}
23-
panic!(e);
23+
panic!("{}", e);
2424
}
2525
Ok(size) => {
2626
if size == 0 {
2727
break;
2828
}
2929
match io::stdout().write_all(&buf[..size]) {
30-
Err(e) => panic!(e),
30+
Err(e) => panic!("{}", e),
3131
Ok(_) => {},
3232
}
3333
}

src/bin/catbrotli.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn main() {
8989
loop {
9090
ioffset = 0;
9191
match read_no_interrupt(&mut input_file, &mut ibuffer[..]) {
92-
Err(e) => panic!(e),
92+
Err(e) => panic!("{}", e),
9393
Ok(cur_read) => {
9494
if cur_read == 0 {
9595
break;
@@ -142,7 +142,7 @@ fn main() {
142142
break;
143143
}
144144
failure => {
145-
panic!(failure)
145+
panic!("{:?}", failure)
146146
}
147147
}
148148
}

src/bin/integration_tests.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ fn decompress_internal<InputType, OutputType, Run: Runner>(r: &mut InputType,
143143
Err(e) => {
144144
match e.kind() {
145145
io::ErrorKind::Interrupted => continue,
146-
_ => panic!(e),
146+
_ => panic!("{}", e),
147147
}
148148
}
149149
Ok(size) => {
150150
if size == 0 {
151-
panic!(io::Error::new(io::ErrorKind::UnexpectedEof, "Read EOF"));
151+
panic!("{:?}", io::Error::new(io::ErrorKind::UnexpectedEof, "Read EOF"));
152152
}
153153
available_in = size;
154154
}
@@ -385,7 +385,7 @@ fn test_random_then_unicode_9() {
385385
roundtrip_helper(RANDOM_THEN_UNICODE, 9, 22, false);
386386
}
387387
#[cfg(feature="std")]
388-
const random_then_unicode_compressed_size_9_5 : usize = 136563;
388+
const random_then_unicode_compressed_size_9_5 : usize = 136542;
389389
#[cfg(feature="std")]
390390
const random_then_unicode_compressed_size_9_5x : usize = 136045;
391391

src/bin/test_broccoli.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn concat(files:&mut [UnlimitedBuffer],
4040
loop {
4141
ioffset = 0;
4242
match input.read(&mut ibuffer[..]) {
43-
Err(e) => panic!(e),
43+
Err(e) => panic!("{}", e),
4444
Ok(cur_read) => {
4545
if cur_read == 0 {
4646
break;
@@ -62,7 +62,7 @@ fn concat(files:&mut [UnlimitedBuffer],
6262
panic!("Unexpected state: Success when streaming before finish");
6363
},
6464
failure => {
65-
panic!(failure);
65+
panic!("{:?}", failure);
6666
},
6767
}
6868
}
@@ -94,7 +94,7 @@ fn concat(files:&mut [UnlimitedBuffer],
9494
break;
9595
}
9696
failure => {
97-
panic!(failure)
97+
panic!("{:?}", failure)
9898
}
9999
}
100100
}

src/bin/test_custom_dict.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ fn test_custom_dict_for_multithreading() {
113113
for brotli in brs.iter_mut() {
114114
brotli.reset_read();
115115
bro_cat_li.new_brotli_file();
116-
let mut input = brotli;
116+
let input = brotli;
117117
loop {
118118
let mut ioffset = 0usize;
119119
match input.read(&mut ibuffer[..]) {
120-
Err(e) => panic!(e),
120+
Err(e) => panic!("{:?}", e),
121121
Ok(cur_read) => {
122122
if cur_read == 0 {
123123
break;
@@ -139,7 +139,7 @@ fn test_custom_dict_for_multithreading() {
139139
panic!("Unexpected state: Success when streaming before finish");
140140
},
141141
failure => {
142-
panic!(failure);
142+
panic!("{:?}", failure);
143143
},
144144
}
145145
}
@@ -169,7 +169,7 @@ fn test_custom_dict_for_multithreading() {
169169
break;
170170
}
171171
failure => {
172-
panic!(failure)
172+
panic!("{}", failure as i32)
173173
}
174174
}
175175
}

src/bin/util.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ struct HexSlice<'a>(&'a [u8]);
3232
impl<'a> fmt::Display for HexSlice<'a> {
3333
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3434
for byte in self.0 {
35-
try!(write!(f, "{:02X}", byte));
35+
if let Err(e) = write!(f, "{:02X}", byte) {
36+
return Err(e);
37+
}
3638
}
3739
Ok(())
3840
}
@@ -83,7 +85,9 @@ struct SliceU8Ref<'a>(pub &'a[u8]);
8385
impl<'a> fmt::LowerHex for SliceU8Ref<'a> {
8486
fn fmt(&self, fmtr: &mut fmt::Formatter) -> Result<(), fmt::Error> {
8587
for item in self.0 {
86-
try!( fmtr.write_fmt(format_args!("{:02x}", item)));
88+
if let Err(e) = fmtr.write_fmt(format_args!("{:02x}", item)) {
89+
return Err(e);
90+
}
8791
}
8892
Ok(())
8993
}

src/concat/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use core;
22

33
#[repr(C)]
44
#[derive(Debug,Clone,Copy, PartialEq)]
5-
#[no_mangle]
65
pub enum BroCatliResult {
76
Success = 0,
87
NeedsMoreInput = 1,

0 commit comments

Comments
 (0)