diff --git a/Makefile b/Makefile index 6ee049d9c..3101eb79e 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ CFG_DIR = $(BASE_DIR)/cfg LIBS = toxcore ncursesw libconfig libcurl -CFLAGS ?= -std=c11 -pthread -Wall -Wpedantic -Wunused -fstack-protector-all -Wvla -Wno-missing-braces +CFLAGS ?= -std=c11 -pthread -Wall -Wpedantic -Wunused -fstack-protector-all -Wvla -Wno-missing-braces -Wmissing-prototypes CFLAGS += '-DTOXICVER="$(VERSION)"' -DHAVE_WIDECHAR -D_XOPEN_SOURCE_EXTENDED -D_FILE_OFFSET_BITS=64 CFLAGS += '-DPACKAGE_DATADIR="$(abspath $(DATADIR))"' CFLAGS += ${USER_CFLAGS} diff --git a/src/audio_call.c b/src/audio_call.c index 95112f78d..cce0766ef 100644 --- a/src/audio_call.c +++ b/src/audio_call.c @@ -132,7 +132,7 @@ ToxAV *init_audio(Toxic *toxic) return toxic->av; } -void read_device_callback(const int16_t *captured, uint32_t size, void *data) +static void read_device_callback(const int16_t *captured, uint32_t size, void *data) { UNUSED_VAR(size); diff --git a/src/audio_device.c b/src/audio_device.c index d0aaba637..a44ff8beb 100644 --- a/src/audio_device.c +++ b/src/audio_device.c @@ -661,7 +661,7 @@ DeviceError write_out(uint32_t device_idx, const int16_t *data, uint32_t sample_ * * return normalized volume of buffer in range 0.0-100.0 */ -float volume(int16_t *frame, uint32_t samples) +static float volume(int16_t *frame, uint32_t samples) { float sum_of_squares = 0; diff --git a/src/bootstrap.c b/src/bootstrap.c index b01f1bb8d..74016531e 100644 --- a/src/bootstrap.c +++ b/src/bootstrap.c @@ -512,7 +512,7 @@ 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) +static void *load_nodeslist_thread(void *data) { const Toxic *toxic = (Toxic *) data; diff --git a/src/chat.c b/src/chat.c index 5c9dafd08..28e64ad08 100644 --- a/src/chat.c +++ b/src/chat.c @@ -904,7 +904,7 @@ static void chat_onGroupInvite(ToxWindow *self, Toxic *toxic, uint32_t friendnum } #ifdef GAMES -void chat_onGameInvite(ToxWindow *self, Toxic *toxic, uint32_t friend_number, const uint8_t *data, size_t length) +static void chat_onGameInvite(ToxWindow *self, Toxic *toxic, uint32_t friend_number, const uint8_t *data, size_t length) { if (toxic == NULL || self == NULL) { return; @@ -986,7 +986,7 @@ void chat_onGameInvite(ToxWindow *self, Toxic *toxic, uint32_t friend_number, co /* AV Stuff */ #ifdef AUDIO -void chat_onInvite(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) +static void chat_onInvite(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) { UNUSED_VAR(state); @@ -1018,7 +1018,7 @@ void chat_onInvite(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int st } } -void chat_onRinging(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) +static void chat_onRinging(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) { UNUSED_VAR(state); @@ -1044,7 +1044,7 @@ void chat_onRinging(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int s #endif /* SOUND_NOTIFY */ } -void chat_onStarting(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) +static void chat_onStarting(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) { UNUSED_VAR(state); @@ -1070,7 +1070,7 @@ void chat_onStarting(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int #endif /* SOUND_NOTIFY */ } -void chat_onError(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) +static void chat_onError(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) { UNUSED_VAR(state); @@ -1090,7 +1090,7 @@ void chat_onError(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int sta #endif /* SOUND_NOTIFY */ } -void chat_onStart(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) +static void chat_onStart(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) { UNUSED_VAR(state); @@ -1116,7 +1116,7 @@ void chat_onStart(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int sta #endif /* SOUND_NOTIFY */ } -void chat_onCancel(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) +static void chat_onCancel(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) { UNUSED_VAR(state); @@ -1137,7 +1137,7 @@ void chat_onCancel(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int st #endif /* SOUND_NOTIFY */ } -void chat_onReject(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) +static void chat_onReject(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) { UNUSED_VAR(state); @@ -1157,7 +1157,7 @@ void chat_onReject(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int st #endif /* SOUND_NOTIFY */ } -void chat_onEnd(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) +static void chat_onEnd(ToxWindow *self, Toxic *toxic, uint32_t friend_number, int state) { UNUSED_VAR(state); @@ -1294,7 +1294,7 @@ static void send_action(ToxWindow *self, ChatContext *ctx, Toxic *toxic, char *a /* * Return true if input is recognized by handler */ -bool chat_onKey(ToxWindow *self, Toxic *toxic, wint_t key, bool ltr) +static bool chat_onKey(ToxWindow *self, Toxic *toxic, wint_t key, bool ltr) { if (toxic == NULL || self == NULL) { return false; diff --git a/src/game_base.c b/src/game_base.c index c26d40e36..5a06bb934 100644 --- a/src/game_base.c +++ b/src/game_base.c @@ -731,7 +731,7 @@ static void game_update_state(GameData *game) } } -void game_onDraw(ToxWindow *self, Toxic *toxic) +static void game_onDraw(ToxWindow *self, Toxic *toxic) { UNUSED_VAR(toxic); // Note: This function is not thread safe if we ever need to use `toxic` @@ -787,7 +787,7 @@ void game_onDraw(ToxWindow *self, Toxic *toxic) game_draw_messages(game, true); } -bool game_onKey(ToxWindow *self, Toxic *toxic, wint_t key, bool is_printable) +static bool game_onKey(ToxWindow *self, Toxic *toxic, wint_t key, bool is_printable) { UNUSED_VAR(is_printable); @@ -828,7 +828,7 @@ bool game_onKey(ToxWindow *self, Toxic *toxic, wint_t key, bool is_printable) return true; } -void game_onInit(ToxWindow *self, Toxic *toxic) +static void game_onInit(ToxWindow *self, Toxic *toxic) { UNUSED_VAR(toxic); @@ -853,7 +853,7 @@ void game_onInit(ToxWindow *self, Toxic *toxic) * Byte 2-5: Game ID * Byte 6-* Game data */ -void game_onPacket(ToxWindow *self, Toxic *toxic, uint32_t friendnumber, const uint8_t *data, size_t length) +static void game_onPacket(ToxWindow *self, Toxic *toxic, uint32_t friendnumber, const uint8_t *data, size_t length) { UNUSED_VAR(toxic); diff --git a/src/game_centipede.c b/src/game_centipede.c index 8591ab97a..4eef52a94 100644 --- a/src/game_centipede.c +++ b/src/game_centipede.c @@ -849,7 +849,7 @@ static void cent_bullet_move(const GameData *game, CentState *state, TIME_MS cur } } -void cent_bullet_spawn(CentState *state) +static void cent_bullet_spawn(CentState *state) { Projectile *bullet = &state->bullet; @@ -1505,7 +1505,7 @@ static void cent_mushrooms_draw(WINDOW *win, const CentState *state) } } -void cent_cb_update_game_state(GameData *game, void *cb_data) +static void cent_cb_update_game_state(GameData *game, void *cb_data) { CentState *state = (CentState *)cb_data; @@ -1529,7 +1529,7 @@ void cent_cb_update_game_state(GameData *game, void *cb_data) cent_do_scorpion(game, state, cur_time); } -void cent_cb_render_window(GameData *game, WINDOW *win, void *cb_data) +static void cent_cb_render_window(GameData *game, WINDOW *win, void *cb_data) { CentState *state = (CentState *)cb_data; @@ -1544,7 +1544,7 @@ void cent_cb_render_window(GameData *game, WINDOW *win, void *cb_data) cent_centipede_draw(game, win, state); } -void cent_cb_on_keypress(GameData *game, int key, void *cb_data) +static void cent_cb_on_keypress(GameData *game, int key, void *cb_data) { CentState *state = (CentState *)cb_data; @@ -1564,7 +1564,7 @@ void cent_cb_on_keypress(GameData *game, int key, void *cb_data) } } -void cent_cb_pause(GameData *game, bool is_paused, void *cb_data) +static void cent_cb_pause(GameData *game, bool is_paused, void *cb_data) { CentState *state = (CentState *)cb_data; @@ -1581,7 +1581,7 @@ void cent_cb_pause(GameData *game, bool is_paused, void *cb_data) } } -void cent_cb_kill(GameData *game, void *cb_data) +static void cent_cb_kill(GameData *game, void *cb_data) { CentState *state = (CentState *)cb_data; diff --git a/src/game_chess.c b/src/game_chess.c index a53ca4492..bcf9deb35 100644 --- a/src/game_chess.c +++ b/src/game_chess.c @@ -1484,25 +1484,25 @@ static int chess_get_display_colour(ChessColour p_colour, int tile_colour) } } -void chess_move_curs_up_left(ChessState *state) +static void chess_move_curs_up_left(ChessState *state) { chess_move_curs_left(state); chess_move_curs_up(state); } -void chess_move_curs_up_right(ChessState *state) +static void chess_move_curs_up_right(ChessState *state) { chess_move_curs_right(state); chess_move_curs_up(state); } -void chess_move_curs_down_left(ChessState *state) +static void chess_move_curs_down_left(ChessState *state) { chess_move_curs_left(state); chess_move_curs_down(state); } -void chess_move_curs_down_right(ChessState *state) +static void chess_move_curs_down_right(ChessState *state) { chess_move_curs_right(state); chess_move_curs_down(state); @@ -1714,7 +1714,7 @@ static void chess_draw_interface(const GameData *game, WINDOW *win, ChessState * chess_print_captured(game, win, state); } -void chess_cb_render_window(GameData *game, WINDOW *win, void *cb_data) +static void chess_cb_render_window(GameData *game, WINDOW *win, void *cb_data) { ChessState *state = (ChessState *)cb_data; @@ -1730,7 +1730,7 @@ void chess_cb_render_window(GameData *game, WINDOW *win, void *cb_data) chess_draw_interface(game, win, state); } -void chess_cb_on_keypress(GameData *game, int key, void *cb_data) +static void chess_cb_on_keypress(GameData *game, int key, void *cb_data) { ChessState *state = (ChessState *)cb_data; @@ -1793,7 +1793,7 @@ void chess_cb_on_keypress(GameData *game, int key, void *cb_data) } } -void chess_cb_kill(GameData *game, void *cb_data) +static void chess_cb_kill(GameData *game, void *cb_data) { ChessState *state = (ChessState *)cb_data; diff --git a/src/game_life.c b/src/game_life.c index 4832bcc2c..b56a41445 100644 --- a/src/game_life.c +++ b/src/game_life.c @@ -346,7 +346,7 @@ static void life_start(GameData *game, LifeState *state) state->generation = 1; } -void life_cb_update_game_state(GameData *game, void *cb_data) +static void life_cb_update_game_state(GameData *game, void *cb_data) { LifeState *state = (LifeState *)cb_data; @@ -357,7 +357,7 @@ void life_cb_update_game_state(GameData *game, void *cb_data) life_cycle(game, state); } -void life_cb_render_window(GameData *game, WINDOW *win, void *cb_data) +static void life_cb_render_window(GameData *game, WINDOW *win, void *cb_data) { LifeState *state = (LifeState *)cb_data; @@ -442,7 +442,7 @@ static void life_move_curs_down_left(LifeState *state) life_move_curs_left(state); } -void life_cb_on_keypress(GameData *game, int key, void *cb_data) +static void life_cb_on_keypress(GameData *game, int key, void *cb_data) { LifeState *state = (LifeState *)cb_data; @@ -555,7 +555,7 @@ static void life_free_cells(LifeState *state) free(state->cells); } -void life_cb_pause(GameData *game, bool is_paused, void *cb_data) +static void life_cb_pause(GameData *game, bool is_paused, void *cb_data) { LifeState *state = (LifeState *)cb_data; @@ -566,7 +566,7 @@ void life_cb_pause(GameData *game, bool is_paused, void *cb_data) state->paused = is_paused; } -void life_cb_kill(GameData *game, void *cb_data) +static void life_cb_kill(GameData *game, void *cb_data) { LifeState *state = (LifeState *)cb_data; diff --git a/src/game_snake.c b/src/game_snake.c index d47a859df..3f6107bba 100644 --- a/src/game_snake.c +++ b/src/game_snake.c @@ -989,7 +989,7 @@ static void snake_draw_powerup(WINDOW *win, const SnakeState *state) } } -void snake_cb_update_game_state(GameData *game, void *cb_data) +static void snake_cb_update_game_state(GameData *game, void *cb_data) { SnakeState *state = (SnakeState *)cb_data; @@ -1014,7 +1014,7 @@ void snake_cb_update_game_state(GameData *game, void *cb_data) } } -void snake_cb_render_window(GameData *game, WINDOW *win, void *cb_data) +static void snake_cb_render_window(GameData *game, WINDOW *win, void *cb_data) { SnakeState *state = (SnakeState *)cb_data; @@ -1034,7 +1034,7 @@ void snake_cb_render_window(GameData *game, WINDOW *win, void *cb_data) snake_draw_snake(win, state->snake, state->snake_length); } -void snake_cb_kill(GameData *game, void *cb_data) +static void snake_cb_kill(GameData *game, void *cb_data) { SnakeState *state = (SnakeState *)cb_data; @@ -1058,7 +1058,7 @@ void snake_cb_kill(GameData *game, void *cb_data) game_set_cb_on_pause(game, NULL, NULL); } -void snake_cb_on_keypress(GameData *game, int key, void *cb_data) +static void snake_cb_on_keypress(GameData *game, int key, void *cb_data) { SnakeState *state = (SnakeState *)cb_data; @@ -1069,7 +1069,7 @@ void snake_cb_on_keypress(GameData *game, int key, void *cb_data) snake_set_key_press(state, key); } -void snake_cb_pause(GameData *game, bool is_paused, void *cb_data) +static void snake_cb_pause(GameData *game, bool is_paused, void *cb_data) { SnakeState *state = (SnakeState *)cb_data; diff --git a/src/groupchats.c b/src/groupchats.c index 4749a3253..4273505f1 100644 --- a/src/groupchats.c +++ b/src/groupchats.c @@ -1107,7 +1107,8 @@ static void groupchat_onGroupPrivacyState(ToxWindow *self, Toxic *toxic, uint32_ write_to_log(ctx->log, c_config, tmp_event, "The founder", true); } -void groupchat_onGroupVoiceState(ToxWindow *self, Toxic *toxic, uint32_t groupnumber, Tox_Group_Voice_State voice_state) +static void groupchat_onGroupVoiceState(ToxWindow *self, Toxic *toxic, uint32_t groupnumber, + Tox_Group_Voice_State voice_state) { if (toxic == NULL || self == NULL) { return; diff --git a/src/name_lookup.c b/src/name_lookup.c index c1a5ba43a..032167497 100644 --- a/src/name_lookup.c +++ b/src/name_lookup.c @@ -233,7 +233,7 @@ static int process_response(struct Recv_Curl_Data *recv_data) return 0; } -void *lookup_thread_func(void *data) +static void *lookup_thread_func(void *data) { struct curl_slist *headers = NULL; CURL *c_handle = NULL; diff --git a/src/notify.c b/src/notify.c index 30f69c8cc..f4a4c4ed9 100644 --- a/src/notify.c +++ b/src/notify.c @@ -156,7 +156,7 @@ static void control_unlock(void) } #ifdef SOUND_NOTIFY -bool is_playing(int source) +static bool is_playing(int source) { int ready; alGetSourcei(source, AL_SOURCE_STATE, &ready); @@ -190,7 +190,7 @@ static void m_open_device(const Client_Config *c_config) device_opened = true; } -void m_close_device(void) +static void m_close_device(void) { if (!device_opened) { return; @@ -202,7 +202,7 @@ void m_close_device(void) } /* Terminate all sounds but wait for them to finish first */ -void graceful_clear(void) +static void graceful_clear(void) { control_lock(); @@ -249,7 +249,7 @@ void graceful_clear(void) control_unlock(); } -void *do_playing(void *_p) +static void *do_playing(void *_p) { UNUSED_VAR(_p); @@ -327,7 +327,7 @@ void *do_playing(void *_p) pthread_exit(NULL); } -int play_source(uint32_t source, uint32_t buffer, bool looping) +static int play_source(uint32_t source, uint32_t buffer, bool looping) { int i = 0; diff --git a/src/term_mplex.c b/src/term_mplex.c index 1db2c608d..64bee346f 100644 --- a/src/term_mplex.c +++ b/src/term_mplex.c @@ -430,7 +430,7 @@ static void mplex_timer_handler(Toxic *toxic) /* Time in seconds between calls to mplex_timer_handler */ #define MPLEX_TIMER_INTERVAL 5 -void *mplex_timer_thread(void *data) +static void *mplex_timer_thread(void *data) { Toxic *toxic = (Toxic *) data; diff --git a/src/toxic.c b/src/toxic.c index b4d3ee117..02a98f21d 100644 --- a/src/toxic.c +++ b/src/toxic.c @@ -141,7 +141,7 @@ static void init_signal_catchers(void) signal(SIGSEGV, catch_SIGSEGV); } -void kill_toxic(Toxic *toxic) +static void kill_toxic(Toxic *toxic) { if (toxic == NULL) { return; @@ -233,8 +233,8 @@ static const char *tox_log_level_show(Tox_Log_Level level) return ""; } -void cb_toxcore_logger(Tox *tox, TOX_LOG_LEVEL level, const char *file, uint32_t line, const char *func, - const char *message, void *user_data) +static void cb_toxcore_logger(Tox *tox, TOX_LOG_LEVEL level, const char *file, uint32_t line, const char *func, + const char *message, void *user_data) { UNUSED_VAR(tox); @@ -1244,7 +1244,7 @@ static void poll_interface_refresh_flag(void) /* How often we refresh windows that aren't focused */ #define INACTIVE_WIN_REFRESH_RATE 10 -void *thread_winref(void *data) +static void *thread_winref(void *data) { Toxic *toxic = (Toxic *) data; @@ -1273,7 +1273,7 @@ void *thread_winref(void *data) } } -void *thread_cqueue(void *data) +static void *thread_cqueue(void *data) { Toxic *toxic = (Toxic *) data; @@ -1299,7 +1299,7 @@ void *thread_cqueue(void *data) } #ifdef AUDIO -void *thread_av(void *data) +static void *thread_av(void *data) { ToxAV *av = (ToxAV *) data; diff --git a/src/video_call.c b/src/video_call.c index 69c4e888d..d9e4eaf93 100644 --- a/src/video_call.c +++ b/src/video_call.c @@ -101,8 +101,8 @@ void terminate_video(void) terminate_video_devices(); } -void read_video_device_callback(Toxic *toxic, int16_t width, int16_t height, const uint8_t *y, const uint8_t *u, - const uint8_t *v, void *data) +static void read_video_device_callback(Toxic *toxic, int16_t width, int16_t height, const uint8_t *y, const uint8_t *u, + const uint8_t *v, void *data) { if (toxic == NULL) { return; @@ -132,10 +132,10 @@ void read_video_device_callback(Toxic *toxic, int16_t width, int16_t height, con } } -void write_video_device_callback(uint32_t friend_number, uint16_t width, uint16_t height, - uint8_t const *y, uint8_t const *u, uint8_t const *v, - int32_t ystride, int32_t ustride, int32_t vstride, - void *user_data) +static void write_video_device_callback(uint32_t friend_number, uint16_t width, uint16_t height, + uint8_t const *y, uint8_t const *u, uint8_t const *v, + int32_t ystride, int32_t ustride, int32_t vstride, + void *user_data) { UNUSED_VAR(friend_number); @@ -246,7 +246,7 @@ void callback_recv_video_end(uint32_t friend_number) close_video_device(vdt_output, this_call->vout_idx); this_call->vout_idx = -1; } -void callback_video_starting(Toxic *toxic, uint32_t friend_number) +static void callback_video_starting(Toxic *toxic, uint32_t friend_number) { Call *this_call = &CallControl.calls[friend_number];