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
20cba9e8
Commit
20cba9e8
authored
Oct 21, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Song: pass reference to song_equals()
parent
f6d67ac2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
19 deletions
+14
-19
DecoderControl.cxx
src/DecoderControl.cxx
+2
-4
DecoderControl.hxx
src/DecoderControl.hxx
+2
-2
PlayerThread.cxx
src/PlayerThread.cxx
+1
-1
Song.cxx
src/Song.cxx
+8
-11
Song.hxx
src/Song.hxx
+1
-1
No files found.
src/DecoderControl.cxx
View file @
20cba9e8
...
...
@@ -47,10 +47,8 @@ decoder_control::~decoder_control()
}
bool
decoder_control
::
IsCurrentSong
(
const
Song
*
_song
)
const
decoder_control
::
IsCurrentSong
(
const
Song
&
_song
)
const
{
assert
(
_song
!=
nullptr
);
switch
(
state
)
{
case
DecoderState
:
:
STOP
:
case
DecoderState
:
:
ERROR
:
...
...
@@ -58,7 +56,7 @@ decoder_control::IsCurrentSong(const Song *_song) const
case
DecoderState
:
:
START
:
case
DecoderState
:
:
DECODE
:
return
song_equals
(
song
,
_song
);
return
SongEquals
(
*
song
,
_song
);
}
assert
(
false
);
...
...
src/DecoderControl.hxx
View file @
20cba9e8
...
...
@@ -274,10 +274,10 @@ struct decoder_control {
* Caller must lock the object.
*/
gcc_pure
bool
IsCurrentSong
(
const
Song
*
_song
)
const
;
bool
IsCurrentSong
(
const
Song
&
_song
)
const
;
gcc_pure
bool
LockIsCurrentSong
(
const
Song
*
_song
)
const
{
bool
LockIsCurrentSong
(
const
Song
&
_song
)
const
{
Lock
();
const
bool
result
=
IsCurrentSong
(
_song
);
Unlock
();
...
...
src/PlayerThread.cxx
View file @
20cba9e8
...
...
@@ -521,7 +521,7 @@ Player::SeekDecoder()
const
unsigned
start_ms
=
pc
.
next_song
->
start_ms
;
if
(
!
dc
.
LockIsCurrentSong
(
pc
.
next_song
))
{
if
(
!
dc
.
LockIsCurrentSong
(
*
pc
.
next_song
))
{
/* the decoder is already decoding the "next" song -
stop it and start the previous song again */
...
...
src/Song.cxx
View file @
20cba9e8
...
...
@@ -127,23 +127,20 @@ directory_is_same(const Directory *a, const Directory *b)
}
bool
song_equals
(
const
Song
*
a
,
const
Song
*
b
)
SongEquals
(
const
Song
&
a
,
const
Song
&
b
)
{
assert
(
a
!=
nullptr
);
assert
(
b
!=
nullptr
);
if
(
a
->
parent
!=
nullptr
&&
b
->
parent
!=
nullptr
&&
!
directory_equals
(
*
a
->
parent
,
*
b
->
parent
)
&&
(
a
->
parent
==
&
detached_root
||
b
->
parent
==
&
detached_root
))
{
if
(
a
.
parent
!=
nullptr
&&
b
.
parent
!=
nullptr
&&
!
directory_equals
(
*
a
.
parent
,
*
b
.
parent
)
&&
(
a
.
parent
==
&
detached_root
||
b
.
parent
==
&
detached_root
))
{
/* must compare the full URI if one of the objects is
"detached" */
const
auto
au
=
a
->
GetURI
();
const
auto
bu
=
b
->
GetURI
();
const
auto
au
=
a
.
GetURI
();
const
auto
bu
=
b
.
GetURI
();
return
au
==
bu
;
}
return
directory_is_same
(
a
->
parent
,
b
->
parent
)
&&
strcmp
(
a
->
uri
,
b
->
uri
)
==
0
;
return
directory_is_same
(
a
.
parent
,
b
.
parent
)
&&
strcmp
(
a
.
uri
,
b
.
uri
)
==
0
;
}
std
::
string
...
...
src/Song.hxx
View file @
20cba9e8
...
...
@@ -145,6 +145,6 @@ struct Song {
*/
gcc_pure
bool
song_equals
(
const
Song
*
a
,
const
Song
*
b
);
SongEquals
(
const
Song
&
a
,
const
Song
&
b
);
#endif
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