From ef097757f3f80d5981db2d1527ed8e21948706e7 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Tue, 24 Jun 2014 17:45:14 -0400 Subject: [PATCH] general cleanup: rm unused config.h, add license info to device.c/h, add a couple compiler options and fix warnings --- src/audio_call.c | 9 +++++---- src/chat.c | 4 ---- src/chat_commands.c | 4 ---- src/configdir.c | 4 ---- src/device.c | 23 ++++++++++++++++++++++- src/device.h | 23 ++++++++++++++++++++--- src/dns.c | 5 +---- src/execute.c | 4 ---- src/file_senders.c | 3 --- src/friendlist.c | 4 ---- src/global_commands.c | 4 ---- src/groupchat.c | 4 ---- src/line_info.c | 4 ---- src/log.c | 4 ---- src/misc_tools.c | 4 ---- src/prompt.c | 4 ---- src/settings.c | 4 ---- src/toxic.c | 8 ++++---- src/toxic_strings.c | 6 +----- src/windows.c | 4 ---- 20 files changed, 53 insertions(+), 76 deletions(-) diff --git a/src/audio_call.c b/src/audio_call.c index 75d342f..7f98077 100644 --- a/src/audio_call.c +++ b/src/audio_call.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "toxic.h" #include "windows.h" #include "audio_call.h" @@ -258,6 +254,8 @@ int start_transmission(ToxWindow *self) 0 != pthread_detach(ASettins.calls[self->call_idx].ttid) ) { return -1; } + + return 0; } int stop_transmission(int call_index) @@ -265,7 +263,10 @@ int stop_transmission(int call_index) if ( ASettins.calls[call_index].ttas ) { toxav_kill_transmission(ASettins.av, call_index); ASettins.calls[call_index].ttas = _False; + return 0; } + + return -1; } /* * End of transmission diff --git a/src/chat.c b/src/chat.c index 7254841..eacfc41 100644 --- a/src/chat.c +++ b/src/chat.c @@ -24,10 +24,6 @@ #define _GNU_SOURCE /* needed for strcasestr() and wcwidth() */ #endif -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/src/chat_commands.c b/src/chat_commands.c index 8e8202f..4835a06 100644 --- a/src/chat_commands.c +++ b/src/chat_commands.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/src/configdir.c b/src/configdir.c index f569ca9..251f0df 100644 --- a/src/configdir.c +++ b/src/configdir.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/src/device.c b/src/device.c index 1c70f78..77776c9 100644 --- a/src/device.c +++ b/src/device.c @@ -1,7 +1,28 @@ +/* device.c + * + * + * Copyright (C) 2014 Toxic All Rights Reserved. + * + * This file is part of Toxic. + * + * Toxic is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Toxic is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Toxic. If not, see . + * + */ + #include "audio_call.h" #include "line_info.h" - #ifdef __APPLE__ #include #include diff --git a/src/device.h b/src/device.h index 9715854..6b8e062 100644 --- a/src/device.h +++ b/src/device.h @@ -1,5 +1,23 @@ -/* - * Toxic -- Tox Curses Client +/* device.h + * + * + * Copyright (C) 2014 Toxic All Rights Reserved. + * + * This file is part of Toxic. + * + * Toxic is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Toxic is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Toxic. If not, see . + * */ /* @@ -8,7 +26,6 @@ * Read from running input device(s) via select()/callback combo. */ - #ifndef _device_h #define _device_h diff --git a/src/dns.c b/src/dns.c index b06bf0a..c582c5f 100644 --- a/src/dns.c +++ b/src/dns.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include @@ -284,6 +280,7 @@ void *dns3_lookup_thread(void *data) pthread_mutex_unlock(&dns_thread.lock); kill_dns_thread(dns_obj); + return 0; } /* creates new thread for dns3 lookup. Only allows one lookup at a time. */ diff --git a/src/execute.c b/src/execute.c index f85fd63..92fa9f5 100644 --- a/src/execute.c +++ b/src/execute.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/src/file_senders.c b/src/file_senders.c index 43836ca..31f09e8 100644 --- a/src/file_senders.c +++ b/src/file_senders.c @@ -20,9 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif #include #include diff --git a/src/friendlist.c b/src/friendlist.c index 22dbc49..13cff65 100644 --- a/src/friendlist.c +++ b/src/friendlist.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/src/global_commands.c b/src/global_commands.c index 5df4f68..984b668 100644 --- a/src/global_commands.c +++ b/src/global_commands.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/src/groupchat.c b/src/groupchat.c index afa8e30..f9f9aa2 100644 --- a/src/groupchat.c +++ b/src/groupchat.c @@ -24,10 +24,6 @@ #define _GNU_SOURCE /* needed for strcasestr() and wcwidth() */ #endif -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/src/line_info.c b/src/line_info.c index 42d617f..aecceb8 100644 --- a/src/line_info.c +++ b/src/line_info.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/src/log.c b/src/log.c index d965895..4e9bbf3 100644 --- a/src/log.c +++ b/src/log.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/src/misc_tools.c b/src/misc_tools.c index 568724a..b78af80 100644 --- a/src/misc_tools.c +++ b/src/misc_tools.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/src/prompt.c b/src/prompt.c index 21cb547..f172c34 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/src/settings.c b/src/settings.c index 8964723..9b00660 100644 --- a/src/settings.c +++ b/src/settings.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/src/toxic.c b/src/toxic.c index 4a4a097..ad81b0a 100644 --- a/src/toxic.c +++ b/src/toxic.c @@ -20,14 +20,14 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifndef SIGWINCH #define SIGWINCH 28 #endif +#ifndef SIGINT +#define SIGINT 2 +#endif + #include #include #include diff --git a/src/toxic_strings.c b/src/toxic_strings.c index a77d540..c405d03 100644 --- a/src/toxic_strings.c +++ b/src/toxic_strings.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include @@ -36,7 +32,7 @@ /* Adds char to line at pos */ void add_char_to_buf(ChatContext *ctx, wint_t ch) { - if (ctx->pos < 0 || ctx->len >= MAX_STR_SIZE) + if (ctx->len >= MAX_STR_SIZE) return; wmemmove(&ctx->line[ctx->pos + 1], &ctx->line[ctx->pos], ctx->len - ctx->pos); diff --git a/src/windows.c b/src/windows.c index 47a56b8..d94db59 100644 --- a/src/windows.c +++ b/src/windows.c @@ -20,10 +20,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include