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
65842cd9
Commit
65842cd9
authored
Aug 04, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DatabasePlugin: pass config_param reference
parent
bf6ed643
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
17 additions
and
17 deletions
+17
-17
DatabaseGlue.cxx
src/DatabaseGlue.cxx
+2
-2
DatabaseGlue.hxx
src/DatabaseGlue.hxx
+1
-1
DatabasePlugin.hxx
src/DatabasePlugin.hxx
+1
-1
Main.cxx
src/Main.cxx
+1
-1
ProxyDatabasePlugin.cxx
src/db/ProxyDatabasePlugin.cxx
+6
-6
SimpleDatabasePlugin.cxx
src/db/SimpleDatabasePlugin.cxx
+3
-3
SimpleDatabasePlugin.hxx
src/db/SimpleDatabasePlugin.hxx
+2
-2
DumpDatabase.cxx
test/DumpDatabase.cxx
+1
-1
No files found.
src/DatabaseGlue.cxx
View file @
65842cd9
...
...
@@ -50,13 +50,13 @@ static bool db_is_open;
static
bool
is_simple
;
bool
DatabaseGlobalInit
(
const
config_param
*
param
,
GError
**
error_r
)
DatabaseGlobalInit
(
const
config_param
&
param
,
GError
**
error_r
)
{
assert
(
db
==
NULL
);
assert
(
!
db_is_open
);
const
char
*
plugin_name
=
config_get_block_string
(
param
,
"plugin"
,
"simple"
);
param
.
GetBlockValue
(
"plugin"
,
"simple"
);
is_simple
=
strcmp
(
plugin_name
,
"simple"
)
==
0
;
const
DatabasePlugin
*
plugin
=
GetDatabasePluginByName
(
plugin_name
);
...
...
src/DatabaseGlue.hxx
View file @
65842cd9
...
...
@@ -32,7 +32,7 @@ class Database;
* @param param the database configuration block
*/
bool
DatabaseGlobalInit
(
const
config_param
*
param
,
GError
**
error_r
);
DatabaseGlobalInit
(
const
config_param
&
param
,
GError
**
error_r
);
void
DatabaseGlobalDeinit
(
void
);
...
...
src/DatabasePlugin.hxx
View file @
65842cd9
...
...
@@ -139,7 +139,7 @@ struct DatabasePlugin {
/**
* Allocates and configures a database.
*/
Database
*
(
*
create
)(
const
struct
config_param
*
param
,
Database
*
(
*
create
)(
const
config_param
&
param
,
GError
**
error_r
);
};
...
...
src/Main.cxx
View file @
65842cd9
...
...
@@ -193,7 +193,7 @@ glue_db_init_and_load(void)
param
=
allocated
;
}
if
(
!
DatabaseGlobalInit
(
param
,
&
error
))
if
(
!
DatabaseGlobalInit
(
*
param
,
&
error
))
MPD_ERROR
(
"%s"
,
error
->
message
);
delete
allocated
;
...
...
src/db/ProxyDatabasePlugin.cxx
View file @
65842cd9
...
...
@@ -48,7 +48,7 @@ class ProxyDatabase : public Database {
Directory
*
root
;
public
:
static
Database
*
Create
(
const
struct
config_param
*
param
,
static
Database
*
Create
(
const
config_param
&
param
,
GError
**
error_r
);
virtual
bool
Open
(
GError
**
error_r
)
override
;
...
...
@@ -73,7 +73,7 @@ public:
GError
**
error_r
)
const
override
;
protected
:
bool
Configure
(
const
struct
config_param
*
param
,
GError
**
error_r
);
bool
Configure
(
const
config_param
&
param
,
GError
**
error_r
);
};
G_GNUC_CONST
...
...
@@ -132,7 +132,7 @@ CheckError(struct mpd_connection *connection, GError **error_r)
}
Database
*
ProxyDatabase
::
Create
(
const
struct
config_param
*
param
,
GError
**
error_r
)
ProxyDatabase
::
Create
(
const
config_param
&
param
,
GError
**
error_r
)
{
ProxyDatabase
*
db
=
new
ProxyDatabase
();
if
(
!
db
->
Configure
(
param
,
error_r
))
{
...
...
@@ -144,10 +144,10 @@ ProxyDatabase::Create(const struct config_param *param, GError **error_r)
}
bool
ProxyDatabase
::
Configure
(
const
struct
config_param
*
param
,
GError
**
)
ProxyDatabase
::
Configure
(
const
config_param
&
param
,
GError
**
)
{
host
=
config_get_block_string
(
param
,
"host"
,
""
);
port
=
config_get_block_unsigned
(
param
,
"port"
,
0
);
host
=
param
.
GetBlockValue
(
"host"
,
""
);
port
=
param
.
GetBlockValue
(
"port"
,
0u
);
return
true
;
}
...
...
src/db/SimpleDatabasePlugin.cxx
View file @
65842cd9
...
...
@@ -41,7 +41,7 @@ simple_db_quark(void)
}
Database
*
SimpleDatabase
::
Create
(
const
struct
config_param
*
param
,
GError
**
error_r
)
SimpleDatabase
::
Create
(
const
config_param
&
param
,
GError
**
error_r
)
{
SimpleDatabase
*
db
=
new
SimpleDatabase
();
if
(
!
db
->
Configure
(
param
,
error_r
))
{
...
...
@@ -53,11 +53,11 @@ SimpleDatabase::Create(const struct config_param *param, GError **error_r)
}
bool
SimpleDatabase
::
Configure
(
const
struct
config_param
*
param
,
GError
**
error_r
)
SimpleDatabase
::
Configure
(
const
config_param
&
param
,
GError
**
error_r
)
{
GError
*
error
=
NULL
;
char
*
_path
=
config_dup_block_path
(
param
,
"path"
,
&
error
);
char
*
_path
=
param
.
DupBlockPath
(
"path"
,
&
error
);
if
(
_path
==
NULL
)
{
if
(
error
!=
NULL
)
g_propagate_error
(
error_r
,
error
);
...
...
src/db/SimpleDatabasePlugin.hxx
View file @
65842cd9
...
...
@@ -60,7 +60,7 @@ public:
return
mtime
;
}
static
Database
*
Create
(
const
struct
config_param
*
param
,
static
Database
*
Create
(
const
config_param
&
param
,
GError
**
error_r
);
virtual
bool
Open
(
GError
**
error_r
)
override
;
...
...
@@ -86,7 +86,7 @@ public:
GError
**
error_r
)
const
override
;
protected
:
bool
Configure
(
const
struct
config_param
*
param
,
GError
**
error_r
);
bool
Configure
(
const
config_param
&
param
,
GError
**
error_r
);
gcc_pure
bool
Check
(
GError
**
error_r
)
const
;
...
...
test/DumpDatabase.cxx
View file @
65842cd9
...
...
@@ -113,7 +113,7 @@ main(int argc, char **argv)
if
(
path
!=
nullptr
)
param
.
AddBlockParam
(
"path"
,
path
->
value
,
path
->
line
);
Database
*
db
=
plugin
->
create
(
&
param
,
&
error
);
Database
*
db
=
plugin
->
create
(
param
,
&
error
);
if
(
db
==
nullptr
)
{
cerr
<<
error
->
message
<<
endl
;
...
...
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