Skip to content

Commit

Permalink
Reorder a few arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanUkhov committed Feb 28, 2025
1 parent d6cba8c commit 184ce9b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Options for WOFF:
--minor-version <number> — set the minor version (0 by default)
Options for WOFF2:
--quality <number> — set the compression quality (8 by default)
--metadata <string> — append metadata (empty by default)
--quality <number> — set the compression quality (8 by default)
--no-transform — disallow transforms
```

Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ fn main() {
(_, Some("woff2")) => {
data = woff::version2::compress(
&data,
options.get::<usize>("quality").unwrap_or(8),
options.get::<String>("metadata").unwrap_or_default(),
options.get::<usize>("quality").unwrap_or(8),
options.get::<bool>("transform").unwrap_or(true),
)
.expect("failed to compress");
Expand All @@ -65,8 +65,8 @@ Options for WOFF:
--minor-version <number> — set the minor version (0 by default)
Options for WOFF2:
--quality <number> — set the compression quality (8 by default)
--metadata <string> — append metadata (empty by default)
--quality <number> — set the compression quality (8 by default)
--no-transform — disallow transforms"#
);
std::process::exit(1);
Expand Down
8 changes: 4 additions & 4 deletions src/version2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
mod ffi;

/// Compress.
pub fn compress<T>(data: &[u8], quality: usize, metadata: T, transform: bool) -> Option<Vec<u8>>
pub fn compress<T>(data: &[u8], metadata: T, quality: usize, transform: bool) -> Option<Vec<u8>>
where
T: Into<Vec<u8>>,
{
Expand Down Expand Up @@ -67,8 +67,8 @@ pub fn decompress(data: &[u8]) -> Option<Vec<u8>> {
mod tests {
use std::fs::{read, write};

const DEFAULT_QUALITY: usize = 8;
const DEFAULT_METADATA: &str = "";
const DEFAULT_QUALITY: usize = 8;
const DEFAULT_TRANSFORM: bool = true;

macro_rules! ok(($result:expr) => ($result.unwrap()));
Expand All @@ -79,8 +79,8 @@ mod tests {
"tests/fixtures/Roboto-Regular.otf.woff2",
ok!(super::compress(
&ok!(read("tests/fixtures/Roboto-Regular.otf")),
DEFAULT_QUALITY,
DEFAULT_METADATA,
DEFAULT_QUALITY,
DEFAULT_TRANSFORM,
)),
));
Expand All @@ -98,8 +98,8 @@ mod tests {
"tests/fixtures/Roboto-Regular.ttf.woff2",
ok!(super::compress(
&ok!(read("tests/fixtures/Roboto-Regular.ttf")),
DEFAULT_QUALITY,
DEFAULT_METADATA,
DEFAULT_QUALITY,
DEFAULT_TRANSFORM,
)),
));
Expand Down

0 comments on commit 184ce9b

Please sign in to comment.