Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: Fix unused parameter warnings and add -Wunused-parameter to makefile #55

Merged
merged 1 commit into from
Mar 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ cc_binary(
"-DPYTHON",
"-DQRCODE",
"-DVIDEO",
"-Wno-error=unused-result",
],
deps = [
"//c-toxcore",
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CFG_DIR = $(BASE_DIR)/cfg
LIBS = toxcore ncursesw libconfig libcurl

CFLAGS ?= -g
CFLAGS += -std=gnu99 -pthread -Wall -Wpedantic -fstack-protector-all
CFLAGS += -std=gnu99 -pthread -Wall -Wpedantic -Wunused -fstack-protector-all
CFLAGS += '-DTOXICVER="$(VERSION)"' -DHAVE_WIDECHAR -D_XOPEN_SOURCE_EXTENDED -D_FILE_OFFSET_BITS=64
CFLAGS += '-DPACKAGE_DATADIR="$(abspath $(DATADIR))"'
CFLAGS += ${USER_CFLAGS}
Expand Down
47 changes: 47 additions & 0 deletions src/audio_call.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "notify.h"
#include "friendlist.h"
#include "chat.h"
#include "misc_tools.h"

#ifdef AUDIO

Expand Down Expand Up @@ -174,6 +175,8 @@ void terminate_audio(void)

void read_device_callback(const int16_t *captured, uint32_t size, void *data)
{
UNUSED_VAR(size);

Toxav_Err_Send_Frame error;
uint32_t friend_number = *((uint32_t *)data); /* TODO: Or pass an array of call_idx's */
int64_t sample_count = ((int64_t) CallControl.audio_sample_rate) * \
Expand Down Expand Up @@ -280,13 +283,20 @@ int stop_transmission(Call *call, uint32_t friend_number)
*/
void on_call(ToxAV *av, uint32_t friend_number, bool audio_enabled, bool video_enabled, void *user_data)
{
UNUSED_VAR(av);
UNUSED_VAR(audio_enabled);
UNUSED_VAR(video_enabled);

Tox *m = (Tox *) user_data;
CallControl.pending_call = true;
callback_recv_invite(m, friend_number);
}

void on_call_state(ToxAV *av, uint32_t friend_number, uint32_t state, void *user_data)
{
UNUSED_VAR(av);
UNUSED_VAR(user_data);

CallControl.call_state = state;

switch (state) {
Expand Down Expand Up @@ -350,6 +360,9 @@ void on_audio_receive_frame(ToxAV *av, uint32_t friend_number,
int16_t const *pcm, size_t sample_count,
uint8_t channels, uint32_t sampling_rate, void *user_data)
{
UNUSED_VAR(av);
UNUSED_VAR(user_data);

write_device_callback(friend_number, pcm, sample_count, channels, sampling_rate);
}

Expand Down Expand Up @@ -457,6 +470,10 @@ void callback_call_ended(uint32_t friend_number)
*/
void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
UNUSED_VAR(window);
UNUSED_VAR(m);
UNUSED_VAR(argv);

Toxav_Err_Call error;
const char *error_str;

Expand Down Expand Up @@ -508,6 +525,10 @@ void cmd_call(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA

void cmd_answer(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
UNUSED_VAR(window);
UNUSED_VAR(m);
UNUSED_VAR(argv);

Toxav_Err_Answer error;
const char *error_str;

Expand Down Expand Up @@ -555,6 +576,10 @@ void cmd_answer(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[

void cmd_reject(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
UNUSED_VAR(window);
UNUSED_VAR(m);
UNUSED_VAR(argv);

const char *error_str;

if (argc != 0) {
Expand Down Expand Up @@ -586,6 +611,10 @@ void cmd_reject(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[

void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
UNUSED_VAR(window);
UNUSED_VAR(m);
UNUSED_VAR(argv);

const char *error_str = NULL;

if (!CallControl.av) {
Expand Down Expand Up @@ -615,6 +644,9 @@ void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[

void cmd_list_devices(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
UNUSED_VAR(window);
UNUSED_VAR(m);

const char *error_str;

if (argc != 1) {
Expand Down Expand Up @@ -655,6 +687,9 @@ void cmd_list_devices(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*
/* This changes primary device only */
void cmd_change_device(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
UNUSED_VAR(window);
UNUSED_VAR(m);

const char *error_str;

if (argc != 2) {
Expand Down Expand Up @@ -705,6 +740,9 @@ void cmd_change_device(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (

void cmd_ccur_device(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
UNUSED_VAR(window);
UNUSED_VAR(m);

const char *error_str;

if (argc != 2) {
Expand Down Expand Up @@ -782,6 +820,9 @@ void cmd_ccur_device(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*a

void cmd_mute(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
UNUSED_VAR(window);
UNUSED_VAR(m);

const char *error_str;

if (argc != 1) {
Expand Down Expand Up @@ -835,6 +876,9 @@ void cmd_mute(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA

void cmd_sense(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
UNUSED_VAR(window);
UNUSED_VAR(m);

const char *error_str;

if (argc != 1) {
Expand Down Expand Up @@ -869,6 +913,9 @@ void cmd_sense(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[M

void cmd_bitrate(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
UNUSED_VAR(window);
UNUSED_VAR(m);

char *error_str;

if (argc != 1) {
Expand Down
2 changes: 2 additions & 0 deletions src/autocomplete.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ static void print_matches(ToxWindow *self, Tox *m, const void *list, size_t n_it
*/
static size_t get_str_match(ToxWindow *self, char *match, size_t match_sz, char (*matches)[MAX_STR_SIZE], int n)
{
UNUSED_VAR(self);

if (n == 1) {
return snprintf(match, match_sz, "%s", matches[0]);
}
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ static int extract_node(const char *line, struct Node *node)
/* Loads the DHT nodeslist to memory from json encoded nodes file. */
void *load_nodeslist_thread(void *data)
{
UNUSED_VAR(data);

char nodes_path[PATH_MAX];
get_nodeslist_path(nodes_path, sizeof(nodes_path));

Expand Down
Loading