Commit d84c1af8 authored by Hubert Chathi's avatar Hubert Chathi
Browse files

East const for consistency

parent 4d6c3ba8
Pipeline #9022 passed with stages
in 2 minutes and 54 seconds
...@@ -72,34 +72,34 @@ size_t olm_error(void); ...@@ -72,34 +72,34 @@ size_t olm_error(void);
/** A null terminated string describing the most recent error to happen to an /** A null terminated string describing the most recent error to happen to an
* account */ * account */
const char * olm_account_last_error( const char * olm_account_last_error(
const OlmAccount * account OlmAccount const * account
); );
/** An error code describing the most recent error to happen to an account */ /** An error code describing the most recent error to happen to an account */
enum OlmErrorCode olm_account_last_error_code( enum OlmErrorCode olm_account_last_error_code(
const OlmAccount * account OlmAccount const * account
); );
/** A null terminated string describing the most recent error to happen to a /** A null terminated string describing the most recent error to happen to a
* session */ * session */
const char * olm_session_last_error( const char * olm_session_last_error(
const OlmSession * session OlmSession const * session
); );
/** An error code describing the most recent error to happen to a session */ /** An error code describing the most recent error to happen to a session */
enum OlmErrorCode olm_session_last_error_code( enum OlmErrorCode olm_session_last_error_code(
const OlmSession * session OlmSession const * session
); );
/** A null terminated string describing the most recent error to happen to a /** A null terminated string describing the most recent error to happen to a
* utility */ * utility */
const char * olm_utility_last_error( const char * olm_utility_last_error(
const OlmUtility * utility OlmUtility const * utility
); );
/** An error code describing the most recent error to happen to a utility */ /** An error code describing the most recent error to happen to a utility */
enum OlmErrorCode olm_utility_last_error_code( enum OlmErrorCode olm_utility_last_error_code(
const OlmUtility * utility OlmUtility const * utility
); );
/** Clears the memory used to back this account */ /** Clears the memory used to back this account */
...@@ -119,12 +119,12 @@ size_t olm_clear_utility( ...@@ -119,12 +119,12 @@ size_t olm_clear_utility(
/** Returns the number of bytes needed to store an account */ /** Returns the number of bytes needed to store an account */
size_t olm_pickle_account_length( size_t olm_pickle_account_length(
const OlmAccount * account OlmAccount const * account
); );
/** Returns the number of bytes needed to store a session */ /** Returns the number of bytes needed to store a session */
size_t olm_pickle_session_length( size_t olm_pickle_session_length(
const OlmSession * session OlmSession const * session
); );
/** Stores an account as a base64 string. Encrypts the account using the /** Stores an account as a base64 string. Encrypts the account using the
...@@ -175,7 +175,7 @@ size_t olm_unpickle_session( ...@@ -175,7 +175,7 @@ size_t olm_unpickle_session(
/** The number of random bytes needed to create an account.*/ /** The number of random bytes needed to create an account.*/
size_t olm_create_account_random_length( size_t olm_create_account_random_length(
const OlmAccount * account OlmAccount const * account
); );
/** Creates a new account. Returns olm_error() on failure. If there weren't /** Creates a new account. Returns olm_error() on failure. If there weren't
...@@ -188,7 +188,7 @@ size_t olm_create_account( ...@@ -188,7 +188,7 @@ size_t olm_create_account(
/** The size of the output buffer needed to hold the identity keys */ /** The size of the output buffer needed to hold the identity keys */
size_t olm_account_identity_keys_length( size_t olm_account_identity_keys_length(
const OlmAccount * account OlmAccount const * account
); );
/** Writes the public parts of the identity keys for the account into the /** Writes the public parts of the identity keys for the account into the
...@@ -203,7 +203,7 @@ size_t olm_account_identity_keys( ...@@ -203,7 +203,7 @@ size_t olm_account_identity_keys(
/** The length of an ed25519 signature encoded as base64. */ /** The length of an ed25519 signature encoded as base64. */
size_t olm_account_signature_length( size_t olm_account_signature_length(
const OlmAccount * account OlmAccount const * account
); );
/** Signs a message with the ed25519 key for this account. Returns olm_error() /** Signs a message with the ed25519 key for this account. Returns olm_error()
...@@ -217,7 +217,7 @@ size_t olm_account_sign( ...@@ -217,7 +217,7 @@ size_t olm_account_sign(
/** The size of the output buffer needed to hold the one time keys */ /** The size of the output buffer needed to hold the one time keys */
size_t olm_account_one_time_keys_length( size_t olm_account_one_time_keys_length(
const OlmAccount * account OlmAccount const * account
); );
/** Writes the public parts of the unpublished one time keys for the account /** Writes the public parts of the unpublished one time keys for the account
...@@ -250,13 +250,13 @@ size_t olm_account_mark_keys_as_published( ...@@ -250,13 +250,13 @@ size_t olm_account_mark_keys_as_published(
/** The largest number of one time keys this account can store. */ /** The largest number of one time keys this account can store. */
size_t olm_account_max_number_of_one_time_keys( size_t olm_account_max_number_of_one_time_keys(
const OlmAccount * account OlmAccount const * account
); );
/** The number of random bytes needed to generate a given number of new one /** The number of random bytes needed to generate a given number of new one
* time keys. */ * time keys. */
size_t olm_account_generate_one_time_keys_random_length( size_t olm_account_generate_one_time_keys_random_length(
const OlmAccount * account, OlmAccount const * account,
size_t number_of_keys size_t number_of_keys
); );
...@@ -272,7 +272,7 @@ size_t olm_account_generate_one_time_keys( ...@@ -272,7 +272,7 @@ size_t olm_account_generate_one_time_keys(
/** The number of random bytes needed to generate a fallback key. */ /** The number of random bytes needed to generate a fallback key. */
size_t olm_account_generate_fallback_key_random_length( size_t olm_account_generate_fallback_key_random_length(
const OlmAccount * account OlmAccount const * account
); );
/** Generates a new fallback key. Only one previous fallback key is /** Generates a new fallback key. Only one previous fallback key is
...@@ -286,7 +286,7 @@ size_t olm_account_generate_fallback_key( ...@@ -286,7 +286,7 @@ size_t olm_account_generate_fallback_key(
/** The number of bytes needed to hold the fallback key as returned by /** The number of bytes needed to hold the fallback key as returned by
* olm_account_fallback_key. */ * olm_account_fallback_key. */
size_t olm_account_fallback_key_length( size_t olm_account_fallback_key_length(
const OlmAccount * account OlmAccount const * account
); );
size_t olm_account_fallback_key( size_t olm_account_fallback_key(
...@@ -297,7 +297,7 @@ size_t olm_account_fallback_key( ...@@ -297,7 +297,7 @@ size_t olm_account_fallback_key(
/** The number of random bytes needed to create an outbound session */ /** The number of random bytes needed to create an outbound session */
size_t olm_create_outbound_session_random_length( size_t olm_create_outbound_session_random_length(
const OlmSession * session OlmSession const * session
); );
/** Creates a new out-bound session for sending messages to a given identity_key /** Creates a new out-bound session for sending messages to a given identity_key
...@@ -339,7 +339,7 @@ size_t olm_create_inbound_session_from( ...@@ -339,7 +339,7 @@ size_t olm_create_inbound_session_from(
/** The length of the buffer needed to return the id for this session. */ /** The length of the buffer needed to return the id for this session. */
size_t olm_session_id_length( size_t olm_session_id_length(
const OlmSession * session OlmSession const * session
); );
/** An identifier for this session. Will be the same for both ends of the /** An identifier for this session. Will be the same for both ends of the
...@@ -351,7 +351,7 @@ size_t olm_session_id( ...@@ -351,7 +351,7 @@ size_t olm_session_id(
); );
int olm_session_has_received_message( int olm_session_has_received_message(
const OlmSession *session OlmSession const *session
); );
/** /**
...@@ -402,18 +402,18 @@ size_t olm_remove_one_time_keys( ...@@ -402,18 +402,18 @@ size_t olm_remove_one_time_keys(
* Returns OLM_MESSAGE_TYPE_MESSAGE if the message will be a normal message. * Returns OLM_MESSAGE_TYPE_MESSAGE if the message will be a normal message.
* Returns olm_error on failure. */ * Returns olm_error on failure. */
size_t olm_encrypt_message_type( size_t olm_encrypt_message_type(
const OlmSession * session OlmSession const * session
); );
/** The number of random bytes needed to encrypt the next message. */ /** The number of random bytes needed to encrypt the next message. */
size_t olm_encrypt_random_length( size_t olm_encrypt_random_length(
const OlmSession * session OlmSession const * session
); );
/** The size of the next message in bytes for the given number of plain-text /** The size of the next message in bytes for the given number of plain-text
* bytes. */ * bytes. */
size_t olm_encrypt_message_length( size_t olm_encrypt_message_length(
const OlmSession * session, OlmSession const * session,
size_t plaintext_length size_t plaintext_length
); );
...@@ -464,7 +464,7 @@ size_t olm_decrypt( ...@@ -464,7 +464,7 @@ size_t olm_decrypt(
/** The length of the buffer needed to hold the SHA-256 hash. */ /** The length of the buffer needed to hold the SHA-256 hash. */
size_t olm_sha256_length( size_t olm_sha256_length(
const OlmUtility * utility OlmUtility const * utility
); );
/** Calculates the SHA-256 hash of the input and encodes it as base64. If the /** Calculates the SHA-256 hash of the input and encodes it as base64. If the
......
...@@ -42,15 +42,15 @@ static olm::Account * from_c(OlmAccount * account) { ...@@ -42,15 +42,15 @@ static olm::Account * from_c(OlmAccount * account) {
return reinterpret_cast<olm::Account *>(account); return reinterpret_cast<olm::Account *>(account);
} }
static const olm::Account * from_c(const OlmAccount * account) { static const olm::Account * from_c(OlmAccount const * account) {
return reinterpret_cast<const olm::Account *>(account); return reinterpret_cast<olm::Account const *>(account);
} }
static olm::Session * from_c(OlmSession * session) { static olm::Session * from_c(OlmSession * session) {
return reinterpret_cast<olm::Session *>(session); return reinterpret_cast<olm::Session *>(session);
} }
static const olm::Session * from_c(const OlmSession * session) { static const olm::Session * from_c(OlmSession const * session) {
return reinterpret_cast<const olm::Session *>(session); return reinterpret_cast<const olm::Session *>(session);
} }
...@@ -58,7 +58,7 @@ static olm::Utility * from_c(OlmUtility * utility) { ...@@ -58,7 +58,7 @@ static olm::Utility * from_c(OlmUtility * utility) {
return reinterpret_cast<olm::Utility *>(utility); return reinterpret_cast<olm::Utility *>(utility);
} }
static const olm::Utility * from_c(const OlmUtility * utility) { static const olm::Utility * from_c(OlmUtility const * utility) {
return reinterpret_cast<const olm::Utility *>(utility); return reinterpret_cast<const olm::Utility *>(utility);
} }
...@@ -142,20 +142,20 @@ const char * olm_session_last_error( ...@@ -142,20 +142,20 @@ const char * olm_session_last_error(
} }
enum OlmErrorCode olm_session_last_error_code( enum OlmErrorCode olm_session_last_error_code(
const OlmSession * session OlmSession const * session
) { ) {
return from_c(session)->last_error; return from_c(session)->last_error;
} }
const char * olm_utility_last_error( const char * olm_utility_last_error(
const OlmUtility * utility OlmUtility const * utility
) { ) {
auto error = from_c(utility)->last_error; auto error = from_c(utility)->last_error;
return _olm_error_to_string(error); return _olm_error_to_string(error);
} }
enum OlmErrorCode olm_utility_last_error_code( enum OlmErrorCode olm_utility_last_error_code(
const OlmUtility * utility OlmUtility const * utility
) { ) {
return from_c(utility)->last_error; return from_c(utility)->last_error;
} }
...@@ -231,14 +231,14 @@ size_t olm_clear_utility( ...@@ -231,14 +231,14 @@ size_t olm_clear_utility(
size_t olm_pickle_account_length( size_t olm_pickle_account_length(
const OlmAccount * account OlmAccount const * account
) { ) {
return _olm_enc_output_length(pickle_length(*from_c(account))); return _olm_enc_output_length(pickle_length(*from_c(account)));
} }
size_t olm_pickle_session_length( size_t olm_pickle_session_length(
const OlmSession * session OlmSession const * session
) { ) {
return _olm_enc_output_length(pickle_length(*from_c(session))); return _olm_enc_output_length(pickle_length(*from_c(session)));
} }
...@@ -347,7 +347,7 @@ size_t olm_unpickle_session( ...@@ -347,7 +347,7 @@ size_t olm_unpickle_session(
size_t olm_create_account_random_length( size_t olm_create_account_random_length(
const OlmAccount * account OlmAccount const * account
) { ) {
return from_c(account)->new_account_random_length(); return from_c(account)->new_account_random_length();
} }
...@@ -364,7 +364,7 @@ size_t olm_create_account( ...@@ -364,7 +364,7 @@ size_t olm_create_account(
size_t olm_account_identity_keys_length( size_t olm_account_identity_keys_length(
const OlmAccount * account OlmAccount const * account
) { ) {
return from_c(account)->get_identity_json_length(); return from_c(account)->get_identity_json_length();
} }
...@@ -381,7 +381,7 @@ size_t olm_account_identity_keys( ...@@ -381,7 +381,7 @@ size_t olm_account_identity_keys(
size_t olm_account_signature_length( size_t olm_account_signature_length(
const OlmAccount * account OlmAccount const * account
) { ) {
return b64_output_length(from_c(account)->signature_length()); return b64_output_length(from_c(account)->signature_length());
} }
...@@ -407,7 +407,7 @@ size_t olm_account_sign( ...@@ -407,7 +407,7 @@ size_t olm_account_sign(
size_t olm_account_one_time_keys_length( size_t olm_account_one_time_keys_length(
const OlmAccount * account OlmAccount const * account
) { ) {
return from_c(account)->get_one_time_keys_json_length(); return from_c(account)->get_one_time_keys_json_length();
} }
...@@ -431,14 +431,14 @@ size_t olm_account_mark_keys_as_published( ...@@ -431,14 +431,14 @@ size_t olm_account_mark_keys_as_published(
size_t olm_account_max_number_of_one_time_keys( size_t olm_account_max_number_of_one_time_keys(
const OlmAccount * account OlmAccount const * account
) { ) {
return from_c(account)->max_number_of_one_time_keys(); return from_c(account)->max_number_of_one_time_keys();
} }
size_t olm_account_generate_one_time_keys_random_length( size_t olm_account_generate_one_time_keys_random_length(
const OlmAccount * account, OlmAccount const * account,
size_t number_of_keys size_t number_of_keys
) { ) {
return from_c(account)->generate_one_time_keys_random_length(number_of_keys); return from_c(account)->generate_one_time_keys_random_length(number_of_keys);
...@@ -460,7 +460,7 @@ size_t olm_account_generate_one_time_keys( ...@@ -460,7 +460,7 @@ size_t olm_account_generate_one_time_keys(
size_t olm_account_generate_fallback_key_random_length( size_t olm_account_generate_fallback_key_random_length(
const OlmAccount * account OlmAccount const * account
) { ) {
return from_c(account)->generate_fallback_key_random_length(); return from_c(account)->generate_fallback_key_random_length();
} }
...@@ -479,7 +479,7 @@ size_t olm_account_generate_fallback_key( ...@@ -479,7 +479,7 @@ size_t olm_account_generate_fallback_key(
size_t olm_account_fallback_key_length( size_t olm_account_fallback_key_length(
const OlmAccount * account OlmAccount const * account
) { ) {
return from_c(account)->get_fallback_key_json_length(); return from_c(account)->get_fallback_key_json_length();
} }
...@@ -496,7 +496,7 @@ size_t olm_account_fallback_key( ...@@ -496,7 +496,7 @@ size_t olm_account_fallback_key(
size_t olm_create_outbound_session_random_length( size_t olm_create_outbound_session_random_length(
const OlmSession * session OlmSession const * session
) { ) {
return from_c(session)->new_outbound_session_random_length(); return from_c(session)->new_outbound_session_random_length();
} }
...@@ -582,7 +582,7 @@ size_t olm_create_inbound_session_from( ...@@ -582,7 +582,7 @@ size_t olm_create_inbound_session_from(
size_t olm_session_id_length( size_t olm_session_id_length(
const OlmSession * session OlmSession const * session
) { ) {
return b64_output_length(from_c(session)->session_id_length()); return b64_output_length(from_c(session)->session_id_length());
} }
...@@ -608,7 +608,7 @@ size_t olm_session_id( ...@@ -608,7 +608,7 @@ size_t olm_session_id(
int olm_session_has_received_message( int olm_session_has_received_message(
const OlmSession * session OlmSession const * session
) { ) {
return from_c(session)->received_message; return from_c(session)->received_message;
} }
...@@ -679,21 +679,21 @@ size_t olm_remove_one_time_keys( ...@@ -679,21 +679,21 @@ size_t olm_remove_one_time_keys(
size_t olm_encrypt_message_type( size_t olm_encrypt_message_type(
const OlmSession * session OlmSession const * session
) { ) {
return size_t(from_c(session)->encrypt_message_type()); return size_t(from_c(session)->encrypt_message_type());
} }
size_t olm_encrypt_random_length( size_t olm_encrypt_random_length(
const OlmSession * session OlmSession const * session
) { ) {
return from_c(session)->encrypt_random_length(); return from_c(session)->encrypt_random_length();
} }
size_t olm_encrypt_message_length( size_t olm_encrypt_message_length(
const OlmSession * session, OlmSession const * session,
size_t plaintext_length size_t plaintext_length
) { ) {
return b64_output_length( return b64_output_length(
...@@ -766,7 +766,7 @@ size_t olm_decrypt( ...@@ -766,7 +766,7 @@ size_t olm_decrypt(
size_t olm_sha256_length( size_t olm_sha256_length(
const OlmUtility * utility OlmUtility const * utility
) { ) {
return b64_output_length(from_c(utility)->sha256_length()); return b64_output_length(from_c(utility)->sha256_length());
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment