From 34bd4a1c7c1bc936d2daa5078af0f288008c6f99 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Sat, 21 Jun 2014 21:41:38 -0400 Subject: [PATCH] fix a bunch of implicit declarations --- build/Makefile.am | 3 ++- src/audio_call.h | 1 + src/chat.c | 4 +++- src/chat_commands.c | 1 + src/execute.c | 1 + src/file_senders.c | 1 + src/global_commands.c | 3 +++ src/groupchat.c | 4 +++- src/misc_tools.c | 1 + src/misc_tools.h | 3 +++ src/prompt.c | 1 + src/toxic.c | 1 + src/toxic.h | 2 ++ src/toxic_strings.c | 4 ++-- src/windows.c | 3 +++ src/windows.h | 4 ++++ 16 files changed, 32 insertions(+), 5 deletions(-) diff --git a/build/Makefile.am b/build/Makefile.am index 919987e..25c6083 100644 --- a/build/Makefile.am +++ b/build/Makefile.am @@ -62,7 +62,8 @@ toxic_SOURCES += $(top_srcdir)/src/audio_call.c \ $(top_srcdir)/src/audio_call.h toxic_CFLAGS += $(LIBTOXAV_CFLAGS) \ - $(OPENAL_CFLAGS) + $(OPENAL_CFLAGS) \ + -Wimplicit-function-declaration toxic_LDADD += $(LIBTOXAV_LIBS) \ $(OPENAL_LIBS) diff --git a/src/audio_call.h b/src/audio_call.h index 7583eb4..f360aae 100644 --- a/src/audio_call.h +++ b/src/audio_call.h @@ -51,6 +51,7 @@ void terminate_audio(); int errors(); int start_transmission(ToxWindow *self); +int stop_transmission(int call_index); int device_set(ToxWindow *self, _Devices type, long int selection); #endif /* _audio_h */ diff --git a/src/chat.c b/src/chat.c index 6106e96..443ace5 100644 --- a/src/chat.c +++ b/src/chat.c @@ -20,6 +20,8 @@ * */ +#define _GNU_SOURCE /* needed for strcasestr() and wcwidth() */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -27,6 +29,7 @@ #include #include #include +#include #include "toxic.h" #include "windows.h" @@ -43,7 +46,6 @@ #endif /* _SUPPORT_AUDIO */ extern char *DATA_FILE; -extern int store_data(Tox *m, char *path); extern FileSender file_senders[MAX_FILES]; extern ToxicFriend friends[MAX_FRIENDS_NUM]; diff --git a/src/chat_commands.c b/src/chat_commands.c index fc4e1c6..a92d867 100644 --- a/src/chat_commands.c +++ b/src/chat_commands.c @@ -33,6 +33,7 @@ #include "friendlist.h" #include "execute.h" #include "line_info.h" +#include "groupchat.h" extern ToxWindow *prompt; diff --git a/src/execute.c b/src/execute.c index 0775293..a383c8e 100644 --- a/src/execute.c +++ b/src/execute.c @@ -34,6 +34,7 @@ #include "chat_commands.h" #include "global_commands.h" #include "line_info.h" +#include "misc_tools.h" struct cmd_func { const char *name; diff --git a/src/file_senders.c b/src/file_senders.c index 4d12a54..43836ca 100644 --- a/src/file_senders.c +++ b/src/file_senders.c @@ -32,6 +32,7 @@ #include "windows.h" #include "file_senders.h" #include "line_info.h" +#include "misc_tools.h" FileSender file_senders[MAX_FILES]; uint8_t max_file_senders_index; diff --git a/src/global_commands.c b/src/global_commands.c index cb0aa52..5df4f68 100644 --- a/src/global_commands.c +++ b/src/global_commands.c @@ -26,6 +26,7 @@ #include #include +#include #include "toxic.h" #include "windows.h" @@ -34,6 +35,8 @@ #include "log.h" #include "line_info.h" #include "dns.h" +#include "groupchat.h" +#include "prompt.h" extern char *DATA_FILE; extern ToxWindow *prompt; diff --git a/src/groupchat.c b/src/groupchat.c index f81fea8..d89eebd 100644 --- a/src/groupchat.c +++ b/src/groupchat.c @@ -20,6 +20,8 @@ * */ +#define _GNU_SOURCE /* needed for strcasestr() and wcwidth() */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -27,6 +29,7 @@ #include #include #include +#include #include "windows.h" #include "toxic.h" @@ -40,7 +43,6 @@ #include "settings.h" extern char *DATA_FILE; -extern int store_data(Tox *m, char *path); static GroupChat groupchats[MAX_GROUPCHAT_NUM]; static int max_groupchat_index = 0; diff --git a/src/misc_tools.c b/src/misc_tools.c index 15641b1..01cf96a 100644 --- a/src/misc_tools.c +++ b/src/misc_tools.c @@ -25,6 +25,7 @@ #endif #include +#include #include #include #include diff --git a/src/misc_tools.h b/src/misc_tools.h index 87908f7..7bbcc1f 100644 --- a/src/misc_tools.h +++ b/src/misc_tools.h @@ -58,6 +58,9 @@ int char_to_wcs_buf(wchar_t *buf, const uint8_t *string, size_t n); Same thing as wcs_to_mbs() but caller must provide its own buffer */ int wcs_to_mbs_buf(uint8_t *buf, const wchar_t *string, size_t n); +/* convert a multibyte string to a wide character string (must provide buffer) */ +int mbs_to_wcs_buf(wchar_t *buf, const uint8_t *string, size_t n); + /* convert wide characters to multibyte string: string returned must be free'd */ uint8_t *wcs_to_mbs(wchar_t *string); diff --git a/src/prompt.c b/src/prompt.c index 3609574..408ee05 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -26,6 +26,7 @@ #include #include +#include #include "toxic.h" #include "windows.h" diff --git a/src/toxic.c b/src/toxic.c index 582e4dd..45871a9 100644 --- a/src/toxic.c +++ b/src/toxic.c @@ -57,6 +57,7 @@ #include "file_senders.h" #include "line_info.h" #include "settings.h" +#include "log.h" #ifdef _SUPPORT_AUDIO #include "audio_call.h" diff --git a/src/toxic.h b/src/toxic.h index 1a78e64..1d5c52d 100644 --- a/src/toxic.h +++ b/src/toxic.h @@ -78,6 +78,8 @@ typedef enum _FATAL_ERRS { void exit_toxic_success(Tox *m); void exit_toxic_err(const char *errmsg, int errcode); +int store_data(Tox *m, char *path); + void on_request(Tox *m, const uint8_t *public_key, const uint8_t *data, uint16_t length, void *userdata); void on_connectionchange(Tox *m, int32_t friendnumber, uint8_t status, void *userdata); void on_message(Tox *m, int32_t friendnumber, uint8_t *string, uint16_t length, void *userdata); diff --git a/src/toxic_strings.c b/src/toxic_strings.c index c1a08b6..a77d540 100644 --- a/src/toxic_strings.c +++ b/src/toxic_strings.c @@ -47,7 +47,7 @@ void add_char_to_buf(ChatContext *ctx, wint_t ch) /* Deletes the character before pos */ void del_char_buf_bck(ChatContext *ctx) { - if (ctx->pos <= 0) + if (ctx->pos == 0) return; wmemmove(&ctx->line[ctx->pos - 1], &ctx->line[ctx->pos], ctx->len - ctx->pos); @@ -58,7 +58,7 @@ void del_char_buf_bck(ChatContext *ctx) /* Deletes the character at pos */ void del_char_buf_frnt(ChatContext *ctx) { - if (ctx->pos < 0 || ctx->pos >= ctx->len) + if (ctx->pos >= ctx->len) return; wmemmove(&ctx->line[ctx->pos], &ctx->line[ctx->pos + 1], ctx->len - ctx->pos - 1); diff --git a/src/windows.c b/src/windows.c index 1295248..47a56b8 100644 --- a/src/windows.c +++ b/src/windows.c @@ -27,12 +27,15 @@ #include #include #include +#include #include "friendlist.h" #include "prompt.h" #include "toxic.h" #include "windows.h" #include "groupchat.h" +#include "chat.h" +#include "line_info.h" extern char *DATA_FILE; extern struct _Winthread Winthread; diff --git a/src/windows.h b/src/windows.h index 551af40..a32d922 100644 --- a/src/windows.h +++ b/src/windows.h @@ -179,4 +179,8 @@ int get_num_active_windows(void); void kill_all_windows(void); /* should only be called on shutdown */ void on_window_resize(int sig); +/* refresh inactive windows to prevent scrolling bugs. + call at least once per second */ +void refresh_inactive_windows(void); + #endif /* #define _windows_h */