1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-23 03:13:25 +01:00

Some misc fixes

This commit is contained in:
jfreegman 2020-02-29 14:14:56 -05:00
parent b080236ee5
commit 437dd8baeb
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
7 changed files with 18 additions and 10 deletions

View File

@ -6,7 +6,7 @@ CFG_DIR = $(BASE_DIR)/cfg
LIBS = toxcore ncursesw libconfig libcurl
CFLAGS ?= -g
CFLAGS += -std=gnu99 -pthread -Wall -fstack-protector-all
CFLAGS += -std=gnu99 -pthread -Wall -Wpedantic -fstack-protector-all
CFLAGS += '-DTOXICVER="$(VERSION)"' -DHAVE_WIDECHAR -D_XOPEN_SOURCE_EXTENDED -D_FILE_OFFSET_BITS=64
CFLAGS += '-DPACKAGE_DATADIR="$(abspath $(DATADIR))"'
CFLAGS += ${USER_CFLAGS}

View File

@ -112,7 +112,7 @@ int avatar_set(Tox *m, const char *path, size_t path_len)
return -1;
}
char PNG_signature[8] = {0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A};
unsigned char PNG_signature[8] = {0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A};
if (check_file_signature(PNG_signature, sizeof(PNG_signature), fp) != 0) {
fclose(fp);

View File

@ -301,7 +301,7 @@ static void group_update_name_list(uint32_t groupnum)
{
GroupChat *chat = &groupchats[groupnum];
if (!chat) {
if (!chat->active) {
return;
}
@ -359,7 +359,7 @@ static void update_peer_list(Tox *m, uint32_t groupnum, uint32_t num_peers)
{
GroupChat *chat = &groupchats[groupnum];
if (!chat) {
if (!chat->active) {
return;
}
@ -403,6 +403,11 @@ static void groupchat_onGroupNameListChange(ToxWindow *self, Tox *m, uint32_t gr
}
GroupChat *chat = &groupchats[groupnum];
if (!chat->active) {
return;
}
Tox_Err_Conference_Peer_Query err;
uint32_t num_peers = tox_conference_peer_count(m, groupnum, &err);
@ -427,7 +432,7 @@ static void groupchat_onGroupPeerNameChange(ToxWindow *self, Tox *m, uint32_t gr
GroupChat *chat = &groupchats[groupnum];
if (!chat) {
if (!chat->active) {
return;
}

View File

@ -381,7 +381,7 @@ void line_info_print(ToxWindow *self)
if (type == OUT_MSG && timed_out(line->timestamp, NOREAD_FLAG_TIMEOUT)) {
wattron(win, COLOR_PAIR(RED));
wprintw(win, " x", line->msg);
wprintw(win, " x");
wattroff(win, COLOR_PAIR(RED));
if (line->noread_flag == false) {

View File

@ -491,7 +491,10 @@ bool file_exists(const char *path)
File_Type file_type(const char *path)
{
struct stat s;
stat(path, &s);
if (stat(path, &s) == -1) {
return FILE_TYPE_OTHER;
}
switch (s.st_mode & S_IFMT) {
case S_IFDIR:
@ -521,7 +524,7 @@ off_t file_size(const char *path)
Returns 0 if they are the same, 1 if they differ, and -1 on error.
On success this function will seek back to the beginning of fp */
int check_file_signature(const char *signature, size_t size, FILE *fp)
int check_file_signature(const unsigned char *signature, size_t size, FILE *fp)
{
char buf[size];

View File

@ -169,7 +169,7 @@ off_t file_size(const char *path);
Returns 0 if they are the same, 1 if they differ, and -1 on error.
On success this function will seek back to the beginning of fp */
int check_file_signature(const char *signature, size_t size, FILE *fp);
int check_file_signature(const unsigned char *signature, size_t size, FILE *fp);
/* sets window title in tab bar. */
void set_window_title(ToxWindow *self, const char *title, int len);

View File

@ -292,7 +292,7 @@ void *lookup_thread_func(void *data)
int proxy_ret = set_curl_proxy(c_handle, arg_opts.proxy_address, arg_opts.proxy_port, arg_opts.proxy_type);
if (proxy_ret != 0) {
lookup_error(self, "Failed to set proxy (error %d)\n");
lookup_error(self, "Failed to set proxy (error %d)\n", proxy_ret);
goto on_exit;
}