Miscellaneous fixes

This commit is contained in:
Martin Pulec
2013-08-16 11:41:10 +02:00
parent 4b5d30e6a6
commit ef7e9a0ee4
7 changed files with 18 additions and 6 deletions

View File

@@ -94,8 +94,12 @@ static bool parse(struct state_blank *s, char *cfg)
while ((item = strtok_r(cfg, ":", &save_ptr))) {
if (s->in_relative_units) {
vals_relative[counter] = atof(item) / 100.0;
if (vals_relative[counter] < 0.0)
vals_relative[counter] = 0.0;
} else {
vals[counter] = atoi(item);
if (vals[counter] < 0)
vals[counter] = 0;
}
cfg = NULL;

View File

@@ -108,7 +108,7 @@ struct control_state {
#define CONTROL_EXIT -1
#define CONTROL_CLOSE_HANDLE -2
static bool parse_msg(char *buffer, char buffer_len, /* out */ char *message, int *new_buffer_len);
static bool parse_msg(char *buffer, int buffer_len, /* out */ char *message, int *new_buffer_len);
static int process_msg(struct control_state *s, fd_t client_fd, char *message);
static ssize_t write_all(fd_t fd, const void *buf, size_t count);
static void * control_thread(void *args);
@@ -120,7 +120,7 @@ static ssize_t write_all(fd_t fd, const void *buf, size_t count)
size_t rest = count;
ssize_t w = 0;
while (rest > 0 && (w = send(fd, p, rest, 0)) >= 0) {
while (rest > 0 && (w = send(fd, p, rest, MSG_NOSIGNAL)) >= 0) {
p += w;
rest -= w;
}
@@ -402,7 +402,7 @@ static void send_response(fd_t fd, struct response *resp)
resp->deleter(resp);
}
static bool parse_msg(char *buffer, char buffer_len, /* out */ char *message, int *new_buffer_len)
static bool parse_msg(char *buffer, int buffer_len, /* out */ char *message, int *new_buffer_len)
{
bool ret = false;
int i = 0;

View File

@@ -106,6 +106,9 @@ int simple_linked_list_remove(struct simple_linked_list *l, void *item)
child_ptr = &(*child_ptr)->next;
}
if(!l->head)
l->tail = NULL;
if(found) {
l->size -= 1;
return TRUE;
@@ -139,6 +142,9 @@ void *simple_linked_list_remove_index(struct simple_linked_list *l, int index)
}
free(tmp);
if(!l->head)
l->tail = NULL;
l->size -= 1;
return ret;
}

View File

@@ -660,7 +660,7 @@ void * vidcap_dshow_init(const struct vidcap_params *params) {
return NULL;
}
if (params->fmt && strcmp(params_fmt, "help") == 0) {
if (params->fmt && strcmp(params->fmt, "help") == 0) {
show_help(s);
cleanup(s);
return &vidcap_init_noerr;

View File

@@ -130,7 +130,7 @@ vidcap_aggregate_init(const struct vidcap_params *params)
for (int i = 0; i < s->devices_cnt; ++i) {
const struct vidcap_params *dev_params = params + 1 + i;
int ret = initialize_video_capture(dev_params->driver, dev_params, &s->devices[i]);
int ret = initialize_video_capture(NULL, dev_params->driver, dev_params, &s->devices[i]);
if(ret != 0) {
fprintf(stderr, "[aggregate] Unable to initialize device %d (%s:%s).\n",
i, dev_params->driver, dev_params->fmt);

View File

@@ -749,7 +749,7 @@ static void *slave_worker(void *arg)
struct vidcap *device;
int ret =
initialize_video_capture(s->device_params->driver, s->device_params, &device);
initialize_video_capture(NULL, s->device_params->driver, s->device_params, &device);
if(ret != 0) {
fprintf(stderr, "[swmix] Unable to initialize device %s (%s:%s).\n",
s->name, s->device_params->driver, s->device_params->fmt);

View File

@@ -47,6 +47,8 @@
#include "config.h"
#include "config_unix.h"
#include "config_win32.h"
#include "debug.h"
#include "video_decompress/null.h"
#include <stdlib.h>