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
8fca32b1
Commit
8fca32b1
authored
Jun 02, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a segfault when deleteing the last song in the playlist and sync'ing metadata from the player
git-svn-id:
https://svn.musicpd.org/mpd/trunk@1306
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
c9c6f1f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
27 deletions
+30
-27
playlist.c
src/playlist.c
+30
-27
No files found.
src/playlist.c
View file @
8fca32b1
...
@@ -71,21 +71,21 @@ typedef struct _Playlist {
...
@@ -71,21 +71,21 @@ typedef struct _Playlist {
unsigned
long
version
;
unsigned
long
version
;
}
Playlist
;
}
Playlist
;
Playlist
playlist
;
static
Playlist
playlist
;
int
playlist_state
=
PLAYLIST_STATE_STOP
;
static
int
playlist_state
=
PLAYLIST_STATE_STOP
;
int
playlist_max_length
;
static
int
playlist_max_length
;
int
playlist_stopOnError
;
static
int
playlist_stopOnError
;
int
playlist_errorCount
=
0
;
static
int
playlist_errorCount
=
0
;
int
playlist_queueError
;
static
int
playlist_queueError
;
int
playlist_noGoToNext
=
0
;
static
int
playlist_noGoToNext
=
0
;
int
playlist_saveAbsolutePaths
;
static
int
playlist_saveAbsolutePaths
;
char
*
playlist_stateFile
=
NULL
;
static
char
*
playlist_stateFile
=
NULL
;
void
swapOrder
(
int
a
,
int
b
);
static
void
swapOrder
(
int
a
,
int
b
);
int
playPlaylistOrderNumber
(
FILE
*
fp
,
int
orderNum
);
static
int
playPlaylistOrderNumber
(
FILE
*
fp
,
int
orderNum
);
void
randomizeOrder
(
int
start
,
int
end
);
static
void
randomizeOrder
(
int
start
,
int
end
);
void
incrPlaylistVersion
()
{
void
incrPlaylistVersion
()
{
static
unsigned
long
max
=
((
unsigned
long
)
1
<<
BITS_FOR_VERSION
)
-
1
;
static
unsigned
long
max
=
((
unsigned
long
)
1
<<
BITS_FOR_VERSION
)
-
1
;
...
@@ -93,6 +93,16 @@ void incrPlaylistVersion() {
...
@@ -93,6 +93,16 @@ void incrPlaylistVersion() {
if
(
playlist
.
version
>=
max
)
playlist
.
version
=
0
;
if
(
playlist
.
version
>=
max
)
playlist
.
version
=
0
;
}
}
static
void
incrPlaylistCurrent
()
{
if
(
playlist
.
current
<
0
)
return
;
if
(
playlist
.
current
>=
playlist
.
length
-
1
)
{
if
(
playlist
.
repeat
)
playlist
.
current
=
0
;
else
playlist
.
current
=
-
1
;
}
else
playlist
.
current
++
;
}
void
initPlaylist
()
{
void
initPlaylist
()
{
char
*
test
;
char
*
test
;
...
@@ -628,12 +638,15 @@ int deleteFromPlaylist(FILE * fp, int song) {
...
@@ -628,12 +638,15 @@ int deleteFromPlaylist(FILE * fp, int song) {
playerStop
(
stderr
);
playerStop
(
stderr
);
playlist_noGoToNext
=
1
;
playlist_noGoToNext
=
1
;
}
}
else
if
(
/*playlist_state!=PLAYLIST_STATE_STOP &&*/
playlist
.
current
>
songOrder
)
{
if
(
playlist
.
current
>=
playlist
.
length
)
{
incrPlaylistCurrent
();
}
else
if
(
playlist
.
current
>
songOrder
)
{
playlist
.
current
--
;
playlist
.
current
--
;
}
}
if
(
/*playlist_state!=PLAYLIST_STATE_STOP && */
playlist
.
queued
>
songOrder
)
{
if
(
playlist
.
queued
>
songOrder
)
{
playlist
.
queued
--
;
playlist
.
queued
--
;
}
}
...
@@ -745,7 +758,7 @@ void syncCurrentPlayerDecodeMetadata() {
...
@@ -745,7 +758,7 @@ void syncCurrentPlayerDecodeMetadata() {
if
(
!
songPlayer
)
return
;
if
(
!
songPlayer
)
return
;
if
(
playlist_state
!=
PLAYLIST_STATE_PLAY
);
if
(
playlist_state
!=
PLAYLIST_STATE_PLAY
)
return
;
song
=
playlist
.
songs
[
playlist
.
order
[
playlist
.
current
]];
song
=
playlist
.
songs
[
playlist
.
order
[
playlist
.
current
]];
...
@@ -775,7 +788,7 @@ int currentSongInPlaylist(FILE * fp) {
...
@@ -775,7 +788,7 @@ int currentSongInPlaylist(FILE * fp) {
syncPlaylistWithQueue
(
0
);
syncPlaylistWithQueue
(
0
);
if
(
playlist
.
current
<
playlist
.
length
)
{
if
(
playlist
.
current
>=
0
&&
playlist
.
current
<
playlist
.
length
)
{
return
playPlaylistOrderNumber
(
fp
,
playlist
.
current
);
return
playPlaylistOrderNumber
(
fp
,
playlist
.
current
);
}
}
else
return
stopPlaylist
(
fp
);;
else
return
stopPlaylist
(
fp
);;
...
@@ -783,16 +796,6 @@ int currentSongInPlaylist(FILE * fp) {
...
@@ -783,16 +796,6 @@ int currentSongInPlaylist(FILE * fp) {
return
0
;
return
0
;
}
}
void
incrPlaylistCurrent
()
{
if
(
playlist
.
current
>=
playlist
.
length
||
(
!
playlist
.
repeat
&&
playlist
.
current
==
playlist
.
length
-
1
))
{
playlist
.
current
=
-
1
;
}
else
if
(
playlist
.
current
==
playlist
.
length
-
1
)
playlist
.
current
=
0
;
else
if
(
playlist
.
current
>=
0
)
playlist
.
current
++
;
}
int
nextSongInPlaylist
(
FILE
*
fp
)
{
int
nextSongInPlaylist
(
FILE
*
fp
)
{
if
(
playlist_state
!=
PLAYLIST_STATE_PLAY
)
return
0
;
if
(
playlist_state
!=
PLAYLIST_STATE_PLAY
)
return
0
;
...
...
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