enum get_address_result_t {
SUCCESS,
- FAILED_TO_LOAD_CLIENT_CONF,
SERVER_FROM_TYPE_FAILED
};
*address = NULL;
- if (pa_client_conf_load(conf) < 0) {
- r = FAILED_TO_LOAD_CLIENT_CONF;
- goto finish;
- }
+ pa_client_conf_load(conf);
if (conf->default_dbus_server)
*address = pa_xstrdup(conf->default_dbus_server);
r = DBUS_HANDLER_RESULT_HANDLED;
goto finish;
- case FAILED_TO_LOAD_CLIENT_CONF:
- if (!(reply = dbus_message_new_error(msg, "org.pulseaudio.ClientConfLoadError", "Failed to load client.conf."))) {
- r = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- goto finish;
- }
- if (!dbus_connection_send(conn, reply, NULL)) {
- r = DBUS_HANDLER_RESULT_NEED_MEMORY;
- goto finish;
- }
- r = DBUS_HANDLER_RESULT_HANDLED;
- goto finish;
-
case SERVER_FROM_TYPE_FAILED:
if (!(reply = dbus_message_new_error(msg, DBUS_ERROR_FAILED, "PulseAudio internal error: get_dbus_server_from_type() failed."))) {
r = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
r = DBUS_HANDLER_RESULT_HANDLED;
goto finish;
- case FAILED_TO_LOAD_CLIENT_CONF:
- if (!(reply = dbus_message_new_error(msg, "org.pulseaudio.ClientConfLoadError", "Failed to load client.conf."))) {
- r = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- goto finish;
- }
- if (!dbus_connection_send(conn, reply, NULL)) {
- r = DBUS_HANDLER_RESULT_NEED_MEMORY;
- goto finish;
- }
- r = DBUS_HANDLER_RESULT_HANDLED;
- goto finish;
-
case SERVER_FROM_TYPE_FAILED:
if (!(reply = dbus_message_new_error(msg, DBUS_ERROR_FAILED, "PulseAudio internal error: get_dbus_server_from_type() failed."))) {
r = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
pa_xfree(c);
}
-int pa_client_conf_load(pa_client_conf *c) {
+void pa_client_conf_load(pa_client_conf *c) {
FILE *f = NULL;
char *fn = NULL;
- int r = -1;
/* Prepare the configuration parse table */
pa_config_item table[] = {
{ NULL, NULL, NULL, NULL },
};
- if (!(f = pa_open_config_file(DEFAULT_CLIENT_CONFIG_FILE, DEFAULT_CLIENT_CONFIG_FILE_USER, ENV_CLIENT_CONFIG_FILE, &fn)))
- if (errno != ENOENT)
- goto finish;
+ f = pa_open_config_file(DEFAULT_CLIENT_CONFIG_FILE, DEFAULT_CLIENT_CONFIG_FILE_USER, ENV_CLIENT_CONFIG_FILE, &fn);
+ if (!f)
+ return;
- r = f ? pa_config_parse(fn, f, table, NULL, NULL) : 0;
-
-finish:
+ pa_config_parse(fn, f, table, NULL, NULL);
pa_xfree(fn);
-
- if (f)
- fclose(f);
-
- return r;
+ fclose(f);
}
int pa_client_conf_load_cookie(pa_client_conf *c, uint8_t *cookie, size_t cookie_length) {
return -1;
}
-int pa_client_conf_env(pa_client_conf *c) {
+void pa_client_conf_env(pa_client_conf *c) {
char *e;
if ((e = getenv(ENV_DEFAULT_SINK))) {
pa_xfree(c->cookie_file_from_env);
c->cookie_file_from_env = pa_xstrdup(e);
}
-
- return 0;
}
void pa_client_conf_set_cookie_file_from_application(pa_client_conf *c, const char *cookie_file) {
/* Load the configuration data from the client configuration file, overwriting
* the current settings in *c. */
-int pa_client_conf_load(pa_client_conf *c);
+void pa_client_conf_load(pa_client_conf *c);
/* Load the cookie from the cookie sources specified in the configuration, or
* if nothing is specified or none of the sources work, load the cookie from
/* Load the configuration data from the environment of the current
process, overwriting the current settings in *c. */
-int pa_client_conf_env(pa_client_conf *c);
+void pa_client_conf_env(pa_client_conf *c);
void pa_client_conf_set_cookie_file_from_application(pa_client_conf *c, const char *cookie_file);
char hx[PA_NATIVE_COOKIE_LENGTH*2+1];
assert(conf);
- if (pa_client_conf_load(conf) < 0) {
- fprintf(stderr, _("Failed to load client configuration file.\n"));
- goto finish;
- }
-
- if (pa_client_conf_env(conf) < 0) {
- fprintf(stderr, _("Failed to read environment configuration data.\n"));
- goto finish;
- }
+ pa_client_conf_load(conf);
+ pa_client_conf_env(conf);
pa_x11_del_prop(xcb, screen, "PULSE_SERVER");
pa_x11_del_prop(xcb, screen, "PULSE_SINK");