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
3a6da7c5
Commit
3a6da7c5
authored
Jan 18, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Main: make variables more local
parent
9909a80d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
Main.cxx
src/Main.cxx
+9
-13
No files found.
src/Main.cxx
View file @
3a6da7c5
...
@@ -238,9 +238,8 @@ static void winsock_init(void)
...
@@ -238,9 +238,8 @@ static void winsock_init(void)
{
{
#ifdef WIN32
#ifdef WIN32
WSADATA
sockinfo
;
WSADATA
sockinfo
;
int
retval
;
retval
=
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
sockinfo
);
int
retval
=
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
sockinfo
);
if
(
retval
!=
0
)
if
(
retval
!=
0
)
FormatFatalError
(
"Attempt to open Winsock2 failed; error code %d"
,
FormatFatalError
(
"Attempt to open Winsock2 failed; error code %d"
,
retval
);
retval
);
...
@@ -258,14 +257,11 @@ static void
...
@@ -258,14 +257,11 @@ static void
initialize_decoder_and_player
(
void
)
initialize_decoder_and_player
(
void
)
{
{
const
struct
config_param
*
param
;
const
struct
config_param
*
param
;
char
*
test
;
size_t
buffer_size
;
float
perc
;
unsigned
buffered_chunks
;
unsigned
buffered_before_play
;
size_t
buffer_size
;
param
=
config_get_param
(
CONF_AUDIO_BUFFER_SIZE
);
param
=
config_get_param
(
CONF_AUDIO_BUFFER_SIZE
);
if
(
param
!=
nullptr
)
{
if
(
param
!=
nullptr
)
{
char
*
test
;
long
tmp
=
strtol
(
param
->
value
.
c_str
(),
&
test
,
10
);
long
tmp
=
strtol
(
param
->
value
.
c_str
(),
&
test
,
10
);
if
(
*
test
!=
'\0'
||
tmp
<=
0
||
tmp
==
LONG_MAX
)
if
(
*
test
!=
'\0'
||
tmp
<=
0
||
tmp
==
LONG_MAX
)
FormatFatalError
(
"buffer size
\"
%s
\"
is not a "
FormatFatalError
(
"buffer size
\"
%s
\"
is not a "
...
@@ -277,14 +273,16 @@ initialize_decoder_and_player(void)
...
@@ -277,14 +273,16 @@ initialize_decoder_and_player(void)
buffer_size
*=
1024
;
buffer_size
*=
1024
;
buffered_chunks
=
buffer_size
/
CHUNK_SIZE
;
const
unsigned
buffered_chunks
=
buffer_size
/
CHUNK_SIZE
;
if
(
buffered_chunks
>=
1
<<
15
)
if
(
buffered_chunks
>=
1
<<
15
)
FormatFatalError
(
"buffer size
\"
%lu
\"
is too big"
,
FormatFatalError
(
"buffer size
\"
%lu
\"
is too big"
,
(
unsigned
long
)
buffer_size
);
(
unsigned
long
)
buffer_size
);
float
perc
;
param
=
config_get_param
(
CONF_BUFFER_BEFORE_PLAY
);
param
=
config_get_param
(
CONF_BUFFER_BEFORE_PLAY
);
if
(
param
!=
nullptr
)
{
if
(
param
!=
nullptr
)
{
char
*
test
;
perc
=
strtod
(
param
->
value
.
c_str
(),
&
test
);
perc
=
strtod
(
param
->
value
.
c_str
(),
&
test
);
if
(
*
test
!=
'%'
||
perc
<
0
||
perc
>
100
)
{
if
(
*
test
!=
'%'
||
perc
<
0
||
perc
>
100
)
{
FormatFatalError
(
"buffered before play
\"
%s
\"
is not "
FormatFatalError
(
"buffered before play
\"
%s
\"
is not "
...
@@ -295,7 +293,7 @@ initialize_decoder_and_player(void)
...
@@ -295,7 +293,7 @@ initialize_decoder_and_player(void)
}
else
}
else
perc
=
DEFAULT_BUFFER_BEFORE_PLAY
;
perc
=
DEFAULT_BUFFER_BEFORE_PLAY
;
buffered_before_play
=
(
perc
/
100
)
*
buffered_chunks
;
unsigned
buffered_before_play
=
(
perc
/
100
)
*
buffered_chunks
;
if
(
buffered_before_play
>
buffered_chunks
)
if
(
buffered_before_play
>
buffered_chunks
)
buffered_before_play
=
buffered_chunks
;
buffered_before_play
=
buffered_chunks
;
...
@@ -351,8 +349,6 @@ int main(int argc, char *argv[])
...
@@ -351,8 +349,6 @@ int main(int argc, char *argv[])
int
mpd_main
(
int
argc
,
char
*
argv
[])
int
mpd_main
(
int
argc
,
char
*
argv
[])
{
{
struct
options
options
;
struct
options
options
;
clock_t
start
;
bool
create_db
;
Error
error
;
Error
error
;
daemonize_close_stdin
();
daemonize_close_stdin
();
...
@@ -436,7 +432,7 @@ int mpd_main(int argc, char *argv[])
...
@@ -436,7 +432,7 @@ int mpd_main(int argc, char *argv[])
decoder_plugin_init_all
();
decoder_plugin_init_all
();
update_global_init
();
update_global_init
();
create_db
=
!
glue_db_init_and_load
();
c
onst
bool
c
reate_db
=
!
glue_db_init_and_load
();
glue_sticker_init
();
glue_sticker_init
();
...
@@ -526,7 +522,7 @@ int mpd_main(int argc, char *argv[])
...
@@ -526,7 +522,7 @@ int mpd_main(int argc, char *argv[])
listen_global_finish
();
listen_global_finish
();
delete
instance
->
client_list
;
delete
instance
->
client_list
;
start
=
clock
();
const
clock_t
start
=
clock
();
DatabaseGlobalDeinit
();
DatabaseGlobalDeinit
();
FormatDebug
(
main_domain
,
FormatDebug
(
main_domain
,
"db_finish took %f seconds"
,
"db_finish took %f seconds"
,
...
...
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