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
0214baad
Commit
0214baad
authored
Oct 02, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Playlist*: use nullptr instead of NULL
parent
c2d3ed2a
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
127 additions
and
128 deletions
+127
-128
Playlist.cxx
src/Playlist.cxx
+3
-3
PlaylistAny.cxx
src/PlaylistAny.cxx
+6
-6
PlaylistControl.cxx
src/PlaylistControl.cxx
+1
-1
PlaylistDatabase.cxx
src/PlaylistDatabase.cxx
+3
-3
PlaylistEdit.cxx
src/PlaylistEdit.cxx
+2
-2
PlaylistFile.cxx
src/PlaylistFile.cxx
+10
-10
PlaylistFile.hxx
src/PlaylistFile.hxx
+1
-1
PlaylistMapper.cxx
src/PlaylistMapper.cxx
+9
-10
PlaylistPrint.cxx
src/PlaylistPrint.cxx
+4
-4
PlaylistQueue.cxx
src/PlaylistQueue.cxx
+5
-5
PlaylistRegistry.cxx
src/PlaylistRegistry.cxx
+52
-52
PlaylistRegistry.hxx
src/PlaylistRegistry.hxx
+2
-2
PlaylistSave.cxx
src/PlaylistSave.cxx
+1
-1
PlaylistSong.cxx
src/PlaylistSong.cxx
+23
-23
PlaylistSong.hxx
src/PlaylistSong.hxx
+1
-1
PlaylistState.cxx
src/PlaylistState.cxx
+3
-3
PlaylistVector.cxx
src/PlaylistVector.cxx
+1
-1
No files found.
src/Playlist.cxx
View file @
0214baad
...
@@ -77,7 +77,7 @@ playlist_queue_song_order(struct playlist *playlist, struct player_control *pc,
...
@@ -77,7 +77,7 @@ playlist_queue_song_order(struct playlist *playlist, struct player_control *pc,
static
void
static
void
playlist_song_started
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
)
playlist_song_started
(
struct
playlist
*
playlist
,
struct
player_control
*
pc
)
{
{
assert
(
pc
->
next_song
==
NULL
);
assert
(
pc
->
next_song
==
nullptr
);
assert
(
playlist
->
queued
>=
-
1
);
assert
(
playlist
->
queued
>=
-
1
);
/* queued song has started: copy queued to current,
/* queued song has started: copy queued to current,
...
@@ -108,7 +108,7 @@ playlist::UpdateQueuedSong(player_control &pc, const Song *prev)
...
@@ -108,7 +108,7 @@ playlist::UpdateQueuedSong(player_control &pc, const Song *prev)
return
;
return
;
assert
(
!
queue
.
IsEmpty
());
assert
(
!
queue
.
IsEmpty
());
assert
((
queued
<
0
)
==
(
prev
==
NULL
));
assert
((
queued
<
0
)
==
(
prev
==
nullptr
));
const
int
next_order
=
current
>=
0
const
int
next_order
=
current
>=
0
?
queue
.
GetNextOrder
(
current
)
?
queue
.
GetNextOrder
(
current
)
...
@@ -133,7 +133,7 @@ playlist::UpdateQueuedSong(player_control &pc, const Song *prev)
...
@@ -133,7 +133,7 @@ playlist::UpdateQueuedSong(player_control &pc, const Song *prev)
?
queue
.
GetOrder
(
next_order
)
?
queue
.
GetOrder
(
next_order
)
:
nullptr
;
:
nullptr
;
if
(
prev
!=
NULL
&&
next_song
!=
prev
)
{
if
(
prev
!=
nullptr
&&
next_song
!=
prev
)
{
/* clear the currently queued song */
/* clear the currently queued song */
pc
.
Cancel
();
pc
.
Cancel
();
queued
=
-
1
;
queued
=
-
1
;
...
...
src/PlaylistAny.cxx
View file @
0214baad
...
@@ -34,25 +34,25 @@ playlist_open_remote(const char *uri, Mutex &mutex, Cond &cond,
...
@@ -34,25 +34,25 @@ playlist_open_remote(const char *uri, Mutex &mutex, Cond &cond,
assert
(
uri_has_scheme
(
uri
));
assert
(
uri_has_scheme
(
uri
));
SongEnumerator
*
playlist
=
playlist_list_open_uri
(
uri
,
mutex
,
cond
);
SongEnumerator
*
playlist
=
playlist_list_open_uri
(
uri
,
mutex
,
cond
);
if
(
playlist
!=
NULL
)
{
if
(
playlist
!=
nullptr
)
{
*
is_r
=
NULL
;
*
is_r
=
nullptr
;
return
playlist
;
return
playlist
;
}
}
Error
error
;
Error
error
;
input_stream
*
is
=
input_stream
::
Open
(
uri
,
mutex
,
cond
,
error
);
input_stream
*
is
=
input_stream
::
Open
(
uri
,
mutex
,
cond
,
error
);
if
(
is
==
NULL
)
{
if
(
is
==
nullptr
)
{
if
(
error
.
IsDefined
())
if
(
error
.
IsDefined
())
g_warning
(
"Failed to open %s: %s"
,
g_warning
(
"Failed to open %s: %s"
,
uri
,
error
.
GetMessage
());
uri
,
error
.
GetMessage
());
return
NULL
;
return
nullptr
;
}
}
playlist
=
playlist_list_open_stream
(
is
,
uri
);
playlist
=
playlist_list_open_stream
(
is
,
uri
);
if
(
playlist
==
NULL
)
{
if
(
playlist
==
nullptr
)
{
is
->
Close
();
is
->
Close
();
return
NULL
;
return
nullptr
;
}
}
*
is_r
=
is
;
*
is_r
=
is
;
...
...
src/PlaylistControl.cxx
View file @
0214baad
...
@@ -226,7 +226,7 @@ playlist::SeekSongPosition(player_control &pc, unsigned song, float seek_time)
...
@@ -226,7 +226,7 @@ playlist::SeekSongPosition(player_control &pc, unsigned song, float seek_time)
}
}
queued
=
-
1
;
queued
=
-
1
;
UpdateQueuedSong
(
pc
,
NULL
);
UpdateQueuedSong
(
pc
,
nullptr
);
return
PLAYLIST_RESULT_SUCCESS
;
return
PLAYLIST_RESULT_SUCCESS
;
}
}
...
...
src/PlaylistDatabase.cxx
View file @
0214baad
...
@@ -49,10 +49,10 @@ playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name,
...
@@ -49,10 +49,10 @@ playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name,
char
*
line
,
*
colon
;
char
*
line
,
*
colon
;
const
char
*
value
;
const
char
*
value
;
while
((
line
=
file
.
ReadLine
())
!=
NULL
&&
while
((
line
=
file
.
ReadLine
())
!=
nullptr
&&
strcmp
(
line
,
"playlist_end"
)
!=
0
)
{
strcmp
(
line
,
"playlist_end"
)
!=
0
)
{
colon
=
strchr
(
line
,
':'
);
colon
=
strchr
(
line
,
':'
);
if
(
colon
==
NULL
||
colon
==
line
)
{
if
(
colon
==
nullptr
||
colon
==
line
)
{
error
.
Format
(
playlist_database_domain
,
error
.
Format
(
playlist_database_domain
,
"unknown line in db: %s"
,
line
);
"unknown line in db: %s"
,
line
);
return
false
;
return
false
;
...
@@ -62,7 +62,7 @@ playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name,
...
@@ -62,7 +62,7 @@ playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name,
value
=
strchug_fast_c
(
colon
);
value
=
strchug_fast_c
(
colon
);
if
(
strcmp
(
line
,
"mtime"
)
==
0
)
if
(
strcmp
(
line
,
"mtime"
)
==
0
)
pm
.
mtime
=
strtol
(
value
,
NULL
,
10
);
pm
.
mtime
=
strtol
(
value
,
nullptr
,
10
);
else
{
else
{
error
.
Format
(
playlist_database_domain
,
error
.
Format
(
playlist_database_domain
,
"unknown line in db: %s"
,
line
);
"unknown line in db: %s"
,
line
);
...
...
src/PlaylistEdit.cxx
View file @
0214baad
...
@@ -59,7 +59,7 @@ playlist::AppendFile(struct player_control &pc,
...
@@ -59,7 +59,7 @@ playlist::AppendFile(struct player_control &pc,
const
char
*
path_utf8
,
unsigned
*
added_id
)
const
char
*
path_utf8
,
unsigned
*
added_id
)
{
{
Song
*
song
=
Song
::
LoadFile
(
path_utf8
,
nullptr
);
Song
*
song
=
Song
::
LoadFile
(
path_utf8
,
nullptr
);
if
(
song
==
NULL
)
if
(
song
==
nullptr
)
return
PLAYLIST_RESULT_NO_SUCH_SONG
;
return
PLAYLIST_RESULT_NO_SUCH_SONG
;
return
AppendSong
(
pc
,
song
,
added_id
);
return
AppendSong
(
pc
,
song
,
added_id
);
...
@@ -247,7 +247,7 @@ playlist::DeleteInternal(player_control &pc,
...
@@ -247,7 +247,7 @@ playlist::DeleteInternal(player_control &pc,
completely */
completely */
Stop
(
pc
);
Stop
(
pc
);
*
queued_p
=
NULL
;
*
queued_p
=
nullptr
;
}
else
if
(
current
==
(
int
)
songOrder
)
}
else
if
(
current
==
(
int
)
songOrder
)
/* there's a "current song" but we're not playing
/* there's a "current song" but we're not playing
currently - clear "current" */
currently - clear "current" */
...
...
src/PlaylistFile.cxx
View file @
0214baad
...
@@ -77,9 +77,9 @@ spl_valid_name(const char *name_utf8)
...
@@ -77,9 +77,9 @@ spl_valid_name(const char *name_utf8)
* filenames isn't going to happen, either.
* filenames isn't going to happen, either.
*/
*/
return
strchr
(
name_utf8
,
'/'
)
==
NULL
&&
return
strchr
(
name_utf8
,
'/'
)
==
nullptr
&&
strchr
(
name_utf8
,
'\n'
)
==
NULL
&&
strchr
(
name_utf8
,
'\n'
)
==
nullptr
&&
strchr
(
name_utf8
,
'\r'
)
==
NULL
;
strchr
(
name_utf8
,
'\r'
)
==
nullptr
;
}
}
static
const
Path
&
static
const
Path
&
...
@@ -144,7 +144,7 @@ LoadPlaylistFileInfo(PlaylistInfo &info,
...
@@ -144,7 +144,7 @@ LoadPlaylistFileInfo(PlaylistInfo &info,
size_t
name_length
=
strlen
(
name_fs_str
);
size_t
name_length
=
strlen
(
name_fs_str
);
if
(
name_length
<
sizeof
(
PLAYLIST_FILE_SUFFIX
)
||
if
(
name_length
<
sizeof
(
PLAYLIST_FILE_SUFFIX
)
||
memchr
(
name_fs_str
,
'\n'
,
name_length
)
!=
NULL
)
memchr
(
name_fs_str
,
'\n'
,
name_length
)
!=
nullptr
)
return
false
;
return
false
;
if
(
!
g_str_has_suffix
(
name_fs_str
,
PLAYLIST_FILE_SUFFIX
))
if
(
!
g_str_has_suffix
(
name_fs_str
,
PLAYLIST_FILE_SUFFIX
))
...
@@ -196,7 +196,7 @@ static bool
...
@@ -196,7 +196,7 @@ static bool
SavePlaylistFile
(
const
PlaylistFileContents
&
contents
,
const
char
*
utf8path
,
SavePlaylistFile
(
const
PlaylistFileContents
&
contents
,
const
char
*
utf8path
,
Error
&
error
)
Error
&
error
)
{
{
assert
(
utf8path
!=
NULL
);
assert
(
utf8path
!=
nullptr
);
if
(
spl_map
(
error
).
IsNull
())
if
(
spl_map
(
error
).
IsNull
())
return
false
;
return
false
;
...
@@ -206,7 +206,7 @@ SavePlaylistFile(const PlaylistFileContents &contents, const char *utf8path,
...
@@ -206,7 +206,7 @@ SavePlaylistFile(const PlaylistFileContents &contents, const char *utf8path,
return
false
;
return
false
;
FILE
*
file
=
FOpen
(
path_fs
,
FOpenMode
::
WriteText
);
FILE
*
file
=
FOpen
(
path_fs
,
FOpenMode
::
WriteText
);
if
(
file
==
NULL
)
{
if
(
file
==
nullptr
)
{
playlist_errno
(
error
);
playlist_errno
(
error
);
return
false
;
return
false
;
}
}
...
@@ -237,7 +237,7 @@ LoadPlaylistFile(const char *utf8path, Error &error)
...
@@ -237,7 +237,7 @@ LoadPlaylistFile(const char *utf8path, Error &error)
}
}
char
*
s
;
char
*
s
;
while
((
s
=
file
.
ReadLine
())
!=
NULL
)
{
while
((
s
=
file
.
ReadLine
())
!=
nullptr
)
{
if
(
*
s
==
0
||
*
s
==
PLAYLIST_COMMENT
)
if
(
*
s
==
0
||
*
s
==
PLAYLIST_COMMENT
)
continue
;
continue
;
...
@@ -245,7 +245,7 @@ LoadPlaylistFile(const char *utf8path, Error &error)
...
@@ -245,7 +245,7 @@ LoadPlaylistFile(const char *utf8path, Error &error)
char
*
path_utf8
;
char
*
path_utf8
;
path_utf8
=
map_fs_to_utf8
(
s
);
path_utf8
=
map_fs_to_utf8
(
s
);
if
(
path_utf8
==
NULL
)
if
(
path_utf8
==
nullptr
)
continue
;
continue
;
s
=
path_utf8
;
s
=
path_utf8
;
...
@@ -303,7 +303,7 @@ spl_clear(const char *utf8path, Error &error)
...
@@ -303,7 +303,7 @@ spl_clear(const char *utf8path, Error &error)
return
false
;
return
false
;
FILE
*
file
=
FOpen
(
path_fs
,
FOpenMode
::
WriteText
);
FILE
*
file
=
FOpen
(
path_fs
,
FOpenMode
::
WriteText
);
if
(
file
==
NULL
)
{
if
(
file
==
nullptr
)
{
playlist_errno
(
error
);
playlist_errno
(
error
);
return
false
;
return
false
;
}
}
...
@@ -362,7 +362,7 @@ spl_append_song(const char *utf8path, Song *song, Error &error)
...
@@ -362,7 +362,7 @@ spl_append_song(const char *utf8path, Song *song, Error &error)
return
false
;
return
false
;
FILE
*
file
=
FOpen
(
path_fs
,
FOpenMode
::
AppendText
);
FILE
*
file
=
FOpen
(
path_fs
,
FOpenMode
::
AppendText
);
if
(
file
==
NULL
)
{
if
(
file
==
nullptr
)
{
playlist_errno
(
error
);
playlist_errno
(
error
);
return
false
;
return
false
;
}
}
...
...
src/PlaylistFile.hxx
View file @
0214baad
...
@@ -47,7 +47,7 @@ spl_valid_name(const char *name_utf8);
...
@@ -47,7 +47,7 @@ spl_valid_name(const char *name_utf8);
/**
/**
* Returns a list of stored_playlist_info struct pointers. Returns
* Returns a list of stored_playlist_info struct pointers. Returns
*
NULL
if an error occurred.
*
nullptr
if an error occurred.
*/
*/
PlaylistVector
PlaylistVector
ListPlaylistFiles
(
Error
&
error
);
ListPlaylistFiles
(
Error
&
error
);
...
...
src/PlaylistMapper.cxx
View file @
0214baad
...
@@ -32,8 +32,8 @@ playlist_open_path(const char *path_fs, Mutex &mutex, Cond &cond,
...
@@ -32,8 +32,8 @@ playlist_open_path(const char *path_fs, Mutex &mutex, Cond &cond,
struct
input_stream
**
is_r
)
struct
input_stream
**
is_r
)
{
{
auto
playlist
=
playlist_list_open_uri
(
path_fs
,
mutex
,
cond
);
auto
playlist
=
playlist_list_open_uri
(
path_fs
,
mutex
,
cond
);
if
(
playlist
!=
NULL
)
if
(
playlist
!=
nullptr
)
*
is_r
=
NULL
;
*
is_r
=
nullptr
;
else
else
playlist
=
playlist_list_open_path
(
path_fs
,
mutex
,
cond
,
is_r
);
playlist
=
playlist_list_open_path
(
path_fs
,
mutex
,
cond
,
is_r
);
...
@@ -47,15 +47,14 @@ static SongEnumerator *
...
@@ -47,15 +47,14 @@ static SongEnumerator *
playlist_open_in_playlist_dir
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
,
playlist_open_in_playlist_dir
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
,
struct
input_stream
**
is_r
)
struct
input_stream
**
is_r
)
{
{
char
*
path_fs
;
assert
(
spl_valid_name
(
uri
));
assert
(
spl_valid_name
(
uri
));
const
Path
&
playlist_directory_fs
=
map_spl_path
();
const
Path
&
playlist_directory_fs
=
map_spl_path
();
if
(
playlist_directory_fs
.
IsNull
())
if
(
playlist_directory_fs
.
IsNull
())
return
NULL
;
return
nullptr
;
path_fs
=
g_build_filename
(
playlist_directory_fs
.
c_str
(),
uri
,
NULL
);
char
*
path_fs
=
g_build_filename
(
playlist_directory_fs
.
c_str
(),
uri
,
nullptr
);
auto
playlist
=
playlist_open_path
(
path_fs
,
mutex
,
cond
,
is_r
);
auto
playlist
=
playlist_open_path
(
path_fs
,
mutex
,
cond
,
is_r
);
g_free
(
path_fs
);
g_free
(
path_fs
);
...
@@ -74,7 +73,7 @@ playlist_open_in_music_dir(const char *uri, Mutex &mutex, Cond &cond,
...
@@ -74,7 +73,7 @@ playlist_open_in_music_dir(const char *uri, Mutex &mutex, Cond &cond,
Path
path
=
map_uri_fs
(
uri
);
Path
path
=
map_uri_fs
(
uri
);
if
(
path
.
IsNull
())
if
(
path
.
IsNull
())
return
NULL
;
return
nullptr
;
return
playlist_open_path
(
path
.
c_str
(),
mutex
,
cond
,
is_r
);
return
playlist_open_path
(
path
.
c_str
(),
mutex
,
cond
,
is_r
);
}
}
...
@@ -86,16 +85,16 @@ playlist_mapper_open(const char *uri, Mutex &mutex, Cond &cond,
...
@@ -86,16 +85,16 @@ playlist_mapper_open(const char *uri, Mutex &mutex, Cond &cond,
if
(
spl_valid_name
(
uri
))
{
if
(
spl_valid_name
(
uri
))
{
auto
playlist
=
playlist_open_in_playlist_dir
(
uri
,
mutex
,
cond
,
auto
playlist
=
playlist_open_in_playlist_dir
(
uri
,
mutex
,
cond
,
is_r
);
is_r
);
if
(
playlist
!=
NULL
)
if
(
playlist
!=
nullptr
)
return
playlist
;
return
playlist
;
}
}
if
(
uri_safe_local
(
uri
))
{
if
(
uri_safe_local
(
uri
))
{
auto
playlist
=
playlist_open_in_music_dir
(
uri
,
mutex
,
cond
,
auto
playlist
=
playlist_open_in_music_dir
(
uri
,
mutex
,
cond
,
is_r
);
is_r
);
if
(
playlist
!=
NULL
)
if
(
playlist
!=
nullptr
)
return
playlist
;
return
playlist
;
}
}
return
NULL
;
return
nullptr
;
}
}
src/PlaylistPrint.cxx
View file @
0214baad
...
@@ -149,11 +149,11 @@ playlist_provider_print(Client *client, const char *uri,
...
@@ -149,11 +149,11 @@ playlist_provider_print(Client *client, const char *uri,
SongEnumerator
&
e
,
bool
detail
)
SongEnumerator
&
e
,
bool
detail
)
{
{
Song
*
song
;
Song
*
song
;
char
*
base_uri
=
uri
!=
NULL
?
g_path_get_dirname
(
uri
)
:
NULL
;
char
*
base_uri
=
uri
!=
nullptr
?
g_path_get_dirname
(
uri
)
:
nullptr
;
while
((
song
=
e
.
NextSong
())
!=
nullptr
)
{
while
((
song
=
e
.
NextSong
())
!=
nullptr
)
{
song
=
playlist_check_translate_song
(
song
,
base_uri
,
false
);
song
=
playlist_check_translate_song
(
song
,
base_uri
,
false
);
if
(
song
==
NULL
)
if
(
song
==
nullptr
)
continue
;
continue
;
if
(
detail
)
if
(
detail
)
...
@@ -175,13 +175,13 @@ playlist_file_print(Client *client, const char *uri, bool detail)
...
@@ -175,13 +175,13 @@ playlist_file_print(Client *client, const char *uri, bool detail)
struct
input_stream
*
is
;
struct
input_stream
*
is
;
SongEnumerator
*
playlist
=
playlist_open_any
(
uri
,
mutex
,
cond
,
&
is
);
SongEnumerator
*
playlist
=
playlist_open_any
(
uri
,
mutex
,
cond
,
&
is
);
if
(
playlist
==
NULL
)
if
(
playlist
==
nullptr
)
return
false
;
return
false
;
playlist_provider_print
(
client
,
uri
,
*
playlist
,
detail
);
playlist_provider_print
(
client
,
uri
,
*
playlist
,
detail
);
delete
playlist
;
delete
playlist
;
if
(
is
!=
NULL
)
if
(
is
!=
nullptr
)
is
->
Close
();
is
->
Close
();
return
true
;
return
true
;
...
...
src/PlaylistQueue.cxx
View file @
0214baad
...
@@ -35,10 +35,10 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e,
...
@@ -35,10 +35,10 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e,
{
{
enum
playlist_result
result
;
enum
playlist_result
result
;
Song
*
song
;
Song
*
song
;
char
*
base_uri
=
uri
!=
NULL
?
g_path_get_dirname
(
uri
)
:
NULL
;
char
*
base_uri
=
uri
!=
nullptr
?
g_path_get_dirname
(
uri
)
:
nullptr
;
for
(
unsigned
i
=
0
;
for
(
unsigned
i
=
0
;
i
<
end_index
&&
(
song
=
e
.
NextSong
())
!=
NULL
;
i
<
end_index
&&
(
song
=
e
.
NextSong
())
!=
nullptr
;
++
i
)
{
++
i
)
{
if
(
i
<
start_index
)
{
if
(
i
<
start_index
)
{
/* skip songs before the start index */
/* skip songs before the start index */
...
@@ -47,7 +47,7 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e,
...
@@ -47,7 +47,7 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e,
}
}
song
=
playlist_check_translate_song
(
song
,
base_uri
,
secure
);
song
=
playlist_check_translate_song
(
song
,
base_uri
,
secure
);
if
(
song
==
NULL
)
if
(
song
==
nullptr
)
continue
;
continue
;
result
=
dest
->
AppendSong
(
*
pc
,
song
);
result
=
dest
->
AppendSong
(
*
pc
,
song
);
...
@@ -74,7 +74,7 @@ playlist_open_into_queue(const char *uri,
...
@@ -74,7 +74,7 @@ playlist_open_into_queue(const char *uri,
struct
input_stream
*
is
;
struct
input_stream
*
is
;
auto
playlist
=
playlist_open_any
(
uri
,
mutex
,
cond
,
&
is
);
auto
playlist
=
playlist_open_any
(
uri
,
mutex
,
cond
,
&
is
);
if
(
playlist
==
NULL
)
if
(
playlist
==
nullptr
)
return
PLAYLIST_RESULT_NO_SUCH_LIST
;
return
PLAYLIST_RESULT_NO_SUCH_LIST
;
enum
playlist_result
result
=
enum
playlist_result
result
=
...
@@ -83,7 +83,7 @@ playlist_open_into_queue(const char *uri,
...
@@ -83,7 +83,7 @@ playlist_open_into_queue(const char *uri,
dest
,
pc
,
secure
);
dest
,
pc
,
secure
);
delete
playlist
;
delete
playlist
;
if
(
is
!=
NULL
)
if
(
is
!=
nullptr
)
is
->
Close
();
is
->
Close
();
return
result
;
return
result
;
...
...
src/PlaylistRegistry.cxx
View file @
0214baad
...
@@ -57,7 +57,7 @@ const struct playlist_plugin *const playlist_plugins[] = {
...
@@ -57,7 +57,7 @@ const struct playlist_plugin *const playlist_plugins[] = {
#endif
#endif
&
cue_playlist_plugin
,
&
cue_playlist_plugin
,
&
embcue_playlist_plugin
,
&
embcue_playlist_plugin
,
NULL
nullptr
};
};
/** which plugins have been initialized successfully? */
/** which plugins have been initialized successfully? */
...
@@ -71,18 +71,18 @@ static bool playlist_plugins_enabled[G_N_ELEMENTS(playlist_plugins)];
...
@@ -71,18 +71,18 @@ static bool playlist_plugins_enabled[G_N_ELEMENTS(playlist_plugins)];
* Find the "playlist" configuration block for the specified plugin.
* Find the "playlist" configuration block for the specified plugin.
*
*
* @param plugin_name the name of the playlist plugin
* @param plugin_name the name of the playlist plugin
* @return the configuration block, or
NULL
if none was configured
* @return the configuration block, or
nullptr
if none was configured
*/
*/
static
const
struct
config_param
*
static
const
struct
config_param
*
playlist_plugin_config
(
const
char
*
plugin_name
)
playlist_plugin_config
(
const
char
*
plugin_name
)
{
{
const
struct
config_param
*
param
=
NULL
;
const
struct
config_param
*
param
=
nullptr
;
assert
(
plugin_name
!=
NULL
);
assert
(
plugin_name
!=
nullptr
);
while
((
param
=
config_get_next_param
(
CONF_PLAYLIST_PLUGIN
,
param
))
!=
NULL
)
{
while
((
param
=
config_get_next_param
(
CONF_PLAYLIST_PLUGIN
,
param
))
!=
nullptr
)
{
const
char
*
name
=
param
->
GetBlockValue
(
"name"
);
const
char
*
name
=
param
->
GetBlockValue
(
"name"
);
if
(
name
==
NULL
)
if
(
name
==
nullptr
)
FormatFatalError
(
"playlist configuration without 'plugin' name in line %d"
,
FormatFatalError
(
"playlist configuration without 'plugin' name in line %d"
,
param
->
line
);
param
->
line
);
...
@@ -90,7 +90,7 @@ playlist_plugin_config(const char *plugin_name)
...
@@ -90,7 +90,7 @@ playlist_plugin_config(const char *plugin_name)
return
param
;
return
param
;
}
}
return
NULL
;
return
nullptr
;
}
}
void
void
...
@@ -98,7 +98,7 @@ playlist_list_global_init(void)
...
@@ -98,7 +98,7 @@ playlist_list_global_init(void)
{
{
const
config_param
empty
;
const
config_param
empty
;
for
(
unsigned
i
=
0
;
playlist_plugins
[
i
]
!=
NULL
;
++
i
)
{
for
(
unsigned
i
=
0
;
playlist_plugins
[
i
]
!=
nullptr
;
++
i
)
{
const
struct
playlist_plugin
*
plugin
=
playlist_plugins
[
i
];
const
struct
playlist_plugin
*
plugin
=
playlist_plugins
[
i
];
const
struct
config_param
*
param
=
const
struct
config_param
*
param
=
playlist_plugin_config
(
plugin
->
name
);
playlist_plugin_config
(
plugin
->
name
);
...
@@ -127,23 +127,23 @@ playlist_list_open_uri_scheme(const char *uri, Mutex &mutex, Cond &cond,
...
@@ -127,23 +127,23 @@ playlist_list_open_uri_scheme(const char *uri, Mutex &mutex, Cond &cond,
char
*
scheme
;
char
*
scheme
;
SongEnumerator
*
playlist
=
nullptr
;
SongEnumerator
*
playlist
=
nullptr
;
assert
(
uri
!=
NULL
);
assert
(
uri
!=
nullptr
);
scheme
=
g_uri_parse_scheme
(
uri
);
scheme
=
g_uri_parse_scheme
(
uri
);
if
(
scheme
==
NULL
)
if
(
scheme
==
nullptr
)
return
NULL
;
return
nullptr
;
for
(
unsigned
i
=
0
;
playlist_plugins
[
i
]
!=
NULL
;
++
i
)
{
for
(
unsigned
i
=
0
;
playlist_plugins
[
i
]
!=
nullptr
;
++
i
)
{
const
struct
playlist_plugin
*
plugin
=
playlist_plugins
[
i
];
const
struct
playlist_plugin
*
plugin
=
playlist_plugins
[
i
];
assert
(
!
tried
[
i
]);
assert
(
!
tried
[
i
]);
if
(
playlist_plugins_enabled
[
i
]
&&
plugin
->
open_uri
!=
NULL
&&
if
(
playlist_plugins_enabled
[
i
]
&&
plugin
->
open_uri
!=
nullptr
&&
plugin
->
schemes
!=
NULL
&&
plugin
->
schemes
!=
nullptr
&&
string_array_contains
(
plugin
->
schemes
,
scheme
))
{
string_array_contains
(
plugin
->
schemes
,
scheme
))
{
playlist
=
playlist_plugin_open_uri
(
plugin
,
uri
,
playlist
=
playlist_plugin_open_uri
(
plugin
,
uri
,
mutex
,
cond
);
mutex
,
cond
);
if
(
playlist
!=
NULL
)
if
(
playlist
!=
nullptr
)
break
;
break
;
tried
[
i
]
=
true
;
tried
[
i
]
=
true
;
...
@@ -161,21 +161,21 @@ playlist_list_open_uri_suffix(const char *uri, Mutex &mutex, Cond &cond,
...
@@ -161,21 +161,21 @@ playlist_list_open_uri_suffix(const char *uri, Mutex &mutex, Cond &cond,
const
char
*
suffix
;
const
char
*
suffix
;
SongEnumerator
*
playlist
=
nullptr
;
SongEnumerator
*
playlist
=
nullptr
;
assert
(
uri
!=
NULL
);
assert
(
uri
!=
nullptr
);
suffix
=
uri_get_suffix
(
uri
);
suffix
=
uri_get_suffix
(
uri
);
if
(
suffix
==
NULL
)
if
(
suffix
==
nullptr
)
return
NULL
;
return
nullptr
;
for
(
unsigned
i
=
0
;
playlist_plugins
[
i
]
!=
NULL
;
++
i
)
{
for
(
unsigned
i
=
0
;
playlist_plugins
[
i
]
!=
nullptr
;
++
i
)
{
const
struct
playlist_plugin
*
plugin
=
playlist_plugins
[
i
];
const
struct
playlist_plugin
*
plugin
=
playlist_plugins
[
i
];
if
(
playlist_plugins_enabled
[
i
]
&&
!
tried
[
i
]
&&
if
(
playlist_plugins_enabled
[
i
]
&&
!
tried
[
i
]
&&
plugin
->
open_uri
!=
NULL
&&
plugin
->
suffixes
!=
NULL
&&
plugin
->
open_uri
!=
nullptr
&&
plugin
->
suffixes
!=
nullptr
&&
string_array_contains
(
plugin
->
suffixes
,
suffix
))
{
string_array_contains
(
plugin
->
suffixes
,
suffix
))
{
playlist
=
playlist_plugin_open_uri
(
plugin
,
uri
,
playlist
=
playlist_plugin_open_uri
(
plugin
,
uri
,
mutex
,
cond
);
mutex
,
cond
);
if
(
playlist
!=
NULL
)
if
(
playlist
!=
nullptr
)
break
;
break
;
}
}
}
}
...
@@ -190,12 +190,12 @@ playlist_list_open_uri(const char *uri, Mutex &mutex, Cond &cond)
...
@@ -190,12 +190,12 @@ playlist_list_open_uri(const char *uri, Mutex &mutex, Cond &cond)
playlist_list_open_uri_scheme() */
playlist_list_open_uri_scheme() */
bool
tried
[
G_N_ELEMENTS
(
playlist_plugins
)
-
1
];
bool
tried
[
G_N_ELEMENTS
(
playlist_plugins
)
-
1
];
assert
(
uri
!=
NULL
);
assert
(
uri
!=
nullptr
);
memset
(
tried
,
false
,
sizeof
(
tried
));
memset
(
tried
,
false
,
sizeof
(
tried
));
auto
playlist
=
playlist_list_open_uri_scheme
(
uri
,
mutex
,
cond
,
tried
);
auto
playlist
=
playlist_list_open_uri_scheme
(
uri
,
mutex
,
cond
,
tried
);
if
(
playlist
==
NULL
)
if
(
playlist
==
nullptr
)
playlist
=
playlist_list_open_uri_suffix
(
uri
,
mutex
,
cond
,
playlist
=
playlist_list_open_uri_suffix
(
uri
,
mutex
,
cond
,
tried
);
tried
);
...
@@ -205,37 +205,37 @@ playlist_list_open_uri(const char *uri, Mutex &mutex, Cond &cond)
...
@@ -205,37 +205,37 @@ playlist_list_open_uri(const char *uri, Mutex &mutex, Cond &cond)
static
SongEnumerator
*
static
SongEnumerator
*
playlist_list_open_stream_mime2
(
struct
input_stream
*
is
,
const
char
*
mime
)
playlist_list_open_stream_mime2
(
struct
input_stream
*
is
,
const
char
*
mime
)
{
{
assert
(
is
!=
NULL
);
assert
(
is
!=
nullptr
);
assert
(
mime
!=
NULL
);
assert
(
mime
!=
nullptr
);
playlist_plugins_for_each_enabled
(
plugin
)
{
playlist_plugins_for_each_enabled
(
plugin
)
{
if
(
plugin
->
open_stream
!=
NULL
&&
if
(
plugin
->
open_stream
!=
nullptr
&&
plugin
->
mime_types
!=
NULL
&&
plugin
->
mime_types
!=
nullptr
&&
string_array_contains
(
plugin
->
mime_types
,
mime
))
{
string_array_contains
(
plugin
->
mime_types
,
mime
))
{
/* rewind the stream, so each plugin gets a
/* rewind the stream, so each plugin gets a
fresh start */
fresh start */
is
->
Seek
(
0
,
SEEK_SET
,
IgnoreError
());
is
->
Seek
(
0
,
SEEK_SET
,
IgnoreError
());
auto
playlist
=
playlist_plugin_open_stream
(
plugin
,
is
);
auto
playlist
=
playlist_plugin_open_stream
(
plugin
,
is
);
if
(
playlist
!=
NULL
)
if
(
playlist
!=
nullptr
)
return
playlist
;
return
playlist
;
}
}
}
}
return
NULL
;
return
nullptr
;
}
}
static
SongEnumerator
*
static
SongEnumerator
*
playlist_list_open_stream_mime
(
struct
input_stream
*
is
,
const
char
*
full_mime
)
playlist_list_open_stream_mime
(
struct
input_stream
*
is
,
const
char
*
full_mime
)
{
{
assert
(
full_mime
!=
NULL
);
assert
(
full_mime
!=
nullptr
);
const
char
*
semicolon
=
strchr
(
full_mime
,
';'
);
const
char
*
semicolon
=
strchr
(
full_mime
,
';'
);
if
(
semicolon
==
NULL
)
if
(
semicolon
==
nullptr
)
return
playlist_list_open_stream_mime2
(
is
,
full_mime
);
return
playlist_list_open_stream_mime2
(
is
,
full_mime
);
if
(
semicolon
==
full_mime
)
if
(
semicolon
==
full_mime
)
return
NULL
;
return
nullptr
;
/* probe only the portion before the semicolon*/
/* probe only the portion before the semicolon*/
char
*
mime
=
g_strndup
(
full_mime
,
semicolon
-
full_mime
);
char
*
mime
=
g_strndup
(
full_mime
,
semicolon
-
full_mime
);
...
@@ -247,24 +247,24 @@ playlist_list_open_stream_mime(struct input_stream *is, const char *full_mime)
...
@@ -247,24 +247,24 @@ playlist_list_open_stream_mime(struct input_stream *is, const char *full_mime)
static
SongEnumerator
*
static
SongEnumerator
*
playlist_list_open_stream_suffix
(
struct
input_stream
*
is
,
const
char
*
suffix
)
playlist_list_open_stream_suffix
(
struct
input_stream
*
is
,
const
char
*
suffix
)
{
{
assert
(
is
!=
NULL
);
assert
(
is
!=
nullptr
);
assert
(
suffix
!=
NULL
);
assert
(
suffix
!=
nullptr
);
playlist_plugins_for_each_enabled
(
plugin
)
{
playlist_plugins_for_each_enabled
(
plugin
)
{
if
(
plugin
->
open_stream
!=
NULL
&&
if
(
plugin
->
open_stream
!=
nullptr
&&
plugin
->
suffixes
!=
NULL
&&
plugin
->
suffixes
!=
nullptr
&&
string_array_contains
(
plugin
->
suffixes
,
suffix
))
{
string_array_contains
(
plugin
->
suffixes
,
suffix
))
{
/* rewind the stream, so each plugin gets a
/* rewind the stream, so each plugin gets a
fresh start */
fresh start */
is
->
Seek
(
0
,
SEEK_SET
,
IgnoreError
());
is
->
Seek
(
0
,
SEEK_SET
,
IgnoreError
());
auto
playlist
=
playlist_plugin_open_stream
(
plugin
,
is
);
auto
playlist
=
playlist_plugin_open_stream
(
plugin
,
is
);
if
(
playlist
!=
NULL
)
if
(
playlist
!=
nullptr
)
return
playlist
;
return
playlist
;
}
}
}
}
return
NULL
;
return
nullptr
;
}
}
SongEnumerator
*
SongEnumerator
*
...
@@ -275,29 +275,29 @@ playlist_list_open_stream(struct input_stream *is, const char *uri)
...
@@ -275,29 +275,29 @@ playlist_list_open_stream(struct input_stream *is, const char *uri)
is
->
LockWaitReady
();
is
->
LockWaitReady
();
const
char
*
const
mime
=
is
->
GetMimeType
();
const
char
*
const
mime
=
is
->
GetMimeType
();
if
(
mime
!=
NULL
)
{
if
(
mime
!=
nullptr
)
{
auto
playlist
=
playlist_list_open_stream_mime
(
is
,
mime
);
auto
playlist
=
playlist_list_open_stream_mime
(
is
,
mime
);
if
(
playlist
!=
NULL
)
if
(
playlist
!=
nullptr
)
return
playlist
;
return
playlist
;
}
}
suffix
=
uri
!=
NULL
?
uri_get_suffix
(
uri
)
:
NULL
;
suffix
=
uri
!=
nullptr
?
uri_get_suffix
(
uri
)
:
nullptr
;
if
(
suffix
!=
NULL
)
{
if
(
suffix
!=
nullptr
)
{
auto
playlist
=
playlist_list_open_stream_suffix
(
is
,
suffix
);
auto
playlist
=
playlist_list_open_stream_suffix
(
is
,
suffix
);
if
(
playlist
!=
NULL
)
if
(
playlist
!=
nullptr
)
return
playlist
;
return
playlist
;
}
}
return
NULL
;
return
nullptr
;
}
}
bool
bool
playlist_suffix_supported
(
const
char
*
suffix
)
playlist_suffix_supported
(
const
char
*
suffix
)
{
{
assert
(
suffix
!=
NULL
);
assert
(
suffix
!=
nullptr
);
playlist_plugins_for_each_enabled
(
plugin
)
{
playlist_plugins_for_each_enabled
(
plugin
)
{
if
(
plugin
->
suffixes
!=
NULL
&&
if
(
plugin
->
suffixes
!=
nullptr
&&
string_array_contains
(
plugin
->
suffixes
,
suffix
))
string_array_contains
(
plugin
->
suffixes
,
suffix
))
return
true
;
return
true
;
}
}
...
@@ -311,25 +311,25 @@ playlist_list_open_path(const char *path_fs, Mutex &mutex, Cond &cond,
...
@@ -311,25 +311,25 @@ playlist_list_open_path(const char *path_fs, Mutex &mutex, Cond &cond,
{
{
const
char
*
suffix
;
const
char
*
suffix
;
assert
(
path_fs
!=
NULL
);
assert
(
path_fs
!=
nullptr
);
suffix
=
uri_get_suffix
(
path_fs
);
suffix
=
uri_get_suffix
(
path_fs
);
if
(
suffix
==
NULL
||
!
playlist_suffix_supported
(
suffix
))
if
(
suffix
==
nullptr
||
!
playlist_suffix_supported
(
suffix
))
return
NULL
;
return
nullptr
;
Error
error
;
Error
error
;
input_stream
*
is
=
input_stream
::
Open
(
path_fs
,
mutex
,
cond
,
error
);
input_stream
*
is
=
input_stream
::
Open
(
path_fs
,
mutex
,
cond
,
error
);
if
(
is
==
NULL
)
{
if
(
is
==
nullptr
)
{
if
(
error
.
IsDefined
())
if
(
error
.
IsDefined
())
g_warning
(
"%s"
,
error
.
GetMessage
());
g_warning
(
"%s"
,
error
.
GetMessage
());
return
NULL
;
return
nullptr
;
}
}
is
->
LockWaitReady
();
is
->
LockWaitReady
();
auto
playlist
=
playlist_list_open_stream_suffix
(
is
,
suffix
);
auto
playlist
=
playlist_list_open_stream_suffix
(
is
,
suffix
);
if
(
playlist
!=
NULL
)
if
(
playlist
!=
nullptr
)
*
is_r
=
is
;
*
is_r
=
is
;
else
else
is
->
Close
();
is
->
Close
();
...
...
src/PlaylistRegistry.hxx
View file @
0214baad
...
@@ -31,7 +31,7 @@ extern const struct playlist_plugin *const playlist_plugins[];
...
@@ -31,7 +31,7 @@ extern const struct playlist_plugin *const playlist_plugins[];
#define playlist_plugins_for_each(plugin) \
#define playlist_plugins_for_each(plugin) \
for (const struct playlist_plugin *plugin, \
for (const struct playlist_plugin *plugin, \
*const*playlist_plugin_iterator = &playlist_plugins[0]; \
*const*playlist_plugin_iterator = &playlist_plugins[0]; \
(plugin = *playlist_plugin_iterator) !=
NULL
; \
(plugin = *playlist_plugin_iterator) !=
nullptr
; \
++playlist_plugin_iterator)
++playlist_plugin_iterator)
/**
/**
...
@@ -75,7 +75,7 @@ playlist_suffix_supported(const char *suffix);
...
@@ -75,7 +75,7 @@ playlist_suffix_supported(const char *suffix);
* @param path_fs the path of the playlist file
* @param path_fs the path of the playlist file
* @param is_r on success, an input_stream object is returned here,
* @param is_r on success, an input_stream object is returned here,
* which must be closed after the playlist_provider object is freed
* which must be closed after the playlist_provider object is freed
* @return a playlist, or
NULL
on error
* @return a playlist, or
nullptr
on error
*/
*/
SongEnumerator
*
SongEnumerator
*
playlist_list_open_path
(
const
char
*
path_fs
,
Mutex
&
mutex
,
Cond
&
cond
,
playlist_list_open_path
(
const
char
*
path_fs
,
Mutex
&
mutex
,
Cond
&
cond
,
...
...
src/PlaylistSave.cxx
View file @
0214baad
...
@@ -78,7 +78,7 @@ spl_save_queue(const char *name_utf8, const struct queue *queue)
...
@@ -78,7 +78,7 @@ spl_save_queue(const char *name_utf8, const struct queue *queue)
FILE
*
file
=
FOpen
(
path_fs
,
FOpenMode
::
WriteText
);
FILE
*
file
=
FOpen
(
path_fs
,
FOpenMode
::
WriteText
);
if
(
file
==
NULL
)
if
(
file
==
nullptr
)
return
PLAYLIST_RESULT_ERRNO
;
return
PLAYLIST_RESULT_ERRNO
;
for
(
unsigned
i
=
0
;
i
<
queue
->
GetLength
();
i
++
)
for
(
unsigned
i
=
0
;
i
<
queue
->
GetLength
();
i
++
)
...
...
src/PlaylistSong.cxx
View file @
0214baad
...
@@ -38,13 +38,13 @@ static void
...
@@ -38,13 +38,13 @@ static void
merge_song_metadata
(
Song
*
dest
,
const
Song
*
base
,
merge_song_metadata
(
Song
*
dest
,
const
Song
*
base
,
const
Song
*
add
)
const
Song
*
add
)
{
{
dest
->
tag
=
base
->
tag
!=
NULL
dest
->
tag
=
base
->
tag
!=
nullptr
?
(
add
->
tag
!=
NULL
?
(
add
->
tag
!=
nullptr
?
Tag
::
Merge
(
*
base
->
tag
,
*
add
->
tag
)
?
Tag
::
Merge
(
*
base
->
tag
,
*
add
->
tag
)
:
new
Tag
(
*
base
->
tag
))
:
new
Tag
(
*
base
->
tag
))
:
(
add
->
tag
!=
NULL
:
(
add
->
tag
!=
nullptr
?
new
Tag
(
*
add
->
tag
)
?
new
Tag
(
*
add
->
tag
)
:
NULL
);
:
nullptr
);
dest
->
mtime
=
base
->
mtime
;
dest
->
mtime
=
base
->
mtime
;
dest
->
start_ms
=
add
->
start_ms
;
dest
->
start_ms
=
add
->
start_ms
;
...
@@ -56,10 +56,10 @@ apply_song_metadata(Song *dest, const Song *src)
...
@@ -56,10 +56,10 @@ apply_song_metadata(Song *dest, const Song *src)
{
{
Song
*
tmp
;
Song
*
tmp
;
assert
(
dest
!=
NULL
);
assert
(
dest
!=
nullptr
);
assert
(
src
!=
NULL
);
assert
(
src
!=
nullptr
);
if
(
src
->
tag
==
NULL
&&
src
->
start_ms
==
0
&&
src
->
end_ms
==
0
)
if
(
src
->
tag
==
nullptr
&&
src
->
start_ms
==
0
&&
src
->
end_ms
==
0
)
return
dest
;
return
dest
;
if
(
dest
->
IsInDatabase
())
{
if
(
dest
->
IsInDatabase
())
{
...
@@ -71,15 +71,15 @@ apply_song_metadata(Song *dest, const Song *src)
...
@@ -71,15 +71,15 @@ apply_song_metadata(Song *dest, const Song *src)
if
(
path_utf8
.
empty
())
if
(
path_utf8
.
empty
())
path_utf8
=
path_fs
.
c_str
();
path_utf8
=
path_fs
.
c_str
();
tmp
=
Song
::
NewFile
(
path_utf8
.
c_str
(),
NULL
);
tmp
=
Song
::
NewFile
(
path_utf8
.
c_str
(),
nullptr
);
merge_song_metadata
(
tmp
,
dest
,
src
);
merge_song_metadata
(
tmp
,
dest
,
src
);
}
else
{
}
else
{
tmp
=
Song
::
NewFile
(
dest
->
uri
,
NULL
);
tmp
=
Song
::
NewFile
(
dest
->
uri
,
nullptr
);
merge_song_metadata
(
tmp
,
dest
,
src
);
merge_song_metadata
(
tmp
,
dest
,
src
);
}
}
if
(
dest
->
tag
!=
NULL
&&
dest
->
tag
->
time
>
0
&&
if
(
dest
->
tag
!=
nullptr
&&
dest
->
tag
->
time
>
0
&&
src
->
start_ms
>
0
&&
src
->
end_ms
==
0
&&
src
->
start_ms
>
0
&&
src
->
end_ms
==
0
&&
src
->
start_ms
/
1000
<
(
unsigned
)
dest
->
tag
->
time
)
src
->
start_ms
/
1000
<
(
unsigned
)
dest
->
tag
->
time
)
/* the range is open-ended, and the playlist plugin
/* the range is open-ended, and the playlist plugin
...
@@ -100,17 +100,17 @@ playlist_check_load_song(const Song *song, const char *uri, bool secure)
...
@@ -100,17 +100,17 @@ playlist_check_load_song(const Song *song, const char *uri, bool secure)
dest
=
Song
::
NewRemote
(
uri
);
dest
=
Song
::
NewRemote
(
uri
);
}
else
if
(
g_path_is_absolute
(
uri
)
&&
secure
)
{
}
else
if
(
g_path_is_absolute
(
uri
)
&&
secure
)
{
dest
=
Song
::
LoadFile
(
uri
,
nullptr
);
dest
=
Song
::
LoadFile
(
uri
,
nullptr
);
if
(
dest
==
NULL
)
if
(
dest
==
nullptr
)
return
NULL
;
return
nullptr
;
}
else
{
}
else
{
const
Database
*
db
=
GetDatabase
(
IgnoreError
());
const
Database
*
db
=
GetDatabase
(
IgnoreError
());
if
(
db
==
nullptr
)
if
(
db
==
nullptr
)
return
nullptr
;
return
nullptr
;
Song
*
tmp
=
db
->
GetSong
(
uri
,
IgnoreError
());
Song
*
tmp
=
db
->
GetSong
(
uri
,
IgnoreError
());
if
(
tmp
==
NULL
)
if
(
tmp
==
nullptr
)
/* not found in database */
/* not found in database */
return
NULL
;
return
nullptr
;
dest
=
tmp
->
DupDetached
();
dest
=
tmp
->
DupDetached
();
db
->
ReturnSong
(
tmp
);
db
->
ReturnSong
(
tmp
);
...
@@ -136,21 +136,21 @@ playlist_check_translate_song(Song *song, const char *base_uri,
...
@@ -136,21 +136,21 @@ playlist_check_translate_song(Song *song, const char *base_uri,
else
{
else
{
/* unsupported remote song */
/* unsupported remote song */
song
->
Free
();
song
->
Free
();
return
NULL
;
return
nullptr
;
}
}
}
}
if
(
base_uri
!=
NULL
&&
strcmp
(
base_uri
,
"."
)
==
0
)
if
(
base_uri
!=
nullptr
&&
strcmp
(
base_uri
,
"."
)
==
0
)
/* g_path_get_dirname() returns "." when there is no
/* g_path_get_dirname() returns "." when there is no
directory name in the given path; clear that now,
directory name in the given path; clear that now,
because it would break the database lookup
because it would break the database lookup
functions */
functions */
base_uri
=
NULL
;
base_uri
=
nullptr
;
if
(
g_path_is_absolute
(
uri
))
{
if
(
g_path_is_absolute
(
uri
))
{
/* XXX fs_charset vs utf8? */
/* XXX fs_charset vs utf8? */
const
char
*
suffix
=
map_to_relative_path
(
uri
);
const
char
*
suffix
=
map_to_relative_path
(
uri
);
assert
(
suffix
!=
NULL
);
assert
(
suffix
!=
nullptr
);
if
(
suffix
!=
uri
)
if
(
suffix
!=
uri
)
uri
=
suffix
;
uri
=
suffix
;
...
@@ -158,15 +158,15 @@ playlist_check_translate_song(Song *song, const char *base_uri,
...
@@ -158,15 +158,15 @@ playlist_check_translate_song(Song *song, const char *base_uri,
/* local files must be relative to the music
/* local files must be relative to the music
directory when "secure" is enabled */
directory when "secure" is enabled */
song
->
Free
();
song
->
Free
();
return
NULL
;
return
nullptr
;
}
}
base_uri
=
NULL
;
base_uri
=
nullptr
;
}
}
char
*
allocated
=
NULL
;
char
*
allocated
=
nullptr
;
if
(
base_uri
!=
NULL
)
if
(
base_uri
!=
nullptr
)
uri
=
allocated
=
g_build_filename
(
base_uri
,
uri
,
NULL
);
uri
=
allocated
=
g_build_filename
(
base_uri
,
uri
,
nullptr
);
Song
*
dest
=
playlist_check_load_song
(
song
,
uri
,
secure
);
Song
*
dest
=
playlist_check_load_song
(
song
,
uri
,
secure
);
song
->
Free
();
song
->
Free
();
...
...
src/PlaylistSong.hxx
View file @
0214baad
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
struct
Song
;
struct
Song
;
/**
/**
* Verifies the song, returns
NULL
if it is unsafe. Translate the
* Verifies the song, returns
nullptr
if it is unsafe. Translate the
* song to a new song object within the database, if it is a local
* song to a new song object within the database, if it is a local
* file. The old song object is freed.
* file. The old song object is freed.
*
*
...
...
src/PlaylistState.cxx
View file @
0214baad
...
@@ -101,7 +101,7 @@ static void
...
@@ -101,7 +101,7 @@ static void
playlist_state_load
(
TextFile
&
file
,
struct
playlist
*
playlist
)
playlist_state_load
(
TextFile
&
file
,
struct
playlist
*
playlist
)
{
{
const
char
*
line
=
file
.
ReadLine
();
const
char
*
line
=
file
.
ReadLine
();
if
(
line
==
NULL
)
{
if
(
line
==
nullptr
)
{
g_warning
(
"No playlist in state file"
);
g_warning
(
"No playlist in state file"
);
return
;
return
;
}
}
...
@@ -110,7 +110,7 @@ playlist_state_load(TextFile &file, struct playlist *playlist)
...
@@ -110,7 +110,7 @@ playlist_state_load(TextFile &file, struct playlist *playlist)
queue_load_song
(
file
,
line
,
&
playlist
->
queue
);
queue_load_song
(
file
,
line
,
&
playlist
->
queue
);
line
=
file
.
ReadLine
();
line
=
file
.
ReadLine
();
if
(
line
==
NULL
)
{
if
(
line
==
nullptr
)
{
g_warning
(
"'"
PLAYLIST_STATE_FILE_PLAYLIST_END
g_warning
(
"'"
PLAYLIST_STATE_FILE_PLAYLIST_END
"' not found in state file"
);
"' not found in state file"
);
break
;
break
;
...
@@ -141,7 +141,7 @@ playlist_state_restore(const char *line, TextFile &file,
...
@@ -141,7 +141,7 @@ playlist_state_restore(const char *line, TextFile &file,
else
else
state
=
PlayerState
::
STOP
;
state
=
PlayerState
::
STOP
;
while
((
line
=
file
.
ReadLine
())
!=
NULL
)
{
while
((
line
=
file
.
ReadLine
())
!=
nullptr
)
{
if
(
g_str_has_prefix
(
line
,
PLAYLIST_STATE_FILE_TIME
))
{
if
(
g_str_has_prefix
(
line
,
PLAYLIST_STATE_FILE_TIME
))
{
seek_time
=
seek_time
=
atoi
(
&
(
line
[
strlen
(
PLAYLIST_STATE_FILE_TIME
)]));
atoi
(
&
(
line
[
strlen
(
PLAYLIST_STATE_FILE_TIME
)]));
...
...
src/PlaylistVector.cxx
View file @
0214baad
...
@@ -31,7 +31,7 @@ PlaylistVector::iterator
...
@@ -31,7 +31,7 @@ PlaylistVector::iterator
PlaylistVector
::
find
(
const
char
*
name
)
PlaylistVector
::
find
(
const
char
*
name
)
{
{
assert
(
holding_db_lock
());
assert
(
holding_db_lock
());
assert
(
name
!=
NULL
);
assert
(
name
!=
nullptr
);
return
std
::
find_if
(
begin
(),
end
(),
return
std
::
find_if
(
begin
(),
end
(),
PlaylistInfo
::
CompareName
(
name
));
PlaylistInfo
::
CompareName
(
name
));
...
...
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