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
80799fa8
Commit
80799fa8
authored
Jan 25, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use config_get_string() instead of config_get_param()
config_get_string() is easier to use than config_get_param() because it unpacks the config_param struct.
parent
bdfb6c23
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
31 deletions
+24
-31
input_curl.c
src/input_curl.c
+12
-11
path.c
src/path.c
+2
-5
tag.c
src/tag.c
+5
-5
utils.c
src/utils.c
+4
-5
zeroconf.c
src/zeroconf.c
+1
-5
No files found.
src/input_curl.c
View file @
80799fa8
...
...
@@ -630,10 +630,10 @@ input_curl_easy_init(struct input_stream *is)
struct
input_curl
*
c
=
is
->
data
;
CURLcode
code
;
CURLMcode
mcode
;
struct
config_param
*
proxy_host
;
struct
config_param
*
proxy_port
;
struct
config_param
*
proxy_user
;
struct
config_param
*
proxy_pass
;
const
char
*
proxy_host
;
const
char
*
proxy_port
;
const
char
*
proxy_user
;
const
char
*
proxy_pass
;
c
->
eof
=
false
;
...
...
@@ -661,27 +661,28 @@ input_curl_easy_init(struct input_stream *is)
curl_easy_setopt
(
c
->
easy
,
CURLOPT_FAILONERROR
,
true
);
curl_easy_setopt
(
c
->
easy
,
CURLOPT_ERRORBUFFER
,
c
->
error
);
proxy_host
=
config_get_param
(
CONF_HTTP_PROXY_HOST
);
proxy_port
=
config_get_param
(
CONF_HTTP_PROXY_PORT
);
proxy_user
=
config_get_param
(
CONF_HTTP_PROXY_USER
);
proxy_pass
=
config_get_param
(
CONF_HTTP_PROXY_PASSWORD
);
proxy_host
=
config_get_string
(
CONF_HTTP_PROXY_HOST
,
NULL
);
proxy_port
=
config_get_string
(
CONF_HTTP_PROXY_PORT
,
NULL
);
if
(
proxy_host
!=
NULL
)
{
char
*
proxy_host_str
;
if
(
proxy_port
==
NULL
)
{
proxy_host_str
=
g_strdup
(
proxy_host
->
value
);
proxy_host_str
=
g_strdup
(
proxy_host
);
}
else
{
proxy_host_str
=
g_strconcat
(
proxy_host
->
value
,
":"
,
proxy_port
->
value
,
NULL
);
g_strconcat
(
proxy_host
,
":"
,
proxy_port
,
NULL
);
}
curl_easy_setopt
(
c
->
easy
,
CURLOPT_PROXY
,
proxy_host_str
);
g_free
(
proxy_host_str
);
}
proxy_user
=
config_get_string
(
CONF_HTTP_PROXY_USER
,
NULL
);
proxy_pass
=
config_get_string
(
CONF_HTTP_PROXY_PASSWORD
,
NULL
);
if
((
proxy_user
!=
NULL
)
&&
(
proxy_pass
!=
NULL
))
{
char
*
proxy_auth_str
=
g_strconcat
(
proxy_user
->
value
,
":"
,
proxy_pass
->
value
,
NULL
);
g_strconcat
(
proxy_user
,
":"
,
proxy_pass
,
NULL
);
curl_easy_setopt
(
c
->
easy
,
CURLOPT_PROXYUSERPWD
,
proxy_auth_str
);
g_free
(
proxy_auth_str
);
}
...
...
src/path.c
View file @
80799fa8
...
...
@@ -66,13 +66,10 @@ const char *path_get_fs_charset(void)
void
path_global_init
(
void
)
{
struct
config_param
*
fs_charset_param
=
config_get_param
(
CONF_FS_CHARSET
);
const
char
*
charset
=
NULL
;
if
(
fs_charset_param
)
{
charset
=
fs_charset_param
->
value
;
}
else
{
charset
=
config_get_string
(
CONF_FS_CHARSET
,
NULL
);
if
(
charset
==
NULL
)
{
const
gchar
**
encodings
;
g_get_filename_charsets
(
&
encodings
);
...
...
src/tag.c
View file @
80799fa8
...
...
@@ -71,6 +71,7 @@ static size_t items_size(const struct tag *tag)
void
tag_lib_init
(
void
)
{
const
char
*
value
;
int
quit
=
0
;
char
*
temp
;
char
*
s
;
...
...
@@ -83,17 +84,16 @@ void tag_lib_init(void)
memset
(
ignoreTagItems
,
0
,
TAG_NUM_OF_ITEM_TYPES
);
ignoreTagItems
[
TAG_ITEM_COMMENT
]
=
1
;
/* ignore comments by default */
param
=
config_get_param
(
CONF_METADATA_TO_USE
);
if
(
!
param
)
value
=
config_get_string
(
CONF_METADATA_TO_USE
,
NULL
);
if
(
value
==
NULL
)
return
;
memset
(
ignoreTagItems
,
1
,
TAG_NUM_OF_ITEM_TYPES
);
if
(
0
==
strcasecmp
(
param
->
value
,
"none"
))
if
(
0
==
strcasecmp
(
value
,
"none"
))
return
;
temp
=
c
=
s
=
g_strdup
(
param
->
value
);
temp
=
c
=
s
=
g_strdup
(
value
);
while
(
!
quit
)
{
if
(
*
s
==
','
||
*
s
==
'\0'
)
{
if
(
*
s
==
'\0'
)
...
...
src/utils.c
View file @
80799fa8
...
...
@@ -65,12 +65,11 @@ char *parsePath(char *path)
const
char
*
home
;
if
(
path
[
1
]
==
'/'
||
path
[
1
]
==
'\0'
)
{
struct
config_param
*
param
=
config_get_param
(
CONF_USER
);
if
(
param
&&
param
->
value
)
{
struct
passwd
*
passwd
=
getpwnam
(
param
->
value
);
const
char
*
user
=
config_get_string
(
CONF_USER
,
NULL
);
if
(
user
!=
NULL
)
{
struct
passwd
*
passwd
=
getpwnam
(
user
);
if
(
!
passwd
)
{
g_warning
(
"no such user %s"
,
param
->
value
);
g_warning
(
"no such user %s"
,
user
);
return
NULL
;
}
...
...
src/zeroconf.c
View file @
80799fa8
...
...
@@ -35,17 +35,13 @@ static int zeroconfEnabled;
void
initZeroconf
(
void
)
{
const
char
*
serviceName
=
SERVICE_NAME
;
struct
config_param
*
param
;
zeroconfEnabled
=
config_get_bool
(
CONF_ZEROCONF_ENABLED
,
DEFAULT_ZEROCONF_ENABLED
);
if
(
!
zeroconfEnabled
)
return
;
param
=
config_get_param
(
CONF_ZEROCONF_NAME
);
if
(
param
&&
*
param
->
value
!=
0
)
serviceName
=
param
->
value
;
serviceName
=
config_get_string
(
CONF_ZEROCONF_NAME
,
NULL
);
#ifdef HAVE_AVAHI
init_avahi
(
serviceName
);
...
...
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