Skip to content

Commit

Permalink
Merge pull request #425 from wcampbell0x2a/remove-std-error-allocation
Browse files Browse the repository at this point in the history
Remove allocation for DekuError into io::Error
  • Loading branch information
wcampbell0x2a authored Jan 16, 2024
2 parents 79f18eb + 0b126f8 commit 5aab3d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### `backhand`
- Enable overflow-checks ([#421](https://github.com/wcampbell0x2a/backhand/pull/421))
- Add feature `gzip-zune-inflate` to add a decompress only option with speed improvements ([#419](https://github.com/wcampbell0x2a/backhand/pull/419))
- Remove allocation for `impl From<BackhandError> for io::Error {` ([#425](https://github.com/wcampbell0x2a/backhand/pull/425))

### `backhand-cli`
- Enable overflow-checks for dist builds ([#421](https://github.com/wcampbell0x2a/backhand/pull/421))
Expand Down
14 changes: 7 additions & 7 deletions backhand/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ impl From<BackhandError> for io::Error {
use BackhandError::*;
match value {
StdIo(io) => io,
Deku(e) => e.into(),
StringUtf8(e) => Self::new(io::ErrorKind::InvalidData, e),
StrUtf8(e) => Self::new(io::ErrorKind::InvalidData, e),
e @ UnsupportedCompression(_) => Self::new(io::ErrorKind::Unsupported, e),
e @ FileNotFound => Self::new(io::ErrorKind::NotFound, e),
e @ (Unreachable
StringUtf8(_) => Self::from(io::ErrorKind::InvalidData),
StrUtf8(_) => Self::from(io::ErrorKind::InvalidData),
UnsupportedCompression(_) => Self::from(io::ErrorKind::Unsupported),
FileNotFound => Self::from(io::ErrorKind::NotFound),
Unreachable
| Deku(_)
| UnexpectedInode(_)
| UnsupportedInode(_)
| CorruptedOrInvalidSquashfs
| InvalidCompressionOption
| InvalidFilePath
| UndefineFileName
| DuplicatedFileName) => Self::new(io::ErrorKind::InvalidData, e),
| DuplicatedFileName => Self::from(io::ErrorKind::InvalidData),
}
}
}

0 comments on commit 5aab3d8

Please sign in to comment.