commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
0b9331dd1960217c120ec222a58af6a25b6ba1b6 | Moritz Borcherding | 2023-03-29T17:58:54 | make clippy happy | diff --git a/src/frame.rs b/src/frame.rs
index 50c7086..3810e4b 100644
--- a/src/frame.rs
+++ b/src/frame.rs
@@ -193,6 +193,8 @@ pub fn read_frame_header(mut r: impl Read) -> Result<(Frame, u8), ReadFrameHeade
r.read_exact(buf).map_err(err::DictionaryIdReadError)?;
bytes_read += dict_id_len;
... | 2 | 5 | 1 |
06433dec34885ad960b86f3c2ab956d05f0acabe | Moritz Borcherding | 2023-03-29T17:53:25 | start overhauling dict API | diff --git a/src/decoding/scratch.rs b/src/decoding/scratch.rs
index 5b905a7..bd6e5f9 100644
--- a/src/decoding/scratch.rs
+++ b/src/decoding/scratch.rs
@@ -58,29 +58,13 @@ impl DecoderScratch {
}
pub fn use_dict(&mut self, dict: &Dictionary) {
- self.fse = dict.fse.clone();
- self.huf = dict.... | 7 | 82 | 176 |
a4d5d48602c04bb95fe22c8f5337eab492d462a0 | Moritz Borcherding | 2023-03-17T15:15:10 | bump version number | diff --git a/Cargo.toml b/Cargo.toml
index 9a5c751..ec4e0e8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ruzstd"
-version = "0.3.0"
+version = "0.3.1"
authors = ["Moritz Borcherding <moritz.borcherding@web.de>"]
edition = "2018"
license = "MIT" | 1 | 1 | 1 |
993d0a7edaf79367a26edf88b266a9c6aca13c26 | Moritz Borcherding | 2023-03-15T19:14:46 | make error format for skippable frames nicer | diff --git a/src/frame.rs b/src/frame.rs
index 4de5700..1eb3f89 100644
--- a/src/frame.rs
+++ b/src/frame.rs
@@ -225,7 +225,7 @@ pub enum ReadFrameHeaderError {
DictionaryIdReadError(#[source] io::Error),
#[error("Error while reading frame content size: {0}")]
FrameContentSizeReadError(#[source] io::Erro... | 1 | 1 | 1 |
4aef98d337d59fe6ddd759a6d9e543fc65fd3d15 | Moritz Borcherding | 2023-03-13T18:02:26 | add basic support for skippable frames | diff --git a/src/bin/zstd.rs b/src/bin/zstd.rs
index dce21fc..54c5d19 100644
--- a/src/bin/zstd.rs
+++ b/src/bin/zstd.rs
@@ -2,8 +2,12 @@ extern crate ruzstd;
use std::fs::File;
use std::io::Read;
use std::io::Seek;
+use std::io::SeekFrom;
use std::io::Write;
+use ruzstd::frame::ReadFrameHeaderError;
+use ruzstd:... | 3 | 55 | 1 |
dc3ef951df7eb8faa337efb9f09ce7ca77c87974 | Phil Hord | 2023-03-07T20:45:08 | zstd: Use range slices instead of resizing vectors
There should be no appreciable difference in runtime, but it seems
friendlier and simpler to avoid specialty-mutations for the vector,
especially since the function accepts a slice anyway. | diff --git a/src/bin/zstd.rs b/src/bin/zstd.rs
index bf82bcd..dce21fc 100644
--- a/src/bin/zstd.rs
+++ b/src/bin/zstd.rs
@@ -69,10 +69,7 @@ fn main() {
if frame_dec.can_collect() > batch_size {
let x = frame_dec.read(result.as_mut_slice()).unwrap();
tracker.fil... | 1 | 2 | 8 |
32ab3afe0052c45e8285e18f949ee27ea9f37a16 | Moritz Borcherding | 2023-03-09T00:06:12 | make clippy happy | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index 0a437c6..9e3e9ba 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -176,8 +176,8 @@ impl RingBuffer {
pub fn as_slices(&self) -> (&[u8], &[u8]) {
let (s1, s2) = self.data_slice_parts();
unsafe {
-... | 1 | 2 | 2 |
8a928ca97d6975f1e0cef1eed530363700583fb5 | Phil Hord | 2023-03-08T19:08:27 | Apply rustfmt changes | diff --git a/src/bin/zstd.rs b/src/bin/zstd.rs
index a906b39..bf82bcd 100644
--- a/src/bin/zstd.rs
+++ b/src/bin/zstd.rs
@@ -1,8 +1,8 @@
extern crate ruzstd;
use std::fs::File;
use std::io::Read;
-use std::io::Write;
use std::io::Seek;
+use std::io::Write;
struct StateTracker {
bytes_used: u64,
@@ -86,29 +8... | 1 | 18 | 17 |
394677b25fe0cda6aaa766e06cb74c7a1b839e39 | Phil Hord | 2023-02-22T00:23:25 | Fix missing variable in error output | diff --git a/src/blocks/sequence_section.rs b/src/blocks/sequence_section.rs
index e4f7cce..28b9eff 100644
--- a/src/blocks/sequence_section.rs
+++ b/src/blocks/sequence_section.rs
@@ -58,7 +58,7 @@ impl Default for SequencesHeader {
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum SequencesHeaderParseE... | 1 | 1 | 1 |
305156cc378d53dc279aae42eafd05c5432110f0 | Phil Hord | 2023-03-07T20:41:20 | Decode multiple frames if present in the file
A file or stream may consist of more than one frame. Do not stop
after the first frame when decoding in zstd. Continue reading until
we reach the end of the file or we get an error.
Move percent-done output into do_something() to avoid duplicating
code. Calculate the perc... | diff --git a/src/bin/zstd.rs b/src/bin/zstd.rs
index 69cb13c..a906b39 100644
--- a/src/bin/zstd.rs
+++ b/src/bin/zstd.rs
@@ -2,9 +2,15 @@ extern crate ruzstd;
use std::fs::File;
use std::io::Read;
use std::io::Write;
+use std::io::Seek;
struct StateTracker {
bytes_used: u64,
+ frames_used: usize,
+ val... | 1 | 66 | 39 |
16398e0c02690bed505dfa58cca90ec95792cb83 | Moritz Borcherding | 2022-07-04T19:23:23 | bump version after breaking change | diff --git a/Cargo.toml b/Cargo.toml
index f1b535a..9a5c751 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ruzstd"
-version = "0.2.4"
+version = "0.3.0"
authors = ["Moritz Borcherding <moritz.borcherding@web.de>"]
edition = "2018"
license = "MIT" | 1 | 1 | 1 |
9c13993b777550d35d0f63b21d5ad6de3f6e9888 | Moritz Borcherding | 2022-07-04T19:02:12 | fix clippy lint | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 4cbb37b..0dea701 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -257,8 +257,8 @@ impl Decodebuffer {
self.hash.write(&slice1[..written1]);
drain_guard.amount += written1;
- ... | 1 | 5 | 4 |
1fcdf139e31ec92a7eec570874b9bb3e29943162 | Rahul Butani | 2022-07-03T15:17:52 | mark all the error enums as `#[non_exhaustive]` | diff --git a/src/blocks/literals_section.rs b/src/blocks/literals_section.rs
index b76ab08..9d83072 100644
--- a/src/blocks/literals_section.rs
+++ b/src/blocks/literals_section.rs
@@ -15,6 +15,7 @@ pub enum LiteralsSectionType {
}
#[derive(Debug, thiserror::Error)]
+#[non_exhaustive]
pub enum LiteralsSectionParse... | 13 | 22 | 3 |
f5dea611078cbd8c91eaf361c6d2478af6b81110 | Rahul Butani | 2022-07-02T21:26:48 | fix a typo | diff --git a/src/fse/fse_decoder.rs b/src/fse/fse_decoder.rs
index fcbfbb0..e304993 100644
--- a/src/fse/fse_decoder.rs
+++ b/src/fse/fse_decoder.rs
@@ -6,7 +6,7 @@ pub struct FSETable {
pub decode: Vec<Entry>, //used to decode symbols, and calculate the next state
pub accuracy_log: u8,
- pub symbol_prob... | 1 | 18 | 18 |
0f03b26d44767787d45ca12477781694db6858ba | Rahul Butani | 2022-07-02T16:53:07 | fix some typos | diff --git a/src/decoding/block_decoder.rs b/src/decoding/block_decoder.rs
index 2650b09..eea911a 100644
--- a/src/decoding/block_decoder.rs
+++ b/src/decoding/block_decoder.rs
@@ -18,7 +18,7 @@ enum DecoderState {
ReadyToDecodeNextHeader,
ReadyToDecodeNextBody,
#[allow(dead_code)]
- Failed, //TODO pu... | 3 | 5 | 5 |
ebe150630b1d750dfc18c6dd3434c51fa594b5ce | Moritz Borcherding | 2022-06-25T08:31:39 | optimize fse status updates by eliminating multiple vector accesses | diff --git a/src/fse/fse_decoder.rs b/src/fse/fse_decoder.rs
index 83cb568..067ff07 100644
--- a/src/fse/fse_decoder.rs
+++ b/src/fse/fse_decoder.rs
@@ -17,13 +17,13 @@ impl Default for FSETable {
}
pub struct FSEDecoder<'table> {
- pub state: usize,
+ pub state: Entry,
table: &'table FSETable,
}
#[d... | 1 | 19 | 13 |
848b028c83b28e6d0f971e4bceb270ea36526351 | Moritz Borcherding | 2022-06-21T21:42:47 | better signature for byte_idx | diff --git a/src/decoding/bit_reader_reverse.rs b/src/decoding/bit_reader_reverse.rs
index 9e33e9d..7fa95f2 100644
--- a/src/decoding/bit_reader_reverse.rs
+++ b/src/decoding/bit_reader_reverse.rs
@@ -26,7 +26,7 @@ impl<'s> BitReaderReversed<'s> {
/// We refill the container in full bytes, shifting the still unrea... | 1 | 19 | 11 |
0155b302e991d124c18ae413a40b385b024d9823 | Moritz Borcherding | 2022-06-21T21:28:31 | tell the compiler which part of get_bits_triple is cold | diff --git a/src/decoding/bit_reader_reverse.rs b/src/decoding/bit_reader_reverse.rs
index 838159e..9e33e9d 100644
--- a/src/decoding/bit_reader_reverse.rs
+++ b/src/decoding/bit_reader_reverse.rs
@@ -144,6 +144,7 @@ impl<'s> BitReaderReversed<'s> {
Ok(self.get_bits_unchecked(n))
}
+ #[inline(always)... | 1 | 6 | 0 |
8a441927914346d21a1a974be6fafad3c17e7509 | Moritz Borcherding | 2022-06-21T21:24:18 | tell the compiler which part of get_bits is cold | diff --git a/src/decoding/bit_reader_reverse.rs b/src/decoding/bit_reader_reverse.rs
index d1dd0a8..838159e 100644
--- a/src/decoding/bit_reader_reverse.rs
+++ b/src/decoding/bit_reader_reverse.rs
@@ -99,6 +99,7 @@ impl<'s> BitReaderReversed<'s> {
(self.idx as usize - 1) / 8
}
+ #[inline(always)]
... | 1 | 7 | 0 |
d5a60c97d89e7ebdfedaa974c3598bbf578214ce | Moritz Borcherding | 2022-06-21T21:10:50 | tell the compiler which of the refill paths is the hot one | diff --git a/src/decoding/bit_reader_reverse.rs b/src/decoding/bit_reader_reverse.rs
index de3ee63..d1dd0a8 100644
--- a/src/decoding/bit_reader_reverse.rs
+++ b/src/decoding/bit_reader_reverse.rs
@@ -24,6 +24,7 @@ impl<'s> BitReaderReversed<'s> {
}
/// We refill the container in full bytes, shifting the st... | 1 | 54 | 45 |
bed4e119b14f6a1c4236a0f2db31c6248269b36f | Moritz Borcherding | 2022-06-21T20:47:00 | add fast paths for get_bits, for when the container just has enough bits already | diff --git a/src/decoding/bit_reader_reverse.rs b/src/decoding/bit_reader_reverse.rs
index 5cb3d82..de3ee63 100644
--- a/src/decoding/bit_reader_reverse.rs
+++ b/src/decoding/bit_reader_reverse.rs
@@ -94,6 +94,9 @@ impl<'s> BitReaderReversed<'s> {
if n == 0 {
return Ok(0);
}
+ if s... | 1 | 24 | 1 |
15eb4ef8b73adc666a555d736a23c06a03713c63 | Moritz Borcherding | 2022-06-21T20:31:28 | prevent overflow when adding amounts of bits for triple read | diff --git a/src/decoding/bit_reader_reverse.rs b/src/decoding/bit_reader_reverse.rs
index 79de8fc..5cb3d82 100644
--- a/src/decoding/bit_reader_reverse.rs
+++ b/src/decoding/bit_reader_reverse.rs
@@ -126,7 +126,7 @@ impl<'s> BitReaderReversed<'s> {
}
pub fn get_bits_triple(&mut self, n1: u8, n2: u8, n3: u8... | 1 | 2 | 1 |
1bd57da1bd5bafbf818c07ee05637d9e7f20594c | Moritz Borcherding | 2022-06-21T20:27:08 | Optimize reversed bitreader refilling further | diff --git a/src/decoding/bit_reader_reverse.rs b/src/decoding/bit_reader_reverse.rs
index 666e15d..79de8fc 100644
--- a/src/decoding/bit_reader_reverse.rs
+++ b/src/decoding/bit_reader_reverse.rs
@@ -23,43 +23,66 @@ impl<'s> BitReaderReversed<'s> {
}
}
+ /// We refill the container in full bytes, sh... | 1 | 58 | 35 |
ef9805dd133bb9d8bbb03e13a66285d24702903f | Moritz Borcherding | 2022-06-21T20:04:56 | Fix bench compilation | diff --git a/benches/reversedbitreader_bench.rs b/benches/reversedbitreader_bench.rs
index 7f8e3c5..89b01e1 100644
--- a/benches/reversedbitreader_bench.rs
+++ b/benches/reversedbitreader_bench.rs
@@ -2,7 +2,7 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion};
use rand::Rng;
use ruzstd::decodi... | 1 | 1 | 1 |
19774a06055d3bef1dcf83833e0a66867fb2e987 | Paolo Barbolini | 2022-06-11T21:36:13 | ringbuffer: replace *mut u8 with NonNull<u8> | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index de74268..0a437c6 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -1,7 +1,7 @@
-use std::{alloc::Layout, ptr::slice_from_raw_parts};
+use std::{alloc::Layout, ptr::NonNull, slice};
pub struct RingBuffer {
- buf: ... | 1 | 34 | 30 |
7eff233425f20c2e1d60e3c7c20a5f6fc684da78 | Moritz Borcherding | 2022-06-04T11:31:50 | Bitreader can now fetch 3 values at once, for a small but measurable performance boost | diff --git a/src/decoding/bit_reader_reverse.rs b/src/decoding/bit_reader_reverse.rs
index 32a7e0c..666e15d 100644
--- a/src/decoding/bit_reader_reverse.rs
+++ b/src/decoding/bit_reader_reverse.rs
@@ -25,39 +25,35 @@ impl<'s> BitReaderReversed<'s> {
fn refill_container(&mut self) {
let want_to_read = 64... | 4 | 87 | 43 |
c2ab3e3d365d67f1c0bc52c67ae5bd6b8536b77c | Moritz Borcherding | 2022-06-03T16:45:35 | Fix bug in ringbuffer and add test for it. Also extend fuzzing | diff --git a/fuzz/fuzz_targets/interop.rs b/fuzz/fuzz_targets/interop.rs
index 6f0180f..83afb13 100644
--- a/fuzz/fuzz_targets/interop.rs
+++ b/fuzz/fuzz_targets/interop.rs
@@ -1,5 +1,6 @@
#![no_main]
-#[macro_use] extern crate libfuzzer_sys;
+#[macro_use]
+extern crate libfuzzer_sys;
extern crate ruzstd;
use std::i... | 2 | 53 | 8 |
b0eafa5ef87492f145792282c7a58e4e01f4340c | Moritz Borcherding | 2022-06-02T19:44:30 | Add a free() function to the ringbuffer and add more tests for specific edgecases | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index ad53b16..5de25c9 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -22,6 +22,11 @@ impl RingBuffer {
x + y
}
+ pub fn free(&self) -> usize {
+ let (x, y) = self.free_slice_lengths();
+ (... | 1 | 146 | 57 |
43b52aa136a0bcb20d337fca2132ca383f39a820 | Moritz Borcherding | 2022-06-01T16:39:50 | Add test for writers that return errors that can be recovered from | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 0347c7b..82dea97 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -334,4 +334,82 @@ mod tests {
decode_buf.drain_to_writer(&mut short_writer).unwrap();
assert_eq!(short_writer.buf.len(), repea... | 1 | 78 | 0 |
5a30b2655f3f92fe041b8795e916c42727e81e19 | Moritz Borcherding | 2022-05-27T16:31:54 | Add test for short writes being handled correctly by the decode buffer | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 44f45ec..0347c7b 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -282,3 +282,56 @@ fn write_all_bytes(mut sink: impl io::Write, buf: &[u8]) -> (usize, io::Result<(
}
(written, Ok(()))
}
+
+#[cfg(tes... | 1 | 53 | 0 |
54426b049fac90aec3e3724d918cb394d6f48854 | Moritz Borcherding | 2022-05-27T15:00:38 | cargo fmt | diff --git a/src/decoding/mod.rs b/src/decoding/mod.rs
index f8f2db6..b89df35 100644
--- a/src/decoding/mod.rs
+++ b/src/decoding/mod.rs
@@ -4,8 +4,8 @@ pub mod block_decoder;
pub mod decodebuffer;
pub mod dictionary;
pub mod literals_section_decoder;
+mod ringbuffer;
#[allow(dead_code)]
pub mod scratch;
pub mod ... | 2 | 3 | 2 |
77c87498aa85035f0605f7f32544597c1e1a0d6b | Moritz Borcherding | 2022-05-27T14:59:38 | Add todo for possible further opmtimization | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index c13699f..152ff3b 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -107,6 +107,8 @@ impl Decodebuffer {
// We have at max offset bytes in one chunk, the last one can be smaller
... | 1 | 2 | 0 |
fa02b60c2ad5476ef2b0c7ccd9204fd40c95fdb2 | Moritz Borcherding | 2022-05-27T14:49:55 | Only alloc if expect fails | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index b92f85f..2c2a746 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -56,7 +56,7 @@ impl RingBuffer {
debug_assert!(usize::BITS >= 64 || new_cap < isize::MAX as usize);
}
- let new_layout = ... | 1 | 1 | 1 |
864aa204a840fe69a3d16548db8ea409fd16bc92 | Moritz Borcherding | 2022-05-27T14:48:04 | Narrow down unsafe regions and rename "drain" | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 14a29de..c13699f 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -229,7 +229,7 @@ impl Decodebuffer {
impl<'a> Drop for DrainGuard<'a> {
fn drop(&mut self) {
if self.amou... | 2 | 30 | 19 |
435e8c3141467aaf18dc98931ae0c96eeac51af3 | Moritz Borcherding | 2022-05-27T14:29:29 | Fix clippy lints and make panics have more expressive messages | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index 73715d5..f7fdfee 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -53,14 +53,17 @@ impl RingBuffer {
// Check that the capacity isn't bigger than isize::MAX, which is the max allowed by LLVM, or that
... | 1 | 16 | 13 |
bb3af4dc19dfda394491b17bda28c04b7301790f | Moritz Borcherding | 2022-05-27T14:10:21 | Fix bug in write_all impl | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 40e0937..14a29de 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -273,7 +273,7 @@ impl Decodebuffer {
fn write_all_bytes(mut sink: impl io::Write, buf: &[u8]) -> (usize, io::Result<()>) {
let mut written... | 1 | 1 | 1 |
6798725b373b5e35ba9556942f8a494f28784bc8 | Simon Gardling | 2022-05-05T14:14:25 | fix rng.gen_range | diff --git a/benches/reversedbitreader_bench.rs b/benches/reversedbitreader_bench.rs
index 29b2734..7f8e3c5 100644
--- a/benches/reversedbitreader_bench.rs
+++ b/benches/reversedbitreader_bench.rs
@@ -21,7 +21,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let mut access_vec = vec![];
let mut br = BitReader... | 1 | 1 | 1 |
6a5a3afe1b3bdb09df38f81d544d023ad641673d | Simon Gardling | 2022-04-25T21:58:14 | Update Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index 95186dc..78e8e6a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,8 +11,8 @@ exclude = ["decodecorpus_files/*", "dict_tests/*", "fuzz_decodecorpus/*"]
readme = "Readme.md"
[dependencies]
-byteorder = "1.4.3"
-twox-hash = { version = "1.6.2", default-features = false }
+byte... | 1 | 2 | 2 |
a31e680c25def90e6c50013802404fca046fa6c2 | Simon Gardling | 2022-04-25T13:31:17 | update dependencies | diff --git a/Cargo.toml b/Cargo.toml
index ce13a9a..95186dc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,13 +11,13 @@ exclude = ["decodecorpus_files/*", "dict_tests/*", "fuzz_decodecorpus/*"]
readme = "Readme.md"
[dependencies]
-byteorder = "1.3.4"
-twox-hash = { version = "1.6.0", default-features = false }
+by... | 1 | 4 | 4 |
30e65d726f934dbb3641ad0f9c096384f5823f63 | Moritz Borcherding | 2022-04-14T18:24:53 | easier switching extend_from_within impl | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index 9085350..73715d5 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -194,6 +194,7 @@ impl RingBuffer {
/// SAFETY:
/// Needs start + len <= self.len()
+ /// And more then len reserved space
#[warn(uns... | 1 | 5 | 7 |
2efd724d73d3b1c268d25fb6a69f446f93ccd4df | Moritz Borcherding | 2022-04-14T17:49:22 | convert check + panic to debug_assert and min call | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index cc55c0c..9085350 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -121,9 +121,8 @@ impl RingBuffer {
}
pub fn drain(&mut self, amount: usize) {
- if amount > self.len() {
- panic!("Thats i... | 1 | 2 | 3 |
ad7c01bea96629d19138ec4371c9dd2549c8f777 | Moritz Borcherding | 2022-04-14T17:41:52 | more checks against 0 length copies | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index b67eeb1..cc55c0c 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -110,8 +110,12 @@ impl RingBuffer {
debug_assert!(in_f1 + in_f2 == len);
unsafe {
- f1_ptr.copy_from_nonoverlapping(ptr, ... | 1 | 8 | 7 |
7929328c22159735f6d6e19833139939572ab172 | Moritz Borcherding | 2022-04-14T17:25:38 | fix ringbuffer smoke test | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index e5a7e9a..b67eeb1 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -1,7 +1,5 @@
use std::{alloc::Layout, ptr::slice_from_raw_parts};
-const MIN_CAPACITY: usize = 1024;
-
pub struct RingBuffer {
buf: *mut u8,
... | 1 | 35 | 46 |
c020b01945710aa8390ac2b7a06d1bac4da8b622 | Moritz Borcherding | 2022-04-14T17:13:13 | Since we check all preconditions in DecodeBuffer::repeate there is no
need to do that again in RingBuffer | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 55d7fe9..40e0937 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -97,25 +97,36 @@ impl Decodebuffer {
));
}
} else {
- let start_idx = self.buffer.len() - offs... | 2 | 30 | 9 |
1e874f7af7e1a72d310a8dfb269202e4af575e3d | Moritz Borcherding | 2022-04-14T16:57:51 | fix branchy extend_from_within | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index 62fdc8e..1b37c63 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -198,9 +198,9 @@ impl RingBuffer {
unsafe {
self.buf
.add(self.tail)
- .copy_to_no... | 1 | 6 | 6 |
3262aaca1db28edcb82aa341b5def043d5673883 | Moritz Borcherding | 2022-04-13T19:33:37 | implement branching extend from within just as a comparison | diff --git a/src/bin/zstd_stream.rs b/src/bin/zstd_stream.rs
index 3c6ebd7..cb2ebc7 100644
--- a/src/bin/zstd_stream.rs
+++ b/src/bin/zstd_stream.rs
@@ -33,7 +33,7 @@ fn main() {
let mut decoder = ruzstd::StreamingDecoder::new(&mut buf_read).unwrap();
let mut buf = [0u8; 1024 * 1024];
let mut... | 2 | 66 | 8 |
fd776932bddd7471394e0cb8c426a2842d386070 | Paolo Barbolini | 2022-04-13T06:31:24 | impl Drop | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index e6371ff..148461a 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -56,7 +56,7 @@ impl RingBuffer {
let new_cap = usize::max(min_cap * 2, (self.cap + amount + 1).next_power_of_two());
// Check that t... | 1 | 16 | 1 |
397284307bb25d71f9b86746b5ac103b4ce1d322 | Paolo Barbolini | 2022-04-13T06:27:29 | Protect ourselves from big allocations | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index 132462b..92e9150 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -54,6 +54,11 @@ impl RingBuffer {
// TODO make this the next biggest 2^x?
let min_cap = usize::max(self.cap, MIN_CAPACITY / 2);
... | 1 | 5 | 0 |
af4098b6ca69c54215e2cdc9cc8459585033f4b5 | Paolo Barbolini | 2022-04-13T06:17:19 | Remove extra check | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index 4bb38ae..132462b 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -57,20 +57,18 @@ impl RingBuffer {
let new_layout = Layout::array::<u8>(new_cap).unwrap();
let new_buf = unsafe { std::alloc::alloc(ne... | 1 | 10 | 12 |
cad85ca6246dabdfd50007eae831f3a7e53c8ecf | Paolo Barbolini | 2022-04-13T06:16:41 | Remove Layout from RingBuffer | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index dfccc40..4bb38ae 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -4,7 +4,6 @@ const MIN_CAPACITY: usize = 1024;
pub struct RingBuffer {
buf: *mut u8,
- layout: Layout,
cap: usize,
head: usize,
... | 1 | 4 | 4 |
b5bafcf6b03c7ce446042ba038852c1bd272e529 | Paolo Barbolini | 2022-04-13T06:05:24 | Add debug assertion | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index 8565b62..dfccc40 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -48,6 +48,8 @@ impl RingBuffer {
#[inline(never)]
#[cold]
unsafe fn reserve_amortized(&mut self, amount: usize) {
+ debug_assert!(... | 1 | 2 | 0 |
1b878368c2c70219e0cb59708bc82f7235346bf9 | Paolo Barbolini | 2022-04-13T06:00:08 | Allocate bigger capacities | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index cc2c499..8565b62 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -1,5 +1,7 @@
use std::{alloc::Layout, ptr::slice_from_raw_parts};
+const MIN_CAPACITY: usize = 1024;
+
pub struct RingBuffer {
buf: *mut u8,
... | 1 | 4 | 1 |
0ec7138db5eaf3d181ceb739b6fd31995519ae55 | Paolo Barbolini | 2022-04-13T05:56:47 | #[inline(never)] #[cold] the actual reserve operation | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index 0b0fd78..cc2c499 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -38,6 +38,14 @@ impl RingBuffer {
return;
}
+ unsafe {
+ self.reserve_amortized(amount);
+ }
+ }
+
+... | 1 | 10 | 2 |
d9733c197c999eefe82f37b84f9d00a26b96334b | Moritz Borcherding | 2022-04-12T18:53:29 | Can implement the byte by byte copy with extend_from_within too | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index f345155..55d7fe9 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -98,14 +98,20 @@ impl Decodebuffer {
}
} else {
let start_idx = self.buffer.len() - offset;
+ let ... | 1 | 12 | 6 |
9621d8989461bed56cd927b9f25d5abde5d93254 | Moritz Borcherding | 2022-04-12T18:12:32 | another bug with get | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 1493516..f345155 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -99,9 +99,8 @@ impl Decodebuffer {
} else {
let start_idx = self.buffer.len() - offset;
- self.buffer.reserve... | 2 | 95 | 98 |
bd58c7be1a9b2b5a94662c3c6dc1807c4e4bcc2b | Moritz Borcherding | 2022-04-12T17:43:07 | Dont look at this too hard. Yes it took me long time to find this bug.
Yes it is stupid. | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index 8e60a7c..fba17ac 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -68,7 +68,7 @@ impl RingBuffer {
pub fn get(&self, idx: usize) -> Option<u8> {
if idx < self.len() {
- Some(unsafe { self.buf... | 1 | 20 | 3 |
7464c879d892538fb2456ba660701c5016f6eeb1 | Moritz Borcherding | 2022-04-11T20:39:23 | inline copy calls and extend calls | diff --git a/src/decoding/ringbuffer.rs b/src/decoding/ringbuffer.rs
index 6dfda5c..8e60a7c 100644
--- a/src/decoding/ringbuffer.rs
+++ b/src/decoding/ringbuffer.rs
@@ -74,6 +74,7 @@ impl RingBuffer {
}
}
+ #[inline(always)]
pub fn extend(&mut self, data: &[u8]) {
let len = data.len();
... | 1 | 6 | 0 |
de6d1c5b4faa5798e480c58aacf116f94e2a798d | Moritz Borcherding | 2022-04-11T20:17:01 | try different strategies to choose the pointer copies | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index ba1a1b1..1493516 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -1,12 +1,12 @@
-use std::collections::VecDeque;
use std::hash::Hasher;
-use std::mem::{self, MaybeUninit};
-use std::{io, ptr, slice};
+use std... | 2 | 192 | 75 |
d225dffbbdf79a24b8fcbe533e94f1ffd72ef357 | Moritz Borcherding | 2022-04-07T22:07:03 | First draft of a Ringbuffer we could use for decoding | diff --git a/src/decoding/mod.rs b/src/decoding/mod.rs
index 8d3d1cf..f8f2db6 100644
--- a/src/decoding/mod.rs
+++ b/src/decoding/mod.rs
@@ -8,3 +8,4 @@ pub mod literals_section_decoder;
pub mod scratch;
pub mod sequence_execution;
pub mod sequence_section_decoder;
+mod ringbuffer;
\ No newline at end of file
diff -... | 2 | 250 | 0 |
5685923e75eb8caf3afdef37b2c47defefb346b1 | Moritz Borcherding | 2022-04-05T20:08:10 | make clippy happy | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 21ac6e6..ba1a1b1 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -263,21 +263,17 @@ impl Decodebuffer {
self.hash.write(&slice1[..written1]);
drain_guard.amount += written1;
- ... | 1 | 8 | 12 |
fbd44de632a0dbe1871ff53b7236924505de9672 | Moritz Borcherding | 2022-04-05T20:00:49 | Even more correctness around drain_to and error handling. I think it now behaves well? I'll see if I can make a testcase for a sink that sometimes errors, like e.g. a nonblocking socket would | diff --git a/src/decoding/block_decoder.rs b/src/decoding/block_decoder.rs
index e8f4ee9..83d0668 100644
--- a/src/decoding/block_decoder.rs
+++ b/src/decoding/block_decoder.rs
@@ -35,7 +35,7 @@ impl BlockDecoder {
&mut self,
header: &BlockHeader,
workspace: &mut DecoderScratch, //reuse this ... | 5 | 70 | 51 |
aa03782d714abeb63dc60399ca69d37d1bd23149 | Paolo Barbolini | 2022-04-04T19:19:40 | Use .min instead of manual implementation | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 3016b3e..045752c 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -17,12 +17,7 @@ pub struct Decodebuffer {
impl io::Read for Decodebuffer {
fn read(&mut self, target: &mut [u8]) -> io::Result<usize> {
... | 1 | 2 | 11 |
e4b2ab848977a1aea2d2a8868d325e881df9684f | Paolo Barbolini | 2022-04-04T14:05:26 | Don't drain more than we were successfully able to write | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 4f450e1..3016b3e 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -248,19 +248,41 @@ impl Decodebuffer {
return Ok(());
}
- let (slice1, slice2) = self.buffer.as_slices();
+ ... | 1 | 24 | 2 |
124fc3638159d53eee8b744847c806951139a327 | Paolo Barbolini | 2022-04-03T14:53:42 | Bring back the equivalent of extend_from_within | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 8ea6510..4f450e1 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -1,6 +1,7 @@
use std::collections::VecDeque;
use std::hash::Hasher;
-use std::{io, mem};
+use std::mem::{self, MaybeUninit};
+use std::{io, pt... | 2 | 47 | 14 |
97d43597a9ba5f2c78abc770c2592b510132cad3 | Paolo Barbolini | 2022-04-03T14:18:37 | Address code review comments around draining | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 102ec31..8ea6510 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -144,7 +144,7 @@ impl Decodebuffer {
match self.can_drain_to_window_size() {
None => None,
Some(can_drain) =>... | 1 | 13 | 13 |
92d89d1dd09080741e17be8d9686450bdf7fa26d | Paolo Barbolini | 2022-04-03T09:45:54 | Replace Vec<u8> with VecDeque<u8> | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 6974b0b..102ec31 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -1,9 +1,11 @@
+use std::collections::VecDeque;
use std::hash::Hasher;
-use std::io;
+use std::{io, mem};
+
use twox_hash::XxHash64;
pub str... | 1 | 48 | 27 |
a348eb4c56d16ab4a47d267618f42b0dc3cbdd20 | Paolo Barbolini | 2022-04-03T09:01:29 | Simplify draining | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 5ddc47a..6974b0b 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -1,4 +1,5 @@
use std::hash::Hasher;
+use std::io;
use twox_hash::XxHash64;
pub struct Decodebuffer {
@@ -11,7 +12,7 @@ pub struct Decodebuf... | 1 | 34 | 27 |
8157cd6aae22dc3884363e649e888195462af145 | Paolo Barbolini | 2022-04-03T08:43:24 | Optimize calls to drain | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 5ef3435..5ddc47a 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -2,7 +2,7 @@ use std::hash::Hasher;
use twox_hash::XxHash64;
pub struct Decodebuffer {
- pub buffer: Vec<u8>,
+ buffer: Vec<u8>,
... | 1 | 13 | 15 |
29845c1339a40965bca66d1d4ec28320595d1b30 | Paolo Barbolini | 2022-04-03T07:41:06 | Fix clippy::manual_bits | diff --git a/src/fse/fse_decoder.rs b/src/fse/fse_decoder.rs
index d129952..d241671 100644
--- a/src/fse/fse_decoder.rs
+++ b/src/fse/fse_decoder.rs
@@ -30,13 +30,9 @@ pub struct Entry {
const ACC_LOG_OFFSET: u8 = 5;
-const fn num_bits<T>() -> usize {
- std::mem::size_of::<T>() * 8
-}
-
fn highest_bit_set(x: u... | 2 | 2 | 10 |
520aebe888962917b4533b1ca3d2e51063d28a8f | Paolo Barbolini | 2022-04-03T07:27:52 | Fix clippy::slow_vector_initialization | diff --git a/src/tests/mod.rs b/src/tests/mod.rs
index d45043d..a50c418 100644
--- a/src/tests/mod.rs
+++ b/src/tests/mod.rs
@@ -59,8 +59,7 @@ fn test_decode_from_to() {
let content: Vec<u8> = f.bytes().map(|x| x.unwrap()).collect();
- let mut target = Vec::with_capacity(1024 * 1024);
- target.resize(102... | 1 | 1 | 2 |
2a9cdc4cd9487b6e1505eeff8202583599b66953 | Paolo Barbolini | 2022-04-03T07:26:29 | Fix and deny clippy::cast_lossless | diff --git a/src/blocks/literals_section.rs b/src/blocks/literals_section.rs
index 4be6df0..e7eaece 100644
--- a/src/blocks/literals_section.rs
+++ b/src/blocks/literals_section.rs
@@ -113,20 +113,21 @@ impl LiteralsSection {
0 | 2 => {
//size_format actually only uses one ... | 10 | 49 | 40 |
c3424c510617a7957a2f58ac6105dee4f5382977 | Paolo Barbolini | 2022-04-03T07:22:41 | Fix clippy::needless_borrow | diff --git a/src/frame.rs b/src/frame.rs
index 4517b3b..ae212e5 100644
--- a/src/frame.rs
+++ b/src/frame.rs
@@ -269,7 +269,7 @@ pub fn read_frame_header(r: &mut dyn Read) -> Result<(Frame, u8), String> {
}
if !frame_header.dict_id.is_empty() {
- match r.read_exact(&mut frame_header.dict_id.as_mut_sl... | 1 | 2 | 2 |
77f0c85cf795e1a64a8855be01c9b875af07e9f1 | Paolo Barbolini | 2022-04-03T07:22:15 | Fix clippy::needless_match | diff --git a/src/frame.rs b/src/frame.rs
index 30079be..4517b3b 100644
--- a/src/frame.rs
+++ b/src/frame.rs
@@ -75,10 +75,7 @@ impl FrameDescriptor {
impl FrameHeader {
pub fn window_size(&self) -> Result<u64, String> {
if self.descriptor.single_segment_flag() {
- match self.frame_content_siz... | 1 | 1 | 4 |
7099817c9f6df6803ada471e60c0b36d40138cb0 | Paolo Barbolini | 2022-04-03T07:21:44 | Fix clippy::needless_late_init | diff --git a/src/decoding/bit_reader.rs b/src/decoding/bit_reader.rs
index f592c24..d795864 100644
--- a/src/decoding/bit_reader.rs
+++ b/src/decoding/bit_reader.rs
@@ -37,13 +37,11 @@ impl<'s> BitReader<'s> {
let old_idx = self.idx;
- let mut value: u64;
-
let bits_left_in_current_byte = 8... | 1 | 1 | 3 |
f604d480c0fcd96903d805a93e532d5da4558577 | Moritz Borcherding | 2021-07-03T06:30:49 | since the last bit of unsafe has been removed, we can use forbid(unsafe_code) | diff --git a/src/lib.rs b/src/lib.rs
index 146b388..139f341 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,5 @@
#![deny(trivial_casts, trivial_numeric_casts, rust_2018_idioms)]
+#![forbid(unsafe_code)]
pub mod blocks;
pub mod decoding; | 1 | 1 | 0 |
32b0a40f0d9385d0231d5ec98edd5ae8a2f01ac8 | Moritz Borcherding | 2021-06-25T11:20:30 | bump version before release | diff --git a/Cargo.toml b/Cargo.toml
index a602721..ce13a9a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ruzstd"
-version = "0.2.3"
+version = "0.2.4"
authors = ["Moritz Borcherding <moritz.borcherding@web.de>"]
edition = "2018"
license = "MIT" | 1 | 1 | 1 |
48156b94ae982a2cb75546428850da1689fd2031 | Moritz Borcherding | 2021-06-25T11:15:21 | satisfy clippy | diff --git a/src/frame_decoder.rs b/src/frame_decoder.rs
index e6e5f4c..1b80b14 100644
--- a/src/frame_decoder.rs
+++ b/src/frame_decoder.rs
@@ -440,7 +440,7 @@ impl FrameDecoder {
};
if !self.is_finished() || self.state.is_none() {
- let mut mt_source = &source[..];
+ let mut ... | 2 | 4 | 6 |
b363bdd5278c59fa937c4d2abfcd3d6da8a78874 | Moritz Borcherding | 2021-06-25T11:05:28 | bump version because the required rust version has changed to 1.53 | diff --git a/Cargo.toml b/Cargo.toml
index a109753..a602721 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ruzstd"
-version = "0.2.2"
+version = "0.2.3"
authors = ["Moritz Borcherding <moritz.borcherding@web.de>"]
edition = "2018"
license = "MIT" | 1 | 1 | 1 |
e4dc7715d1c06dadd35dbbe181c6076ee7879dfb | Moritz Borcherding | 2021-06-25T11:04:24 | remove last unsafe usage by taking advantage of Vec::extend_from_within | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 3443922..5ef3435 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -101,43 +101,19 @@ impl Decodebuffer {
}
} else {
let start_idx = self.buffer.len() - offset;
- se... | 1 | 5 | 29 |
259394c0022db651560a60744374a92fac185047 | Moritz Borcherding | 2020-12-21T15:24:57 | fix last few clippy warnings | diff --git a/src/block/block.rs b/src/blocks/block.rs
similarity index 100%
rename from src/block/block.rs
rename to src/blocks/block.rs
diff --git a/src/block/literals_section.rs b/src/blocks/literals_section.rs
similarity index 98%
rename from src/block/literals_section.rs
rename to src/blocks/literals_section.rs
ind... | 9 | 24 | 12 |
5c7ad041d278d75cecf7b870b0c864a53c4fb447 | Moritz Borcherding | 2020-12-21T15:18:44 | cargo fmt | diff --git a/src/bin/zstd_stream.rs b/src/bin/zstd_stream.rs
index 00af000..3c6ebd7 100644
--- a/src/bin/zstd_stream.rs
+++ b/src/bin/zstd_stream.rs
@@ -2,7 +2,6 @@ extern crate ruzstd;
use std::fs::File;
use std::io::{Read, Write};
-
fn main() {
let mut file_paths: Vec<_> = std::env::args().filter(|f| !f.sta... | 4 | 21 | 17 |
9f967d75157916d5fa2e5adb6b0273cc2b1052a3 | Paolo Barbolini | 2020-12-19T14:29:10 | clippy: fix warnings | diff --git a/benches/reversedbitreader_bench.rs b/benches/reversedbitreader_bench.rs
index 1dafd15..29b2734 100644
--- a/benches/reversedbitreader_bench.rs
+++ b/benches/reversedbitreader_bench.rs
@@ -1,5 +1,4 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
-use rand::rngs::ThreadRng;
use r... | 20 | 57 | 75 |
84053d8c80c913a6d2f40367a99ff612f6dca79b | Paolo Barbolini | 2020-12-17T13:02:57 | Allocate a new Vec instead of cloning it and clearing it | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 3c57918..9993213 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -196,7 +196,9 @@ impl Decodebuffer {
//drain the buffer completely
pub fn drain(&mut self) -> Vec<u8> {
self.hash.write(&self... | 1 | 3 | 1 |
92db9c3a8f11758ccf3329025517c9936a96c033 | Paolo Barbolini | 2020-12-16T19:17:04 | Replace read_little_endian_{u32,u64} with std implementation | diff --git a/src/decoding/dictionary.rs b/src/decoding/dictionary.rs
index 464ffe4..6ae6f80 100644
--- a/src/decoding/dictionary.rs
+++ b/src/decoding/dictionary.rs
@@ -1,3 +1,5 @@
+use std::convert::TryInto;
+
use crate::decoding::scratch::FSEScratch;
use crate::decoding::scratch::HuffmanScratch;
@@ -26,8 +28,8 @@... | 5 | 25 | 47 |
059644e5eeb6c5656f8574401c04d4d76a29e959 | Paolo Barbolini | 2020-12-16T19:15:53 | Avoid allocating two Vec<u8> just to compare slices | diff --git a/src/decoding/dictionary.rs b/src/decoding/dictionary.rs
index 1b773cc..464ffe4 100644
--- a/src/decoding/dictionary.rs
+++ b/src/decoding/dictionary.rs
@@ -20,9 +20,9 @@ impl Dictionary {
dict_content: Vec::new(),
offset_hist: [2, 4, 8],
};
- let magic_num = Vec::f... | 1 | 2 | 2 |
d1e1017d0bfbce081d0c4d620562add25f9e14de | Paolo Barbolini | 2020-12-16T19:15:07 | Write everything at once instead of doing byte by byte in a loop | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index a0d31e0..3c57918 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -204,11 +204,8 @@ impl Decodebuffer {
sink: &mut dyn std::io::Write,
) -> Result<usize, std::io::Error> {
self.hash.write... | 1 | 2 | 5 |
095c070c332a767dc08b1bdf6813269035d2b4ab | Paolo Barbolini | 2020-12-16T19:14:40 | Avoid cloning Vec<u8> just to clear it afterwards | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index 5767c6f..a0d31e0 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -196,9 +196,7 @@ impl Decodebuffer {
//drain the buffer completely
pub fn drain(&mut self) -> Vec<u8> {
self.hash.write(&self... | 1 | 1 | 3 |
4aba526be6a25dfb6d10c18290786324021ef9cd | Paolo Barbolini | 2020-12-16T19:13:51 | Use copy_from_slice instead of read_exact when dealing with memory | diff --git a/src/decoding/decodebuffer.rs b/src/decoding/decodebuffer.rs
index c133517..5767c6f 100644
--- a/src/decoding/decodebuffer.rs
+++ b/src/decoding/decodebuffer.rs
@@ -28,8 +28,7 @@ impl std::io::Read for Decodebuffer {
}
self.hash.write(&self.buffer[0..amount]);
- let mut buffer_sli... | 1 | 2 | 5 |
0c4f3d6e1ea33b51524be7f337541855e22caca0 | Moritz Borcherding | 2020-11-05T08:27:32 | set a version number for test dep rand | diff --git a/Cargo.toml b/Cargo.toml
index 441e476..a109753 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,7 @@ twox-hash = { version = "1.6.0", default-features = false }
[dev-dependencies]
criterion = "0.3"
-rand = "*"
+rand = "0.7.3"
[[bench]]
name = "reversedbitreader_bench" | 1 | 1 | 1 |
2d19253c77a6860de1111952c0f937b4bbfaff64 | Moritz Borcherding | 2020-11-05T08:23:27 | update dependencies | diff --git a/Cargo.toml b/Cargo.toml
index 672223c..441e476 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,8 +11,8 @@ exclude = ["decodecorpus_files/*", "dict_tests/*", "fuzz_decodecorpus/*"]
readme = "Readme.md"
[dependencies]
-byteorder = "1.3.2"
-twox-hash = { version = "1.5.0", default-features = false }
+byte... | 1 | 2 | 2 |
432781b5fb99d90dca8c0db673d18babd6d8beda | Moritz Borcherding | 2020-11-05T08:14:27 | bump minor version number after removing some feature-flags from two-xhash | diff --git a/Cargo.toml b/Cargo.toml
index 4ac4b5f..672223c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ruzstd"
-version = "0.2.1"
+version = "0.2.2"
authors = ["Moritz Borcherding <moritz.borcherding@web.de>"]
edition = "2018"
license = "MIT" | 1 | 1 | 1 |
b093adefe3eaf19c89679d595f310d553b8931fa | Moritz Borcherding | 2020-05-26T17:47:42 | added a benchmark for the reversed bitreader to guide optimizations | diff --git a/Cargo.toml b/Cargo.toml
index 807e08b..4ac4b5f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,3 +13,11 @@ readme = "Readme.md"
[dependencies]
byteorder = "1.3.2"
twox-hash = { version = "1.5.0", default-features = false }
+
+[dev-dependencies]
+criterion = "0.3"
+rand = "*"
+
+[[bench]]
+name = "revers... | 2 | 47 | 0 |
0be5ea951131925098fee2957b933d0c4c676c39 | Sergey "Shnatsel" Davidoff | 2020-04-19T15:42:39 | Add the actual fuzz target for decoding; forgot to do it earlier | diff --git a/fuzz/fuzz_targets/decode.rs b/fuzz/fuzz_targets/decode.rs
new file mode 100644
index 0000000..ab38137
--- /dev/null
+++ b/fuzz/fuzz_targets/decode.rs
@@ -0,0 +1,16 @@
+#![no_main]
+#[macro_use] extern crate libfuzzer_sys;
+extern crate ruzstd;
+use ruzstd::frame_decoder;
+
+fuzz_target!(|data: &[u8]| {
+ ... | 1 | 16 | 0 |
0f9bd7380a4e3f87b8f85d2a3f7056173bcbd315 | Sergey "Shnatsel" Davidoff | 2020-04-19T15:42:14 | make interop fuzz target fail if encoding fails; if it cannot encode data that means the fuzz target is broken | diff --git a/fuzz/fuzz_targets/interop.rs b/fuzz/fuzz_targets/interop.rs
index b69818b..6f0180f 100644
--- a/fuzz/fuzz_targets/interop.rs
+++ b/fuzz/fuzz_targets/interop.rs
@@ -15,8 +15,7 @@ fn encode_zstd(data: &[u8]) -> Result<Vec<u8>, std::io::Error> {
}
fuzz_target!(|data: &[u8]| {
- if let Ok(compressed) = ... | 1 | 3 | 4 |
04a7a02f600c3c2e7f0f5722d764ec7c921dacf6 | Sergey "Shnatsel" Davidoff | 2020-04-19T02:48:52 | Add a fuzzing target to verify that we can decompress any data compressed by the reference implementation | diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml
index 77504df..4eb5983 100644
--- a/fuzz/Cargo.toml
+++ b/fuzz/Cargo.toml
@@ -8,6 +8,9 @@ publish = false
[package.metadata]
cargo-fuzz = true
+[dependencies]
+zstd = "0.5.1+zstd.1.4.4"
+
[dependencies.ruzstd]
path = ".."
[dependencies.libfuzzer-sys]
@@ -20,3 +23,7 ... | 2 | 29 | 0 |
d6203be6eef9bf89d613ee334ab78878cdb2dc20 | Sergey "Shnatsel" Davidoff | 2020-04-17T01:22:31 | Disable unused `rand` feature in twox-hash crate. Stops pulling in `rand` and `libc` dependencies | diff --git a/Cargo.toml b/Cargo.toml
index 813cf65..807e08b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,4 +12,4 @@ readme = "Readme.md"
[dependencies]
byteorder = "1.3.2"
-twox-hash = "1.5.0"
\ No newline at end of file
+twox-hash = { version = "1.5.0", default-features = false } | 1 | 1 | 1 |
7ec9562f2e1d121fd4114ad6f93305806207a62c | Moritz Borcherding | 2019-11-24T17:59:55 | bump version number | diff --git a/Cargo.toml b/Cargo.toml
index 1dfa61a..813cf65 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ruzstd"
-version = "0.2.0"
+version = "0.2.1"
authors = ["Moritz Borcherding <moritz.borcherding@web.de>"]
edition = "2018"
license = "MIT" | 1 | 1 | 1 |
873445131d08281bbfac6a341108383c9d3b8d83 | Moritz Borcherding | 2019-11-24T17:20:40 | ran cargo fmt | diff --git a/src/bin/zstd.rs b/src/bin/zstd.rs
index 186b67f..69cb13c 100644
--- a/src/bin/zstd.rs
+++ b/src/bin/zstd.rs
@@ -49,10 +49,7 @@ fn main() {
while !frame_dec.is_finished() {
frame_dec
- .decode_blocks(
- &mut f,
- ruzstd::BlockDecod... | 8 | 117 | 82 |
17f8cd1a7d39c54b7a6fb41e98f854d6769c968b | Moritz Borcherding | 2019-11-24T17:09:46 | added doc for the FrameDecoder itself so it shows up at the top of the doc page for it | diff --git a/src/frame_decoder.rs b/src/frame_decoder.rs
index 4f2226d..633acd3 100644
--- a/src/frame_decoder.rs
+++ b/src/frame_decoder.rs
@@ -6,6 +6,40 @@ use std::collections::HashMap;
use std::hash::Hasher;
use std::io::Read;
+/// This implements a decoder for zstd frames. This decoder is able to decode frames... | 1 | 34 | 0 |
31942f06b4718af07927f3f33eb6f2eb15780947 | Moritz Borcherding | 2019-11-24T16:53:19 | added doc and made the underlying FrameDecoder pub so that all the status functions can still be used | diff --git a/src/streaming_decoder.rs b/src/streaming_decoder.rs
index 2eb6ad4..07dfd33 100644
--- a/src/streaming_decoder.rs
+++ b/src/streaming_decoder.rs
@@ -1,8 +1,13 @@
use crate::frame_decoder::{FrameDecoder, BlockDecodingStrategy};
use std::io::{Read};
+/// High level decoder that implements a io::Read that ... | 1 | 6 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.