1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-27 18:53:25 +01:00

Merge pull request #91 from mannol1/master

This should fix segfault and remove one-line comments
This commit is contained in:
mannol1 2014-03-11 23:26:51 +01:00
commit ab0da36cb7
11 changed files with 42 additions and 51 deletions

View File

@ -50,16 +50,16 @@ struct _ASettings {
} ASettins;
void *callback_recv_invite ( void *arg );
void *callback_recv_ringing ( void *arg );
void *callback_recv_starting ( void *arg );
void *callback_recv_ending ( void *arg );
void *callback_recv_error ( void *arg );
void *callback_call_started ( void *arg );
void *callback_call_canceled ( void *arg );
void *callback_call_rejected ( void *arg );
void *callback_call_ended ( void *arg );
void *callback_requ_timeout ( void *arg );
void callback_recv_invite ( void *arg );
void callback_recv_ringing ( void *arg );
void callback_recv_starting ( void *arg );
void callback_recv_ending ( void *arg );
void callback_recv_error ( void *arg );
void callback_call_started ( void *arg );
void callback_call_canceled ( void *arg );
void callback_call_rejected ( void *arg );
void callback_call_ended ( void *arg );
void callback_requ_timeout ( void *arg );
@ -327,57 +327,48 @@ int stop_transmission()
#define CB_BODY(Arg, onFunc) do { ToxWindow* windows = (Arg); int i;\
for (i = 0; i < MAX_WINDOWS_NUM; ++i) if (windows[i].onFunc != NULL) windows[i].onFunc(&windows[i], ASettins.av); } while (0)
void *callback_recv_invite ( void* arg )
void callback_recv_invite ( void* arg )
{
CB_BODY(arg, onInvite);
_cbend;
}
void *callback_recv_ringing ( void* arg )
void callback_recv_ringing ( void* arg )
{
CB_BODY(arg, onRinging);
_cbend;
}
void *callback_recv_starting ( void* arg )
void callback_recv_starting ( void* arg )
{
CB_BODY(arg, onStarting);
_cbend;
}
void *callback_recv_ending ( void* arg )
void callback_recv_ending ( void* arg )
{
CB_BODY(arg, onEnding);
stop_transmission();
}
void *callback_recv_error ( void* arg )
void callback_recv_error ( void* arg )
{
CB_BODY(arg, onError);
_cbend;
}
void *callback_call_started ( void* arg )
void callback_call_started ( void* arg )
{
CB_BODY(arg, onStart);
_cbend;
}
void *callback_call_canceled ( void* arg )
void callback_call_canceled ( void* arg )
{
CB_BODY(arg, onCancel);
_cbend;
}
void *callback_call_rejected ( void* arg )
void callback_call_rejected ( void* arg )
{
CB_BODY(arg, onReject);
_cbend;
}
void *callback_call_ended ( void* arg )
void callback_call_ended ( void* arg )
{
CB_BODY(arg, onEnd);
stop_transmission();
_cbend;
}
void *callback_requ_timeout ( void* arg )
void callback_requ_timeout ( void* arg )
{
CB_BODY(arg, onTimeout);
_cbend;
}
/*

View File

@ -282,9 +282,9 @@ static void chat_onFileControl(ToxWindow *self, Tox *m, int num, uint8_t receive
case TOX_FILECONTROL_ACCEPT:
wprintw(ctx->history, "File transfer for '%s' accepted.\n", filename);
break;
// case TOX_FILECONTROL_PAUSE:
// wprintw(ctx->history, "File transfer for '%s' paused.\n", filename);
// break;
/*case TOX_FILECONTROL_PAUSE:
wprintw(ctx->history, "File transfer for '%s' paused.\n", filename);
break; */
case TOX_FILECONTROL_KILL:
wprintw(ctx->history, "File transfer for '%s' failed.\n", filename);

View File

@ -79,8 +79,8 @@ static struct cmd_func chat_commands[] = {
static int parse_command(WINDOW *w, char *cmd, char (*args)[MAX_STR_SIZE])
{
int num_args = 0;
bool cmd_end = false; // flags when we get to the end of cmd
char *end; // points to the end of the current arg
bool cmd_end = false; /* flags when we get to the end of cmd */
char *end; /* points to the end of the current arg */
/* characters wrapped in double quotes count as one arg */
while (!cmd_end && num_args < MAX_NUM_ARGS) {

View File

@ -28,7 +28,7 @@
#else
#define GLOBAL_NUM_COMMANDS 14
#define CHAT_NUM_COMMANDS 5
#endif /* _SUPPORT_AUDIO */
#endif /* _SUPPORT_AUDIO */
enum {
GLOBAL_COMMAND_MODE,

View File

@ -472,7 +472,7 @@ static void friendlist_onInit(ToxWindow *self, Tox *m)
static void friendlist_onAv(ToxWindow *self, ToxAv *av)
{
int id = toxav_get_peer_id(av, 0);
id++;
/*id++;*/
if ( id >= max_friends_index)
return;
@ -511,7 +511,7 @@ ToxWindow new_friendlist(void)
ret.onFriendAdded = &friendlist_onFriendAdded;
ret.onMessage = &friendlist_onMessage;
ret.onConnectionChange = &friendlist_onConnectionChange;
ret.onAction = &friendlist_onMessage; // Action has identical behaviour to message
ret.onAction = &friendlist_onMessage; /* Action has identical behaviour to message */
ret.onNickChange = &friendlist_onNickChange;
ret.onStatusChange = &friendlist_onStatusChange;
ret.onStatusMessageChange = &friendlist_onStatusMessageChange;

View File

@ -330,13 +330,13 @@ static void send_group_action(ToxWindow *self, ChatContext *ctx, Tox *m, uint8_t
return;
}
// uint8_t selfname[TOX_MAX_NAME_LENGTH];
// tox_get_self_name(m, selfname, TOX_MAX_NAME_LENGTH);
/* uint8_t selfname[TOX_MAX_NAME_LENGTH];
tox_get_self_name(m, selfname, TOX_MAX_NAME_LENGTH);
// print_time(ctx->history);
// wattron(ctx->history, COLOR_PAIR(YELLOW));
// wprintw(ctx->history, "* %s %s\n", selfname, action);
// wattroff(ctx->history, COLOR_PAIR(YELLOW));
print_time(ctx->history);
wattron(ctx->history, COLOR_PAIR(YELLOW));
wprintw(ctx->history, "* %s %s\n", selfname, action);
wattroff(ctx->history, COLOR_PAIR(YELLOW)); */
if (tox_group_action_send(m, self->num, action, strlen(action) + 1) == -1) {
wattron(ctx->history, COLOR_PAIR(RED));

View File

@ -158,7 +158,7 @@ static Tox *init_tox(int ipv4)
#elif defined(_WIN32)
tox_set_name(m, (uint8_t *) "I should install GNU/Linux", sizeof("I should install GNU/Linux"));
#elif defined(__APPLE__)
tox_set_name(m, (uint8_t *) "Hipster", sizeof("Hipster")); //This used to users of other Unixes are hipsters
tox_set_name(m, (uint8_t *) "Hipster", sizeof("Hipster")); /* This used to users of other Unixes are hipsters */
#else
tox_set_name(m, (uint8_t *) "Registered Minix user #4", sizeof("Registered Minix user #4"));
#endif

View File

@ -33,7 +33,7 @@
extern ToxWindow *prompt;
// XXX: FIX
/* XXX: FIX */
unsigned char *hex_string_to_bin(char hex_string[])
{
size_t len = strlen(hex_string);
@ -224,13 +224,13 @@ void get_file_name(uint8_t *pathname, uint8_t *namebuf)
while (idx >= 0 && pathname[idx] == '/')
pathname[idx--] = '\0';
uint8_t *filename = strrchr(pathname, '/'); // Try unix style paths
uint8_t *filename = strrchr(pathname, '/'); /* Try unix style paths */
if (filename != NULL) {
if (!strlen(++filename))
filename = pathname;
} else {
filename = strrchr(pathname, '\\'); // Try windows style paths
filename = strrchr(pathname, '\\'); /* Try windows style paths */
if (filename == NULL)
filename = pathname;

View File

@ -430,7 +430,7 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, int friendnum , u
static void prompt_onFriendRequest(ToxWindow *self, uint8_t *key, uint8_t *data, uint16_t length)
{
// make sure message data is null-terminated
/* make sure message data is null-terminated */
data[length - 1] = 0;
PromptBuf *prt = self->promptbuf;
prep_prompt_win();

View File

@ -82,7 +82,7 @@ enum {
/* Fixes text color problem on some terminals.
Uncomment if necessary */
//#define URXVT_FIX
/* #define URXVT_FIX */
typedef struct ToxWindow ToxWindow;
typedef struct StatusBar StatusBar;

View File

@ -253,7 +253,7 @@ int add_window(Tox *m, ToxWindow w)
/* Deletes window w and cleans up */
void del_window(ToxWindow *w)
{
active_window = windows; // Go to prompt screen
active_window = windows; /* Go to prompt screen */
delwin(w->window);
memset(w, 0, sizeof(ToxWindow));
@ -279,7 +279,7 @@ void set_next_window(int ch)
if (active_window->window)
return;
if (active_window == inf) { // infinite loop check
if (active_window == inf) { /* infinite loop check */
endwin();
fprintf(stderr, "set_next_window() failed. Aborting...\n");
exit(EXIT_FAILURE);