aboutsummaryrefslogtreecommitdiffstats
path: root/src/PlayerControl.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/PlayerControl.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/PlayerControl.cxx')
-rw-r--r--src/PlayerControl.cxx14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/PlayerControl.cxx b/src/PlayerControl.cxx
index 357cdfc17..3fd09a8d1 100644
--- a/src/PlayerControl.cxx
+++ b/src/PlayerControl.cxx
@@ -40,7 +40,6 @@ player_control::player_control(unsigned _buffer_chunks,
command(PLAYER_COMMAND_NONE),
state(PLAYER_STATE_STOP),
error_type(PLAYER_ERROR_NONE),
- error(nullptr),
next_song(nullptr),
cross_fade_seconds(0),
mixramp_db(0),
@@ -216,16 +215,13 @@ player_control::GetStatus()
}
void
-player_control::SetError(player_error type, GError *_error)
+player_control::SetError(player_error type, Error &&_error)
{
assert(type != PLAYER_ERROR_NONE);
- assert(_error != NULL);
-
- if (error_type != PLAYER_ERROR_NONE)
- g_error_free(error);
+ assert(_error.IsDefined());
error_type = type;
- error = _error;
+ error = std::move(_error);
}
void
@@ -235,7 +231,7 @@ player_control::ClearError()
if (error_type != PLAYER_ERROR_NONE) {
error_type = PLAYER_ERROR_NONE;
- g_error_free(error);
+ error.Clear();
}
Unlock();
@@ -246,7 +242,7 @@ player_control::GetErrorMessage() const
{
Lock();
char *message = error_type != PLAYER_ERROR_NONE
- ? g_strdup(error->message)
+ ? g_strdup(error.GetMessage())
: NULL;
Unlock();
return message;