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
b9ff6383
Commit
b9ff6383
authored
Jul 06, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/LightSong: make Tag a reference
This enforces the "not nullptr" rule.
parent
ebc006ab
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
23 additions
and
26 deletions
+23
-26
DetachedSong.cxx
src/DetachedSong.cxx
+2
-3
SongFilter.cxx
src/SongFilter.cxx
+1
-1
SongPrint.cxx
src/SongPrint.cxx
+1
-1
Count.cxx
src/db/Count.cxx
+1
-3
DatabasePrint.cxx
src/db/DatabasePrint.cxx
+2
-2
Helpers.cxx
src/db/Helpers.cxx
+1
-1
LightSong.cxx
src/db/LightSong.cxx
+3
-3
LightSong.hxx
src/db/LightSong.hxx
+5
-2
UniqueTags.cxx
src/db/UniqueTags.cxx
+1
-2
ProxyDatabasePlugin.cxx
src/db/plugins/ProxyDatabasePlugin.cxx
+1
-1
Song.cxx
src/db/plugins/simple/Song.cxx
+1
-2
UpnpDatabasePlugin.cxx
src/db/plugins/upnp/UpnpDatabasePlugin.cxx
+3
-4
PlaylistUpdate.cxx
src/queue/PlaylistUpdate.cxx
+1
-1
No files found.
src/DetachedSong.cxx
View file @
b9ff6383
...
...
@@ -26,18 +26,17 @@
DetachedSong
::
DetachedSong
(
const
LightSong
&
other
)
:
uri
(
other
.
GetURI
()),
real_uri
(
other
.
real_uri
!=
nullptr
?
other
.
real_uri
:
""
),
tag
(
*
other
.
tag
),
tag
(
other
.
tag
),
mtime
(
other
.
mtime
),
start_time
(
other
.
start_time
),
end_time
(
other
.
end_time
)
{}
DetachedSong
::
operator
LightSong
()
const
noexcept
{
LightSong
result
;
LightSong
result
(
tag
)
;
result
.
directory
=
nullptr
;
result
.
uri
=
uri
.
c_str
();
result
.
real_uri
=
real_uri
.
empty
()
?
nullptr
:
real_uri
.
c_str
();
result
.
tag
=
&
tag
;
result
.
mtime
=
mtime
;
result
.
start_time
=
start_time
;
result
.
end_time
=
end_time
;
...
...
src/SongFilter.cxx
View file @
b9ff6383
...
...
@@ -164,7 +164,7 @@ SongFilter::Item::Match(const LightSong &song) const noexcept
return
StringMatch
(
uri
.
c_str
());
}
return
Match
(
*
song
.
tag
);
return
Match
(
song
.
tag
);
}
SongFilter
::
SongFilter
(
unsigned
tag
,
const
char
*
value
,
bool
fold_case
)
...
...
src/SongPrint.cxx
View file @
b9ff6383
...
...
@@ -92,7 +92,7 @@ song_print_info(Response &r, const LightSong &song, bool base) noexcept
if
(
!
IsNegative
(
song
.
mtime
))
time_print
(
r
,
"Last-Modified"
,
song
.
mtime
);
tag_print
(
r
,
*
song
.
tag
);
tag_print
(
r
,
song
.
tag
);
}
void
...
...
src/db/Count.cxx
View file @
b9ff6383
...
...
@@ -97,9 +97,7 @@ static void
GroupCountVisitor
(
TagCountMap
&
map
,
TagType
group
,
const
LightSong
&
song
)
noexcept
{
assert
(
song
.
tag
!=
nullptr
);
const
Tag
&
tag
=
*
song
.
tag
;
const
Tag
&
tag
=
song
.
tag
;
if
(
!
CollectGroupCounts
(
map
,
group
,
tag
)
&&
group
==
TAG_ALBUM_ARTIST
)
/* fall back to "Artist" if no "AlbumArtist" was found */
CollectGroupCounts
(
map
,
TAG_ARTIST
,
tag
);
...
...
src/db/DatabasePrint.cxx
View file @
b9ff6383
...
...
@@ -105,7 +105,7 @@ PrintSongBrief(Response &r, bool base, const LightSong &song) noexcept
{
song_print_uri
(
r
,
song
,
base
);
if
(
song
.
tag
->
has_playlist
)
if
(
song
.
tag
.
has_playlist
)
/* this song file has an embedded CUE sheet */
print_playlist_in_directory
(
r
,
base
,
song
.
directory
,
song
.
uri
);
...
...
@@ -116,7 +116,7 @@ PrintSongFull(Response &r, bool base, const LightSong &song) noexcept
{
song_print_info
(
r
,
song
,
base
);
if
(
song
.
tag
->
has_playlist
)
if
(
song
.
tag
.
has_playlist
)
/* this song file has an embedded CUE sheet */
print_playlist_in_directory
(
r
,
base
,
song
.
directory
,
song
.
uri
);
...
...
src/db/Helpers.cxx
View file @
b9ff6383
...
...
@@ -65,7 +65,7 @@ StatsVisitSong(DatabaseStats &stats, StringSet &artists, StringSet &albums,
{
++
stats
.
song_count
;
StatsVisitTag
(
stats
,
artists
,
albums
,
*
song
.
tag
);
StatsVisitTag
(
stats
,
artists
,
albums
,
song
.
tag
);
}
DatabaseStats
...
...
src/db/LightSong.cxx
View file @
b9ff6383
...
...
@@ -25,10 +25,10 @@ LightSong::GetDuration() const noexcept
{
SongTime
a
=
start_time
,
b
=
end_time
;
if
(
!
b
.
IsPositive
())
{
if
(
tag
->
duration
.
IsNegative
())
return
tag
->
duration
;
if
(
tag
.
duration
.
IsNegative
())
return
tag
.
duration
;
b
=
SongTime
(
tag
->
duration
);
b
=
SongTime
(
tag
.
duration
);
}
return
SignedSongTime
(
b
-
a
);
...
...
src/db/LightSong.hxx
View file @
b9ff6383
...
...
@@ -57,9 +57,9 @@ struct LightSong {
const
char
*
real_uri
;
/**
* M
ust not be nullptr
.
* M
etadata
.
*/
const
Tag
*
tag
;
const
Tag
&
tag
;
/**
* The time stamp of the last file modification. A negative
...
...
@@ -78,6 +78,9 @@ struct LightSong {
*/
SongTime
end_time
;
explicit
LightSong
(
const
Tag
&
_tag
)
noexcept
:
tag
(
_tag
)
{}
gcc_pure
std
::
string
GetURI
()
const
noexcept
{
if
(
directory
==
nullptr
)
...
...
src/db/UniqueTags.cxx
View file @
b9ff6383
...
...
@@ -31,8 +31,7 @@ static void
CollectTags
(
TagSet
&
set
,
TagType
tag_type
,
TagMask
group_mask
,
const
LightSong
&
song
)
{
assert
(
song
.
tag
!=
nullptr
);
const
Tag
&
tag
=
*
song
.
tag
;
const
Tag
&
tag
=
song
.
tag
;
set
.
InsertUnique
(
tag
,
tag_type
,
group_mask
);
}
...
...
src/db/plugins/ProxyDatabasePlugin.cxx
View file @
b9ff6383
...
...
@@ -203,11 +203,11 @@ Copy(TagBuilder &tag, TagType d_tag,
}
ProxySong
::
ProxySong
(
const
mpd_song
*
song
)
:
LightSong
(
tag2
)
{
directory
=
nullptr
;
uri
=
mpd_song_get_uri
(
song
);
real_uri
=
nullptr
;
tag
=
&
tag2
;
const
auto
_mtime
=
mpd_song_get_last_modified
(
song
);
mtime
=
_mtime
>
0
...
...
src/db/plugins/simple/Song.cxx
View file @
b9ff6383
...
...
@@ -98,12 +98,11 @@ Song::GetURI() const noexcept
LightSong
Song
::
Export
()
const
noexcept
{
LightSong
dest
;
LightSong
dest
(
tag
)
;
dest
.
directory
=
parent
->
IsRoot
()
?
nullptr
:
parent
->
GetPath
();
dest
.
uri
=
uri
;
dest
.
real_uri
=
nullptr
;
dest
.
tag
=
&
tag
;
dest
.
mtime
=
mtime
;
dest
.
start_time
=
start_time
;
dest
.
end_time
=
end_time
;
...
...
src/db/plugins/upnp/UpnpDatabasePlugin.cxx
View file @
b9ff6383
...
...
@@ -55,13 +55,13 @@ class UpnpSong : public LightSong {
public
:
UpnpSong
(
UPnPDirObject
&&
object
,
std
::
string
&&
_uri
)
:
uri2
(
std
::
move
(
_uri
)),
:
LightSong
(
tag2
),
uri2
(
std
::
move
(
_uri
)),
real_uri2
(
std
::
move
(
object
.
url
)),
tag2
(
std
::
move
(
object
.
tag
))
{
directory
=
nullptr
;
uri
=
uri2
.
c_str
();
real_uri
=
real_uri2
.
c_str
();
tag
=
&
tag2
;
mtime
=
std
::
chrono
::
system_clock
::
time_point
::
min
();
start_time
=
end_time
=
SongTime
::
zero
();
}
...
...
@@ -321,11 +321,10 @@ visitSong(const UPnPDirObject &meta, const char *path,
if
(
!
visit_song
)
return
;
LightSong
song
;
LightSong
song
(
meta
.
tag
)
;
song
.
directory
=
nullptr
;
song
.
uri
=
path
;
song
.
real_uri
=
meta
.
url
.
c_str
();
song
.
tag
=
&
meta
.
tag
;
song
.
mtime
=
std
::
chrono
::
system_clock
::
time_point
::
min
();
song
.
start_time
=
song
.
end_time
=
SongTime
::
zero
();
...
...
src/queue/PlaylistUpdate.cxx
View file @
b9ff6383
...
...
@@ -50,7 +50,7 @@ UpdatePlaylistSong(const Database &db, DetachedSong &song)
}
song
.
SetLastModified
(
original
->
mtime
);
song
.
SetTag
(
*
original
->
tag
);
song
.
SetTag
(
original
->
tag
);
db
.
ReturnSong
(
original
);
return
true
;
...
...
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