From d62902ffb31290c6d382010a209aaf31b44bbe78 Mon Sep 17 00:00:00 2001 From: iphydf Date: Thu, 13 Sep 2018 23:47:47 +0000 Subject: [PATCH] Use (void) in prototypes instead of (). Also, removed `__inline` from an extern function (why was it there?). Also, moved one extern declaration to a header file. There are lots of these that need to be moved, but one thing at a time. --- src/audio_call.h | 2 +- src/audio_device.h | 6 +++--- src/chat.c | 2 +- src/chat_commands.c | 2 +- src/global_commands.c | 3 +-- src/groupchat.c | 4 ++-- src/input.h | 2 +- src/name_lookup.c | 2 +- src/notify.c | 4 ++-- src/notify.h | 2 +- src/osx_video.h | 4 ++-- src/prompt.c | 2 +- src/prompt.h | 2 ++ src/term_mplex.h | 4 ++-- src/toxic.h | 4 ++-- src/video_call.h | 2 +- src/video_device.c | 2 +- src/video_device.h | 6 +++--- src/xtra.h | 8 ++++---- 19 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/audio_call.h b/src/audio_call.h index 7256924..7d5b289 100644 --- a/src/audio_call.h +++ b/src/audio_call.h @@ -85,7 +85,7 @@ extern struct CallControl CallControl; /* You will have to pass pointer to first member of 'windows' declared in windows.c */ ToxAV *init_audio(ToxWindow *self, Tox *tox); -void terminate_audio(); +void terminate_audio(void); int start_transmission(ToxWindow *self, Call *call); int stop_transmission(Call *call, uint32_t friend_number); void stop_current_call(ToxWindow *self); diff --git a/src/audio_device.h b/src/audio_device.h index bd01bc8..267f1d5 100644 --- a/src/audio_device.h +++ b/src/audio_device.h @@ -58,11 +58,11 @@ typedef void (*DataHandleCallback)(const int16_t *, uint32_t size, void *data); #ifdef AUDIO DeviceError init_devices(ToxAV *av); #else -DeviceError init_devices(); +DeviceError init_devices(void); #endif /* AUDIO */ -void get_devices_names(); -DeviceError terminate_devices(); +void get_devices_names(void); +DeviceError terminate_devices(void); /* Callback handles ready data from INPUT device */ DeviceError register_device_callback(int32_t friend_number, uint32_t device_idx, DataHandleCallback callback, diff --git a/src/chat.c b/src/chat.c index 21a3efd..49a35ba 100644 --- a/src/chat.c +++ b/src/chat.c @@ -936,7 +936,7 @@ static void draw_infobox(ToxWindow *self) wattron(infobox->win, A_BOLD); wprintw(infobox->win, " VAD level: "); wattroff(infobox->win, A_BOLD); - wprintw(infobox->win, "%.2f\n", infobox->vad_lvl); + wprintw(infobox->win, "%.2f\n", (double) infobox->vad_lvl); wborder(infobox->win, ACS_VLINE, ' ', ACS_HLINE, ACS_HLINE, ACS_TTEE, ' ', ACS_LLCORNER, ' '); wnoutrefresh(infobox->win); diff --git a/src/chat_commands.c b/src/chat_commands.c index 2d0ebe9..0529f01 100644 --- a/src/chat_commands.c +++ b/src/chat_commands.c @@ -125,7 +125,7 @@ void cmd_join_group(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*ar TOX_ERR_CONFERENCE_JOIN err; - uint32_t groupnum = tox_conference_join(m, self->num, (uint8_t *) groupkey, length, &err); + uint32_t groupnum = tox_conference_join(m, self->num, (const uint8_t *) groupkey, length, &err); if (err != TOX_ERR_CONFERENCE_JOIN_OK) { line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Group chat instance failed to initialize (error %d)", err); diff --git a/src/global_commands.c b/src/global_commands.c index 26b212c..89070d1 100644 --- a/src/global_commands.c +++ b/src/global_commands.c @@ -41,7 +41,6 @@ extern char *DATA_FILE; extern ToxWindow *prompt; extern FriendsList Friends; -extern FriendRequests FrndRequests; /* command functions */ void cmd_accept(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) @@ -94,7 +93,7 @@ void cmd_add_helper(ToxWindow *self, Tox *m, const char *id_bin, const char *msg const char *errmsg; TOX_ERR_FRIEND_ADD err; - uint32_t f_num = tox_friend_add(m, (uint8_t *) id_bin, (uint8_t *) msg, strlen(msg), &err); + uint32_t f_num = tox_friend_add(m, (const uint8_t *) id_bin, (const uint8_t *) msg, strlen(msg), &err); switch (err) { case TOX_ERR_FRIEND_ADD_TOO_LONG: diff --git a/src/groupchat.c b/src/groupchat.c index 36a7061..b348759 100644 --- a/src/groupchat.c +++ b/src/groupchat.c @@ -439,10 +439,10 @@ static void groupchat_onGroupPeerNameChange(ToxWindow *self, Tox *m, uint32_t gr get_time_str(timefrmt, sizeof(timefrmt)); char tmp_event[TOXIC_MAX_NAME_LENGTH * 2 + 32]; - snprintf(tmp_event, sizeof(tmp_event), "is now known as %s", (char *) name); + snprintf(tmp_event, sizeof(tmp_event), "is now known as %s", (const char *) name); write_to_log(tmp_event, peer->name, ctx->log, true); - line_info_add(self, timefrmt, peer->name, (char *) name, NAME_CHANGE, 0, 0, " is now known as "); + line_info_add(self, timefrmt, peer->name, (const char *) name, NAME_CHANGE, 0, 0, " is now known as "); break; } diff --git a/src/input.h b/src/input.h index 18d0fa6..72d6b3c 100644 --- a/src/input.h +++ b/src/input.h @@ -30,4 +30,4 @@ void input_new_char(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_ return true if key matches a function, false otherwise */ bool input_handle(ToxWindow *self, wint_t key, int x, int y, int mx_x, int mx_y); -#endif /* #define INPUT_H */ \ No newline at end of file +#endif /* #define INPUT_H */ diff --git a/src/name_lookup.c b/src/name_lookup.c index 2032367..06c3ef9 100644 --- a/src/name_lookup.c +++ b/src/name_lookup.c @@ -42,7 +42,7 @@ extern struct Winthread Winthread; #define MAX_DOMAIN_SIZE 32 #define MAX_SERVER_LINE MAX_DOMAIN_SIZE + (SERVER_KEY_SIZE * 2) + 3 -struct Nameservers { +static struct Nameservers { int lines; char names[MAX_SERVERS][MAX_DOMAIN_SIZE]; char keys[MAX_SERVERS][SERVER_KEY_SIZE]; diff --git a/src/notify.c b/src/notify.c index 3a7e660..aaddbbf 100644 --- a/src/notify.c +++ b/src/notify.c @@ -64,7 +64,7 @@ extern struct user_settings *user_settings; -struct Control { +static struct Control { time_t cooldown; time_t notif_timeout; @@ -79,7 +79,7 @@ struct Control { #endif /* SOUND_NOTIFY */ } Control = {0}; -struct _ActiveNotifications { +static struct _ActiveNotifications { #ifdef SOUND_NOTIFY uint32_t source; uint32_t buffer; diff --git a/src/notify.h b/src/notify.h index 71e65d8..859fff9 100644 --- a/src/notify.h +++ b/src/notify.h @@ -60,7 +60,7 @@ typedef enum _Flags { } Flags; int init_notify(int login_cooldown, int notification_timeout); -void terminate_notify(); +void terminate_notify(void); int sound_notify(ToxWindow *self, Notification notif, uint64_t flags, int *id_indicator); int sound_notify2(ToxWindow *self, Notification notif, uint64_t flags, int id); diff --git a/src/osx_video.h b/src/osx_video.h index 4a04b67..da00389 100644 --- a/src/osx_video.h +++ b/src/osx_video.h @@ -45,7 +45,7 @@ void bgrtoyuv420(uint8_t *plane_y, uint8_t *plane_u, uint8_t *plane_v, uint8_t * #endif /* __OBJC__ */ int osx_video_init(char **device_names, int *size); -void osx_video_release(); +void osx_video_release(void); /* Start device */ int osx_video_open_device(uint32_t selection, uint16_t *width, uint16_t *height); /* Stop device */ @@ -54,4 +54,4 @@ void osx_video_close_device(uint32_t device_idx); int osx_video_read_device(uint8_t *y, uint8_t *u, uint8_t *v, uint16_t *width, uint16_t *height); -#endif /* OSX_VIDEO_H */ \ No newline at end of file +#endif /* OSX_VIDEO_H */ diff --git a/src/prompt.c b/src/prompt.c index d5cc63d..43221d5 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -160,7 +160,7 @@ void prompt_update_statusmessage(ToxWindow *prompt, Tox *m, const char *statusms statusbar->statusmsg_len = len; TOX_ERR_SET_INFO err; - tox_self_set_status_message(m, (uint8_t *) statusmsg, len, &err); + tox_self_set_status_message(m, (const uint8_t *) statusmsg, len, &err); if (err != TOX_ERR_SET_INFO_OK) { line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, "Failed to set note (error %d)\n", err); diff --git a/src/prompt.h b/src/prompt.h index 9a8f19c..46be773 100644 --- a/src/prompt.h +++ b/src/prompt.h @@ -40,6 +40,8 @@ typedef struct { struct friend_request request[MAX_FRIEND_REQUESTS]; } FriendRequests; +extern FriendRequests FrndRequests; + ToxWindow new_prompt(void); void prep_prompt_win(void); diff --git a/src/term_mplex.h b/src/term_mplex.h index cab03ea..0128291 100644 --- a/src/term_mplex.h +++ b/src/term_mplex.h @@ -29,7 +29,7 @@ */ int init_mplex_away_timer(Tox *m); -void lock_status(); -void unlock_status(); +void lock_status(void); +void unlock_status(void); #endif /* #define TERM_MPLEX_H */ diff --git a/src/toxic.h b/src/toxic.h index 793dda7..b437e82 100644 --- a/src/toxic.h +++ b/src/toxic.h @@ -96,8 +96,8 @@ typedef enum _FATAL_ERRS { Uncomment if necessary */ /* #define URXVT_FIX */ -void lock_status(); -void unlock_status(); +void lock_status(void); +void unlock_status(void); void exit_toxic_success(Tox *m); void exit_toxic_err(const char *errmsg, int errcode); diff --git a/src/video_call.h b/src/video_call.h index 9cb8394..d9868f3 100644 --- a/src/video_call.h +++ b/src/video_call.h @@ -31,7 +31,7 @@ /* You will have to pass pointer to first member of 'windows' declared in windows.c */ ToxAV *init_video(ToxWindow *self, Tox *tox); -void terminate_video(); +void terminate_video(void); int start_video_transmission(ToxWindow *self, ToxAV *av, Call *call); int stop_video_transmission(Call *call, int friend_number); void stop_video_stream(ToxWindow *self); diff --git a/src/video_device.c b/src/video_device.c index 7dc788e..2fc2b46 100644 --- a/src/video_device.c +++ b/src/video_device.c @@ -591,7 +591,7 @@ VideoDeviceError open_video_device(VideoDeviceType type, int32_t selection, uint return vde_None; } -__inline VideoDeviceError write_video_out(uint16_t width, uint16_t height, +VideoDeviceError write_video_out(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) diff --git a/src/video_device.h b/src/video_device.h index 12a5664..672df8f 100644 --- a/src/video_device.h +++ b/src/video_device.h @@ -51,10 +51,10 @@ typedef void (*VideoDataHandleCallback)(int16_t width, int16_t height, const uin #ifdef VIDEO VideoDeviceError init_video_devices(ToxAV *av); #else -VideoDeviceError init_video_devices(); +VideoDeviceError init_video_devices(void); #endif /* VIDEO */ -VideoDeviceError terminate_video_devices(); +VideoDeviceError terminate_video_devices(void); /* Callback handles ready data from INPUT device */ VideoDeviceError register_video_device_callback(int32_t call_idx, uint32_t device_idx, VideoDataHandleCallback callback, @@ -76,4 +76,4 @@ void print_video_devices(ToxWindow *self, VideoDeviceType type); void get_primary_video_device_name(VideoDeviceType type, char *buf, int size); VideoDeviceError video_selection_valid(VideoDeviceType type, int32_t selection); -#endif /* VIDEO_DEVICE_H */ \ No newline at end of file +#endif /* VIDEO_DEVICE_H */ diff --git a/src/xtra.h b/src/xtra.h index 0a4bd00..e9329e9 100644 --- a/src/xtra.h +++ b/src/xtra.h @@ -34,8 +34,8 @@ DropType; typedef void (*drop_callback)(const char *, DropType); int init_xtra(drop_callback d); -void terminate_xtra(); -long unsigned int focused_window_id(); -int is_focused(); /* returns bool */ +void terminate_xtra(void); +long unsigned int focused_window_id(void); +int is_focused(void); /* returns bool */ -#endif /* XTRA_H */ \ No newline at end of file +#endif /* XTRA_H */