Skip to content

Commit

Permalink
Ignore "unused-result" warning in super_donators code.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Sep 6, 2018
1 parent 6872c14 commit be700ae
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions super_donators/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cc_binary(
name = "grencez_tok5",
srcs = ["grencez_tok5.c"],
copts = ["-Wno-unused-result"],
)
15 changes: 12 additions & 3 deletions testing/av_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,10 @@ static int print_help(const char *name)

int main(int argc, char **argv)
{
freopen("/dev/zero", "w", stderr);
if (freopen("/dev/zero", "w", stderr) == nullptr) {
return EXIT_FAILURE;
}

Pa_Initialize();

struct stat st;
Expand Down Expand Up @@ -649,10 +652,16 @@ int main(int argc, char **argv)
output.hostApiSpecificStreamInfo = nullptr;

PaError err = Pa_OpenStream(&adout, nullptr, &output, af_info.samplerate, frame_size, paNoFlag, nullptr, nullptr);
assert(err == paNoError);

if (err != paNoError) {
return EXIT_FAILURE;
}

err = Pa_StartStream(adout);
assert(err == paNoError);

if (err != paNoError) {
return EXIT_FAILURE;
}

// toxav_audio_bit_rate_set(AliceAV, 0, 64, false, nullptr);

Expand Down
4 changes: 4 additions & 0 deletions toxcore/DHT.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,9 @@ int pack_nodes(uint8_t *data, uint16_t length, const Node_format *nodes, uint16_
memcpy(data + packed_length, nodes[i].public_key, CRYPTO_PUBLIC_KEY_SIZE);
packed_length += CRYPTO_PUBLIC_KEY_SIZE;

#ifndef NDEBUG
const uint32_t increment = ipp_size + CRYPTO_PUBLIC_KEY_SIZE;
#endif
assert(increment == PACKED_NODE_SIZE_IP4 || increment == PACKED_NODE_SIZE_IP6);
}

Expand Down Expand Up @@ -610,7 +612,9 @@ int unpack_nodes(Node_format *nodes, uint16_t max_num_nodes, uint16_t *processed
len_processed += CRYPTO_PUBLIC_KEY_SIZE;
++num;

#ifndef NDEBUG
const uint32_t increment = ipp_size + CRYPTO_PUBLIC_KEY_SIZE;
#endif
assert(increment == PACKED_NODE_SIZE_IP4 || increment == PACKED_NODE_SIZE_IP6);
}

Expand Down
6 changes: 3 additions & 3 deletions toxcore/tox.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,22 +1013,22 @@ bool tox_friend_get_status_message(const Tox *tox, uint32_t friend_number, uint8
{
if (!status_message) {
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_NULL);
return 0;
return false;
}

const Messenger *const m = tox->m;
const int size = m_get_statusmessage_size(m, friend_number);

if (size == -1) {
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_FRIEND_NOT_FOUND);
return 0;
return false;
}

const int ret = m_copy_statusmessage(m, friend_number, status_message, size);
assert(ret == size && "concurrency problem: friend status message changed");

SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_OK);
return 1;
return ret == size;
}

void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *callback)
Expand Down

0 comments on commit be700ae

Please sign in to comment.