Ignore "unused-result" warning in super_donators code.

This commit is contained in:
iphydf 2018-09-06 00:58:49 +00:00
parent 1b2322284f
commit f59e6ff0cb
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
4 changed files with 20 additions and 6 deletions

View File

@ -1,4 +1,5 @@
cc_binary(
name = "grencez_tok5",
srcs = ["grencez_tok5.c"],
copts = ["-Wno-unused-result"],
)

View File

@ -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);

View File

@ -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);
}

View File

@ -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)