Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
aaa438e7
Commit
aaa438e7
authored
Aug 19, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mixer/Type: mixer_type_parse() throws on error
parent
4531e4cc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
15 deletions
+12
-15
MixerType.cxx
src/mixer/MixerType.cxx
+5
-3
MixerType.hxx
src/mixer/MixerType.hxx
+6
-9
Init.cxx
src/output/Init.cxx
+1
-3
No files found.
src/mixer/MixerType.cxx
View file @
aaa438e7
/*
* Copyright 2003-201
7
The Music Player Daemon Project
* Copyright 2003-201
8
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -20,11 +20,13 @@
#include "config.h"
#include "MixerType.hxx"
#include <stdexcept>
#include <assert.h>
#include <string.h>
MixerType
mixer_type_parse
(
const
char
*
input
)
noexcept
mixer_type_parse
(
const
char
*
input
)
{
assert
(
input
!=
NULL
);
...
...
@@ -37,5 +39,5 @@ mixer_type_parse(const char *input) noexcept
else
if
(
strcmp
(
input
,
"null"
)
==
0
)
return
MixerType
::
NULL_
;
else
return
MixerType
::
UNKNOWN
;
throw
std
::
runtime_error
(
"Unrecognized mixer type"
)
;
}
src/mixer/MixerType.hxx
View file @
aaa438e7
/*
* Copyright 2003-201
7
The Music Player Daemon Project
* Copyright 2003-201
8
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -23,9 +23,6 @@
#include "Compiler.h"
enum
class
MixerType
{
/** parser error */
UNKNOWN
,
/** mixer disabled */
NONE
,
...
...
@@ -42,12 +39,12 @@ enum class MixerType {
/**
* Parses a #MixerType setting from the configuration file.
*
* @param input the configured string value; must not be NULL @return
* a #MixerType value; #MixerType::UNKNOWN means #input could not be
* parsed
* Throws if the string could not be parsed.
*
* @param input the configured string value
* @return a #MixerType value
*/
gcc_pure
MixerType
mixer_type_parse
(
const
char
*
input
)
noexcept
;
mixer_type_parse
(
const
char
*
input
);
#endif
src/output/Init.cxx
View file @
aaa438e7
...
...
@@ -87,9 +87,8 @@ audio_output_detect()
* This handles the deprecated options mixer_type (global) and
* mixer_enabled, if the mixer_type setting is not configured.
*/
gcc_pure
static
MixerType
audio_output_mixer_type
(
const
ConfigBlock
&
block
)
noexcept
audio_output_mixer_type
(
const
ConfigBlock
&
block
)
{
/* read the local "mixer_type" setting */
const
char
*
p
=
block
.
GetBlockValue
(
"mixer_type"
);
...
...
@@ -117,7 +116,6 @@ audio_output_load_mixer(EventLoop &event_loop, FilteredAudioOutput &ao,
switch
(
audio_output_mixer_type
(
block
))
{
case
MixerType
:
:
NONE
:
case
MixerType
:
:
UNKNOWN
:
return
nullptr
;
case
MixerType
:
:
NULL_
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment