1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 02:23:02 +01:00

format fixes

This commit is contained in:
jfreegman 2019-12-07 23:17:02 -05:00
parent ddeca171a0
commit 116bff8cef
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
7 changed files with 17 additions and 15 deletions

View File

@ -219,10 +219,10 @@ static int complete_line_helper(ToxWindow *self, const void *list, size_t n_item
/* If path points to a file with no extension don't append a forward slash */ /* If path points to a file with no extension don't append a forward slash */
if (dir_search && *endchrs == '/') { if (dir_search && *endchrs == '/') {
const char *path_start = strchr(ubuf+1, '/'); const char *path_start = strchr(ubuf + 1, '/');
if (!path_start) { if (!path_start) {
path_start = strchr(ubuf+1, ' '); path_start = strchr(ubuf + 1, ' ');
if (!path_start) { if (!path_start) {
return -1; return -1;
@ -279,7 +279,7 @@ static void complete_home_dir(ToxWindow *self, char *path, int pathsize, const c
char newline[MAX_STR_SIZE]; char newline[MAX_STR_SIZE];
snprintf(newline, sizeof(newline), "%s %s%s", cmd, homedir, path + 1); snprintf(newline, sizeof(newline), "%s %s%s", cmd, homedir, path + 1);
snprintf(path, pathsize, "%s", &newline[cmdlen-1]); snprintf(path, pathsize, "%s", &newline[cmdlen - 1]);
wchar_t wline[MAX_STR_SIZE]; wchar_t wline[MAX_STR_SIZE];

View File

@ -129,7 +129,8 @@ static void kill_groupchat_window(ToxWindow *self)
del_window(self); del_window(self);
} }
int init_groupchat_win(ToxWindow *prompt, Tox *m, uint32_t groupnum, uint8_t type, const char *title, size_t title_length) int init_groupchat_win(ToxWindow *prompt, Tox *m, uint32_t groupnum, uint8_t type, const char *title,
size_t title_length)
{ {
if (groupnum > MAX_GROUPCHAT_NUM) { if (groupnum > MAX_GROUPCHAT_NUM) {
return -1; return -1;

View File

@ -56,7 +56,8 @@ typedef struct {
/* Frees all Toxic associated data structures for a groupchat (does not call tox_conference_delete() ) */ /* Frees all Toxic associated data structures for a groupchat (does not call tox_conference_delete() ) */
void free_groupchat(ToxWindow *self, Tox *m, uint32_t groupnum); void free_groupchat(ToxWindow *self, Tox *m, uint32_t groupnum);
int init_groupchat_win(ToxWindow *prompt, Tox *m, uint32_t groupnum, uint8_t type, const char *title, size_t title_length); int init_groupchat_win(ToxWindow *prompt, Tox *m, uint32_t groupnum, uint8_t type, const char *title,
size_t title_length);
/* destroys and re-creates groupchat window with or without the peerlist */ /* destroys and re-creates groupchat window with or without the peerlist */
void redraw_groupchat_win(ToxWindow *self); void redraw_groupchat_win(ToxWindow *self);

View File

@ -496,11 +496,13 @@ File_Type file_type(const char *path)
switch (s.st_mode & S_IFMT) { switch (s.st_mode & S_IFMT) {
case S_IFDIR: case S_IFDIR:
return FILE_TYPE_DIRECTORY; return FILE_TYPE_DIRECTORY;
case S_IFREG: case S_IFREG:
return FILE_TYPE_REGULAR; return FILE_TYPE_REGULAR;
default: default:
return FILE_TYPE_OTHER; return FILE_TYPE_OTHER;
} }
} }
/* returns file size. If file doesn't exist returns 0. */ /* returns file size. If file doesn't exist returns 0. */

View File

@ -39,11 +39,10 @@
#define net_to_host(x, y) hst_to_net(x, y) #define net_to_host(x, y) hst_to_net(x, y)
#endif #endif
typedef enum File_Type typedef enum File_Type {
{ FILE_TYPE_REGULAR,
FILE_TYPE_REGULAR, FILE_TYPE_DIRECTORY,
FILE_TYPE_DIRECTORY, FILE_TYPE_OTHER,
FILE_TYPE_OTHER,
} File_Type; } File_Type;

View File

@ -393,7 +393,7 @@ static void mplex_timer_handler(Tox *m)
char status_str[MAX_STR_SIZE]; char status_str[MAX_STR_SIZE];
char note_str[MAX_STR_SIZE]; char note_str[MAX_STR_SIZE];
const char *status = new_status == TOX_USER_STATUS_AWAY ? "away" : const char *status = new_status == TOX_USER_STATUS_AWAY ? "away" :
new_status == TOX_USER_STATUS_BUSY ? "busy" : "online"; new_status == TOX_USER_STATUS_BUSY ? "busy" : "online";
snprintf(status_str, sizeof(status_str), "/status %s", status); snprintf(status_str, sizeof(status_str), "/status %s", status);
snprintf(note_str, sizeof(status_str), "/note %s", new_note); snprintf(note_str, sizeof(status_str), "/note %s", new_note);

View File

@ -236,9 +236,8 @@ void add_line_to_hist(ChatContext *ctx)
resets line if at end of history */ resets line if at end of history */
void fetch_hist_item(ChatContext *ctx, int key_dir) void fetch_hist_item(ChatContext *ctx, int key_dir)
{ {
if(wcscmp(ctx->line, L"\0") != 0 if (wcscmp(ctx->line, L"\0") != 0
&& ctx->hst_pos == ctx->hst_tot) && ctx->hst_pos == ctx->hst_tot) {
{
add_line_to_hist(ctx); add_line_to_hist(ctx);
ctx->hst_pos--; ctx->hst_pos--;
} }