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
9cfaa9c7
Commit
9cfaa9c7
authored
Jan 30, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ConfigFile: move code to ConfigOptions.cxx
parent
c5ea5868
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
73 deletions
+99
-73
ConfigFile.cxx
src/ConfigFile.cxx
+1
-73
ConfigOptions.hxx
src/ConfigOptions.hxx
+98
-0
No files found.
src/ConfigFile.cxx
View file @
9cfaa9c7
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "config.h"
#include "config.h"
#include "conf.h"
#include "conf.h"
#include "ConfigOptions.hxx"
extern
"C"
{
extern
"C"
{
#include "utils.h"
#include "utils.h"
...
@@ -45,69 +46,6 @@ extern "C" {
...
@@ -45,69 +46,6 @@ extern "C" {
#define CONF_COMMENT '#'
#define CONF_COMMENT '#'
struct
ConfigOption
{
const
char
*
const
name
;
const
bool
repeatable
;
const
bool
block
;
};
static
constexpr
struct
ConfigOption
config_options
[]
=
{
{
CONF_MUSIC_DIR
,
false
,
false
},
{
CONF_PLAYLIST_DIR
,
false
,
false
},
{
CONF_FOLLOW_INSIDE_SYMLINKS
,
false
,
false
},
{
CONF_FOLLOW_OUTSIDE_SYMLINKS
,
false
,
false
},
{
CONF_DB_FILE
,
false
,
false
},
{
CONF_STICKER_FILE
,
false
,
false
},
{
CONF_LOG_FILE
,
false
,
false
},
{
CONF_PID_FILE
,
false
,
false
},
{
CONF_STATE_FILE
,
false
,
false
},
{
"restore_paused"
,
false
,
false
},
{
CONF_USER
,
false
,
false
},
{
CONF_GROUP
,
false
,
false
},
{
CONF_BIND_TO_ADDRESS
,
true
,
false
},
{
CONF_PORT
,
false
,
false
},
{
CONF_LOG_LEVEL
,
false
,
false
},
{
CONF_ZEROCONF_NAME
,
false
,
false
},
{
CONF_ZEROCONF_ENABLED
,
false
,
false
},
{
CONF_PASSWORD
,
true
,
false
},
{
CONF_DEFAULT_PERMS
,
false
,
false
},
{
CONF_AUDIO_OUTPUT
,
true
,
true
},
{
CONF_AUDIO_OUTPUT_FORMAT
,
false
,
false
},
{
CONF_MIXER_TYPE
,
false
,
false
},
{
CONF_REPLAYGAIN
,
false
,
false
},
{
CONF_REPLAYGAIN_PREAMP
,
false
,
false
},
{
CONF_REPLAYGAIN_MISSING_PREAMP
,
false
,
false
},
{
CONF_REPLAYGAIN_LIMIT
,
false
,
false
},
{
CONF_VOLUME_NORMALIZATION
,
false
,
false
},
{
CONF_SAMPLERATE_CONVERTER
,
false
,
false
},
{
CONF_AUDIO_BUFFER_SIZE
,
false
,
false
},
{
CONF_BUFFER_BEFORE_PLAY
,
false
,
false
},
{
CONF_HTTP_PROXY_HOST
,
false
,
false
},
{
CONF_HTTP_PROXY_PORT
,
false
,
false
},
{
CONF_HTTP_PROXY_USER
,
false
,
false
},
{
CONF_HTTP_PROXY_PASSWORD
,
false
,
false
},
{
CONF_CONN_TIMEOUT
,
false
,
false
},
{
CONF_MAX_CONN
,
false
,
false
},
{
CONF_MAX_PLAYLIST_LENGTH
,
false
,
false
},
{
CONF_MAX_COMMAND_LIST_SIZE
,
false
,
false
},
{
CONF_MAX_OUTPUT_BUFFER_SIZE
,
false
,
false
},
{
CONF_FS_CHARSET
,
false
,
false
},
{
CONF_ID3V1_ENCODING
,
false
,
false
},
{
CONF_METADATA_TO_USE
,
false
,
false
},
{
CONF_SAVE_ABSOLUTE_PATHS
,
false
,
false
},
{
CONF_DECODER
,
true
,
true
},
{
CONF_INPUT
,
true
,
true
},
{
CONF_GAPLESS_MP3_PLAYBACK
,
false
,
false
},
{
CONF_PLAYLIST_PLUGIN
,
true
,
true
},
{
CONF_AUTO_UPDATE
,
false
,
false
},
{
CONF_AUTO_UPDATE_DEPTH
,
false
,
false
},
{
CONF_DESPOTIFY_USER
,
false
,
false
},
{
CONF_DESPOTIFY_PASSWORD
,
false
,
false
},
{
CONF_DESPOTIFY_HIGH_BITRATE
,
false
,
false
},
{
"filter"
,
true
,
true
},
{
"database"
,
false
,
true
},
};
static
GSList
*
config_params
[
G_N_ELEMENTS
(
config_options
)];
static
GSList
*
config_params
[
G_N_ELEMENTS
(
config_options
)];
static
bool
static
bool
...
@@ -172,16 +110,6 @@ config_param_free_callback(gpointer data, G_GNUC_UNUSED gpointer user_data)
...
@@ -172,16 +110,6 @@ config_param_free_callback(gpointer data, G_GNUC_UNUSED gpointer user_data)
config_param_free
(
param
);
config_param_free
(
param
);
}
}
static
int
ConfigFindByName
(
const
char
*
name
)
{
for
(
unsigned
i
=
0
;
i
<
G_N_ELEMENTS
(
config_options
);
++
i
)
if
(
strcmp
(
config_options
[
i
].
name
,
name
)
==
0
)
return
i
;
return
-
1
;
}
void
config_global_finish
(
void
)
void
config_global_finish
(
void
)
{
{
for
(
unsigned
i
=
0
;
i
<
G_N_ELEMENTS
(
config_params
);
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
G_N_ELEMENTS
(
config_params
);
++
i
)
{
...
...
src/ConfigOptions.hxx
0 → 100644
View file @
9cfaa9c7
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "gcc.h"
#include <glib.h>
#include <string.h>
struct
ConfigOption
{
const
char
*
const
name
;
const
bool
repeatable
;
const
bool
block
;
};
static
constexpr
struct
ConfigOption
config_options
[]
=
{
{
CONF_MUSIC_DIR
,
false
,
false
},
{
CONF_PLAYLIST_DIR
,
false
,
false
},
{
CONF_FOLLOW_INSIDE_SYMLINKS
,
false
,
false
},
{
CONF_FOLLOW_OUTSIDE_SYMLINKS
,
false
,
false
},
{
CONF_DB_FILE
,
false
,
false
},
{
CONF_STICKER_FILE
,
false
,
false
},
{
CONF_LOG_FILE
,
false
,
false
},
{
CONF_PID_FILE
,
false
,
false
},
{
CONF_STATE_FILE
,
false
,
false
},
{
"restore_paused"
,
false
,
false
},
{
CONF_USER
,
false
,
false
},
{
CONF_GROUP
,
false
,
false
},
{
CONF_BIND_TO_ADDRESS
,
true
,
false
},
{
CONF_PORT
,
false
,
false
},
{
CONF_LOG_LEVEL
,
false
,
false
},
{
CONF_ZEROCONF_NAME
,
false
,
false
},
{
CONF_ZEROCONF_ENABLED
,
false
,
false
},
{
CONF_PASSWORD
,
true
,
false
},
{
CONF_DEFAULT_PERMS
,
false
,
false
},
{
CONF_AUDIO_OUTPUT
,
true
,
true
},
{
CONF_AUDIO_OUTPUT_FORMAT
,
false
,
false
},
{
CONF_MIXER_TYPE
,
false
,
false
},
{
CONF_REPLAYGAIN
,
false
,
false
},
{
CONF_REPLAYGAIN_PREAMP
,
false
,
false
},
{
CONF_REPLAYGAIN_MISSING_PREAMP
,
false
,
false
},
{
CONF_REPLAYGAIN_LIMIT
,
false
,
false
},
{
CONF_VOLUME_NORMALIZATION
,
false
,
false
},
{
CONF_SAMPLERATE_CONVERTER
,
false
,
false
},
{
CONF_AUDIO_BUFFER_SIZE
,
false
,
false
},
{
CONF_BUFFER_BEFORE_PLAY
,
false
,
false
},
{
CONF_HTTP_PROXY_HOST
,
false
,
false
},
{
CONF_HTTP_PROXY_PORT
,
false
,
false
},
{
CONF_HTTP_PROXY_USER
,
false
,
false
},
{
CONF_HTTP_PROXY_PASSWORD
,
false
,
false
},
{
CONF_CONN_TIMEOUT
,
false
,
false
},
{
CONF_MAX_CONN
,
false
,
false
},
{
CONF_MAX_PLAYLIST_LENGTH
,
false
,
false
},
{
CONF_MAX_COMMAND_LIST_SIZE
,
false
,
false
},
{
CONF_MAX_OUTPUT_BUFFER_SIZE
,
false
,
false
},
{
CONF_FS_CHARSET
,
false
,
false
},
{
CONF_ID3V1_ENCODING
,
false
,
false
},
{
CONF_METADATA_TO_USE
,
false
,
false
},
{
CONF_SAVE_ABSOLUTE_PATHS
,
false
,
false
},
{
CONF_DECODER
,
true
,
true
},
{
CONF_INPUT
,
true
,
true
},
{
CONF_GAPLESS_MP3_PLAYBACK
,
false
,
false
},
{
CONF_PLAYLIST_PLUGIN
,
true
,
true
},
{
CONF_AUTO_UPDATE
,
false
,
false
},
{
CONF_AUTO_UPDATE_DEPTH
,
false
,
false
},
{
CONF_DESPOTIFY_USER
,
false
,
false
},
{
CONF_DESPOTIFY_PASSWORD
,
false
,
false
},
{
CONF_DESPOTIFY_HIGH_BITRATE
,
false
,
false
},
{
"filter"
,
true
,
true
},
{
"database"
,
false
,
true
},
};
gcc_pure
static
int
ConfigFindByName
(
const
char
*
name
)
{
for
(
unsigned
i
=
0
;
i
<
G_N_ELEMENTS
(
config_options
);
++
i
)
if
(
strcmp
(
config_options
[
i
].
name
,
name
)
==
0
)
return
i
;
return
-
1
;
}
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