-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dragly/fix-corrupted-range-coding
- Loading branch information
Showing
11 changed files
with
306 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# List of commit statuses that must pass on the merge commit before it is | ||
# pushed to master. | ||
status = [ | ||
"continuous-integration/travis-ci/push", | ||
] | ||
|
||
# If set to true, and if the PR branch is on the same repository that bors-ng | ||
# itself is on, the branch will be deleted. | ||
delete_merged_branches = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
pub mod lzbuffer; | ||
pub mod lzma; | ||
pub mod lzma2; | ||
pub mod options; | ||
pub mod rangecoder; | ||
pub mod util; | ||
pub mod xz; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#[derive(Clone, Copy, Debug, Default)] | ||
pub struct Options { | ||
/// Defines whether the unpacked size should be read from the header or provided. | ||
/// The default is | ||
/// [`UnpackedSize::ReadFromHeader`](enum.UnpackedSize.html#variant.ReadFromHeader) | ||
pub unpacked_size: UnpackedSize, | ||
} | ||
|
||
/// Alternatives for defining the unpacked size of the decoded data | ||
#[derive(Clone, Copy, Debug)] | ||
pub enum UnpackedSize { | ||
/// Assume that the 8 bytes used to specify the unpacked size are present in the header. | ||
/// If the bytes are `0xFFFF_FFFF_FFFF_FFFF`, assume that there is an end-of-payload marker in | ||
/// the file. | ||
/// If not, read the 8 bytes as a little-endian encoded u64. | ||
ReadFromHeader, | ||
/// Assume that there are 8 bytes representing the unpacked size present in the header. | ||
/// Read it, but ignore it and use the provided value instead. | ||
/// If the provided value is `None`, assume that there is an end-of-payload marker in the file. | ||
/// Note that this is a non-standard way of reading LZMA data, | ||
/// but is used by certain libraries such as | ||
/// [OpenCTM](http://openctm.sourceforge.net/). | ||
ReadHeaderButUseProvided(Option<u64>), | ||
/// Assume that the 8 bytes typically used to represent the unpacked size are *not* present in | ||
/// the header. Use the provided value. | ||
/// If the provided value is `None`, assume that there is an end-of-payload marker in the file. | ||
UseProvided(Option<u64>), | ||
} | ||
|
||
impl Default for UnpackedSize { | ||
fn default() -> UnpackedSize { | ||
UnpackedSize::ReadFromHeader | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub mod dumbencoder; | ||
pub mod lzma2; | ||
pub mod options; | ||
mod rangecoder; | ||
mod util; | ||
pub mod xz; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/// Options for the `lzma_compress` function | ||
#[derive(Clone, Copy, Debug, Default)] | ||
pub struct Options { | ||
/// Defines whether the unpacked size should be written to the header. | ||
/// The default is | ||
/// [`UnpackedSize::WriteToHeader(None)`](enum.encode.UnpackedSize.html#variant.WriteValueToHeader) | ||
pub unpacked_size: UnpackedSize, | ||
} | ||
|
||
/// Alternatives for handling unpacked size | ||
#[derive(Clone, Copy, Debug)] | ||
pub enum UnpackedSize { | ||
/// If the value is `Some(u64)`, write the provided u64 value to the header. | ||
/// There is currently no check in place that verifies that this is the actual number of bytes | ||
/// provided by the input stream. | ||
/// If the value is `None`, write the special `0xFFFF_FFFF_FFFF_FFFF` code to the header, | ||
/// indicating that the unpacked size is unknown. | ||
WriteToHeader(Option<u64>), | ||
/// Do not write anything to the header. The unpacked size needs to be stored elsewhere and | ||
/// provided when reading the file. Note that this is a non-standard way of writing LZMA data, | ||
/// but is used by certain libraries such as | ||
/// [OpenCTM](http://openctm.sourceforge.net/). | ||
SkipWritingToHeader, | ||
} | ||
|
||
impl Default for UnpackedSize { | ||
fn default() -> UnpackedSize { | ||
UnpackedSize::WriteToHeader(None) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.