Merge pull request #564 from iburinoc/doc

Move educational_decoder to doc/ and add doc README
dev
Yann Collet 2017-02-23 16:27:54 -08:00 committed by GitHub
commit 805943ccaa
5 changed files with 23 additions and 3 deletions

20
doc/README.md Normal file
View File

@ -0,0 +1,20 @@
Zstandard Documentation
=======================
This directory contains material defining the Zstandard format,
as well as for help using the `zstd` library.
__`zstd_compression_format.md`__ : This document defines the Zstandard compression format.
Compliant decoders must adhere to this document,
and compliant encoders must generate data that follows it.
__`educational_decoder`__ : This directory contains an implementation of a Zstandard decoder,
compliant with the Zstandard compression format.
It can be used, for example, to better understand the format,
or as the basis for a separate implementation a Zstandard decoder/encoder.
__`zstd_manual.html`__ : Documentation on the functions found in `zstd.h`.
See [http://zstd.net/zstd_manual.html](http://zstd.net/zstd_manual.html) for
the manual released with the latest official `zstd` release.

View File

@ -799,7 +799,7 @@ static size_t decode_literals_simple(istream_t *const in, u8 **const literals,
case 2: case 2:
// "Size_Format uses 1 bit. Regenerated_Size uses 5 bits (0-31)." // "Size_Format uses 1 bit. Regenerated_Size uses 5 bits (0-31)."
IO_rewind_bits(in, 1); IO_rewind_bits(in, 1);
size = IO_read_bits(in, 2); size = IO_read_bits(in, 5);
break; break;
case 1: case 1:
// "Size_Format uses 2 bits. Regenerated_Size uses 12 bits (0-4095)." // "Size_Format uses 2 bits. Regenerated_Size uses 12 bits (0-4095)."
@ -881,7 +881,7 @@ static size_t decode_literals_compressed(frame_context_t *const ctx,
IMPOSSIBLE(); IMPOSSIBLE();
} }
if (regenerated_size > MAX_LITERALS_SIZE || if (regenerated_size > MAX_LITERALS_SIZE ||
compressed_size > regenerated_size) { compressed_size >= regenerated_size) {
CORRUPTION(); CORRUPTION();
} }
@ -1654,7 +1654,7 @@ static inline const u8 *IO_read_bytes(istream_t *const in, size_t len) {
/// Returns a pointer to write `len` bytes to, and advances the internal state /// Returns a pointer to write `len` bytes to, and advances the internal state
static inline u8 *IO_write_bytes(ostream_t *const out, size_t len) { static inline u8 *IO_write_bytes(ostream_t *const out, size_t len) {
if (len > out->len) { if (len > out->len) {
INP_SIZE(); OUT_SIZE();
} }
u8 *const ptr = out->ptr; u8 *const ptr = out->ptr;
out->ptr += len; out->ptr += len;