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
2d63c269
Commit
2d63c269
authored
Jan 30, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ConfigData: use std::string in block_param
parent
3cdd01aa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
15 deletions
+11
-15
ConfigData.cxx
src/ConfigData.cxx
+7
-12
ConfigData.hxx
src/ConfigData.hxx
+3
-2
ConfigGlobal.cxx
src/ConfigGlobal.cxx
+1
-1
No files found.
src/ConfigData.cxx
View file @
2d63c269
...
...
@@ -53,11 +53,6 @@ config_param_free(struct config_param *param)
{
g_free
(
param
->
value
);
for
(
auto
&
i
:
param
->
block_params
)
{
g_free
(
i
.
name
);
g_free
(
i
.
value
);
}
delete
param
;
}
...
...
@@ -70,8 +65,8 @@ config_add_block_param(struct config_param * param, const char *name,
param
->
block_params
.
push_back
(
block_param
());
struct
block_param
*
bp
=
&
param
->
block_params
.
back
();
bp
->
name
=
g_strdup
(
name
)
;
bp
->
value
=
g_strdup
(
value
)
;
bp
->
name
=
name
;
bp
->
value
=
value
;
bp
->
line
=
line
;
bp
->
used
=
false
;
}
...
...
@@ -83,7 +78,7 @@ config_get_block_param(const struct config_param * param, const char *name)
return
NULL
;
for
(
auto
&
i
:
param
->
block_params
)
{
if
(
0
==
strcmp
(
name
,
i
.
name
)
)
{
if
(
i
.
name
==
name
)
{
i
.
used
=
true
;
return
&
i
;
}
...
...
@@ -101,7 +96,7 @@ config_get_block_string(const struct config_param *param, const char *name,
if
(
bp
==
NULL
)
return
default_value
;
return
bp
->
value
;
return
bp
->
value
.
c_str
()
;
}
char
*
...
...
@@ -122,7 +117,7 @@ config_dup_block_path(const struct config_param *param, const char *name,
if
(
bp
==
NULL
)
return
NULL
;
char
*
path
=
parsePath
(
bp
->
value
,
error_r
);
char
*
path
=
parsePath
(
bp
->
value
.
c_str
()
,
error_r
);
if
(
G_UNLIKELY
(
path
==
NULL
))
g_prefix_error
(
error_r
,
"Invalid path in
\"
%s
\"
at line %i: "
,
...
...
@@ -142,7 +137,7 @@ config_get_block_unsigned(const struct config_param *param, const char *name,
if
(
bp
==
NULL
)
return
default_value
;
value
=
strtol
(
bp
->
value
,
&
endptr
,
0
);
value
=
strtol
(
bp
->
value
.
c_str
()
,
&
endptr
,
0
);
if
(
*
endptr
!=
0
)
MPD_ERROR
(
"Not a valid number in line %i"
,
bp
->
line
);
...
...
@@ -162,7 +157,7 @@ config_get_block_bool(const struct config_param *param, const char *name,
if
(
bp
==
NULL
)
return
default_value
;
success
=
get_bool
(
bp
->
value
,
&
value
);
success
=
get_bool
(
bp
->
value
.
c_str
()
,
&
value
);
if
(
!
success
)
MPD_ERROR
(
"%s is not a boolean value (yes, true, 1) or "
"(no, false, 0) on line %i
\n
"
,
...
...
src/ConfigData.hxx
View file @
2d63c269
...
...
@@ -26,6 +26,7 @@
#ifdef __cplusplus
#include <glib.h>
#include <string>
#include <array>
#include <vector>
#endif
...
...
@@ -35,8 +36,8 @@
#ifdef __cplusplus
struct
block_param
{
char
*
name
;
char
*
value
;
std
::
string
name
;
std
::
string
value
;
int
line
;
/**
...
...
src/ConfigGlobal.cxx
View file @
2d63c269
...
...
@@ -79,7 +79,7 @@ config_param_check(gpointer data, G_GNUC_UNUSED gpointer user_data)
for
(
const
auto
&
i
:
param
->
block_params
)
{
if
(
!
i
.
used
)
g_warning
(
"option '%s' on line %i was not recognized"
,
i
.
name
,
i
.
line
);
i
.
name
.
c_str
()
,
i
.
line
);
}
}
...
...
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