Skip to content

Commit

Permalink
Fix indent
Browse files Browse the repository at this point in the history
  • Loading branch information
breard-r committed Dec 10, 2023
1 parent d7d6056 commit 086a334
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 39 deletions.
32 changes: 16 additions & 16 deletions src/oath/cbindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ use std::ffi::CStr;
use std::time::SystemTime;

macro_rules! otp_init {
($cfg_type: ty, $cfg: ident, $($field: ident, $value: expr), *) => {
if $cfg.is_null() {
Err(ErrorCode::NullPtr)
} else {
let c: &mut $cfg_type = deref_ptr_mut!($cfg, ErrorCode::NullPtr);
c.key = std::ptr::null();
c.key_len = 0;
c.output_len = crate::oath::DEFAULT_OTP_OUT_LEN;
c.output_base = std::ptr::null();
c.hash_function = crate::oath::DEFAULT_OTP_HASH;
$(
c.$field = $value;
)*
Ok(c)
}
}
($cfg_type: ty, $cfg: ident, $($field: ident, $value: expr), *) => {
if $cfg.is_null() {
Err(ErrorCode::NullPtr)
} else {
let c: &mut $cfg_type = deref_ptr_mut!($cfg, ErrorCode::NullPtr);
c.key = std::ptr::null();
c.key_len = 0;
c.output_len = crate::oath::DEFAULT_OTP_OUT_LEN;
c.output_base = std::ptr::null();
c.hash_function = crate::oath::DEFAULT_OTP_HASH;
$(
c.$field = $value;
)*
Ok(c)
}
}
}

/// [C binding] HOTP configuration storage
Expand Down
22 changes: 11 additions & 11 deletions src/oath/hotp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1334,9 +1334,9 @@ mod tests {
.finalize();

assert_eq!(
uri,
"otpauth://hotp/Provider%201:[email protected]?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Provider+1&counter=0"
);
uri,
"otpauth://hotp/Provider%201:[email protected]?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Provider+1&counter=0"
);
}

#[test]
Expand All @@ -1356,9 +1356,9 @@ mod tests {
.finalize();

assert_eq!(
uri,
"otpauth://hotp/Provider%201:[email protected]?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&counter=0"
);
uri,
"otpauth://hotp/Provider%201:[email protected]?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&counter=0"
);
}

#[test]
Expand All @@ -1373,9 +1373,9 @@ mod tests {
.finalize();

assert_eq!(
uri,
"otpauth://hotp/Provider1Label?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Provider1&counter=0"
);
uri,
"otpauth://hotp/Provider1Label?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Provider1&counter=0"
);
}

#[test]
Expand All @@ -1392,8 +1392,8 @@ mod tests {

assert_eq!(uri.len(), 141);
assert!(uri.starts_with(
"otpauth://hotp/Provider1:[email protected]?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Provider1&counter=0&"
));
"otpauth://hotp/Provider1:[email protected]?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Provider1&counter=0&"
));
assert!(uri.contains("&foo=bar+baz"));
assert!(uri.contains("&foo+2=%C3%A8_%C3%A9"));
}
Expand Down
24 changes: 12 additions & 12 deletions src/oath/totp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -889,9 +889,9 @@ mod tests {
.finalize();

assert_eq!(
uri,
"otpauth://totp/Provider1:[email protected]?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Provider1"
);
uri,
"otpauth://totp/Provider1:[email protected]?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Provider1"
);
}

#[test]
Expand All @@ -905,9 +905,9 @@ mod tests {
.finalize();

assert_eq!(
uri,
"otpauth://totp/%C3%B6_%C3%88%20%E2%80%A6:D%C3%[email protected]?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=%C3%B6_%C3%88+%E2%80%A6"
);
uri,
"otpauth://totp/%C3%B6_%C3%88%20%E2%80%A6:D%C3%[email protected]?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=%C3%B6_%C3%88+%E2%80%A6"
);
}

#[test]
Expand All @@ -922,9 +922,9 @@ mod tests {
.finalize();

assert_eq!(
uri,
"otpauth://totp/Provider1Label?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Provider1"
);
uri,
"otpauth://totp/Provider1Label?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Provider1"
);
}

#[test]
Expand All @@ -939,9 +939,9 @@ mod tests {
.finalize();

assert_eq!(
uri,
"otpauth://totp/Provider1:[email protected]?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Provider1&foo=bar+baz"
);
uri,
"otpauth://totp/Provider1:[email protected]?secret=GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ&issuer=Provider1&foo=bar+baz"
);
}

#[test]
Expand Down

0 comments on commit 086a334

Please sign in to comment.