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

couple fixes

This commit is contained in:
Jfreegman 2014-02-11 19:12:26 -05:00
parent 16b8f85d95
commit c3d2ff6bfb
4 changed files with 9 additions and 7 deletions

View File

@ -136,7 +136,8 @@ static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int num, uint8_t fil
ChatContext *ctx = self->chatwin;
uint8_t *filename = get_file_name(pathname);
uint8_t filename[MAX_STR_SIZE];
get_file_name(pathname, filename);
wprintw(ctx->history, "File transfer request for '%s' (%llu bytes).\n", filename,
(long long unsigned int)filesize);

View File

@ -164,7 +164,8 @@ void cmd_sendfile(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv
uint64_t filesize = ftell(file_to_send);
fseek(file_to_send, 0, SEEK_SET);
uint8_t *filename = get_file_name(path);
uint8_t filename[MAX_STR_SIZE];
get_file_name(path, filename);
int filenum = tox_new_file_sender(m, self->num, filesize, filename, strlen(filename) + 1);
if (filenum == -1) {

View File

@ -194,8 +194,8 @@ void mv_curs_end(WINDOW *w, size_t len, int max_y, int max_x)
wmove(w, end_y, end_x);
}
/* Returns base file name from path or original file name if no path is supplied */
uint8_t *get_file_name(uint8_t *pathname)
/* gets base file name from path or original file name if no path is supplied */
void get_file_name(uint8_t *pathname, uint8_t *namebuf)
{
int idx = strlen(pathname) - 1;
@ -214,5 +214,5 @@ uint8_t *get_file_name(uint8_t *pathname)
filename = pathname;
}
return filename;
snprintf(namebuf, MAX_STR_SIZE, "%s", filename);
}

View File

@ -48,5 +48,5 @@ bool valid_nick(uint8_t *nick);
/* Moves the cursor to the end of the line in given window */
void mv_curs_end(WINDOW *w, size_t len, int max_y, int max_x);
/* Returns base file name from path or original file name if no path is supplied */
uint8_t *get_file_name(uint8_t *pathname);
/* gets base file name from path or original file name if no path is supplied */
void get_file_name(uint8_t *pathname, uint8_t *buf);