Skip to content

Commit

Permalink
Fun is C++
Browse files Browse the repository at this point in the history
  • Loading branch information
nurupo committed Dec 28, 2021
1 parent abe07d9 commit 80854d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions other/fun/create_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ static void handle_args(const int argc, const char *const argv[], const char *co
} else if (argc == 2 && strlen(argv[1]) == crypto_box_SECRETKEYBYTES * 2) {
size_t bin_len = 0;

if (sodium_hex2bin(secret_key, crypto_box_SECRETKEYBYTES, argv[1], crypto_box_SECRETKEYBYTES * 2, NULL, &bin_len,
NULL) != 0 || bin_len != crypto_box_SECRETKEYBYTES) {
if (sodium_hex2bin(secret_key, crypto_box_SECRETKEYBYTES, argv[1], crypto_box_SECRETKEYBYTES * 2, nullptr, &bin_len,
nullptr) != 0 || bin_len != crypto_box_SECRETKEYBYTES) {
printf("Error: Secret key must be a hex string.\n");
exit(1);
}
Expand Down
12 changes: 6 additions & 6 deletions other/fun/create_savedata.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ static bool create_tox(const unsigned char *const secret_key, Tox **const tox)
static bool print_savedata(Tox *const tox)
{
const size_t savedata_size = tox_get_savedata_size(tox);
uint8_t *const savedata = malloc(savedata_size);
uint8_t *const savedata = (uint8_t *const)malloc(savedata_size);

if (savedata == NULL) {
if (savedata == nullptr) {
tox_kill(tox);
return false;
}
Expand All @@ -58,17 +58,17 @@ static bool print_savedata(Tox *const tox)

static bool print_tox_id(const Tox *const tox)
{
uint8_t *const tox_id = malloc(tox_address_size());
uint8_t *const tox_id = (uint8_t *const)malloc(tox_address_size());

if (tox_id == NULL) {
if (tox_id == nullptr) {
return false;
}

tox_self_get_address(tox, tox_id);
const size_t tox_id_str_size = tox_address_size() * 2 + 1;
char *const tox_id_str = malloc(tox_id_str_size);
char *const tox_id_str = (char *const)malloc(tox_id_str_size);

if (tox_id_str == NULL) {
if (tox_id_str == nullptr) {
free(tox_id);
return false;
}
Expand Down

0 comments on commit 80854d1

Please sign in to comment.