pipewire: fix scan-build errors for unused variables

All cases of value stored but never read
This commit is contained in:
Peter Hutterer 2021-05-10 11:49:59 +10:00 committed by Wim Taymans
parent 049eaac821
commit 0b5f19f1d2
4 changed files with 9 additions and 12 deletions

View file

@ -117,7 +117,7 @@ static int get_read_path(char *path, size_t size, const char *prefix, const char
static int ensure_path(char *path, int size, const char *paths[]) static int ensure_path(char *path, int size, const char *paths[])
{ {
int i, len, res, mode; int i, len, mode;
char *p = path; char *p = path;
for (i = 0; paths[i] != NULL; i++) { for (i = 0; paths[i] != NULL; i++) {
@ -134,14 +134,14 @@ static int ensure_path(char *path, int size, const char *paths[])
if (paths[i+1] == NULL) if (paths[i+1] == NULL)
mode |= R_OK | W_OK; mode |= R_OK | W_OK;
if ((res = access(path, mode)) < 0) { if (access(path, mode) < 0) {
if (errno != ENOENT) if (errno != ENOENT)
return -errno; return -errno;
if ((res = mkdir(path, 0700)) < 0) { if (mkdir(path, 0700) < 0) {
pw_log_info("Can't create directory %s: %m", path); pw_log_info("Can't create directory %s: %m", path);
return -errno; return -errno;
} }
if ((res = access(path, mode)) < 0) if (access(path, mode) < 0)
return -errno; return -errno;
pw_log_info("created directory %s", path); pw_log_info("created directory %s", path);

View file

@ -282,7 +282,7 @@ static struct port *alloc_port(struct filter *filter,
int i; int i;
for (i = 0; i < MAX_PORTS; i++) { for (i = 0; i < MAX_PORTS; i++) {
if ((p = filter->ports[direction][i]) == NULL) if ((filter->ports[direction][i]) == NULL)
break; break;
} }
if (i == MAX_PORTS) if (i == MAX_PORTS)
@ -327,11 +327,10 @@ static inline int push_queue(struct port *port, struct queue *queue, struct buff
static inline struct buffer *pop_queue(struct port *port, struct queue *queue) static inline struct buffer *pop_queue(struct port *port, struct queue *queue)
{ {
int32_t avail;
uint32_t index, id; uint32_t index, id;
struct buffer *buffer; struct buffer *buffer;
if ((avail = spa_ringbuffer_get_read_index(&queue->ring, &index)) < 1) { if (spa_ringbuffer_get_read_index(&queue->ring, &index) < 1) {
errno = EPIPE; errno = EPIPE;
return NULL; return NULL;
} }
@ -1436,7 +1435,6 @@ void *pw_filter_add_port(struct pw_filter *filter,
struct filter *impl = SPA_CONTAINER_OF(filter, struct filter, this); struct filter *impl = SPA_CONTAINER_OF(filter, struct filter, this);
struct port *p; struct port *p;
const char *str; const char *str;
int res;
if (props == NULL) if (props == NULL)
props = pw_properties_new(NULL, NULL); props = pw_properties_new(NULL, NULL);
@ -1461,7 +1459,7 @@ void *pw_filter_add_port(struct pw_filter *filter,
add_control_dsp_port_params(impl, p); add_control_dsp_port_params(impl, p);
} }
/* then override with user provided if any */ /* then override with user provided if any */
if ((res = update_params(impl, p, SPA_ID_INVALID, params, n_params)) < 0) if (update_params(impl, p, SPA_ID_INVALID, params, n_params) < 0)
goto error_free; goto error_free;
p->change_mask_all = SPA_PORT_CHANGE_MASK_FLAGS | p->change_mask_all = SPA_PORT_CHANGE_MASK_FLAGS |

View file

@ -922,7 +922,7 @@ int pw_impl_port_add(struct pw_impl_port *port, struct pw_impl_node *node)
} }
pw_properties_set(port->properties, PW_KEY_PORT_DIRECTION, dir); pw_properties_set(port->properties, PW_KEY_PORT_DIRECTION, dir);
if ((str = pw_properties_get(port->properties, PW_KEY_PORT_NAME)) == NULL) { if (pw_properties_get(port->properties, PW_KEY_PORT_NAME) == NULL) {
if ((str = pw_properties_get(port->properties, PW_KEY_AUDIO_CHANNEL)) != NULL && if ((str = pw_properties_get(port->properties, PW_KEY_AUDIO_CHANNEL)) != NULL &&
!spa_streq(str, "UNK")) { !spa_streq(str, "UNK")) {
pw_properties_setf(port->properties, PW_KEY_PORT_NAME, "%s_%s", dir, str); pw_properties_setf(port->properties, PW_KEY_PORT_NAME, "%s_%s", dir, str);

View file

@ -612,8 +612,7 @@ const char *pw_get_prgname(void)
spa_memzero(prgname, sizeof(prgname)); spa_memzero(prgname, sizeof(prgname));
#if defined(__linux__) || defined(__FreeBSD_kernel__) #if defined(__linux__) || defined(__FreeBSD_kernel__)
{ {
ssize_t len; if (readlink("/proc/self/exe", prgname, sizeof(prgname)-1) > 0)
if ((len = readlink("/proc/self/exe", prgname, sizeof(prgname)-1)) > 0)
return strrchr(prgname, '/') + 1; return strrchr(prgname, '/') + 1;
} }
#endif #endif