1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 12:36:01 -07:00

C++ compat

This commit is contained in:
Frank Denis 2017-08-09 16:08:03 +02:00
parent ad5a5232a2
commit 74fd8fd1ce

View File

@ -152,9 +152,9 @@ main(void)
for (i = 0; i < 1000; i++) { for (i = 0; i < 1000; i++) {
assert(sizeof buf1 >= 100); assert(sizeof buf1 >= 100);
bin_len = (size_t) randombytes_uniform(100); bin_len = (size_t) randombytes_uniform(100);
bin = sodium_malloc(bin_len); bin = (unsigned char *) sodium_malloc(bin_len);
b64_len = 1 + (bin_len + 2) / 3 * 4; b64_len = 1 + (bin_len + 2) / 3 * 4;
b64_ = sodium_malloc(b64_len); b64_ = (char *) sodium_malloc(b64_len);
randombytes_buf(bin, bin_len); randombytes_buf(bin, bin_len);
memcpy(buf1, bin, bin_len); memcpy(buf1, bin, bin_len);
b64 = sodium_bin2base64(b64_, b64_len, bin, bin_len, b64 = sodium_bin2base64(b64_, b64_len, bin, bin_len,