diff --git a/src/audio_device.c b/src/audio_device.c index 9dfa2fc..9bb31ee 100644 --- a/src/audio_device.c +++ b/src/audio_device.c @@ -133,7 +133,8 @@ DeviceError terminate_devices() return (DeviceError) de_None; } -void get_devices_names() { +void get_devices_names() +{ const char *stringed_device_list; @@ -487,7 +488,8 @@ void print_devices(ToxWindow *self, DeviceType type) int i; for (i = 0; i < size[type]; ++i) { - line_info_add(self, NULL, NULL, NULL, SYS_MSG, i == primary_device[type] ? 1 : 0, 0, "%d: %s", i, devices_names[type][i]); + line_info_add(self, NULL, NULL, NULL, SYS_MSG, i == primary_device[type] ? 1 : 0, 0, "%d: %s", i, + devices_names[type][i]); } return; diff --git a/src/autocomplete.c b/src/autocomplete.c index 8ca354d..fe0c935 100644 --- a/src/autocomplete.c +++ b/src/autocomplete.c @@ -289,7 +289,7 @@ int dir_match(ToxWindow *self, Tox *m, const wchar_t *line, const wchar_t *cmd) if (dp == NULL) return -1; - char dirnames[MAX_DIRS][NAME_MAX+1]; + char dirnames[MAX_DIRS][NAME_MAX + 1]; struct dirent *entry; int dircount = 0; diff --git a/src/groupchat.c b/src/groupchat.c index 5a5ea51..db3aacc 100644 --- a/src/groupchat.c +++ b/src/groupchat.c @@ -402,7 +402,7 @@ static void groupchat_onGroupNameListChange(ToxWindow *self, Tox *m, uint32_t gr } static void groupchat_onGroupPeerNameChange(ToxWindow *self, Tox *m, uint32_t groupnum, uint32_t peernum, - const char *name, size_t length) + const char *name, size_t length) { if (self->num != groupnum) { return; diff --git a/src/message_queue.c b/src/message_queue.c index 7d11d58..0c5667d 100644 --- a/src/message_queue.c +++ b/src/message_queue.c @@ -133,7 +133,7 @@ void cqueue_remove(ToxWindow *self, Tox *m, uint32_t receipt) } } -#define CQUEUE_TRY_SEND_INTERVAL 60 +#define CQUEUE_TRY_SEND_INTERVAL 10 /* Tries to send the oldest unsent message in queue. */ void cqueue_try_send(ToxWindow *self, Tox *m) @@ -141,18 +141,15 @@ void cqueue_try_send(ToxWindow *self, Tox *m) struct chat_queue *q = self->chatwin->cqueue; struct cqueue_msg *msg = q->root; - if (!msg) + if (!msg) { return; + } - if (msg->receipt != 0 && !timed_out(msg->last_send_try, CQUEUE_TRY_SEND_INTERVAL)) + if (msg->receipt != 0 && !timed_out(msg->last_send_try, CQUEUE_TRY_SEND_INTERVAL)) { return; - - uint32_t receipt = 0; + } TOX_MESSAGE_TYPE type = msg->type == OUT_MSG ? TOX_MESSAGE_TYPE_NORMAL : TOX_MESSAGE_TYPE_ACTION; - receipt = tox_friend_send_message(m, self->num, type, (uint8_t *) msg->message, msg->len, NULL); - + msg->receipt = tox_friend_send_message(m, self->num, type, (uint8_t *) msg->message, msg->len, NULL); msg->last_send_try = get_unix_time(); - msg->receipt = receipt; - return; } diff --git a/src/toxic.c b/src/toxic.c index 7104502..7f2a4f8 100644 --- a/src/toxic.c +++ b/src/toxic.c @@ -767,8 +767,10 @@ static Tox *load_toxic(char *data_path) { TOX_ERR_OPTIONS_NEW options_new_err; struct Tox_Options *tox_opts = tox_options_new(&options_new_err); + if (!tox_opts) exit_toxic_err("tox_options_new returned fatal error", options_new_err); + init_tox_options(tox_opts); TOX_ERR_NEW new_err; diff --git a/src/video_device.c b/src/video_device.c index 5f23811..89fa33d 100644 --- a/src/video_device.c +++ b/src/video_device.c @@ -186,8 +186,10 @@ VideoDeviceError init_video_devices() size[vdt_input] = 0; #if defined(__OSX__) - if( osx_video_init((char**)video_devices_names[vdt_input], &size[vdt_input]) != 0 ) + + if ( osx_video_init((char **)video_devices_names[vdt_input], &size[vdt_input]) != 0 ) return vde_InternalError; + #else /* not __OSX__*/ for (; size[vdt_input] <= MAX_DEVICES; ++size[vdt_input]) { @@ -358,11 +360,13 @@ VideoDeviceError open_video_device(VideoDeviceType type, int32_t selection, uint video_thread_paused = true; #if defined(__OSX__) + if ( osx_video_open_device(selection, &device->video_width, &device->video_height) != 0 ) { free(device); unlock; return vde_FailedStart; } + #else /* not __OSX__*/ /* Open selected device */ char device_address[] = "/dev/videoXX"; @@ -667,10 +671,12 @@ void *video_thread_poll (void *arg) // TODO: maybe use thread for every input so uint8_t *v = device->input.planes[2]; #if defined(__OSX__) + if ( osx_video_read_device(y, u, v, &video_width, &video_height) != 0 ) { unlock; continue; } + #else /* not __OSX__*/ struct v4l2_buffer buf; memset(&(buf), 0, sizeof(buf));