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 33b27d7a43069b86e6834d55158bde83959be669 Author: David Henningsson <david.hennings...@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.hennings...@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 b2fc0796ae0487178db41024c9f6844a6f6cc958 Author: David Henningsson <david.hennings...@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.hennings...@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 d15867b4330c9a2760cc359b5594e6efd4a1a09b Author: David Henningsson <david.hennings...@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.hennings...@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); _______________________________________________ pulseaudio-commits mailing list pulseaudio-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits