[pulseaudio-commits] 3 commits - src/modules src/pulsecore
David Henningsson
diwic at kemper.freedesktop.org
Wed May 22 07:11:15 PDT 2013
src/modules/module-device-manager.c | 4 ++--
src/modules/rtp/rtp.c | 2 +-
src/pulsecore/core-util.h | 9 +++++++++
3 files changed, 12 insertions(+), 3 deletions(-)
New commits:
commit 19a7c6e49b631ac5c19cdabafeb96683b0f93b51
Author: David Henningsson <david.henningsson at canonical.com>
Date: Wed May 22 13:26:24 2013 +0200
rtp: Reset timestamp with correct size if not found
This fixes a compiler warning when building under Ubuntu.
Signed-off-by: David Henningsson <david.henningsson at canonical.com>
diff --git a/src/modules/rtp/rtp.c b/src/modules/rtp/rtp.c
index c094fcf..9195493 100644
--- a/src/modules/rtp/rtp.c
+++ b/src/modules/rtp/rtp.c
@@ -286,7 +286,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool, struct
if (!found_tstamp) {
pa_log_warn("Couldn't find SCM_TIMESTAMP data in auxiliary recvmsg() data!");
- memset(tstamp, 0, sizeof(tstamp));
+ pa_zero(*tstamp);
}
return 0;
commit d396b76934ead9e6f5c3ac7bb6d7d79cd9a7f981
Author: David Henningsson <david.henningsson at canonical.com>
Date: Wed May 22 13:21:24 2013 +0200
module-device-manager: Fix description restore
e->description is a pointer, not a fixed char array. Hence it
makes no sense to use strncmp.
This fixes a compiler warning when compiling under Ubuntu.
Signed-off-by: David Henningsson <david.henningsson at canonical.com>
diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c
index 207870d..5db5550 100644
--- a/src/modules/module-device-manager.c
+++ b/src/modules/module-device-manager.c
@@ -889,7 +889,7 @@ static pa_hook_result_t sink_new_hook_callback(pa_core *c, pa_sink_new_data *new
name = pa_sprintf_malloc("sink:%s", new_data->name);
if ((e = entry_read(u, name))) {
- if (e->user_set_description && strncmp(e->description, pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION), sizeof(e->description)) != 0) {
+ if (e->user_set_description && !pa_safe_streq(e->description, pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION))) {
pa_log_info("Restoring description for sink %s.", new_data->name);
pa_proplist_sets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION, e->description);
}
@@ -913,7 +913,7 @@ static pa_hook_result_t source_new_hook_callback(pa_core *c, pa_source_new_data
name = pa_sprintf_malloc("source:%s", new_data->name);
if ((e = entry_read(u, name))) {
- if (e->user_set_description && strncmp(e->description, pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION), sizeof(e->description)) != 0) {
+ if (e->user_set_description && !pa_safe_streq(e->description, pa_proplist_gets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION))) {
/* NB, We cannot detect if we are a monitor here... this could mess things up a bit... */
pa_log_info("Restoring description for source %s.", new_data->name);
pa_proplist_sets(new_data->proplist, PA_PROP_DEVICE_DESCRIPTION, e->description);
commit de5eb70032344c02d3dfe09ff9d830c16bd595f0
Author: David Henningsson <david.henningsson at canonical.com>
Date: Wed May 22 14:08:19 2013 +0200
core-util: Add pa_safe_streq
Like pa_streq, but does not blow up on NULL pointers.
Signed-off-by: David Henningsson <david.henningsson at canonical.com>
diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
index 15e6809..7b59fbc 100644
--- a/src/pulsecore/core-util.h
+++ b/src/pulsecore/core-util.h
@@ -208,6 +208,15 @@ void pa_unset_env_recorded(void);
pa_bool_t pa_in_system_mode(void);
#define pa_streq(a,b) (!strcmp((a),(b)))
+
+/* Like pa_streq, but does not blow up on NULL pointers. */
+static inline bool pa_safe_streq(const char *a, const char *b)
+{
+ if (a == NULL || b == NULL)
+ return a == b;
+ return pa_streq(a, b);
+}
+
pa_bool_t pa_str_in_list_spaces(const char *needle, const char *haystack);
char *pa_get_host_name_malloc(void);
More information about the pulseaudio-commits
mailing list