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
9999914c
Commit
9999914c
authored
Aug 19, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Main: throw exception instead of calling FatalError()
parent
bd32a110
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
Main.cxx
src/Main.cxx
+10
-11
No files found.
src/Main.cxx
View file @
9999914c
...
...
@@ -48,7 +48,6 @@
#include "AudioParser.hxx"
#include "pcm/PcmConvert.hxx"
#include "unix/SignalHandlers.hxx"
#include "system/FatalError.hxx"
#include "thread/Slack.hxx"
#include "net/Init.hxx"
#include "lib/icu/Init.hxx"
...
...
@@ -285,9 +284,9 @@ initialize_decoder_and_player(const ConfigData &config,
char
*
test
;
long
tmp
=
strtol
(
param
->
value
.
c_str
(),
&
test
,
10
);
if
(
*
test
!=
'\0'
||
tmp
<=
0
||
tmp
==
LONG_MAX
)
FormatFatal
Error
(
"buffer size
\"
%s
\"
is not a "
"positive integer, line %i"
,
param
->
value
.
c_str
(),
param
->
line
);
throw
FormatRuntime
Error
(
"buffer size
\"
%s
\"
is not a "
"positive integer, line %i"
,
param
->
value
.
c_str
(),
param
->
line
);
buffer_size
=
tmp
*
KILOBYTE
;
if
(
buffer_size
<
MIN_BUFFER_SIZE
)
{
...
...
@@ -302,8 +301,8 @@ initialize_decoder_and_player(const ConfigData &config,
const
unsigned
buffered_chunks
=
buffer_size
/
CHUNK_SIZE
;
if
(
buffered_chunks
>=
1
<<
15
)
FormatFatal
Error
(
"buffer size
\"
%lu
\"
is too big"
,
(
unsigned
long
)
buffer_size
);
throw
FormatRuntime
Error
(
"buffer size
\"
%lu
\"
is too big"
,
(
unsigned
long
)
buffer_size
);
float
perc
;
param
=
config
.
GetParam
(
ConfigOption
::
BUFFER_BEFORE_PLAY
);
...
...
@@ -311,10 +310,10 @@ initialize_decoder_and_player(const ConfigData &config,
char
*
test
;
perc
=
strtod
(
param
->
value
.
c_str
(),
&
test
);
if
(
*
test
!=
'%'
||
perc
<
0
||
perc
>
100
)
{
FormatFatal
Error
(
"buffered before play
\"
%s
\"
is not "
"a positive percentage and less "
"than 100 percent, line %i"
,
param
->
value
.
c_str
(),
param
->
line
);
throw
FormatRuntime
Error
(
"buffered before play
\"
%s
\"
is not "
"a positive percentage and less "
"than 100 percent, line %i"
,
param
->
value
.
c_str
(),
param
->
line
);
}
if
(
perc
>
80
)
{
...
...
@@ -620,7 +619,7 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
database */
unsigned
job
=
instance
->
update
->
Enqueue
(
""
,
true
);
if
(
job
==
0
)
FatalE
rror
(
"directory update failed"
);
throw
std
::
runtime_e
rror
(
"directory update failed"
);
}
#endif
...
...
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