mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 02:03:02 +01:00
a few general fixes
This commit is contained in:
parent
a432d733d7
commit
00cccad22c
@ -70,6 +70,7 @@ static int set_call(Call* call, bool start)
|
||||
|
||||
if ( start ) {
|
||||
call->ttas = true;
|
||||
|
||||
if (pthread_mutex_init(&call->mutex, NULL) != 0)
|
||||
return -1;
|
||||
}
|
||||
|
@ -1013,7 +1013,7 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
||||
self->x = x2;
|
||||
|
||||
/* Truncate note if it doesn't fit in statusbar */
|
||||
uint16_t maxlen = x2 - getcurx(statusbar->topline) - (KEY_IDENT_DIGITS * 2) - 6;
|
||||
uint16_t maxlen = x2 - getcurx(statusbar->topline) - (KEY_IDENT_DIGITS * 2) - 3;
|
||||
|
||||
if (statusbar->statusmsg_len > maxlen) {
|
||||
statusbar->statusmsg[maxlen - 3] = '\0';
|
||||
|
13
src/device.c
13
src/device.c
@ -103,8 +103,6 @@ DeviceError init_devices()
|
||||
{
|
||||
const char *stringed_device_list;
|
||||
|
||||
|
||||
|
||||
size[input] = 0;
|
||||
if ( (stringed_device_list = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER)) ) {
|
||||
ddevice_names[input] = alcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER);
|
||||
@ -115,8 +113,6 @@ DeviceError init_devices()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
size[output] = 0;
|
||||
if ( (stringed_device_list = alcGetString(NULL, ALC_DEVICE_SPECIFIER)) ) {
|
||||
ddevice_names[output] = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
|
||||
@ -128,7 +124,6 @@ DeviceError init_devices()
|
||||
}
|
||||
|
||||
// Start poll thread
|
||||
|
||||
if (pthread_mutex_init(&mutex, NULL) != 0)
|
||||
return de_InternalError;
|
||||
|
||||
@ -242,8 +237,10 @@ DeviceError open_device(DeviceType type, int32_t selection, uint32_t* device_idx
|
||||
}
|
||||
device->ref_count++;
|
||||
|
||||
if (pthread_mutex_init(device->mutex, NULL) != 0)
|
||||
if (pthread_mutex_init(device->mutex, NULL) != 0) {
|
||||
unlock;
|
||||
return de_InternalError;
|
||||
}
|
||||
|
||||
unlock;
|
||||
return de_None;
|
||||
@ -296,8 +293,10 @@ DeviceError open_device(DeviceType type, int32_t selection, uint32_t* device_idx
|
||||
thread_paused = false;
|
||||
}
|
||||
|
||||
if (pthread_mutex_init(device->mutex, NULL) != 0)
|
||||
if (pthread_mutex_init(device->mutex, NULL) != 0) {
|
||||
unlock;
|
||||
return de_InternalError;
|
||||
}
|
||||
|
||||
unlock;
|
||||
return de_None;
|
||||
|
@ -158,7 +158,7 @@ void load_chat_history(ToxWindow *self, struct chatlog *log)
|
||||
|
||||
off_t sz = file_size(log->path);
|
||||
|
||||
if (sz == 0)
|
||||
if (sz <= 0)
|
||||
return;
|
||||
|
||||
char *hstbuf = malloc(sz);
|
||||
@ -195,7 +195,7 @@ void load_chat_history(ToxWindow *self, struct chatlog *log)
|
||||
return;
|
||||
}
|
||||
|
||||
while (line != NULL) {
|
||||
while (line != NULL && count--) {
|
||||
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "%s", line);
|
||||
line = strtok(NULL, "\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user