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
d360f17a
Commit
d360f17a
authored
Jan 07, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Client: add Partition reference attribute
playlist and player_control are deprecated.
parent
a6ee6be9
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
24 additions
and
25 deletions
+24
-25
Client.hxx
src/Client.hxx
+2
-3
ClientInternal.hxx
src/ClientInternal.hxx
+4
-2
ClientNew.cxx
src/ClientNew.cxx
+6
-6
DatabaseCommands.cxx
src/DatabaseCommands.cxx
+1
-1
DatabaseQueue.cxx
src/DatabaseQueue.cxx
+6
-6
DatabaseQueue.hxx
src/DatabaseQueue.hxx
+3
-4
Listen.cxx
src/Listen.cxx
+1
-2
QueueCommands.cxx
src/QueueCommands.cxx
+1
-1
No files found.
src/Client.hxx
View file @
d360f17a
...
...
@@ -27,15 +27,14 @@
#include <stdarg.h>
struct
sockaddr
;
struct
playlist
;
struct
player_control
;
struct
Partition
;
class
Client
;
void
client_manager_init
(
void
);
void
client_manager_deinit
(
void
);
void
client_new
(
struct
playlist
&
playlist
,
struct
player_control
*
player_control
,
client_new
(
Partition
&
partition
,
int
fd
,
const
struct
sockaddr
*
sa
,
size_t
sa_length
,
int
uid
);
gcc_pure
...
...
src/ClientInternal.hxx
View file @
d360f17a
...
...
@@ -44,8 +44,11 @@ struct deferred_buffer {
char
data
[
sizeof
(
long
)];
};
struct
Partition
;
class
Client
{
public
:
Partition
&
partition
;
struct
playlist
&
playlist
;
struct
player_control
*
player_control
;
...
...
@@ -100,8 +103,7 @@ public:
*/
std
::
list
<
ClientMessage
>
messages
;
Client
(
struct
playlist
&
playlist
,
struct
player_control
*
player_control
,
Client
(
Partition
&
partition
,
int
fd
,
int
uid
,
int
num
);
~
Client
();
...
...
src/ClientNew.cxx
View file @
d360f17a
...
...
@@ -19,6 +19,7 @@
#include "config.h"
#include "ClientInternal.hxx"
#include "Partition.hxx"
#include "fd_util.h"
extern
"C"
{
#include "fifo_buffer.h"
...
...
@@ -45,10 +46,10 @@ extern "C" {
static
const
char
GREETING
[]
=
"OK MPD "
PROTOCOL_VERSION
"
\n
"
;
Client
::
Client
(
struct
playlist
&
_playlist
,
struct
player_control
*
_player_control
,
Client
::
Client
(
Partition
&
_partition
,
int
fd
,
int
_uid
,
int
_num
)
:
playlist
(
_playlist
),
player_control
(
_player_control
),
:
partition
(
_partition
),
playlist
(
partition
.
playlist
),
player_control
(
&
partition
.
pc
),
input
(
fifo_buffer_new
(
4096
)),
permission
(
getDefaultPermissions
()),
uid
(
_uid
),
...
...
@@ -94,13 +95,12 @@ Client::~Client()
}
void
client_new
(
struct
playlist
&
playlist
,
struct
player_control
*
player_control
,
client_new
(
Partition
&
partition
,
int
fd
,
const
struct
sockaddr
*
sa
,
size_t
sa_length
,
int
uid
)
{
static
unsigned
int
next_client_num
;
char
*
remote
;
assert
(
player_control
!=
NULL
);
assert
(
fd
>=
0
);
#ifdef HAVE_LIBWRAP
...
...
@@ -134,7 +134,7 @@ client_new(struct playlist &playlist, struct player_control *player_control,
return
;
}
Client
*
client
=
new
Client
(
p
laylist
,
player_control
,
fd
,
uid
,
Client
*
client
=
new
Client
(
p
artition
,
fd
,
uid
,
next_client_num
++
);
(
void
)
send
(
fd
,
GREETING
,
sizeof
(
GREETING
)
-
1
,
0
);
...
...
src/DatabaseCommands.cxx
View file @
d360f17a
...
...
@@ -92,7 +92,7 @@ handle_match_add(Client *client, int argc, char *argv[], bool fold_case)
}
GError
*
error
=
NULL
;
return
findAddIn
(
client
->
playlist
,
client
->
player_control
,
return
AddFromDatabase
(
client
->
partition
,
""
,
&
filter
,
&
error
)
?
COMMAND_RETURN_OK
:
print_error
(
client
,
error
);
...
...
src/DatabaseQueue.cxx
View file @
d360f17a
...
...
@@ -22,16 +22,16 @@
#include "DatabaseSelection.hxx"
#include "DatabaseGlue.hxx"
#include "DatabasePlugin.hxx"
#include "P
laylist
.hxx"
#include "P
artition
.hxx"
#include <functional>
static
bool
AddToQueue
(
struct
playlist
&
playlist
,
struct
player_control
*
pc
,
song
&
song
,
GError
**
error_r
)
AddToQueue
(
Partition
&
partition
,
song
&
song
,
GError
**
error_r
)
{
enum
playlist_result
result
=
playlist_append_song
(
&
playlist
,
pc
,
&
song
,
NULL
);
playlist_append_song
(
&
partition
.
playlist
,
&
partition
.
pc
,
&
song
,
NULL
);
if
(
result
!=
PLAYLIST_RESULT_SUCCESS
)
{
g_set_error
(
error_r
,
playlist_quark
(),
result
,
"Playlist error"
);
...
...
@@ -42,7 +42,7 @@ AddToQueue(struct playlist &playlist, struct player_control *pc,
}
bool
findAddIn
(
struct
playlist
&
playlist
,
struct
player_control
*
pc
,
AddFromDatabase
(
Partition
&
partition
,
const
char
*
uri
,
const
SongFilter
*
filter
,
GError
**
error_r
)
{
...
...
@@ -53,6 +53,6 @@ findAddIn(struct playlist &playlist, struct player_control *pc,
const
DatabaseSelection
selection
(
uri
,
true
,
filter
);
using
namespace
std
::
placeholders
;
const
auto
f
=
std
::
bind
(
AddToQueue
,
std
::
ref
(
p
laylist
),
pc
,
_1
,
_2
);
const
auto
f
=
std
::
bind
(
AddToQueue
,
std
::
ref
(
p
artition
)
,
_1
,
_2
);
return
db
->
Visit
(
selection
,
f
,
error_r
);
}
src/DatabaseQueue.hxx
View file @
d360f17a
...
...
@@ -24,12 +24,11 @@
#include "gerror.h"
class
SongFilter
;
struct
playlist
;
struct
player_control
;
struct
Partition
;
gcc_nonnull
(
2
,
3
)
gcc_nonnull
(
2
)
bool
findAddIn
(
struct
playlist
&
playlist
,
struct
player_control
*
pc
,
AddFromDatabase
(
Partition
&
partition
,
const
char
*
name
,
const
SongFilter
*
filter
,
GError
**
error_r
);
...
...
src/Listen.cxx
View file @
d360f17a
...
...
@@ -20,7 +20,6 @@
#include "config.h"
#include "Listen.hxx"
#include "Main.hxx"
#include "Partition.hxx"
#include "Client.hxx"
#include "conf.h"
...
...
@@ -47,7 +46,7 @@ static void
listen_callback
(
int
fd
,
const
struct
sockaddr
*
address
,
size_t
address_length
,
int
uid
,
G_GNUC_UNUSED
void
*
ctx
)
{
client_new
(
global_partition
->
playlist
,
&
global_partition
->
pc
,
client_new
(
*
global_partition
,
fd
,
address
,
address_length
,
uid
);
}
...
...
src/QueueCommands.cxx
View file @
d360f17a
...
...
@@ -70,7 +70,7 @@ handle_add(Client *client, G_GNUC_UNUSED int argc, char *argv[])
}
GError
*
error
=
NULL
;
return
findAddIn
(
client
->
playlist
,
client
->
player_control
,
return
AddFromDatabase
(
client
->
partition
,
uri
,
nullptr
,
&
error
)
?
COMMAND_RETURN_OK
:
print_error
(
client
,
error
);
...
...
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