mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 20:53:01 +01:00
Some misc fixes
This commit is contained in:
parent
b080236ee5
commit
437dd8baeb
2
Makefile
2
Makefile
@ -6,7 +6,7 @@ CFG_DIR = $(BASE_DIR)/cfg
|
|||||||
LIBS = toxcore ncursesw libconfig libcurl
|
LIBS = toxcore ncursesw libconfig libcurl
|
||||||
|
|
||||||
CFLAGS ?= -g
|
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 += '-DTOXICVER="$(VERSION)"' -DHAVE_WIDECHAR -D_XOPEN_SOURCE_EXTENDED -D_FILE_OFFSET_BITS=64
|
||||||
CFLAGS += '-DPACKAGE_DATADIR="$(abspath $(DATADIR))"'
|
CFLAGS += '-DPACKAGE_DATADIR="$(abspath $(DATADIR))"'
|
||||||
CFLAGS += ${USER_CFLAGS}
|
CFLAGS += ${USER_CFLAGS}
|
||||||
|
@ -112,7 +112,7 @@ int avatar_set(Tox *m, const char *path, size_t path_len)
|
|||||||
return -1;
|
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) {
|
if (check_file_signature(PNG_signature, sizeof(PNG_signature), fp) != 0) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
@ -301,7 +301,7 @@ static void group_update_name_list(uint32_t groupnum)
|
|||||||
{
|
{
|
||||||
GroupChat *chat = &groupchats[groupnum];
|
GroupChat *chat = &groupchats[groupnum];
|
||||||
|
|
||||||
if (!chat) {
|
if (!chat->active) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ static void update_peer_list(Tox *m, uint32_t groupnum, uint32_t num_peers)
|
|||||||
{
|
{
|
||||||
GroupChat *chat = &groupchats[groupnum];
|
GroupChat *chat = &groupchats[groupnum];
|
||||||
|
|
||||||
if (!chat) {
|
if (!chat->active) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,6 +403,11 @@ static void groupchat_onGroupNameListChange(ToxWindow *self, Tox *m, uint32_t gr
|
|||||||
}
|
}
|
||||||
|
|
||||||
GroupChat *chat = &groupchats[groupnum];
|
GroupChat *chat = &groupchats[groupnum];
|
||||||
|
|
||||||
|
if (!chat->active) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Tox_Err_Conference_Peer_Query err;
|
Tox_Err_Conference_Peer_Query err;
|
||||||
|
|
||||||
uint32_t num_peers = tox_conference_peer_count(m, groupnum, &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];
|
GroupChat *chat = &groupchats[groupnum];
|
||||||
|
|
||||||
if (!chat) {
|
if (!chat->active) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ void line_info_print(ToxWindow *self)
|
|||||||
|
|
||||||
if (type == OUT_MSG && timed_out(line->timestamp, NOREAD_FLAG_TIMEOUT)) {
|
if (type == OUT_MSG && timed_out(line->timestamp, NOREAD_FLAG_TIMEOUT)) {
|
||||||
wattron(win, COLOR_PAIR(RED));
|
wattron(win, COLOR_PAIR(RED));
|
||||||
wprintw(win, " x", line->msg);
|
wprintw(win, " x");
|
||||||
wattroff(win, COLOR_PAIR(RED));
|
wattroff(win, COLOR_PAIR(RED));
|
||||||
|
|
||||||
if (line->noread_flag == false) {
|
if (line->noread_flag == false) {
|
||||||
|
@ -491,7 +491,10 @@ bool file_exists(const char *path)
|
|||||||
File_Type file_type(const char *path)
|
File_Type file_type(const char *path)
|
||||||
{
|
{
|
||||||
struct stat s;
|
struct stat s;
|
||||||
stat(path, &s);
|
|
||||||
|
if (stat(path, &s) == -1) {
|
||||||
|
return FILE_TYPE_OTHER;
|
||||||
|
}
|
||||||
|
|
||||||
switch (s.st_mode & S_IFMT) {
|
switch (s.st_mode & S_IFMT) {
|
||||||
case S_IFDIR:
|
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.
|
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 */
|
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];
|
char buf[size];
|
||||||
|
|
||||||
|
@ -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.
|
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 */
|
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. */
|
/* sets window title in tab bar. */
|
||||||
void set_window_title(ToxWindow *self, const char *title, int len);
|
void set_window_title(ToxWindow *self, const char *title, int len);
|
||||||
|
@ -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);
|
int proxy_ret = set_curl_proxy(c_handle, arg_opts.proxy_address, arg_opts.proxy_port, arg_opts.proxy_type);
|
||||||
|
|
||||||
if (proxy_ret != 0) {
|
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;
|
goto on_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user