protocol-native,proplist-util: port to pa_get_{user|host}_name_malloc()

This commit is contained in:
Lennart Poettering 2009-04-29 01:56:02 +02:00
parent a8f0d7ec1e
commit ad5a1f312a
2 changed files with 19 additions and 13 deletions

View file

@ -168,20 +168,20 @@ void pa_init_proplist(pa_proplist *p) {
} }
if (!pa_proplist_contains(p, PA_PROP_APPLICATION_PROCESS_USER)) { if (!pa_proplist_contains(p, PA_PROP_APPLICATION_PROCESS_USER)) {
char t[64]; char *u;
if (pa_get_user_name(t, sizeof(t))) {
char *c = pa_utf8_filter(t); if ((u = pa_get_user_name_malloc())) {
pa_proplist_sets(p, PA_PROP_APPLICATION_PROCESS_USER, c); pa_proplist_sets(p, PA_PROP_APPLICATION_PROCESS_USER, u);
pa_xfree(c); pa_xfree(u);
} }
} }
if (!pa_proplist_contains(p, PA_PROP_APPLICATION_PROCESS_HOST)) { if (!pa_proplist_contains(p, PA_PROP_APPLICATION_PROCESS_HOST)) {
char t[64]; char *h;
if (pa_get_host_name(t, sizeof(t))) {
char *c = pa_utf8_filter(t); if ((h = pa_get_host_name_malloc())) {
pa_proplist_sets(p, PA_PROP_APPLICATION_PROCESS_HOST, c); pa_proplist_sets(p, PA_PROP_APPLICATION_PROCESS_HOST, h);
pa_xfree(c); pa_xfree(h);
} }
} }

View file

@ -3182,10 +3182,10 @@ static void command_get_info_list(pa_pdispatch *pd, uint32_t command, uint32_t t
static void command_get_server_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { static void command_get_server_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); pa_native_connection *c = PA_NATIVE_CONNECTION(userdata);
pa_tagstruct *reply; pa_tagstruct *reply;
char txt[256];
pa_sink *def_sink; pa_sink *def_sink;
pa_source *def_source; pa_source *def_source;
pa_sample_spec fixed_ss; pa_sample_spec fixed_ss;
char *h, *u;
pa_native_connection_assert_ref(c); pa_native_connection_assert_ref(c);
pa_assert(t); pa_assert(t);
@ -3200,8 +3200,14 @@ static void command_get_server_info(pa_pdispatch *pd, uint32_t command, uint32_t
reply = reply_new(tag); reply = reply_new(tag);
pa_tagstruct_puts(reply, PACKAGE_NAME); pa_tagstruct_puts(reply, PACKAGE_NAME);
pa_tagstruct_puts(reply, PACKAGE_VERSION); pa_tagstruct_puts(reply, PACKAGE_VERSION);
pa_tagstruct_puts(reply, pa_get_user_name(txt, sizeof(txt)));
pa_tagstruct_puts(reply, pa_get_host_name(txt, sizeof(txt))); u = pa_get_user_name_malloc();
pa_tagstruct_puts(reply, u);
pa_xfree(u);
h = pa_get_host_name_malloc();
pa_tagstruct_puts(reply, h);
pa_xfree(h);
fixup_sample_spec(c, &fixed_ss, &c->protocol->core->default_sample_spec); fixup_sample_spec(c, &fixed_ss, &c->protocol->core->default_sample_spec);
pa_tagstruct_put_sample_spec(reply, &fixed_ss); pa_tagstruct_put_sample_spec(reply, &fixed_ss);