diff options
author | Max Kellermann <max@duempel.org> | 2013-08-10 18:02:44 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-09-04 18:14:22 +0200 |
commit | 29030b54c98b0aee65fbc10ebf7ba36bed98c02c (patch) | |
tree | 79766830b55ebca38ddbce84d8d548227eedb69e /src/mixer/WinmmMixerPlugin.cxx | |
parent | c9fcc7f14860777458153eb2d13c773ccfa1daa2 (diff) | |
download | mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.gz mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.xz mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.zip |
util/Error: new error passing library
Replaces GLib's GError.
Diffstat (limited to '')
-rw-r--r-- | src/mixer/WinmmMixerPlugin.cxx | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/mixer/WinmmMixerPlugin.cxx b/src/mixer/WinmmMixerPlugin.cxx index cbfb8f6cb..ae25b532c 100644 --- a/src/mixer/WinmmMixerPlugin.cxx +++ b/src/mixer/WinmmMixerPlugin.cxx @@ -21,6 +21,8 @@ #include "MixerInternal.hxx" #include "OutputAPI.hxx" #include "output/WinmmOutputPlugin.hxx" +#include "util/Error.hxx" +#include "util/Domain.hxx" #include <mmsystem.h> @@ -40,11 +42,7 @@ struct WinmmMixer final : public Mixer { } }; -static inline GQuark -winmm_mixer_quark(void) -{ - return g_quark_from_static_string("winmm_mixer"); -} +static constexpr Domain winmm_mixer_domain("winmm_mixer"); static inline int winmm_volume_decode(DWORD volume) @@ -61,7 +59,7 @@ winmm_volume_encode(int volume) static Mixer * winmm_mixer_init(void *ao, gcc_unused const config_param ¶m, - gcc_unused GError **error_r) + gcc_unused Error &error) { assert(ao != nullptr); @@ -77,7 +75,7 @@ winmm_mixer_finish(Mixer *data) } static int -winmm_mixer_get_volume(Mixer *mixer, GError **error_r) +winmm_mixer_get_volume(Mixer *mixer, Error &error) { WinmmMixer *wm = (WinmmMixer *) mixer; DWORD volume; @@ -85,8 +83,7 @@ winmm_mixer_get_volume(Mixer *mixer, GError **error_r) MMRESULT result = waveOutGetVolume(handle, &volume); if (result != MMSYSERR_NOERROR) { - g_set_error(error_r, 0, winmm_mixer_quark(), - "Failed to get winmm volume"); + error.Set(winmm_mixer_domain, "Failed to get winmm volume"); return -1; } @@ -94,7 +91,7 @@ winmm_mixer_get_volume(Mixer *mixer, GError **error_r) } static bool -winmm_mixer_set_volume(Mixer *mixer, unsigned volume, GError **error_r) +winmm_mixer_set_volume(Mixer *mixer, unsigned volume, Error &error) { WinmmMixer *wm = (WinmmMixer *) mixer; DWORD value = winmm_volume_encode(volume); @@ -102,8 +99,7 @@ winmm_mixer_set_volume(Mixer *mixer, unsigned volume, GError **error_r) MMRESULT result = waveOutSetVolume(handle, value); if (result != MMSYSERR_NOERROR) { - g_set_error(error_r, 0, winmm_mixer_quark(), - "Failed to set winmm volume"); + error.Set(winmm_mixer_domain, "Failed to set winmm volume"); return false; } |