1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 20:13:04 +01:00

Use (void) for empty parameter list in C.

This commit is contained in:
iphydf 2018-09-08 17:23:07 +00:00
parent 2be4847b53
commit bebff3be0e
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
10 changed files with 31 additions and 28 deletions

View File

@ -12,6 +12,7 @@ cc_binary(
"-DAUDIO", "-DAUDIO",
"-DPACKAGE_DATADIR='\"data\"'", "-DPACKAGE_DATADIR='\"data\"'",
"-DPYTHON", "-DPYTHON",
"-DQRCODE",
"-DVIDEO", "-DVIDEO",
"-Wno-error=unused-result", "-Wno-error=unused-result",
], ],

View File

@ -155,7 +155,7 @@ ToxAV *init_audio(ToxWindow *self, Tox *tox)
return CallControl.av; return CallControl.av;
} }
void terminate_audio() void terminate_audio(void)
{ {
int i; int i;

View File

@ -97,7 +97,7 @@ void *thread_poll(void *);
#ifdef AUDIO #ifdef AUDIO
DeviceError init_devices(ToxAV *av_) DeviceError init_devices(ToxAV *av_)
#else #else
DeviceError init_devices() DeviceError init_devices(void)
#endif /* AUDIO */ #endif /* AUDIO */
{ {
get_devices_names(); get_devices_names();
@ -120,7 +120,7 @@ DeviceError init_devices()
return (DeviceError) de_None; return (DeviceError) de_None;
} }
DeviceError terminate_devices() DeviceError terminate_devices(void)
{ {
/* Cleanup if needed */ /* Cleanup if needed */
lock; lock;
@ -136,7 +136,7 @@ DeviceError terminate_devices()
return (DeviceError) de_None; return (DeviceError) de_None;
} }
void get_devices_names() void get_devices_names(void)
{ {
const char *stringed_device_list; const char *stringed_device_list;

View File

@ -219,11 +219,13 @@ static void chat_onMessage(ToxWindow *self, Tox *m, uint32_t num, TOX_MESSAGE_TY
get_time_str(timefrmt, sizeof(timefrmt)); get_time_str(timefrmt, sizeof(timefrmt));
if (type == TOX_MESSAGE_TYPE_NORMAL) { if (type == TOX_MESSAGE_TYPE_NORMAL) {
return recv_message_helper(self, m, num, msg, len, nick, timefrmt); recv_message_helper(self, m, num, msg, len, nick, timefrmt);
return;
} }
if (type == TOX_MESSAGE_TYPE_ACTION) { if (type == TOX_MESSAGE_TYPE_ACTION) {
return recv_action_helper(self, m, num, msg, len, nick, timefrmt); recv_action_helper(self, m, num, msg, len, nick, timefrmt);
return;
} }
} }

View File

@ -124,7 +124,7 @@ int hex_string_to_bin(const char *hex_string, size_t hex_len, char *output, size
} }
for (size_t i = 0; i < output_size; ++i) { for (size_t i = 0; i < output_size; ++i) {
sscanf(hex_string, "%2hhx", &output[i]); sscanf(hex_string, "%2hhx", (unsigned char *)&output[i]);
hex_string += 2; hex_string += 2;
} }
@ -141,7 +141,7 @@ int hex_string_to_bytes(char *buf, int size, const char *keystr)
const char *pos = keystr; const char *pos = keystr;
for (i = 0; i < size; ++i) { for (i = 0; i < size; ++i) {
res = sscanf(pos, "%2hhx", &buf[i]); res = sscanf(pos, "%2hhx", (unsigned char *)&buf[i]);
pos += 2; pos += 2;
if (res == EOF || res < 1) { if (res == EOF || res < 1) {

View File

@ -131,14 +131,14 @@ static bool notifications_are_disabled(uint64_t flags)
#endif #endif
} }
static void control_lock() static void control_lock(void)
{ {
#if defined(SOUND_NOTIFY) || defined(BOX_NOTIFY) #if defined(SOUND_NOTIFY) || defined(BOX_NOTIFY)
pthread_mutex_lock(Control.poll_mutex); pthread_mutex_lock(Control.poll_mutex);
#endif #endif
} }
static void control_unlock() static void control_unlock(void)
{ {
#if defined(SOUND_NOTIFY) || defined(BOX_NOTIFY) #if defined(SOUND_NOTIFY) || defined(BOX_NOTIFY)
pthread_mutex_unlock(Control.poll_mutex); pthread_mutex_unlock(Control.poll_mutex);
@ -160,7 +160,7 @@ static bool device_opened = false;
time_t last_opened_update = 0; time_t last_opened_update = 0;
/* Opens primary device. Returns true on succe*/ /* Opens primary device. Returns true on succe*/
void m_open_device() void m_open_device(void)
{ {
last_opened_update = get_unix_time(); last_opened_update = get_unix_time();
@ -174,7 +174,7 @@ void m_open_device()
device_opened = true; device_opened = true;
} }
void m_close_device() void m_close_device(void)
{ {
if (!device_opened) { if (!device_opened) {
return; return;
@ -186,7 +186,7 @@ void m_close_device()
} }
/* Terminate all sounds but wait for them to finish first */ /* Terminate all sounds but wait for them to finish first */
void graceful_clear() void graceful_clear(void)
{ {
control_lock(); control_lock();
@ -367,7 +367,7 @@ void *do_playing(void *_p)
pthread_exit(NULL); pthread_exit(NULL);
} }
void graceful_clear() void graceful_clear(void)
{ {
int i; int i;
control_lock(); control_lock();
@ -431,7 +431,7 @@ int init_notify(int login_cooldown, int notification_timeout)
return 1; return 1;
} }
void terminate_notify() void terminate_notify(void)
{ {
#if defined(SOUND_NOTIFY) || defined(BOX_NOTIFY) #if defined(SOUND_NOTIFY) || defined(BOX_NOTIFY)
control_lock(); control_lock();

View File

@ -80,12 +80,12 @@ static char prev_note [TOX_MAX_STATUS_MESSAGE_LENGTH] = "";
static pthread_mutex_t status_lock; static pthread_mutex_t status_lock;
static pthread_t mplex_tid; static pthread_t mplex_tid;
void lock_status() void lock_status(void)
{ {
pthread_mutex_lock(&status_lock); pthread_mutex_lock(&status_lock);
} }
void unlock_status() void unlock_status(void)
{ {
pthread_mutex_unlock(&status_lock); pthread_mutex_unlock(&status_lock);
} }
@ -148,7 +148,7 @@ static char *extract_socket_path(const char *info)
return strcpy(path, pos); return strcpy(path, pos);
} }
static int detect_gnu_screen() static int detect_gnu_screen(void)
{ {
FILE *session_info_stream = NULL; FILE *session_info_stream = NULL;
char *socket_name = NULL, *socket_path = NULL; char *socket_name = NULL, *socket_path = NULL;
@ -214,7 +214,7 @@ nomplex:
return 0; return 0;
} }
static int detect_tmux() static int detect_tmux(void)
{ {
char *tmux_env = getenv("TMUX"), *pos; char *tmux_env = getenv("TMUX"), *pos;
@ -243,7 +243,7 @@ static int detect_tmux()
Returns 1 if present, 0 otherwise. This value can be used to determine Returns 1 if present, 0 otherwise. This value can be used to determine
whether an auto-away detection timer is needed. whether an auto-away detection timer is needed.
*/ */
static int detect_mplex() static int detect_mplex(void)
{ {
/* try screen, and if fails try tmux */ /* try screen, and if fails try tmux */
return detect_gnu_screen() || detect_tmux(); return detect_gnu_screen() || detect_tmux();
@ -252,7 +252,7 @@ static int detect_mplex()
/* Detects gnu screen session attached/detached by examining permissions of /* Detects gnu screen session attached/detached by examining permissions of
the session's unix socket. the session's unix socket.
*/ */
static int gnu_screen_is_detached() static int gnu_screen_is_detached(void)
{ {
if (mplex != MPLEX_SCREEN) { if (mplex != MPLEX_SCREEN) {
return 0; return 0;
@ -271,7 +271,7 @@ static int gnu_screen_is_detached()
/* Detects tmux attached/detached by getting session data and finding the /* Detects tmux attached/detached by getting session data and finding the
current session's entry. current session's entry.
*/ */
static int tmux_is_detached() static int tmux_is_detached(void)
{ {
if (mplex != MPLEX_TMUX) { if (mplex != MPLEX_TMUX) {
return 0; return 0;
@ -352,7 +352,7 @@ fail:
sample its state and update away status according to attached/detached state sample its state and update away status according to attached/detached state
of the mplex. of the mplex.
*/ */
static int mplex_is_detached() static int mplex_is_detached(void)
{ {
return gnu_screen_is_detached() || tmux_is_detached(); return gnu_screen_is_detached() || tmux_is_detached();
} }

View File

@ -80,7 +80,7 @@ ToxAV *init_video(ToxWindow *self, Tox *tox)
return CallControl.av; return CallControl.av;
} }
void terminate_video() void terminate_video(void)
{ {
int i; int i;

View File

@ -250,7 +250,7 @@ VideoDeviceError init_video_devices()
return (VideoDeviceError) vde_None; return (VideoDeviceError) vde_None;
} }
VideoDeviceError terminate_video_devices() VideoDeviceError terminate_video_devices(void)
{ {
/* Cleanup if needed */ /* Cleanup if needed */
lock; lock;

View File

@ -378,7 +378,7 @@ int init_xtra(drop_callback d)
return 0; return 0;
} }
void terminate_xtra() void terminate_xtra(void)
{ {
if (!Xtra.display || !Xtra.terminal_window) { if (!Xtra.display || !Xtra.terminal_window) {
return; return;
@ -400,7 +400,7 @@ void terminate_xtra()
while (Xtra.display); /* Wait for termination */ while (Xtra.display); /* Wait for termination */
} }
long unsigned int focused_window_id() long unsigned int focused_window_id(void)
{ {
if (!Xtra.display) { if (!Xtra.display) {
return 0; return 0;
@ -414,7 +414,7 @@ long unsigned int focused_window_id()
return focus; return focus;
} }
int is_focused() int is_focused(void)
{ {
return Xtra.proxy_window == focused_window_id() || Xtra.terminal_window == focused_window_id(); return Xtra.proxy_window == focused_window_id() || Xtra.terminal_window == focused_window_id();
} }