aboutsummaryrefslogtreecommitdiffstats
path: root/src/FilterConfig.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-08-10 18:02:44 +0200
committerMax Kellermann <max@duempel.org>2013-09-04 18:14:22 +0200
commit29030b54c98b0aee65fbc10ebf7ba36bed98c02c (patch)
tree79766830b55ebca38ddbce84d8d548227eedb69e /src/FilterConfig.cxx
parentc9fcc7f14860777458153eb2d13c773ccfa1daa2 (diff)
downloadmpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.gz
mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.xz
mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.zip
util/Error: new error passing library
Replaces GLib's GError.
Diffstat (limited to 'src/FilterConfig.cxx')
-rw-r--r--src/FilterConfig.cxx33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/FilterConfig.cxx b/src/FilterConfig.cxx
index 389afa99d..8a3377c7d 100644
--- a/src/FilterConfig.cxx
+++ b/src/FilterConfig.cxx
@@ -24,35 +24,31 @@
#include "FilterPlugin.hxx"
#include "FilterInternal.hxx"
#include "FilterRegistry.hxx"
+#include "ConfigError.hxx"
+#include "util/Error.hxx"
#include <glib.h>
#include <string.h>
-static GQuark
-filter_quark(void)
-{
- return g_quark_from_static_string("filter");
-}
-
/**
* Find the "filter" configuration block for the specified name.
*
* @param filter_template_name the name of the filter template
- * @param error_r space to return an error description
+ * @param error space to return an error description
* @return the configuration block, or NULL if none was configured
*/
static const struct config_param *
-filter_plugin_config(const char *filter_template_name, GError **error_r)
+filter_plugin_config(const char *filter_template_name, Error &error)
{
const struct config_param *param = NULL;
while ((param = config_get_next_param(CONF_AUDIO_FILTER, param)) != NULL) {
const char *name = param->GetBlockValue("name");
if (name == NULL) {
- g_set_error(error_r, filter_quark(), 1,
- "filter configuration without 'name' name in line %d",
- param->line);
+ error.Format(config_domain,
+ "filter configuration without 'name' name in line %d",
+ param->line);
return NULL;
}
@@ -60,10 +56,9 @@ filter_plugin_config(const char *filter_template_name, GError **error_r)
return param;
}
- g_set_error(error_r, filter_quark(), 1,
- "filter template not found: %s",
- filter_template_name);
-
+ error.Format(config_domain,
+ "filter template not found: %s",
+ filter_template_name);
return NULL;
}
@@ -73,11 +68,11 @@ filter_plugin_config(const char *filter_template_name, GError **error_r)
* configured filter sections.
* @param chain the chain to append filters on
* @param spec the filter chain specification
- * @param error_r space to return an error description
+ * @param error space to return an error description
* @return the number of filters which were successfully added
*/
unsigned int
-filter_chain_parse(Filter &chain, const char *spec, GError **error_r)
+filter_chain_parse(Filter &chain, const char *spec, Error &error)
{
// Split on comma
@@ -92,14 +87,14 @@ filter_chain_parse(Filter &chain, const char *spec, GError **error_r)
g_strstrip(*template_names);
const struct config_param *cfg =
- filter_plugin_config(*template_names, error_r);
+ filter_plugin_config(*template_names, error);
if (cfg == NULL) {
// The error has already been set, just stop.
break;
}
// Instantiate one of those filter plugins with the template name as a hint
- Filter *f = filter_configured_new(*cfg, error_r);
+ Filter *f = filter_configured_new(*cfg, error);
if (f == NULL) {
// The error has already been set, just stop.
break;