Avoid C99 inside C++ code

This disrupts building at least with Visual Studio.

Signed-off-by: Alexey Rusakov <ktirf@users.sf.net>
This commit is contained in:
Alexey Rusakov 2017-09-28 20:38:55 +09:00 committed by Richard van der Hoff
parent 0fd768e1b5
commit 3c33180fe3
2 changed files with 6 additions and 6 deletions

View file

@ -123,9 +123,9 @@ extern const struct _olm_cipher_ops _olm_cipher_aes_sha_256_ops;
* struct _olm_cipher *cipher = OLM_CIPHER_BASE(&MY_CIPHER); * struct _olm_cipher *cipher = OLM_CIPHER_BASE(&MY_CIPHER);
*/ */
#define OLM_CIPHER_INIT_AES_SHA_256(KDF_INFO) { \ #define OLM_CIPHER_INIT_AES_SHA_256(KDF_INFO) { \
.base_cipher = { &_olm_cipher_aes_sha_256_ops },\ /*.base_cipher = */{ &_olm_cipher_aes_sha_256_ops },\
.kdf_info = (uint8_t *)(KDF_INFO), \ /*.kdf_info = */(uint8_t *)(KDF_INFO), \
.kdf_info_length = sizeof(KDF_INFO) - 1 \ /*.kdf_info_length = */sizeof(KDF_INFO) - 1 \
} }
#define OLM_CIPHER_BASE(CIPHER) \ #define OLM_CIPHER_BASE(CIPHER) \
(&((CIPHER)->base_cipher)) (&((CIPHER)->base_cipher))

View file

@ -167,7 +167,7 @@ std::size_t olm::Account::get_one_time_keys_json_length(
} }
is_empty = false; is_empty = false;
length += 2; /* {" */ length += 2; /* {" */
length += olm::encode_base64_length(olm::pickle_length(key.id)); length += olm::encode_base64_length(_olm_pickle_uint32_length(key.id));
length += 3; /* ":" */ length += 3; /* ":" */
length += olm::encode_base64_length(sizeof(key.key.public_key)); length += olm::encode_base64_length(sizeof(key.key.public_key));
length += 1; /* " */ length += 1; /* " */
@ -198,8 +198,8 @@ std::size_t olm::Account::get_one_time_keys_json(
} }
*(pos++) = sep; *(pos++) = sep;
*(pos++) = '\"'; *(pos++) = '\"';
std::uint8_t key_id[olm::pickle_length(key.id)]; std::uint8_t key_id[_olm_pickle_uint32_length(key.id)];
olm::pickle(key_id, key.id); _olm_pickle_uint32(key_id, key.id);
pos = olm::encode_base64(key_id, sizeof(key_id), pos); pos = olm::encode_base64(key_id, sizeof(key_id), pos);
*(pos++) = '\"'; *(pos++) = ':'; *(pos++) = '\"'; *(pos++) = '\"'; *(pos++) = ':'; *(pos++) = '\"';
pos = olm::encode_base64( pos = olm::encode_base64(