From f59e6ff0cb829dfd46e5383658a7b34bb512b5f2 Mon Sep 17 00:00:00 2001 From: iphydf Date: Thu, 6 Sep 2018 00:58:49 +0000 Subject: [PATCH] Ignore "unused-result" warning in super_donators code. --- super_donators/BUILD.bazel | 1 + testing/av_test.c | 15 ++++++++++++--- toxcore/DHT.c | 4 ++++ toxcore/tox.c | 6 +++--- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/super_donators/BUILD.bazel b/super_donators/BUILD.bazel index 85629756..806f72b0 100644 --- a/super_donators/BUILD.bazel +++ b/super_donators/BUILD.bazel @@ -1,4 +1,5 @@ cc_binary( name = "grencez_tok5", srcs = ["grencez_tok5.c"], + copts = ["-Wno-unused-result"], ) diff --git a/testing/av_test.c b/testing/av_test.c index ca2b2779..a058e869 100644 --- a/testing/av_test.c +++ b/testing/av_test.c @@ -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; @@ -649,10 +652,16 @@ CHECK_ARG: 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); diff --git a/toxcore/DHT.c b/toxcore/DHT.c index b2f2e625..682b962f 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c @@ -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); } @@ -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); } diff --git a/toxcore/tox.c b/toxcore/tox.c index 203a6550..558fe28a 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c @@ -1013,7 +1013,7 @@ 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; @@ -1021,14 +1021,14 @@ bool tox_friend_get_status_message(const Tox *tox, uint32_t friend_number, uint8 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)