fix style

This commit is contained in:
Hubert Chathi 2020-09-16 16:14:23 -04:00
parent c45f19f12d
commit c47c6ca399
2 changed files with 17 additions and 6 deletions

View file

@ -129,8 +129,7 @@ struct Account {
); );
/** The number of random bytes needed to generate a fallback key. */ /** The number of random bytes needed to generate a fallback key. */
std::size_t generate_fallback_key_random_length( std::size_t generate_fallback_key_random_length();
);
/** Generates a new fallback key. Returns std::size_t(-1) on error. If the /** Generates a new fallback key. Returns std::size_t(-1) on error. If the
* number of random bytes is too small then last_error will be * number of random bytes is too small then last_error will be

View file

@ -38,11 +38,17 @@ olm::OneTimeKey const * olm::Account::lookup_key(
} }
} }
if (current_fallback_key.published if (current_fallback_key.published
&& olm::array_equal(current_fallback_key.key.public_key.public_key, public_key.public_key)) { && olm::array_equal(
current_fallback_key.key.public_key.public_key, public_key.public_key
)
) {
return &current_fallback_key; return &current_fallback_key;
} }
if (prev_fallback_key.published if (prev_fallback_key.published
&& olm::array_equal(prev_fallback_key.key.public_key.public_key, public_key.public_key)) { && olm::array_equal(
prev_fallback_key.key.public_key.public_key, public_key.public_key
)
) {
return &prev_fallback_key; return &prev_fallback_key;
} }
return 0; return 0;
@ -62,11 +68,17 @@ std::size_t olm::Account::remove_key(
// check if the key is a fallback key, to avoid returning an error, but // check if the key is a fallback key, to avoid returning an error, but
// don't actually remove it // don't actually remove it
if (current_fallback_key.published if (current_fallback_key.published
&& olm::array_equal(current_fallback_key.key.public_key.public_key, public_key.public_key)) { && olm::array_equal(
current_fallback_key.key.public_key.public_key, public_key.public_key
)
) {
return current_fallback_key.id; return current_fallback_key.id;
} }
if (prev_fallback_key.published if (prev_fallback_key.published
&& olm::array_equal(prev_fallback_key.key.public_key.public_key, public_key.public_key)) { && olm::array_equal(
prev_fallback_key.key.public_key.public_key, public_key.public_key
)
) {
return prev_fallback_key.id; return prev_fallback_key.id;
} }
return std::size_t(-1); return std::size_t(-1);