From 1ce6aab5dabcd801a2bc41986b976e494f57f2cc Mon Sep 17 00:00:00 2001 From: iphydf Date: Tue, 7 Dec 2021 14:42:13 +0000 Subject: [PATCH] cleanup: Ensure that error codes are always initialised. In this case, there was no way it would not be, but a code change down the stack could cause a variable to become uninitialised. This avoids a gcc warning and is more locally-correct. --- other/analysis/run-gcc | 5 +++-- toxcore/tox.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/other/analysis/run-gcc b/other/analysis/run-gcc index 74f294df..a7033f13 100755 --- a/other/analysis/run-gcc +++ b/other/analysis/run-gcc @@ -8,12 +8,13 @@ g++ -O3 -o /dev/null amalgamation.cc \ "${CPPFLAGS[@]}" \ "${LDFLAGS[@]}" \ -std=c++11 \ - -pedantic \ -fdiagnostics-color=always \ -Wall \ -Wextra \ - -Wno-aggregate-return \ + -Werror \ -Wno-aggressive-loop-optimizations \ + -Wno-error=null-dereference \ + -Wno-error=type-limits \ -Wno-float-conversion \ -Wno-format-signedness \ -Wno-missing-field-initializers \ diff --git a/toxcore/tox.c b/toxcore/tox.c index 780d9136..64daab01 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c @@ -1655,6 +1655,7 @@ bool tox_file_send_chunk(Tox *tox, uint32_t friend_number, uint32_t file_number, } /* can't happen */ + SET_ERROR_PARAMETER(error, TOX_ERR_FILE_SEND_CHUNK_OK); return 0; }