mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
fix some compiler warnings
This commit is contained in:
parent
65d17ab6fe
commit
da94f65493
6 changed files with 29 additions and 12 deletions
|
|
@ -83,7 +83,10 @@ context_set_state(struct pw_context *context, enum pw_context_state state, const
|
|||
va_list varargs;
|
||||
|
||||
va_start(varargs, fmt);
|
||||
vasprintf(&context->error, fmt, varargs);
|
||||
if (vasprintf(&context->error, fmt, varargs) < 0) {
|
||||
pw_log_debug("context %p: error formating message: %m", context);
|
||||
context->error = NULL;
|
||||
}
|
||||
va_end(varargs);
|
||||
} else {
|
||||
context->error = NULL;
|
||||
|
|
|
|||
|
|
@ -63,8 +63,7 @@ struct pw_extension *pw_extension_load(struct pw_context *context,
|
|||
|
||||
pw_log_debug("PIPEWIRE_MODULE_DIR set to: %s", module_dir);
|
||||
|
||||
asprintf(&filename, "%s/%s.so", module_dir, name);
|
||||
if (filename == NULL)
|
||||
if (asprintf(&filename, "%s/%s.so", module_dir, name) < 0)
|
||||
goto no_filename;
|
||||
|
||||
pw_log_debug("trying to load extension: %s (%s)", name, filename);
|
||||
|
|
@ -101,18 +100,22 @@ struct pw_extension *pw_extension_load(struct pw_context *context,
|
|||
return this;
|
||||
|
||||
no_filename:
|
||||
pw_log_error("No memory");
|
||||
pw_log_error("Can't create filename: %m");
|
||||
return NULL;
|
||||
open_failed:
|
||||
pw_log_error("Failed to open module: \"%s\" %s", filename, dlerror());
|
||||
free(filename);
|
||||
return NULL;
|
||||
no_mem:
|
||||
no_pw_extension:
|
||||
pw_log_error("\"%s\" is not a pipewire extension", name);
|
||||
dlclose(hnd);
|
||||
free(filename);
|
||||
return NULL;
|
||||
no_mem:
|
||||
pw_log_error("no memory");
|
||||
dlclose(hnd);
|
||||
free(filename);
|
||||
return NULL;
|
||||
init_failed:
|
||||
pw_log_error("\"%s\" failed to initialize", name);
|
||||
pw_extension_destroy(this);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ open_support(const char *path,
|
|||
{
|
||||
char *filename;
|
||||
|
||||
asprintf(&filename, "%s/%s.so", path, lib);
|
||||
if (asprintf(&filename, "%s/%s.so", path, lib) < 0)
|
||||
goto no_filename;
|
||||
|
||||
if ((info->hnd = dlopen(filename, RTLD_NOW)) == NULL) {
|
||||
fprintf(stderr, "can't load %s: %s\n", filename, dlerror());
|
||||
|
|
@ -60,6 +61,8 @@ open_support(const char *path,
|
|||
free(filename);
|
||||
return true;
|
||||
|
||||
no_filename:
|
||||
return false;
|
||||
no_symbol:
|
||||
dlclose(info->hnd);
|
||||
open_failed:
|
||||
|
|
@ -282,7 +285,8 @@ char *pw_get_client_name(void)
|
|||
else if ((cc = pw_get_prgname()))
|
||||
return strdup(cc);
|
||||
else {
|
||||
asprintf(&c, "pipewire-pid-%zd", (size_t) getpid());
|
||||
if (asprintf(&c, "pipewire-pid-%zd", (size_t) getpid()) < 0)
|
||||
return NULL;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,9 @@ static int spa_proxy_node_set_props(struct spa_node *node, const struct spa_prop
|
|||
static inline void do_flush(struct proxy *this)
|
||||
{
|
||||
uint64_t cmd = 1;
|
||||
write(this->writefd, &cmd, 8);
|
||||
if (write(this->writefd, &cmd, 8) != 8)
|
||||
spa_log_warn(this->log, "proxy %p: error writing event: %s", this, strerror(errno));
|
||||
|
||||
}
|
||||
|
||||
static inline void send_need_input(struct proxy *this)
|
||||
|
|
@ -967,7 +969,9 @@ static void proxy_on_data_fd_events(struct spa_source *source)
|
|||
struct spa_event event;
|
||||
uint64_t cmd;
|
||||
|
||||
read(this->data_source.fd, &cmd, 8);
|
||||
if (read(this->data_source.fd, &cmd, 8) != 8)
|
||||
spa_log_warn(this->log, "proxy %p: error reading event: %s",
|
||||
this, strerror(errno));
|
||||
|
||||
while (pw_transport_next_event(impl->transport, &event) == SPA_RESULT_OK) {
|
||||
struct spa_event *ev = alloca(SPA_POD_SIZE(&event));
|
||||
|
|
|
|||
|
|
@ -481,7 +481,8 @@ static void alsa_on_playback_timeout_event(struct spa_source *source)
|
|||
snd_pcm_status_t *status;
|
||||
snd_htimestamp_t htstamp;
|
||||
|
||||
read(state->timerfd, &exp, sizeof(uint64_t));
|
||||
if (read(state->timerfd, &exp, sizeof(uint64_t)) != sizeof(uint64_t))
|
||||
spa_log_warn(state->log, "error reading timerfd: %s", strerror(errno));
|
||||
|
||||
snd_pcm_status_alloca(&status);
|
||||
|
||||
|
|
@ -566,7 +567,8 @@ static void alsa_on_capture_timeout_event(struct spa_source *source)
|
|||
snd_pcm_status_t *status;
|
||||
snd_htimestamp_t htstamp;
|
||||
|
||||
read(state->timerfd, &exp, sizeof(uint64_t));
|
||||
if (read(state->timerfd, &exp, sizeof(uint64_t)) != sizeof(uint64_t))
|
||||
spa_log_warn(state->log, "error reading timerfd: %s", strerror(errno));
|
||||
|
||||
snd_pcm_status_alloca(&status);
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@ impl_log_logv(struct spa_log *log,
|
|||
index & impl->trace_rb.mask, location, size);
|
||||
spa_ringbuffer_write_update(&impl->trace_rb, index + size);
|
||||
|
||||
write(impl->source.fd, &count, sizeof(uint64_t));
|
||||
if (write(impl->source.fd, &count, sizeof(uint64_t)) != sizeof(uint64_t))
|
||||
fprintf(stderr, "error signaling eventfd: %s\n", strerror(errno));
|
||||
} else
|
||||
fputs(location, stderr);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue